From: cajus Date: Sun, 14 May 2006 16:08:13 +0000 (+0000) Subject: Updated show_ldap_error X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d1a1f67066cf07616d37a1b3cd983082d0028f2f;p=gosa.git Updated show_ldap_error git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3322 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/TODO b/TODO index 77b0a6736..12a409d67 100644 --- a/TODO +++ b/TODO @@ -34,7 +34,8 @@ Now: * evaluate what effects a ldap->cat(..., $this->attributes) will have to other plugins in class_plugin.inc * Changing LDAP-Servers -> start tab! Actions? -* finish show_ldap_error() extension +* Redo print_red(). Just show the first error, redesign it. +* Base-chooser geht nicht mehr Target for 2.5: diff --git a/include/functions.inc b/include/functions.inc index 4c4103965..571f5edc6 100644 --- a/include/functions.inc +++ b/include/functions.inc @@ -988,6 +988,16 @@ function print_red() } +#Test +if (!preg_match('/[.!?]$/', $string)){ + $string.= "."; +} +$_SESSION['errors'].= "
". +"". +"". +"

"._("An error occured while checking the formular input")."

". +"$string "._("Please check your input and fix the contents of the highlighted field. Pess 'OK' to close this message box.")."

"; + } else { echo "Error: $string\n"; } diff --git a/plugins/admin/ogroups/class_mailogroup.inc b/plugins/admin/ogroups/class_mailogroup.inc index f3eacafb0..9dc1cf71c 100644 --- a/plugins/admin/ogroups/class_mailogroup.inc +++ b/plugins/admin/ogroups/class_mailogroup.inc @@ -93,9 +93,9 @@ class mailogroup extends plugin /* Save data to LDAP */ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving mail objectgroup settings failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ @@ -126,9 +126,9 @@ $ldap->modify ($this->attrs); $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing mail objectgroup settings failed")); } diff --git a/plugins/admin/ogroups/class_ogroup.inc b/plugins/admin/ogroups/class_ogroup.inc index 6e6004fba..461002c82 100644 --- a/plugins/admin/ogroups/class_ogroup.inc +++ b/plugins/admin/ogroups/class_ogroup.inc @@ -712,7 +712,7 @@ class ogroup extends plugin $this->handle_post_events($mode); $ret= 0; - if (show_ldap_error($ldap->get_error())){ + if (show_ldap_error($ldap->get_error(), _("Saving object group failed"))){ $ret= 1; } @@ -725,7 +725,7 @@ class ogroup extends plugin $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing object group failed")); /* Trigger remove signal */ $this->handle_post_events("remove"); diff --git a/plugins/admin/ogroups/class_phonequeue.inc b/plugins/admin/ogroups/class_phonequeue.inc index 27c4e21a9..827d2ad8a 100644 --- a/plugins/admin/ogroups/class_phonequeue.inc +++ b/plugins/admin/ogroups/class_phonequeue.inc @@ -582,10 +582,9 @@ class phonequeue extends plugin /* Save data to LDAP */ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving phone queue failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ @@ -680,9 +679,9 @@ $ldap->modify ($this->attrs); $this->attributes, "Save"); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing phone queue failed")); } diff --git a/plugins/admin/systems/class_componentGeneric.inc b/plugins/admin/systems/class_componentGeneric.inc index fbd5412c3..ff0aa7d81 100644 --- a/plugins/admin/systems/class_componentGeneric.inc +++ b/plugins/admin/systems/class_componentGeneric.inc @@ -97,7 +97,7 @@ class componentGeneric extends plugin $ldap= $this->config->get_ldap_link(); $this->netConfigDNS->remove_from_parent(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing generic component failed")); $this->handle_post_events("remove"); /* Delete references to object groups */ @@ -219,7 +219,7 @@ class componentGeneric extends plugin $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving generic component failed")); /* Optionally execute a command after we're done */ $this->postcreate(); diff --git a/plugins/admin/systems/class_phoneGeneric.inc b/plugins/admin/systems/class_phoneGeneric.inc index 6186d366b..9e602ba28 100644 --- a/plugins/admin/systems/class_phoneGeneric.inc +++ b/plugins/admin/systems/class_phoneGeneric.inc @@ -243,7 +243,7 @@ class phoneGeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing phone failed")); $this->handle_post_events("remove"); /* Delete references to object groups */ @@ -393,8 +393,8 @@ class phoneGeneric extends plugin } $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); + show_ldap_error($ldap->get_error(), _("Saving phone failed")); - show_ldap_error($ldap->get_error()); /* Optionally execute a command after we're done */ $this->postcreate(); } diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 420295407..678c6d834 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -549,7 +549,7 @@ class printgeneric extends plugin /* Remove account & dns extension */ $this->netConfigDNS->remove_from_parent(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing printer failed")); $this->handle_post_events("remove"); /* Delete references to object groups */ @@ -726,7 +726,7 @@ class printgeneric extends plugin $this->handle_post_events("modify"); } - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving printer failed")); $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->dn = $this->dn; diff --git a/plugins/admin/systems/class_servDB.inc b/plugins/admin/systems/class_servDB.inc index 6ceef64e6..6d4e25bc7 100644 --- a/plugins/admin/systems/class_servDB.inc +++ b/plugins/admin/systems/class_servDB.inc @@ -240,9 +240,9 @@ class servdb extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving server db settings failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ diff --git a/plugins/admin/systems/class_servDNS.inc b/plugins/admin/systems/class_servDNS.inc index f2864d790..9bc83feef 100644 --- a/plugins/admin/systems/class_servDNS.inc +++ b/plugins/admin/systems/class_servDNS.inc @@ -258,7 +258,7 @@ class servdns extends plugin $ldap->cd($attr['dn']); $ldap->rmDir($attr['dn']); } - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing DNS service failed")); } @@ -279,7 +279,7 @@ class servdns extends plugin foreach($tmp['zoneUpdates'] as $dn => $attrs){ $ldap->cd($dn); $ldap->modify($attrs); - show_ldap_error("Zone:".$ldap->get_error()); + show_ldap_error("Zone:".$ldap->get_error(), _("Updating DNS service failed")); } } @@ -288,7 +288,7 @@ class servdns extends plugin foreach($tmp['del'] as $dn => $del){ $ldap->cd($dn); $ldap->rmdir_recursive($dn); - show_ldap_error("Zone:".$ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing DNS entries failed")); } /* move follwoing entries @@ -309,6 +309,7 @@ class servdns extends plugin $ldap->cd($dn); $ldap->add($attrs); } + show_ldap_error($ldap->get_error(), _("Saving DNS entries failed")); } } } diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc index a969b4440..7679c72e2 100644 --- a/plugins/admin/systems/class_servGeneric.inc +++ b/plugins/admin/systems/class_servGeneric.inc @@ -168,7 +168,7 @@ class servgeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing server failed")); /* Delete references to object groups */ $ldap->cd ($this->config->current['BASE']); @@ -276,13 +276,13 @@ class servgeneric extends plugin $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); $mode= "modify"; } $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving server failed")); /* Optionally execute a command after we're done */ $this->handle_post_events($mode); diff --git a/plugins/admin/systems/class_servKolab.inc b/plugins/admin/systems/class_servKolab.inc index d8359c056..c124abfaa 100644 --- a/plugins/admin/systems/class_servKolab.inc +++ b/plugins/admin/systems/class_servKolab.inc @@ -171,7 +171,7 @@ class servkolab extends plugin { /* Remove complete entry */ $ldap->rmdir ($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing kolab host entry failed")); } else { @@ -186,9 +186,9 @@ class servkolab extends plugin { $attrs= array('kolabHost' => $hosts); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($attrs); + $ldap->modify ($attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing server from kolab object failed")); } /* Optionally execute a command after we're done */ @@ -317,7 +317,7 @@ $ldap->modify ($attrs); $ldap->cd($this->dn); $this->cleanup();; $ldap->$mode($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving server to kolab object failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account) { diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc index 4c18c49e2..2c9f9381e 100644 --- a/plugins/admin/systems/class_servService.inc +++ b/plugins/admin/systems/class_servService.inc @@ -376,7 +376,7 @@ class servservice extends plugin $this->cleanup(); $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving server service object failed")); /* Optionally execute a command after we're done */ if ($this->initially_was_account == $this->is_account){ @@ -407,7 +407,7 @@ class servservice extends plugin if (count($attrs) == 0) { $ldap->cd($mountsdn); $ldap->add($mounts); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Creating mount container failed")); gosa_log("Mount container '$mountsdn' has been created"); } @@ -421,7 +421,7 @@ class servservice extends plugin if (count($attrs) != 0) { $ldap->rmdir($mountdn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing mount container failed")); gosa_log("Mount object '".$mountdn."' has been removed"); } } @@ -433,7 +433,7 @@ class servservice extends plugin $mountdn = "cn=".$mount["cn"].","."$mountsdn"; $ldap->cd($mountdn); $ldap->add($mount); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving mount container failed")); gosa_log("Mount object '".$mountdn."' has been added"); } } diff --git a/plugins/admin/systems/class_termDNS.inc b/plugins/admin/systems/class_termDNS.inc index d282fe08a..9c2ef6fc8 100644 --- a/plugins/admin/systems/class_termDNS.inc +++ b/plugins/admin/systems/class_termDNS.inc @@ -197,6 +197,7 @@ class termDNS extends plugin while($attr = $ldap->fetch()){ $ldap->cd($attr['dn']); $ldap->rmDir($attr['dn']); + show_ldap_error("Record:".$ldap->get_error(), _("Removing terminal from DNS object failed")); } */ } @@ -411,7 +412,7 @@ class termDNS extends plugin /* Display errors */ if($ldap->get_error() != "Success"){ - show_ldap_error("Record:".$ldap->get_error()); + show_ldap_error("Record:".$ldap->get_error(), _("Saving terminal to DNS object failed")); } } } diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index ae91f5f28..3e16aabb1 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -263,7 +263,7 @@ class termgeneric extends plugin if($ldap->count()){ $this->netConfigDNS->remove_from_parent(); $ldap->rmDir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing terminal failed")); /* Optionally execute a command after we're done */ $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress)); @@ -408,13 +408,13 @@ class termgeneric extends plugin } $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); $this->handle_post_events("modify"); } $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving terminal failed")); /* Optionally execute a command after we're done */ $this->postcreate(); diff --git a/plugins/admin/systems/class_terminalService.inc b/plugins/admin/systems/class_terminalService.inc index fe580b76e..e1c3d6f9b 100644 --- a/plugins/admin/systems/class_terminalService.inc +++ b/plugins/admin/systems/class_terminalService.inc @@ -317,9 +317,9 @@ class termservice extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving terminal service information failed")); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_terminalStartup.inc b/plugins/admin/systems/class_terminalStartup.inc index bb173ae29..589f89a78 100644 --- a/plugins/admin/systems/class_terminalStartup.inc +++ b/plugins/admin/systems/class_terminalStartup.inc @@ -351,9 +351,9 @@ class termstartup extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving terminal startup settings failed")); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc index 196a8bb7a..ffd87eb9c 100644 --- a/plugins/admin/systems/class_winGeneric.inc +++ b/plugins/admin/systems/class_winGeneric.inc @@ -123,7 +123,7 @@ class wingeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing Samba workstation failed")); $this->handle_post_events("remove"); /* Delete references to object groups */ @@ -214,14 +214,14 @@ class wingeneric extends plugin $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); $this->handle_post_events("modify"); } $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving Samba workstation failed")); /* Optionally execute a command after we're done */ $this->postcreate(); diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 409316227..1bb728ace 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -223,7 +223,7 @@ class workgeneric extends plugin $this->netConfigDNS->remove_from_parent(); $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing workstation failed")); /* Optionally execute a command after we're done */ $this->handle_post_events("remove", array("macAddress" => $this->netConfigDNS->macAddress)); @@ -367,7 +367,7 @@ class workgeneric extends plugin } $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); if(!$this->didAction){ $this->handle_post_events("modify"); @@ -375,7 +375,7 @@ $ldap->modify ($this->attrs); } $this->netConfigDNS->cn = $this->cn; $this->netConfigDNS->save($this->dn); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving workstation failed")); } } diff --git a/plugins/admin/systems/class_workstationService.inc b/plugins/admin/systems/class_workstationService.inc index 41ae7b4e6..ba1cdf865 100644 --- a/plugins/admin/systems/class_workstationService.inc +++ b/plugins/admin/systems/class_workstationService.inc @@ -319,9 +319,9 @@ class workservice extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving workstation services failed")); $this->handle_post_events("modify"); } diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index 1cf3899b0..9d5d2c5de 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -918,7 +918,7 @@ class workstartup extends plugin $this->cleanup(); $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving workstation startup settings failed")); $this->handle_post_events("modify"); } diff --git a/plugins/gofon/conference/class_phoneConferenceGeneric.inc b/plugins/gofon/conference/class_phoneConferenceGeneric.inc index 0cc291709..7b5fed530 100644 --- a/plugins/gofon/conference/class_phoneConferenceGeneric.inc +++ b/plugins/gofon/conference/class_phoneConferenceGeneric.inc @@ -479,7 +479,7 @@ class conference extends plugin $ldap->add($this->attrs); $this->handle_post_events('add'); } - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving phone conference failed")); /* Optionally execute a command after we're done */ $this->postcreate(); diff --git a/plugins/gofon/macro/class_gofonMacro.inc b/plugins/gofon/macro/class_gofonMacro.inc index 1f316f50f..9adf21534 100755 --- a/plugins/gofon/macro/class_gofonMacro.inc +++ b/plugins/gofon/macro/class_gofonMacro.inc @@ -163,6 +163,7 @@ class macro extends plugin } $ldap->rmDir($this->dn); + show_ldap_error($ldap->get_error(), _("Removing phone macro failed")); if(isset($this->orig_cn)){ $this->generate_mysql_entension_entries(false,true,$this->orig_cn); }else{ @@ -176,6 +177,7 @@ class macro extends plugin $og= new ogroup($this->config, $ldap->getDN()); unset($og->member[$this->dn]); $og->save (); + show_ldap_error($ldap->get_error(), _("Removing phone macro reverences failed")); } } @@ -413,7 +415,7 @@ class macro extends plugin if (count($a)){ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); $this->handle_post_events("modify"); } else { @@ -423,8 +425,8 @@ $ldap->modify ($this->attrs); $ldap->add($this->attrs); $this->handle_post_events("add"); } + show_ldap_error($ldap->get_error(), _("Saving phone macro failed")); } - show_ldap_error($ldap->get_error()); } } diff --git a/plugins/gofon/macro/class_gofonMacroParameters.inc b/plugins/gofon/macro/class_gofonMacroParameters.inc index a167eacbc..d9d91bef6 100755 --- a/plugins/gofon/macro/class_gofonMacroParameters.inc +++ b/plugins/gofon/macro/class_gofonMacroParameters.inc @@ -380,7 +380,7 @@ class macroParameter extends plugin if (count($a)){ $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); $this->handle_post_events("modify"); } else { @@ -393,7 +393,7 @@ $ldap->modify ($this->attrs); $ldap->add($this->attrs); $this->handle_post_events("add"); } - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving phone macro parameters failed")); } } diff --git a/plugins/gofon/phoneaccount/class_phoneAccount.inc b/plugins/gofon/phoneaccount/class_phoneAccount.inc index b0dd42be2..b38336fe9 100644 --- a/plugins/gofon/phoneaccount/class_phoneAccount.inc +++ b/plugins/gofon/phoneaccount/class_phoneAccount.inc @@ -959,9 +959,9 @@ class phoneAccount extends plugin $ldap= $this->config->get_ldap_link(); $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Saving phone account failed")); /* Optionally execute a command after we're done */ @@ -1120,9 +1120,9 @@ $ldap->modify ($this->attrs); } $ldap->cd($this->dn); $this->cleanup(); -$ldap->modify ($this->attrs); + $ldap->modify ($this->attrs); - show_ldap_error($ldap->get_error()); + show_ldap_error($ldap->get_error(), _("Removing phone account failed")); /* Optionally execute a command after we're done */ @mysql_close($r_con);