-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added missing gk_box style and few small fixes
- Loading branch information
Showing
9 changed files
with
594 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
/** | ||
* @author: GavickPro | ||
* @copyright: 2008-2012 | ||
**/ | ||
|
||
// no direct access | ||
defined('_JEXEC') or die('Restricted access'); | ||
|
||
class GKIS_Box_Image extends GKIS_Image { | ||
|
||
} | ||
|
||
/* eof */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
<?php | ||
|
||
/** | ||
* GK Image Show - main PHP file | ||
* @package Joomla! | ||
* @Copyright (C) 2009-2012 Gavick.com | ||
* @ All rights reserved | ||
* @ Joomla! is Free Software | ||
* @ Released under GNU/GPL License : http://www.gnu.org/copyleft/gpl.html | ||
* @ version $Revision: GK4 1.0 $ | ||
**/ | ||
|
||
// no direct access | ||
defined('_JEXEC') or die; | ||
// Image class loading | ||
require_once (dirname(__FILE__).DS.'class.image.php'); | ||
// Model class loading | ||
require_once (dirname(__FILE__).DS.'model.php'); | ||
|
||
class GKIS_gk_box_Controller { | ||
// configuration array | ||
private $config; | ||
// module info | ||
private $module; | ||
// article data | ||
private $articles; | ||
private $articlesK2; | ||
// constructor | ||
function __construct($module, $config) { | ||
// init the style config | ||
$this->config = $config; | ||
// init the module info | ||
$this->module = $module; | ||
// init the articles array | ||
$this->articles = array(); | ||
$this->articlesK2 = array(); | ||
// check the module images | ||
$this->checkImages(); | ||
// get the articles data | ||
$this->getArticleData(); | ||
// generate the view | ||
$this->generateView(); | ||
} | ||
// check the images | ||
function checkImages() { | ||
// if the thumbnail generation is enabled | ||
if($this->config['generate_thumbnails'] == 1) { | ||
// basic images params | ||
$img_width = $this->config['config']->gk_box->gk_box_image_width; | ||
$img_height = $this->config['config']->gk_box->gk_box_image_height; | ||
$thumb_width = $this->config['config']->gk_box->gk_box_thumb_width; | ||
$thumb_height = $this->config['config']->gk_box->gk_box_thumb_height; | ||
$img_bg = $this->config['config']->gk_box->gk_box_image_bg; | ||
$quality = $this->config['config']->gk_box->gk_box_quality; | ||
// check the slides | ||
foreach($this->config['image_show_data'] as $slide) { | ||
$stretch = ($slide->stretch == 'nostretch') ? false : true; | ||
GKIS_Box_Image::createThumbnail($slide->image, $this->config, $img_width, $img_height, $img_bg, $stretch, $quality); | ||
// Small hack to create a different width thumbnail ;) | ||
$thumb_config = $this->config; | ||
$thumb_config['module_id'] = '-thumb-' . $thumb_config['module_id']; | ||
GKIS_Box_Image::createThumbnail($slide->image, $thumb_config, $thumb_width, $thumb_height, $img_bg, $stretch, $quality); | ||
} | ||
} | ||
} | ||
// get the articles data | ||
function getArticleData() { | ||
// create the array | ||
$ids = array(); | ||
$idsK2 = array(); | ||
// generate the content of the array | ||
foreach($this->config['image_show_data'] as $slide) { | ||
if($slide->type == 'article') { | ||
if($slide->art_id) { | ||
array_push($ids, $slide->art_id); | ||
} else { | ||
array_push($ids, 0); | ||
} | ||
} | ||
|
||
if($slide->type == 'k2') { | ||
if($slide->artK2_id) { | ||
array_push($idsK2, $slide->artK2_id); | ||
} else { | ||
array_push($idsK2, 0); | ||
} | ||
} | ||
} | ||
// get the data | ||
if(count($idsK2) > 0) { | ||
$this->articlesK2 = GKIS_gk_box_Model::getDataK2($idsK2); | ||
} | ||
if(count($ids) > 0) { | ||
$this->articles = GKIS_gk_box_Model::getData($ids); | ||
} | ||
} | ||
// generate view | ||
function generateView() { | ||
// generate the head section | ||
$document = JFactory::getDocument(); | ||
$uri = JURI::getInstance(); | ||
// get the head data | ||
$headData = $document->getHeadData(); | ||
// generate keys of script section | ||
$headData_js_keys = array_keys($headData["scripts"]); | ||
// generate keys of css section | ||
$headData_css_keys = array_keys($headData["style"]); | ||
// set variables for false | ||
$engine_founded = false; | ||
$css_founded = false; | ||
// searching engine in scripts paths | ||
if(array_search($uri->root().'modules/mod_image_show_gk4/styles/'.$this->config['styles'].'/engine.js', $headData_js_keys) > 0) { | ||
$engine_founded = true; | ||
} | ||
// searching css in CSSs paths | ||
if(array_search($uri->root().'modules/mod_image_show_gk4/styles/'.$this->config['styles'].'/style.css', $headData_css_keys) > 0) { | ||
$css_founded = true; | ||
} | ||
// if mootools file doesn't exists in document head section | ||
if(!$engine_founded){ | ||
// add new script tag connected with mootools from module | ||
$document->addScript($uri->root().'modules/mod_image_show_gk4/styles/'.$this->config['styles'].'/engine.js'); | ||
} | ||
// if CSS not found | ||
if(!$css_founded && $this->config['use_style_css'] == 1) { | ||
// add stylesheets to document header | ||
$document->addStyleSheet($uri->root().'modules/mod_image_show_gk4/styles/'.$this->config['styles'].'/style.css' ); | ||
} | ||
// add script fragment | ||
$document->addScriptDeclaration('try {$Gavick;}catch(e){$Gavick = {};};$Gavick["gkIs-'.$this->config['module_id'].'"] = { "anim_speed": '.$this->config['config']->gk_box->gk_box_animation_speed.', "anim_interval": '.$this->config['config']->gk_box->gk_box_animation_interval.', "autoanim": '.$this->config['config']->gk_box->gk_box_autoanimation.', "slide_links": '.$this->config['config']->gk_box->gk_box_slide_links.' };'); | ||
// load view | ||
require(dirname(__FILE__).DS.'view.php'); | ||
} | ||
} | ||
|
||
// EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
jQuery(window).load(function () { | ||
jQuery('.gkIsWrapper-gk_box').each(function(i, el) { | ||
el = jQuery(el); | ||
var elID = el.attr("id"); | ||
var wrapper = jQuery('#' + elID); | ||
var $G = $Gavick[elID]; | ||
var slides = []; | ||
var links = []; | ||
var imagesToLoad = []; | ||
// animation variables | ||
$G['animation_timer'] = false; | ||
// blank flag | ||
$G['blank'] = false; | ||
// load the images | ||
wrapper.find('.gkIsSlide').each(function(i, el) { | ||
el = jQuery(el); | ||
var newImg = new jQuery('<img title="'+el.attr('title')+'" data-link="'+el.attr('data-link') + '" class="gkIsImage" style="z-index: '+el.css('z-index')+';" src="'+el.attr('data-path') + '">'); | ||
imagesToLoad.push(newImg); | ||
newImg.insertBefore(el); | ||
el.remove(); | ||
}); | ||
// | ||
var time = setInterval(function() { | ||
var process = 0; | ||
jQuery(imagesToLoad).each(function(i, el) { | ||
if (jQuery(el)[0].complete){ process++; } | ||
}); | ||
// | ||
if (process === imagesToLoad.length) { | ||
clearInterval(time); | ||
// | ||
$G['actual_slide'] = 0; | ||
// | ||
wrapper.find('.gkIsImage').each(function(i, elmt) { | ||
slides[i] = jQuery(elmt); | ||
links[i] = slides[i].attr('data-link'); | ||
}); | ||
// | ||
if ($G['slide_links']) { | ||
wrapper.find('.gkIsImage').on('click', function() { | ||
window.location = links[$G['actual_slide']]; | ||
}); | ||
|
||
wrapper.find('.gkIsImage').css('cursor', 'pointer'); | ||
} | ||
// | ||
wrapper.find('.gkIsPagination li').each(function(i, item) { | ||
jQuery(item).click(function() { | ||
if (i !== $G['actual_slide']) { | ||
$G['blank'] = true; | ||
gk_box_autoanimate($G, wrapper, 'next', i); | ||
} | ||
}); | ||
}); | ||
// auto-animation | ||
if ($G['autoanim'] == 1) { | ||
$G['animation_timer'] = setTimeout(function() { | ||
gk_box_autoanimate($G, wrapper, 'next', null); | ||
}, $G['anim_interval']); | ||
} | ||
} | ||
}, 250); | ||
}); | ||
}); | ||
|
||
var gk_box_animate = function($G, wrapper, imgPrev, imgNext) { | ||
// | ||
jQuery(imgNext).animate({ | ||
opacity: 1 | ||
}, $G['anim_speed'], function() { | ||
jQuery(imgPrev).removeClass('active'); | ||
jQuery(imgNext).addClass('active'); | ||
|
||
if ($G['autoanim'] == 1) { | ||
clearTimeout($G['animation_timer']); | ||
|
||
$G['animation_timer'] = setTimeout(function() { | ||
if ($G['blank']) { | ||
$G['blank'] = false; | ||
clearTimeout($G['animation_timer']); | ||
|
||
$G['animation_timer'] = setTimeout(function() { | ||
gk_box_autoanimate($G, wrapper, 'next', null); | ||
}, $G['anim_interval']); | ||
} else { | ||
gk_box_autoanimate($G, wrapper, 'next', null); | ||
} | ||
}, $G['anim_interval']); | ||
} | ||
}); | ||
|
||
jQuery(imgPrev).animate({ | ||
opacity: 0 | ||
}, $G['anim_speed']); | ||
}; | ||
|
||
var gk_box_autoanimate = function($G, wrapper, dir, next) { | ||
var i = $G['actual_slide']; | ||
var imgs = wrapper.find('.gkIsImage'); | ||
|
||
if (next == null) { | ||
next = (dir == 'next') ? ((i < imgs.length - 1) ? i + 1: 0) : ((i == 0) ? imgs.length - 1: i - 1); | ||
} | ||
|
||
gk_box_animate($G, wrapper, imgs[i], imgs[next]); | ||
$G['actual_slide'] = next; | ||
|
||
wrapper.find('.gkIsPagination li').removeClass('active'); | ||
wrapper.find('.gkIsPagination li').eq(next).addClass('active'); | ||
wrapper.find('.gkIsText li').removeClass('active'); | ||
wrapper.find('.gkIsText li').eq(next).addClass('active'); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<html><body></body></html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<style> | ||
<info> | ||
<name>gk_box</name> | ||
<author>GavickPro</author> | ||
<desc>Image Show GK4 style for Box template.</desc> | ||
<version>1.0</version> | ||
</info> | ||
<config> | ||
<field type="text" name="image_width" label="Image width" desc="Slide image width in pixels" default="780" unit="px" /> | ||
<field type="text" name="image_height" label="Image height" desc="Slide image height in pixels" default="860" unit="px" /> | ||
<field type="text" name="thumb_width" label="Thumbnail width" desc="Slide thumbnail image width in pixels" default="80" unit="px" /> | ||
<field type="text" name="thumb_height" label="Thumbnail height" desc="Slide thumbnail image height in pixels" default="92" unit="px" /> | ||
<field type="text" name="image_bg" label="Image background color" desc="Slide image background as hexdecimal value" default="#ffffff" unit="" /> | ||
<field type="text" name="quality" label="Image quality" desc="Quality of images (used in the JPG images) - percentage value between 0 and 100." default="95" unit="%" /> | ||
<field type="switch" name="show_text_block" label="Show text block" default="1" desc="You can enable showing block with slide text." class="gk_switch" /> | ||
<field type="text" name="text_block_length" label="Text block length" desc="Maximal number of chars in the text block" default="80" /> | ||
<field type="switch" name="pagination" label="Pagination" desc="You can enable showing pagination." default="1" class="gk_switch" /> | ||
<field type="switch" name="slide_links" label="Slide links" desc="You can enable links in the slides." default="1" class="gk_switch" /> | ||
<field type="text" name="animation_speed" label="Animation speed" desc="Animation speed in miliseconds" default="500" unit="ms" /> | ||
<field type="text" name="animation_interval" label="Animation interval" desc="Animation interval in miliseconds" default="5000" unit="ms" /> | ||
<field type="switch" name="autoanimation" label="Autoanimation" desc="Autoanimation of the slides" default="1" class="gk_switch" /> | ||
</config> | ||
</style> |
Oops, something went wrong.