function getTabNameForItem(CommonGLPI $item, $withtemplate = 0)
 {
     if ($item->getType() == 'Profile') {
         return PluginWebapplicationsWebapplication::getTypeName(2);
     }
     return '';
 }
 static function getMenuContent()
 {
     global $CFG_GLPI;
     $menu = array();
     $menu['title'] = self::getMenuName();
     $menu['page'] = "/plugins/webapplications/front/webapplication.php";
     $menu['links']['search'] = PluginWebapplicationsWebapplication::getSearchURL(false);
     if (PluginWebapplicationsWebapplication::canCreate()) {
         $menu['links']['add'] = PluginWebapplicationsWebapplication::getFormURL(false);
     }
     return $menu;
 }
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 Webapplications. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$web = new PluginWebapplicationsWebapplication();
$web_item = new PluginWebapplicationsWebapplication_Item();
if (isset($_POST["add"])) {
    $web->check(-1, 'w', $_POST);
    $newID = $web->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $web->check($_POST['id'], 'w');
        $web->delete($_POST);
        $web->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $web->check($_POST['id'], 'w');
            $web->restore($_POST);
            $web->redirectToList();
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 Webapplications. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
if (!isset($_GET["id"])) {
    $_GET["id"] = "";
}
if (!isset($_GET["withtemplate"])) {
    $_GET["withtemplate"] = "";
}
$web = new PluginWebapplicationsWebapplication();
$web_item = new PluginWebapplicationsWebapplication_Item();
if (isset($_POST["add"])) {
    $web->check(-1, CREATE, $_POST);
    $newID = $web->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $web->check($_POST['id'], DELETE);
        $web->delete($_POST);
        $web->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $web->check($_POST['id'], PURGE);
            $web->restore($_POST);
            $web->redirectToList();
Example #5
0
function plugin_init_webapplications()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['webapplications'] = true;
    //load changeprofile function
    $PLUGIN_HOOKS['change_profile']['webapplications'] = array('PluginWebapplicationsProfile', 'changeProfile');
    $PLUGIN_HOOKS['assign_to_ticket']['webapplications'] = true;
    if (class_exists('PluginWebapplicationsWebapplication_Item')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['webapplications'] = array('Profile' => array('PluginWebapplicationsProfile', 'purgeProfiles'));
        $PLUGIN_HOOKS['plugin_datainjection_populate']['webapplications'] = 'plugin_datainjection_populate_webapplications';
    }
    // Params : plugin name - string type - number - class - table - form page
    Plugin::registerClass('PluginWebapplicationsWebapplication', array('linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true, 'addtabon' => 'Supplier'));
    Plugin::registerClass('PluginWebapplicationsProfile', array('addtabon' => array('Profile')));
    if (class_exists('PluginAccountsAccount')) {
        PluginAccountsAccount::registerType('PluginWebapplicationsWebapplication');
    }
    if (class_exists('PluginCertificatesCertificate')) {
        PluginCertificatesCertificate::registerType('PluginWebapplicationsWebapplication');
    }
    //if glpi is loaded
    if (Session::getLoginUserID()) {
        //if environment plugin is installed
        if (isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            //init $_SESSION for environment using
            $_SESSION["glpi_plugin_environment_webapplications"] = 1;
            if (plugin_webapplications_haveRight("webapplications", "r")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['title'] = PluginWebapplicationsWebapplication::getTypeName(2);
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['page'] = '/plugins/webapplications/front/webapplication.php';
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['links']['search'] = '/plugins/webapplications/front/webapplication.php';
            }
            if (plugin_webapplications_haveRight("webapplications", "w")) {
                //redirect link to add webapplications
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['webapplications']['links']['add'] = '/plugins/webapplications/front/webapplication.form.php';
                //use massiveaction in the plugin
                $PLUGIN_HOOKS['use_massive_action']['webapplications'] = 1;
            }
            //if environment plugin isn't installed
        } else {
            // Display a menu entry ?
            if (plugin_webapplications_haveRight("webapplications", "r")) {
                //menu entry
                $PLUGIN_HOOKS['menu_entry']['webapplications'] = 'front/webapplication.php';
                //search link
                $PLUGIN_HOOKS['submenu_entry']['webapplications']['search'] = 'front/webapplication.php';
            }
            if (plugin_webapplications_haveRight("webapplications", "w")) {
                //add link
                $PLUGIN_HOOKS['submenu_entry']['webapplications']['add'] = 'front/webapplication.form.php';
                //use massiveaction in the plugin
                $PLUGIN_HOOKS['use_massive_action']['webapplications'] = 1;
            }
        }
        if (plugin_webapplications_haveRight("webapplications", "r") || Session::haveRight("config", "w")) {
        }
        // Import from Data_Injection plugin
        //      $PLUGIN_HOOKS['migratetypes']['webapplications']
        //                                   = 'plugin_datainjection_migratetypes_webapplications';
        $PLUGIN_HOOKS['plugin_pdf']['PluginWebapplicationsWebapplication'] = 'PluginWebapplicationsWebapplicationPDF';
    }
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['webapplications'] = 'plugin_webapplications_postinit';
}
Example #6
0
function plugin_init_appliances()
{
    global $PLUGIN_HOOKS, $CFG_GLPI;
    $PLUGIN_HOOKS['csrf_compliant']['appliances'] = true;
    // Params : plugin name - string type - number - attributes
    Plugin::registerClass('PluginAppliancesAppliance', array('linkuser_types' => true, 'linkuser_tech_types' => true, 'linkgroup_types' => true, 'linkgroup_tech_types' => true, 'infocom_types' => true, 'document_types' => true, 'contract_types' => true, 'ticket_types' => true, 'helpdesk_visible_types' => true));
    Plugin::registerClass('PluginAppliancesProfile', array('addtabon' => 'Profile'));
    Plugin::registerClass('PluginAppliancesEnvironment');
    Plugin::registerClass('PluginAppliancesApplianceType');
    Plugin::registerClass('PluginAppliancesAppliance_Item');
    Plugin::registerClass('PluginAppliancesOptvalue');
    Plugin::registerClass('PluginAppliancesOptvalue_Item');
    Plugin::registerClass('PluginAppliancesRelation');
    if (class_exists('PluginAccountsAccount')) {
        PluginAccountsAccount::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginCertificatesCertificate')) {
        PluginCertificatesCertificate::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginDatabasesDatabase')) {
        PluginDatabasesDatabase::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginDomainsDomain')) {
        PluginDomainsDomain::registerType('PluginAppliancesAppliance');
    }
    if (class_exists('PluginWebapplicationsWebapplication')) {
        PluginWebapplicationsWebapplication::registerType('PluginAppliancesAppliance');
    }
    // Define the type for which we know how to generate PDF, need :
    $PLUGIN_HOOKS['plugin_pdf']['PluginAppliancesAppliance'] = 'PluginAppliancesAppliancePDF';
    $PLUGIN_HOOKS['migratetypes']['appliances'] = 'plugin_datainjection_migratetypes_appliances';
    $PLUGIN_HOOKS['change_profile']['appliances'] = array('PluginAppliancesProfile', 'select');
    $PLUGIN_HOOKS['assign_to_ticket']['appliances'] = true;
    if (class_exists('PluginAppliancesAppliance')) {
        // only if plugin activated
        $PLUGIN_HOOKS['pre_item_purge']['appliances'] = array('Profile' => array('PluginAppliancesProfile', 'cleanProfile'));
        $PLUGIN_HOOKS['item_clone']['appliances'] = array('Profile' => array('PluginAppliancesProfile', 'cloneProfile'));
        $PLUGIN_HOOKS['plugin_datainjection_populate']['appliances'] = 'plugin_datainjection_populate_appliances';
    }
    if (isset($_SESSION["glpiID"])) {
        if (isset($_SESSION["glpi_plugin_environment_installed"]) && $_SESSION["glpi_plugin_environment_installed"] == 1) {
            $_SESSION["glpi_plugin_environment_appliances"] = 1;
            // Display a menu entry ?
            if (plugin_appliances_haveRight("appliance", "r")) {
                $PLUGIN_HOOKS['menu_entry']['appliances'] = false;
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['title'] = _n('Appliance', 'Appliances', 2, 'appliances');
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['page'] = '/plugins/appliances/front/appliance.php';
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['links']['search'] = '/plugins/appliances/front/appliance.php';
            }
            if (plugin_appliances_haveRight("appliance", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['environment']['options']['appliances']['links']['add'] = '/plugins/appliances/front/appliance.form.php';
                $PLUGIN_HOOKS['use_massive_action']['appliances'] = 1;
            }
        } else {
            // Display a menu entry ?
            if (plugin_appliances_haveRight("appliance", "r")) {
                $PLUGIN_HOOKS['menu_entry']['appliances'] = 'front/appliance.php';
                $PLUGIN_HOOKS['submenu_entry']['appliances']['search'] = 'front/appliance.php';
            }
            if (plugin_appliances_haveRight("appliance", "w")) {
                $PLUGIN_HOOKS['submenu_entry']['appliances']['add'] = 'front/appliance.form.php?new=1';
                $PLUGIN_HOOKS['use_massive_action']['appliances'] = 1;
            }
        }
    }
    // Import from Data_Injection plugin
    $PLUGIN_HOOKS['data_injection']['appliances'] = "plugin_appliances_data_injection_variables";
    // Import webservice
    $PLUGIN_HOOKS['webservices']['appliances'] = 'plugin_appliances_registerMethods';
    // End init, when all types are registered
    $PLUGIN_HOOKS['post_init']['appliances'] = 'plugin_appliances_postinit';
}
 static function displayTabContentForPDF(PluginPdfSimplePDF $pdf, CommonGLPI $item, $tab)
 {
     if ($item->getType() == 'PluginWebapplicationsWebapplication') {
         self::ItemsPdf($pdf, $item);
     } else {
         if (in_array($item->getType(), PluginWebapplicationsWebapplication::getTypes(true))) {
             self::PdfFromItems($pdf, $item);
         } else {
             return false;
         }
     }
     return true;
 }
Example #8
0
This file is part of Webapplications.

Webapplications 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.

Webapplications 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 Webapplications. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
//check environment meta-plugin installation for change header
$plugin = new Plugin();
if ($plugin->isActivated("environment")) {
    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "plugins", "environment", "webapplications");
} else {
    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "plugins", "webapplications");
}
$web = new PluginWebapplicationsWebapplication();
if ($web->canView() || Session::haveRight("config", "w")) {
    Search::show("PluginWebapplicationsWebapplication");
} else {
    Html::displayRightError();
}
Html::footer();
Webapplications 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.

Webapplications 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 Webapplications. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include '../../../inc/includes.php';
//check environment meta-plugin installation for change header
$plugin = new Plugin();
if ($plugin->isActivated("environment")) {
    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "assets", "pluginenvironmentdisplay", "webapplications");
} else {
    Html::header(PluginWebapplicationsWebapplication::getTypeName(2), '', "assets", "pluginwebapplicationsmenu");
}
$web = new PluginWebapplicationsWebapplication();
$web->checkGlobal(READ);
if ($web->canView()) {
    Search::show("PluginWebapplicationsWebapplication");
} else {
    Html::displayRightError();
}
Html::footer();
function plugin_webapplications_postinit()
{
    global $CFG_GLPI, $PLUGIN_HOOKS;
    $PLUGIN_HOOKS['item_purge']['webapplications'] = array();
    foreach (PluginWebapplicationsWebapplication::getTypes(true) as $type) {
        $PLUGIN_HOOKS['item_purge']['webapplications'][$type] = array('PluginWebapplicationsWebapplication_Item', 'cleanForItem');
        CommonGLPI::registerStandardTab($type, 'PluginWebapplicationsWebapplication_Item');
    }
}