示例#1
0
function plugin_monitoring_searchOptionsValues($item)
{
    global $CFG_GLPI;
    if ($item['searchoption']['table'] == 'glpi_plugin_monitoring_services' and $item['searchoption']['field'] == 'state') {
        $input = array();
        $input['CRITICAL'] = 'CRITICAL';
        $input['DOWN'] = 'DOWN';
        $input['DOWNTIME'] = 'DOWNTIME';
        $input['FLAPPING'] = 'FLAPPING';
        $input['OK'] = 'OK';
        $input['RECOVERY'] = 'RECOVERY';
        $input['UNKNOWN'] = 'UNKNOWN';
        $input['UNREACHABLE'] = 'UNREACHABLE';
        $input['UP'] = 'UP';
        $input['WARNING'] = 'WARNING';
        Dropdown::showFromArray($item['name'], $input, array('value' => $item['value']));
        return true;
    } else {
        if ($item['searchoption']['table'] == 'glpi_plugin_monitoring_services' and $item['searchoption']['field'] == 'state_type') {
            $input = array();
            $input['HARD'] = 'HARD';
            $input['SOFT'] = 'SOFT';
            Dropdown::showFromArray($item['name'], $input, array('value' => $item['value']));
            return true;
        } else {
            if ($item['searchoption']['table'] == 'glpi_plugin_monitoring_services' and ($item['searchoption']['field'] == 'Computer' or $item['searchoption']['field'] == 'Printer' or $item['searchoption']['field'] == 'NetworkEquipment')) {
                $itemtype = $item['searchoption']['field'];
                $use_ajax = false;
                if ($CFG_GLPI["use_ajax"]) {
                    $nb = countElementsInTable("glpi_plugin_monitoring_componentscatalogs_hosts", "`itemtype`='Computer'");
                    if ($nb > $CFG_GLPI["ajax_limit_count"]) {
                        $use_ajax = true;
                    }
                }
                $params = array();
                $params['itemtype'] = $itemtype;
                $params['searchText'] = '';
                $params['myname'] = $item['name'];
                $params['rand'] = '';
                $params['value'] = $item['value'];
                $default = "<select name='" . $item['name'] . "' id='dropdown_" . $item['name'] . "0'>";
                if (isset($item['value']) and !empty($item['value'])) {
                    $itemm = new $itemtype();
                    $itemm->getFromDB($item['value']);
                    $default .= "<option value='" . $item['value'] . "'>" . $itemm->getName() . "</option></select>";
                }
                ajaxDropdown($use_ajax, "/plugins/monitoring/ajax/dropdownDevices.php", $params, $default);
                return true;
            }
        }
    }
}
 /**
  * Make a select box for connections
  *
  * @param $itemtype type to connect
  * @param $fromtype from where the connection is
  * @param $myname select name
  * @param $entity_restrict Restrict to a defined entity
  * @param $onlyglobal display only global devices (used for templates)
  * @param $used Already used items ID: not to display in dropdown
  *
  * @return nothing (print out an HTML select box)
  */
 static function dropdownConnect($itemtype, $fromtype, $myname, $entity_restrict = -1, $onlyglobal = 0, $used = array())
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     $use_ajax = false;
     if ($CFG_GLPI["use_ajax"]) {
         $nb = 0;
         if ($entity_restrict >= 0) {
             $nb = countElementsInTableForEntity(getTableForItemType($itemtype), $entity_restrict);
         } else {
             $nb = countElementsInTableForMyEntities(getTableForItemType($itemtype));
         }
         if ($nb > $CFG_GLPI["ajax_limit_count"]) {
             $use_ajax = true;
         }
     }
     $params = array('searchText' => '__VALUE__', 'fromtype' => $fromtype, 'idtable' => $itemtype, 'myname' => $myname, 'onlyglobal' => $onlyglobal, 'entity_restrict' => $entity_restrict, 'used' => $used);
     $default = "<select name='{$myname}'><option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option>\n                  </select>\n";
     ajaxDropdown($use_ajax, "/ajax/dropdownConnect.php", $params, $default, $rand);
     return $rand;
 }
 /**
  * Make a select box for  software to install
  *
  * Parameters which could be used in options array :
  *    - name : string / name of the select (default is softwareversions_id)
  *    - softwares_id : integer / ID of the software
  *    - value : integer / value of the selected version
  *
  * @param options options used
  *
  * @return nothing (print out an HTML select box)
  **/
 static function dropdown($options = array())
 {
     global $CFG_GLPI;
     //$softwares_id,$value=0
     $p['softwares_id'] = 0;
     $p['value'] = 0;
     $p['name'] = 'softwareversions_id';
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     $rand = mt_rand();
     $params = array('softwares_id' => $p['softwares_id'], 'myname' => $p['name'], 'value' => $p['value']);
     $default = "<select name='" . $p['name'] . "'><option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option>\n                  </select>";
     ajaxDropdown(false, "/ajax/dropdownInstallVersion.php", $params, $default, $rand);
     return $rand;
 }
 /**
  * Make a select box for license software to associate
  *
  * @param $myname select name
  * @param $entity_restrict Restrict to a defined entity
  * @param $massiveaction is it a massiveaction select ?
  *
  * @return nothing (print out an HTML select box)
  **/
 static function dropdownLicenseToInstall($myname, $entity_restrict, $massiveaction = 0)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     $use_ajax = false;
     if ($CFG_GLPI["use_ajax"]) {
         if (countElementsInTableForEntity("glpi_softwarelicenses", $entity_restrict) > $CFG_GLPI["ajax_limit_count"]) {
             $use_ajax = true;
         }
     }
     $params = array('searchText' => '__VALUE__', 'myname' => $myname, 'entity_restrict' => $entity_restrict);
     $default = "<select name='{$myname}'><option value='0'>" . DROPDOWN_EMPTY_VALUE . " </option>\n                  </select>";
     ajaxDropdown($use_ajax, "/ajax/dropdownSelectSoftwareLicense.php", $params, $default, $rand);
     return $rand;
 }
 /**
  * Print out an HTML "<select>" for a dropdown with preselected value
  *
  * Parameters which could be used in options array :
  *    - name : string / name of the select (default is depending itemtype)
  *    - value : integer / preselected value (default -1)
  *    - comments : boolean / is the comments displayed near the dropdown (default true)
  *    - entity : integer or array / restrict to a defined entity or array of entities
  *                   (default -1 : no restriction)
  *    - entity_sons : boolean / if entity restrict specified auto select its sons
  *                   only available if entity is a single value not an array (default false)
  *    - toupdate : array / Update a specific item on select change on dropdown
  *                   (need value_fieldname, to_update, url (see ajaxUpdateItemOnSelectEvent for informations)
  *                   and may have moreparams)
  *    - used : array / Already used items ID: not to display in dropdown (default empty)
  *    - auto_submit : boolean / autosubmit on change (default false)
  *    - rand : integer / already computed rand value
  *    - condition : string / aditional SQL condition to limit display
  *    - displaywith : array / array of field to display with request
  *
  * @param $itemtype itemtype used for create dropdown
  * @param $options possible options
  * @return boolean : lse if error and random id if OK
  *
  **/
 static function show($itemtype, $options = array())
 {
     global $DB, $CFG_GLPI, $LANG;
     if ($itemtype && !class_exists($itemtype)) {
         return false;
     }
     $item = new $itemtype();
     $table = $item->getTable();
     $params['name'] = $item->getForeignKeyField();
     $params['value'] = '';
     $params['comments'] = true;
     $params['entity'] = -1;
     $params['entity_sons'] = false;
     $params['toupdate'] = '';
     $params['used'] = array();
     $params['auto_submit'] = 0;
     $params['condition'] = '';
     $params['rand'] = mt_rand();
     $params['displaywith'] = array();
     //Parameters about choice 0
     //Empty choice's label
     $params['emptylabel'] = '';
     //Display emptychoice ?
     $params['display_emptychoice'] = true;
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $params[$key] = $val;
         }
     }
     $name = DROPDOWN_EMPTY_VALUE;
     $comment = "";
     $limit_length = $_SESSION["glpidropdown_chars_limit"];
     // Check default value for dropdown : need to be a numeric
     if (strlen($params['value']) == 0 || !is_numeric($params['value'])) {
         $params['value'] = -1;
     }
     if ($params['value'] > 0 || $itemtype == "Entity" && $params['value'] >= 0) {
         $tmpname = self::getDropdownName($table, $params['value'], 1);
         if ($tmpname["name"] != "&nbsp;") {
             $name = $tmpname["name"];
             $comment = $tmpname["comment"];
             if (utf8_strlen($name) > $_SESSION["glpidropdown_chars_limit"]) {
                 if ($item instanceof CommonTreeDropdown) {
                     $pos = strrpos($name, ">");
                     $limit_length = max(utf8_strlen($name) - $pos, $_SESSION["glpidropdown_chars_limit"]);
                     if (utf8_strlen($name) > $limit_length) {
                         $name = "&hellip;" . utf8_substr($name, -$limit_length);
                     }
                 } else {
                     $limit_length = utf8_strlen($name);
                 }
             } else {
                 $limit_length = $_SESSION["glpidropdown_chars_limit"];
             }
         }
     }
     // Manage entity_sons
     if (!($params['entity'] < 0) && $params['entity_sons']) {
         if (is_array($params['entity'])) {
             echo "entity_sons options is not available with array of entity";
         } else {
             $params['entity'] = getSonsOf('glpi_entities', $params['entity']);
         }
     }
     $use_ajax = false;
     if ($CFG_GLPI["use_ajax"]) {
         $nb = 0;
         if ($item->isEntityAssign()) {
             if (!($params['entity'] < 0)) {
                 $nb = countElementsInTableForEntity($table, $params['entity'], $params['condition']);
             } else {
                 $nb = countElementsInTableForMyEntities($table, $params['condition']);
             }
         } else {
             $nb = countElementsInTable($table, $params['condition']);
         }
         $nb -= count($params['used']);
         if ($nb > $CFG_GLPI["ajax_limit_count"]) {
             $use_ajax = true;
         }
     }
     $param = array('searchText' => '__VALUE__', 'value' => $params['value'], 'itemtype' => $itemtype, 'myname' => $params['name'], 'limit' => $limit_length, 'comment' => $params['comments'], 'rand' => $params['rand'], 'entity_restrict' => $params['entity'], 'update_item' => $params['toupdate'], 'used' => $params['used'], 'auto_submit' => $params['auto_submit'], 'condition' => $params['condition'], 'emptylabel' => $params['emptylabel'], 'display_emptychoice' => $params['display_emptychoice']);
     $default = "<select name='" . $params['name'] . "' id='dropdown_" . $params['name'] . $params['rand'] . "'>";
     $default .= "<option value='" . $params['value'] . "'>{$name}</option></select>";
     ajaxDropdown($use_ajax, "/ajax/dropdownValue.php", $param, $default, $params['rand']);
     // Display comment
     if ($params['comments']) {
         $options_tooltip = array('contentid' => "comment_" . $params['name'] . $params['rand']);
         if ($item->canView() && $params['value'] && $item->getFromDB($params['value']) && $item->canViewItem()) {
             $options_tooltip['link'] = $item->getLinkURL();
             $options_tooltip['linktarget'] = '_blank';
         }
         showToolTip($comment, $options_tooltip);
         if ($item instanceof CommonDropdown && $item->canCreate() && !isset($_GET['popup'])) {
             echo "<img alt='' title=\"" . $LANG['buttons'][8] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'\n                     onClick=\"var w = window.open('" . $item->getFormURL() . "?popup=1&amp;rand=" . $params['rand'] . "' ,'glpipopup', 'height=400, " . "width=1000, top=100, left=100, scrollbars=yes' );w.focus();\">";
         }
         // Display specific Links
         if ($itemtype == "Supplier") {
             if ($item->getFromDB($params['value'])) {
                 echo $item->getLinks();
             }
         }
         if ($itemtype == 'TicketCategory' && haveRight('knowbase', 'r')) {
             if ($params['value'] && $item->getFromDB($params['value'])) {
                 echo '&nbsp;' . $item->getLinks();
             }
         }
     }
     return $params['rand'];
 }
