Exemple #1
0
	protected function fetchElement($name, $value, $node, $control_name)
	{
		$selectId = str_replace(array('[', ']'), array('_', ''), $control_name);
		$this->includeAssets();

		$containerId = uniqid('groups', false);
		$document =& JFactory::getDocument();
		$document->addScriptDeclaration(
			sprintf('window.addEvent("domready", function(){ new ARIElementGroups("%s", %s); });',
				$containerId,
				AriJSONHelper::encode(array('selectId' => $selectId))));

		return sprintf('<div id="%1$s" style="float: left; width: 100%%;" class="ari-fieldsgroup"><fieldset><legend><label for="%2$s" class="ari-fieldsgroup-lbl">%3$s</label>&nbsp;&nbsp;%4$s</legend><div>%5$s</div></fieldset></div>',
			$containerId,
			$selectId,
			JText::_((string)$node['label']),
			JHTML::_(
				'select.genericlist', 
				$this->getOptionsGroup($node), 
				$control_name, 
				'class="ari-fieldsgroup-sel"', 
				'value', 
				'text', 
				$value, 
				$selectId), 
			$this->getChildsInput($node, $value, $selectId, $control_name));
	}
	function fetchElement($name, $value, &$node, $control_name)
	{
		$this->_includeAssets();
		
		$id = $control_name . $name;
		$layout = $this->_getLayout($node, $id);
		$cssFile = $node->attributes('css_file');
		$keyField = $node->attributes('key_field');

		$document =& JFactory::getDocument();
		if (!empty($cssFile))
			$document->addStyleSheet(JURI::root(true) . $cssFile);
			
		if ($value && $control_name == 'refField_params')
			$value = html_entity_decode($value);

		$document->addScriptDeclaration(sprintf(
			'window.addEvent("domready", function(){ new ARIElementsCloner("%1$s_cloner", %2$s, %3$s, %4$s); });',
			$id,
			AriJSONHelper::encode(array('hiddenId' => $id, 'keyField' => $keyField)),
			AriJSONHelper::encode($this->_getClonerOptions($node)),
			$value ? addcslashes($value, "\n\r") : 'null'
		));
		
		return $layout 
			. '<input type="hidden" name="' . $control_name . '[' . $name . ']' . '" id="' . $id . '" value="' . str_replace('"', '&quot;', $value) . '" />';;
	}
Exemple #3
0
 function initMenu($id, $params)
 {
     $loadExtJs = (bool) $params->get('loadExtJS', true);
     $loadMethod = $params->get('loadMethod', 'ready');
     AriExtMenuHelper::loadAssets($loadExtJs);
     $defMenuConfig = array('direction' => 'horizontal', 'delay' => 0.2, 'autoWidth' => true, 'transitionType' => 'fade', 'transitionDuration' => 0.3, 'animate' => true);
     $config = array();
     foreach ($defMenuConfig as $key => $defValue) {
         $value = AriUtils::parseValueBySample($params->get($key, $defValue), $defValue);
         if ($value != $defValue) {
             $config[$key] = $value;
         }
     }
     $zIndex = intval($params->get('zIndex', -1), 10);
     if ($zIndex > 0) {
         $config['zIndex'] = $zIndex;
     }
     $doc =& JFactory::getDocument();
     if ($loadMethod == 'load') {
         $doc->addScriptDeclaration(sprintf(';Ext.EventManager.on(window, "load", function() { new Ext.ux.Menu("' . $id . '", %1$s); Ext.get("' . $id . '").select(".ux-menu-sub").removeClass("ux-menu-init-hidden"); });', AriJSONHelper::encode($config)));
     } else {
         $doc->addScriptDeclaration(sprintf(';(function() { var _menuInit = function() { new Ext.ux.Menu("' . $id . '", %1$s); Ext.get("' . $id . '").select(".ux-menu-sub").removeClass("ux-menu-init-hidden"); }; if (!Ext.isIE || typeof(MooTools) == "undefined" || typeof(MooTools.More) == "undefined") Ext.onReady(_menuInit); else window.addEvent("domready", _menuInit); })();', AriJSONHelper::encode($config)));
     }
     AriExtMenuHelper::addCustomStyles($id, $params);
 }
