/**
		 * 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>";
		}
Exemplo n.º 2
0
 /**
  * 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");
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
 /**
  * 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;
 }
Exemplo n.º 6
0
 /**
  * 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;
 }
Exemplo n.º 7
0
<?php

/**
Map a filesystem with HTML TreeMenu
@author Tomas V.V.Cox <*****@*****.**>
*/
require_once '../HTML_TreeMenu/TreeMenu.php';
$map_dir = '.';
$menu = new HTML_TreeMenu('menuLayer', 'images', '_self');
$menu->addItem(recurseDir($map_dir));
function &recurseDir($path)
{
    if (!($dir = opendir($path))) {
        return false;
    }
    $files = array();
    $node = new HTML_TreeNode(basename($path), basename($path), 'folder.gif');
    while (($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (@is_dir("{$path}/{$file}")) {
                $addnode =& recurseDir("{$path}/{$file}");
            } else {
                $addnode = new HTML_TreeNode($file, $file, 'document2.png');
            }
            $node->addItem($addnode);
        }
    }
    closedir($dir);
    return $node;
}
?>
function manage_category()
{
    global $hesk_settings, $hesklang;
    $catid = intval(hesk_GET('catid')) or hesk_error($hesklang['kb_cat_inv']);
    $result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'kb_categories` ORDER BY `parent` ASC, `cat_order` ASC');
    $kb_cat = array();
    while ($cat = hesk_dbFetchAssoc($result)) {
        $kb_cat[] = $cat;
        if ($cat['id'] == $catid) {
            $this_cat = $cat;
        }
    }
    if (isset($_SESSION['manage_cat'])) {
        $_SESSION['manage_cat'] = hesk_stripArray($_SESSION['manage_cat']);
        $this_cat['type'] = $_SESSION['manage_cat']['type'];
        $this_cat['parent'] = $_SESSION['manage_cat']['parent'];
        $this_cat['name'] = $_SESSION['manage_cat']['title'];
    }
    /* Translate main category "Knowledgebase" if needed */
    $kb_cat[0]['name'] = $hesklang['kb_text'];
    require HESK_PATH . 'inc/treemenu/TreeMenu.php';
    $icon = HESK_PATH . 'img/folder.gif';
    $expandedIcon = HESK_PATH . 'img/folder-expanded.gif';
    $menu = new HTML_TreeMenu();
    $thislevel = array('0');
    $nextlevel = array();
    $i = 1;
    $j = 1;
    while (count($kb_cat) > 0) {
        foreach ($kb_cat as $k => $cat) {
            if (in_array($cat['parent'], $thislevel)) {
                $up = $cat['parent'];
                $my = $cat['id'];
                $type = $cat['type'] ? '*' : '';
                $text_short = $cat['name'] . $type . ' (' . $cat['articles'] . ', ' . $cat['articles_private'] . ', ' . $cat['articles_draft'] . ')';
                if (isset($node[$up])) {
                    $node[$my] =& $node[$up]->addItem(new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true)));
                } else {
                    $node[$my] = new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true));
                }
                $nextlevel[] = $cat['id'];
                $j++;
                unset($kb_cat[$k]);
            }
        }
        $thislevel = $nextlevel;
        $nextlevel = array();
        /* Break after 20 recursions to avoid hang-ups in case of any problems */
        if ($i > 20) {
            break;
        }
        $i++;
    }
    $menu->addItem($node[1]);
    // Create the presentation class
    $listBox =& ref_new(new HTML_TreeMenu_Listbox($menu));
    /* Print header */
    require_once HESK_PATH . 'inc/header.inc.php';
    /* Print main manage users page */
    require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
    ?>

	
     <div class="container manage-kb-category-title"><a href="manage_knowledgebase.php" class="smaller"><b><?php 
    echo $hesklang['kb'];
    ?>
</b></a> &gt; <?php 
    echo $hesklang['kb_cat_man'];
    ?>
