/** * draw the Tree-Folder structure */ function draw_folders() { global $c, $lang, $sid; echo "<table width=\"98%\" cellpadding=\"0\" cellspacing=\"0\">"; echo "<tr><td >"; echo '<div id="explore" class="sidebar_explore" style="height:400px;">'; // draw the folder here $icon = 'site_root.gif'; $expandedIcon = 'site_root.gif'; $menu = new HTML_TreeMenu(); $startnode = new HTML_TreeNode(array ( 'text' => $lang->get("website", "Website"), 'link' => $this->action . "?sid=$sid&pnode=0", 'icon' => $icon, 'expandedIcon' => $expandedIcon, isDynamic => true, 'defaultClass' => "treemenu" )); $this->buildSitemap($startnode, "0"); $menu->addItem($startnode); $treeMenu = new HTML_TreeMenu_DHTML($menu, array ( 'images' => $c["docroot"] . 'api/userinterface/tree/images', 'defaultClass' => "treemenu" ), true); $treeMenu->printMenu(); echo '</div>'; echo '</td></tr>'; echo "</table>"; }
/** * A method to return the HTML code needed to display a tree-based * menu of all the simulations. * * @return string A string containing the HTML code needed to display * the tests in a tree-based menu. */ function buildTree() { $icon_pkg = "package.png"; // Create the root of the test suite $menu = new HTML_TreeMenu(); $rootNode = new HTML_TreeNode(array('text' => 'Test Datasets', 'icon' => $icon_pkg, 'link' => 'home.php', 'linkTarget' => 'right')); // Create the top-level test groups $aTypes = array('datasets' => 'menu.php'); foreach ($aTypes as $type => $link) { $nodeName = $type . 'RootNode'; ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type), 'icon' => $icon_pkg, 'link' => $link, 'linkTarget' => "left")); $list = get_file_list(TD_DATAPATH, '.xml', true); foreach ($list as $index => $file) { ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $file, 'icon' => $icon_pkg, 'link' => "action.php?&datasetfile={$file}", 'linkTarget' => 'right'))); } $rootNode->addItem(${$nodeName}); } $menu->addItem($rootNode); $tree = new HTML_TreeMenu_DHTML($menu); $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css'); $code .= "\n<script>\n"; $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js'); $code .= "\n</script>"; $code .= $tree->toHTML(); return $code; }
function list_action() { //$this->tree->rebuild_tree(1,1); $icon = 'folder.gif'; $expandedIcon = 'folder-expanded.gif'; $menu = new HTML_TreeMenu(); $this->_last_node = null; $rnode = $this->_array_recurse($this->tree->tree); $menu->addItem($rnode); $treeMenu = new HTML_TreeMenu_DHTML($menu, array('images' => 'images', 'defaultClass' => 'treeMenuDefault')); $this->assign("tree_html", $treeMenu->toHTML()); return $this->fetch($GLOBALS['template_dir'] . "document_categories/" . $this->template_mod . "_list.html"); }
/** * A method to return the HTML code needed to display a tree-based * menu of all the simulations. * * @return string A string containing the HTML code needed to display * the tests in a tree-based menu. */ function buildTree() { $menu = new HTML_TreeMenu(); $rootNode = new HTML_TreeNode(array('text' => 'OpenX Developer Toolbox', 'icon' => '', 'link' => 'action.php?action=index', 'linkTarget' => 'right')); $aItems[] = array('title' => 'Plugins', 'action' => 'about&item=plugins', 'children' => array(0 => array('title' => 'New Plugin', 'action' => 'create_plugin'))); $aItems[] = array('title' => 'Schemas', 'action' => 'about&item=schema', 'children' => array(0 => array('title' => 'Schema Editor', 'action' => 'schema_editor'), 1 => array('title' => 'Changeset Archives', 'action' => 'schema_changesets'))); $aItems[] = array('title' => 'Core Schema Utilities', 'action' => 'about&item=core_utils', 'children' => array(0 => array('title' => 'Integrity Check', 'action' => 'schema_integ'), 1 => array('title' => 'Dump Data', 'action' => 'schema_datadump'), 2 => array('title' => 'Load Data', 'action' => 'schema_dataload'))); $aItems[] = array('title' => 'Schema Analysis', 'action' => 'schema_analysis'); // Generate DataObjects $aDataObjects[] = array('title' => 'OpenX Core', 'action' => 'generate_dataobjects'); $plugins = $GLOBALS['_MAX']['CONF']['pluginPaths']['packages']; foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) { $schema = strtolower($name); $aDataObjects[] = array('title' => $name, 'action' => "generate_dataobjects&schema={$plugins}{$name}/etc/tables_{$schema}.xml&dbopath={$plugins}{$name}/etc/DataObjects"); } $aItems[] = array('title' => 'Generate DataObjects', 'action' => 'about&item=dataobjects', 'children' => $aDataObjects); // Upgrade Packages $aPackages[] = array('title' => 'New Core Upgrade Package', 'action' => 'upgrade_package&name=OpenXCore'); foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) { $aPackages[] = array('title' => $name, 'action' => 'upgrade_package&name=' . $name); } $aItems[] = array('title' => 'Upgrade Packages', 'action' => 'about&item=upgrade_packages', 'children' => $aPackages); // Upgrade Packages Array $aUpgrades[] = array('title' => 'OpenX Core', 'action' => 'upgrade_array&read=/etc/changes&write=/etc/changes/openads_upgrade_array.txt'); foreach ($GLOBALS['_MAX']['CONF']['pluginGroupComponents'] as $name => $enabled) { $aUpgrades[] = array('title' => $name, 'action' => "upgrade_array&read={$plugins}{$name}/etc/changes&write={$plugins}{$name}/etc/changes/{$name}_upgrade_array.txt"); } $aItems[] = array('title' => 'Upgrade Packages Array', 'action' => 'about&item=upgrade_array', 'children' => $aUpgrades); foreach ($aItems as $aItem) { $newNode =& $rootNode->addItem(new HTML_TreeNode(array('text' => $aItem['title'], 'icon' => 'package.png', 'link' => 'action.php?action=' . $aItem['action'], 'linkTarget' => 'right'))); if (isset($aItem['children'])) { foreach ($aItem['children'] as $aChild) { $newNode->addItem(new HTML_TreeNode(array('text' => $aChild['title'], 'icon' => 'Method.png', 'link' => 'action.php?action=' . $aChild['action'], 'linkTarget' => 'right'))); } } } $menu->addItem($rootNode); $options = array('images' => 'assets/images'); $tree = new HTML_TreeMenu_DHTML($menu, $options); $code = file_get_contents(PATH_ASSETS . '/css/menu.css'); $code .= "\n<script>\n"; $code .= file_get_contents(PATH_ASSETS . '/js/TreeMenu.js'); $code .= "\n</script>"; $code .= $tree->toHTML(); return $code; }
/** * A method to return the HTML code needed to display a tree-based * menu of all the OpenX tests. * * @return string A string containing the HTML code needed to display * the tests in a tree-based menu. */ function buildTree() { preg_match('/^(\\d+\\.\\d+)/', VERSION, $aMatches); // Create the root of the test suite $menu = new HTML_TreeMenu(); $rootNode = new HTML_TreeNode(array('text' => PRODUCT_NAME . ' ' . $aMatches[1] . ' Tests', 'icon' => "package.png")); // Create the top-level test groups foreach ($GLOBALS['_MAX']['TEST']['groups'] as $type) { $nodeName = $type . 'RootNode'; ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type) . ' Test Suite', 'icon' => "package.png", 'link' => "run.php?type={$type}&level=all", 'linkTarget' => "right")); $structure = TestFiles::getAllTestFiles($type); foreach ($structure as $layerCode => $folders) { $firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $GLOBALS['_MAX']['TEST'][$type . '_layers'][$layerCode][0], 'icon' => "package.png", 'link' => "run.php?type={$type}&level=layer&layer={$layerCode}", 'linkTarget' => 'right'))); foreach ($folders as $folder => $files) { if (count($files)) { $secondNode =& $firstNode->addItem(new HTML_TreeNode(array('text' => $folder, 'icon' => "class_folder.png", 'link' => "run.php?type={$type}&level=folder&layer={$layerCode}&folder={$folder}", 'linkTarget' => 'right'))); } foreach ($files as $index => $file) { $secondNode->addItem(new HTML_TreeNode(array('text' => $file, 'icon' => "Method.png", 'link' => "run.php?type={$type}&level=file&layer={$layerCode}&folder={$folder}&file={$file}", 'linkTarget' => 'right'))); } } } $rootNode->addItem(${$nodeName}); } /** * @TODO Clean up the following code to ensure that adding new * PEAR PHPUnit tests to the test suite is easier! */ // Create the PEAR PHPUnit tests $nodeName = 'PearRootNode'; ${$nodeName} = new HTML_TreeNode(array('text' => 'PEAR PHPUnit Test Suite', 'icon' => "package.png", 'link' => "", 'linkTarget' => "right")); $firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => 'PEAR::MDB2', 'icon' => "package.png", 'link' => "run.php?type=phpunit&dir=../lib/pear/MDB2/tests", 'linkTarget' => 'right'))); $firstNode =& ${$nodeName}->addItem(new HTML_TreeNode(array('text' => 'PEAR::MDB2_Schema', 'icon' => "package.png", 'link' => "run.php?type=phpunit&dir=../lib/pear/MDB2_Schema/tests", 'linkTarget' => 'right'))); $rootNode->addItem(${$nodeName}); // Add the root node to the menu, and return the HTML code $menu->addItem($rootNode); $tree = new HTML_TreeMenu_DHTML($menu); $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css'); $code .= "\n<script>\n"; $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js'); $code .= "\n</script>"; $code .= $tree->toHTML(); return $code; }
/** * A method to return the HTML code needed to display a tree-based * menu of all the simulations. * * @return string A string containing the HTML code needed to display * the tests in a tree-based menu. */ function buildTree() { $icon_pkg = "package.png"; // Create the root of the test suite $menu = new HTML_TreeMenu(); $rootNode = new HTML_TreeNode(array('text' => 'Simulation Scenarios', 'icon' => $icon_pkg, 'link' => 'home.php', 'linkTarget' => 'right')); // Create the top-level test groups $aTypes = array(SCENARIOS => 'menu.php'); foreach ($aTypes as $type => $link) { $nodeName = $type . 'RootNode'; ${$nodeName} = new HTML_TreeNode(array('text' => ucwords($type), 'icon' => $icon_pkg, 'link' => $link, 'linkTarget' => "left")); $scenarios = get_file_list($type, '.php'); foreach ($scenarios as $index => $scenario) { ${$nodeName}->addItem(new HTML_TreeNode(array('text' => $scenario, 'icon' => $icon_pkg, 'link' => "action.php?dir={$type}&scenario={$scenario}", 'linkTarget' => 'right'))); } $rootNode->addItem(${$nodeName}); } $aParams = array('text' => 'Actions', 'icon' => $icon_pkg, 'link' => "", 'linkTarget' => "right"); // create the Actions node $nodeName = 'ActionsRootNode'; ${$nodeName} = new HTML_TreeNode($aParams); $rootNode->addItem(${$nodeName}); $aParams['text'] = 'Save Current Scenario'; $aParams['link'] = 'action.php?act=save'; ${$nodeName}->addItem(new HTML_TreeNode($aParams)); $aParams['text'] = 'Download Scenario/s'; $aParams['link'] = 'action.php?act=download'; ${$nodeName}->addItem(new HTML_TreeNode($aParams)); $aParams['text'] = 'Upload Scenario/s'; $aParams['link'] = 'action.php?act=upload'; ${$nodeName}->addItem(new HTML_TreeNode($aParams)); // Add the root node to the menu, and return the HTML code $menu->addItem($rootNode); $tree = new HTML_TreeMenu_DHTML($menu); $code = file_get_contents(MAX_PATH . '/tests/testClasses/menu.css'); $code .= "\n<script>\n"; $code .= file_get_contents(MAX_PATH . '/tests/testClasses/TreeMenu.js'); $code .= "\n</script>"; $code .= $tree->toHTML(); return $code; }
function list_action($patient_id = "") { $this->_last_node = null; $categories_list = $this->tree->_get_categories_array($patient_id); //print_r($categories_list); $menu = new HTML_TreeMenu(); $rnode = $this->_array_recurse($this->tree->tree, $categories_list); $menu->addItem($rnode); $treeMenu = new HTML_TreeMenu_DHTML($menu, array('images' => 'images', 'defaultClass' => 'treeMenuDefault')); $treeMenu_listbox = new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self')); $this->assign("tree_html", $treeMenu->toHTML()); return $this->fetch($GLOBALS['template_dir'] . "documents/" . $this->template_mod . "_list.html"); }
//require_once('HTML/TreeMenu.php'); require_once '../TreeMenu.php'; $icon = 'folder.gif'; $expandedIcon = 'folder-expanded.gif'; $menu = new HTML_TreeMenu(); $node1 = new HTML_TreeNode(array('text' => "First level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true), array('onclick' => "alert('foo'); return false", 'onexpand' => "alert('Expanded')")); $node1_1 =& $node1->addItem(new HTML_TreeNode(array('text' => "Second level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); $node1_1_1 =& $node1_1->addItem(new HTML_TreeNode(array('text' => "Third level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); $node1_1_1_1 =& $node1_1_1->addItem(new HTML_TreeNode(array('text' => "Fourth level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); $node1_1_1_1->addItem(new HTML_TreeNode(array('text' => "Fifth level", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'cssClass' => 'treeMenuBold'))); $node1->addItem(new HTML_TreeNode(array('text' => "Second level, item 2", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); $node1->addItem(new HTML_TreeNode(array('text' => "Second level, item 3", 'link' => "test.php", 'icon' => $icon, 'expandedIcon' => $expandedIcon))); $menu->addItem($node1); $menu->addItem($node1); // Create the presentation class $treeMenu = new HTML_TreeMenu_DHTML($menu, array('images' => '../images', 'defaultClass' => 'treeMenuDefault')); $listBox = new HTML_TreeMenu_Listbox($menu, array('linkTarget' => '_self')); //$treeMenuStatic = new HTML_TreeMenu_staticHTML($menu, array('images' => '../images', 'defaultClass' => 'treeMenuDefault', 'noTopLevelImages' => true)); ?> <html> <head> <style type="text/css"> body { font-family: Georgia; font-size: 11pt; } .treeMenuDefault { font-style: italic; }
function _nodeToHTML($nodeObj, $prefix, $return = 'newNode', $treelevel = 0) { $html = HTML_TreeMenu_DHTML::_nodeToHTML($nodeObj, $prefix, $return, $treelevel); // Set javascript values for image sizes for this node $nodeprops = array('iconImageWidth', 'iconImageHeight', 'lineImageWidth', 'lineImageHeight'); foreach ($nodeprops as $nprop) { // Image sizes: set from node or presentation object. if (isset($nodeObj->{$nprop})) { ${$nprop} = $nodeObj->{$nprop}; } else { ${$nprop} = $this->{$nprop}; } $html .= "\t{$return}." . $nprop . '=' . ${$nprop} . ";\n"; } // Node may be selected if (!empty($nodeObj->selected)) { $html .= "\t{$return}.selected = '" . $this->selectedStyle . "';\n"; } return $html; }
/** * Creates a DHTML menu of serendipity categories. * * The menu is echoed out. * * @param string $title (Serves as the top level menu item if present) * @return void * @see http://pear.php.net/HTML_TreeMenu PEAR::HTML_TreeMenu */ function generate_content(&$title) { global $serendipity; $title = $this->get_config('title', $this->title); // may want to put this in bundled_libs or a sub directory of this directory $pear = false; if (@(include_once 'HTML/TreeMenu.php')) { $pear = true; } elseif (@(include_once 'HTML_TreeMenu/TreeMenu.php')) { $pear = true; } if ($pear) { $which_category = $this->get_config('authorid'); // build an accessible array of categories foreach (serendipity_fetchCategories(empty($which_category) ? 'all' : $which_category) as $cat) { if (!is_array($cat) || !isset($cat['categoryid'])) { continue; } $categories[$cat['categoryid']] = $cat; } // create an array of numbers of entries per category $cat_count = array(); if (serendipity_db_bool($this->get_config('show_count'))) { $cat_sql = "SELECT c.categoryid, c.category_name, count(e.id) as postings\n FROM {$serendipity['dbPrefix']}entrycat ec,\n {$serendipity['dbPrefix']}category c,\n {$serendipity['dbPrefix']}entries e\n WHERE ec.categoryid = c.categoryid\n AND ec.entryid = e.id\n AND e.isdraft = 'false'\n " . (!serendipity_db_bool($serendipity['showFutureEntries']) ? " AND e.timestamp <= " . serendipity_db_time() : '') . "\n GROUP BY c.categoryid, c.category_name\n ORDER BY postings DESC"; $category_rows = serendipity_db_query($cat_sql); if (is_array($category_rows)) { foreach ($category_rows as $cat) { $cat_count[$cat['categoryid']] = $cat['postings']; } } } $image = $this->get_config('image', serendipity_getTemplateFile('img/xml.gif')); $image = $image == "'none'" || $image == 'none' ? '' : $image; // create nodes foreach ($categories as $cid => $cat) { if (function_exists('serendipity_categoryURL')) { $link = serendipity_categoryURL($cat, 'serendipityHTTPPath'); } else { $link = serendipity_rewriteURL(PATH_CATEGORIES . '/' . serendipity_makePermalink(PERM_CATEGORIES, array('id' => $cat['categoryid'], 'title' => $cat['category_name'])), 'serendipityHTTPPath'); } if (!empty($cat_count[$cat['categoryid']])) { // $categories[$cid]['true_category_name'] = $cat['category_name']; $cat['category_name'] .= ' (' . $cat_count[$cat['categoryid']] . ')'; // $categories[$cid]['article_count'] = $cat_count[$cat['categoryid']]; } if (!empty($image)) { $feedURL = serendipity_feedCategoryURL($cat, 'serendipityHTTPPath'); $feed = '<a class="serendipity_xml_icon" href="' . $feedURL . '"><img src="' . $image . '" alt="XML" style="border: 0px;vertical-align:middle"/></a> '; $link = '<a href="' . $link . '" target="_self"><span>' . $cat['category_name'] . '</span></a>'; // work around a problem in HTML_TreeNode: when there is a href in 'text', 'link' is not converted to a link. $cat_nodes[$cat['categoryid']] = new HTML_TreeNode(array('text' => $feed . $link)); } else { $cat_nodes[$cat['categoryid']] = new HTML_TreeNode(array('text' => $feed . $cat['category_name'], 'link' => $link)); } } // create a top level for "all categories" // this serves as the title $cat_nodes[0] = new HTML_TreeNode(array('text' => ALL_CATEGORIES, 'link' => $serendipity['baseURL'])); // nest nodes (thanks to PHP references) foreach ($categories as $category) { $cat_nodes[$category['parentid']]->addItem($cat_nodes[$category['categoryid']]); } // nest the "all categories" category $menu = new HTML_TreeMenu(); $menu->addItem($cat_nodes[0]); $tree = new HTML_TreeMenu_DHTML($menu, array('images' => $serendipity['baseURL'] . $this->get_config('image_path'))); // Add heading for block #$output = '<h2 class="serendipitySideBarTitle" style="font-weight: bold;">'.$title.'</h2><br />'; // Put inside a div with "overflow:hidden" to avoid items of the sidebar plugin running outside the blog // Maybe we can put a config setting to choose if the block should be displayed with or without overflow setting. $output .= '<div style="overflow: hidden;">'; $output .= $tree->toHTML(); $output .= '</div>'; echo '<script type="text/javascript" src="' . $serendipity['baseURL'] . $this->get_config('script_path') . '"></script>'; } else { $output .= "Please install PEAR package HTML_TreeMenu to enable this plugin."; } echo $output; }
if ($DB->get_manager()->table_exists('repository_elisfiles_cats') && $categories = $repo->category_get_children(0)) { echo '<input type="button" value="' . get_string('selectall') . '" onclick="checkall();" />'; echo ' <input type="button" value="' . get_string('deselectall') . '" onclick="checknone();" /><br />'; echo '<input type="submit" value="' . get_string('savechanges') . '" />'; echo '</center><br />'; if ($nodes = elis_files_make_category_select_tree_choose($categories, $catfilter)) { $menu = new HTML_TreeMenu(); for ($i = 0; $i < count($nodes); $i++) { $menu->addItem($nodes[$i]); } $treemenu = new HTML_TreeMenu_DHTML($menu, array( 'images' => $CFG->wwwroot . '/repository/elisfiles/lib/HTML_TreeMenu-1.2.0/images' )); $treemenu->printMenu(); } echo '<center><br />'; echo '<input type="button" value="' . get_string('selectall') . '" onclick="checkall();" />'; echo ' <input type="button" value="' . get_string('deselectall') . '" onclick="checknone();" /><br />'; echo '<input type="submit" value="' . get_string('savechanges') . '" /> '; } else { echo get_string('nocategoriesfound', 'repository_elisfiles'); } echo '</center>'; echo '</form>';
function displaydir($uuid, $wdir, $courseid = 0) { global $USER; global $CFG; global $basedir; global $id; global $oid; global $shared; global $userid; global $choose; global $repo; //global $uuid; global $canedit; global $category; $search = optional_param('search', '', PARAM_CLEAN); /// Get the context instance for where we originated viewing this browser from. if (!empty($oid)) { $cluster_context = get_context_instance(context_level_base::get_custom_context_level('cluster', 'block_curr_admin'), $oid); } if ($id == SITEID) { $context = get_context_instance(CONTEXT_SYSTEM, SITEID); } else { $context = get_context_instance(CONTEXT_COURSE, $id); } $strname = get_string("name"); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("makeafolder"); $struploadafile = get_string("uploadafile"); $strselectall = get_string("selectall"); $strselectnone = get_string("deselectall"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strmovefilestohere = get_string("movefilestohere"); $strdeletecompletely = get_string("deletecompletely"); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); $strbrowserepo = get_string('browserepository', 'repository'); $strdownloadlocal = get_string('downloadlocally', 'repository'); $dirlist = array(); $filelist = array(); $parentdir = new Object(); if (!empty($userid)) { $ustore = $repo->get_user_store($userid); } if (!empty($search)) { $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($userid) && ($uuid == '' || $uuid == $ustore)) { if (empty($uuid)) { $uuid = $ustore; } $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($shared) && ($uuid == '' || $uuid == $repo->suuid)) { if (empty($uuid)) { $uuid = $repo->suuid; } $parentdir->title = ''; $parentdir->url = ''; } else { if (!empty($oid) && ($uuid == '' || $uuid == $repo->get_organization_store($oid))) { if (empty($uuid)) { $uuid = $repo->get_organization_store($oid); } $parentdir->title = ''; $parentdir->url = ''; } else { if ($id != SITEID && ($uuid == '' || !($parent = $repo->get_parent($uuid)) || ($uuid == '' || $uuid == $repo->get_course_store($id)))) { if (empty($uuid)) { $uuid = $repo->get_course_store($id); } $parentdir->title = ''; $parentdir->url = ''; } else { if ($id == SITEID && ($uuid == '' || !($parent = $repo->get_parent($uuid)))) { if (empty($uuid)) { $node = $repo->get_root(); $uuid = $node->uuid; } $parentdir->title = ''; $parentdir->url = ''; } else { $parentdir->uuid = $parent->uuid; $parentdir->name = $parent->title; $parentdir->title = '..'; } } } } } } $dirlist[] = $parentdir; $catselect = array(); if (!empty($search)) { if (($data = data_submitted()) && confirm_sesskey()) { if (!empty($data->categories)) { $catselect = $data->categories; } } else { if (!empty($category)) { $catselect = array($category); } } $search = stripslashes($search); $repodir = $repo->search($search, $catselect); } else { $repodir = $repo->read_dir($uuid); } // Store the UUID value that we are currently browsing. $repo->set_repository_location($uuid, $id, $userid, $shared, $oid); if (!empty($repodir->folders)) { foreach ($repodir->folders as $folder) { $dirlist[] = $folder; } } if (!empty($repodir->files)) { foreach ($repodir->files as $file) { $filelist[] = $file; } } echo '<form action="index.php" method="post" name="reposearch">'; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo "<input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo "<input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo "<input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo "<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" /> "; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; echo '<center>'; echo '<input type="text" name="search" size="40" value="' . s($search) . '" /> '; echo '<input type="submit" value="' . get_string('search') . '" />'; helpbutton('search', get_string('alfrescosearch', 'repository_alfresco'), 'block_repository'); echo '</center><br />'; if ($cats = $repo->category_get_children(0)) { $baseurl = $CFG->wwwroot . '/file/repository/index.php?choose=' . $choose . '&id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=' . $wdir . '&uuid=' . $uuid; $catfilter = repository_alfresco_get_category_filter(); $icon = 'folder.gif'; $eicon = 'folder-expanded.gif'; $menu = new HTML_TreeMenu(); $tnodes = array(); if ($cats = $repo->category_get_children(0)) { if ($nodes = repository_alfresco_make_category_select_tree_browse($cats, $catselect, $baseurl)) { for ($i = 0; $i < count($nodes); $i++) { $menu->addItem($nodes[$i]); } } } $treemenu = new HTML_TreeMenu_DHTML($menu, array('images' => $CFG->wwwroot . '/lib/HTML_TreeMenu-1.2.0/images')); // Add roll up - roll down code here, similar to Show Advanced in course/modedit // Advanced Search/Hide Advanced Search // "category filter" now has help text - so, how to add that too, but use yui library // for hiding this echo '<script language="JavaScript" type="text/javascript">'; echo "<!--\n"; include $CFG->libdir . '/HTML_TreeMenu-1.2.0/TreeMenu.js'; echo "\n// -->"; echo '</script>'; print_simple_box_start('center', '75%'); //looks for search.html file and gets text alfrescosearch from repository_alfresco lang file which I guess we use too... // now hmmm, so where does search.html go? or in our case, categoryfilter.html, I guess repository/alfresco print_heading(helpbutton('categoryfilter', get_string('alfrescocategoryfilter', 'block_repository'), 'block_repository', true, false, null, true) . get_string('categoryfilter', 'block_repository') . ':', 'center', '3'); $treemenu->printMenu(); echo '<br />'; print_simple_box_end(); } echo '</form>'; echo '<center>'; print_single_button('index.php', array('id' => $id, 'shared' => $shared, 'oid' => $oid, 'userid' => $userid, 'uuid' => $uuid), get_string('showall'), 'get'); echo '</center>'; if ($canedit) { echo "<form action=\"index.php\" method=\"post\" name=\"dirform\" id=\"dirform\">"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; } echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\" class=\"files\">"; echo "<tr>"; echo "<th width=\"5\"></th>"; echo "<th align=\"left\" class=\"header name\">{$strname}</th>"; echo "<th align=\"right\" class=\"header size\">{$strsize}</th>"; echo "<th align=\"right\" class=\"header date\">{$strmodified}</th>"; echo "<th align=\"right\" class=\"header commands\">{$straction}</th>"; echo "</tr>\n"; $count = 0; if (!empty($dirlist)) { foreach ($dirlist as $dir) { if (empty($dir->title)) { continue; } echo "<tr class=\"folder\">"; if ($dir->title == '..' || $dir->title == $strbrowserepo) { if (!empty($dir->url)) { print_cell(); if (!empty($search)) { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . $strbrowserepo . '" /></a> <a href="' . $dir->url . '">' . $strbrowserepo . '</a>', 'name'); } else { print_cell('left', '<a href="' . $dir->url . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="' . $dir->url . '">' . get_string('parentfolder') . '</a>', 'name'); } print_cell(); print_cell(); print_cell(); } else { $pdir = urlencode($dir->title); $fileurl = $dir->uuid; print_cell(); print_cell('left', '<a href="index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=' . $pdir . '&uuid=' . $fileurl . '&choose=' . $choose . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&wdir=' . $pdir . '&uuid=' . $fileurl . '&choose=' . $choose . '">' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); } } else { $count++; $filename = $dir->title; $pdir = urlencode($filename); $fileurl = $dir->uuid; $filesafe = rawurlencode($dir->title); $filesize = '-'; $filedate = !empty($dir->modified) ? userdate($dir->modified, "%d %b %Y, %I:%M %p") : '-'; if ($canedit) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" />", 'checkbox'); } else { print_cell(); } print_cell("left", "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&wdir={$pdir}&uuid={$fileurl}&choose={$choose}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> <a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&wdir={$pdir}&uuid={$fileurl}&choose={$choose}\">" . htmlspecialchars($dir->title) . "</a>", 'name'); print_cell("right", $filesize, 'size'); print_cell("right", $filedate, 'date'); print_cell('right', '-', 'commands'); } echo "</tr>"; } } if (!empty($filelist)) { asort($filelist); echo ' <script language="javascript"> <!-- function openextpopup(url,name,options,fullscreen) { windowobj = window.open(url,name,options); if (fullscreen) { windowobj.moveTo(0,0); windowobj.resizeTo(screen.availWidth,screen.availHeight); } windowobj.focus(); return false; } // --> </script> '; foreach ($filelist as $file) { // $icon = $file->icon; $icon = mimeinfo('icon', $file->title); $count++; $filename = $file->title; $fileurl = $CFG->wwwroot . '/file/repository/alfresco/openfile.php?uuid=' . $file->uuid; $filesafe = rawurlencode($file->title); $fileurlsafe = rawurlencode($fileurl); $filedate = !empty($file->modified) ? userdate($file->modified, "%d %b %Y, %I:%M %p") : '-'; $filesize = ''; $selectfile = $fileurl; echo "<tr class=\"file\">"; if ($canedit) { print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$file->uuid}\" />", 'checkbox'); } else { print_cell(); } echo "<td align=\"left\" nowrap=\"nowrap\" class=\"name\">"; if ($CFG->slasharguments) { $ffurl = str_replace('//', '/', "/file.php/{$id}/{$fileurl}"); } else { $ffurl = str_replace('//', '/', "/file.php?file=/{$id}/{$fileurl}"); } $height = 480; $width = 640; $name = '_blank'; $url = $fileurl; $title = 'Popup window'; $linkname = "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$file->title}\" />"; $options = 'menubar=0,location=0,scrollbars,resizable,width=' . $width . ',height=' . $height; if (!empty($search) && !empty($file->parent)) { $pdir = urlencode($file->parent->name); $fileurl = $file->parent->uuid; $motext = get_string('parentfolder', 'repository', $file->parent->name); echo "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&wdir={$pdir}&uuid={$fileurl}&choose={$choose}\" title=\"{$motext}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> "; } echo '<a target="' . $name . '" title="' . $title . '" href="' . $url . '" ' . ">{$linkname}</a>"; echo ' '; $linkname = htmlspecialchars($file->title); echo '<a target="' . $name . '" title="' . $title . '" href="' . $url . '" ' . ">{$linkname}</a>"; echo "</td>"; print_cell("right", display_size(isset($file->filesize) ? $file->filesize : '-'), 'size'); print_cell("right", $filedate, 'date'); if ($choose) { $edittext = "<strong><a onclick=\"return set_value('{$selectfile}')\" href=\"#\">{$strchoose}</a></strong> "; } else { $edittext = ''; } if (strstr($icon, 'zip.gif') !== false) { $edittext .= "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&uuid={$file->uuid}&action=unzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strunzip}</a> "; $edittext .= "<a href=\"index.php?id={$id}&shared={$shared}&oid={$oid}&userid={$userid}&uuid={$file->uuid}&action=listzip&sesskey={$USER->sesskey}&choose={$choose}\">{$strlist}</a> "; } /// User's cannot download files locally if they cannot access the local file storage. if (has_capability('moodle/course:managefiles', $context)) { $popupurl = '/files/index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&repouuid=' . $file->uuid . '&repofile=' . $filesafe . '&dd=1'; $edittext .= link_to_popup_window($popupurl, 'coursefiles', $strdownloadlocal, 500, 750, $strdownloadlocal, 'none', true); } print_cell('right', $edittext, 'commands'); echo "</tr>"; } } echo "</table>"; echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; /// Don't display the editing form buttons (yet). if (empty($search)) { echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"640\">"; echo "<tr><td>"; if ($canedit) { echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo "<input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo "<input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo "<input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo '<input type="hidden" name="choose" value="' . $choose . '" />'; echo "<input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" /> "; echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; $options = array('move' => $strmovetoanotherfolder, 'delete' => $strdeletecompletely, 'zip' => $strcreateziparchive); if (!empty($count)) { choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:document.dirform.submit()"); } } echo "</form>"; echo "<td align=\"center\">"; if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $uuid) { echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo " <input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo " <input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo " <input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />"; echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />"; echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />"; echo "</form>"; } echo "</td>"; if ($canedit) { echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo " <input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo " <input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo " <input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"makedir\" />"; echo " <input type=\"submit\" value=\"{$strmakeafolder}\" />"; echo "</form>"; echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; //dummy form - alignment only echo " <input type=\"button\" value=\"{$strselectall}\" onclick=\"checkall();\" />"; echo " <input type=\"button\" value=\"{$strselectnone}\" onclick=\"uncheckall();\" />"; echo "</form>"; echo "</td>"; echo "<td align=\"right\">"; echo "<form action=\"index.php\" method=\"get\">"; echo ' <input type="hidden" name="choose" value="' . $choose . '" />'; echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />"; echo " <input type=\"hidden\" name=\"oid\" value=\"{$oid}\" />"; echo " <input type=\"hidden\" name=\"shared\" value=\"{$shared}\" />"; echo " <input type=\"hidden\" name=\"userid\" value=\"{$userid}\" />"; echo " <input type=\"hidden\" name=\"uuid\" value=\"{$uuid}\" />"; echo " <input type=\"hidden\" name=\"action\" value=\"upload\" />"; echo " <input type=\"submit\" value=\"{$struploadafile}\" />"; echo "</form>"; echo "</td>"; } echo '</tr>'; echo "</table>"; } else { $url = 'index.php?id=' . $id . '&shared=' . $shared . '&oid=' . $oid . '&userid=' . $userid . '&uuid=' . $uuid; echo '<h3><a href="' . $url . '">' . get_string('returntofilelist', 'repository') . '</a></h3>'; } if ($canedit) { echo "<hr width=\"640\" align=\"center\" noshade=\"noshade\" size=\"1\" />"; } }