Code

Made uniform headers.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 1 Dec 2006 08:56:17 +0000 (08:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 1 Dec 2006 08:56:17 +0000 (08:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5282 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/applications/class_divListApplication.inc
plugins/admin/departments/class_divListDepartment.inc
plugins/admin/groups/class_divListGroup.inc
plugins/admin/mimetypes/class_divListMimeTypes.inc
plugins/admin/ogroups/class_divListOGroup.inc
plugins/admin/systems/class_divListSystem.inc
plugins/admin/systems/class_printGeneric.inc
plugins/admin/systems/class_printerPPDDialog.inc

index f92e10a990e7fcea1544a1681aba58aea24772b1..b2464b1aaa5ff5b35fa3f804dbef45fd4865b2a3 100755 (executable)
@@ -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")."'>&nbsp;".
       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
 
+    /* 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 .= " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new")."'
+      $listhead .= " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new")."'
        title='"._("Create new application")."' name='appl_new'>&nbsp;";
+      $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 .= " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
     }
 
-    $listhead.=  $Copy_Paste.
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-      _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+    /* And the rest, a base selection box */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' 
         title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
       "</div>";
index 7ea33e77518d3c22c64363495e2268cea1fed25c..712ba87905e36befccdc98b90b925b3f348facd9 100755 (executable)
@@ -102,7 +102,7 @@ class divListDepartment extends MultiSelectWindow
     }
   
 
-    $listhead .= $acl." <img class='center' src='images/list_seperator.png' align='middle' ".
+    $listhead .= " <img class='center' src='images/list_seperator.png' align='middle' ".
       " alt='' height='16' width='1'>&nbsp;".
       " "._("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' ".
index 13501175afdd82801501d87a52452395029a7f9e..2a270b34e20d20a8d6a3b00ecf21eed9ad5df17c 100644 (file)
@@ -105,14 +105,18 @@ class divListGroup extends MultiSelectWindow
       }
     }
 
+    /* Get acls */
     $acls   = $ui->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
       " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='".        _("Submit")."'>&nbsp;".
       " <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'>&nbsp;";
 
+    /* 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 .= "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
+      $addsep = true;
     }
 
+    /* Add Create group icon */
     if(preg_match("/c/",$acls)) {
       $listhead.=" <input type='image' class='center' src='images/list_new_group.png' 
         title='"._("Create new group")."' alt='"._("New")."' name='group_new'>&nbsp;";
+      $addsep = true;
     }
 
-    $listhead.=      $Copy_Paste.
-      " <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'>&nbsp;".
-      _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+    /* Assign copy & paste icons */
+    $listhead.=      $Copy_Paste;
+    
+    /* Append an additional seperator */
+    if($addsep){
+      $listhead.=" <img class='center' src='images/list_seperator.png' alt='' height='16' width='1'>&nbsp;";
+    }
+    
+    /* Add department selection */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
       "'>&nbsp;".
       "</div>";
index c538f6e94ae2dbb41909cb09d15345c756c432d3..b1fd3768eafe50a6136307d61bac184fb676825e 100755 (executable)
@@ -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")."'>&nbsp;".
       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
     
