From 2738e56e22f23c43e980dea2d34a3c21baa645e9 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 1 Dec 2006 08:56:17 +0000 Subject: [PATCH] Made uniform headers. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5282 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../applications/class_divListApplication.inc | 38 +++++++++++++------ .../departments/class_divListDepartment.inc | 2 +- plugins/admin/groups/class_divListGroup.inc | 27 +++++++++---- .../mimetypes/class_divListMimeTypes.inc | 31 +++++++++++---- plugins/admin/ogroups/class_divListOGroup.inc | 27 +++++++++---- plugins/admin/systems/class_divListSystem.inc | 23 +++++++++-- plugins/admin/systems/class_printGeneric.inc | 17 +++++++++ .../admin/systems/class_printerPPDDialog.inc | 17 +++++++++ 8 files changed, 144 insertions(+), 38 deletions(-) diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc index f92e10a99..b2464b1aa 100755 --- a/plugins/admin/applications/class_divListApplication.inc +++ b/plugins/admin/applications/class_divListApplication.inc @@ -100,15 +100,20 @@ class divListApplication extends MultiSelectWindow } } - /* Get copy & paste icon */ - $ui = get_userinfo(); - $acl = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application"); - $acl_all= $ui->has_complete_category_acls($this->selectedBase,"application"); + /* Get acls */ + $ui = get_userinfo(); + $acl = $ui->get_permissions("cn=dummy,".$this->selectedBase,"application/application"); + $acl_all = $ui->has_complete_category_acls($this->selectedBase,"application"); + + /* If this is true we have to add a seperator after + adding the special icons, just have a look at the lines below */ + $add_sep = false; + /* Get copy & paste icon */ + $Copy_Paste =""; if((preg_match("/(c.*w|w.*c)/",$acl_all)) && ($this->parent->CopyPasteHandler)){ - $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); - }else{ - $Copy_Paste =""; + $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); + $add_sep = true; } /* Create listhead, it will be shown on top of the divlist. @@ -125,18 +130,29 @@ class divListApplication extends MultiSelectWindow "title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ". "  "; + /* Add snapshot header icons */ if(preg_match("/(c.*w|w.*c)/",$acl_all)){ $listhead .= $this->get_snapshot_header($this->selectedBase); + $add_sep = true; } + /* Add create icon */ if(preg_match("/c/",$acl)){ - $listhead .= "  "; + $add_sep = true; + } + + /* Add copy & paste icon */ + $listhead.= $Copy_Paste; + + /* Add a seperator if required and the list will look perfectly */ + if($add_sep){ + $listhead .= "  "; } - $listhead.= $Copy_Paste. - "  ". - _("Base")." ". + /* And the rest, a base selection box */ + $listhead .= _("Base")." ". "  ". ""; diff --git a/plugins/admin/departments/class_divListDepartment.inc b/plugins/admin/departments/class_divListDepartment.inc index 7ea33e775..712ba8790 100755 --- a/plugins/admin/departments/class_divListDepartment.inc +++ b/plugins/admin/departments/class_divListDepartment.inc @@ -102,7 +102,7 @@ class divListDepartment extends MultiSelectWindow } - $listhead .= $acl."  ". " "._("Base")." ". " get_permissions($this->selectedBase,"groups/group"); $acl_all= $ui->has_complete_category_acls($this->selectedBase,"groups"); + /* If this is true add a seperator after added c&p and snapshot icons to header */ + $addsep = false; + /* Get copy & paste icon */ + $Copy_Paste =""; if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); - }else{ - $Copy_Paste =""; + $addsep = true; } // Managment @@ -124,20 +128,29 @@ class divListGroup extends MultiSelectWindow "  ". "  "; + /* Add snapshot restore icon and force a following seperator */ if(preg_match("/(c.*w|w.*c)/",$acl_all)){ $listhead .= $this->get_snapshot_header($this->selectedBase); - }else{ - $listhead .= " "; + $addsep = true; } + /* Add Create group icon */ if(preg_match("/c/",$acls)) { $listhead.="  "; + $addsep = true; } - $listhead.= $Copy_Paste. - "  ". - _("Base")." ". + /* Assign copy & paste icons */ + $listhead.= $Copy_Paste; + + /* Append an additional seperator */ + if($addsep){ + $listhead.="  "; + } + + /* Add department selection */ + $listhead .= _("Base")." ". "  ". ""; diff --git a/plugins/admin/mimetypes/class_divListMimeTypes.inc b/plugins/admin/mimetypes/class_divListMimeTypes.inc index c538f6e94..b1fd3768e 100755 --- a/plugins/admin/mimetypes/class_divListMimeTypes.inc +++ b/plugins/admin/mimetypes/class_divListMimeTypes.inc @@ -109,15 +109,20 @@ class divListMimeTypes extends MultiSelectWindow } } - $ui = get_userinfo(); - $acl = $ui->get_permissions("cn=dummy,ou=mimetypes,".$this->selectedBase,"mimetypes/mimetype"); + /* Get acls */ + $ui = get_userinfo(); + $acl = $ui->get_permissions("cn=dummy,ou=mimetypes,".$this->selectedBase,"mimetypes/mimetype"); $acl_all = $ui->has_complete_category_acls($this->selectedBase,"mimetypes") ; + + /* If this is true we add an additional seperator. Just look a few lines below */ + $add_sep = false; + /* Get copy & paste icon */ + $Copy_Paste =""; if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); - }else{ - $Copy_Paste =""; + $add_sep = true; } /* Create listhead, it will be shown on top of the divlist. @@ -135,19 +140,29 @@ class divListMimeTypes extends MultiSelectWindow "title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ". "  "; + /* Create snapshot icons */ if(preg_match("/(c.*w|w.*c)/",$acl_all)){ $listhead .= $this->get_snapshot_header($this->selectedBase); + $add_sep = true; } + /* Add create icon */ if(preg_match("/c/",$acl)){ $listhead .= "  "; + $add_sep = true; } - $listhead .= - $Copy_Paste. - "  ". - _("Base")." ". + /* Add copy & paste icons */ + $listhead .= $Copy_Paste; + + /* Add a seperator ? */ + if($add_sep) { + $listhead .= "  "; + } + + /* And at least add a department selection box */ + $listhead .= _("Base")." ". "  ". ""; diff --git a/plugins/admin/ogroups/class_divListOGroup.inc b/plugins/admin/ogroups/class_divListOGroup.inc index 2609fda97..c661eb577 100755 --- a/plugins/admin/ogroups/class_divListOGroup.inc +++ b/plugins/admin/ogroups/class_divListOGroup.inc @@ -109,13 +109,16 @@ class divListOGroup extends MultiSelectWindow } } + /* Add a seperator after displaying c&p and snapshot icons ? */ + $add_sep = false; + /* Get copy & paste icon */ $acls = $ui->get_permissions($this->selectedBase,"ogroups/ogroup"); $acl_all= $ui->has_complete_category_acls($this->selectedBase,"ogroups"); + $Copy_Paste =""; if(preg_match("/(c.*w|w.*c)/",$acl_all) && $this->parent->CopyPasteHandler){ $Copy_Paste = $this->parent->CopyPasteHandler->generatePasteIcon(); - }else{ - $Copy_Paste =""; + $add_sep = true; } // Managment @@ -130,21 +133,29 @@ class divListOGroup extends MultiSelectWindow title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ". "  "; - + /* Add snapshot restore icons */ if(preg_match("/(c.*w|w.*c)/",$acl_all)){ $listhead .= $this->get_snapshot_header($this->selectedBase); - }else{ - $listhead .= " "; + $add_sep = true; } + /* Create new ogroup icon */ if(preg_match("/c/",$acls)) { $listhead .=" "; + $add_sep = true; } - $listhead .= $Copy_Paste. - "  ". - _("Base")." ". + /* Add copy & paste icon */ + $listhead .= $Copy_Paste; + + /* Should we add a seperator here ? */ + if($add_sep){ + $listhead .="  "; + } + + /* Add department selector */ + $listhead .= _("Base")." ". "  ". ""; diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc index d5ddeec82..d624ec0ec 100644 --- a/plugins/admin/systems/class_divListSystem.inc +++ b/plugins/admin/systems/class_divListSystem.inc @@ -129,6 +129,10 @@ class divListSystem extends MultiSelectWindow $all_module_acls .= $ui->has_complete_category_acls($this->selectedBase,$module)." | ".$module."
"; } + /* Must we add an additional seperator */ + $add_sep = false; + + /* Add the basic icons for navigation */ $listhead = "
". "  ". @@ -139,43 +143,56 @@ class divListSystem extends MultiSelectWindow "  ". "  "; + /* Add snapshot icons */ if(preg_match("/(c.*w|w.*c)/",$all_module_acls)){ $listhead .= $this->get_snapshot_header($this->selectedBase); + $add_sep = true; } - + /* Handle create icons */ if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"terminal/termgeneric"))){ + $add_sep = true; $listhead .= " "; } if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){ + $add_sep = true; $listhead .= " "; } if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"server/servgeneric"))){ + $add_sep = true; $listhead .= " "; } if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){ + $add_sep = true; $listhead .= " "; } if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){ + $add_sep = true; $listhead .= " "; } if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){ + $add_sep = true; $listhead .= " "; } - $listhead .= " "._("Base")." ". - " ". + /* Should we add a seperator ? */ + if($add_sep){ + $listhead .= " "; + } + + /* Add base selection */ + $listhead .= _("Base")."  ". "  ". "
"; diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index 021c75f9d..7b55b0ed4 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -18,6 +18,7 @@ class printgeneric extends plugin var $description = ""; var $labeledURI = ""; var $gotoPrinterPPD = ""; + var $initial_PPD = ""; var $orig_dn = ""; var $UserMember =""; @@ -117,6 +118,8 @@ class printgeneric extends plugin $this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD); } + $this->initial_PPD = $this->gotoPrinterPPD; + /* Prepare different member types */ foreach(array("AddUser" =>"gotoUserPrinter", "AddGroup" =>"gotoGroupPrinter", @@ -594,6 +597,12 @@ class printgeneric extends plugin unset($og->member[$this->dn]); $og->save (); } + + /* Remove previously selected ppd file.*/ + if(!empty($this->initial_PPD)){ + $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD); + $tmp->removeModifiedPPD(); + } } } @@ -717,6 +726,14 @@ class printgeneric extends plugin $this->PPDdialogToSave->save_ppd(); } + /* Remove previously selected ppd file.*/ + if($this->initial_PPD != $this->gotoPrinterPPD){ + if(!empty($this->initial_PPD)){ + $tmp = new printerPPDDialog($this->config, $this->dn,$this->initial_PPD); + $tmp->removeModifiedPPD(); + } + } + if(preg_match("/https/i",$_SERVER['HTTP_REFERER'])){ $method="https://"; }else{ diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc index 9296afe61..fd041b762 100644 --- a/plugins/admin/systems/class_printerPPDDialog.inc +++ b/plugins/admin/systems/class_printerPPDDialog.inc @@ -477,6 +477,23 @@ class printerPPDDialog extends plugin } return($str); } + + function removeModifiedPPD() + { + $path = $this->pathToPPD.$this->pathToModified.$this->selectedPPD['link']; + + if(file_exists($path)){ + if(is_writeable($path)){ + if(!@unlink($path)){ + print_red(sprintf(_("Removing old ppd file '%s' failed."),$path)); + } + }else{ + print_red(sprintf(_("Removing old ppd file '%s' failed. File is not accessible."),$path)); + } + }else{ + print_red(sprintf(_("Removing old ppd file '%s' failed. File does not exists or is not accessible."),$path)); + } + } function check() { -- 2.30.2