latham
2011-05-25 f99b37f56dad8e3a1f844f8d3b33ee1ba4b86d62
interface/web/dns/dns_soa_edit.php
@@ -50,6 +50,16 @@
class page_action extends tform_actions {
   
   function onShow() {
      global $app;
      //* Reset the page number of the list form for the dns
      //* records to 0 if we are on the first tab of the soa form.
      if($app->tform->getNextTab() == 'dns_soa') {
         $_SESSION['search']['dns_a']['page'] = 0;
      }
      parent::onShow();
   }
   function onShowNew() {
      global $app, $conf;
      
@@ -76,9 +86,10 @@
         $clients = $app->db->queryAllRecords($sql);
         $client_select = '';
         if($_SESSION["s"]["user"]["typ"] == 'admin') $client_select .= "<option value='0'></option>";
         $tmp_data_record = $app->tform->getDataRecord($this->id);
         if(is_array($clients)) {
            foreach( $clients as $client) {
               $selected = ($client["groupid"] == @$this->dataRecord["sys_groupid"])?'SELECTED':'';
               $selected = ($client["groupid"] == @$tmp_data_record["sys_groupid"])?'SELECTED':'';
               $client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
            }
         }
@@ -92,10 +103,12 @@
         // Fill the client select field
         $sql = "SELECT groupid, name FROM sys_group, client WHERE sys_group.client_id = client.client_id AND client.parent_client_id = ".$client['client_id']." ORDER BY name";
         $clients = $app->db->queryAllRecords($sql);
         $client_select = '<option value="'.$client['client_id'].'">'.$client['contact_name'].'</option>';
         $tmp = $app->db->queryOneRecord("SELECT groupid FROM sys_group WHERE client_id = ".$client['client_id']);
         $client_select = '<option value="'.$tmp['groupid'].'">'.$client['contact_name'].'</option>';
         $tmp_data_record = $app->tform->getDataRecord($this->id);
         if(is_array($clients)) {
            foreach( $clients as $client) {
               $selected = @($client["groupid"] == $this->dataRecord["sys_groupid"])?'SELECTED':'';
               $selected = @($client["groupid"] == $tmp_data_record["sys_groupid"])?'SELECTED':'';
               $client_select .= "<option value='$client[groupid]' $selected>$client[name]</option>\r\n";
            }
         }
@@ -151,7 +164,12 @@
      if(stristr($this->dataRecord["mbox"],'@')) {
         $this->dataRecord["mbox"] = str_replace('@','.',$this->dataRecord["mbox"]);
      }
      //* Check if a secondary zone with the same name already exists
      $tmp = $app->db->queryOneRecord("SELECT count(id) as number FROM dns_slave WHERE origin = \"".$this->dataRecord["origin"]."\" AND server_id = \"".$this->dataRecord["server_id"]."\"");
      if($tmp["number"] > 0) {
           $app->error($app->tform->wordbook["origin_error_unique"]);
      }
      parent::onSubmit();
   }
@@ -216,4 +234,4 @@
$page = new page_action;
$page->onLoad();
?>
?>