function showForm($ID, $options = array()) { global $LANG, $CFG_GLPI; if (!haveRight("notification", "r")) { return false; } if ($ID > 0) { $this->check($ID, 'r'); } else { // Create item $this->check(-1, 'w'); } $this->showTabs($options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " :</td>"; echo "<td>"; autocompletionTextField($this, "name"); echo "</td>"; echo "<td rowspan='6' class='middle right'>" . $LANG['common'][25] . " :</td>"; echo "<td class='center middle' rowspan='6'><textarea cols='45' rows='9' name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>"; echo "<tr class='tab_bg_1'><td>" . $LANG['common'][60] . " :</td>"; echo "<td>"; Dropdown::showYesNo('is_active', $this->fields['is_active']); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . $LANG['common'][17] . " :</td>"; echo "<td>"; if (haveRight('config', 'w') && $this->getEntityID() == 0) { $rand = Dropdown::dropdownTypes("itemtype", $this->fields['itemtype'], $CFG_GLPI["notificationtemplates_types"]); } else { $rand = Dropdown::dropdownTypes("itemtype", $this->fields['itemtype'], array_diff($CFG_GLPI["notificationtemplates_types"], array('Crontask', 'DBConnection'))); } $params = array('itemtype' => '__VALUE__'); ajaxUpdateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_events", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationEvent.php", $params); ajaxUpdateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_templates", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationTemplate.php", $params); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][120] . " :</td>"; echo "<td>"; self::dropdownMode($this->fields['mode']); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][119] . " :</td>"; echo "<td><span id='show_events'>"; NotificationEvent::dropdownEvents($this->fields['itemtype'], $this->fields['event']); echo "</span></td></tr>"; echo "<tr class='tab_bg_1'><td>" . $LANG['mailing'][113] . " :</td>"; echo "<td><span id='show_templates'>"; NotificationTemplate::dropdownTemplates('notificationtemplates_id', $this->fields['itemtype'], $this->fields['notificationtemplates_id']); echo "</span></td></tr>"; $this->showFormButtons($options); $this->addDivForTabs(); return true; }
------------------------------------------------------------------------- LICENSE This file is part of GLPI. GLPI 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. GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ if (strpos($_SERVER['PHP_SELF'], "dropdownNotificationTemplate.php")) { include '../inc/includes.php'; header("Content-Type: text/html; charset=UTF-8"); Html::header_nocache(); } Session::checkRight("notification", UPDATE); NotificationTemplate::dropdownTemplates('notificationtemplates_id', $_POST['itemtype']);
function showForm($ID, $options = array()) { global $CFG_GLPI; $this->initForm($ID, $options); $this->showFormHeader($options); echo "<tr class='tab_bg_1'><td>" . __('Name') . "</td>"; echo "<td>"; Html::autocompletionTextField($this, "name"); echo "</td>"; echo "<td rowspan='6' class='middle right'>" . __('Comments') . "</td>"; echo "<td class='center middle' rowspan='6'><textarea cols='45' rows='9' class='form-control' name='comment' >" . $this->fields["comment"] . "</textarea></td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Active') . "</td>"; echo "<td>"; Dropdown::showYesNo('is_active', $this->fields['is_active']); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Type') . "</td>"; echo "<td>"; if (!Session::haveRight(static::$rightname, UPDATE)) { $itemtype = $this->fields['itemtype']; echo $itemtype::getTypeName(1); $rand = ''; } else { if (Config::canUpdate() && $this->getEntityID() == 0) { $rand = Dropdown::showItemTypes('itemtype', $CFG_GLPI["notificationtemplates_types"], array('value' => $this->fields['itemtype'])); } else { $rand = Dropdown::showItemTypes('itemtype', array_diff($CFG_GLPI["notificationtemplates_types"], array('Crontask', 'DBConnection', 'User')), array('value' => $this->fields['itemtype'])); } } $params = array('itemtype' => '__VALUE__'); Ajax::updateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_events", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationEvent.php", $params); Ajax::updateItemOnSelectEvent("dropdown_itemtype{$rand}", "show_templates", $CFG_GLPI["root_doc"] . "/ajax/dropdownNotificationTemplate.php", $params); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . __('Notification method') . "</td>"; echo "<td>"; self::dropdownMode(array('value' => $this->fields['mode'])); echo "</td></tr>"; echo "<tr class='tab_bg_1'><td>" . NotificationEvent::getTypeName(1) . "</td>"; echo "<td><span id='show_events'>"; NotificationEvent::dropdownEvents($this->fields['itemtype'], array('value' => $this->fields['event'])); echo "</span></td></tr>"; echo "<tr class='tab_bg_1'><td>" . NotificationTemplate::getTypeName(1) . "</td>"; echo "<td><span id='show_templates'>"; NotificationTemplate::dropdownTemplates('notificationtemplates_id', $this->fields['itemtype'], $this->fields['notificationtemplates_id']); echo "</span></td></tr>"; $this->showFormButtons($options); return true; }