Пример #1
0
    function fetchElement($name, $value, &$node, $control_name)
    {
        if ($node['secret'] && !JRequest::getBool($node['secret'])) {
            return null;
        }
        $order = $node['order'] == 'after' ? 'after' : 'before';
        $label = $node['label'] ? $node['label'] : 'Layout Parameters';
        $doc =& JFactory::getDocument();
        $style = "\n\t\t#{$control_name}{$name}-tabs {\n\t\t\tborder-top-width: 0px;\n\t\t\tborder-right-width: 0px;\n\t\t\tborder-bottom-width: 0px;\n\t\t\tborder-left-width: 0px;\n\t\t}";
        $doc->addStyleDeclaration($style);
        $id = JRequest::getInt('id');
        if (!$id) {
            $id = reset(JRequest::getVar('cid', array()));
        }
        $db =& JFactory::getDBO();
        $query = 'SELECT params' . ' FROM #__modules' . ' WHERE id =' . $id;
        $db->setQuery($query);
        $values = $db->loadResult();
        //Get the module name, in a slightly hacky way.
        $module = JRequest::getWord('module');
        $mod =& JTable::getInstance('Module', 'JTable');
        if ($id) {
            $mod->load($id);
            $modname = $mod->module;
        } elseif ($module) {
            $modname = $module;
        }
        nimport('napi.html.parameter');
        $load = new NParameter($values, JPATH_ROOT . DS . 'modules' . DS . $modname . DS . $modname . '.xml');
        if (!$node->children()) {
            $content = $load->renderFieldset('params', $value, $node['suffix']);
            $container = $node['panel'] ? "\n\t\t\t<div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>\n\t\t\t\t<h3 class='title jpane-toggler' id='{$name}-page'>\n\t\t\t\t\t<span>" . JFilterOutput::ampReplace($label) . "</span>\n\t\t\t\t</h3>\n\t\t\t\t<div class='jpane-slider ui-widget-content content' style='background:transparent;'>{$content}</div>\n\t\t\t</div>" : " <div id='{$control_name}{$name}'>{$content}</div>";
            $script = "\n\t\t\t\tjQuery.noConflict();\n\t \n\t\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t\t\t});\n\t\t\t\t";
            $doc->addScriptDeclaration($script);
        } else {
            $content = null;
            $panel = null;
            $title = null;
            $container = $node['panel'] ? " <div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>" : " <div id='{$control_name}{$name}'>";
            $opt['useCookie'] = $node['cookie'] ? '\'' . $node['cookie'] . '\'' : null;
            JHTML::script('tabs.js');
            $panel .= JPaneTabs::startPane($control_name . $name . 'tabs');
            foreach ($node->children() as $group) {
                $content = $load->renderFieldset('params', $group['value'], $node['suffix']);
                $title .= $node['panel'] ? ' <span>' . JFilterOutput::ampReplace($group->data()) . '</span>' : JFilterOutput::ampReplace($group->data());
                $panel .= $node['panel'] ? JPaneTabs::startPanel(JFilterOutput::ampReplace($group->data()), $group['value']) . $content . JPaneTabs::endPanel() : $content;
            }
            $panel .= JPaneTabs::endPane();
            $container .= $node['panel'] ? '<h3 class="title jpane-toggler" id="' . $value . '-page"><span>' . JFilterOutput::ampReplace($label) . '</span></h3>
					<div class="jpane-slider jpane-current ui-widget-content content" style="background:transparent;">' . $panel . '</div>
				</div>' : $panel . '</div>';
            JHTML::script('accordion.fix.js', 'media/napi/js/');
            JHTML::script('tabs.fix.js', 'media/napi/js/');
            $script = "\n\t\tjQuery.noConflict();\n \n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t});";
            $doc->addScriptDeclaration($script);
            $doc->addStyleDeclaration('.jpane-current div.current { padding: 0px 0px; border-width:0px; border-top-width:1px;}');
        }
        return $container;
    }
    function fetchElement($name, $value, &$node, $control_name)
    {
        if ($node['secret'] && !JRequest::getBool($node['secret'])) {
            return null;
        }
        $order = $node['order'] == 'after' ? 'after' : 'before';
        $label = $node['label'] ? $node['label'] : 'Layout Parameters';
        $doc =& JFactory::getDocument();
        $style = "\n\t\t#{$control_name}{$name}-tabs {\n\t\t\tborder-top-width: 0px;\n\t\t\tborder-right-width: 0px;\n\t\t\tborder-bottom-width: 0px;\n\t\t\tborder-left-width: 0px;\n\t\t}";
        $doc->addStyleDeclaration($style);
        $id = JRequest::getInt('id');
        if (!$id) {
            $id = reset(JRequest::getVar('cid', array()));
        }
        $db =& JFactory::getDBO();
        $query = 'SELECT params' . ' FROM #__modules' . ' WHERE id =' . $id;
        $db->setQuery($query);
        $values = $db->loadResult();
        //Get the module name, in a slightly hacky way.
        $module = JRequest::getWord('module');
        $mod =& JTable::getInstance('Module', 'JTable');
        if ($id) {
            $mod->load($id);
            $modname = $mod->module;
        } elseif ($module) {
            $modname = $module;
        }
        nimport('napi.html.parameter');
        $load = new NParameter($values, JPATH_ROOT . DS . 'modules' . DS . $modname . DS . $modname . '.xml');
        if (!$node->children()) {
            $content = $load->renderFieldset('params', $value, $node['suffix']);
            $container = $node['panel'] ? "\n\t\t\t<div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>\n\t\t\t\t<h3 class='title jpane-toggler' id='{$name}-page'>\n\t\t\t\t\t<span>" . JFilterOutput::ampReplace($label) . "</span>\n\t\t\t\t</h3>\n\t\t\t\t<div class='jpane-slider ui-widget-content content' style='background:transparent;'>{$content}</div>\n\t\t\t</div>" : " <div id='{$control_name}{$name}'>{$content}</div>";
            $script = "\n\t\t\t\tjQuery.noConflict();\n\t \n\t\t\t\tjQuery(document).ready(function(\$){\n\t\t\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t\t\t});\n\t\t\t\t";
            $doc->addScriptDeclaration($script);
        } else {
            $content = null;
            $panel = null;
            $title = null;
            $container = $node['panel'] ? " <div id='{$control_name}{$name}' class='panel ui-widget ui-widget-content'>" : " <div id='{$control_name}{$name}'>";
            $opt['useCookie'] = $node['cookie'] ? '\'' . $node['cookie'] . '\'' : null;
            JHTML::script('tabs.js');
            $panel .= JPaneTabs::startPane($control_name . $name . 'tabs');
            foreach ($node->children() as $group) {
                $content = $load->renderFieldset('params', $group['value'], $node['suffix']);
                $title .= $node['panel'] ? ' <span>' . JFilterOutput::ampReplace($group->data()) . '</span>' : JFilterOutput::ampReplace($group->data());
                $panel .= $node['panel'] ? JPaneTabs::startPanel(JFilterOutput::ampReplace($group->data()), $group['value']) . $content . JPaneTabs::endPanel() : $content;
            }
            $panel .= JPaneTabs::endPane();
            $container .= $node['panel'] ? '<h3 class="title jpane-toggler" id="' . $value . '-page"><span>' . JFilterOutput::ampReplace($label) . '</span></h3>
					<div class="jpane-slider jpane-current ui-widget-content content" style="background:transparent;">' . $panel . '</div>
				</div>' : $panel . '</div>';
            $script = "\n\t\tjQuery.noConflict();\n \n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').closest('.pane-sliders > .panel').{$order}(\$('#{$control_name}{$name}'));\n\t\t});\n\t\t\t\t\n\t\t\t\t\n\t\twindow.addEvent('domready', function(){ \n\t\t\t\n\t\t\tvar dur = 600;\n\t\t\tvar trans = Fx.Transitions.Quad.easeInOut;\n\t\t\tvar el = \$\$('#{$control_name}{$name} div.jpane-slider').getFirst();\n\t\t\tvar fx = new Fx.Styles(el, {duration: dur, transition: trans});\n\t\t\t\n\t\t\t\$\$('dl.tabs').each(function(tabs){ new JTabs(tabs, {\n\t\t\tonActive: function(title, description){\n                description.effects({duration: dur, transition: trans}).start({'opacity': 1, 'height': description.getSize().scrollSize.y});\n                title.addClass('open').removeClass('closed');\n\t            el.effects({duration: dur, transition: trans}).start({'height': description.getSize().scrollSize.y + title.getParent().getSize().scrollSize.y + title.getParent().getStyle('margin-top').toInt()});\n            },\n            onBackground: function(title, description){\n            \tdescription.effects({duration: dur, transition: trans}).start({'opacity': 0});\n            \tdescription.effects({duration: dur, transition: trans}).start({'height': 0});\n                title.addClass('closed').removeClass('open');\n            },\n            cookie: 'showcase'}); }); \n        });";
            $doc->addScriptDeclaration($script);
            $doc->addStyleDeclaration('.jpane-current div.current { padding: 0px 0px; border-width:0px; border-top-width:1px;}');
        }
        return $container;
    }
