Code

Readded action command to template
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Oct 2006 04:55:04 +0000 (04:55 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 4 Oct 2006 04:55:04 +0000 (04:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@4846 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiManagement.inc
plugins/admin/fai/class_faiScript.inc
plugins/admin/fai/class_faiScriptEntry.inc
plugins/admin/fai/faiScript.tpl
plugins/admin/fai/faiScriptEntry.tpl
plugins/admin/fai/tabsScript.inc

index 098cde7ab05a8abef1ecd08b669d392d13aa4479..2158806541b83b0ee86d2c2465de53f5993ef7c5 100644 (file)
@@ -199,6 +199,8 @@ class faiManagement extends plugin
                                $attrs  = $ldap->fetch();
                                $type     = $this->get_type($attrs);                    
                                $this->dialog = new $type[0]($this->config,     $this->config->data['TABS'][$type[2]], $this->dn);
+        $this->dialog->set_acl_base($this->dn);
+        $this->dialog->set_acl_category("fai");
                                $this->dialog->by_object[$type[1]]->remove_from_parent ();
                                unset ($this->dialog);
                                gosa_log ("FAI class '".$this->dn."' has been tagged as removed");
@@ -240,7 +242,9 @@ 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);
+                       $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->dialog->set_acl_category("fai");
                        $this->is_dialog  = true;
 
       if($entry['FAIstate'] == "freeze"){
index 18f95aef3914979b9e15bf083de9f0ed5186c5c6..3dd1a51366c7c333a749b81458cd3bba292bdf6d 100644 (file)
@@ -43,21 +43,12 @@ class faiScript extends plugin
     /* Load Attributes */
     plugin::plugin ($config, $dn);
 
-    $this->acl ="#all#";
-    
     /* If "dn==new" we try to create a new entry
      * Else we must read all objects from ldap which belong to this entry.
      * First read SubObjects from ldap ... and then the partition definitions for the SubObjects.
      */
     if($dn != "new"){
 
-      /* Set acls
-       */
-      $ui   = get_userinfo();
-      $acl  = get_permissions ($this->dn, $ui->subtreeACL);
-      $acli = get_module_permission($acl, "FAIclass", $this->dn);
-      $this->acl=$acli;
-
       $this->dn =$dn;
 
       /* Get FAIstate
@@ -130,7 +121,8 @@ class faiScript extends plugin
     /* Add new sub object */
     if(isset($_POST['AddSubObject'])){
       $this->dialog= new $this->subClassName($this->config,"new");
-      $this->dialog->acl = $this->acl;
+      $this->dialog->set_acl_base($_SESSION['CurrentMainBase']);
+      $this->dialog->set_acl_category("fai");
       $this->is_dialog=true;
     }
 
@@ -154,6 +146,8 @@ class faiScript extends plugin
           $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
         }
         $this->dialog= new $this->subClassName($this->config,$this->dn,$obj);
+        $this->dialog->set_acl_base($this->dn);
+        $this->dialog->set_acl_category("fai");
 
 
         $_SESSION['objectinfo'] = $obj['dn'];
@@ -179,7 +173,8 @@ class faiScript extends plugin
     if((isset($_POST['EditSubObject']))&&(isset($_POST['SubObject']))){
       $script = $_POST['SubObject'][0];
       $this->dialog= new $this->subClassName($this->config,$this->dn,$this->SubObjects[$script]);
-      $this->dialog->acl = $this->acl;
+      $this->dialog->set_acl_base($_SESSION['CurrentMainBase']);
+      $this->dialog->set_acl_category("fai");
       $_SESSION['objectinfo'] = $this->SubObjects[$script]['dn'];
       $this->is_dialog=true;
     }
@@ -252,7 +247,7 @@ class faiScript extends plugin
      */
     $divlist = new divSelectBox("FAIscripts");
     $divlist->setHeight(400);
-    if((chkacl($this->acl,"cn")!="") || ($this->FAIstate == "freeze")){
+    if(($this->FAIstate == "freeze")){
       $img_edit = "<input type='image' src='images/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
       $img_remo = "";
     }else{
@@ -288,8 +283,11 @@ class faiScript extends plugin
       }
     }
 
-    foreach($this->attributes as $attr){
-      $smarty->assign($attr."ACL",chkacl($this->acl,$attr));
+    $tmp = $this->plInfo();
+    $this->ui = get_userinfo();
+    $smarty->assign("sub_object_is_addable", preg_match("/c/",$this->ui->get_permissions($this->dn,"fai/faiScriptEntry")));
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $smarty->assign($name."ACL",$this->getacl($name));
     }
 
     $display.= $smarty->fetch(get_template_path('faiScript.tpl', TRUE));
@@ -485,10 +483,8 @@ class faiScript extends plugin
           "plSection"     => array("administration"),
           "plCategory"    => array("fai"),
           "plProvidedAcls" => array(
-            "cn"                => _("Name"),
-            "description"       => _("Description"),
-            "FAIpriority"       => _("Script priority"),
-            "FAIscript"         => _("FAI script"))
+            "cn"                => _("Name")." ("._("Readonly").")",
+            "description"       => _("Description"))
           ));
   }
 }
index 617de2612d6d27e72b8d0ec6a1192ccc35c730b9..2c6bcf0709760777023bec5b0f4c01398ca42d02 100644 (file)
@@ -96,12 +96,13 @@ class faiScriptEntry extends plugin
       $FAIprioritys[$i]=$i;
     }
 