Exemple #4
0
 function initSlider($id, $params)
 {
     AriImageSliderHelper::includeAssets($params);
     $clientParams = AriImageSliderHelper::getClientParams($params);
     $doc = JFactory::getDocument();
     $loadMethod = $params->get('loadMethod', 'load');
     $doc->addScriptDeclaration(sprintf('%3$s(function() { var $ = window.jQueryNivoSlider || jQuery; $("#%1$s").nivoSlider(%2$s); });', $id, $clientParams ? AriJSONHelper::encode($clientParams) : '', $loadMethod == 'load' ? 'jQuery(window).load' : 'jQuery(document).ready'));
     $responsive = (bool) $params->get('responsive');
     $width = intval($params->get('width', 300), 10);
     $height = intval($params->get('height'), 10);
     if (!$responsive) {
         $styleDec = sprintf('#%1$s_wrapper,#%1$s{width:%2$dpx;height:%3$dpx;}', $id, $width, $height);
     } else {
         $styleDec = sprintf('#%1$s_wrapper{max-width:%2$dpx;}#%1$s{width:100%%;height:auto;}', $id, $width);
         $doc->addCustomTag(sprintf('<!--[if lt IE 9]><style type="text/css">BODY #%1$s_wrapper,BODY #%1$s{width:%2$dpx;height:%3$dpx;}</style><![endif]-->', $id, $width, $height));
     }
     if ($params->get('style')) {
         $extraStyles = trim($params->get('style'));
         $extraStyles = str_replace('{$id}', '#' . $id, $extraStyles);
         if (!empty($extraStyles)) {
             $styleDec .= $extraStyles;
         }
     }
     $doc->addStyleDeclaration($styleDec);
 }
 public static function initSlider($id, $params)
 {
     self::includeAssets($params);
     $clientParams = self::getClientParams($params);
     $doc = JFactory::getDocument();
     $loadMethod = $params->get('loadMethod', 'load');
     $fixTransparentBg = (bool) $params->get('fixTransparentBg');
     $animSpeed = AriUtils::getParam($clientParams, 'animSpeed', 500);
     $doc->addScriptDeclaration(sprintf('%3$s(function() { var $ = window.jQueryNivoSlider || jQuery; var opts = %2$s;%4$s $("#%1$s").nivoSlider(opts); });', $id, $clientParams ? AriJSONHelper::encode($clientParams) : '{}', $loadMethod == 'load' ? 'jQuery(window).load' : 'jQuery(document).ready', $fixTransparentBg ? sprintf('opts["beforeChange"] = function() { setTimeout(function() { $("#%1$s .nivo-main-image").animate({opacity:0}, %2$d);}, 20); }; opts["afterChange"] = function() { setTimeout(function() { $("#%1$s .nivo-main-image").css({opacity:1}); }, 20); };', $id, $animSpeed) : ''));
     $responsive = (bool) $params->get('responsive');
     $width = intval($params->get('width', 300), 10);
     $height = intval($params->get('height'), 10);
     if (!$responsive) {
         $styleDec = sprintf('#%1$s_wrapper,#%1$s{width:%2$dpx;height:%3$dpx;}', $id, $width, $height);
     } else {
         $maxWidth = $params->get('width');
         if (strpos($maxWidth, '%') === false) {
             $maxWidth = $width . 'px';
         }
         $styleDec = sprintf('#%1$s_wrapper{max-width:%2$s;}#%1$s{width:100%%;height:auto;}.ari-image-slider-loading #%1$s{height:%3$dpx;}', $id, $maxWidth, $height);
         $doc->addCustomTag(sprintf('<!--[if lt IE 8]><style type="text/css">BODY #%1$s_wrapper,BODY #%1$s{width:%2$dpx;height:%3$dpx;}</style><![endif]-->', $id, $width, $height));
     }
     if ($params->get('customstyle')) {
         $extraStyles = trim($params->get('customstyle'));
         $extraStyles = str_replace('{$id}', '#' . $id, $extraStyles);
         if (!empty($extraStyles)) {
             $styleDec .= $extraStyles;
         }
     }
     $doc->addStyleDeclaration($styleDec);
 }
	function decode($str)
	{
		if (empty($str)) return null;
		
		$jsonHandler =& AriJSONHelper::_getJSONHandler();
		
		return $jsonHandler->decode($str);
	}
