Code

test
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jan 2010 14:47:16 +0000 (14:47 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 5 Jan 2010 14:47:16 +0000 (14:47 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@15056 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiManagement.inc
gosa-plugins/fai/admin/fai/class_filterFAI.inc
gosa-plugins/fai/admin/fai/fai-filter.tpl
gosa-plugins/fai/admin/fai/fai-list.xml
gosa-plugins/fai/admin/fai/faiGroupHandle.tpl

index 63e1733eef91c42012142121068a9a8d05994ba1..d1b2868f6dc56901e47115ea84ba8666122b27be 100644 (file)
@@ -69,9 +69,55 @@ class faiManagement extends management
     if($this->config->get_cfg_value("enableSnapshots") == "true"){
       $this->snapHandler = new SnapshotHandler($this->config);
     }
+    $this->registerAction("editByGroup","editByGroup");
     parent::__construct($config, $ui, "roles", $headpage);
   }
 
+
+  
+  function editEntry($action="",$target=array(),$all=array(), $altTabClass ="", $altTabType = "", $altAclCategory="")
+  {
+    $headpage = $this->getHeadpage();
+    if(count($target) == 1){
+      foreach($headpage->entries as $entry){
+        if($entry['dn'] == $target[0]){
+          if(count($entry['GROUPS']) == 1){
+            $data = array_pop($entry['GROUPS']);
+            $type = $this->get_type($data);
+            management::editEntry('editEntry',array($data['dn']),array(),$type[0],$type[2],$type[1]);
+          }else{
+            $this->dialogObject = new faiGroupHandle($entry['GROUPS'],"edit");
+          }
+          break;
+        }
+      }
+    }
+  }
+
+  function editByGroup()
+  {
+    if($this->dialogObject instanceOf faiGroupHandle && $this->dialogObject->get_mode() == "edit"){
+      $entry = $this->dialogObject->get_selected();
+      $this->editEntryByType(key($entry), array_pop($entry));
+    }
+  }
+
+  function editEntryByType($type, $data)
+  {
+    $this->closeDialogs();
+    $type = $this->get_type($data);
+    management::editEntry('editEntry',array($data['dn']),array(),$type[0],$type[2],$type[1]);
+  }
+  
+  function detectPostActions()
+  {
+    $action = management::detectPostActions();
+    if(isset($_POST['faiGroupHandle_cancel'])) $action['action'] = "cancel";
+    if(isset($_POST['faiGroupHandle_apply']))  $action['action'] = "editByGroup";
+    return($action);
+  }
+
+
   function renderList()
   {
     $filter = $this->getFilter();
@@ -109,6 +155,7 @@ class faiManagement extends management
 
       $list = array_merge($list,$this->getReleaseList($release['dn'],$prefix."&nbsp; "));
     }
+    print_a($_POST);
     return($list);
   }
 
@@ -149,6 +196,31 @@ class faiManagement extends management
   }
 
 
+  function get_type($array){
+    if(!isset($array['objectClass'])) return(array());
+    if(in_array("FAIpartitionTable",$array['objectClass'])){
+      return(array("tabsPartition","faiPartitionTable","FAIPARTITIONTABS"));
+    }
+    if(in_array("FAIscript",$array['objectClass'])){
+      return(array("tabsScript","faiScript","FAISCRIPTTABS"));
+    }
+    if(in_array("FAItemplate",$array['objectClass'])){
+      return(array("tabsTemplate","faiTemplate","FAITEMPLATETABS"));
+    }
+    if(in_array("FAIhook",$array['objectClass'])){
+      return(array("tabsHook","faiHook","FAIHOOKTABS"));
+    }
+    if(in_array("FAIvariable",$array['objectClass'])){
+      return(array("tabsVariable","faiVariable","FAIVARIABLETABS"));
+    }
+    if(in_array("FAIprofile",$array['objectClass'])){
+      return(array("tabsProfile","faiProfile","FAIPROFILETABS"));
+    }
+    if(in_array("FAIpackageList",$array['objectClass'])){
+      return(array("tabsPackage","faiPackage","FAIPACKAGETABS"));
+    }
+    return(array());
+  }
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 6583ab14ac2efb97b6d5f13aa32facb2f4b7314b..61d12f93696f5d7fe7a22a1ff20d73eb390fa559 100644 (file)
@@ -56,11 +56,13 @@ class filterFAI extends filterLDAP{
           $obj['description']   = $object['description'][0];
           $obj['objectClass']   = $object['objectClass'];
           $obj['TYPES'][]       = $type;
+          $obj['GROUPS'][$type]      = $object;
         
           if(!isset($result[$obj['cn']])){
             $result[$obj['cn']] = $obj;
           }else{
             $result[$obj['cn']]['TYPES'][]=$type;
+            $result[$obj['cn']]['GROUPS'][$type]=$object;
           }
         }
       }
