function showForm($ID, $options = array()) { global $CFG_GLPI; if (!Config::canUpdate()) { return false; } $spotted = false; if (empty($ID)) { if ($this->getEmpty()) { $spotted = true; } } else { if ($this->getFromDB($ID)) { $spotted = true; } } $this->showFormHeader($options); echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>"; echo "<td colspan='3'>"; Html::autocompletionTextField($this, "name"); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Type') . "</td><td colspan='3'>"; Dropdown::showItemTypes('itemtype', $CFG_GLPI["notificationtemplates_types"], array('value' => $this->fields['itemtype'] ? $this->fields['itemtype'] : 'Ticket')); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Comments') . "</td>"; echo "<td colspan='3'>"; echo "<textarea cols='60' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('CSS') . "</td>"; echo "<td colspan='3'>"; echo "<textarea cols='60' rows='5' name='css' >" . $this->fields["css"] . "</textarea></td></tr>"; $this->showFormButtons($options); return true; }
function plugin_init_racks() { global $PLUGIN_HOOKS, $CFG_GLPI; $PLUGIN_HOOKS['csrf_compliant']['racks'] = true; //load changeprofile function $PLUGIN_HOOKS['change_profile']['racks'] = array('PluginRacksProfile', 'initProfile'); $plugin = new Plugin(); if ($plugin->isInstalled('racks') && $plugin->isActivated('racks')) { //Ability to add a rack to a project $CFG_GLPI["project_asset_types"][] = 'PluginRacksRack'; $PLUGIN_HOOKS['assign_to_ticket']['racks'] = true; Plugin::registerClass('PluginRacksRack', array('document_types' => true, 'location_types' => true, 'unicity_types' => true, 'linkgroup_tech_types' => true, 'linkuser_tech_types' => true, 'infocom_types' => true, 'ticket_types' => true)); Plugin::registerClass('PluginRacksProfile', array('addtabon' => 'Profile')); $types = array('PluginAppliancesAppliance', 'PluginManufacturersimportsConfig', 'PluginTreeviewConfig', 'PluginPositionsPosition'); foreach ($types as $itemtype) { if (class_exists($itemtype)) { $itemtype::registerType('PluginRacksRack'); } } //If treeview plugin is installed, add rack as a type of item //that can be shown in the tree if (class_exists('PluginTreeviewConfig')) { $PLUGIN_HOOKS['treeview']['PluginRacksRack'] = '../racks/pics/racks.png'; } if (Session::getLoginUserID()) { include_once GLPI_ROOT . "/plugins/racks/inc/rack.class.php"; if (PluginRacksRack::canView()) { //Display menu entry only if user has right to see it ! $PLUGIN_HOOKS["menu_toadd"]['racks'] = array('assets' => 'PluginRacksMenu'); $PLUGIN_HOOKS['use_massive_action']['racks'] = 1; } if (PluginRacksRack::canCreate() || Config::canUpdate()) { $PLUGIN_HOOKS['config_page']['racks'] = 'front/config.form.php'; } $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")); } } }
/** * @since version 0.85 * * @see CommonDBTM::processMassiveActionsForOneItemtype() **/ static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids) { switch ($ma->getAction()) { case 'reset': if (Config::canUpdate()) { foreach ($ids as $key) { if ($item->getFromDB($key)) { if ($item->resetDate()) { $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_OK); } else { $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO); $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION)); } } else { $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_KO); $ma->addMessage($item->getErrorMessage(ERROR_NOT_FOUND)); } } } else { $ma->itemDone($item->getType(), $key, MassiveAction::ACTION_NORIGHT); $ma->addMessage($item->getErrorMessage(ERROR_RIGHT)); } return; } parent::processMassiveActionsForOneItemtype($ma, $item, $ids); }
/** * Form for configuration authentification **/ static function showOtherAuthList() { global $DB, $CFG_GLPI; if (!Config::canUpdate()) { return false; } echo "<form name=cas action='" . $CFG_GLPI['root_doc'] . "/front/auth.others.php' method='post'>"; echo "<div class='center'>"; echo "<table class='tab_cadre_fixe'>"; // CAS config echo "<tr><th>" . __('CAS authentication') . '</th><th>'; if (!empty($CFG_GLPI["cas_host"])) { echo _x('authentication', 'Enabled'); } echo "</th></tr>\n"; if (function_exists('curl_init')) { //TRANS: for CAS SSO system echo "<tr class='tab_bg_2'><td class='center'>" . __('CAS Host') . "</td>"; echo "<td><input type='text' name='cas_host' value=\"" . $CFG_GLPI["cas_host"] . "\"></td></tr>\n"; //TRANS: for CAS SSO system echo "<tr class='tab_bg_2'><td class='center'>" . __('Port') . "</td>"; echo "<td><input type='text' name='cas_port' value=\"" . $CFG_GLPI["cas_port"] . "\"></td></tr>\n"; //TRANS: for CAS SSO system echo "<tr class='tab_bg_2'><td class='center'>" . __('Root directory (optional)') . "</td>"; echo "<td><input type='text' name='cas_uri' value=\"" . $CFG_GLPI["cas_uri"] . "\"></td></tr>\n"; //TRANS: for CAS SSO system echo "<tr class='tab_bg_2'><td class='center'>" . __('Log out fallback URL') . "</td>"; echo "<td><input type='text' name='cas_logout' value=\"" . $CFG_GLPI["cas_logout"] . "\"></td>" . "</tr>\n"; } else { echo "<tr class='tab_bg_2'><td class='center' colspan='2'>"; echo "<p class='red'>" . __("The CURL extension for your PHP parser isn't installed"); echo "</p>"; echo "<p>" . __('Impossible to use CAS as external source of connection') . "</p></td></tr>\n"; } // X509 config echo "<tr><th>" . __('x509 certificate authentication') . "</th><th>"; if (!empty($CFG_GLPI["x509_email_field"])) { echo _x('authentication', 'Enabled'); } echo "</th></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Email attribute for x509 authentication') . "</td>"; echo "<td><input type='text' name='x509_email_field' value=\"" . $CFG_GLPI["x509_email_field"] . "\">"; echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . sprintf(__('Restrict %s field for x509 authentication (separator $)'), 'OU') . "</td>"; echo "<td><input type='text' name='x509_ou_restrict' value=\"" . $CFG_GLPI["x509_ou_restrict"] . "\">"; echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . sprintf(__('Restrict %s field for x509 authentication (separator $)'), 'CN') . "</td>"; echo "<td><input type='text' name='x509_cn_restrict' value=\"" . $CFG_GLPI["x509_cn_restrict"] . "\">"; echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . sprintf(__('Restrict %s field for x509 authentication (separator $)'), 'O') . "</td>"; echo "<td><input type='text' name='x509_o_restrict' value=\"" . $CFG_GLPI["x509_o_restrict"] . "\">"; echo "</td></tr>\n"; //Other configuration echo "<tr><th>" . __('Other authentication sent in the HTTP request') . "</th><th>"; if (!empty($CFG_GLPI["ssovariables_id"])) { echo _x('authentication', 'Enabled'); } echo "</th></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Field storage of the login in the HTTP request') . "</td>"; echo "<td>"; SsoVariable::dropdown(array('name' => 'ssovariables_id', 'value' => $CFG_GLPI["ssovariables_id"])); echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Remove the domain of logins like login@domain') . "</td><td>"; Dropdown::showYesNo('existing_auth_server_field_clean_domain', $CFG_GLPI['existing_auth_server_field_clean_domain']); echo "</td></tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Surname') . "</td>"; echo "<td><input type='text' name='realname_ssofield' value='" . $CFG_GLPI['realname_ssofield'] . "'></td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('First name') . "</td>"; echo "<td><input type='text' name='firstname_ssofield' value='" . $CFG_GLPI['firstname_ssofield'] . "'></td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Comments') . "</td>"; echo "<td><input type='text' name='comment_ssofield' value='" . $CFG_GLPI['comment_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Administrative number') . "</td>"; echo "<td><input type='text' name='registration_number_ssofield' value='" . $CFG_GLPI['registration_number_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Email') . "</td>"; echo "<td><input type='text' name='email1_ssofield' value='" . $CFG_GLPI['email1_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '2') . "</td>"; echo "<td><input type='text' name='email2_ssofield' value='" . $CFG_GLPI['email2_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '3') . "</td>"; echo "<td><input type='text' name='email3_ssofield' value='" . $CFG_GLPI['email3_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '4') . "</td>"; echo "<td><input type='text' name='email4_ssofield' value='" . $CFG_GLPI['email4_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Phone') . "</td>"; echo "<td><input type='text' name='phone_ssofield' value='" . $CFG_GLPI['phone_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Phone 2') . "</td>"; echo "<td><input type='text' name='phone2_ssofield' value='" . $CFG_GLPI['phone2_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Mobile phone') . "</td>"; echo "<td><input type='text' name='mobile_ssofield' value='" . $CFG_GLPI['mobile_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . _x('person', 'Title') . "</td>"; echo "<td><input type='text' name='title_ssofield' value='" . $CFG_GLPI['title_ssofield'] . "'>"; echo "</td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Category') . "</td>"; echo "<td><input type='text' name='category_ssofield' value='" . $CFG_GLPI['category_ssofield'] . "'></td>"; echo "</tr>\n"; echo "<tr class='tab_bg_2'>"; echo "<td class='center'>" . __('Language') . "</td>"; echo "<td><input type='text' name='language_ssofield' value='" . $CFG_GLPI['language_ssofield'] . "'></td></tr>"; echo "<tr class='tab_bg_1'><td class='center' colspan='2'>"; echo "<input type='submit' name='update' class='submit' value=\"" . __s('Save') . "\" >"; echo "</td></tr>\n"; echo "</table></div>\n"; Html::closeForm(); }
/** * @param $authldap AuthLDAP object **/ static function showUserImportForm(AuthLDAP $authldap) { global $DB; //Get data related to entity (directory and ldap filter) $authldap->getFromDB($_SESSION['ldap_import']['authldaps_id']); echo "<div class='center'>"; echo "<form method='post' action='" . $_SERVER['PHP_SELF'] . "'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='4' class='middle'><div class='relative'>"; echo "<span>" . ($_SESSION['ldap_import']['mode'] ? __('Synchronizing already imported users') : __('Import new users')); // Expert interface allow user to override configuration. // If not coming from the ticket form, then give expert/simple link if ((Config::canUpdate() || Entity::canUpdate()) && !isset($_SESSION['ldap_import']['no_expert_mode'])) { echo "</span> <span class='floatright'><a href='" . $_SERVER['PHP_SELF'] . "?action=" . $_SESSION['ldap_import']['action'] . "&mode=" . $_SESSION['ldap_import']['mode']; if ($_SESSION['ldap_import']['interface'] == self::SIMPLE_INTERFACE) { echo "&interface=" . self::EXPERT_INTERFACE . "'>" . __('Expert mode') . "</a>"; } else { echo "&interface=" . self::SIMPLE_INTERFACE . "'>" . __('Simple mode') . "</a>"; } } else { $_SESSION['ldap_import']['interface'] = self::SIMPLE_INTERFACE; } echo "</span></div>"; echo "</th></tr>"; switch ($_SESSION['ldap_import']['interface']) { case self::EXPERT_INTERFACE: //If more than one directory configured //Display dropdown ldap servers if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) { if (self::getNumberOfServers() > 1) { echo "<tr class='tab_bg_2'><td>" . __('LDAP directory choice') . "</td>"; echo "<td colspan='3'>"; self::dropdown(array('name' => 'authldaps_id', 'value' => $_SESSION['ldap_import']['authldaps_id'], 'condition' => "`is_active` = '1'", 'display_emptychoice' => false)); echo " <input class='submit' type='submit' name='change_directory'\n value=\"" . _sx('button', 'To change') . "\">"; echo "</td></tr>"; } echo "<tr class='tab_bg_2'><td>" . __('BaseDN') . "</td><td colspan='3'>"; echo "<input type='text' class='form-control' name='basedn' value=\"" . $_SESSION['ldap_import']['basedn'] . "\" size='90' " . (!$_SESSION['ldap_import']['basedn'] ? "disabled" : "") . ">"; echo "</td></tr>"; echo "<tr class='tab_bg_2'><td>" . __('Search filter for users') . "</td><td colspan='3'>"; echo "<input type='text' class='form-control' name='ldap_filter' value=\"" . $_SESSION['ldap_import']['ldap_filter'] . "\" size='90'>"; echo "</td></tr>"; } break; //case self::SIMPLE_INTERFACE : //case self::SIMPLE_INTERFACE : default: //If multi-entity mode and more than one entity visible //else no need to select entity if (Session::isMultiEntitiesMode() && count($_SESSION['glpiactiveentities']) > 1) { echo "<tr class='tab_bg_2'><td>" . __('Select the desired entity') . "</td>" . "<td colspan='3'>"; Entity::dropdown(array('value' => $_SESSION['ldap_import']['entities_id'], 'entity' => $_SESSION['glpiactiveentities'], 'on_change' => 'submit()')); echo "</td></tr>"; } else { //Only one entity is active, store it echo "<tr><td><input type='hidden' name='entities_id' value='" . $_SESSION['glpiactive_entity'] . "'></td></tr>"; } if (isset($_SESSION['ldap_import']['begin_date']) && !empty($_SESSION['ldap_import']['begin_date']) || isset($_SESSION['ldap_import']['end_date']) && !empty($_SESSION['ldap_import']['end_date'])) { $enabled = 1; } else { $enabled = 0; } Dropdown::showAdvanceDateRestrictionSwitch($enabled); echo "<table class='tab_cadre_fixe'>"; if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) { $field_counter = 0; $fields = array('login_field' => __('Login'), 'email1_field' => __('Email'), 'email2_field' => sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '2'), 'email3_field' => sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '3'), 'email4_field' => sprintf(__('%1$s %2$s'), _n('Email', 'Emails', 1), '4'), 'realname_field' => __('Surname'), 'firstname_field' => __('First name'), 'phone_field' => __('Phone'), 'phone2_field' => __('Phone 2'), 'mobile_field' => __('Mobile phone'), 'title_field' => _x('person', 'Title'), 'category_field' => __('Category'), 'picture_field' => __('Picture')); $available_fields = array(); foreach ($fields as $field => $label) { if (isset($authldap->fields[$field]) && $authldap->fields[$field] != '') { $available_fields[$field] = $label; } } echo "<tr><th colspan='4'>" . __('Search criteria for users') . "</th></tr>"; foreach ($available_fields as $field => $label) { if ($field_counter == 0) { echo "<tr class='tab_bg_1'>"; } echo "<td>{$label}</td><td>"; $field_counter++; echo "<input type='text' class='form-control' name='criterias[{$field}]' value='" . (isset($_SESSION['ldap_import']['criterias'][$field]) ? $_SESSION['ldap_import']['criterias'][$field] : '') . "'>"; echo "</td>"; if ($field_counter == 2) { echo "</tr>"; $field_counter = 0; } } if ($field_counter > 0) { while ($field_counter < 2) { echo "<td colspan='2'></td>"; $field_counter++; } $field_counter = 0; echo "</tr>"; } } break; } if ($_SESSION['ldap_import']['authldaps_id'] != NOT_AVAILABLE && $_SESSION['ldap_import']['authldaps_id'] > 0) { if ($_SESSION['ldap_import']['authldaps_id']) { echo "<tr class='tab_bg_2'><td colspan='4' class='center'>"; echo "<input class='submit' type='submit' name='search' value=\"" . _sx('button', 'Search') . "\">"; echo "</td></tr>"; } else { echo "<tr class='tab_bg_2'><" . "td colspan='4' class='center'>" . __('No directory selected') . "</td></tr>"; } } else { echo "<tr class='tab_bg_2'><td colspan='4' class='center'>" . __('No directory associated to entity: impossible search') . "</td></tr>"; } echo "</table>"; Html::closeForm(); echo "</div>"; }
/** * Print the user preference form * * @param $target form target * @param $ID integer Id of the user * * @return boolean : user found **/ function showMyForm($target, $ID) { global $CFG_GLPI, $PLUGIN_HOOKS; // Affiche un formulaire User if ($ID != Session::getLoginUserID() && !$this->currentUserHaveMoreRightThan($ID)) { return false; } if ($this->getFromDB($ID)) { $rand = mt_rand(); $authtype = $this->getAuthMethodsByID(); $extauth = !($this->fields["authtype"] == Auth::DB_GLPI || $this->fields["authtype"] == Auth::NOT_YET_AUTHENTIFIED && !empty($this->fields["password"])); // No autocopletion : $save_autocompletion = $CFG_GLPI["use_ajax_autocompletion"]; $CFG_GLPI["use_ajax_autocompletion"] = false; echo "<div class='center'>"; echo "<form method='post' name='user_manager' enctype='multipart/form-data' action='" . $target . "' autocomplete='off'>"; echo "<table class='tab_cadre_fixe'>"; echo "<tr><th colspan='4'>" . sprintf(__('%1$s: %2$s'), __('Login'), $this->fields["name"]); echo "<input type='hidden' name='name' value='" . $this->fields["name"] . "'>"; echo "<input type='hidden' name='id' value='" . $this->fields["id"] . "'>"; echo "</th></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Surname') . "</td><td>"; if ($extauth && isset($authtype['realname_field']) && !empty($authtype['realname_field'])) { echo $this->fields["realname"]; } else { Html::autocompletionTextField($this, "realname"); } echo "</td>"; if (!empty($this->fields["name"])) { echo "<td rowspan='3'>" . __('Picture') . "</td>"; echo "<td rowspan='3'>"; echo "<div class='user_picture_border_small' id='picture{$rand}'>"; echo "<img class='user_picture_small' alt=\"" . __s('Picture') . "\" src='" . User::getThumbnailURLForPicture($this->fields['picture']) . "'>"; echo "</div>"; $full_picture = "<div class='user_picture_border'>"; $full_picture .= "<img class='user_picture' alt=\"" . __s('Picture') . "\" src='" . User::getURLForPicture($this->fields['picture']) . "'>"; $full_picture .= "</div>"; Html::showTooltip($full_picture, array('applyto' => "picture{$rand}")); echo "<input type='file' name='picture' accept='image/*'>"; echo " "; Html::showCheckbox(array('name' => '_blank_picture', 'title' => __('Clear'))); echo " " . __('Clear'); echo "</td>"; echo "</tr>"; } echo "<tr class='tab_bg_1'><td>" . __('First name') . "</td><td>"; if ($extauth && isset($authtype['firstname_field']) && !empty($authtype['firstname_field'])) { echo $this->fields["firstname"]; } else { Html::autocompletionTextField($this, "firstname"); } echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; if (!GLPI_DEMO_MODE) { echo "<td>" . __('Language') . "</td><td>"; // Use session variable because field in table may be null if same of the global config Dropdown::showLanguages("language", array('value' => $_SESSION["glpilanguage"])); echo "</td>"; } else { echo "<td colspan='2'> </td>"; } echo "</tr>"; //do some rights verification if (!$extauth && Session::haveRight("password_update", "1")) { echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Password') . "</td>"; echo "<td><input id='password' type='password' name='password' value='' size='30' autocomplete='off' onkeyup=\"return passwordCheck();\">"; echo "</td>"; echo "<td rowspan='2'>" . __('Password security policy') . "</td>"; echo "<td rowspan='2'>"; Config::displayPasswordSecurityChecks(); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Password confirmation') . "</td>"; echo "<td><input type='password' name='password2' value='' size='30' autocomplete='off'>"; echo "</td></tr>"; } echo "<tr class='tab_bg_1'><td>" . __('Phone') . "</td><td>"; if ($extauth && isset($authtype['phone_field']) && !empty($authtype['phone_field'])) { echo $this->fields["phone"]; } else { Html::autocompletionTextField($this, "phone"); } echo "</td>"; echo "<td class='top'>" . _n('Email', 'Emails', Session::getPluralNumber()); UserEmail::showAddEmailButton($this); echo "</td><td>"; UserEmail::showForUser($this); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __('Mobile phone') . " </td><td>"; if ($extauth && isset($authtype['mobile_field']) && !empty($authtype['mobile_field'])) { echo $this->fields["mobile"]; } else { Html::autocompletionTextField($this, "mobile"); } echo "</td>"; if (count($_SESSION['glpiprofiles']) > 1) { echo "<td>" . __('Default profile') . "</td><td>"; $options = Dropdown::getDropdownArrayNames('glpi_profiles', Profile_User::getUserProfiles($this->fields['id'])); Dropdown::showFromArray("profiles_id", $options, array('value' => $this->fields["profiles_id"], 'display_emptychoice' => true)); echo "</td>"; } else { echo "<td colspan='2'> </td>"; } echo "</tr>"; echo "<tr class='tab_bg_1'><td>" . __('Phone 2') . "</td><td>"; if ($extauth && isset($authtype['phone2_field']) && !empty($authtype['phone2_field'])) { echo $this->fields["phone2"]; } else { Html::autocompletionTextField($this, "phone2"); } echo "</td>"; $entities = Profile_User::getUserEntities($this->fields['id'], 1); if (!GLPI_DEMO_MODE && count($_SESSION['glpiactiveentities']) > 1) { echo "<td>" . __('Default entity') . "</td><td>"; Entity::dropdown(array('value' => $this->fields['entities_id'], 'entity' => $entities)); } else { echo "<td colspan='2'> "; } echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Administrative number') . "</td><td>"; if ($extauth && isset($authtype['registration_number_field']) && !empty($authtype['registration_number_field'])) { echo $this->fields["registration_number"]; } else { Html::autocompletionTextField($this, "registration_number"); } echo "</td><td colspan='2'></td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Location') . "</td><td>"; $entities = Profile_User::getUserEntities($ID, true); Location::dropdown(array('value' => $this->fields['locations_id'], 'entity' => $entities)); if (Config::canUpdate()) { echo "<td>" . __('Use GLPI in mode') . "</td><td>"; $modes[Session::NORMAL_MODE] = __('Normal'); //$modes[Session::TRANSLATION_MODE] = __('Translation'); $modes[Session::DEBUG_MODE] = __('Debug'); Dropdown::showFromArray('use_mode', $modes, array('value' => $this->fields["use_mode"])); } else { echo "<td colspan='2'> "; } echo "</td></tr>"; echo "<tr><td class='tab_bg_2 center' colspan='4'>"; echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); echo "</div>"; $CFG_GLPI["use_ajax_autocompletion"] = $save_autocompletion; return true; } return false; }
/** * @see CommonGLPI::getTabNameForItem() **/ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { switch ($item->getType()) { case 'Preference': return __('Personalization'); case 'User': if (User::canUpdate() && $item->currentUserHaveMoreRightThan($item->getID())) { return __('Settings'); } break; case __CLASS__: $tabs[1] = __('General setup'); // Display $tabs[2] = __('Default values'); // Prefs $tabs[3] = __('Assets'); $tabs[4] = __('Assistance'); if (Config::canUpdate()) { $tabs[5] = __('System'); } if (DBConnection::isDBSlaveActive() && Config::canUpdate()) { $tabs[6] = _n('Mysql replica', 'Mysql replicas', Session::getPluralNumber()); // Slave } return $tabs; } return ''; }
/** * @param $template NotificationTemplate object * @param $options array **/ function showSummary(NotificationTemplate $template, $options = array()) { global $DB, $CFG_GLPI; $nID = $template->getField('id'); $canedit = Config::canUpdate(); if ($canedit) { echo "<div class='center'>" . "<a class='vsubmit' href='" . Toolbox::getItemTypeFormURL('NotificationTemplateTranslation') . "?notificationtemplates_id=" . $nID . "'>" . __('Add a new translation') . "</a></div><br>"; } echo "<div class='center' id='tabsbody'>"; Session::initNavigateListItems('NotificationTemplateTranslation', sprintf(__('%1$s = %2$s'), NotificationTemplate::getTypeName(1), $template->getName())); if ($canedit) { $rand = mt_rand(); Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand); Html::showMassiveActions($massiveactionparams); } echo "<table class='tab_cadre_fixe'>"; echo "<tr class='tab_bg_1'>"; if ($canedit) { echo "<th width='10'>"; Html::checkAllAsCheckbox('mass' . __CLASS__ . $rand); echo "</th>"; } echo "<th>" . __('Language') . "</th></tr>"; foreach ($DB->request('glpi_notificationtemplatetranslations', array('notificationtemplates_id' => $nID)) as $data) { if ($this->getFromDB($data['id'])) { Session::addToNavigateListItems('NotificationTemplateTranslation', $data['id']); echo "<tr class='tab_bg_1'>"; if ($canedit) { echo "<td class='center'>"; Html::showMassiveActionCheckBox(__CLASS__, $data["id"]); echo "</td>"; } echo "<td class='center'>"; echo "<a href='" . Toolbox::getItemTypeFormURL('NotificationTemplateTranslation') . "?id=" . $data['id'] . "&notificationtemplates_id=" . $nID . "'>"; if ($data['language'] != '') { echo $CFG_GLPI['languages'][$data['language']][0]; } else { _e('Default translation'); } echo "</a></td></tr>"; } } echo "</table>"; if ($canedit) { $massiveactionparams['ontop'] = false; Html::showMassiveActions($massiveactionparams); Html::closeForm(); } echo "</div>"; }
/** * Display a mail server configuration form * * @param $value String host connect string ex * {localhost:993/imap/ssl}INBOX * * @return String type of the server (imap/pop) **/ static function showMailServerConfig($value) { if (!Config::canUpdate()) { return false; } $tab = Toolbox::parseMailServerConnectString($value); echo "<tr class='tab_bg_1'><td>" . __('Server') . "</td>"; echo "<td><input size='30' type='text' name='mail_server' value=\"" . $tab['address'] . "\">"; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'><td>" . __('Connection options') . "</td><td>"; $values = array('' => '', '/imap' => __('IMAP'), '/pop' => __('POP')); $svalue = !empty($tab['type']) ? '/' . $tab['type'] : ''; Dropdown::showFromArray('server_type', $values, array('value' => $svalue, 'width' => '10%')); $values = array('' => '', '/ssl' => __('SSL')); $svalue = $tab['ssl'] ? '/ssl' : ''; Dropdown::showFromArray('server_ssl', $values, array('value' => $svalue, 'width' => '10%')); $values = array('' => '', '/tls' => __('TLS'), '/notls' => __('NO-TLS')); $svalue = ''; if ($tab['tls'] === true) { $svalue = '/tls'; } if ($tab['tls'] === false) { $svalue = '/notls'; } Dropdown::showFromArray('server_tls', $values, array('value' => $svalue, 'width' => '14%')); $values = array('' => '', '/novalidate-cert' => __('NO-VALIDATE-CERT'), '/validate-cert' => __('VALIDATE-CERT')); $svalue = ''; if ($tab['validate-cert'] === false) { $svalue = '/novalidate-cert'; } if ($tab['validate-cert'] === true) { $svalue = '/validate-cert'; } Dropdown::showFromArray('server_cert', $values, array('value' => $svalue, 'width' => '20%')); $values = array('' => '', '/norsh' => __('NORSH')); $svalue = $tab['norsh'] === true ? '/norsh' : ''; Dropdown::showFromArray('server_rsh', $values, array('value' => $svalue, 'width' => '12%')); $values = array('' => '', '/secure' => __('SECURE')); $svalue = $tab['secure'] === true ? '/secure' : ''; Dropdown::showFromArray('server_secure', $values, array('value' => $svalue, 'width' => '12%')); $values = array('' => '', '/debug' => __('DEBUG')); $svalue = $tab['debug'] === true ? '/debug' : ''; Dropdown::showFromArray('server_debug', $values, array('value' => $svalue, 'width' => '12%')); echo "<input type=hidden name=imap_string value='" . $value . "'>"; echo "</td></tr>\n"; echo "<tr class='tab_bg_1'><td>" . __('Incoming mail folder (optional, often INBOX)') . "</td>"; echo "<td><input size='30' type='text' name='server_mailbox' value=\"" . $tab['mailbox'] . "\" >"; echo "</td></tr>\n"; //TRANS: for mail connection system echo "<tr class='tab_bg_1'><td>" . __('Port (optional)') . "</td>"; echo "<td><input size='10' type='text' name='server_port' value='" . $tab['port'] . "'></td></tr>\n"; if (empty($value)) { $value = " "; } //TRANS: for mail connection system echo "<tr class='tab_bg_1'><td>" . __('Connection string') . "</td>"; echo "<td class='b'>{$value}</td></tr>\n"; return $tab['type']; }
/** * Print the mailing config form * * @param $ID integer ID of the item * @param $options array * - target filename : where to go when done. * - tabs integer : ID of the tab to display * * @return Nothing (display) **/ function showForm($ID, $options = array()) { global $CFG_GLPI; if (!Config::canUpdate()) { return false; } if (!$CFG_GLPI['use_mailing']) { $options['colspan'] = 1; } $this->getFromDB($ID); return true; }
/** * Is the current user have right to update the current notification ? * * @return boolean **/ function canCreateItem() { if (($this->fields['itemtype'] == 'Crontask' || $this->fields['itemtype'] == 'DBConnection') && !Config::canUpdate()) { return false; } return Session::haveAccessToEntity($this->getEntityID()); }
/** * Print the auth mail form * * @param $ID Integer : ID of the item * @param $options array * * @return Nothing (display) **/ function showForm($ID, $options = array()) { if (!Config::canUpdate()) { return false; } $spotted = false; if (empty($ID)) { if ($this->getEmpty()) { $spotted = true; } } else { if ($this->getFromDB($ID)) { $spotted = true; } } if (Toolbox::canUseImapPop()) { $options['colspan'] = 1; $this->showFormHeader($options); echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>"; echo "<td><input size='30' type='text' name='name' value='" . $this->fields["name"] . "'>"; echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Active') . "</td>"; echo "<td colspan='3'>"; Dropdown::showYesNo('is_active', $this->fields['is_active']); echo "</td></tr>"; echo "<tr class='tab_bg_1'>"; echo "<td>" . __('Email domain Name (users email will be login@domain)') . "</td>"; echo "<td><input size='30' type='text' name='host' value='" . $this->fields["host"] . "'>"; echo "</td></tr>"; Toolbox::showMailServerConfig($this->fields["connect_string"]); echo "<tr class='tab_bg_1'><td>" . __('Comments') . "</td>"; echo "<td>"; echo "<textarea cols='40' rows='4' name='comment'>" . $this->fields["comment"] . "</textarea>"; if ($ID > 0) { echo "<br>"; //TRANS: %s is the datetime of update printf(__('Last update on %s'), Html::convDateTime($this->fields["date_mod"])); } echo "</td></tr>"; $this->showFormButtons($options); } else { echo "<div class='center'> <table class='tab_cadre_fixe'>"; echo "<tr><th colspan='2'>" . __('Email server configuration') . "</th></tr>"; echo "<tr class='tab_bg_2'><td class='center'>"; echo "<p class='red'>" . __('Your PHP parser was compiled without the IMAP functions') . "</p>"; echo "<p>" . __('Impossible to use email server as external source of connection') . "</p>"; echo "</td></tr></table></div>"; } }
/** * @see CommonGLPI::getMenuContent() * * @since version 0.85 **/ static function getMenuContent() { $menu = array(); if (Config::canUpdate()) { $menu['title'] = SLA::getTypeName(Session::getPluralNumber()); $menu['page'] = '/front/sla.php'; $menu['links']['search'] = '/front/sla.php'; $menu['links']['add'] = '/front/sla.form.php'; $menu['options']['slt']['title'] = SLT::getTypeName(Session::getPluralNumber()); $menu['options']['slt']['page'] = '/front/slt.php'; $menu['options']['slt']['links']['search'] = '/front/slt.php'; $menu['options']['slalevel']['title'] = SlaLevel::getTypeName(Session::getPluralNumber()); $menu['options']['slalevel']['page'] = '/front/slalevel.php'; $menu['options']['slalevel']['links']['search'] = '/front/slalevel.php'; } if (count($menu)) { return $menu; } return false; }