示例#6
0
 /**
  * Dropdown rules for a defined sub_type of rule
  *
  * Parameters which could be used in options array :
  *    - name : string / name of the select (default is depending itemtype)
  *    - sub_type : integer / sub_type of rule
  *
  * @param $options possible options
  **/
 static function dropdown($options = array())
 {
     global $DB, $CFG_GLPI, $LANG;
     $p['sub_type'] = '';
     $p['name'] = 'rules_id';
     $p['entity_restrict'] = '';
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     if ($p['sub_type'] == '') {
         return false;
     }
     $rand = mt_rand();
     $limit_length = $_SESSION["glpidropdown_chars_limit"];
     $use_ajax = false;
     if ($CFG_GLPI["use_ajax"]) {
         $nb = countElementsInTable("glpi_rules", "`sub_type`='" . $p['sub_type'] . "'");
         if ($nb > $CFG_GLPI["ajax_limit_count"]) {
             $use_ajax = true;
         }
     }
     $params = array('searchText' => '__VALUE__', 'myname' => $p['name'], 'limit' => $limit_length, 'rand' => $rand, 'type' => $p['sub_type'], 'entity_restrict' => $p['entity_restrict']);
     $default = "<select name='" . $p['name'] . "' id='dropdown_" . $p['name'] . $rand . "'>";
     $default .= "<option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option></select>";
     ajaxDropdown($use_ajax, "/ajax/dropdownRules.php", $params, $default, $rand);
     return $rand;
 }
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, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Julien Dombre
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkRight("networking", "w");
// Make a select box
if (class_exists($_POST["itemtype"])) {
    $table = getTableForItemType($_POST["itemtype"]);
    $rand = mt_rand();
    $use_ajax = true;
    $paramsconnectpdt = array('searchText' => '__VALUE__', 'itemtype' => $_POST['itemtype'], 'rand' => $rand, 'myname' => "items", 'entity_restrict' => $_POST["entity_restrict"], 'update_item' => array('value_fieldname' => 'item', 'to_update' => "results_item_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/dropdownConnectPort.php", 'moreparams' => array('current' => $_POST['current'], 'itemtype' => $_POST['itemtype'], 'myname' => $_POST['myname'])));
    $default = "<select name='item{$rand}'><option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option></select>\n";
    ajaxDropdown($use_ajax, "/ajax/dropdownValue.php", $paramsconnectpdt, $default, $rand);
    echo "<span id='results_item_{$rand}'>";
    echo "</span>\n";
}
示例#8
0
 /**
  * Make a select box with all glpi users where select key = name
  *
  * Parameters which could be used in options array :
  *    - name : string / name of the select (default is users_id)
  *    - right : string / limit user who have specific right :
  *        id -> only current user (default case);
  *        interface -> central ;
  *        all -> all users ;
  *        specific right like show_all_ticket, create_ticket....
  *    - comments : boolean / is the comments displayed near the dropdown (default true)
  *    - entity : integer or array / restrict to a defined entity or array of entities
  *                   (default -1 : no restriction)
  *    - entity_sons : boolean / if entity restrict specified auto select its sons
  *                   only available if entity is a single value not an array(default false)
  *    - all : Nobody or All display for none selected
  *          all=0 (default) -> Nobody
  *          all=1 -> All
  *          all=-1-> nothing
  *    - rand : integer / already computed rand value
  *    - toupdate : array / Update a specific item on select change on dropdown
  *                   (need value_fieldname, to_update, url (see ajaxUpdateItemOnSelectEvent for informations)
  *                   and may have moreparams)
  *    - used : array / Already used items ID: not to display in dropdown (default empty)
  *    - auto_submit : boolean / autosubmit on change (default false)
  *
  * @param $options possible options
  *
  * @return nothing (print out an HTML select box)
  **/
 static function dropdown($options = array())
 {
     global $DB, $CFG_GLPI, $LANG;
     // Defautl values
     $p['name'] = 'users_id';
     $p['value'] = '';
     $p['right'] = 'id';
     $p['all'] = 0;
     $p['auto_submit'] = false;
     $p['comments'] = 1;
     $p['entity'] = -1;
     $p['entity_sons'] = false;
     $p['used'] = array();
     $p['ldap_import'] = false;
     $p['toupdate'] = '';
     $p['rand'] = mt_rand();
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     if (!($p['entity'] < 0) && $p['entity_sons']) {
         if (is_array($p['entity'])) {
             echo "entity_sons options is not available with array of entity";
         } else {
             $p['entity'] = getSonsOf('glpi_entities', $p['entity']);
         }
     }
     // Make a select box with all glpi users
     $use_ajax = false;
     if ($CFG_GLPI["use_ajax"]) {
         $res = self::getSqlSearchResult(true, $p['right'], $p['entity'], $p['value'], $p['used']);
         $nb = $res ? $DB->result($res, 0, "cpt") : 0;
         if ($nb > $CFG_GLPI["ajax_limit_count"]) {
             $use_ajax = true;
         }
     }
     $user = getUserName($p['value'], 2);
     $default_display = "<select id='dropdown_" . $p['name'] . $p['rand'] . "' name='" . $p['name'] . "'>";
     $default_display .= "<option value='" . $p['value'] . "'>";
     $default_display .= utf8_substr($user["name"], 0, $_SESSION["glpidropdown_chars_limit"]);
     $default_display .= "</option></select>";
     $view_users = haveRight("user", "r");
     $params = array('searchText' => '__VALUE__', 'value' => $p['value'], 'myname' => $p['name'], 'all' => $p['all'], 'right' => $p['right'], 'comment' => $p['comments'], 'rand' => $p['rand'], 'auto_submit' => $p['auto_submit'], 'entity_restrict' => $p['entity'], 'used' => $p['used'], 'update_item' => $p['toupdate']);
     if ($view_users) {
         $params['update_link'] = $view_users;
     }
     $default = "";
     if (!empty($p['value']) && $p['value'] > 0) {
         $default = $default_display;
     } else {
         $default = "<select name='" . $p['name'] . "' id='dropdown_" . $p['name'] . $p['rand'] . "'>";
         if ($p['all']) {
             $default .= "<option value='0'>[ " . $LANG['common'][66] . " ]</option></select>";
         } else {
             $default .= "<option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option></select>\n";
         }
     }
     ajaxDropdown($use_ajax, "/ajax/dropdownUsers.php", $params, $default, $p['rand']);
     // Display comment
     if ($p['comments']) {
         if (!$view_users) {
             $user["link"] = '';
         } else {
             if (empty($user["link"])) {
                 $user["link"] = $CFG_GLPI['root_doc'] . "/front/user.php";
             }
         }
         showToolTip($user["comment"], array('contentid' => "comment_" . $p['name'] . $p['rand'], 'link' => $user["link"], 'linkid' => "comment_link_" . $p["name"] . $p['rand']));
     }
     if (haveRight('import_externalauth_users', 'w') && $p['ldap_import'] && EntityData::isEntityDirectoryConfigured($_SESSION['glpiactive_entity'])) {
         echo "<img alt='' title=\"" . $LANG['ldap'][35] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'\n                onClick=\"var w = window.open('" . $CFG_GLPI['root_doc'] . "/front/popup.php?popup=add_ldapuser&amp;rand=" . $p['rand'] . "&amp;entity=" . $_SESSION['glpiactive_entity'] . "' ,'glpipopup', 'height=400, " . "width=1000, top=100, left=100, scrollbars=yes' );w.focus();\">";
     }
     return $p['rand'];
 }