@@ -69,11 +71,15 @@ class filterFAI extends filterLDAP{
     // Make results useable for the listing class.
     $entries = array();
     foreach($result as $entry){
-      $item=array('count' => count($entry));
+      $item=array('count' => count($entry) -1);
       foreach($entry as $name => $value){
-        $item[] = $name;
-        $item[$name] = $value ;       
+        if($name != "GROUPS"){
+          $item[] = $name;
+
+          $item[$name] = $value ;       
+        }
       }
+      $item['GROUPS'] = $entry['GROUPS'];
       $entries[] = $item;
     }
 
index 3c2904bfc12bdfb744f8fb00ef7de7d6fc6b5001..f29a2a5d49e2a09dd4dd5f5dde9308057ea74774 100644 (file)
@@ -8,13 +8,22 @@
 
 <div style="border-top:1px solid #AAAAAA"></div>
 
- <table summary="" style="width:100%;">
-  <tr>
-   <td>
-     <LABEL for='RELEASE'>{t}Release{/t}</LABEL>&nbsp;{$RELEASE}<br>
-   </td>
-  </tr>
- </table>
+<div style='padding:4px;'>
+  <LABEL for='RELEASE'>{t}Release{/t}</LABEL>&nbsp;{$RELEASE}<br>
+</div>
+
+<div style="border-top:1px solid #AAAAAA"></div>
+
+<div style='padding:4px;'>
+  <input class="center" type="image" name="branch_branch" src="plugins/fai/images/branch_small.png">
+  <a href="?plug={$plug}&act=branch_branch">{t}Create release{/t}</a>
+  <br>
+  <input class="center" type="image" name="freeze_branch" src="plugins/fai/images/freeze.png">
+  <a href="?plug={$plug}&act=freeze_branch">{t}Create read-only release{/t}</a>
+  <br>
+  <input class="center" type="image" name="remove_branch" src="images/lists/trash.png">
+  <a href="?plug={$plug}&act=remove_branch">{t}Delete current release{/t}</a>
+</div>
 <div style="border-top:1px solid #AAAAAA"></div>
 
 {$PROFILE}   {t}Show profiles{/t}
index e4758ef6ec8eb7c56a246a7b7980ca39fa9f540c..225054b4e1c1584f14dbb8755695eac285dae913 100644 (file)
@@ -22,7 +22,7 @@
   </definition>
 
   <table>
-    <layout>|20px;c|||250px|170px;r|</layout>
+    <layout>|20px;c||250px|170px;r|</layout>
 
     <department>
       <value>%{filter:departmentLink(row,dn,description)}</value>
       <export>true</export>
     </column>
 
-    <column>
-      <label>Description</label>
-      <sortAttribute>description</sortAttribute>
-      <sortType>string</sortType>
-      <value>%{filter:link(row,dn,"%s",description)}</value>
-      <export>true</export>
-    </column>
-
     <column>
       <label>Properties</label>
       <value>%{filter:filterProperties(row,TYPES)}</value>
       <name>edit</name>
       <type>entry</type>
       <image>images/lists/edit.png</image>
-      <label>Edit role</label>
+      <label>Edit</label>
     </action>
 
     <action>
       <name>remove</name>
       <type>entry</type>
       <image>images/lists/trash.png</image>
-      <acl>roles/role[d]</acl>
       <label>Remove role</label>
     </action>
 
index 829db509009b524d13c6d0eca9aaa6eee7d1a08f..c9794b2d46d5215617635822327839f8b6cdb33a 100644 (file)
@@ -42,7 +42,7 @@
                                class='center'>
                </td>
                <td style='width:150px;'>{$types.$key.NAME}</td>
-               <td><i>({$item.description})</i>
+               <td><i>({$item.description.0})</i>
                </td>
        </tr>
 {/foreach}