Code

Modified FAI templates to consist of name and path. CN and FAItemplatePath get synced...
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Dec 2007 14:42:02 +0000 (14:42 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 5 Dec 2007 14:42:02 +0000 (14:42 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8019 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/fai/class_faiTemplateEntry.inc
plugins/admin/fai/faiTemplateEntry.tpl

index f2278b65e7c5e706973d87481dbe12e5a865a200..b24901c048af2f19857a836c5bab387dec6ca868 100644 (file)
@@ -137,6 +137,10 @@ class faiTemplateEntry extends plugin
       $smarty->assign($attr."ACL",$this->getacl($attr,preg_match("/freeze/",$this->FAIstate)));
     }
 
+    /* We now split cn/FAItemplatePath to make things more clear... */
+    $smarty->assign("cn", basename($this->FAItemplatePath));
+    $smarty->assign("templatePath", dirname($this->FAItemplatePath));
+
     $display.=  $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
     return($display);
   }
@@ -173,6 +177,10 @@ class faiTemplateEntry extends plugin
           $tmode= $tmode.$dest;
         }
         $this->FAImode= $tmode;
+
+        /* Assemble cn/FAItemplatePath */
+        $this->cn= preg_replace('/\/+/', '/', $this->FAItemplatePath.'/'.$this->cn);
+        $this->FAItemplatePath= $this->cn;
       }
     }
   }
@@ -192,12 +200,16 @@ class faiTemplateEntry extends plugin
       $message[]=_("Please specify a value for attribute 'file'.");
     } 
 
-    if(empty($this->FAItemplatePath)){
-      $message[]=_("Please specify a value for attribute 'path'.");
+    if(!preg_match('/^\//', $this->FAItemplatePath)){
+      $message[]=_("Please specify a valid value for attribute 'Destination path'.");
     } 
   
     if(empty($this->cn)){
-      $message[] = _("Please enter a name.");
+      $message[] = _("Please enter a file name.");
+    }
+
+    if(preg_match('/\//', $this->cn)){
+      $message[] = _("The file name should not contain / characters.");
     }
 
     if(empty($this->user)){
index 86079b1c2c0fb42cc5f7b7fd039d31dca9f83a1d..b8ee41a61a4d3b3a2da31c8061d8a7ea6c546ce6 100644 (file)
@@ -4,10 +4,30 @@
 <table width="100%" summary="">
 <tr>
        <td width="50%">
-               {t}Name{/t}{$must}&nbsp;
+               <table>
+                 <tr>
+                   <td>
+               {t}File name{/t}{$must}&nbsp;
+                   </td>
+                   <td>
 {render acl=$cnACL}
                <input value="{$cn}" name="cn" size="45" maxlength="80">&nbsp;&nbsp;
 {/render}
+                   </td>
+                  </tr>
+                 <tr>
+                       <td>
+                               <LABEL for="templatePath">
+                                       {t}Destination path{/t}{$must}&nbsp;
+                               </LABEL>
+                               </td>
+                       <td>
+{render acl=$FAItemplatePathACL}
+                               <input type="text" name="FAItemplatePath" value="{$templatePath}" id="templatePath" size="45">
+{/render}
+                               </td>
+                 </tr>
+               </table>
        </td>
        <td>
                {t}Description{/t}&nbsp;
                        </td>
        </tr><tr>
                        <td>
-                               <LABEL for="FAItemplatePath">
-                                       {t}Destination path{/t}{$must}&nbsp;
-                               </LABEL>
+                               {t}Full path{/t}&nbsp;
                                </td>
                        <td>
 {render acl=$FAItemplatePathACL}
-                               <input type="text" name="FAItemplatePath" value="{$FAItemplatePath}" id="FAItemplatePath" size="45">
+                               <i>{$FAItemplatePath}</i>
 {/render}
                                </td>
                </tr>