</div>

	<!-- SUB NAVIGATION -->
	<?php 
    show_subnav('', $catid);
    ?>
	<!-- SUB NAVIGATION -->

	<?php 
    if (!isset($_SESSION['hide']['article_list'])) {
        ?>

     <div class="container category-kb"><?php 
        echo $hesklang['category'];
        ?>
: <span class="black"><?php 
        echo $this_cat['name'];
        ?>
</span></div>

    &nbsp;<br />

    <?php 
        $result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' ORDER BY `sticky` DESC, `art_order` ASC");
        $num = hesk_dbNumRows($result);
        if ($num == 0) {
            echo '<div class="container kb_no_article">' . $hesklang['kb_no_art'] . ' &nbsp;<br/><br/> 
		<a href="manage_knowledgebase.php?a=add_article&amp;catid=' . $catid . '"><img src="../img/add_article.png" width="16" height="16" alt="' . $hesklang['kb_i_art2'] . '" title="' . $hesklang['kb_i_art2'] . '" border="0" style="border:none;vertical-align:text-bottom" /></a>' . '<a href="manage_knowledgebase.php?a=add_article&amp;catid=' . $catid . '"><b>' . $hesklang['kb_i_art2'] . '</b></a></div>';
        } else {
            /* Get number of sticky articles */
            $res2 = hesk_dbQuery("SELECT COUNT(*) FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' AND `sticky` = '1' ");
            $num_sticky = hesk_dbResult($res2);
            $num_nosticky = $num - $num_sticky;
            ?>
        <div class="container insertArticle">
	        <?php 
            echo '<a href="manage_knowledgebase.php?a=add_article&amp;catid=' . $catid . '"><img src="../img/add_article.png" width="16" height="16" alt="' . $hesklang['kb_i_art2'] . '" title="' . $hesklang['kb_i_art2'] . '" border="0" style="border:none;vertical-align:text-bottom" /></a> <a href="manage_knowledgebase.php?a=add_article&amp;catid=' . $catid . '"><b>' . $hesklang['kb_i_art2'] . '</b></a>';
            ?>
	    </div>

	     <div class="container kb_cat_art_title"><?php 
            echo $hesklang['kb_cat_art'];
            ?>
</div>

		<div class="container">
		<table class="table table-bordered table-responsive kb_cat_art_table">
		<tr>
        <th class="admin_white">&nbsp;</th>
		<th class="admin_white"><b><i><?php 
            echo $hesklang['kb_subject'];
            ?>
</i></b></th>
		<th class="admin_white"><b><i><?php 
            echo $hesklang['kb_type'];
            ?>
</i></b></th>
        <th class="admin_white"><b><i><?php 
            echo $hesklang['views'];
            ?>
</i></b></th>
        <?php 
            if ($hesk_settings['kb_rating']) {
                ?>
	        <th class="admin_white" style="white-space:nowrap" nowrap="nowrap" width="130"><b><i><?php 
                echo $hesklang['rating'] . ' (' . $hesklang['votes'] . ')';
                ?>
</i></b></th>
	        <?php 
            }
            ?>
        <th class="admin_white" style="width:120px"><b><i>&nbsp;<?php 
            echo $hesklang['opt'];
            ?>
&nbsp;</i></b></th>
		</tr>
    	<?php 
            $i = 1;
            $j = 1;
            $k = 1;
            $previous_sticky = 1;
            $num = $num_sticky;
            while ($article = hesk_dbFetchAssoc($result)) {
                if ($previous_sticky != $article['sticky']) {
                    $k = 1;
                    $num = $num_nosticky;
                    $previous_sticky = $article['sticky'];
                }
                if (isset($_SESSION['artord']) && $article['id'] == $_SESSION['artord']) {
                    $color = 'admin_green';
                    unset($_SESSION['artord']);
                } elseif ($article['sticky']) {
                    $color = 'admin_yellow';
                } else {
                    $color = $i ? 'admin_white' : 'admin_gray';
                }
                $tmp = $i ? 'White' : 'Blue';
                $style = 'class="option' . $tmp . 'OFF" onmouseover="this.className=\'option' . $tmp . 'ON\'" onmouseout="this.className=\'option' . $tmp . 'OFF\'"';
                $i = $i ? 0 : 1;
                switch ($article['type']) {
                    case '1':
                        $type = '<span class="kb_private">' . $hesklang['kb_private'] . '</span>';
                        break;
                    case '2':
                        $type = '<span class="kb_draft">' . $hesklang['kb_draft'] . '</span>';
                        break;
                    default:
                        $type = '<span class="kb_published">' . $hesklang['kb_published'] . '</span>';
                }
                if ($hesk_settings['kb_rating']) {
                    $alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated'];
                    $rat = '<td class="' . $color . '" style="white-space:nowrap;"><img src="../img/star_' . hesk_round_to_half($article['rating']) * 10 . '.png" width="85" height="16" alt="' . $alt . '" title="' . $alt . '" border="0" style="vertical-align:text-bottom" /> (' . $article['votes'] . ') </td>';
                } else {
                    $rat = '';
                }
                ?>
			<tr>
			<td class="<?php 
                echo $color;
                ?>
"><?php 
                echo $j;
                ?>
.</td>
			<td class="<?php 
                echo $color;
                ?>
"><?php 
                echo $article['subject'];
                ?>
</td>
            <td class="<?php 
                echo $color;
                ?>
"><?php 
                echo $type;
                ?>
</td>
            <td class="<?php 
                echo $color;
                ?>
"><?php 
                echo $article['views'];
                ?>
</td>
            <?php 
                echo $rat;
                ?>
            <td class="<?php 
                echo $color;
                ?>
" style="text-align:center; white-space:nowrap;">
			<?php 
                if ($num > 1) {
                    if ($k == 1) {
                        ?>
                    <img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;" />
                	<a href="manage_knowledgebase.php?a=order_article&amp;id=<?php 
                        echo $article['id'];
                        ?>
&amp;catid=<?php 
                        echo $catid;
                        ?>
&amp;move=15&amp;token=<?php 
                        hesk_token_echo();
                        ?>
"><img src="../img/move_down.png" width="16" height="16" alt="<?php 
                        echo $hesklang['move_dn'];
                        ?>
" title="<?php 
                        echo $hesklang['move_dn'];
                        ?>
" <?php 
                        echo $style;
                        ?>
 /></a>
	            <?php 
                    } elseif ($k == $num) {
                        ?>
					<a href="manage_knowledgebase.php?a=order_article&amp;id=<?php 
                        echo $article['id'];
                        ?>
&amp;catid=<?php 
                        echo $catid;
                        ?>
&amp;move=-15&amp;token=<?php 
                        hesk_token_echo();
                        ?>
"><img src="../img/move_up.png" width="16" height="16" alt="<?php 
                        echo $hesklang['move_up'];
                        ?>
" title="<?php 
                        echo $hesklang['move_up'];
                        ?>
" <?php 
                        echo $style;
                        ?>
 /></a>
                    <img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;" />
	            <?php 
                    } else {
                        ?>
					<a href="manage_knowledgebase.php?a=order_article&amp;id=<?php 
                        echo $article['id'];
                        ?>
&amp;catid=<?php 
                        echo $catid;
                        ?>
&amp;move=-15&amp;token=<?php 
                        hesk_token_echo();
                        ?>
"><img src="../img/move_up.png" width="16" height="16" alt="<?php 
                        echo $hesklang['move_up'];
                        ?>
" title="<?php 
                        echo $hesklang['move_up'];
                        ?>
" <?php 
                        echo $style;
                        ?>
 /></a>
					<a href="manage_knowledgebase.php?a=order_article&amp;id=<?php 
                        echo $article['id'];
                        ?>
&amp;catid=<?php 
                        echo $catid;
                        ?>
&amp;move=15&amp;token=<?php 
                        hesk_token_echo();
                        ?>
"><img src="../img/move_down.png" width="16" height="16" alt="<?php 
                        echo $hesklang['move_dn'];
                        ?>
" title="<?php 
                        echo $hesklang['move_dn'];
                        ?>
" <?php 
                        echo $style;
                        ?>
 /></a>
	            <?php 
                    }
                } elseif ($num_sticky > 1 || $num_nosticky > 1) {
                    echo '<img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;vertical-align:text-bottom;" /> <img src="../img/blank.gif" width="16" height="16" alt="" style="padding:3px;border:none;vertical-align:text-bottom;" />';
                }
                ?>
            <a href="manage_knowledgebase.php?a=sticky&amp;s=<?php 
                echo $article['sticky'] ? 0 : 1;
                ?>
&amp;id=<?php 
                echo $article['id'];
                ?>
&amp;catid=<?php 
                echo $catid;
                ?>
&amp;token=<?php 
                hesk_token_echo();
                ?>
"><img src="../img/sticky<?php 
                if (!$article['sticky']) {
                    echo '_off';
                }
                ?>
.png" width="16" height="16" alt="<?php 
                echo $article['sticky'] ? $hesklang['stickyoff'] : $hesklang['stickyon'];
                ?>
" title="<?php 
                echo $article['sticky'] ? $hesklang['stickyoff'] : $hesklang['stickyon'];
                ?>
" <?php 
                echo $style;
                ?>
 /></a>
            <a href="knowledgebase_private.php?article=<?php 
                echo $article['id'];
                ?>
&amp;back=1<?php 
                if ($article['type'] == 2) {
                    echo '&amp;draft=1';
                }
                ?>
" target="_blank"><img src="../img/article_text.png" width="16" height="16" alt="<?php 
                echo $hesklang['viewart'];
                ?>
" title="<?php 
                echo $hesklang['viewart'];
                ?>
" <?php 
                echo $style;
                ?>
 /></a>
            <a href="manage_knowledgebase.php?a=edit_article&amp;id=<?php 
                echo $article['id'];
                ?>
"><img src="../img/edit.png" width="16" height="16" alt="<?php 
                echo $hesklang['edit'];
                ?>
" title="<?php 
                echo $hesklang['edit'];
                ?>
" <?php 
                echo $style;
                ?>
 /></a>
            <a href="manage_knowledgebase.php?a=remove_article&amp;id=<?php 
                echo $article['id'];
                ?>
&amp;token=<?php 
                hesk_token_echo();
                ?>
" onclick="return hesk_confirmExecute('<?php 
                echo hesk_makeJsString($hesklang['del_art']);
                ?>
');"><img src="../img/delete.png" width="16" height="16" alt="<?php 
                echo $hesklang['delete'];
                ?>
" title="<?php 
                echo $hesklang['delete'];
                ?>
" <?php 
                echo $style;
                ?>
 /></a>&nbsp;</td>
			</tr>
            <?php 
                $j++;
                $k++;
            }
            // End while
            ?>
		</table>
		</div>
		<?php 
        }
    }
    // END if hide article list
    /* Manage Category (except the default one) */
    if ($catid != 1) {
        ?>

        &nbsp;<br />


    <div class="container insertCategory">
		<?php 
        echo '<a href="manage_knowledgebase.php?a=add_category&amp;parent=' . $catid . '"><img src="../img/add_category.png" width="16" height="16" alt="' . $hesklang['kb_i_cat2'] . '" title="' . $hesklang['kb_i_cat2'] . '" border="0" style="border:none;vertical-align:text-bottom" /></a> <a href="manage_knowledgebase.php?a=add_category&amp;parent=' . $catid . '"><b>' . $hesklang['kb_i_cat2'] . '</b></a>';
        ?>
	</div>

	<div class="container category-settings-title"><?php 
        echo $hesklang['catset'];
        ?>
</div>
	<div class="container category-settings-form">
	<br/>
		<form action="manage_knowledgebase.php" method="post" name="form1" onsubmit="Javascript:return hesk_deleteIfSelected('dodelete','<?php 
        echo hesk_makeJsString($hesklang['kb_delcat']);
        ?>
')">
			<div class="form-inline">
				<span class="col-sm-2"><b><?php 
        echo $hesklang['kb_cat_title'];
        ?>
:</b></span>
				<span><input class="form-control" type="text" name="title" size="70" maxlength="255" value="<?php 
        echo $this_cat['name'];
        ?>
" /></span>
			</div>
			<br/>
			<div class="form-inline">
				<span class="col-sm-2"><b><?php 
        echo $hesklang['kb_cat_parent'];
        ?>
:</b></span>
				<span><select class="form-control" name="parent"><?php 
        $listBox->printMenu();
        ?>
</select></span>
			</div>
			<br/>
			<div class="form-inline">
				<span class="col-sm-2"><b><?php 
        echo $hesklang['kb_type'];
        ?>
:</b></span>
				<div class="form-group">
					<label><input type="radio" name="type" value="0" <?php 
        if (!$this_cat['type']) {
            echo 'checked="checked"';
        }
        ?>
 /> <b><i><?php 
        echo $hesklang['kb_published'];
        ?>
</i></b></label><br />
					<span><?php 
        echo $hesklang['kb_cat_published'];
        ?>
</span><br/><br/>
					<label><input type="radio" name="type" value="1" <?php 
        if ($this_cat['type']) {
            echo 'checked="checked"';
        }
        ?>
 /> <b><i><?php 
        echo $hesklang['kb_private'];
        ?>
</i></b></label><br />
					<span><?php 
        echo $hesklang['kb_cat_private'];
        ?>
</span>
				</div>
			</div>
			<br/>
	        <div class="form-inline">
				<span class="col-sm-2"><b><?php 
        echo $hesklang['opt'];
        ?>
:</b></span>
				<div class="form-group">
					<label><input type="checkbox" name="dodelete" id="dodelete" value="Y" onclick="Javascript:hesk_toggleLayerDisplay('deleteoptions')" /> <i><?php 
        echo $hesklang['delcat'];
        ?>
</i></label>
					<div id="deleteoptions" style="display: none;">
					<label><input type="radio" name="movearticles" value="Y" checked="checked" /> <?php 
        echo $hesklang['move1'];
        ?>
</label><br />
					<label><input type="radio" name="movearticles" value="N" /> <?php 
        echo $hesklang['move2'];
        ?>
</label>
					</div>
				</div>
	        </div>
			<br/>
	</div>
	<br/>
		<div class="col-sm-6 col-sm-offset-6">
			<input type="hidden" name="a" value="edit_category" />
	        <input type="hidden" name="token" value="<?php 
        hesk_token_echo();
        ?>
" />
	        <input type="hidden" name="catid" value="<?php 
        echo $catid;
        ?>
" /><input type="submit" value="<?php 
        echo $hesklang['save_changes'];
        ?>
" class="btn btn-default save-cat-changes-btn" />
		</div>
	</form>
	

	<?php 
    }
    // END if $catid != 1
    /* Clean unneeded session variables */
    hesk_cleanSessionVars(array('hide', 'manage_cat', 'edit_article'));
    require_once HESK_PATH . 'inc/footer.inc.php';
    exit;
}
Exemplo n.º 9
0
function displayMenuRecords()
{
    global $_CONF, $_TABLES, $CONF_NEXMENU, $LANG_NEXMENU01, $LANG_NEXMENU02, $menulocation;
    global $statusmsg, $imagesdir, $folder_icon, $showdisabled, $idCurrent, $LANG_NEXMENU04;
    include $_CONF['path_system'] . 'classes/navbar.class.php';
    require_once $_CONF['path_system'] . 'nexpro/classes/TreeMenu.php';
    $menu = new HTML_TreeMenu();
    $mquery = DB_query("SELECT id,pid,label,menuorder, menutype, is_enabled from {$_TABLES['nexmenu']} WHERE pid='0' AND location='{$menulocation}' ORDER BY menuorder");
    $menuOrd = 10;
    $stepNumber = 10;
    while (list($id, $pid, $label, $order, $menutype, $enabled) = DB_fetchARRAY($mquery)) {
        /* Re-order any Offer or Stories that may have just been moved */
        if ($order != $menuOrd) {
            DB_query("UPDATE {$_TABLES['nexmenu']} SET menuorder = '{$menuOrd}' WHERE id = '{$id}'");
        }
        $menuOrd += $stepNumber;
        if ($enabled == '1' or $showdisabled == '1' and $enabled == '0') {
            $icon = $CONF_NEXMENU['icons'][$menutype];
            if ($idCurrent == $id) {
                $label = '<span class="treeMenuSelected">' . $label . '</span>';
            } elseif ($enabled == '0') {
                $label = '<span class="treeMenuDisabled">' . $label . '</span>';
            }
            $node[$id] = new HTML_TreeNode(array('text' => $label, 'link' => $_CONF['site_admin_url'] . "/plugins/nexmenu/index.php?op=display&id={$id}&showdisabled={$showdisabled}&menulocation={$menulocation}", 'icon' => $icon));
            recursive_node($node[$id], $id);
            $menu->addItem($node[$id]);
        }
    }
    $treeMenu =& new HTML_TreeMenu_DHTML($menu, array('images' => $imagesdir, 'defaultClass' => 'treeMenuDefault', 'usePersistance' => true));
    $mainview = new Template($_CONF['path_layout'] . 'nexmenu/admin');
    $mainview->set_file(array('mainview' => 'mainview.thtml'));
    $mainview->set_var('site_url', $_CONF['site_url']);
    if ($statusmsg != '') {
        $mainview->set_var('showalert', '');
    } else {
        $mainview->set_var('showalert', 'none');
    }
    $mainview->set_var('statusmsg', $statusmsg);
    $mainview->set_var('imgset', $_CONF['layout_url'] . '/nexmenu/images/admin');
    if ($showdisabled == '1') {
        $mainview->set_var('chk_enabled', 'CHECKED');
    } else {
        $mainview->set_var('chk_disabled', 'CHECKED');
    }
    if ($statusmsg != '') {
        $mainview->set_var('statusmsg', $statusmsg);
    }
    if ($CONF_NEXMENU['load_HTMLTree']) {
        $javascript = "<script language=JavaScript src=\"{$_CONF['site_url']}/nexmenu/javascript/TreeMenu.js\" type=\"text/javascript\"></script>";
        $mainview->set_var('include_javascript', $javascript);
    }
    $scripturl = $_CONF['site_admin_url'] . '/plugins/nexmenu/index.php';
    $navbar = new navbar();
    $navbar->add_menuitem($LANG_NEXMENU04['1'], $scripturl . "?menulocation=header&showdisabled={$showdisabled}");
    $navbar->add_menuitem($LANG_NEXMENU04['2'], $scripturl . "?menulocation=block&showdisabled={$showdisabled}");
    $navbar->add_menuitem($LANG_NEXMENU04['3'], $scripturl . "?op=addaction&id={$idCurrent}&menulocation={$menulocation}&showdisabled={$showdisabled}");
    $navbar->add_menuitem($LANG_NEXMENU04['6'], $scripturl . "?op=config&menulocation=block&showdisabled={$showdisabled}");
    if ($menulocation == 'block') {
        $navbar->set_selected($LANG_NEXMENU04['2']);
        $mainview->set_var('navbar', $navbar->generate());
        $mainview->set_var('location', 'block');
    } else {
        $navbar->set_selected($LANG_NEXMENU04['1']);
        $mainview->set_var('navbar', $navbar->generate());
        $mainview->set_var('location', 'header');
    }
    $mainview->set_var('LANG_OPTIONS', $LANG_NEXMENU01['LANG_OPTIONS']);
    $mainview->set_var('LANG_ADD', $LANG_NEXMENU01['LANG_ADD']);
    $mainview->set_var('LANG_HEADING1', $LANG_NEXMENU01['LANG_HEADING1']);
    $mainview->set_var('treemenu', $treeMenu->toHTML());
    $filteroptions = '<option value=\'block\' ';
    $filteroptions .= $menulocation == 'block' ? 'SELECTED' : '';
    $filteroptions .= '>Block Menu Items</option><option value=\'header\' ';
    $filteroptions .= $menulocation == 'header' ? 'SELECTED' : '';
    $filteroptions .= '>Header Menu Items</option>';
    $mainview->set_var('filteroptions', $filteroptions);
    if ($idCurrent == 0 or DB_getItem($_TABLES['nexmenu'], "location", "id='{$idCurrent}'") != $menulocation) {
        $mainview->set_var('showdiv', 'none');
        $mainview->set_var('LANG_edithelp', $LANG_NEXMENU01['LANG_EditHelp']);
    } else {
        $mainview->set_var('show_itemhelp', 'none');
        $mainview->set_var('LANG_HEADING2', $LANG_NEXMENU01['LANG_HEADING2']);
        $query = DB_query("SELECT pid, menutype, menuorder, label, url, grp_access, is_enabled FROM {$_TABLES['nexmenu']} WHERE id={$idCurrent}");
        list($pid, $menutype, $order, $label, $url, $grp_id, $is_enabled) = DB_fetchArray($query);
        $chk1 = $is_enabled == 1 ? ' checked' : '';
        if ($pid == 0) {
            $parent = $LANG_NEXMENU01['LANG_TopLevelMenu'];
        } else {
            $parent = DB_getItem($_TABLES['nexmenu'], "label", "id={$pid}");
        }
        if (trim($url) == '') {
            $url = 'Not Defined';
        }
        $mainview->set_var('showurl', $menutype == 3 ? 'none' : '');
        $mainview->set_var('id', $idCurrent);
        $mainview->set_var('location', $menulocation);
        $mainview->set_var('label', stripslashes($label));
        $mainview->set_var('parent', $parent);
        $mainview->set_var('url', substr($url, 0, 40));
        $mainview->set_var('full_url', $url);
        $mainview->set_var('order', $order);
        $mainview->set_var('menutype', $LANG_NEXMENU02[$menutype]);
        $mainview->set_var('chk1', $chk1);
        $mainview->set_var('chk2', $chk2);
        $mainview->set_var('chk3', $chk3);
        $mainview->set_var('showdisabled', $showdisabled);
        $mainview->set_var('LANG_MenuItemAdmin', $LANG_NEXMENU01['LANG_MenuItemAdmin']);
        $mainview->set_var('LANG_ParentMenu', $LANG_NEXMENU01['LANG_ParentMenu']);
        $mainview->set_var('LANG_ORDER', $LANG_NEXMENU01['LANG_ORDER']);
        $mainview->set_var('LANG_Enabled', $LANG_NEXMENU01['LANG_Enabled']);
        $mainview->set_var('LANG_Submenu', $LANG_NEXMENU01['LANG_Submenu']);
        $mainview->set_var('LANG_URLITEM', $LANG_NEXMENU01['LANG_URLITEM']);
        $mainview->set_var('LANG_ACCESS', $LANG_NEXMENU01['LANG_ACCESS']);
        $mainview->set_var('grp_access', getMenuGroupAccessOption($grp_id));
        $mainview->set_var('LANG_EditRecord', $LANG_NEXMENU01['LANG_EditRecord']);
        $mainview->set_var('LANG_DeleteRecord', $LANG_NEXMENU01['LANG_DeleteRecord']);
        $mainview->set_var('LANG_MoveUp', $LANG_NEXMENU01['LANG_MoveUp']);
        $mainview->set_var('LANG_MoveDn', $LANG_NEXMENU01['LANG_MoveDn']);
        $mainview->set_var('LANG_DELCONFIRM', $LANG_NEXMENU01['LANG_DELCONFIRM']);
        $mainview->set_var('chk1', $chk1);
    }
    $mainview->parse('output', 'mainview');
    return $mainview->finish($mainview->get_var('output'));
}
Exemplo n.º 10
0
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 . '&amp;id=' . $id . '&amp;shared=' . $shared . '&amp;oid=' . $oid . '&amp;userid=' . $userid . '&amp;wdir=' . $wdir . '&amp;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 . '&amp;shared=' . $shared . '&amp;oid=' . $oid . '&amp;userid=' . $userid . '&amp;wdir=' . $pdir . '&amp;uuid=' . $fileurl . '&amp;choose=' . $choose . '"><img src="' . $CFG->pixpath . '/f/parent.gif" height="16" width="16" alt="' . get_string('parentfolder') . '" /></a> <a href="index.php?id=' . $id . '&amp;shared=' . $shared . '&amp;oid=' . $oid . '&amp;userid=' . $userid . '&amp;wdir=' . $pdir . '&amp;uuid=' . $fileurl . '&amp;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}&amp;shared={$shared}&amp;oid={$oid}&amp;userid={$userid}&amp;wdir={$pdir}&amp;uuid={$fileurl}&amp;choose={$choose}\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"Folder\" /></a> <a href=\"index.php?id={$id}&amp;shared={$shared}&amp;oid={$oid}&amp;userid={$userid}&amp;wdir={$pdir}&amp;uuid={$fileurl}&amp;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}&amp;shared={$shared}&amp;oid={$oid}&amp;userid={$userid}&amp;wdir={$pdir}&amp;uuid={$fileurl}&amp;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 '&nbsp;';
            $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>&nbsp;";
            } else {
                $edittext = '';
            }
            if (strstr($icon, 'zip.gif') !== false) {
                $edittext .= "<a href=\"index.php?id={$id}&amp;shared={$shared}&amp;oid={$oid}&amp;userid={$userid}&amp;uuid={$file->uuid}&amp;action=unzip&amp;sesskey={$USER->sesskey}&amp;choose={$choose}\">{$strunzip}</a>&nbsp;";
                $edittext .= "<a href=\"index.php?id={$id}&amp;shared={$shared}&amp;oid={$oid}&amp;userid={$userid}&amp;uuid={$file->uuid}&amp;action=listzip&amp;sesskey={$USER->sesskey}&amp;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 . '&amp;shared=' . $shared . '&amp;oid=' . $oid . '&amp;userid=' . $userid . '&amp;repouuid=' . $file->uuid . '&amp;repofile=' . $filesafe . '&amp;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 . '&amp;shared=' . $shared . '&amp;oid=' . $oid . '&amp;userid=' . $userid . '&amp;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\" />";
    }
}
Exemplo n.º 11
0
    {
        $this->path = $path;
        $options = array();
        if ($text) {
            $options['text'] = $text;
        }
        if ($link) {
            $options['link'] = $link;
        }
        if ($icon) {
            $options['icon'] = $icon;
        }
        HTML_TreeNode::HTML_TreeNode($options, $events);
    }
}
$menu = new HTML_TreeMenu();
$filename = '';
if (isset($_GET) && isset($_GET['fileName'])) {
    $filename = $_GET['fileName'];
}
$filename = realpath($filename);
$pd = substr(PHP_OS, 0, 3) == 'WIN' ? '\\' : '/';
$test = $pd == '/' ? '/' : 'C:\\';
if (empty($filename) || $filename == $test) {
    $filename = $pd == '/' ? '/' : 'C:\\';
    $node = false;
    getDir($filename, $node);
} else {
    flush();
    //            if ($pd != '/') $pd = $pd.$pd;
    $anode = false;
 /**
  * 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;
 }
    }
}
/// Get (or create) the array of category IDs that are already selected in the filter.
$catfilter = repository_alfresco_get_category_filter();
print_simple_box_start('center', '75%');
echo '<form method="post" action="' . $CFG->wwwroot . '/file//repository/alfresco/config-categories.php">';
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
echo '<center>';
echo '<input type="submit" name="reset" value="' . get_string('resetcategories', 'repository_alfresco') . '" /><br />' . get_string('resetcategoriesdesc', 'repository_alfresco') . '<br /><br />';
if ($categories = $repo->category_get_children(0)) {
    echo '<input type="button" value="' . get_string('selectall') . '" onclick="checkall();" />';
    echo '&nbsp;<input type="button" value="' . get_string('deselectall') . '" onclick="checknone();" /><br />';
    echo '<input type="submit" value="' . get_string('savechanges') . '" />';
    echo '</center><br />';
    if ($nodes = repository_alfresco_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 . '/lib/HTML_TreeMenu-1.2.0/images'));
        echo '<script language="JavaScript" type="text/javascript">';
        echo "<!--\n";
        include $CFG->libdir . '/HTML_TreeMenu-1.2.0/TreeMenu.js';
        echo "\n// -->";
        echo '</script>';
        $treemenu->printMenu();
    }
    echo '<center><br />';
    echo '<input type="button" value="' . get_string('selectall') . '" onclick="checkall();" />';
    echo '&nbsp;<input type="button" value="' . get_string('deselectall') . '" onclick="checknone();" /><br />';
    echo '<input type="submit" value="' . get_string('savechanges') . '" /> ' . close_window_button('closewindow', true);
<?php

/**
Map a filesystem with HTML TreeMenu
@author Tomas V.V.Cox <*****@*****.**>
*/
require_once '../HTML_TreeMenu/TreeMenu.php';
$map_dir = '.';
$menu = new HTML_TreeMenu('menuLayer', 'images', '_self');
$menu->addItem(recurseDir($map_dir));
function &recurseDir($path)
{
    if (!($dir = opendir($path))) {
        return false;
    }
    $files = array();
    $node =& new HTML_TreeNode(basename($path), basename($path), 'folder.gif');
    while (($file = readdir($dir)) !== false) {
        if ($file != '.' && $file != '..') {
            if (@is_dir("{$path}/{$file}")) {
                $addnode =& recurseDir("{$path}/{$file}");
            } else {
                $addnode =& new HTML_TreeNode($file, $file, 'document2.png');
            }
            $node->addItem($addnode);
        }
    }
    closedir($dir);
    return $node;
}
?>
Exemplo n.º 15
0
function displayPages($catid)
{
    global $_CONF, $CONF_SE, $_TABLES, $statusmsg, $type, $LANG_SE02;
    $menu = new HTML_TreeMenu();
    if ($catid != 0) {
        $parentCatid = DB_getItem($_TABLES['nexcontent_pages'], 'pid', "id='{$catid}'");
        $node[0] = new HTML_TreeNode(array('text' => 'up one level', 'link' => $_CONF['site_admin_url'] . "/plugins/nexcontent/index.php?catid={$parentCatid}", 'icon' => 'folder.gif'));
        $menu->addItem($node[0]);
        $label = DB_getItem($_TABLES['nexcontent_pages'], 'name', "id='{$catid}'");
        $psql = "SELECT id FROM {$_TABLES['nexcontent_pages']} WHERE pid='{$catid}' AND (type='page' OR type='link')";
        $psql .= COM_getPermSQL('AND');
        $psql .= ' ORDER BY pageorder, id asc';
        $pquery = DB_query($psql);
        $numpages = DB_numRows($pquery);
        if ($numpages > 0) {
            $label = $label . '&nbsp;(' . $numpages . ')';
        }
        $label = '<span class="treeMenuSelected">' . $label . '</span>';
        $node[$catid] = new HTML_TreeNode(array('text' => $label, 'link' => $_CONF['site_admin_url'] . "/plugins/nexcontent/index.php?catid=" . $catid, 'icon' => 'folder.gif'));
        nexcontent_recursiveView($node[$catid], $catid);
        $menu->addItem($node[$catid]);
    } else {
        $msql = "SELECT id,pid,name,pageorder from {$_TABLES['nexcontent_pages']} WHERE pid='0' and type='category'";
        $msql .= COM_getPermSQL('AND');
        $msql .= ' ORDER BY pageorder, id asc';
        $mquery = DB_QUERY($msql);
        while (list($id, $category, $name, $order) = DB_fetchARRAY($mquery)) {
            //echo "<br>id:$id, cat: $category, name:$name, order:$order";
            if ($catid != 0 and $catid == $id) {
                $name = '<span class="treeMenuSelected">' . $name . '</span>';
            }
            $pquery = DB_query("SELECT id FROM {$_TABLES['nexcontent_pages']} WHERE pid='{$id}' AND (type='page' OR type='link')");
            $numpages = DB_numRows($pquery);
            if ($numpages > 0) {
                $name = $name . '&nbsp;(' . $numpages . ')';
            }
            $node[$id] = new HTML_TreeNode(array('text' => $name, 'link' => $_CONF['site_admin_url'] . "/plugins/nexcontent/index.php?catid=" . $id, 'icon' => 'folder.gif'));
            nexcontent_recursiveView($node[$id], $id);
            $menu->addItem($node[$id]);
        }
    }
    $treeMenu =& new HTML_TreeMenu_DHTML($menu, array('images' => $_CONF['layout_url'] . '/nexpro/images/treemenu', 'defaultClass' => 'treeMenuDefault'));
    $q = DB_query("SELECT id,name from {$_TABLES['nexcontent_pages']} WHERE type='category' ORDER BY id");
    $selCategories = '<option value="0">Top Level</option>' . LB;
    $selCategories .= nexcontent_getFolderList($catid);
    /* Retrieve all the pages for the selected category */
    $sql = "SELECT id,sid,pageorder,name,hits,type,menutype,submenu_item,is_draft FROM {$_TABLES['nexcontent_pages']} WHERE pid='{$catid}' or id='{$catid}'";
    $sql .= COM_getPermSQL('AND');
    //$sql .= '  ORDER by type, pid,pageorder';
    $sql .= '  ORDER by pid,pageorder';
    $query = DB_query($sql);
    $mainview = new Template($_CONF['path_layout'] . 'nexcontent/admin');
    $mainview->set_file(array('mainview' => 'pageview.thtml', 'msgline' => 'alertline.thtml', 'records' => 'pagerecords.thtml'));
    $mainview->set_var('navbar', nexcontent_showNavbar($LANG_SE02['1']));
    $mainview->set_var('type', $type);
    $mainview->set_var('catid', $catid);
    $mainview->set_var('folderview', $treeMenu->toHTML());
    $mainview->set_var('phpself', $_SERVER['PHP_SELF']);
    if ($statusmsg != '') {
        $mainview->set_var('alertmsg', $statusmsg);
    } else {
        $mainview->set_var('alertmsg', '');
        $mainview->set_var('msgmode', 'none');
    }
    $mainview->set_var('filteroptions', $selCategories);
    $mainview->parse('alertline', 'msgline', true);
    $mainview->set_var('HEADING1', 'ID');
    $mainview->set_var('HEADING2', 'Name');
    $mainview->set_var('HEADING3', 'Hits');
    $mainview->set_var('HEADING4', 'Menu Type');
    $mainview->set_var('HEADING5', 'Draft');
    $mainview->set_var('HEADING6', 'Action');
    $mainview->set_var('imgset', $CONF_SE['public_url'] . '/images');
    $mainview->set_var('site_url', $_CONF['site_url']);
    $mainview->set_var('site_admin_url', $_CONF['site_admin_url']);
    $mainview->set_var('layout_url', $_CONF['layout_url']);
    $mainview->set_var('nexcontent_url', $CONF_SE['public_url']);
    $i = 1;
    $currentCategory = '';
    $pageOrd = 10;
    $stepNumber = 10;
    while (list($id, $sid, $order, $name, $hits, $type, $menutype, $submenu, $is_draft) = DB_fetchArray($query)) {
        if ($type == 'page' and $currentCategory != $category) {
            $pageOrd = 10;
            $currentCategory = $category;
        }
        if ($id != $catid and $order != $pageOrd) {
            DB_query("UPDATE {$_TABLES['nexcontent_pages']} SET pageorder = '{$pageOrd}' WHERE id = '{$id}'");
            $order = $pageOrd;
        }
        $pageOrd += $stepNumber;
        $check1 = $submenu >= 1 ? ' CHECKED' : '';
        $check2 = $is_draft == 1 ? ' CHECKED' : '';
        if ($type == 'category') {
            $mainview->set_var('pagelink', "{$_CONF['site_admin_url']}/plugins/nexcontent/index.php?catid={$id}");
            $mainview->set_var('pageimage', '<img src="' . $_CONF['layout_url'] . '/nexcontent/images/admin/sitecategory.gif">');
            $editop = 'editCategory';
        } else {
            if ($type == 'link') {
                $mainview->set_var('pagelink', "{$_CONF['site_admin_url']}/plugins/nexcontent/index.php?op=editLink&pageid={$id}");
                $mainview->set_var('pageimage', '<img src="' . $_CONF['layout_url'] . '/nexcontent/images/admin/sitelink.gif">');
                $editop = 'editLink';
            } else {
                $mainview->set_var('pagelink', "{$_CONF['site_admin_url']}/plugins/nexcontent/index.php?op=editPage&pageid={$id}");
                $mainview->set_var('pageimage', '<img src="' . $_CONF['layout_url'] . '/nexcontent/images/admin/sitepage.gif">');
                $editop = 'editPage';
            }
        }
        $menuoptions = '';
        foreach ($CONF_SE['menuoptions'] as $value => $label) {
            if ($name == 'frontpage') {
                if ($value == '0') {
                    $menuoptions .= '<option value="' . $value . '">' . $label . '</option>';
                }
            } elseif ($value == 0 or $type == 'page' and $value == 3 or $type == 'link' and $value == 3) {
                if ($value == $menutype) {
                    $menuoptions .= '<option value="' . $value . '" SELECTED=SELECTED>' . $label . '</option>';
                } else {
                    $menuoptions .= '<option value="' . $value . '">' . $label . '</option>';
                }
            } elseif ($type == 'category' and ($catid > 0 or $value != 3)) {
                if ($value == $menutype) {
                    $menuoptions .= '<option value="' . $value . '" SELECTED=SELECTED>' . $label . '</option>';
                } else {
                    $menuoptions .= '<option value="' . $value . '">' . $label . '</option>';
                }
            }
        }
        $mainview->set_var('menuoptions', $menuoptions);
        $sql = "SELECT id FROM {$_TABLES['nexcontent_pages']} WHERE id='{$id}' ";
        $sql .= COM_getPermSQL('AND', 0, 3);
        $pquery = DB_query($sql);
        if (DB_numRows($pquery) > 0) {
            $link = '&nbsp;<a href="' . $_CONF['site_admin_url'] . '/plugins/nexcontent/index.php?op=';
            $editimg = '<img src="' . $_CONF['layout_url'] . '/nexcontent/images/admin/edit.gif" TITLE="Edit Page" border="0">';
            $editlink = $link . $editop . '&pageid=' . $id . '">' . $editimg . '</a>';
            $copyimg = '<img src="' . $_CONF['layout_url'] . '/nexcontent/images/admin/copy.gif" TITLE="Copy Page" border="0">';
            $copylink = $link . 'copyPage&pageid=' . $id . '">' . $copyimg . '</a>';
            $LANG_CONFIRM = 'Please confirm that you want to delete this page and any associated images';
            $deleteimg = '<img src="' . $_CONF['layout_url'] . '/nexcontent/images/admin/delete.gif" TITLE="Delete Page" border="0">';
            $deletelink = $link . 'delPage&pageid=' . $id . '" onclick="return confirm(\'' . $LANG_CONFIRM . '\');">' . $deleteimg . '</a>';
        } else {
            $editlink = '';
            $deletelink = '';
        }
        $mainview->set_var('sid', $sid);
        $mainview->set_var('cssid', $i);
        $mainview->set_var('pageid', $id);
        $mainview->set_var('pagename', $name);
        $mainview->set_var('hits', $hits);
        $mainview->set_var('order', $order);
        $mainview->set_var('check1', $check1);
        $mainview->set_var('check2', $check2);
        $mainview->set_var('LANG_EDIT', 'Edit Page');
        $mainview->set_var('editlink', $editlink);
        $mainview->set_var('copylink', $copylink);
        $mainview->set_var('LANG_DELETE', 'Delete Page');
        $mainview->set_var('deletelink', $deletelink);
        $mainview->set_var('LANG_MOVEUP', 'Move Page Up');
        $mainview->set_var('LANG_MOVEDN', 'Move Page Down');
        $mainview->set_var('LANG_PREVIEW', 'Preview this page');
        $mainview->parse('page_records', 'records', true);
        $i = $i == 2 ? 1 : 2;
    }
    $mainview->parse('output', 'mainview');
    $retval .= $mainview->finish($mainview->get_var('output'));
    return $retval;
}
Exemplo n.º 16
0
 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");
 }
