Example #1
0
 /**
  * @global gantry used to access the core Gantry class
  * @param  $name
  * @param  $value
  * @param  $node
  * @param  $control_name
  * @return void
  */
 function fetchElement($name, $value, &$node, $control_name)
 {
     global $gantry;
     $output = "";
     $document =& JFactory::getDocument();
     $arrayList = "'" . implode("', '", explode(",", str_replace(" ", "", $node->attributes('default')))) . "'";
     if (!defined('GANTRY_ADMIN')) {
         include_once dirname(dirname(__FILE__)) . '/../gantry.php';
         gantry_import('core.gantrybrowser');
         $browser = new GantryBrowser();
         $gantry_created_dirs = array($gantry->custom_dir, $gantry->custom_menuitemparams_dir);
         $this->template = end(explode(DS, $gantry->templatePath));
         gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry.css');
         if ($browser->name == 'ie' && $browser->version == '7' && file_exists($gantry->gantryPath . DS . 'admin' . DS . 'widgets' . DS . 'gantry-ie7.css')) {
             gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry-ie7.css');
         }
         gantry_addScript($gantry->gantryUrl . '/admin/widgets/gantry.js');
         gantry_addInlineScript("var GantrySlideList = [" . $arrayList . "];var AdminURI = '" . JURI::base() . "';var UnallowedParams = ['" . implode("', '", $gantry->dontsetinmenuitem) . '\'];');
         gantry_addInlineScript($this->gantryLang());
         // fixes Firefox < 3.7 input line-height issue
         if ($browser->name == 'firefox' && $browser->version < '3.7' || $browser->name == 'ie' && $browser->version > '6') {
             $css = ".text-short, .text-medium, .text-long, .text-color {padding-top: 4px;height:19px;}";
             gantry_addInlineStyle($css);
         }
         if ($browser->name == 'ie' && $browser->shortversion == '7') {
             $css = "\n\t\t\t\t\t.g-surround, .g-inner, .g-surround > div {zoom: 1;position: relative;}\n\t\t\t\t\t.text-short, .text-medium, .text-long, .text-color {border:0 !important;}\n\t\t\t\t\t.selectbox {z-index:500;position:relative;}\n\t\t\t\t\t.group-fusionmenu, .group-splitmenu {position:relative;margin-top:0 !important;zoom:1;}\n\t\t\t\t\t.scroller .inner {position:relative;}\n\t\t\t\t\t.moor-hexLabel {display:inline-block;zoom:1;float:left;}\n\t\t\t\t\t.moor-hexLabel input {float:left;}\n\t\t\t\t";
             gantry_addInlineStyle($css);
         }
         //create dirs needed by gantry
         foreach ($gantry_created_dirs as $dir) {
             if (is_readable(dirname($dir)) && is_writeable(dirname($dir)) && !JFolder::exists($dir)) {
                 JFolder::create($dir);
             }
         }
         if (version_compare(JVERSION, '1.5.14', '<=')) {
             $tmpscripts = array();
             foreach ($document->_scripts as $script => $type) {
                 if ($script != $gantry->baseUrl . 'media/system/js/mootools.js') {
                     $tmpscripts[$script] = $type;
                 } else {
                     $tmpscripts[$gantry->gantryUrl . '/js/mootools-1.1.2.js'] = $type;
                 }
             }
             $document->_scripts = $tmpscripts;
         }
         $this->checkAjaxTool();
         define('GANTRY_ADMIN', 1);
     }
     if (file_exists($gantry->templatePath . "/gantry.scripts.php") && is_readable($gantry->templatePath . "/gantry.scripts.php")) {
         include_once $gantry->templatePath . "/gantry.scripts.php";
         if (function_exists('gantry_params_init')) {
             gantry_params_init();
         }
     }
     $this->_parent->addElementPath($gantry->templatePath . DS . 'elements');
     $this->_parent->addElementPath($gantry->templatePath . DS . 'admin/elements');
 }
