From 7f5f0019c19fc961abd590ec443d5244825c2930 Mon Sep 17 00:00:00 2001 From: cajus Date: Thu, 21 Feb 2008 07:24:41 +0000 Subject: [PATCH] Removed a couple of print_red calls Enabled unit tagging git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8998 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/ihtml/themes/default/msg_dialog.tpl | 30 ++-- gosa-core/include/class_config.inc | 2 +- gosa-core/include/class_hostActionQueue.inc | 1 + .../plugins/admin/acl/class_aclManagement.inc | 12 +- gosa-core/plugins/admin/acl/class_aclRole.inc | 2 +- .../departments/class_departmentGeneric.inc | 131 ++++++++---------- .../plugins/admin/departments/generic.tpl | 9 -- 7 files changed, 79 insertions(+), 108 deletions(-) diff --git a/gosa-core/ihtml/themes/default/msg_dialog.tpl b/gosa-core/ihtml/themes/default/msg_dialog.tpl index 1929f8863..c0251705b 100644 --- a/gosa-core/ihtml/themes/default/msg_dialog.tpl +++ b/gosa-core/ihtml/themes/default/msg_dialog.tpl @@ -50,12 +50,7 @@
-   {$s_Title} -
-
- - -
+ + +
{if $i_Type == ERROR_DIALOG} {t}Error{/t} {elseif $i_Type == WARNING_DIALOG} @@ -63,7 +58,12 @@ {elseif $i_Type == INFO_DIALOG || $i_Type == CONFIRM_DIALOG} {t}Information{/t} {/if} - {$s_Title}
+ +
+ +
{$s_Message}
@@ -95,13 +95,7 @@
-   {$s_Title} -
-
- - - -
+ + +
{if $i_Type == ERROR_DIALOG} {t}Error{/t} {elseif $i_Type == WARNING_DIALOG} @@ -109,7 +103,13 @@ {elseif $i_Type == INFO_DIALOG || $i_Type == CONFIRM_DIALOG} {t}Information{/t} {/if} - {$s_Title}
+ +
+ + +
{$s_Message}
diff --git a/gosa-core/include/class_config.inc b/gosa-core/include/class_config.inc index 69ee3f909..a1c386f82 100644 --- a/gosa-core/include/class_config.inc +++ b/gosa-core/include/class_config.inc @@ -221,7 +221,7 @@ class config { /* Check for connection */ if (is_null($this->ldap) || (is_int($this->ldap) && $this->ldap == 0)){ $smarty= get_smarty(); - msg_dialog::display(_("LDAP error"), _("Can't bind to LDAP. Please contact the system administrator."), FATAL_ERROR_DIALOG); + msg_dialog::display(_("LDAP error"), _("Cannot bind to LDAP. Please contact the system administrator."), FATAL_ERROR_DIALOG); exit(); } diff --git a/gosa-core/include/class_hostActionQueue.inc b/gosa-core/include/class_hostActionQueue.inc index c32be66ae..c21ebfd76 100644 --- a/gosa-core/include/class_hostActionQueue.inc +++ b/gosa-core/include/class_hostActionQueue.inc @@ -140,6 +140,7 @@ class hostActionQueue { if(count($parts) != 10){ print_red(_("Entry broken, skipped.")); + msg_dialog::display(_("GOsa infrastructure"), _("Cannot read broken entry - skipped!"), WARNING_DIALOG); }else{ $entry = array(); diff --git a/gosa-core/plugins/admin/acl/class_aclManagement.inc b/gosa-core/plugins/admin/acl/class_aclManagement.inc index d924c5998..299cbd2e8 100644 --- a/gosa-core/plugins/admin/acl/class_aclManagement.inc +++ b/gosa-core/plugins/admin/acl/class_aclManagement.inc @@ -157,7 +157,7 @@ class aclManagement extends plugin $this->acltabs= new aclroletab($this->config, NULL,$this->dn); $this->acltabs->set_acl_base($this->DivListACL->selectedBase); }else{ - print_red(_("You are not allowed to create a new role.")); + msg_dialog::display(_("Permission error"), _("You have no permissions to create a new role!"), ERROR_DIALOG); } } @@ -194,7 +194,7 @@ class aclManagement extends plugin /* Set ACL and move DN to the headline */ session::set('objectinfo',$this->dn); }else{ - print_red(_("You are not allowed to edit this acl.")); + msg_dialog::display(_("Permission error"), _("You have no permissions to edit this ACL!"), ERROR_DIALOG); } } @@ -247,7 +247,7 @@ class aclManagement extends plugin /* Obviously the acl isn't allowed to delete. Show message and clean session. */ - print_red (_("You are not allowed to delete this acl!")); + msg_dialog::display(_("Permission error"), _("You have no permissions to delete this ACL!"), ERROR_DIALOG); } } @@ -271,7 +271,7 @@ class aclManagement extends plugin /* Normally this shouldn't be reached, send some extra logs to notify the administrator */ - print_red (_("You are not allowed to delete this acl role!")); + msg_dialog::display(_("Permission error"), _("You have no permissions to delete this role!"), ERROR_DIALOG); if(isset($this->ui->uid)){ new log("security","aclroles/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick acl role deletion."); @@ -310,7 +310,7 @@ class aclManagement extends plugin /* Obviously the acl isn't allowed to delete. Show message and clean session. */ - print_red (_("You are not allowed to delete this acl!")); + msg_dialog::display(_("Permission error"), _("You have no permissions to delete this ACL!"), ERROR_DIALOG); } } @@ -334,7 +334,7 @@ class aclManagement extends plugin /* Normally this shouldn't be reached, send some extra logs to notify the administrator */ - print_red (_("You are not allowed to delete this acl!")); + msg_dialog::display(_("Permission error"), _("You have no permissions to delete this ACL!"), ERROR_DIALOG); if(isset($this->ui->uid)){ new log("security","aclroles/".get_class($this),$this->dn,array(),"Warning: '".$this->ui->uid."' tried to trick acl role deletion."); diff --git a/gosa-core/plugins/admin/acl/class_aclRole.inc b/gosa-core/plugins/admin/acl/class_aclRole.inc index 01581ab9b..5939a5b38 100644 --- a/gosa-core/plugins/admin/acl/class_aclRole.inc +++ b/gosa-core/plugins/admin/acl/class_aclRole.inc @@ -593,7 +593,7 @@ class aclrole extends acl $all_names .= ", ..."; } $all_names = "".$all_names.""; - print_red(sprintf(_("This role can't be removed while it is in use. Follwing objects are using this role %s"),$all_names)); + msg_dialog::display(_("Object in use"), sprintf(_("This role cannot be removed while it is in use by these objects:")."

%s", $all_names), WARNING_DIALOG); return; } diff --git a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc index 03cedf2dc..a6e443d08 100644 --- a/gosa-core/plugins/admin/departments/class_departmentGeneric.inc +++ b/gosa-core/plugins/admin/departments/class_departmentGeneric.inc @@ -50,13 +50,6 @@ class department extends plugin var $objectclasses= array("top", "gosaDepartment", "organizationalUnit"); var $initially_was_tagged = false; - - /* Temporary disable the Unit Tag functionalityi. - This is not used anymore, cause of the new acl implementation. - Setting this to TRUE will disable - all POST / GET activity, "Department tagging" and the checkbox within the generic template. - */ - var $UnitTagDiabled = TRUE; var $orig_base = ""; var $orig_ou = ""; @@ -166,13 +159,10 @@ class department extends plugin $smarty->assign("base_select", $this->base); /* Set admin unit flag */ - $smarty->assign("UnitTagDiabled",$this->UnitTagDiabled); - if(!$this->UnitTagDiabled){ - if ($this->is_administrational_unit) { - $smarty->assign("unitTag", "checked"); - } else { - $smarty->assign("unitTag", ""); - } + if ($this->is_administrational_unit) { + $smarty->assign("unitTag", "checked"); + } else { + $smarty->assign("unitTag", ""); } return($smarty->fetch (get_template_path('generic.tpl', TRUE))); @@ -232,13 +222,11 @@ class department extends plugin } /* Save tagging flag */ - if(!$this->UnitTagDiabled){ - if ($this->acl_is_writeable("unitTag")){ - if (isset($_POST['unitTag'])){ - $this->is_administrational_unit= true; - } else { - $this->is_administrational_unit= false; - } + if ($this->acl_is_writeable("unitTag")){ + if (isset($_POST['unitTag'])){ + $this->is_administrational_unit= true; + } else { + $this->is_administrational_unit= false; } } } @@ -291,70 +279,64 @@ class department extends plugin { $ldap= $this->config->get_ldap_link(); - if(!$this->UnitTagDiabled){ + /* Add tag objects if needed */ + if ($this->is_administrational_unit){ - /* Add tag objects if needed */ - if ($this->is_administrational_unit){ + /* If this wasn't tagged before add oc an reset unit tag */ + if(!$this->initially_was_tagged){ + $this->objectclasses[]= "gosaAdministrativeUnit"; + $this->gosaUnitTag= ""; - /* If this wasn't tagged before add oc an reset unit tag */ - if(!$this->initially_was_tagged){ - $this->objectclasses[]= "gosaAdministrativeUnit"; - $this->gosaUnitTag= ""; - - /* It seams that this method is called twice, - set this to true. to avoid adding this oc twice */ - $this->initially_was_tagged = true; - } + /* It seams that this method is called twice, + set this to true. to avoid adding this oc twice */ + $this->initially_was_tagged = true; + } - if ($this->gosaUnitTag == ""){ + if ($this->gosaUnitTag == ""){ - /* It's unlikely, but check if already used... */ - $try= 5; - $ldap->cd($this->config->current['BASE']); - while ($try--){ + /* It's unlikely, but check if already used... */ + $try= 5; + $ldap->cd($this->config->current['BASE']); + while ($try--){ - /* Generate microtime stamp as tag */ - list($usec, $sec)= explode(" ", microtime()); - $time_stamp= preg_replace("/\./", "", $sec.$usec); + /* Generate microtime stamp as tag */ + list($usec, $sec)= explode(" ", microtime()); + $time_stamp= preg_replace("/\./", "", $sec.$usec); - $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag")); - if ($ldap->count() == 0){ - break; - } - } - if($try == 0) { - print_red(_("Fatal error: Can't find an unused tag to mark the administrative unit!")); - return; + $ldap->search("(&(objectClass=gosaAdministrativeUnit)(gosaUnitTag=$time_stamp))",array("gosaUnitTag")); + if ($ldap->count() == 0){ + break; } - $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec); } + if($try == 0) { + msg_dialog::display(_("Fatal error"), _("Cannot find an unused tag for this administrative unit!"), WARNING_DIALOG); + return; + } + $this->gosaUnitTag= preg_replace("/\./", "", $sec.$usec); } } - plugin::save(); - - if(!$this->UnitTagDiabled){ + plugin::save(); - /* Remove tag information if needed */ - if (!$this->is_administrational_unit){ - $tmp= array(); + /* Remove tag information if needed */ + if (!$this->is_administrational_unit){ + $tmp= array(); - /* Remove gosaAdministrativeUnit from this plugin */ - $has_unit_tag= false; - foreach($this->attrs['objectClass'] as $oc){ - if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){ - $tmp[]= $oc; - } - if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){ - $has_unit_tag= true; - } + /* Remove gosaAdministrativeUnit from this plugin */ + $has_unit_tag= false; + foreach($this->attrs['objectClass'] as $oc){ + if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){ + $tmp[]= $oc; } - $this->attrs['objectClass']= $tmp; - - if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){ - $this->attrs['gosaUnitTag']= array(); + if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){ + $has_unit_tag= true; } - $this->gosaUnitTag = ""; } + $this->attrs['objectClass']= $tmp; + + if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){ + $this->attrs['gosaUnitTag']= array(); + } + $this->gosaUnitTag = ""; } /* Write back to ldap */ @@ -375,12 +357,9 @@ class department extends plugin } show_ldap_error($ldap->get_error(), sprintf(_("Saving of department with dn '%s' failed."),$this->dn)); - - if(!$this->UnitTagDiabled){ - /* The parameter forces only to set must_be_tagged, and don't touch any objects - This will be done later */ - $this->tag_objects(true); - } + /* The parameter forces only to set must_be_tagged, and don't touch any objects + This will be done later */ + $this->tag_objects(true); /* Optionally execute a command after we're done */ $this->postcreate(); diff --git a/gosa-core/plugins/admin/departments/generic.tpl b/gosa-core/plugins/admin/departments/generic.tpl index 7e353be8c..a743aeb34 100644 --- a/gosa-core/plugins/admin/departments/generic.tpl +++ b/gosa-core/plugins/admin/departments/generic.tpl @@ -101,14 +101,6 @@
- -{if !$UnitTagDiabled} - - -

 

@@ -122,7 +114,6 @@ Its functionality is disabled in class_departmentGeneric.inc
-{/if}