Exemplo n.º 17
0
 /**
  * Creates a treeMenu from XML. The structure of your XML should be
  * like so:
  *
  * <treemenu>
  *     <node text="First node" icon="folder.gif" expandedIcon="folder-expanded.gif" />
  *     <node text="Second node" icon="folder.gif" expandedIcon="folder-expanded.gif">
  *         <node text="Sub node" icon="folder.gif" expandedIcon="folder-expanded.gif" />
  *     </node>
  *     <node text="Third node" icon="folder.gif" expandedIcon="folder-expanded.gif">
  * </treemenu>
  *
  * Any of the options you can supply to the HTML_TreeNode constructor can be supplied as
  * attributes to the <node> tag. If there are no subnodes for a particular node, you can
  * use the XML shortcut <node ... /> instead of <node ... ></node>. The $xml argument can
  * be either the XML as a string, or an pre-created XML_Tree object. Also, this method
  * REQUIRES my own Tree class to work (http://phpguru.org/tree.html). If this has not
  * been include()ed or require()ed this method will die().
  *
  * @param  mixed  $xml  This can be either a string containing the XML, or an XML_Tree object
  *                      (the PEAR::XML_Tree package).
  * @return object       The HTML_TreeMenu object
  */
 function createFromXML($xml)
 {
     if (!class_exists('Tree')) {
         die('Could not find Tree class');
     }
     // Supplied $xml is a string
     if (is_string($xml)) {
         require_once 'XML/Tree.php';
         $xmlTree =& new XML_Tree();
         $xmlTree->getTreeFromString($xml);
         // Supplied $xml is an XML_Tree object
     } else {
         $xmlTree = $xml;
     }
     // Now process the XML_Tree object, setting the XML attributes
     // to be the tag data (with out the XML tag name or contents).
     $treeStructure = Tree::createFromXMLTree($xmlTree, true);
     $treeStructure->nodes->traverse(create_function('&$node', '$tagData = $node->getTag(); $node->setTag($tagData["attributes"]);'));
     return HTML_TreeMenu::createFromStructure(array('structure' => $treeStructure));
 }
