/** * 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"); }
function toHTML() { // I'm Still having erratic problems with NN4 // Hence this check. if ($GLOBALS['tmsDoesMenus'] == 'maybe') { $tmb = new ccBrowserInfo(); $GLOBALS['tmsDoesMenus'] = $tmb->is_ie5up() || $tmb->is_moz5up(); } if (!$GLOBALS['tmsDoesMenus']) { $this_sucks =& new HTML_TreeMenu_RigidXL($this->menu, array('images' => $this->images, 'defaultClass' => $this->defaultClass, 'autostyles' => $this->autostyles, 'linkSelectKey' => $this->linkSelectKey, 'lineImageWidth' => $this->lineImageWidth, 'lineImageHeight' => $this->lineImageHeight, 'iconImageWidth' => $this->iconImageWidth, 'iconImageHeight' => $this->iconImageHeight, 'linkTarget' => $this->linkTarget, 'selectedStyle' => $this->selectedStyle, 'brOK' => $this->brOK)); return $this_sucks->toHTML(); } // Expand the branch(es), if any, that contain nodes with matching links. if (!empty($this->linkSelectKey)) { $keys = $this->linkSelectKey; if (!is_array($keys)) { $keys = array($keys); } foreach ($keys as $key) { $this->_expandSelected($this->menu, $key); } } // Is the entire menu "expanded"? Then make it so... if (isset($this->expanded) && $this->expanded) { for ($i = 0; $i < count($this->menu->items); $i++) { $this->menu->items[$i]->setChildProperties(array('expanded' => true)); } } return HTML_TreeMenu_DHTML::toHTML(); }
/** * 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; }