Example #2
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     global $gantry;
     if (!defined('GANTRY_GRADIENT')) {
         gantry_addScript($gantry->gantryUrl . '/admin/widgets/gradient/js/gradient.js');
         define('GANTRY_GRADIENT', 1);
     }
     $functions = "_jsInit_" . $gantry->platform->getJSInit();
     gantry_addInlineScript($this->{$functions}($name, $value, $node, $control_name));
     $output = "<div id='" . $name . "' class='gradient-preview'></div>\n";
     return $output;
 }
Example #3
0
	function fetchElement($name, $value, &$node, $control_name)
	{

		global $gantry;
		
		$class = ( $node->attributes('class') ? 'class="'.$node->attributes('class').'"' : 'class="inputbox"' );
		$mode = $node->attributes('mode');
		if (!isset($mode)) $mode = 'dropdown';
		
		$options = array();
		if (!array_key_exists($name,$gantry->presets)) {
				return JText::_('Unable to find the preset information'); 
		}
		foreach ($gantry->presets[$name] as $preset_name => $preset_value)
		{
			$val	= $preset_name;
			$text	= $preset_value['name'];
			$options[] = JHTML::_('select.option', $val, JText::_($text));
		}
		
		if (!defined('GANTRY_PRESET')) {
			gantry_import('core.gantryjson');
			
			$this->template = end(explode(DS, $gantry->templatePath));
			gantry_addScript($gantry->gantryUrl.'/admin/widgets/preset/js/preset.js');
			gantry_addScript($gantry->gantryUrl.'/admin/widgets/preset/js/preset-saver.js');
			gantry_addInlineScript('var Presets = {};var PresetsKeys = {};');
			
			if (isset($gantry->customPresets[$name])) {
				gantry_addInlineScript('var CustomPresets = '.GantryJSON::encode($gantry->customPresets[$name]).';');
			}
			
			define('GANTRY_PRESET', 1);
		}

		$this->presets = $gantry->originalPresets[$name];
		gantry_addInlineScript($this->populatePresets($name));
		
		if ($mode == 'dropdown') {
			include_once('selectbox.php');
			gantry_addInlineScript("window.addEvent('domready', PresetDropdown.init.bind(PresetDropdown, '$name'));");
			$selectbox = new JElementSelectBox;
			$node->addAttribute('preset', true);
			return $selectbox->fetchElement($name, $value, $node, $control_name, $options);
		} else {
			gantry_addInlineScript("window.addEvent('domready', Scroller.init.bind(Scroller, '$name'));");
			return $this->scrollerLayout($name, $value, $node, $control_name);
		}
	}
Example #4
0
	function fetchElement($name, $value, &$node, $control_name)
	{
		//global $stylesList;
        /**
         * @global Gantry $gantry
         */
		global $gantry;
		$output = '';
		
		$this->template = end(explode(DS, $gantry->templatePath));
		
		//$styles = '../templates/'.$this->template.'/styles.php';
		//if (file_exists($styles)) include_once($styles);
		//else return "No styles file found";
		$transparent = 1;

		if ($node->attributes('transparent') == 'false') $transparent = 0;
		
        if (!defined('GANTRY_CSS')) {
			gantry_addStyle($gantry->gantryUrl.'/admin/widgets/gantry.css');
			define('GANTRY_CSS', 1);
		}
		
		if (!defined('GANTRY_MOORAINBOW')) {
			
			gantry_addStyle($gantry->gantryUrl.'/admin/widgets/colorchooser/css/mooRainbow.css');
			gantry_addScript($gantry->gantryUrl.'/admin/widgets/colorchooser/js/mooRainbow.js');
			
			//$scriptconfig  = $this->populateStyles($stylesList);
			$scriptconfig = $this->rainbowInit();
			
			gantry_addInlineScript($scriptconfig);
			
			define('GANTRY_MOORAINBOW',1);
		}
	
		$scriptconfig = $this->newRainbow($name, $transparent);
		
		gantry_addInlineScript($scriptconfig);

		$output .= "<div class='wrapper'>";
		$output .= "<input class=\"picker-input text-color\" id=\"".$control_name.$name."\" name=\"".$control_name."[".$name."]\" type=\"text\" size=\"7\" maxlength=\"11\" value=\"".$value."\" />";
		$output .= "<div class=\"picker\" id=\"myRainbow_".$name."_input\"><div class=\"overlay".(($value == 'transparent') ? ' overlay-transparent' : '')."\" style=\"background-color: ".$value."\"><div></div></div></div>\n";
		$output .= "</div>";
		//$output = false;
		
		return $output;
	}