define('GLPI_ROOT', '..');
include GLPI_ROOT . "/inc/includes.php";
header("Content-Type: text/html; charset=UTF-8");
header_nocache();
checkCentralAccess();
// Make a select box
if ($_POST["idtable"] && class_exists($_POST["idtable"])) {
    $table = getTableForItemType($_POST["idtable"]);
    // Link to user for search only > normal users
    $link = "dropdownValue.php";
    if ($_POST["idtable"] == 'User') {
        $link = "dropdownUsers.php";
    }
    $rand = mt_rand();
    $use_ajax = false;
    if ($CFG_GLPI["use_ajax"] && countElementsInTable($table) > $CFG_GLPI["ajax_limit_count"]) {
        $use_ajax = true;
    }
    $paramsallitems = array('searchText' => '__VALUE__', 'table' => $table, 'itemtype' => $_POST["idtable"], 'rand' => $rand, 'myname' => $_POST["myname"], 'displaywith' => array('otherserial', 'serial'), 'display_emptychoice' => true);
    if (isset($_POST['value'])) {
        $paramsallitems['value'] = $_POST['value'];
    }
    if (isset($_POST['entity_restrict'])) {
        $paramsallitems['entity_restrict'] = $_POST['entity_restrict'];
    }
    if (isset($_POST['condition'])) {
        $paramsallitems['condition'] = stripslashes($_POST['condition']);
    }
    $default = "<select name='" . $_POST["myname"] . "'><option value='0'>" . DROPDOWN_EMPTY_VALUE . "</option></select>";
    ajaxDropdown($use_ajax, "/ajax/{$link}", $paramsallitems, $default, $rand);
}
示例#10
0
 /**
  * Print out an HTML "<select>" for a dropdown with preselected value
  *
  *
  * @param $myname the name of the HTML select
  * @param $value the preselected value we want
  * @param $locations_id default location ID for search
  * @param $display_comment display the comment near the dropdown
  * @param $entity_restrict Restrict to a defined entity
  * @param $devtype
  * @return nothing (display the select box)
  *
  */
 static function dropdownNetpoint($myname, $value = 0, $locations_id = -1, $display_comment = 1, $entity_restrict = -1, $devtype = -1)
 {
     global $CFG_GLPI, $LANG;
     $rand = mt_rand();
     $name = "------";
     $comment = "";
     $limit_length = $_SESSION["glpidropdown_chars_limit"];
     if (empty($value)) {
         $value = 0;
     }
     if ($value > 0) {
         $tmpname = Dropdown::getDropdownName("glpi_netpoints", $value, 1);
         if ($tmpname["name"] != "&nbsp;") {
             $name = $tmpname["name"];
             $comment = $tmpname["comment"];
             $limit_length = max(utf8_strlen($name), $_SESSION["glpidropdown_chars_limit"]);
         }
     }
     $use_ajax = false;
     if ($CFG_GLPI["use_ajax"]) {
         if ($locations_id < 0 || $devtype == 'NetworkEquipment') {
             $nb = countElementsInTableForEntity("glpi_netpoints", $entity_restrict);
         } else {
             if ($locations_id > 0) {
                 $nb = countElementsInTable("glpi_netpoints", "locations_id={$locations_id} ");
             } else {
                 $nb = countElementsInTable("glpi_netpoints", "locations_id=0 " . getEntitiesRestrictRequest(" AND ", "glpi_netpoints", '', $entity_restrict));
             }
         }
         if ($nb > $CFG_GLPI["ajax_limit_count"]) {
             $use_ajax = true;
         }
     }
     $params = array('searchText' => '__VALUE__', 'value' => $value, 'locations_id' => $locations_id, 'myname' => $myname, 'limit' => $limit_length, 'comment' => $display_comment, 'rand' => $rand, 'entity_restrict' => $entity_restrict, 'devtype' => $devtype);
     $default = "<select name='{$myname}'><option value='{$value}'>{$name}</option></select>";
     ajaxDropdown($use_ajax, "/ajax/dropdownNetpoint.php", $params, $default, $rand);
     // Display comment
     if ($display_comment) {
         showToolTip($comment);
         $item = new Netpoint();
         if ($item->canCreate()) {
             echo "<img alt='' title=\"" . $LANG['buttons'][8] . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;' " . "onClick=\"var w = window.open('" . $item->getFormURL() . "?popup=1&amp;rand={$rand}' ,'glpipopup', 'height=400, " . "width=1000, top=100, left=100, scrollbars=yes' );w.focus();\">";
         }
     }
     return $rand;
 }