Exemple #7
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $this->_includeAssets();
     $rgbColor = $this->_parseColor($value);
     $uri = $this->_getRootAssetsUri();
     $document =& JFactory::getDocument();
     $document->addScriptDeclaration(sprintf('window.addEvent("domready", function(){ var opt = %2$s; opt.onComplete = function(color) { $("%1$s").value = color.hex; }; new MooRainbow("%1$s", opt); });', $control_name . $name, AriJSONHelper::encode(array('wheel' => true, 'imgPath' => $uri . 'images/', 'id' => uniqid('cp_'), 'startColor' => $rgbColor))));
     return '<input type="text" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '" value="' . $value . '" size="10" readonly="readonly" onclick="$(window).scrollTo($(window).getScrollLeft(), $(this).getTop());" /> [<a href="javascript:void(0);" onclick="$(\'' . $control_name . $name . '\').value = \'\'; return false;">Clear</a>]';
 }
 function modifyAttrs($lnkAttrs, $imgAttrs, $group, $params)
 {
     JHTML::_('behavior.modal', 'a.modal');
     if (empty($lnkAttrs['class'])) {
         $lnkAttrs['class'] = '';
     } else {
         $lnkAttrs['class'] .= ' ';
     }
     $lnkAttrs['class'] .= 'modal';
     $link = $lnkAttrs['href'];
     if ($this->isLink($link)) {
         $lnkParams = array('handler' => 'iframe', 'size' => array('x' => $params->get('lightbox_width'), 'y' => $params->get('lightbox_height')));
         $lnkAttrs['rel'] = str_replace('"', '&quot;', AriJSONHelper::encode($lnkParams));
     }
     return parent::modifyAttrs($lnkAttrs, $imgAttrs, $group, $params);
 }
 function initSlider($id, $params)
 {
     AriImageSliderHelper::includeAssets($params);
     $clientParams = AriImageSliderHelper::getClientParams($params);
     $doc =& JFactory::getDocument();
     $doc->addScriptDeclaration(sprintf('jQuery(window).load(function() { var $ = window.jQueryNivoSlider || jQuery; $("#%1$s").nivoSlider(%2$s); });', $id, $clientParams ? AriJSONHelper::encode($clientParams) : ''));
     $width = intval($params->get('width', 300), 10);
     $height = intval($params->get('height'), 10);
     $styleDec = sprintf('#%1$s_wrapper,#%1$s{width:%2$dpx;height:%3$dpx;}', $id, $width, $height);
     if ($params->get('style')) {
         $extraStyles = trim($params->get('style'));
         $extraStyles = str_replace('{$id}', '#' . $id, $extraStyles);
         if (!empty($extraStyles)) {
             $styleDec .= $extraStyles;
         }
     }
     $doc->addStyleDeclaration($styleDec);
 }
 function modifyAttrs($lnkAttrs, $imgAttrs, $group, $params)
 {
     if ($group) {
         $lnkAttrs['rel'] = $group;
     }
     if (empty($lnkAttrs['class'])) {
         $lnkAttrs['class'] = '';
     } else {
         $lnkAttrs['class'] .= ' ';
     }
     $lnkAttrs['class'] .= 'aricolorbox';
     $link = $lnkAttrs['href'];
     if ($this->isLink($link)) {
         $lnkParams = array('iframe' => true, 'width' => $params->get('lightbox_width'), 'height' => $params->get('lightbox_height'));
         $lnkAttrs['class'] .= ' ' . str_replace('"', '&quot;', AriJSONHelper::encode($lnkParams));
     }
     return parent::modifyAttrs($lnkAttrs, $imgAttrs, $group, $params);
 }
	function includeAssets($loadJQuery, $noConflict, $jQueryVer = '1.4.4', $options = array())
	{
		static $loaded;

		if ($loaded)
			return ;

		$baseUri = JURI::root(true) . '/modules/mod_arisexylightbox/includes/js/';
		if ($loadJQuery) 
		{
			AriDocumentHelper::includeJsFile('http://ajax.googleapis.com/ajax/libs/jquery/' . $jQueryVer . '/jquery.min.js');
			
			if ($noConflict)
			{
				AriDocumentHelper::includeJsFile($baseUri . 'jquery.noconflict.js');
			}
		}
			
		AriDocumentHelper::includeJsFile($baseUri . 'jquery.easing.js');
		AriDocumentHelper::includeJsFile($baseUri . 'jquery.sexylightbox.min.js');
		
		$lang =& JFactory::getLanguage();
		if ($lang->isRTL())
			AriDocumentHelper::includeCssFile($baseUri . 'sexylightbox_rtl.css');
		
		AriDocumentHelper::includeCustomHeadTag(sprintf('<!--[if lt IE 7]><link rel="stylesheet" href="%s" type="text/css" /><![endif]-->',
			$baseUri . 'sexylightbox.ie6.css'));
		AriDocumentHelper::includeCustomHeadTag(sprintf('<link rel="stylesheet" href="%s" type="text/css" />',
			$baseUri . 'sexylightbox.css'));

		AriDocumentHelper::includeCustomHeadTag(sprintf('<!--[if IE]><link rel="stylesheet" href="%s" type="text/css" /><![endif]-->',
			$baseUri . 'sexylightbox.ie.css'));			

		$jsOptions = AriSexyLightboxHelper::getJsOptions($options);
		$document =& JFactory::getDocument();
		$document->addScriptDeclaration(sprintf(';(window["jQueryASL"] || jQuery)(document).ready(function(){ SexyLightbox.initialize(%s); });',
			!empty($jsOptions) ? AriJSONHelper::encode($jsOptions) : ''));
			
		$loaded = true;
	}
 function modifyAttrs($lnkAttrs, $imgAttrs, $group, $params)
 {
     if ($group) {
         $lnkAttrs['rel'] = $group;
     }
     if (empty($lnkAttrs['class'])) {
         $lnkAttrs['class'] = '';
     } else {
         $lnkAttrs['class'] .= ' ';
     }
     $lnkAttrs['class'] .= 'arifancybox';
     $link = $lnkAttrs['href'];
     if ($this->isLink($link)) {
         $uri = new JURI($link);
         $lnkParams = array('width' => intval($uri->getVar('width') ? $uri->getVar('width') : $params->get('lightbox_width'), 10), 'height' => intval($uri->getVar('height') ? $uri->getVar('height') : $params->get('lightbox_height'), 10));
         $lnkAttrs['class'] .= ' iframe ' . str_replace('"', '&quot;', AriJSONHelper::encode($lnkParams));
         $uri->delVar('width');
         $uri->delVar('height');
         $lnkAttrs['href'] = $uri->toString();
     }
     return parent::modifyAttrs($lnkAttrs, $imgAttrs, $group, $params);
 }
 function modifyAttrs($lnkAttrs, $imgAttrs, $group, $params)
 {
     if ($group) {
         $lnkAttrs['rel'] = $group;
     }
     if (empty($lnkAttrs['class'])) {
         $lnkAttrs['class'] = '';
     } else {
         $lnkAttrs['class'] .= ' ';
     }
     $lnkAttrs['class'] .= 'arifancybox';
     $link = $lnkAttrs['href'];
     if ($this->isLink($link)) {
         $lnkParams = array('width' => $params->get('lightbox_width'), 'height' => $params->get('lightbox_height'));
         foreach ($lnkParams as $key => $value) {
             if (strpos($value, '%') === false) {
                 $lnkParams[$key] = intval($value, 10);
             }
         }
         $lnkAttrs['class'] .= ' iframe ' . str_replace('"', '&quot;', AriJSONHelper::encode($lnkParams));
     }
     return parent::modifyAttrs($lnkAttrs, $imgAttrs, $group, $params);
 }
 function initCarousel($id, $params)
 {
     AriCloudCarouselHelper::includeAssets($params);
     $width = intval($params->get('width', 300), 10);
     $height = intval($params->get('height'), 10);
     $width .= strpos($params->get('width'), '%') !== false ? '%' : 'px';
     $clientParams = AriCloudCarouselHelper::getClientParams($params);
     $doc =& JFactory::getDocument();
     $doc->addScriptDeclaration(sprintf(';(window["jQueryCloudCarousel"] || jQuery)(document).ready(function($) { cloudCarouselInit(window.jQueryCloudCarousel || $, "#%1$s", "%3$s", $.extend(%2$s, {"buttonLeft": $("#%1$s_wrapper .ari-cloud-carousel-left"), "buttonRight": $("#%1$s_wrapper .ari-cloud-carousel-right"), "titleBox": $("#%1$s_wrapper .ari-cloud-carousel-title"), "altBox": $("#%1$s_wrapper .ari-cloud-carousel-alt")}),%4$s); });', $id, $clientParams ? AriJSONHelper::encode($clientParams) : '{}', $width, (bool) $params->get('openOnlyActive', false) ? 'true' : 'false'));
     $styleDec = sprintf('#%1$s_wrapper,#%1$s{width:%2$s;height:%3$dpx;}', $id, $width, $height);
     if ($params->get('customstyle')) {
         $extraStyles = trim($params->get('customstyle'));
         $extraStyles = str_replace('{$id}', '#' . $id, $extraStyles);
         if (!empty($extraStyles)) {
             $styleDec .= $extraStyles;
         }
     }
     $bgImage = $params->get('bgImage');
     if ($bgImage) {
         $styleDec .= sprintf('#%1$s_wrapper{background:transparent url(%2$s) no-repeat center center;}', $id, AriUtils::isRemoteResource($bgImage) ? $bgImage : JURI::root(true) . '/' . $bgImage);
     }
     $doc->addStyleDeclaration($styleDec);
 }