Пример #3
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     nimport('napi.plugin');
     $values = $this->_parent->_raw;
     $doc = JFactory::getDocument();
     $db =& JFactory::getDBO();
     $db->setQuery('SELECT element, name FROM #__napi_plugins WHERE published = 1 AND folder = ' . $db->Quote($node['plugin'] ? $node['plugin'] : 'content') . ' ORDER BY ordering, name, id');
     $params = $control_name . $name . 'loadHere';
     $plugin = $control_name . $name . 'update';
     $n = $control_name . $name;
     if ($node['option']) {
         $option = $node['option'];
     } else {
         switch (JRequest::getCmd('option')) {
             case 'com_modules':
             case 'com_plugins':
             case 'com_templates':
                 $option = 'com_napi';
                 break;
             default:
                 $option = JRequest::getInt('com_napi') ? JRequest::getCmd('option') : 'com_napi';
                 break;
         }
     }
     $seeJson = $node['debug'] ? "\$('{$n}" . "seeJson').setProperty('href', {$n}" . "url);" : "";
     $getxmlpath = JText::sprintf($node['getxmlpath'] ? $node['getxmlpath'] : '%s.tmpl.', 'mod_ninjashowcase');
     $varvalue = '\'+' . $n . 'value';
     $urlformat = $node['urlformat'] ? $node['urlformat'] : 'index.php?option=com_modules&format=cli&cli[update]=' . $n . 'desc&cli[getxmlpath]=%s';
     $urlparams = $node['urlparams'] ? explode($node['urlparamseparator'] ? $node['urlparamseparator'] : ',', $node['urlparams']) : array('option', 'getxmlpath', 'varvalue');
     $url = str_replace(array(), array(), 'index.php?option=com_napi&format=cli&view=theme&layout=params&cli[update]=' . $n . 'desc&cli[getxmlpath]=%s');
     JHTML::_('cli.render', 'params', array('trigger' => $n, 'url' => '\\\'' . $url . '\'+$(\'' . $n . '\').value', 'trigger_url' => '\\\'' . $url . '\'+this.value', 'control_name' => $control_name, 'bind' => $values, 'loadOnInit' => true));
     $doc->addScriptDeclaration("\nwindow.addEvent('domready', function() {\n\n//\tvar {$n}" . "parent = \$('{$n}').getParent().getParent();\n//\tvar scriptObj;\n//\tvar {$n}" . "prev;\n//\tvar {$n} = \$('{$n}');\n//\tvar {$n}" . "value = {$n}.value;\n//\tvar {$n}" . "url = '{$url};\n//\tvar {$n}" . "data = '" . json_encode(explode("\n", $values)) . "';\n//\t\n//\tfunction {$plugin}(plugin) {\n//\t\tif(\$('{$n}" . "desc')) \$('{$n}" . "desc').remove();\n//\t\tvar el = new Element('div', {'id': '{$n}" . "desc', 'class': 'paramlist_json'});\n//\t\tel.setHTML(plugin.html);\n//\t\t\$('{$n}').fireEvent('update');\n//\t\tel.injectAfter({$n}" . "parent);\n//\t\ti = 0;\n//\t\tif({$n}" . "prev)\n//\t\t{\n//\t\t\t{$n}" . "prev.each(function(old){\n//\t\t\t\told.remove();\n//\t\t\t});\n//\t\t}\n//\t\tif(plugin.scripts)\n//\t\t{\n//\t\t\tplugin.scripts.each(function(script){\n//\t\t\t\tscriptObj = Json.evaluate(script);\n//\t\t\t\tnew Asset.javascript(scriptObj.src, {'type': scriptObj.type, 'class': '{$n}" . "temp'});\n//\t\t\t});\n//\t\t}\n//\t\tif(plugin.styles)\n//\t\t{\n//\t\t\tplugin.styles.each(function(style){\n//\t\t\t\tstyleObj = Json.evaluate(style);\n//\t\t\t\tnew Asset.css(styleObj.href, {'class': '{$n}" . "temp'});\n//\t\t\t});\n//\t\t}\n//\t\t{$n}" . "prev = \$\$('.{$n}" . "temp');\n\t\t//update({$n}" . "parent);\n//\t};\n//\t\n//\t{$n}.addEvent('change', function(e) {\n//\t\te = new Event(e).stop();\n//\t\t{$n}" . "value = this.value;\n//\t\t{$n}" . "url = '{$url};\n//\t\tvar {$n}" . "request = new Json.Remote({$n}" . "url, {\n//\t\t\tonComplete: function(jsonObj) {\n//\t\t\t\t{$plugin}(jsonObj);\n//\t\t\t\t" . $seeJson . "\n//\t\t\t}\n//\t\t}).send({'bind': {$n}" . "data});\n//\t});\n//\t\n//\tvar {$n}" . "startrequest = new Json.Remote({$n}" . "url, {\n//\t\t\tonComplete: function(jsonObj) {\n//\t\t\t\t{$plugin}(jsonObj);\n//\t\t\t}\n//\t}).send({'bind': {$n}" . "data});\n});");
     $arr = $db->loadObjectList();
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     $path = $this->_parent->_path ? dirname($this->_parent->_path) : false;
     $path = $node['path'] ? JPATH_ROOT . DIRECTORY_SEPARATOR . $node['path'] : $path;
     if (!$path) {
         $this->_nopath = true;
     }
     $path = $path . DS . ($node['folder'] ? $node['folder'] : 'tmpl');
     $files = JFolder::files($path, '.xml');
     foreach ($files as $file) {
         $template = new stdClass();
         $xml =& JFactory::getXMLParser('Simple');
         $xml->loadFile($path . DS . $file);
         $template->value = JFile::stripExt($file);
         $template->text = $xml->document->name[0]->data();
         $templates[] = $template;
     }
     if ($node['trigger'] == 'error') {
         $obj = new stdClass();
         $obj->value = 'triggererrorevent';
         $obj->text = 'Trigger Error';
         $templates[] = $obj;
     }
     $label = $node['label'] ? $node['label'] : $name;
     $description = $node['description'];
     $output = '<label id="' . $control_name . $name . '-lbl" for="' . $control_name . $name . '"';
     if ($description) {
         $output .= ' class="hasTip" title="' . JText::_($label) . '::' . JText::_($description) . '">';
     } else {
         $output .= '>';
     }
     $output .= JText::_($label) . '</label>';
     $html = $this->_nopath ? JText::_('Path isn\'t set. Either use NParameter instead of JParameter, or set the path to the template folder with the "path" attribute.') : JHTML::_('select.genericlist', $templates, '' . $control_name . '[' . $name . ']', 'class="inputbox"', 'value', 'text', $value, $control_name . $name);
     return '<p class="paramlist_item"><span class="editlinktip">' . $output . '</span><span class="paramlist_input">' . $html . '</span>' . '<div id="' . $n . 'desc" class="paramlist_json"></div>';
 }