Example #5
0
 function fetchElement($name, $value, &$node, $control_name = 'params')
 {
     global $gantry;
     $hidden = '<input type="hidden" name="' . $name . '" value="_" />';
     $options = array();
     $options[] = array('value' => 1, 'text' => 'On/Off', 'id' => $name);
     if (!defined('GANTRY_TOGGLE')) {
         $this->template = end(explode(DS, $gantry->templatePath));
         gantry_addScript($gantry->gantryUrl . '/admin/widgets/toggle/js/touch.js');
         gantry_addScript($gantry->gantryUrl . '/admin/widgets/toggle/js/toggle.js');
         define('GANTRY_TOGGLE', 1);
     }
     gantry_addInlineScript($this->toggleInit($name));
     $checked = $value == 0 ? '' : 'checked="checked"';
     return "\n\t\t<div class='wrapper'>\n\t\t\t<input name='" . $control_name . "[" . $name . "]' value='{$value}' type='hidden' />\n\t\t\t<input type='checkbox' class='toggle' id='params{$name}' {$checked} />\n\t\t</div>\n\t\t";
 }
Example #6
0
	function fetchElement($name, $value, &$node, $control_name)
	{
		global $gantry;
		$output = '';

		$this->template = end(explode(DS, $gantry->templatePath));

        $class = $node->attributes('class') ? $node->attributes('class') : '';

		if (!defined('GANTRY_CSS')) {
			gantry_addStyle($gantry->gantryUrl.'/admin/widgets/gantry.css');
			define('GANTRY_CSS', 1);
		}
        if (!defined('GANTRY_POSITIONS')) {
            gantry_addScript($gantry->gantryUrl.'/admin/widgets/slider/js/slider.js');
			if (!defined('GANTRY_SLIDER')) define('GANTRY_SLIDER', 1);
        }
		
		$this->value = $value;
		$this->children = array();
		
		foreach($node->children() as $children) {
			$this->children[] = $children->data();
		}
		
		$scriptinit = $this->sliderInit($name);		
		gantry_addInlineScript($scriptinit);
		
		$output = '
		<div class="wrapper">
		<div id="'.$name.'" class="'.$class.'">
			<!--<div class="note">
				Internet Explorer 6 supports only the <strong>Low Quality</strong> setting.
			</div>-->
			<div class="slider">
			    <div class="slider2"></div>
				<div class="knob"></div>
			</div>
			<input type="hidden" id="params'.$name.'" class="slider" name="'.$control_name.'['.$name.']'.'" value="'.$this->value.'" />
		</div>
		</div>
		';
		
		return $output;
	}
