/** * View Tree of CSS files * @param designs * @return $html **/ function viewCSSFiles($design, $safe = false, $source = false) { global $option; $filetree = JYAML::getCSSTree($design, $source); $html = ''; $bar =& new JToolBar('My ToolBar'); $button =& $bar->loadButtonType('Custom'); $popup =& $bar->loadButtonType('Popup'); $lockedFolders = array('/', 'screen/', 'patches/', 'print/', 'extensions/', 'navigation/'); if (!$safe) { $html .= '<ul class="css-file-tree filetree tree-disabled">'; } if ($safe) { $html .= '<ul class="tree-safe tree-safe-css filetree tree-disabled">'; } if ($source) { $html .= '<li><span class="folder"> /' . $source . '/</span>'; } else { $html .= '<li><span class="folder"> /css/' . $design . '/</span>'; } $html .= '<ul>'; $create_css_folder_link = 'index3.php?option=' . $option . '&controller=fileControl&task=createCssFolder&template=' . $this->template_name . '&design=' . $design; $create_css_folder_button = $popup->fetchButton('Popup', 'create_css', 'YAML CREATE CSS FOLDER', $create_css_folder_link, 640, 350, 150, 150); if (!$safe) { $html .= '<li><span class="folder folder_add"> <span class="on">' . $create_css_folder_button . '</span></span></li>'; } foreach ($filetree['folderfiles'] as $folder => $files) { $deleteFolder = ''; if (!$safe && !$files && !in_array($folder, $lockedFolders)) { $deleteLink = $this->template_name . DS . 'css' . DS . $design . DS . str_replace('/', DS, $folder); $deleteFolder = ' [ <a folder="' . $deleteLink . '" class="MAINdeleteCssFolder">' . JText::_('YAML DELETE CSS FOLDER') . '</a> ] - '; } $html .= '<li class="css-folder"><span class="folder"> ' . $deleteFolder . $folder . '</span>'; $create_css_link = 'index3.php?option=' . $option . '&controller=fileControl&task=create&ext=css&folder=' . $this->template_name . DS . 'css' . DS . $design . DS . str_replace('/', DS, $folder) . '&core_folder=' . $this->template_name; $create_css_button = $popup->fetchButton('Popup', 'create_css', 'YAML CREATE FILE', $create_css_link, 640, 350, 150, 150); if ($files) { $html .= '<ul>'; foreach ($files as $file) { $edit_url = JURI::base() . 'index3.php?option=' . $option . '&controller=syntaxEditor&task=edit&eSyntax=css&file=' . $this->template_name . DS . 'css' . DS . $design . DS . str_replace('/', DS, $folder) . $file; $link = "<a class=\"modal\" href=\"{$edit_url}\" rel=\"{handler: 'iframe', size: {x: 640, y: 480}}\">"; $link .= "{$file}"; $link .= "</a>\n"; $deleteLink = $this->template_name . DS . 'css' . DS . $design . DS . str_replace('/', DS, $folder) . $file; if ($safe) { if ($source) { $sfolder = '/' . $source . '/'; $sfile = $folder . $file; } else { $sfolder = '/css/' . $design . '/'; $sfile = str_replace('\\', '/', $folder) . $file; } $html .= '<li><span class="file"><a href="#" onclick="javascript:return false;" folder="' . $sfolder . '" file="' . $sfile . '" class="chooseFile">' . $file . '</a></span></li>'; } else { $html .= '<li><span class="file">[ <a rel="' . $deleteLink . '" class="MAINdeleteFile">' . JText::_('YAML DELETE') . '</a> ] - ' . $button->fetchButton('Custom', $link, 'editfile') . '</span></li>'; } } if (!$safe) { $html .= '<li><span class="file">[<span class="on"> ' . $create_css_button . ' </span>]</span></li>'; } $html .= '</ul>'; } else { $html .= '<ul>'; if (!$safe) { $html .= '<li><span class="file">[<span class="on"> ' . $create_css_button . ' </span>]</span></li>'; } $html .= '<li><span class="file">' . JText::_('YAML NO FILES IN FOLDER') . '</span></li>'; $html .= '</ul>'; } $html .= '</li>'; } foreach ($filetree['basicfiles'] as $file) { $lockedFiles = array('layout_1col_3.css', 'layout_2col_13.css', 'layout_2col_23.css', 'layout_2col_31.css', 'layout_2col_32.css', 'layout_3col_123.css', 'layout_3col_132.css', 'layout_3col_213.css', 'layout_3col_231.css', 'layout_3col_312.css', 'layout_3col_321.css'); $edit_url = JURI::base() . 'index3.php?option=' . $option . '&controller=syntaxEditor&task=edit&eSyntax=css&file=' . $this->template_name . DS . 'css' . DS . $design . DS . $file; $link = "<a class=\"modal\" href=\"{$edit_url}\" rel=\"{handler: 'iframe', size: {x: 640, y: 480}}\">"; $link .= "{$file}"; $link .= "</a>\n"; $delButton = ''; if (!$safe && !in_array($file, $lockedFiles)) { $delButton = '[ <a rel="' . $this->template_name . DS . 'css' . DS . $design . DS . $file . '" class="MAINdeleteFile">' . JText::_('YAML DELETE') . '</a> ] - '; } if ($safe) { if ($source) { $sfolder = '/' . $source . '/'; } else { $sfolder = '/css/' . $design . '/'; } $html .= '<li><span class="file"><a href="#" onclick="javascript:return false;" folder="' . $sfolder . '" file="' . $file . '" class="chooseFile">' . $file . '</a></span></li>'; } else { $html .= '<li><span class="file">' . $delButton . $button->fetchButton('Custom', $link, 'editfile') . '</span></li>'; } } $create_css_link = 'index3.php?option=' . $option . '&controller=fileControl&task=create&ext=css&folder=' . $this->template_name . DS . 'css' . DS . $design . '&core_folder=' . $this->template_name; $create_css_button = $popup->fetchButton('Popup', 'create_css', 'YAML CREATE FILE', $create_css_link, 640, 350, 150, 150); if (!$safe) { $html .= '<li><span class="file file_add">[<span class="on"> ' . $create_css_button . ' </span>]</span></li>'; } $html .= '</ul>'; $html .= '</li>'; $html .= '</ul>'; return $html; }