Пример #4
0
 function html($html, $node, $start = null, $end = null, $panes = array())
 {
     global $option;
     $doc =& JFactory::getDocument();
     //$doc->addScript(JURI::root(true).'/media/napi/js/accordion.fix.js');
     //$doc->addScript(JURI::root(true).'/media/napi/js/tabs.fix.js');
     switch (get_class($this->_parent)) {
         default:
         case 'JParameter':
             $start = '</td></tr></table></div></div></div>';
             $parent = $this->_parent;
             $xml = $parent->_xml;
             $params = new NParameter($parent);
             nimport('napi.html.pane');
             $pane = NPane::getInstance('sliders');
             //$start .= $pane->startPane($node['id']?$node['id']:( $node['name'] ? $node['name'] : $node['type'] ).'-pane');
             foreach ($params->_xml as $group => $object) {
                 if ($object->attributes($option) != 'hide' && ($object['if'] ? $this->checkIf($object) : true) && $group != '_default') {
                     //Create default title
                     $title = JText::sprintf($object['title'] ? $object['title'] : '%s Parameters', ucwords($object['group']));
                     //Create tabtitle
                     $tabtitle = JText::sprintf($object['tabtitle'] ? $object['tabtitle'] : '%s', ucwords($object['group']));
                     //Check a new sliders instance is started
                     if ($object['sliders'] != 'end' && $object['sliders']) {
                         $sliders = NPane::getInstance('sliders');
                         $html .= $sliders->startPane($group . '-pane');
                     }
                     //Check a new slider instance is started
                     if (($object['slider'] !== 'false' && $object['slider'] != 'end' || $object['slider'] == 'start' && $object['slider']) && $sliders) {
                         $html .= $sliders->startPanel($title, $object['id'] ? $object['id'] : $group . '-page');
                     }
                     //Check a new tabs instance is started
                     if ($object['tabs'] != 'end' && $object['tabs']) {
                         $tabs = NPane::getInstance('tabs', array('useCookie' => '\'' . $node['name'] . '\''));
                         $html .= $tabs->startPane($group . '-pane');
                     }
                     //Check a new tab instance is started
                     if (($object['tab'] !== 'false' && $object['tab'] != 'end' || $object['tab'] == 'start' && $object['tab']) && isset($tabs)) {
                         $html .= $tabs->startPanel($tabtitle, $object['id'] ? $object['id'] : $group . '-page');
                     }
                     //							if($object['panel'])
                     //							{
                     //								$html .= $pane->endPane();
                     //								$id = !$object['id']?$group.'-pane':$object['id'];
                     //								$html .= $pane->startPane($id);
                     //							}
                     //$html .= $pane->startPanel(JText::sprintf($object['title']?$object['title']:'%s Parameters', ucwords($object['group'])), $object['id']?$object['id']:$group.'-page');
                     $html .= $object['render'] == 'inline' ? $params->renderInline('params', $group) : $params->renderFieldset('params', $group);
                     //$html .= $pane->endPanel();
                     //Check a new tab instance is ended
                     if (($object['tab'] !== 'false' && $object['tab'] != 'start' || $object['tab'] == 'end' && $object['tab']) && isset($tabs)) {
                         $html .= $tabs->endPanel();
                     }
                     //Check if tabs instance is ended
                     if ($object['tabs'] != 'start' && $object['tabs'] && isset($tabs)) {
                         $html .= $tabs->endPane();
                         unset($tabs);
                     }
                     //Check a new slider instance is ended
                     if (($object['slider'] !== 'false' && $object['slider'] != 'start' || $object['slider'] == 'end' && $object['slider']) && $sliders) {
                         $html .= $sliders->endPanel();
                     }
                     //Check if sliders instance is ended
                     if ($object['sliders'] != 'start' && $object['sliders'] && $sliders) {
                         $html .= $sliders->endPane();
                         unset($sliders);
                     }
                 }
             }
             //					gettype($html)!='array' ? $html = array() : '';
             //					foreach($this->_panels as $group => $panel)
             //					{
             //						if($group=='sliders'||$group=='tabs')
             //						{
             //							$html[] = $$group->startPane($group.'-pane');
             //							foreach($panel as $innergroup => $innerpanel)
             //							{
             //								$html[] = $$group->startPanel(JText::_('Parameters '.$innergroup), $innergroup);
             //$html[] = $pane->startPane($test.'-pane');
             //								if($innergroup=='sliders'||$innergroup=='tabs')
             //								{
             //									$html[] = $$innergroup->startPane($innergroup.'-panse');
             //									foreach($innerpanel as $childgroup => $childpanel)
             //									{
             //										$html[] = $$innergroup->startPanel($childgroup, $childgroup.'ss');
             //$html[] = $pane->startPane($test.'-pane');
             //										$html[] = $this->_groups[$childgroup];
             //$me = 'sliders';
             //die('<pre>'.print_r($$me->startPanel('me'), true).'</pre>');
             //										$html[] = $$innergroup->endPanel();
             //									}
             //									$html[] = $$innergroup->endPane();
             //								} else {
             //
             //									$html[] = $this->_groups[$innergroup];
             //								}
             //								$html[] = $$group->endPanel();
             //							}
             //$me = 'sliders';
             //die('<pre>'.print_r($$me->startPanel('me'), true).'</pre>');
             //							$html[] = $$group->endPane();
             //						}
             //					}
             //die('<pre>'.print_r($this->_panels, true).'</pre>');
             //$end .= $pane->endPane();
             $params->_napi = true;
             $this->_parent->_napi = true;
             //$start .= print_r($params);
             //$end .= '<pre>'.print_r($this->_parent, true).'</pre>';
             JHTML::_('behavior.mootools');
             $doc->addStyleDeclaration('#menu-pane, #deletediv { display:none; }');
             $doc->addScriptDeclaration('window.addEvent(\'domready\', function(){ $(\'deletediv\').remove(); $(\'menu-pane\').remove(); });');
             $end = '<div id="deletediv"><div><div><table><tr><td class="paramlist_value">';
             break;
         case 'NParameter':
             break;
     }
     return $start . $html . $end;
 }