-    foreach($this->attributes as $attr){
-      if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
-        $smarty->assign($attr."ACL"," disabled ");
-      }else{
-        $smarty->assign($attr."ACL","  ");
+    $tmp = $this->plInfo();
+    foreach($tmp['plProvidedAcls'] as $name => $translated){
+      $acl = $this->getacl($name);
+      if($this->FAIstate == "freezed"){
+        $acl = preg_replace("/w/","",$acl);
       }
+      $smarty->assign($name."ACL",$acl);
     }
 
     $smarty->assign("FAIprioritys",$FAIprioritys);
@@ -159,6 +160,28 @@ class faiScriptEntry extends plugin
     $tmp['status']  = $this->status; 
     return($tmp);
   }
+
+  
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName" => _("Script entry"),
+          "plDescription" => _("FAI script entry"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("fai"),
+          "plProvidedAcls" => array(
+            "cn"              => _("Name"),
+            "description"     => _("Description"),
+            "FAIscript"       => _("Script entry"),
+            "FAIpriority"     => _("Script Priority"))
+          ));
+  }
+
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 420b6afd0309b0054c5f5fa0cd666a26f3c76c37..45f7cf25c5ea32f3150d8cda7b6d650c06487226 100644 (file)
@@ -10,7 +10,9 @@
                                                        </LABEL>
                                                </td>
                                                <td>
+{render acl=$cnACL}
                                                        <input value="{$cn}"  maxlength="80" size="45" disabled id="cn">
+{/render}
                                                </td>
                                        </tr>
                                        <tr>
@@ -20,7 +22,9 @@
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                       <input size="45" maxlength="80" value="{$description}" {$description} name="description" id="description" {$descriptionACL}>
+{render acl=$descriptionACL}
+                                                       <input size="45" maxlength="80" value="{$description}" name="description" id="description" >
+{/render}
                                                </td>
                                        </tr>
                                </table>
                                <tr>
                                        <td>
                                                {$Entry_divlist}
-                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}"         title="{t}Add{/t}" {$cnACL}>
+{if $sub_object_is_addable}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" >
+{else}
+                                               <input type="submit" name="AddSubObject"     value="{t}Add{/t}" title="{t}Add{/t}" disabled>
+{/if}
                                        </td>
                                </tr>
                                </table>
index ab9c5c15227e746bc6d27decb919533e9354f36a..f3db3d682a67b96a85a4a3b61e60109af08cb707 100644 (file)
@@ -9,7 +9,9 @@
                                                        {t}Name{/t}{$must}&nbsp;
                                                </td>
                                                <td>
-                                                       <input value="{$cn}" size="45" maxlength="80" name="cn"  {$cnACL}>
+{render acl=$cnACL}
+                                                       <input value="{$cn}" size="45" maxlength="80" name="cn">
+{/render}
                                                </td>
                                        </tr>
                                        <tr>
@@ -17,7 +19,9 @@
                                                        {t}Description{/t}&nbsp;
                                                </td>
                                                <td>
-                                                       <input size="45" maxlength="80" value="{$description}" name="description" {$descriptionACL}>
+{render acl=$descriptionACL}
+                                                       <input size="45" maxlength="80" value="{$description}" name="description">
+{/render}
                                                </td>
                                        </tr>
                                </table>
                                                        </LABEL>
                                                </td>
                                                <td>
-                                                   <select name="FAIpriority" title="{t}Choose a priority{/t}" {$FAIpriorityACL}>
+{render acl=$FAIpriorityACL}
+                                                   <select name="FAIpriority" title="{t}Choose a priority{/t}">
                                                {html_options options=$FAIprioritys selected=$FAIpriority}
                                        </select>
+{/render}
                                                </td>
                                        </tr>
                                </table>
 <table summary="" width="99%">
     <tr>
         <td>
+{render acl=$FAIscriptACL}
             <textarea name="FAIscript" style="width:100%;height:300px;" id="FAIscript"  >{$FAIscript}</textarea>
+{/render}
         </td>
     </tr>
 </table>
 <br>
 <div>
-       <input type="file" name="ImportFile"  {$FAIscriptACL}>&nbsp;
-       <input type="submit" name="ImportUpload" value="{t}Import script{/t}" {$FAIscriptACL}>
+{render acl=$FAIscriptACL}
+       <input type="file" name="ImportFile">&nbsp;
+{/render}
+{render acl=$FAIscriptACL}
+       <input type="submit" name="ImportUpload" value="{t}Import script{/t}">
+{/render}
+{render acl=$FAIscriptACL}
        {$DownMe}
+{/render}
 </div>
 <br>
 <div style="align:right;" align="right">
index 69ddfc9635329c68b069f6ca9eb38e4494c56ea8..6d7625d3b80990d6c5854f71cbba9bd32b03d468 100644 (file)
@@ -4,9 +4,9 @@ class tabsScript extends tabs
 {
   var $base= "";
 
-  function tabsScript($config, $data, $dn)
+  function tabsScript($config, $data, $dn,$category)
   {
-       tabs::tabs($config, $data, $dn);
+       tabs::tabs($config, $data, $dn,$category);
 
        /* Add references/acls/snapshots */
        $this->addSpecialTabs();