Exemple #1
0
function plugin_init_treeview()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['treeview'] = true;
    Plugin::registerClass('PluginTreeviewPreference', array('addtabon' => array('Preference')));
    Plugin::registerClass('PluginTreeviewProfile', array('addtabon' => array('Profile')));
    $PLUGIN_HOOKS['change_profile']['treeview'] = array('PluginTreeviewProfile', 'changeprofile');
    if (Session::getLoginUserID()) {
        Plugin::registerClass('PluginTreeviewProfile', array('addtabon' => 'Profile'));
        if (Session::haveRight("plugin_treeview", READ)) {
            $PLUGIN_HOOKS['menu_toadd']['treeview'] = array('tools' => 'PluginTreeviewConfig');
            $PLUGIN_HOOKS['pre_item_purge']['treeview'] = array('Profile' => array('PluginTreeviewProfile', 'cleanProfiles'));
            if (isset($_SESSION["glpi_plugin_treeview_loaded"]) && $_SESSION["glpi_plugin_treeview_loaded"] == 1 && class_exists('PluginTreeviewConfig')) {
                foreach (PluginTreeviewConfig::getTypes() as $type) {
                    $PLUGIN_HOOKS['item_update']['treeview'][$type] = 'plugin_item_update_treeview';
                    $PLUGIN_HOOKS['item_delete']['treeview'][$type] = 'plugin_treeview_reload';
                    $PLUGIN_HOOKS['item_restore']['treeview'][$type] = 'plugin_treeview_reload';
                }
            }
            if ($_SERVER['PHP_SELF'] == $CFG_GLPI["root_doc"] . "/front/central.php" && (!isset($_SESSION["glpi_plugin_treeview_loaded"]) || $_SESSION["glpi_plugin_treeview_loaded"] == 0) && isset($_SESSION["glpi_plugin_treeview_preference"]) && $_SESSION["glpi_plugin_treeview_preference"] == 1) {
                Html::redirect($CFG_GLPI["root_doc"] . "/plugins/treeview/index.php");
            }
            if ($_SERVER['PHP_SELF'] == $CFG_GLPI["root_doc"] . "/logout.php" && (isset($_SESSION["glpi_plugin_treeview_loaded"]) && $_SESSION["glpi_plugin_treeview_loaded"] == 1 && class_exists('PluginTreeviewConfig'))) {
                $config = new PluginTreeviewConfig();
                $config->hideTreeview();
            }
            // Add specific files to add to the header : javascript or css
            $PLUGIN_HOOKS['add_javascript']['treeview'] = "dtree.js";
            $PLUGIN_HOOKS['add_css']['treeview'] = "dtree.css";
            $PLUGIN_HOOKS['add_javascript']['treeview'] = "functions.js";
            $PLUGIN_HOOKS['add_css']['treeview'] = "style.css";
            $PLUGIN_HOOKS['add_javascript']['treeview'] = "treeview.js";
            $PLUGIN_HOOKS['add_css']['treeview'] = "treeview.css";
        }
        // Config page
        if (Session::haveRight("plugin_treeview", UPDATE) || Session::haveRight("config", UPDATE)) {
            $PLUGIN_HOOKS['config_page']['treeview'] = 'front/config.form.php';
        }
    }
}
Exemple #2
0
function plugin_init_racks()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['racks'] = true;
    $PLUGIN_HOOKS['change_profile']['racks'] = array('PluginRacksProfile', 'changeProfile');
    if (class_exists('PluginRacksRack')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['racks'] = array('Profile' => array('PluginRacksProfile', 'purgeProfiles'));
    }
    Plugin::registerClass('PluginRacksRack', array('document_types' => true, 'unicity_types' => true, 'linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'infocom_types' => true));
    Plugin::registerClass('PluginRacksProfile', array('addtabon' => 'Profile'));
    if (class_exists('PluginAppliancesAppliance')) {
        PluginAppliancesAppliance::registerType('PluginRacksRack');
    }
    if (class_exists('PluginManufacturersimportsConfig')) {
        PluginManufacturersimportsConfig::registerType('PluginRacksRack');
    }
    if (class_exists('PluginTreeviewConfig')) {
        PluginTreeviewConfig::registerType('PluginRacksRack');
        $PLUGIN_HOOKS['treeview']['PluginRacksRack'] = '../racks/pics/racks.png';
    }
    if (class_exists('PluginPositionsPosition')) {
        PluginPositionsPosition::registerType('PluginRacksRack');
    }
    if (Session::getLoginUserID()) {
        // Display a menu entry ?
        if (plugin_racks_haveRight("racks", "r")) {
            $PLUGIN_HOOKS['menu_entry']['racks'] = 'front/rack.php';
            $PLUGIN_HOOKS['submenu_entry']['racks']['search'] = 'front/rack.php';
            $PLUGIN_HOOKS['submenu_entry']['racks']['add'] = 'front/setup.templates.php?add=1';
        }
        if (plugin_racks_haveRight("model", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['racks']['template'] = 'front/setup.templates.php?add=0';
            $PLUGIN_HOOKS['submenu_entry']['racks']["<img  src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' title=\"" . __('Equipments models specifications', 'racks') . "\" alt=\"" . __('Equipments models specifications', 'racks') . "\">"] = 'front/itemspecification.php';
        }
        if (plugin_racks_haveRight("racks", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['racks']['config'] = 'front/config.form.php';
            $PLUGIN_HOOKS['use_massive_action']['racks'] = 1;
        }
        // Config page
        if (plugin_racks_haveRight("racks", "w") || Session::haveRight("config", "w")) {
            $PLUGIN_HOOKS['config_page']['racks'] = 'front/config.form.php';
        }
        // Add specific files to add to the header : javascript or css
        //$PLUGIN_HOOKS['add_javascript']['example']="example.js";
        $PLUGIN_HOOKS['add_css']['racks'] = "racks.css";
        $PLUGIN_HOOKS['post_init']['racks'] = 'plugin_racks_postinit';
        $PLUGIN_HOOKS['reports']['racks'] = array('front/report.php' => __("Report - Bays management", "racks"));
    }
}
Exemple #3
0
Session::checkLoginUser();
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Frameset//EN'\n       'http://www.w3.org/TR/html4/frameset.dtd'>";
echo "\n<html><head><title>" . sprintf(__('%1$s - %2$s'), "GLPI", __('Tree view', 'treeview')) . "</title>";
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>";
// Send extra expires header if configured
echo "<meta http-equiv='Expires' content='Fri, Jun 12 1981 08:20:00 GMT'>\n";
echo "<meta http-equiv='Pragma' content='no-cache'>\n";
echo "<meta http-equiv='Cache-Control' content='no-cache'>\n";
echo "<link rel='stylesheet' type='text/css' href='" . $CFG_GLPI["root_doc"] . "/plugins/treeview/treeview.css' type='text/css'>\n";
echo "<script type='text/javascript' src='" . $CFG_GLPI["root_doc"] . "/plugins/treeview/treeview.js'>\n      </script></head>\n";
echo '<div id="ie5menu" class="skin0" onMouseover="highlightie5(event)" ' . 'onMouseout="lowlightie5(event)" onClick="jumptoie5(event)" display:none>';
echo '</div>';
echo "<body>";
// Title bar
echo '<div id=explorer_bar>';
echo '<div id=explorer_title>' . sprintf(__('%1$s - %2$s'), "GLPI", __('Tree view', 'treeview'));
echo '</div>';
echo "<div id=explorer_close>";
echo "<img border=0 src='pics/close.gif' name='explorer_close'\n       onmouseover=\"ChangeImg(document.images.explorer_close, 'pics/close_hover.gif');\"\n       onmouseout=\"ChangeImg(document.images.explorer_close, 'pics/close.gif');\"\n       onclick='parent.location.href = parent.right.location.href;'></div>";
echo "</div>";
echo "<form method='get' name='get_level' action='" . $_SERVER["PHP_SELF"] . "'>";
// The IDs (primary key) of the requested nodes are stored in this field
echo "<input type='hidden' name='nodes' value=''>";
// Which item type should be opened?
echo "<input type='hidden' name='openedType' value=''>";
echo "</form>";
// Print the tree
$config = new PluginTreeviewConfig();
$config->buildTreeview();
echo "</body>";
echo "</html>";
Exemple #4
0
* @version $Id: setup.php 313 2011-12-19 09:39:58Z remi $
-------------------------------------------------------------------------
treeview - TreeView browser plugin for GLPI
Copyright (C) 2003-2012 by the treeview Development Team.

https://forge.indepnet.net/projects/treeview
-------------------------------------------------------------------------

LICENSE

This file is part of treeview.

treeview is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

treeview is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with treeview. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../inc/includes.php';
Plugin::load('treeview', true);
$_SESSION["glpi_plugin_treeview_loaded"] = 1;
$config = new PluginTreeviewConfig();
$config->seeTreeview();
Exemple #5
0
treeview is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

treeview is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with treeview. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
$config = new PluginTreeviewConfig();
if (isset($_POST["update"])) {
    $config->update($_POST);
    Html::back();
} else {
    $plugin = new Plugin();
    if ($plugin->isInstalled("treeview") && $plugin->isActivated("treeview")) {
        Html::header(__('Tree view', 'treeview'), $_SERVER["PHP_SELF"], "config", "plugins");
        $config->showForm(1);
    } else {
        Html::header(__('Setup'), $_SERVER['PHP_SELF'], "config", "plugins");
        // Get the configuration from the database and show it
        echo " <script type='text/javascript'>\n         if (top != self)\n         top.location = self.location;\n         </script>";
    }
}
Html::footer();
Exemple #6
0
function plugin_init_resources()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['resources'] = true;
    $PLUGIN_HOOKS['change_profile']['resources'] = array('PluginResourcesProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['resources'] = true;
    if (Session::getLoginUserID()) {
        $noupdate = false;
        if (isset($_SESSION['glpiactiveprofile']['interface']) && $_SESSION['glpiactiveprofile']['interface'] != 'central') {
            $noupdate = true;
        }
        Plugin::registerClass('PluginResourcesResource', array('linkuser_types' => true, 'document_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'notificationtemplates_types' => true, 'unicity_types' => true, 'massiveaction_nodelete_types' => $noupdate, 'massiveaction_noupdate_types' => $noupdate));
        Plugin::registerClass('PluginResourcesDirectory', array('massiveaction_nodelete_types' => true, 'massiveaction_noupdate_types' => true));
        Plugin::registerClass('PluginResourcesRecap', array('massiveaction_nodelete_types' => true, 'massiveaction_noupdate_types' => true));
        Plugin::registerClass('PluginResourcesTaskPlanning', array('planning_types' => true));
        Plugin::registerClass('PluginResourcesRuleChecklistCollection', array('rulecollections_types' => true));
        Plugin::registerClass('PluginResourcesRuleContracttypeCollection', array('rulecollections_types' => true));
        Plugin::registerClass('PluginResourcesProfile', array('addtabon' => 'Profile'));
        Plugin::registerClass('PluginResourcesEmployment', array('massiveaction_nodelete_types' => true));
        if (class_exists('PluginPositionsPosition')) {
            PluginPositionsPosition::registerType('PluginResourcesResource');
            //$PLUGIN_HOOKS['plugin_positions']['PluginResourcesResource']='plugin_resources_positions_pics';
        }
        if (class_exists('PluginBehaviorsCommon')) {
            PluginBehaviorsCommon::addCloneType('PluginResourcesRuleChecklist', 'PluginBehaviorsRule');
            PluginBehaviorsCommon::addCloneType('PluginResourcesRuleContracttype', 'PluginBehaviorsRule');
        }
        if (class_exists('PluginTreeviewConfig')) {
            PluginTreeviewConfig::registerType('PluginResourcesResource');
            $PLUGIN_HOOKS['treeview']['PluginResourcesResource'] = '../resources/pics/miniresources.png';
            $PLUGIN_HOOKS['treeview_params']['resources'] = array('PluginResourcesResource', 'showResourceTreeview');
        }
        if (plugin_resources_haveRight("resources", "r") || plugin_resources_haveRight("employer", "w")) {
            $PLUGIN_HOOKS['menu_entry']['resources'] = 'front/menu.php';
            $PLUGIN_HOOKS['helpdesk_menu_entry']['resources'] = '/front/menu.php';
            $PLUGIN_HOOKS['submenu_entry']['resources']['search'] = 'front/resource.php';
            $PLUGIN_HOOKS['redirect_page']['resources'] = "front/resource.form.php";
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/directory18.png' title='" . __('Directory', 'resources') . "' alt='" . __('Directory', 'resources') . "'>"] = 'front/directory.php';
        }
        if (plugin_resources_haveRight("resting", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/restinglist18.png' title='" . __('List of non contract periods', 'resources') . "' alt='" . __('List of non contract periods', 'resources') . "'>"] = 'front/resourceresting.php';
        }
        if (plugin_resources_haveRight("holiday", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/holidaylist18.png' title='" . __('List of forced holidays', 'resources') . "' alt='" . __('List of forced holidays', 'resources') . "'>"] = 'front/resourceholiday.php';
        }
        if (plugin_resources_haveRight("employment", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/employmentlist18.png' title='" . __('Employment management', 'resources') . "' alt='" . __('Employment management', 'resources') . "'>"] = 'front/employment.php';
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/recap18.png' title='" . __('List Employments / Resources', 'resources') . "' alt='" . __('List Employments / Resources', 'resources') . "'>"] = 'front/recap.php';
        }
        if (plugin_resources_haveRight("budget", "r")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']["<img src='" . $CFG_GLPI["root_doc"] . "/plugins/resources/pics/budgetlist18.png' title='" . __('Budget management', 'resources') . "' alt='" . __('Budget management', 'resources') . "'>"] = 'front/budget.php';
        }
        if (plugin_resources_haveRight("resources", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']['add'] = 'front/wizard.form.php';
            $PLUGIN_HOOKS['submenu_entry']['resources']['template'] = 'front/setup.templates.php?add=0';
            if (plugin_resources_haveRight("task", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']["<img  src='" . $CFG_GLPI["root_doc"] . "/pics/menu_showall.png' title='" . __('Tasks list', 'resources') . "' alt='" . __('Tasks list', 'resources') . "'>"] = 'front/task.php';
            }
            if (plugin_resources_haveRight("checklist", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']["<img  src='" . $CFG_GLPI["root_doc"] . "/pics/reservation-3.png' title='" . _n('Checklist', 'Checklists', 2, 'resources') . "' alt='" . _n('Checklist', 'Checklists', 2, 'resources') . "'>"] = 'front/checklistconfig.php';
            }
            if (plugin_resources_haveRight("checklist", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['title'] = __('Checklists', 'resources');
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['page'] = '/plugins/resources/front/checklistconfig.php';
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['links']['search'] = '/plugins/resources/front/checklistconfig.php';
            }
            if (plugin_resources_haveRight("checklist", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['links']['add'] = '/plugins/resources/front/checklistconfig.form.php?new=1';
            }
            if (plugin_resources_haveRight("employment", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['title'] = __('Employments', 'resources');
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['page'] = '/plugins/resources/front/employment.php';
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['links']['search'] = '/plugins/resources/front/employment.php';
            }
            if (plugin_resources_haveRight("employment", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['employment']['links']['add'] = '/plugins/resources/front/employment.form.php';
            }
            if (plugin_resources_haveRight("budget", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['title'] = _n('Budget', 'Budgets', 2);
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['page'] = '/plugins/resources/front/budget.php';
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['links']['search'] = '/plugins/resources/front/budget.php';
            }
            if (plugin_resources_haveRight("budget", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['budget']['links']['add'] = '/plugins/resources/front/budget.form.php';
            }
            if (Session::haveRight("config", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['resources']['options']['checklist']['links']['config'] = '/plugins/resources/front/config.form.php';
            }
            $PLUGIN_HOOKS['use_massive_action']['resources'] = 1;
        }
        // Add specific files to add to the header : javascript or css
        $PLUGIN_HOOKS['add_javascript']['resources'] = "resources.js";
        $PLUGIN_HOOKS['add_css']['resources'] = "resources.css";
        //TODO : Check
        $PLUGIN_HOOKS['plugin_pdf']['PluginResourcesResource'] = 'PluginResourcesResourcePDF';
        //Clean Plugin on Profile delete
        if (class_exists('PluginResourcesResource_Item')) {
            // only if plugin activated
            $PLUGIN_HOOKS['pre_item_purge']['resources'] = array('Profile' => array('PluginResourcesProfile', 'purgeProfiles'));
            $PLUGIN_HOOKS['plugin_datainjection_populate']['resources'] = 'plugin_datainjection_populate_resources';
        }
        //planning action
        $PLUGIN_HOOKS['planning_populate']['resources'] = array('PluginResourcesTaskPlanning', 'populatePlanning');
        $PLUGIN_HOOKS['display_planning']['resources'] = array('PluginResourcesTaskPlanning', 'displayPlanningItem');
        $PLUGIN_HOOKS['migratetypes']['resources'] = 'plugin_datainjection_migratetypes_resources';
        // Config page
        if (Session::haveRight("config", "w")) {
            $PLUGIN_HOOKS['submenu_entry']['resources']['config'] = 'front/config.form.php';
            $PLUGIN_HOOKS['config_page']['resources'] = 'front/config.form.php';
        }
    }
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['resources'] = 'plugin_resources_postinit';
}