Example #7
0
    function fetchElement($name, $value, &$node, $control_name)
    {
        global $gantry;
        $output = '';
        $lis = '';
        $currentScheme = '';
        $this->template = end(explode(DS, $gantry->templatePath));
        $this->name = $name;
        $this->value = $value;
        $this->default = explode(',', str_replace(' ', '', $node->attributes('default')));
        $this->defaultCount = count($this->default);
        // [0] => schemas | [1] => words | [2] => maxgrid | [3] => type
        $opts = $node->children();
        $this->maxGrid = (int) $gantry->get('grid_system');
        if (!$this->maxGrid) {
            $this->maxGrid = 12;
        }
        $this->type = "regular";
        if (count($opts)) {
            foreach ($opts as $opt) {
                $optName = $opt->name();
                if ($optName == 'words') {
                    $this->words = explode(",", $opt->data());
                }
                if ($optName == 'schemas') {
                    $this->schemas = explode(",", $opt->data());
                }
                if ($optName == 'type') {
                    $this->type = $opt->data();
                }
            }
        }
        $this->keyName = '';
        if ($this->type == 'custom') {
            $tmpName = str_replace("Position", "Schemas", $this->name);
            $tmpSchema = $this->{$tmpName};
            $this->keyName = key($tmpSchema[1][0]);
        }
        $this->layoutSchemas = $gantry->layoutSchemas[$this->maxGrid];
        $this->defaultMainbodySchemas = $gantry->mainbodySchemas;
        $this->mainbodySchemas = $gantry->mainbodySchemasCombos[$this->maxGrid];
        if (!defined('GANTRY_CSS')) {
            gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry.css');
            define('GANTRY_CSS', 1);
        }
        if (!defined('POSITIONS')) {
            if (!defined('GANTRY_SLIDER')) {
                gantry_addScript($gantry->gantryUrl . '/admin/widgets/slider/js/slider.js');
                define('GANTRY_SLIDER', 1);
            }
            gantry_addScript($gantry->gantryUrl . '/admin/widgets/slider/js/unserialize.js');
            $functions = "generalFunctions_" . $gantry->platform->getJSInit();
            gantry_addInlineScript($this->{$functions}());
            $this->settings = array("words" => $this->words, "schemas" => $this->schemas, "maxGrid" => $this->maxGrid);
            if ($this->type == 'custom') {
                $this->customCombinations = $this->getCombinations();
            } else {
                $this->combinations = $this->getCombinations();
            }
            define('POSITIONS', 1);
        }
        $posName = $name == "mainbodyPosition" ? "sidebar" : str_replace("Position", "", $name);
        $realCount = $gantry->countModules($posName);
        if ($posName == 'sidebar') {
            $realCount += 1;
        }
        if ($realCount > 0) {
            if (!in_array($realCount, $this->schemas)) {
                $realCount = $this->schemas[0];
            }
            $this->default = $this->oneCharConversion($this->layoutSchemas[$realCount]);
            $this->defaultCount = $realCount;
        }
        // if the same type of combinations are requested, use the cached ones, otherwise get the new set
        if ($this->type != "custom" && ($this->words != $this->settings["words"] || $this->schemas != $this->settings["schemas"] || $this->maxGrid != $this->settings["maxGrid"])) {
            $this->combinations = $this->getCombinations();
        }
        if ($this->type == "custom") {
            $this->customCombinations = $this->getCombinations();
        }
        if (!in_array((string) $this->defaultCount, $this->schemas)) {
            $this->defaultCount = (int) $this->schemas[0];
        }
        foreach ($this->schemas as $scheme) {
            $active = "";
            if ((int) $scheme == $this->defaultCount) {
                $active = ' class="active"';
                $currentLayout = $scheme;
            }
            $lis .= '<li' . $active . '><a href="#"><span>' . $scheme . '</span></a></li>';
        }
        $init_function = "sliderInit_" . $gantry->platform->getJSInit();
        gantry_addInlineScript($this->{$init_function}($name));
        $output = '
		<div class="wrapper">
		<div id="' . $name . '" class="g-position">
			<div class="navigation">
				<span class="title">Positions:</span>
				<ul class="list">' . $lis . '</ul>
			</div>
			<div class="clr"></div>
			<div id="' . $name . '-wrapper" class="col' . $this->maxGrid . ' miniatures">
				<div class="mini-container layout-grid-' . $currentLayout . '">
					<div class="mini-grid mini-grid-2">a</div>
					<div class="mini-grid mini-grid-2">b</div>
					<div class="mini-grid mini-grid-2">c</div>
					<div class="mini-grid mini-grid-2">d</div>
					<div class="mini-grid mini-grid-2">e</div>
					<div class="mini-grid mini-grid-2">f</div>
				</div>
				<div class="clr"></div>
				<div class="position">
					<div class="position2"></div>
					<div class="knob"></div>
				</div>
			</div>
			<div class="current-positions">
				<span class="title">' . str_replace('%d', "<strong class='" . $name . "-currentPosition countPositions'>" . $realCount . "</strong>", JText::_('CURRENT_POSITIONS')) . '</span>
			</div>
			<div class="debug" style="display: none;">
				<span class="title">DEBUG</span>
				<div id="output"></div>
			</div>
			<input type="hidden" id="params' . $name . '" name="' . $control_name . '[' . $name . ']' . '" value=\'';
        $output .= $this->value;
        $output .= '\' />
		</div>
		</div>
		';
        return $output;
    }
