From: hickert Date: Thu, 8 Jun 2006 04:50:05 +0000 (+0000) Subject: The setStatus function expects that the service was already saved. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b01864fc658d3b612b7e3ec9dde552087c4196d0;p=gosa.git The setStatus function expects that the service was already saved. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3687 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/plugins/admin/systems/class_goCupsServer.inc b/plugins/admin/systems/class_goCupsServer.inc index c926db6e1..8d3c0065f 100644 --- a/plugins/admin/systems/class_goCupsServer.inc +++ b/plugins/admin/systems/class_goCupsServer.inc @@ -90,29 +90,25 @@ class goCupsServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $attrs =array(); + $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goCupsServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goCupsServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } - + function check() { $message = plugin::check(); diff --git a/plugins/admin/systems/class_goFaxServer.inc b/plugins/admin/systems/class_goFaxServer.inc index ff8805b10..2fec55259 100644 --- a/plugins/admin/systems/class_goFaxServer.inc +++ b/plugins/admin/systems/class_goFaxServer.inc @@ -92,38 +92,22 @@ class goFaxServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goFaxAdmin", "goFaxPassword")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goFaxAdmin", "goFaxPassword") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goFaxServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goFaxServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } diff --git a/plugins/admin/systems/class_goFonServer.inc b/plugins/admin/systems/class_goFonServer.inc index adb0d55f8..cdb123bde 100644 --- a/plugins/admin/systems/class_goFonServer.inc +++ b/plugins/admin/systems/class_goFonServer.inc @@ -95,41 +95,25 @@ class goFonServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goFonAdmin", "goFonAreaCode", "goFonCountryCode","goFonPassword")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goFonAdmin", "goFonAreaCode", "goFonCountryCode","goFonPassword") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goFonServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goFonServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } - + function check() { $message = plugin::check(); diff --git a/plugins/admin/systems/class_goGlpiServer.inc b/plugins/admin/systems/class_goGlpiServer.inc index 36caf5c92..ce7569dfe 100644 --- a/plugins/admin/systems/class_goGlpiServer.inc +++ b/plugins/admin/systems/class_goGlpiServer.inc @@ -94,38 +94,22 @@ class goGlpiServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goGlpiAdmin","goGlpiDatabase")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goGlpiAdmin","goGlpiDatabase") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goGlpiServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goGlpiServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } diff --git a/plugins/admin/systems/class_goImapServer.inc b/plugins/admin/systems/class_goImapServer.inc index 301a2dd87..56d658bab 100644 --- a/plugins/admin/systems/class_goImapServer.inc +++ b/plugins/admin/systems/class_goImapServer.inc @@ -72,6 +72,7 @@ class goImapServer extends plugin{ } $smarty->assign("Actions",$this->Actions); $smarty->assign("is_new",$this->dn); + $smarty->assign("is_acc",$this->initially_was_account); return($smarty->fetch(get_template_path("goImapServer.tpl",TRUE,dirname(__FILE__)))); } @@ -126,33 +127,16 @@ class goImapServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goImapName","goImapConnect","goImapAdmin","goImapPassword")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goImapName","goImapConnect","goImapAdmin","goImapPassword") as $required){ - if(!isset($attrs[$required])){ - if(empty($this->$required)){ - print_red(_("Can't set new status while there are blank option within generic configuration part.")); - return; - }else{ - $attrs[$required] = $this->$required; - } - }else{ - $attrs[$required] = $attrs[$required][0]; - } - } - $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; } - if(!in_array("goImapServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goImapServer"; - } $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; diff --git a/plugins/admin/systems/class_goKrbServer.inc b/plugins/admin/systems/class_goKrbServer.inc index ca2bc66f5..34dd98309 100644 --- a/plugins/admin/systems/class_goKrbServer.inc +++ b/plugins/admin/systems/class_goKrbServer.inc @@ -93,41 +93,25 @@ class goKrbServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goKrbRealm","goKrbAdmin","goKrbPassword")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goKrbRealm","goKrbAdmin","goKrbPassword") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goKrbServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goKrbServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } - - + + function check() { $message = plugin::check(); diff --git a/plugins/admin/systems/class_goLdapServer.inc b/plugins/admin/systems/class_goLdapServer.inc index f5a284882..885970ac0 100644 --- a/plugins/admin/systems/class_goLdapServer.inc +++ b/plugins/admin/systems/class_goLdapServer.inc @@ -91,38 +91,22 @@ class goLdapServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goLdapBase")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goLdapBase") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goLdapServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goLdapServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } diff --git a/plugins/admin/systems/class_goLogDBServer.inc b/plugins/admin/systems/class_goLogDBServer.inc index a85705009..47d132b19 100644 --- a/plugins/admin/systems/class_goLogDBServer.inc +++ b/plugins/admin/systems/class_goLogDBServer.inc @@ -93,41 +93,25 @@ class goLogDBServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goLogAdmin","goLogPassword")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goLogAdmin","goLogPassword") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goLogDBServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goLogDBServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } - + function check() { $message = plugin::check(); diff --git a/plugins/admin/systems/class_goMailServer.inc b/plugins/admin/systems/class_goMailServer.inc index 8afd4dda0..701428b02 100644 --- a/plugins/admin/systems/class_goMailServer.inc +++ b/plugins/admin/systems/class_goMailServer.inc @@ -46,8 +46,7 @@ class goMailServer extends plugin{ $this->Actions = array( SERVICE_STOPPED=>SERVICE_STOPPED, SERVICE_STARTED => SERVICE_STARTED, - SERVICE_RESTARTED=>SERVICE_RESTARTED, - "mailqueue"=>"mailqueue"); + SERVICE_RESTARTED=>SERVICE_RESTARTED); /* Fill RestrictionFilters TransportProtocols from external hooks */ $str = $this->config->data['TABS']['SERVERSERVICE']; @@ -426,6 +425,7 @@ class goMailServer extends plugin{ $smarty->assign("is_new", $this->dn); + $smarty->assign("is_acc", $this->initially_was_account); $smarty->assign("TransportProtocols", $this->TransportProtocols); $smarty->assign("Actions", $this->Actions); $smarty->assign("RestrictionFilters", $this->RestrictionFilters); @@ -573,21 +573,16 @@ class goMailServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $attrs =array(); $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; } - if(!in_array("goMailServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goMailServer"; - } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; diff --git a/plugins/admin/systems/class_goNtpServer.inc b/plugins/admin/systems/class_goNtpServer.inc index 9188acf3f..fa6e11c07 100644 --- a/plugins/admin/systems/class_goNtpServer.inc +++ b/plugins/admin/systems/class_goNtpServer.inc @@ -118,28 +118,25 @@ class goNtpServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $attrs =array(); + $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goNtpServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goNtpServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } - + + function check(){ return array();} function save_object(){;} diff --git a/plugins/admin/systems/class_goShareServer.inc b/plugins/admin/systems/class_goShareServer.inc index 7911dcb0e..3a00600e6 100644 --- a/plugins/admin/systems/class_goShareServer.inc +++ b/plugins/admin/systems/class_goShareServer.inc @@ -208,38 +208,22 @@ class goShareServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $attrs =array(); - foreach(array() as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goShareServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goShareServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } diff --git a/plugins/admin/systems/class_goSyslogServer.inc b/plugins/admin/systems/class_goSyslogServer.inc index f3481a47c..7bb179adf 100644 --- a/plugins/admin/systems/class_goSyslogServer.inc +++ b/plugins/admin/systems/class_goSyslogServer.inc @@ -90,29 +90,25 @@ class goSyslogServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); $ldap->cat($this->dn,array("objectClass")); - if($ldap->count()){ - $attrs =array(); + $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goSyslogServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goSyslogServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } - + function check() { $message = plugin::check(); diff --git a/plugins/admin/systems/class_goTerminalServer.inc b/plugins/admin/systems/class_goTerminalServer.inc index a9d2d5963..48f01b4f7 100644 --- a/plugins/admin/systems/class_goTerminalServer.inc +++ b/plugins/admin/systems/class_goTerminalServer.inc @@ -93,41 +93,25 @@ class goTerminalServer extends plugin{ function setStatus($value) { if($value == "none") return; + if(!$this->initially_was_account) return; $ldap = $this->config->get_ldap_link(); $ldap->cd($this->dn); - $ldap->cat($this->dn,array("objectClass","goXdmcpIsEnabled", "goFontPath")); - + $ldap->cat($this->dn,array("objectClass")); if($ldap->count()){ - $attrs =array(); - foreach(array("goXdmcpIsEnabled", "goFontPath") as $req) { - if(!isset($attrs[$req])){ - if(empty($this->$req)){ - print_red(sprintf(_("The required attribute '%s' is not set."),$req)); - }else{ - $attrs[$req] = $this->$req; - } - }else{ - $attrs[$req] = $attrs[$req][0]; - } - } $tmp = $ldap->fetch(); for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ $attrs['objectClass'][] = $tmp['objectClass'][$i]; - } - if(!in_array("goTerminalServer",$attrs['objectClass'])){ - $attrs['objectClass'][] = "goTerminalServer"; } - $flag = $this->StatusFlag; $attrs[$flag] = $value; $this->$flag = $value; $ldap->modify($attrs); show_ldap_error($ldap->get_error()); - } + } } - + function check() { $message = plugin::check(); diff --git a/plugins/admin/systems/goImapServer.tpl b/plugins/admin/systems/goImapServer.tpl index 6c2e1fce9..8381540be 100644 --- a/plugins/admin/systems/goImapServer.tpl +++ b/plugins/admin/systems/goImapServer.tpl @@ -71,16 +71,22 @@

 


+

Action

{if $is_new == "new"} {t}The server must be saved before you can use the status flag.{/t} +{elseif !$is_acc} + {t}The service must be saved before you can use the status flag.{/t} {/if}
-

Action

- {html_options options=$Actions} - +

 

diff --git a/plugins/admin/systems/goMailServer.tpl b/plugins/admin/systems/goMailServer.tpl index a53e0a83d..edd533f20 100644 --- a/plugins/admin/systems/goMailServer.tpl +++ b/plugins/admin/systems/goMailServer.tpl @@ -144,16 +144,22 @@

 


+

Action

{if $is_new == "new"} {t}The server must be saved before you can use the status flag.{/t} +{elseif !$is_acc} + {t}The service must be saved before you can use the status flag.{/t} {/if}
-

Action

- {html_options options=$Actions} - +