Пример #5
0
 function fetchElement($name, $value, &$node, $control_name)
 {
     $doc =& JFactory::getDocument();
     $doc->addScript(JURI::root(true) . "/media/napi/js/styleswitchertool.js");
     $label = JText::_($node['label'] ? $node['label'] : 'Select Style');
     $copy = $node['copy'];
     $thumbpath = $node['thumbpath'] ? JURI::root(true) . $node['thumbpath'] : JURI::root(true) . '/media/napi/img/tmpl/';
     $stylepath = $node['stylepath'] ? JURI::root(true) . $node['stylepath'] : JURI::root(true) . '/media/napi/css/widgets/';
     $script = "\n\t\tjQuery.noConflict();\n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').styleswitcher({loadTheme: '{$value}', stylepane: '<div class=\"jquery-ui-styleswitcher\"><div id=\"themeGallery\">\t<ul>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/ui-lightness/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_ui_light.png\" alt=\"UI Lightness\" title=\"UI Lightness\" />\t\t\t<span class=\"styleName\">Lightness</span>\t\t</a></li>\t\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/ui-darkness/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_ui_dark.png\" alt=\"UI Darkness\" title=\"UI Darkness\" />\t\t\t<span class=\"styleName\">UI darkness</span>\t\t</a></li>\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/smoothness/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_smoothness.png\" alt=\"Smoothness\" title=\"Smoothness\" />\t\t\t<span class=\"styleName\">Smoothness</span>\t\t</a></li>\t\t\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/start/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_start_menu.png\" alt=\"Start\" title=\"Start\" />\t\t\t<span class=\"styleName\">Start</span>\t\t</a></li>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/redmond/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_windoze.png\" alt=\"Redmond\" title=\"Redmond\" />\t\t\t<span class=\"styleName\">Redmond</span>\t\t</a></li>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/cupertino/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_cupertino.png\" alt=\"Cupertino\" title=\"Cupertino\" />\t\t\t<span class=\"styleName\">Cupertino</span>\t\t\t\t</a></li>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/south-street/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_south_street.png\" alt=\"South St\" title=\"South St\" />\t\t\t<span class=\"styleName\">South Street</span>\t\t\t\t</a></li>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/blitzer/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_blitzer.png\" alt=\"Blitzer\" title=\"Blitzer\" />\t\t\t<span class=\"styleName\">Blitzer</span>\t\t</a></li>\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/humanity/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_humanity.png\" alt=\"Humanity\" title=\"Humanity\" />\t\t\t<span class=\"styleName\">Humanity</span>\t\t</a></li>\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/hot-sneaks/jquery-ui.css\">\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_hot_sneaks.png\" alt=\"Hot Sneaks\" title=\"Hot Sneaks\" />\t\t\t<span class=\"styleName\">Hot sneaks</span>\t\t</a></li>\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/excite-bike/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_excite_bike.png\" alt=\"Excite Bike\" title=\"Excite Bike\" />\t\t\t<span class=\"styleName\">Excite Bike</span>\t\t\t</a></li>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/vader/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_black_matte.png\" alt=\"Vader\" title=\"Vader\" />\t\t\t<span class=\"styleName\">Vader</span>\t\t\t</a></li>\t\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/dot-luv/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_dot_luv.png\" alt=\"Dot Luv\" title=\"Dot Luv\" />\t\t\t<span class=\"styleName\">Dot Luv</span>\t\t\t</a></li>\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/mint-choc/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_mint_choco.png\" alt=\"Mint Choc\" title=\"Mint Choc\" />\t\t\t<span class=\"styleName\">Mint Choc</span>\t\t</a></li>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/black-tie/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_black_tie.png\" alt=\"Black Tie\" title=\"Black Tie\" />\t\t\t<span class=\"styleName\">Black Tie</span>\t\t</a></li>\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/trontastic/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_trontastic.png\" alt=\"Trontastic\" title=\"Trontastic\" />\t\t\t<span class=\"styleName\">Trontastic</span>\t\t\t</a></li>\t\t\t<li><a href=\"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.0/themes/swanky-purse/jquery-ui.css\">\t\t\t<img src=\"http://static.jquery.com/ui/themeroller/images/themeGallery/theme_30_swanky_purse.png\" alt=\"Swanky Purse\" title=\"Swanky Purse\" />\t\t\t<span class=\"styleName\">Swanky Purse</span>\t\t\t</a></li>\t</ul></div></div>',\n\t\t\tbutPreText: ' ', initialText: '{$label}', cookieName: '{$name}', onSelect: function(href){ \$('#{$control_name}{$name}" . "_value').val(href); }}).find('a.jquery-ui-themeswitcher-trigger').bind('filterstyle', {foo: 'bar'}, {$name}){\n\t\t\t\t\$('.ui-styleswitcher', \$('#{$control_name}{$name}')).filterable(filterVal, 'ui-styleswitcher');\n\t\t\t});\n\t\t});";
     $html = null;
     $select = null;
     //$doc->addScriptDeclaration($script);
     jimport('joomla.filesystem.folder');
     jimport('joomla.filesystem.file');
     nimport('napi.html.parameter');
     $id = JRequest::getInt('id');
     if (!$id) {
         $id = reset(JRequest::getVar('cid', array()));
     }
     //Get the module name, in a slightly hacky way.
     $module = JRequest::getWord('module');
     $mod =& JTable::getInstance('Module', 'JTable');
     if ($id) {
         $mod->load($id);
         $modname = $mod->module;
     } elseif ($module) {
         $modname = $module;
     }
     // path to images directory
     $path = $node['directory'] ? JPATH_ROOT . DS . $node['directory'] : JPATH_ROOT . DS . 'templates';
     $filter = $node['filter'];
     $exclude = $node['exclude'];
     $folders = JFolder::folders($path, $filter);
     if ($copy) {
         foreach ($this->_parent->_xml as $_xml) {
             foreach ($_xml->children() as $children) {
                 if (isset($children->_attributes['name'])) {
                     if ($children->_attributes['name'] === $copy) {
                         //echo print_r($children->children());
                         //echo print_r($key, true).' => '.print_r($val, true).' ';
                         foreach ($children->children() as $key => $val) {
                             $options->name = $val->_data;
                             $options->filter = JFilterOutput::stringURLSafe($val->_data);
                             $options->filename = $val->_attributes['value'];
                             //$html .= $options->thumb = $val->_attributes['thumbnail'];
                             $html .= ' <li class="ui-styleswitcher l-' . JFilterOutput::stringURLSafe($val->_data) . '"><a href="' . $stylepath . $val->_attributes['value'] . '.css"><img class="ui-styleswitcher-thumb" src="' . $thumbpath . $val->_attributes['thumbnail'] . '" alt=\\"' . $val->_data . '\\" title=\\"' . $val->_data . '\\" /><span class=\\"styleName\\">--' . JText::_('Default') . '--</span></a></li>';
                             //								Children, for sublayouts in more complex plugins.
                             //								echo print_r($val->children());
                             foreach ($folders as $folder) {
                                 if ($exclude) {
                                     if (preg_match(chr(1) . $exclude . chr(1), $folder)) {
                                         continue;
                                     }
                                 }
                                 if (JFile::exists($path . DS . $folder . DS . 'templateDetails.xml')) {
                                     $templateDetails = new NParameter('', $path . DS . $folder . DS . 'templateDetails.xml');
                                     // Set base path
                                     $templateDetails->_elementPath[] = JPATH_PLUGINS . DS . 'system' . DS . 'napi' . DS . 'elements';
                                     //$templateDetails 	= new NParameter('', $path.DS.'ja_purity_showcase'.DS.'templateDetails.xml');
                                     //die('<pre>'.var_export($templateDetails, true).'</pre>');
                                     $stylexml = $templateDetails->renderToArray('', $modname);
                                     if (!isset($stylexml[$name])) {
                                         /*$stylexml = new NParameter(null);
                                         		$tylexml  = $stylexml->loadArray(array (
                                         		  0 => 'stylepicker',
                                         		  1 => 
                                         		  array (
                                         		    0 => 
                                         		    JSimpleXMLElement::__set_state(array(
                                         		       '_attributes' => 
                                         		      array (
                                         		        'value' => '3dcarousel',
                                         		        'file' => '3dcarousel',
                                         		      ),
                                         		       '_name' => 'option',
                                         		       '_data' => 'Vertical',
                                         		       '_children' => 
                                         		      array (
                                         		      ),
                                         		       '_level' => 3,
                                         		       '_errors' => 
                                         		      array (
                                         		      ),
                                         		    )),
                                         		    1 => 
                                         		    JSimpleXMLElement::__set_state(array(
                                         		       '_attributes' => 
                                         		      array (
                                         		        'value' => 'spacegallery',
                                         		        'file' => 'spacegallery_dark',
                                         		      ),
                                         		       '_name' => 'option',
                                         		       '_data' => 'Dark',
                                         		       '_children' => 
                                         		      array (
                                         		      ),
                                         		       '_level' => 3,
                                         		       '_errors' => 
                                         		      array (
                                         		      ),
                                         		    )),
                                         		    2 => 
                                         		    JSimpleXMLElement::__set_state(array(
                                         		       '_attributes' => 
                                         		      array (
                                         		        'value' => 'spacegallery',
                                         		        'file' => 'spacegallery_light',
                                         		      ),
                                         		       '_name' => 'option',
                                         		       '_data' => 'Light',
                                         		       '_children' => 
                                         		      array (
                                         		      ),
                                         		       '_level' => 3,
                                         		       '_errors' => 
                                         		      array (
                                         		      ),
                                         		    )),
                                         		  ),
                                         		  2 => NULL,
                                         		  3 => 'stylepicker',
                                         		  4 => NULL,
                                         		  5 => 'stylepicker',
                                         		));*/
                                     }
                                     //die('<pre>'.print_r($stylexml, true).'</pre>');
                                     if (isset($stylexml[$name])) {
                                         foreach ($stylexml[$name][1] as $style) {
                                             if ($style->_attributes['value'] == $val->_attributes['value']) {
                                                 $css = '';
                                                 $html .= ' <li class=\\"ui-styleswitcher l-' . JFilterOutput::stringURLSafe($val->_data) . '\\"><a href=\\"' . JURI::root(true) . '/templates/' . $folder . '/html/' . $modname . '/' . $val->_attributes['value'] . '/' . (isset($style->_attributes['file']) ? $style->_attributes['file'] : $style->_attributes['value']) . '.css\\">			<img class=\\"ui-styleswitcher-thumb\\" src=\\"' . JURI::root(true) . '/templates/' . $folder . '/html/' . $modname . '/' . $val->_attributes['value'] . '/' . (isset($style->_attributes['file']) ? $style->_attributes['file'] : $style->_attributes['value']) . '.png\\" alt=\\"' . $style->_data . '\\" title=\\"' . $style->_data . '\\" />			<span class=\\"styleName\\">' . $style->_data . '</span>			</a></li>';
                                                 $select .= ' l-' . JFilterOutput::stringURLSafe($val->_data);
                                                 $select .= ' l-' . $val->_data;
                                             }
                                         }
                                         //die('<pre>'.$styles[0][0]->_attributes['value'].'</pre>');
                                     } else {
                                         if (!isset($nostyle)) {
                                             $nostyle = true;
                                             $css = '';
                                             $html .= ' &#xFEFF;';
                                             $select .= ' l-&#xFEFF;';
                                         }
                                     }
                                     //die($path.DS.$folder.DS.'templateDetails.xml');
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $reset = $node['resetitem'] && $node['reseton'] ? '$(\'' . $node['resetitem'] . '\').livequery(\'' . $node['reseton'] . '\', function(){ $(\'#' . $control_name . $name . ' .jquery-ui-styleswitcher-title\').text(\'' . $label . '\'); });' : '';
     $script = "\n\t\tjQuery.noConflict();\n \t\t\n\t\tjQuery(document).ready(function(\$){\n\t\t\t\$('#{$control_name}{$name}').styleswitcher({loadTheme: '{$value}', stylepane: '<div class=\"jquery-ui-styleswitcher\"><div id=\"themeGallery\"><ul class=\"ui-styleswitcher-wrapper\">{$html}</ul></div></div>',\n\t\t\tbutPre: '<a href=\"#\" class=\"jquery-ui-styleswitcher-trigger ui-state-default ui-corner-all\"><span class=\"jquery-ui-styleswitcher-icon ui-icon ui-icon-triangle-1-s\"></span><span class=\"jquery-ui-styleswitcher-title\">',\n\t\t\tinitialText: '{$label}', onSelect: function(href){ \$('#{$control_name}{$name}" . "_value').val(href); }}).find('a.jquery-ui-themeswitcher-trigger');\n\t\t\t{$reset}\n\t\t});";
     $doc->addScriptDeclaration($script);
     $selectors = null;
     $nselectors = null;
     $lockdesc = JText::_($node['description2']);
     if ($select) {
         $selectors = ' class="' . $select . ' fl f-select ui-helper-hidden"';
         $nselectors = '<span class="' . $select . ' fl hasTip" title="' . $lockdesc . '"><a class="ui-state-default jquery-ui-styleswitcher-trigger ' . $select . ' fl ui-state-default" style="font-family: \'Trebuchet MS\', Verdana, sans-serif; font-size: 11px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-top-style: solid; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; -webkit-border-top-right-radius: 6px 6px; -webkit-border-top-left-radius: 6px 6px; -webkit-border-bottom-left-radius: 6px 6px; -webkit-border-bottom-right-radius: 6px 6px; text-decoration: none; padding-top: 3px; padding-right: 3px; padding-bottom: 3px; padding-left: 8px; width: 149px; display: block; height: 14px; outline-width: 0px; outline-style: initial; outline-color: initial; -webkit-background-clip: initial; -webkit-background-origin: initial;  cursor: normal;background-position: initial initial; "><span class="ui-icon ui-icon-cancel" style="float: right; width: 16px;margin-top:-1px;"></span><span class="jquery-ui-styleswitcher-title">Using Default</span></a></span>';
     }
     return '<span id="' . $control_name . $name . '"' . $selectors . '></span><input type="hidden" name="' . $control_name . '[' . $name . ']" id="' . $control_name . $name . '_value" value="' . $value . '" />' . $nselectors;
 }
Пример #6
0
 function fetchElement($name, $value = null, &$node, $control_name)
 {
     nimport('napi.plugin');
     //Legacy code
     if ($node['plugin'] == 'showcase') {
         return NJPluginHelper::renderParams($node['plugin'], $name, $value, $node, $control_name);
     }
     $id = JRequest::getInt('id');
     if (!$id) {
         $id = reset(JRequest::getVar('cid', array()));
     }
     $dbs =& JFactory::getDBO();
     $querys = 'SELECT params' . ' FROM #__modules' . ' WHERE id =' . $id;
     $dbs->setQuery($querys);
     $values = $dbs->loadResult();
     $values = $this->_parent->_raw;
     $doc = JFactory::getDocument();
     $db =& JFactory::getDBO();
     $db->setQuery('SELECT DISTINCT plugin, id, name, NOT enabled AS disable FROM #__napi_plugins WHERE type = ' . $db->Quote($node['plugin']) . ' ORDER BY name, id');
     $key = $node['key_field'] ? $node['key_field'] : 'id';
     $val = $node['value_field'] ? $node['value_field'] : 'name';
     $params = $control_name . $name . 'loadHere';
     $plugin = $control_name . $name . 'update';
     $n = $control_name . $name;
     if ($node['option']) {
         $option = $node['option'];
     } else {
         switch (JRequest::getCmd('option')) {
             case 'com_modules':
             case 'com_plugins':
             case 'com_templates':
                 $option = 'com_napi';
                 break;
             default:
                 $option = JRequest::getInt('com_napi') ? JRequest::getCmd('option') : 'com_napi';
                 break;
         }
     }
     $getxmlpath = JText::sprintf($node['getxmlpath'] ? $node['getxmlpath'] : '%s.', 'napi_' . $node['plugin']);
     $urlformat = $node['urlformat'] ? $node['urlformat'] : 'index.php?option=%s&view=plugin&layout=params&format=cli&cli[update]=' . $n . 'desc&id=';
     $urlparams = $node['urlparams'] ? explode(',', $node['urlparams']) : array('option', 'getxmlpath');
     $url = JText::sprintf($urlformat, ${$urlparams}[0], ${$urlparams}[1]);
     $seeJson = $node['debug'] ? "\$('{$n}" . "seeJson').setProperty('href', {$n}" . "url);" : "";
     JHTML::_('cli.render', 'params', array('trigger' => $n, 'url' => '\\\'' . $url . '\'+$(\'' . $n . '\').value', 'trigger_url' => '\\\'' . $url . '\'+this.value', 'control_name' => $control_name, 'bind' => $values, 'loadOnInit' => true));
     /*$doc->addScriptDeclaration("
     window.addEvent('domready', function() {
     	var $n"."parent = $('$n').getParent().getParent();
     	var scriptObj;
     	var $n"."prev;
     	var $n = $('$n');
     	var $n"."value = $n.value;
     	var $n"."url = 'index.php?option=$option&task=cli&format=json&cli[getxmlpath]=napi_".$node['plugin'].".'+$n"."value;
     	var $n"."data = '".json_encode(explode("\n", $values))."';
     	
     	function $plugin(plugin) {
     		if($('$n"."desc')) $('$n"."desc').empty();
     		var el = $('$n"."desc');
     		el.setHTML(plugin.html);
     		$('$n').fireEvent('update');
     		el.injectAfter($n"."parent);
     		i = 0;
     		if($n"."prev)
     		{
     			$n"."prev.each(function(old){
     				old.remove();
     			});
     		}
     		if(plugin.scripts)
     		{
     			plugin.scripts.each(function(script){
     				scriptObj = Json.evaluate(script);
     				new Asset.javascript(scriptObj.src, {'type': scriptObj.type, 'class': '$n"."temp'});
     			});
     		}
     		if(plugin.styles)
     		{
     			plugin.styles.each(function(style){
     				styleObj = Json.evaluate(style);
     				new Asset.css(styleObj.href, {'class': '$n"."temp'});
     			});
     		}
     		$n"."prev = $$('.$n"."temp');
     		//update($n"."parent);
     	};
     	
     	$n.addEvent('change', function(e) {
     		e = new Event(e).stop();
     		$n"."value = this.value;
     		$n"."url = 'index.php?option=$option&task=cli&format=cli&cli[getxmlpath]=napi_".$node['plugin'].".'+$n"."value;
     		var $n"."request = new Json.Remote($n"."url, {
     			onComplete: function(jsonObj) {
     				$plugin(jsonObj);
     				".$seeJson."
     			}
     		}).send({'bind': $n"."data});
     	});
     	
     	var $n"."startrequest = new Json.Remote($n"."url, {
     			onComplete: function(jsonObj) {
     				$plugin(jsonObj);
     			}
     	}).send({'bind': $n"."data});
     });");*/
     $arr = $db->loadObjectList();
     if (empty($arr)) {
         $arr[] = JHTML::_('select.option', '', 'Trigger Error', $key, $val, true);
     }
     //$arr = array_unshift($db->loadObjectList(), $obj);
     $debug = $node['debug'] ? ' <a href="index.php?option=com_napi&format=cli&cli[getxmlpath]=napi_' . $node['plugin'] . '.' . $value . '" id="' . $control_name . $name . 'seeJson" title="Json: data.js">see <strong>data.js</strong></a>' : '';
     $label = $node['label'] ? $node['label'] : $name;
     $description = $node['description'];
     $output = '<label id="' . $control_name . $name . '-lbl" for="' . $control_name . $name . '"';
     if ($description) {
         $output .= ' class="hasTip" title="' . JText::_($label) . '::' . JText::_($description) . '">';
     } else {
         $output .= '>';
     }
     $output .= JText::_($label) . '</label>';
     return '<p class="paramlist_item"><span class="editlinktip">' . $output . '</span><span class="paramlist_input">' . JHTML::_('select.genericlist', $arr, '' . $control_name . '[' . $name . ']', 'class="inputbox"', $key, $val, $value, $control_name . $name) . $debug . '</span>' . '<div id="' . $n . 'desc" class="paramlist_json"></div>';
 }