Example #8
0
    function fetchElement($name, $value, &$node, $control_name)
    {
        global $gantry;
        $output = '';
        $this->template = $gantry->templateName;
        $class = $node->attributes('class') ? $node->attributes('class') : '';
        $preview = $node->attributes('preview') ? $node->attributes('preview') : "false";
        $path = $node->attributes('path') ? $node->attributes('path') : false;
        $this->default = $node->attributes('default') ? $node->attributes('default') : 'none';
        if (!$path) {
            return "No path set in templateDetails.xml";
        }
        if ($preview == 'true') {
            $class .= " overlay-slider";
        }
        if (!defined('GANTRY_CSS')) {
            gantry_addStyle($gantry->gantryUrl . '/admin/widgets/gantry.css');
            define('GANTRY_CSS', 1);
        }
        if (!defined('GANTRY_SLIDER')) {
            gantry_addScript($gantry->gantryUrl . '/admin/widgets/slider/js/slider.js');
            if (!defined('GANTRY_SLIDER')) {
                define('GANTRY_SLIDER', 1);
            }
        }
        if (!defined('GANTRY_OVERLAYS')) {
            $gantry->addInlineScript('var GantryOverlays = {};');
            define('GANTRY_OVERLAYS', 1);
        }
        $this->value = $value;
        $rootPath = str_replace("__TEMPLATE__", $gantry->templatePath, $path);
        $urlPath = str_replace("__TEMPLATE__", $gantry->templateUrl, $path);
        $this->_loadOverlays($name, $rootPath);
        $overlays = array();
        $__overlays = $gantry->retrieveTemp('overlays', 'overlays', array());
        $__paths = $gantry->retrieveTemp('overlays', 'paths', array());
        $overlays[$name] = "'none': {'file': 'overlay-off.png', 'value': 'none', 'name': 'Off', 'path': '" . $gantry->gantryUrl . "/admin/widgets/overlays/images/overlay-off.png'}, ";
        foreach ($__overlays[$name] as $title => $file) {
            $overlays[$name] .= "'" . $file['name'] . "': {'file': '" . $file['file'] . "', 'value': '" . $file['name'] . "', 'name': '" . $title . "', 'path': '" . $urlPath . $file['file'] . "'}, ";
        }
        $overlays[$name] = substr($overlays[$name], 0, -2);
        $gantry->addInlineScript('GantryOverlays["' . $name . '"] = new Hash({' . $overlays[$name] . '});');
        $init_function = "sliderInit_" . $gantry->platform->getJSInit();
        $scriptinit = $this->{$init_function}($name);
        gantry_addInlineScript($scriptinit);
        $output = '
		<div class="wrapper">
		';
        $output .= '<div class="overlay-tip">
			<div class="overlay-tip-left"></div>
			<div class="overlay-tip-mid"><span>Example</span></div>
			<div class="overlay-tip-right"></div>
		</div>';
        if ($preview == 'true') {
            $output .= '<div class="overlay-preview"><div></div></div>';
        }
        $output .= '
		<div id="' . $name . '" class="' . $class . '">
			<div class="slider">
			    <div class="slider2"></div>
				<div class="knob"></div>
			</div>
			<input type="hidden" id="params' . $name . '" class="slider" name="' . $control_name . '[' . $name . ']' . '" value="' . $this->value . '" />
		</div>
		</div>
		';
        $gantry->addTemp('overlays', 'overlays', $__overlays);
        $gantry->addTemp('overlays', 'paths', $__paths);
        return $output;
    }