Exemple #15
0
	function fetchElement($name, $value, &$node, $control_name)
	{
		$selectId = $control_name . $name;
		$this->_addGroupAttrs($node, $value, $selectId);
		$parent =& $this->_parent;
		$childParameter = new JParameterGroups($parent->_raw);
		
		$paths = $parent->_elementPath;
		if (is_array($paths))
			foreach ($paths as $path)
				$childParameter->addElementPath($path);

		$childParameter->setXML($node);
		$this->_includeAssets();

		$containerId = uniqid('groups', false);
		$document =& JFactory::getDocument();
		$document->addScriptDeclaration(
			sprintf('window.addEvent("domready", function(){ new ARIElementGroups("%s", %s); });',
				$containerId,
				AriJSONHelper::encode(array('selectId' => $selectId))));
				
		return sprintf('<div id="%1$s"><fieldset><legend><label for="%2$s">%3$s</label>&nbsp;&nbsp;%4$s</legend><div>%5$s</div></fieldset></div>',
			$containerId,
			$selectId,
			JText::_($node->attributes('label')),
			JHTML::_(
				'select.genericlist', 
				$this->_getOptionsGroup($node), 
				$control_name . '[' . $name . ']', 
				'inputbox', 
				'value', 
				'text', 
				$value, 
				$selectId), 
			$childParameter->render($control_name));
	}
	function initMenu($id, $menu, $currentMenu, $activeTopId, $hlCurrentItem, $params)
	{
		$safeMode = (bool)$params->get('safeMode', true);
		AriYUIMenuHelper::loadAssets($id, $safeMode);
		
		$menuId = $id . '_menu';
		$direction = $params->get('direction', 'horizontal');
		$isVertical = ($direction != 'horizontal');
		$selectedIndex = $hlCurrentItem 
			? AriYUIMenuHelper::getMenuItemIndex($menu, $currentMenu, $activeTopId, (bool)$params->get('showHiddenItems', false))
			: -1;

		$defMenuConfig = array(
			'zIndex' => 0,
			'classname' => '',
			'hidedelay' => 0,
			'maxheight' => 0,
			'minscrollheight' => 90,
			'scrollincrement' => 1,
			'showdelay' => 250
		);

		$config = array(
			'lazyLoad' => true, 
			'autosubmenudisplay' => true, 
			'position' => 'static'
		);
		foreach ($defMenuConfig as $key => $defValue)
		{
			$value = AriUtils::parseValueBySample($params->get($key, $defValue), $defValue);
			if ($value != $defValue) $config[$key] = $value;
		}
		
		$submenuAlign = $params->get('submenualignment');
		if (!empty($submenuAlign))
		{
			$submenuAlign = explode(',', $submenuAlign);
			$submenuAlign = array_map('trim', $submenuAlign);
	
			$config['submenualignment'] = $submenuAlign;	
		}
		
		$doc =& JFactory::getDocument();
		
		$doc->addScriptDeclaration(
			sprintf(
				'YAHOO.util.Event.onContentReady("' . $menuId . '", function () { var oMenu = new YAHOO.widget.%3$s("' . $menuId . '", %1$s); oMenu.render(); oMenu.show(); if (%2$d > -1) oMenu.getItem(%2$d).cfg.setProperty("selected", true); });',
				AriJSONHelper::encode($config),
				$selectedIndex,
				$isVertical ? 'Menu' : 'MenuBar'
			)
		);
		
		AriYUIMenuHelper::addCustomStyles($id, $params);
	}