Code

Snap shot button is now grey, if there are no snapshots left to restore
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Jun 2006 11:55:02 +0000 (11:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 26 Jun 2006 11:55:02 +0000 (11:55 +0000)
Application only, other dialog will follow

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3908 594d385d-05f5-0310-b6e9-bd551577e9d8

html/images/restore_grey.png [new file with mode: 0755]
include/class_MultiSelectWindow.inc
plugins/admin/applications/class_applicationManagement.inc
plugins/admin/applications/class_divListApplication.inc

diff --git a/html/images/restore_grey.png b/html/images/restore_grey.png
new file mode 100755 (executable)
index 0000000..b9aa02d
Binary files /dev/null and b/html/images/restore_grey.png differ
index 59aa9eb22419221c4a7cb1e217bd294fdcc42ead..82aac59eee198e016f7bdae4c8acf11ecfb2b04b 100644 (file)
@@ -480,14 +480,35 @@ class MultiSelectWindow{
                                }
                        }
                }
-
        }
 
 
-  function GetSnapShotActions($dn)
+  /* Create header snapshot value */
+  function get_snapshot_header()
   {
     $str = "";
+    if($this->parent->snapshotEnabled()){
+      $ok = false;
+      foreach($this->parent->get_used_snapshot_bases() as $base){
+        $ok |= count($this->parent->getAllDeletedSnapshots($base)) >= 1 ;
+      }
+      if($ok){
+        $str = "<input class='center' type='image' align='middle' src='images/restore.png'
+          title='"._("Restore snapshopts of already deleted objects")."' 
+          alt='"._("Restore")."' name='RestoreDeletedSnapShot'>&nbsp;"; 
+      }else{
+        $str = "<img class='center' src='images/restore_grey.png'>&nbsp;";
+      }
+
+      $str .= "<img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
+    }
+    return($str);
+  }
+
 
+  function GetSnapShotActions($dn)
+  {
+    $str = "";
     if($this->parent->snapshotEnabled()){
 
       $str .="<input class='center' type='image' src='images/snapshot.png'
index 5a3cecedea1eb7e1cd27033fe9a2762531217ff1..4cb3ccd04b8c9c39f39132ede58b5342fc3bce90 100644 (file)
@@ -364,9 +364,9 @@ class applicationManagement extends plugin
       Dialog display
      ****************/
 
-    $useBase = $this->DivListApplication->selectedRelease;
     /* Check if there is a snapshot dialog open */
-    if($str = $this->showSnapshotDialog($this->DivListApplication->selectedBase,$useBase)){
+    $base = $this->DivListApplication->selectedBase;
+    if($str = $this->showSnapshotDialog($base,$this->get_used_snapshot_bases($base))){
       return($str);
     }
 
@@ -380,6 +380,16 @@ class applicationManagement extends plugin
   }
 
 
+  /* Return departments, that will be included within snapshot detection */
+  function get_used_snapshot_bases(){
+    if($this->DivListApplication->selectedRelease == "main"){
+      return(array($this->DivListApplication->selectedBase));
+    }else{
+      return(array($this->DivListApplication->selectedRelease));
+    }
+  }
+
+
   function reload()
   {
     $this->applications= array();
index 52c69425ec35b5f294be7e13a3d3ab0e27a457eb..86f1aa235fa5f1f2ff04bd043298ecc19b9fe30b 100755 (executable)
@@ -104,13 +104,7 @@ class divListApplication 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;";
-
-    if($this->parent->snapshotEnabled()){
-      $listhead .= "  <input class='center' type='image' align='middle' src='images/restore.png'
-        title='"._("Restore snapshopts of already deleted objects")."' alt='"._("Restore")."' name='RestoreDeletedSnapShot'>".
-        " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'>&nbsp;";
-    }
-
+    $listhead .= $this->get_snapshot_header($this->selectedBase);
     $listhead .= " <input class='center' type='image' align='middle' src='images/list_new_app.png' alt='"._("new").
       "' title='"._("Create new application")."' name='appl_new'>&nbsp;".
       $Copy_Paste.