Example #9
0
    function getInput()
    {
        JHTML::_('behavior.modal');
        /** @var $gantry Gantry */
        global $gantry;
        $layout = $link = $dropdown = "";
        $options = $choices = array();
        $nomargin = false;
        $rokgallery = self::checkForRokGallery();
        //$rokgallery = false; // debug
        $value = str_replace("'", '"', $this->value);
        $data = json_decode($value);
        if (!$data && strlen($value)) {
            $nomargin = true;
            $data = json_decode('{"path":"' . $value . '"}');
        }
        $preview = "";
        $preview_width = 'width="100"';
        $preview_height = 'height="70"';
        if (!$data && (!isset($data->preview) || !isset($data->path))) {
            $preview = $gantry->gantryUrl . '/admin/widgets/imagepicker/images/no-image.png';
        } else {
            if (isset($data->preview)) {
                $preview = $data->preview;
            } else {
                $preview = JURI::root(true) . '/' . $data->path;
                $preview_height = "";
            }
        }
        if (!defined('ELEMENT_RTIMAGEPICKER')) {
            $gantry->addStyle($gantry->gantryUrl . '/admin/widgets/imagepicker/css/imagepicker.css');
            gantry_addInlineScript("\n\t\t\tif (typeof jInsertEditorText == 'undefined'){\n\t\t\t\tfunction jInsertEditorText(text, editor) {\n\t\t\t\t\tvar source = text.match(/(src)=(\"[^\"]*\")/i), img;\n\t\t\t\t\ttext = source[2].replace(/\\\"/g, '');\n\t\t\t\t\timg = '" . JURI::root(true) . "/' + text;\n\n\t\t\t\t\tdocument.getElementById(editor + '-img').src = img;\n\t\t\t\t\tdocument.getElementById(editor + '-img').removeProperty('height');\n\t\t\t\t\tdocument.getElementById(editor).value = JSON.encode({path: text});\n\t\t\t\t};\n\t\t\t};\n\t\t\t");
            gantry_addInlineScript("\n\t\t\t\tvar AdminURI = '" . JURI::base(true) . "/';\n\t\t\t\tvar GalleryPickerInsertText = function(input, string, size, minithumb){\n\t\t\t\t\tvar data = {\n\t\t\t\t\t\tpath: string,\n\t\t\t\t\t\twidth: size.width,\n\t\t\t\t\t\theight: size.height,\n\t\t\t\t\t\tpreview: minithumb\n\t\t\t\t\t};\n\n\t\t\t\t\tdocument.getElementById(input + '-img').src = minithumb;\n\t\t\t\t\tdocument.getElementById(input + '-infos').innerHTML = data.width + ' x ' + data.height;\n\t\t\t\t\tdocument.getElementById(input).value = JSON.encode(data);\n\n\t\t\t\t};\n\n\t\t\t\tvar empty_background_img = '" . $gantry->gantryUrl . "/admin/widgets/imagepicker/images/no-image.png';\n\n\t\t\t");
            define('ELEMENT_RTIMAGEPICKER', true);
        }
        gantry_addInlineScript("\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t\tdocument.id('" . $this->id . "').addEvent('keyup', function(value){\n\t\t\t\t\tdocument.id('" . $this->id . "-infos').innerHTML = '';\n\t\t\t\t\tif (!value || !value.length) document.id('" . $this->id . "-img').set('src', empty_background_img);\n\t\t\t\t\telse {\n\t\t\t\t\t\tvar data = JSON.decode(value);\n\t\t\t\t\t\tdocument.id('" . $this->id . "-img').set('src', (data.preview ? data.preview : '" . JURI::root(true) . "/' + data.path));\n\t\t\t\t\t\tif (!data.preview){\n\t\t\t\t\t\t\tdocument.id('" . $this->id . "-img').removeProperty('height');\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tdocument.id('" . $this->id . "-img').set('height', '50');\n\t\t\t\t\t\t\tif (data.width && data.height) document.id('" . $this->id . "-infos').innerHTML = data.width + ' x ' + data.height;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.setProperty('value', value);\n\t\t\t\t});\n\n\t\t\t\tdocument.id('" . $this->id . "-clear').addEvent('click', function(e){\n\t\t\t\t\te.stop();\n\t\t\t\t\tdocument.id('" . $this->id . "').set('value', '').fireEvent('set', '');\n\t\t\t\t\tdocument.id('" . $this->id . "-img').src = empty_background_img;\n\t\t\t\t\tdocument.id('" . $this->id . "-infos').innerHTML = '';\n\t\t\t\t});\n\n\t\t\t\tvar dropdown = document.id('" . $this->id . "mediatype');\n\t\t\t\tif (dropdown){\n\t\t\t\t\tdropdown.addEvent('change', function(){\n\t\t\t\t\t\tdocument.id('" . $this->id . "-link').set('href', this.value);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t");
        if ($rokgallery) {
            $link = 'index.php?option=com_rokgallery&view=gallerypicker&tmpl=component&show_menuitems=0&inputfield=' . $this->id;
        } else {
            $link = "index.php?option=com_media&view=images&layout=default&tmpl=component&e_name=" . $this->id;
        }
        if ($rokgallery) {
            $choices = array(array('RokGallery', 'index.php?option=com_rokgallery&view=gallerypicker&tmpl=component&show_menuitems=0&inputfield=' . $this->id), array('MediaManager', 'index.php?option=com_media&view=images&layout=default&tmpl=component&e_name=' . $this->id));
            foreach ($choices as $option) {
                $options[] = GantryHtmlSelect::option($option[1], $option[0], 'value', 'text');
            }
            include_once $gantry->gantryPath . '/' . 'admin' . '/' . 'forms' . '/' . 'fields' . '/' . 'selectbox.php';
            $selectbox = new GantryFormFieldSelectBox();
            $selectbox->id = $this->id . 'mediatype';
            $selectbox->value = $link;
            $selectbox->addOptions($options);
            $dropdown = '<div id="' . $this->id . '-mediadropdown" class="mediadropdown">' . $selectbox->getInput() . "</div>";
        }
        $value = str_replace('"', "'", $value);
        $layout .= '
			<div class="wrapper">' . "\n" . '
				<div id="' . $this->id . '-wrapper" class="backgroundpicker">' . "\n" . '
					<img id="' . $this->id . '-img" class="backgroundpicker-img" ' . $preview_width . ' ' . $preview_height . ' alt="" src="' . $preview . '" />

					<div id="' . $this->id . '-infos" class="backgroundpicker-infos" ' . ($rokgallery && !$nomargin ? 'style="display:inline-block;"' : 'style="display:none;"') . ' >' . (isset($data->width) && isset($data->height) ? $data->width . ' x ' . $data->height : '') . '</div>


					<a id="' . $this->id . '-link" href="' . $link . '" rel="{handler: \'iframe\', size: {x: 675, y: 450}}" class="rok-button modal">' . "\n" . '
						Select
					</a>' . "\n" . '
					<a id="' . $this->id . '-clear" href="#" class="rok-button bg-button-clear">' . "\n" . '
						Reset
					</a>' . "\n" . '

					' . $dropdown . '

					<input class="background-picker" type="hidden" id="' . $this->id . '" name="' . $this->name . '" value="' . $value . '" />' . "\n" . '
					<div class="clr"></div>
				</div>' . "\n" . '
			</div>' . "\n" . '
		';
        return $layout;
    }
Example #10
0
    static function finalize(){
        //Do something here for the finalize
//        foreach (self::$instances as $instance ){
//
//            echo $instance;
//        }
// 
		gantry_addInlineScript("window.addEvent('domready', function(){ window.gantryToggles = new Toggle(); });");
    }