Code

Updated FAI stuff.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Apr 2008 12:05:54 +0000 (12:05 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 4 Apr 2008 12:05:54 +0000 (12:05 +0000)
-Hide save button if freezed.
-Inherit release STATE if freezed

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

gosa-plugins/fai/admin/fai/class_divListFai.inc
gosa-plugins/fai/admin/fai/class_faiManagement.inc

index efc16028ebd1911ebdd65e49d0edf8da11e7ec36..f1c500ddf1b06b985567500e94ee86208a1d736e 100644 (file)
@@ -275,7 +275,6 @@ class divListFai extends MultiSelectWindow
            "FAIprofile"         => array("IMG"=> "images/fai_profile.png",        "NAME"=>_("Profile") ,       "KZL"=> "P",  "VAR"=>"ShowProfiles"),
            "FAItemplate"        => array("IMG"=> "images/fai_template.png",       "NAME"=>_("Templates") ,     "KZL"=> "T",  "VAR"=>"ShowTemplates"));
 
-    $editlink ="<a href='?plug=".$_GET['plug']."&amp;edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
 
     /* Dynamic action col, depending on snapshot icons */
     $action_col_size = 120;
@@ -328,10 +327,12 @@ class divListFai extends MultiSelectWindow
        }
 
        if(preg_match("/^freeze/", $value['FAIstate'])){
+         $editlink ="<a href='?plug=".$_GET['plug']."&amp;edit_freeze_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
          $action.=  "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
-                      name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+           name='entry_freeze_edit_%KEY%' title='"._("Edit class")."'>";
          $action.=  "<img src='images/closedlock.png' alt='F' class='center'>";
        }else{
+         $editlink ="<a href='?plug=".$_GET['plug']."&amp;edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
          $action.= "<input class='center' type='image' src='images/edit.png'  alt='"._("edit")."'
            name='entry_edit_%KEY%' title='"._("Edit class")."'>";
          if(preg_match("/d/",$value['acl'])){
index 5a781fcf878eed1bb30b71994ccb89b82881a20b..b6ea4355990103474a06652e7e4837374fc5d400 100644 (file)
@@ -46,6 +46,8 @@ class faiManagement extends plugin
   var $CopyPasteHandler = FALSE;
   var $base = "";
 
+  var $no_save;
+
        /* construction/reconstruction 
         */
        function faiManagement (&$config, $ui)
@@ -76,9 +78,10 @@ class faiManagement extends plugin
                $display        = "";
     $s_action  = "";
                $s_entry        = "";
+    $no_save = FALSE;   // hide Apply / Save buttons
     
     /* If an entry was locked, these vars will be stored in a session to allow direct edit */
-    session::set('LOCK_VARS_TO_USE',array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/","/^menu_action/"));
+    session::set('LOCK_VARS_TO_USE',array("/^edit_freeze_entry$/","/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/","/^menu_action/"));
 
 
     /****************
@@ -112,6 +115,11 @@ class faiManagement extends plugin
                                $s_entry = preg_replace("/^entry_edit_/","",$name);
                                $s_entry = preg_replace("/_.*$/","",$s_entry);
                                $s_action = "edit";
+                       }elseif(preg_match("/^entry_freeze_edit_.*/",$name)){
+                               $s_entry = preg_replace("/^entry_freeze_edit_/","",$name);
+                               $s_entry = preg_replace("/_.*$/","",$s_entry);
+                               $s_action = "edit";
+        $no_save = TRUE;
                        }elseif(preg_match("/^entry_delete_.*/",$name)){
                                $s_entry = preg_replace("/^entry_delete_/","",$name);
                                $s_entry = preg_replace("/_.*$/","",$s_entry);
@@ -124,6 +132,12 @@ class faiManagement extends plugin
                        $s_action = "edit";
                }
 
+               if(isset($_GET['edit_freeze_entry'])){
+                       $s_entry = $_GET['edit_freeze_entry'];
+                       $s_action = "edit";
+      $no_save = TRUE;
+               }
+
     if(isset($_GET['act']) && $_GET['act'] == "freeze_branch"){
       $s_action = "freeze_branch";
     }
@@ -172,6 +186,11 @@ class faiManagement extends plugin
       $s_action = "del_multiple";
     }
 
+
+    if(!empty($s_action)){
+      $this->no_save = $no_save;
+    }
+
     /********************
       Copy & Paste
      ********************/
@@ -396,11 +415,12 @@ class faiManagement extends plugin
                        add_lock ($this->dn, $this->ui->dn);
 
                        $this->dialog     = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
+
       $this->dialog->set_acl_base($this->dn);
                        $this->is_dialog  = true;
 
-      if(preg_match("/^freeze/", $entry['FAIstate'])){
-        #$this->dialog->set_acl(array("*none*"))  ;    
+      if(preg_match("/^freeze/", $entry['FAIstate']) || $this->no_save){
+#        $this->dialog->set_acl_base("freezed")  ;    
       }
                        session::set('objectinfo',$this->dn);
                }
@@ -826,11 +846,13 @@ class faiManagement extends plugin
         if((isset($obj->is_dialog) && (!$obj->is_dialog)) || (isset($obj->dialog) && (!$obj->dialog))){
 
           $display.= "<p style=\"text-align:right\">\n";
-          $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
-          $display.= "&nbsp;\n";
-          if ($this->dn != "new"){
-            $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
+          if(!$this->no_save){
+            $display.= "<input type=\"submit\" name=\"edit_finish\" style=\"width:80px\" value=\"".msgPool::okButton()."\">\n";
             $display.= "&nbsp;\n";
+            if ($this->dn != "new"){
+              $display.= "<input type=submit name=\"edit_apply\" value=\"".msgPool::applyButton()."\">\n";
+              $display.= "&nbsp;\n";
+            }
           }
           $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\"".msgPool::cancelButton()."\">\n";
           $display.= "</p>";
@@ -968,6 +990,17 @@ class faiManagement extends plugin
     /* Ge listed ldap objects */
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
+
+    /* Get release tag 
+       If current release is freezed, all objects are freezed to.
+     */
+    $ldap->cat($base);
+    $release_attrs = $ldap->fetch();
+    $force_freezed = FALSE;
+    if(isset($release_attrs['FAIstate'][0]) && preg_match("/freeze/i",$release_attrs['FAIstate'][0])){
+      $force_freezed = TRUE;
+    }
+
     foreach($tmp as $entry){
 
       /* Get some more informations about the object */ 
@@ -1004,6 +1037,10 @@ class faiManagement extends plugin
             $obj['FAIstate'] = $object['FAIstate'][0]; 
           }
 
+          if($force_freezed){
+            $obj['FAIstate'] = "freeze";
+          }
+
           $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
           $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
         }