From 9133a46cd12f4eb933aba20d31e251b3cdec9ba5 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 4 Apr 2008 12:05:54 +0000 Subject: [PATCH] Updated FAI stuff. -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 --- .../fai/admin/fai/class_divListFai.inc | 5 +- .../fai/admin/fai/class_faiManagement.inc | 51 ++++++++++++++++--- 2 files changed, 47 insertions(+), 9 deletions(-) diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc index efc16028e..f1c500ddf 100644 --- a/gosa-plugins/fai/admin/fai/class_divListFai.inc +++ b/gosa-plugins/fai/admin/fai/class_divListFai.inc @@ -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 ="%NAME%"; /* 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 ="%NAME%"; $action.= ""; + name='entry_freeze_edit_%KEY%' title='"._("Edit class")."'>"; $action.= "F"; }else{ + $editlink ="%NAME%"; $action.= ""; if(preg_match("/d/",$value['acl'])){ diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 5a781fcf8..b6ea43559 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -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.= "

\n"; - $display.= "\n"; - $display.= " \n"; - if ($this->dn != "new"){ - $display.= "\n"; + if(!$this->no_save){ + $display.= "\n"; $display.= " \n"; + if ($this->dn != "new"){ + $display.= "\n"; + $display.= " \n"; + } } $display.= "\n"; $display.= "

"; @@ -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; } -- 2.30.2