From 5b65c27e4c6374371d7dec2a7b04bcd53cad10bd Mon Sep 17 00:00:00 2001 From: cajus Date: Wed, 5 Dec 2007 14:42:02 +0000 Subject: [PATCH] Modified FAI templates to consist of name and path. CN and FAItemplatePath get synced here. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8019 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/fai/class_faiTemplateEntry.inc | 18 ++++++++++--- plugins/admin/fai/faiTemplateEntry.tpl | 28 ++++++++++++++++---- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc index f2278b65e..b24901c04 100644 --- a/plugins/admin/fai/class_faiTemplateEntry.inc +++ b/plugins/admin/fai/class_faiTemplateEntry.inc @@ -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)){ diff --git a/plugins/admin/fai/faiTemplateEntry.tpl b/plugins/admin/fai/faiTemplateEntry.tpl index 86079b1c2..b8ee41a61 100644 --- a/plugins/admin/fai/faiTemplateEntry.tpl +++ b/plugins/admin/fai/faiTemplateEntry.tpl @@ -4,10 +4,30 @@ -- 2.30.2
- {t}Name{/t}{$must}  + + + + + + + + + +
+ {t}File name{/t}{$must}  + {render acl=$cnACL}    {/render} +
+ + +{render acl=$FAItemplatePathACL} + +{/render} +
{t}Description{/t}  @@ -53,13 +73,11 @@
- + {t}Full path{/t}  {render acl=$FAItemplatePathACL} - + {$FAItemplatePath} {/render}