/** * Get available display options array * * @since version 0.84 * * @return all the options **/ static function getAvailableDisplayOptions() { $options[__('Global displays')] = array('characteristics' => array('name' => __('Characteristics'), 'default' => true), 'internet' => array('name' => __('Internet information'), 'default' => true), 'dynamic_import' => array('name' => __('Automatic inventory'), 'default' => false)); $options[__('Common options')] = NetworkPortInstantiation::getGlobalInstantiationNetworkPortDisplayOptions(); $options[__('Internet information')] = array('names' => array('name' => NetworkName::getTypeName(2), 'default' => false), 'aliases' => array('name' => NetworkAlias::getTypeName(2), 'default' => false), 'ipaddresses' => array('name' => IPAddress::getTypeName(2), 'default' => true), 'ipnetworks' => array('name' => IPNetwork::getTypeName(2), 'default' => true)); foreach (self::getNetworkPortInstantiations() as $portType) { $portTypeName = $portType::getTypeName(0); $options[$portTypeName] = $portType::getInstantiationNetworkPortDisplayOptions(); } return $options; }
(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 */ include '../inc/includes.php'; $alias = new NetworkAlias(); if (!isset($_GET["id"])) { $_GET["id"] = -1; } if (empty($_GET["networknames_id"])) { $_GET["networknames_id"] = ""; } if (isset($_POST["add"])) { $alias->check(-1, 'w', $_POST); if ($newID = $alias->add($_POST)) { Ajax::refreshPopupTab(); Event::log($newID, $alias->getType(), 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"])); } Html::back(); } else { if (isset($_POST["delete"])) {
/** * @since version 0.84 * * @param $row HTMLTableRow object (default NULL) * @param $item CommonDBTM object (default NULL) * @param $father HTMLTableCell object (default NULL) * @param $options array **/ static function getHTMLTableCellsForItem(HTMLTableRow $row = NULL, CommonDBTM $item = NULL, HTMLTableCell $father = NULL, array $options = array()) { global $DB, $CFG_GLPI; $column_name = __CLASS__; if (empty($item)) { if (empty($father)) { return; } $item = $father->getItem(); } switch ($item->getType()) { case 'FQDN': $JOINS = ""; $ORDER = "`glpi_networknames`.`name`"; if (isset($options['order'])) { switch ($options['order']) { case 'name': break; case 'ip': $JOINS = " LEFT JOIN `glpi_ipaddresses`\n ON (`glpi_ipaddresses`.`items_id` = `glpi_networknames`.`id`\n AND `glpi_ipaddresses`.`itemtype` = 'NetworkName'\n AND `glpi_ipaddresses`.`is_deleted` = '0')"; $ORDER = "ISNULL (`glpi_ipaddresses`.`id`),\n `glpi_ipaddresses`.`binary_3`, `glpi_ipaddresses`.`binary_2`,\n `glpi_ipaddresses`.`binary_1`, `glpi_ipaddresses`.`binary_0`"; break; case 'alias': $JOINS = " LEFT JOIN `glpi_networkaliases`\n ON (`glpi_networkaliases`.`networknames_id`\n = `glpi_networknames`.`id`)"; $ORDER = "ISNULL(`glpi_networkaliases`.`name`),\n `glpi_networkaliases`.`name`"; break; } } $query = "SELECT `glpi_networknames`.`id`\n FROM `glpi_networknames`\n {$JOINS}\n WHERE `glpi_networknames`.`fqdns_id` = '" . $item->fields["id"] . "'\n AND `glpi_networknames`.`is_deleted` = '0'\n ORDER BY {$ORDER}"; break; case 'NetworkPort': $query = "SELECT `id`\n FROM `glpi_networknames`\n WHERE `itemtype` = '" . $item->getType() . "'\n AND `items_id` = '" . $item->getID() . "'\n AND `glpi_networknames`.`is_deleted` = '0'"; break; case 'NetworkEquipment': $query = "SELECT `glpi_networknames`.`id`\n FROM `glpi_networknames`, `glpi_networkports`\n WHERE `glpi_networkports`.`itemtype` = '" . $item->getType() . "'\n AND `glpi_networkports`.`items_id` ='" . $item->getID() . "'\n AND `glpi_networknames`.`itemtype` = 'NetworkPort'\n AND `glpi_networknames`.`items_id` = `glpi_networkports`.`id`\n AND `glpi_networknames`.`is_deleted` = '0'"; break; } if (isset($options['SQL_options'])) { $query .= " " . $options['SQL_options']; } $canedit = isset($options['canedit']) && $options['canedit']; $createRow = isset($options['createRow']) && $options['createRow']; $options['createRow'] = false; $address = new self(); foreach ($DB->request($query) as $line) { if ($address->getFromDB($line["id"])) { if ($createRow) { $row = $row->createAnotherRow(); } if (isset($options['massiveactionnetworkname']) && $options['massiveactionnetworkname']) { $header = $row->getGroup()->getHeaderByName('Internet', 'delete'); $cell_value = Html::getMassiveActionCheckBox(__CLASS__, $line["id"]); $delete_cell = $row->addCell($header, $cell_value, $father); } $internetName = $address->getInternetName(); if (empty($internetName)) { $internetName = "(" . $line["id"] . ")"; } $content = $internetName; if (Session::haveRight('internet', READ)) { $content = "<a href='" . $address->getLinkURL() . "'>" . $internetName . "</a>"; } if (!isset($options['dont_display'][$column_name])) { $header = $row->getGroup()->getHeaderByName('Internet', $column_name); $name_cell = $row->addCell($header, $content, $father, $address); if (isset($options['display_isDynamic']) && $options['display_isDynamic']) { $dyn_header = $row->getGroup()->getHeaderByName('Internet', $column_name . '_dynamic'); $dynamic_cell = $row->addCell($dyn_header, Dropdown::getYesNo($address->fields['is_dynamic']), $name_cell); $father_for_children = $dynamic_cell; } else { $father_for_children = $name_cell; } } else { $father_for_children = $father; } NetworkAlias::getHTMLTableCellsForItem($row, $address, $father_for_children, $options); IPAddress::getHTMLTableCellsForItem($row, $address, $father_for_children, $options); } } }
(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 */ include '../inc/includes.php'; $alias = new NetworkAlias(); if (!isset($_GET["id"])) { $_GET["id"] = -1; } if (empty($_GET["networknames_id"])) { $_GET["networknames_id"] = ""; } if (isset($_POST["add"])) { $alias->check(-1, CREATE, $_POST); if ($newID = $alias->add($_POST)) { Event::log($newID, $alias->getType(), 4, "setup", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"])); if ($_SESSION['glpibackcreated']) { Html::redirect($alias->getFormURL() . "?id=" . $newID); } } Html::back();