/** * display method * @return void **/ function display($tpl = null) { // make mainframe variable available global $mainframe, $option; // get design and template name $template_name = JRequest::getVar('template_name', 'hm_yaml', 'REQUEST'); $this->assignRef('template_name', $template_name); $design = JRequest::getVar('design', 'default', 'REQUEST'); $this->assignRef('design', $design); // Global XML for referenz view $xmlfile = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . '_global.xml'; $config_global = JYAML::readConfig($template_name, $xmlfile); $this->assignRef('config_global', $config_global); // Design XML $xmlfile = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . $design . '.xml'; $config_design = JYAML::readConfig($template_name, $xmlfile); $this->assignRef('config_design', $config_design); // Custom Config XML $filename = JRequest::getVar('file', NULL, 'REQUEST'); $this->assignRef('filename', $filename); $xmlfile = JPATH_SITE . DS . 'templates' . DS . $template_name . DS . 'config' . DS . $design . DS . $filename; $config = JYAML::readConfig($template_name, $xmlfile); $this->assignRef('config', $config); $html_list = JYAML::getHTMLList(); $this->assignRef('html_list', $html_list); $designlist = JYAML::getDesignList(); $this->assignRef('designlist', $designlist); $positions = JYAML::getPositions(); $this->assignRef('positions', $positions); /*** Load Configuration ***/ $conf_design = JYAML::parseConfigDesign($this->config_design, true); $conf_global = JYAML::parseConfigDesign($this->config_global); $conf = JYAML::parseConfigDesign($this->config); $this->assignRef('conf', $conf); $this->assignRef('conf_design', $conf_design); $this->assignRef('conf_global', $conf_global); /*** Buttons ***/ // Explore Buttons for Stylesheets $explore_buttons[0][0]['label'] = 'YAML EXPLORE CSS'; $explore_buttons[0][0]['link'] = 'index3.php?option=' . $option . '&controller=templateExplorer&task=view&ext=css&template_name=' . $this->template_name . '&design=' . $design; // Explore Buttons for Scripts $explore_buttons[1][0]['label'] = 'YAML EXPLORE SCRIPTS'; $explore_buttons[1][0]['link'] = 'index3.php?option=' . $option . '&controller=templateExplorer&task=view&ext=js&template_name=' . $this->template_name . '&design=' . $design; $this->assignRef('explore_buttons', $explore_buttons); parent::display($tpl); }
/** * View html as php files * @param design * @return $html **/ function viewHTMLFiles($design) { global $option; $htmlfiles = JYAML::getHTMLList($design); $html = ''; $noDelFiles = array('index.php', 'component.php', 'offline.php', '403.php', '404.php', '500.php', 'error.php', 'contentPreview.php'); /* ToDo: incude following, more capable $noDelFiles = array( 'index.php', 'component.php', 'offline.php', 'error.php', 'contentPreview.php', '400.php', '401.php', '402.php', '403.php', '404.php', '405.php', '406.php', '407.php', '408.php', '409.php', '410.php', '411.php', '412.php', '413.php', '414.php', '415.php', '500.php', '501.php', '502.php', '503.php', '504.php', '505.php' ); */ $bar =& new JToolBar('My ToolBar'); $button =& $bar->loadButtonType('Custom'); $html .= '<ul class="htmlindex-file-tree filetree tree-disabled">'; $html .= '<li><span class="folder"> /html/index/' . $design . '</span>'; $html .= '<ul>'; // Main design file $di = 0; foreach ($noDelFiles as $file) { $edit_url = JURI::base() . 'index3.php?option=' . $option . '&controller=syntaxEditor&task=edit&eSyntax=html&file=' . $this->template_name . DS . 'html' . DS . 'index' . DS . $design . DS . $file; $link = "<a class=\"modal\" href=\"{$edit_url}\" rel=\"{handler: 'iframe', size: {x: 640, y: 480}}\">\n"; $link .= "{$file}\n"; $link .= "</a>\n"; $style = ''; if (count($noDelFiles) - 1 == $di) { $style = ' style="margin-bottom:2px;padding-bottom:3px;border-bottom:1px solid #eee;"'; } $html .= '<li' . $style . '><span class="file">' . $button->fetchButton('Custom', $link, 'editfile') . '</span></li>'; $di++; } if ($htmlfiles) { foreach ($htmlfiles as $file) { $edit_url = JURI::base() . 'index3.php?option=' . $option . '&controller=syntaxEditor&task=edit&eSyntax=html&file=' . $this->template_name . DS . 'html' . DS . 'index' . DS . $design . DS . $file; $link = "<a class=\"modal\" href=\"{$edit_url}\" rel=\"{handler: 'iframe', size: {x: 640, y: 480}}\">"; $link .= "<strong>{$file}</strong>"; $link .= "</a>\n"; $deleteLink = $this->template_name . DS . 'html' . DS . 'index' . DS . $design . DS . $file; $html .= '<li><span class="file">[ <a rel="' . $deleteLink . '" class="MAINdeleteFile">' . JText::_('YAML DELETE') . '</a> ] - ' . $button->fetchButton('Custom', $link, 'editfile') . '</span></li>'; } } else { $html .= '<li>' . JText::_('YAML NO OTHERS AVALIABLE') . '</li>'; } $html .= '</li>'; $bar =& new JToolBar('My ToolBar'); $popup =& $bar->loadButtonType('Popup'); $create_html_link = 'index3.php?option=' . $option . '&controller=fileControl&task=create&ext=php&folder=' . $this->template_name . DS . 'html' . DS . 'index' . DS . $design; $create_html_button = $popup->fetchButton('Popup', 'create_html', 'YAML CREATE FILE', $create_html_link, 640, 350, 150, 150); $html .= '<li><span class="file file_add">[<span class="on"> ' . $create_html_button . ' </span>]</span></li>'; $html .= '</ul>'; $html .= '</ul>'; return $html; }