/**
  * Print the mailgate form
  *
  * @param $ID Integer : Id of the item to print
  * @param $options array
  *     - target filename : where to go when done.
  *
  * @return boolean item found
  **/
 function showForm($ID, $options = array())
 {
     global $CFG_GLPI, $LANG;
     if (!haveRight("config", "r")) {
         return false;
     }
     if ($ID > 0) {
         $this->check($ID, 'r');
     } else {
         // Create item
         $this->check(-1, 'w');
     }
     $options['colspan'] = 1;
     $this->showTabs($options);
     $this->showFormHeader($options);
     if (!function_exists('mb_list_encodings') || !function_exists('mb_convert_encoding')) {
         echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['mailgate'][4] . "</td></tr>";
     }
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . " (" . $LANG['mailing'][111] . ")&nbsp;:</td><td>";
     autocompletionTextField($this, "name");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][60] . "&nbsp;:</td><td>";
     Dropdown::showYesNo("is_active", $this->fields["is_active"]);
     echo "</td></tr>";
     showMailServerConfig($this->fields["host"]);
     echo "<tr class='tab_bg_1'><td>" . $LANG['login'][6] . "&nbsp;:</td><td>";
     autocompletionTextField($this, "login");
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['login'][7] . "&nbsp;:</td>";
     echo "<td><input type='password' name='passwd' value='' size='20' autocomplete='off'></td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td width='200px'> " . $LANG['mailgate'][7] . "&nbsp;:</td><td>";
     self::showMaxFilesize('filesize_max', $this->fields["filesize_max"]);
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'><td>" . $LANG['common'][25] . "&nbsp;:</td>";
     echo "<td><textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
     if ($ID > 0) {
         echo "<br>" . $LANG['common'][26] . "&nbsp;: " . convDateTime($this->fields["date_mod"]);
     }
     echo "</td></tr>";
     $this->showFormButtons($options);
     $this->addDivForTabs();
     return true;
 }
Пример #2
0
 /**
  * Print the auth mail form
  *
  * @param $ID Integer : ID of the item
  * @param $options array
  *
  * @return Nothing (display)
  **/
 function showForm($ID, $options = array())
 {
     global $LANG;
     if (!haveRight("config", "w")) {
         return false;
     }
     $spotted = false;
     if (empty($ID)) {
         if ($this->getEmpty()) {
             $spotted = true;
         }
     } else {
         if ($this->getFromDB($ID)) {
             $spotted = true;
         }
     }
     if (canUseImapPop()) {
         $options['colspan'] = 1;
         $this->showTabs($options);
         $this->showFormHeader($options);
         echo "<tr class='tab_bg_1'><td>" . $LANG['common'][16] . "&nbsp;:</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>" . $LANG['common'][60] . "&nbsp;:</td>";
         echo "<td colspan='3'>";
         Dropdown::showYesNo('is_active', $this->fields['is_active']);
         echo "</td></tr>";
         echo "<tr class='tab_bg_1'><td>" . $LANG['setup'][164] . "&nbsp;:</td>";
         echo "<td><input size='30' type='text' name='host' value='" . $this->fields["host"] . "'>";
         echo "</td></tr>";
         showMailServerConfig($this->fields["connect_string"]);
         echo "<tr class='tab_bg_1'><td>" . $LANG['common'][25] . "&nbsp;:</td>";
         echo "<td>";
         echo "<textarea cols='40' rows='4' name='comment'>" . $this->fields["comment"] . "</textarea>";
         if ($ID > 0) {
             echo "<br>" . $LANG['common'][26] . "&nbsp;: " . convDateTime($this->fields["date_mod"]);
         }
         echo "</td></tr>";
         $this->showFormButtons($options);
         $this->addDivForTabs();
     } else {
         echo "<div class='center'>&nbsp;<table class='tab_cadre_fixe'>";
         echo "<tr><th colspan='2'>" . $LANG['setup'][162] . "</th></tr>";
         echo "<tr class='tab_bg_2'><td class='center'>";
         echo "<p class='red'>" . $LANG['setup'][165] . "</p>";
         echo "<p>" . $LANG['setup'][166] . "</p></td></tr></table></div>";
     }
 }