Code

Application.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 13:10:40 +0000 (13:10 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 17 Jul 2008 13:10:40 +0000 (13:10 +0000)
-Implemented freeze handling

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

gosa-plugins/goto/admin/applications/class_applicationGeneric.inc
gosa-plugins/goto/admin/applications/class_applicationManagement.inc
gosa-plugins/goto/admin/applications/class_divListApplication.inc
gosa-plugins/goto/admin/applications/tabs_application.inc

index 5995d16075183da9f7a81d0cccb21da9ce9590a7..4cf072e49afa7676a550a973f2561dae61a5e76b 100644 (file)
@@ -26,6 +26,7 @@ class application extends plugin
       "gosaApplicationFlags","gotoLogonScript");
 
   var $objectclasses= array("top", "gosaApplication");
+  var $FAIstate ="";
 
   function application (&$config, $dn= NULL, $parent= NULL)
   {
@@ -115,7 +116,7 @@ class application extends plugin
 
     $tmp = $this->plInfo();
     foreach($tmp['plProvidedAcls'] as $name => $translation){
-      $smarty->assign($name."ACL",$this->getacl($name));
+      $smarty->assign($name."ACL",$this->getacl($name, preg_match("/freeze/i",$this->FAIstate)));
     }
  
     /* Do we represent a valid group? */
@@ -144,7 +145,7 @@ class application extends plugin
     $head = $this->generateTemplate();
     $this->gotoLogonScript= $this->generateTemplate().preg_replace('/.*### END HEADER ###/s', '', $this->gotoLogonScript);
 
-    if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile']))){
+    if((isset($_POST['upLoad']))&&(isset($_FILES['ScriptFile'])) && !preg_match("/freeze/i",$this->FAIstate)){
       $str = file_get_contents($_FILES['ScriptFile']['tmp_name']);
       $this->gotoLogonScript = $str;
     }
@@ -167,7 +168,7 @@ class application extends plugin
     /* Base select dialog */
     $once = true;
     foreach($_POST as $name => $value){
-      if(preg_match("/^chooseBase/",$name) && $once){
+      if(preg_match("/^chooseBase/",$name) && $once && !preg_match("/freeze/i",$this->FAIstate)){
         $once = false;
         $this->dialog = new baseSelectDialog($this->config,$this,$this->get_allowed_bases());
         $this->dialog->setCurrentBase($this->base);
@@ -288,6 +289,10 @@ class application extends plugin
   /* Save data to object */
   function save_object()
   {
+    if(preg_match("/freeze/i",$this->FAIstate)){
+      return;
+    }
+
     if (isset($_POST['cn'])){
 
       /* Create a base backup and reset the
index b4f83907f3eb9bf15762786d0735aa31ed574b83..b7f040d78140994b03cd53f7541808e73f6608f2 100644 (file)
@@ -302,6 +302,9 @@ class applicationManagement extends plugin
 
       /* Register apptabs to trigger edit dialog */
       $this->apptabs= new apptabs($this->config,$this->config->data['TABS']['APPSTABS'], $this->dn,"application");
+      if($this->IsReleaseManagementActivated()){
+        $this->apptabs->set_FAIstate($this->applications[$s_entry]['FAIstate'][0]);
+      }
       $this->apptabs->parent = &$this;
       $this->apptabs->set_acl_base($this->dn);
       session::set('objectinfo',$this->dn);
@@ -492,11 +495,14 @@ class applicationManagement extends plugin
       /* Don't show buttons if tab dialog requests this */
       if (!$this->apptabs->by_object[$this->apptabs->current]->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(isset($this->apptabs->FAIstate) && !preg_match("/freeze/i",$this->apptabs->FAIstate)){
+          $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>";
@@ -562,14 +568,23 @@ class applicationManagement extends plugin
       $use_base = $this->app_release;
       $SubSearch= FALSE;
     }
-  
+
+    /* Add FAIstate to the search attributes */
+    $search_attrs = array("cn","description","dn","objectClass");
+    if($this->IsReleaseManagementActivated()) {
+      $search_attrs[] = "FAIstate";
+    }
     if($SubSearch){ 
-      $res= get_sub_list($Filter, "application",get_ou("applicationou"), $use_base, array("cn","description","dn","objectClass"), $Flags);
+      $res= get_sub_list($Filter, "application",get_ou("applicationou"), $use_base, $search_attrs, $Flags);
     }else{
-      $res= get_list($Filter, "application",$use_base, array("cn","description","dn","objectClass"), $Flags);
+      $res= get_list($Filter, "application",$use_base, $search_attrs, $Flags);
     }
     $tmp2 = array();
     foreach ($res as $val){
+      if(!isset($val['FAIstate'])){
+        $val['FAIstate'][0] = "";
+      }
       $tmp[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']]=$val;
       $tmp2[strtolower($val['cn'][0]).$val['cn'][0].$val['dn']] = strtolower($val['cn'][0]).$val['cn'][0].$val['dn'];
     }
index 24d55ef248e9243a50427d2c052c654aee4cdc1b..cb096f5c627d47a3c1ef729282bdab477e7ed92d 100644 (file)
@@ -160,21 +160,38 @@ class divListApplication extends MultiSelectWindow
       $acl = $ui->get_permissions($val['dn'],"application/application");
       $acl_all= $ui->has_complete_category_acls($val['dn'],"application");
 
+      /* Check FAI state 
+       */  
+      $FAIstate = $val['FAIstate'][0];
+
       /* Create action icons */
       $actions= "";
 
       /* Add copy & cut functionality */
-      $actions.= $this->parent->get_copypaste_action($val['dn'],"application","application");
+      if(!preg_match("/freeze/i",$FAIstate)){
+        $actions.= $this->parent->get_copypaste_action($val['dn'],"application","application");
+      }else{
+        $actions.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+        $actions.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+      }
 
       /* Add edit icon */
       $actions.= "<input class='center' type='image'
         src='images/lists/edit.png' alt='"._("edit")."' name='appl_edit_%KEY%' title='"._("Edit this entry")."'>";
 
       /* Add snapshot icon */
-      $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
+      if(!preg_match("/freeze/i",$FAIstate)){
+        $actions.= $this->parent->get_snapshot_action($val['dn'],$this->module);
+      }else{
+        $actions.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+        $actions.= "<img src='images/empty.png' class='center' alt=''>&nbsp;";
+      }
+
 
       /* If we are allowed to remove the application account, display remove icon */
-      if(preg_match("/d/",$acl)){
+      if(preg_match("/freeze/i",$FAIstate)){
+        $actions .= "<img src='images/freeze.png' class='center' alt='!' title='"._("Freezed")."'>";
+      }elseif(preg_match("/d/",$acl)){
         $actions.= "<input class='center' type='image'
           src='images/lists/trash.png' alt='"._("delete")."' name='appl_del_%KEY%' title='"._("Delete this entry")."'>";
       }else{
index 9636c44db90d962227ea0a6d56f69d6410b6872d..53b0916cd180ae348977b179be830d795f65451d 100644 (file)
@@ -2,7 +2,8 @@
 
 class apptabs extends tabs
 {
-  var $parent = FALSE;
+  var $parent   = FALSE;
+  var $FAIstate = "";
 
   function apptabs($config, $data, $dn,$category)
   {
@@ -12,6 +13,14 @@ class apptabs extends tabs
     $this->addSpecialTabs();
   }
 
+  function set_FAIstate($state)
+  {
+    $this->FAIstate = $state;
+    foreach($this->by_name as $name => $desc){
+      $this->by_object[$name]->FAIstate = $state;
+    }
+  }
+
   function save($ignore_account= FALSE)
   {
     $baseobject= $this->by_object['application'];