+    /* 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 .= " <input class='center' type='image' align='middle' src='images/list_new_mime.png' alt='"._("new").
         "' title='"._("Create new mime type")."' name='mime_new'>&nbsp;";
+      $add_sep = true;
     }
   
-    $listhead .= 
-      $Copy_Paste.
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-      _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+    /* Add copy & paste icons */
+    $listhead .= $Copy_Paste;
+
+    /* Add a seperator ? */
+    if($add_sep) {
+      $listhead .= " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+    
+    /* And at least add a department selection box */
+    $listhead .=  _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' 
         title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
       "</div>";
index 2609fda973ec6da4c266234459f2018d5e9b0e17..c661eb577a2a65fee27defd1cd2084d1c58b3070 100755 (executable)
@@ -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")."'>&nbsp;".
       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
 
-
+    /* Add snapshot restore icons */ 
     if(preg_match("/(c.*w|w.*c)/",$acl_all)){
       $listhead .= $this->get_snapshot_header($this->selectedBase);
-    }else{
-      $listhead .= "<img class='center' src='images/restore_grey.png' alt=''>&nbsp;";
+      $add_sep = true;
     }
 
+    /* Create new ogroup icon */
     if(preg_match("/c/",$acls)) {
       $listhead .=" <input class='center' type='image' align='middle' src='images/list_new_ogroup.png' 
         title='"._("Create new object group")."' alt='"._("new")."' name='group_new'>";
+      $add_sep = true;
     }
 
-    $listhead .=  $Copy_Paste.
-      " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;".
-      _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+    /* Add copy & paste icon */
+    $listhead .=  $Copy_Paste;
+    
+    /* Should we add a seperator here ? */
+    if($add_sep){
+      $listhead .=" <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+  
+    /* Add department selector */
+    $listhead .= _("Base")."&nbsp;<select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle' 
       title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'>&nbsp;".
       "</div>";
index d5ddeec8251cb9a44baa8ca68e6a2af0d04c645b..d624ec0ec6edbaab19937dea3ebd2b98093a704e 100644 (file)
@@ -129,6 +129,10 @@ class divListSystem extends MultiSelectWindow
       $all_module_acls .= $ui->has_complete_category_acls($this->selectedBase,$module)." | ".$module."<br>";
     }
 
+    /* Must we add an additional seperator */
+    $add_sep = false;
+    
+    /* Add the basic icons for navigation */
     $listhead = "<div style='background:#F0F0F9;padding:5px;'>".
       " <input class='center' type='image' src='images/list_root.png' align='middle'
       title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'>&nbsp;".
@@ -139,43 +143,56 @@ class divListSystem extends MultiSelectWindow
       " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='".          _("Submit")."'>&nbsp;".
       " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
 
+    /* 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 .= "<input class='center' type='image' align='middle' src='images/select_new_terminal.png'
         name='newsystem_terminal'    alt='"._("New Terminal template")."' title='"._("New Terminal")."'>&nbsp;";
     }
 
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"workstation/workgeneric"))){
+      $add_sep = true;
       $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_workstation.png'
         name='newsystem_workstation' alt='"._("New Workstation template")."' title='"._("New Workstation")."'>&nbsp;";
     }
 
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"server/servgeneric"))){
+      $add_sep = true;
       $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_server.png'     
         name='newsystem_server' alt='"._("New Server")."' title='"._("New Server")."'>&nbsp;";
     }
 
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"printer/printgeneric"))){
+      $add_sep = true;
       $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_printer.png'    
         name='newsystem_printer'     alt='"._("New Printer")."' title='"._("New Printer")."'>&nbsp;";
     }
 
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"phone/phoneGeneric"))){
+      $add_sep = true;
       $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_phone.png'      
         name='newsystem_phone' alt='"._("New Phone")."' title='"._("New Phone")."'>&nbsp;";
     }
 
     if(preg_match("/c/",$ui->get_permissions($this->selectedBase,"component/componentGeneric"))){
+      $add_sep = true;
       $listhead .= "<input class='center' type='image' align='middle' src='images/select_new_component.png'  
         name='newsystem_component' alt='"._("New Component")."' title='"._("New Component")."'>&nbsp;";
     }
 
-    $listhead .= "<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;"._("Base")."&nbsp;".
-      " <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
+    /* Should we add a seperator ? */
+    if($add_sep){
+      $listhead .= "<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+
+    /* Add base selection */
+    $listhead .= _("Base")."&nbsp; <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
       " <input class='center' type='image' src='images/list_submit.png' align='middle'
       title='"._("Submit department")."' name='submit_department' alt='".           _("Submit")."'>&nbsp;".
       "</div>";
index 021c75f9d0f5b6864dbd6fbe27e31abb6d306aac..7b55b0ed4d8475746fbc0120eb0f1d74bcfc3755 100644 (file)
@@ -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{
index 9296afe61985cfcd1585baae1e9ef623dcdb16c7..fd041b762aad8eed5f15933145a9b86a4de6b269 100644 (file)
@@ -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()
   {