Exemplo n.º 18
0
<tr><td align="left" valign="top" width="230" height="710">

<table border="1" cellpadding="2" cellspacing="0" width="200" class="table1">
<tr>
	<td class="td41" align="center">
    <input name="rootshow" type="button" onclick="window.location='range.php?m=<?php 
echo $_GET["m"];
?>
'" value="顯示主分類" />
    </td>
</tr>
<tr><td>
<?php 
require_once '../TreeMenu/TreeMenu.php';
$icon = '';
$menu = new HTML_TreeMenu();
$query = "select * from `item` where `root`=0 order by `range` asc";
$result = mysql_query($query);
$i = 0;
$ii = 0;
while ($row = mysql_fetch_array($result)) {
    $i++;
    if ($_GET["r"] == $row["num"] || $_GET["num"] == $row["num"]) {
        if ($_GET["r"] != "") {
            $color = "green";
        } else {
            $color = "blue";
        }
        $f1 = "<font color='" . $color . "'><b>";
        $f2 = "</b></font>";
    } else {
Exemplo n.º 19
0
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.  |
// |                                                                       |
// +-----------------------------------------------------------------------+
// | Author: Richard Heyes <http://www.phpguru.org/>                       |
// |         Harald Radi <*****@*****.**>                              |
// +-----------------------------------------------------------------------+
//
// $Id: example.php,v 1.14 2005/03/02 02:16:51 richard Exp $
//error_reporting(E_ALL | E_STRICT);
//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>
Exemplo n.º 20
0
}

if ( $conf['debug'] == 1 ) {
  print "UserID:".$_SESSION['__auth']['userID']."<BR>";
  print "APP_BASE: ".APP_BASE."<BR>";
  print "FRAMEWORK_BASE: ".FRAMEWORK_BASE."<BR>";
}

global $conf;
global $applications;

// use TreeMenu
require_once(FRAMEWORK_BASE.'/lib/TreeMenu.php');
$icon = 'stock_open16.gif';
$level_count = 0;
$menu  = new HTML_TreeMenu();
$root = new HTML_TreeNode(array('text' => "dnsZone-Manager",
                                 'icon' => $icon));

$top_level = LDAP_functions::my_ldap_search('objectclass=dcObject', '', array( "dc" ), 'one', 'dc');

if (is_array($top_level) && (count($top_level) > 1)) { 
  foreach ($top_level as $value) {
    if ( $value['dc'][0] ) {
      
      $level[$level_count] = &$root->addItem( new HTML_TreeNode(array('text' => $value['dc'][0],
      					                             'icon' => $icon)));
      
      $domain_level = LDAP_functions::my_ldap_search('(& (objectclass=domain) (description=ActiveDomain*))', 
                                                     $value['dn'],
						     array( "*" ));