summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 7d3f507)
raw | patch | inline | side by side (parent: 7d3f507)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Oct 2005 13:03:41 +0000 (13:03 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 12 Oct 2005 13:03:41 +0000 (13:03 +0000) |
* Fixups for template dialog
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1562 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1562 594d385d-05f5-0310-b6e9-bd551577e9d8
index fd30c52e0204386f0fd2096d3695b4e62262815a..4618e899a401dda14b39fe6b0df786c67557bb80 100644 (file)
var $subClassName = "faiTemplateEntry";
/* Attributes to initialise for each subObject */
- var $subAttributes = array("cn","description","FAItemplateFile","FAItemplatePath");
- var $sub64coded = array("FAItemplateFile","FAItemplatePath");
+ var $subAttributes = array("cn","description","FAItemplateFile","FAItemplatePath","FAIowner","FAImode");
+ var $sub64coded = array("FAItemplatePath");
/* Specific attributes */
var $cn = ""; // The class name for this object
$this->SubObjects[$object['cn'][0]][$codeIt]=base64_decode($this->SubObjects[$object['cn'][0]][$codeIt]);
}
- $this->SubObjects[$object['cn'][0]]['FAItemplateFile'] =base64_decode($this->readBinary("FAItemplateFile",$object['dn']));
+ $this->SubObjects[$object['cn'][0]]['FAItemplateFile'] = $this->readBinary("FAItemplateFile",$object['dn']);
$this->SubObjects[$object['cn'][0]]['status'] = "edited";
$this->SubObjects[$object['cn'][0]]['dn'] = $object['dn'];
diff --git a/plugins/admin/fai/class_faiTemplateEntry.inc b/plugins/admin/fai/class_faiTemplateEntry.inc
index 200e0074a6ee3256942c140372d01e29b1c821f0..0399e5d8d5407ff9e1d9234ca3328594594ab4e1 100644 (file)
/* attribute list for save action */
var $ignore_account= TRUE;
- var $attributes = array("Object_cn","Object_description","Object_FAItemplateFile","Object_FAItemplatePath");
+ var $attributes = array("Object_cn","Object_description","Object_FAItemplateFile","Object_FAItemplatePath","Object_FAImode","Object_user","Object_group","Object_binary","Object_FAIowner");
var $objectclasses= array();
var $orig_cn = "";
var $Object_FAItemplatePath = "";
var $Object_description = "";
var $Object_status = "new";
+ var $Object_FAImode = "0640";
+ var $Object_FAIowner = "root.root";
+ var $Object_user = "root";
+ var $Object_group = "root";
+ var $Object_binary = false;
function faiTemplateEntry ($config, $dn= NULL,$object=false)
{
$this->Object_status = "new";
$this->orig_cn = false;
}
+ $this->Object_user = explode( '.', $this->Object_FAIowner );
+ $this->Object_group = $this->Object_user[1];
+ $this->Object_user = $this->Object_user[0];
+ $_SESSION['binary'] = $this->Object_FAItemplateFile;
+ $_SESSION['binarytype'] = 'octet-stream';
+ $_SESSION['binaryfile'] = basename( $this->Object_FAItemplatePath );
}
function execute()
{
/* Fill templating stuff */
$smarty = get_smarty();
+ $smarty->assign("rand", rand(0, 10000));
$display = "";
if(isset($_POST['TmpFileUpload'])){
if($str=file_get_contents($_FILES['FAItemplateFile']['tmp_name'])){
$this->Object_FAItemplateFile = $str;
+
+ /* If we don't have a filename set it from upload filename. */
+ if( 0 == strlen( $this->Object_FAItemplatePath ) )
+ $this->Object_FAItemplatePath = $_FILES['FAItemplateFile']['name'];
}
}
- $status="<br>"._("No file uploaded");
+ $status= _("no file uploaded yet");
if(strlen($this->Object_FAItemplateFile)){
- $status="<br>".sprintf(_("File uploaded, size : %s byte"),strlen($this->Object_FAItemplateFile));
+ $status= sprintf(_("exists in database (size: %s bytes)"),strlen($this->Object_FAItemplateFile));
}
$smarty->assign("status",$status);
}
}
+ /* Assign file modes */
+ $tmode= "$this->Object_FAImode ";
+ foreach (array("s", "u", "g", "o") as $type){
+ $current= substr($tmode, 0, 1);
+ $tmode= preg_replace("/^./", "", $tmode);
+ $nr= 1;
+ while ($nr < 5){
+ if ($current & $nr){
+ $smarty->assign($type.$nr, "checked");
+ } else {
+ $smarty->assign($type.$nr, "");
+ }
+ $nr+= $nr;
+ }
+ }
+
$smarty->assign("Object_FAItemplateFile","");
- for($i =1 ; $i <= 100 ; $i++){
- $Object_FAIprioritys[$i]=$i;
- }
- $smarty->assign("Object_FAIprioritys",$Object_FAIprioritys);
$display.= $smarty->fetch(get_template_path('faiTemplateEntry.tpl', TRUE));
return($display);
}
/* Save data to object */
function save_object()
{
+ if (!isset($_POST['Object_FAItemplatePath'])){
+ return;
+ }
if(isset($_POST['SubObjectFormSubmitted'])){
foreach($this->attributes as $attrs){
- if($attrs == "Object_FAItemplateFile") continue;
+ if($attrs == "Object_FAItemplateFile")
+ continue;
+ if($attrs == "Object_FAIowner") {
+ $this->$attrs = $_POST["Object_user"] . '.' . $_POST["Object_group"];
+ continue;
+ }
if(isset($_POST[$attrs])){
$this->$attrs = $_POST[$attrs];
}else{
}
}
}
+
+ /* Save mode */
+ $tmode= "";
+ foreach (array("s", "u", "g", "o") as $type){
+ $nr= 1;
+ $dest= 0;
+ while ($nr < 5){
+ if (isset($_POST["$type$nr"])){
+ $dest+= $nr;
+ }
+ $nr+= $nr;
+ }
+ $tmode= $tmode.$dest;
+ }
+ $this->Object_FAImode= $tmode;
}
/* Check supplied data */
if(empty($this->Object_cn)){
$message[] = _("Please enter a name.");
}
-
- if(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
+ elseif(preg_match("/[^0-9a-z]/i",$this->Object_cn)){
$message[] = _("Please enter a valid name. Only a-Z 0-9 are allowed.");
}
+
+ if(empty($this->Object_user)){
+ $message[] = _("Please enter a user.");
+ }
+ elseif(preg_match("/[^0-9a-z]/i",$this->Object_user)){
+ $message[] = _("Please enter a valid user. Only a-Z 0-9 are allowed.");
+ }
+
+ if(empty($this->Object_group)){
+ $message[] = _("Please enter a group.");
+ }
+ elseif(preg_match("/[^0-9a-z]/i",$this->Object_group)){
+ $message[] = _("Please enter a valid group. Only a-Z 0-9 are allowed.");
+ }
+
return ($message);
}
index 022e16f867eefcf32c26e8a3b14eff26d73f768c..bbb5b8fbc2ea210baeb964c3cc0a8975b1ab8aec 100644 (file)
{html_options options=$usedPackages}
</select>
<br>
- <input type="submit" name="Addpkg" value="+" {$OptionsACL}>
- <input type="submit" name="Delpkg" value="-" {$OptionsACL}>
- <input type="submit" name="Conpkg" value="Configure" {$OptionsACL} disabled>
+ <input type="submit" name="Addpkg" value="{t}Add{/t}" {$OptionsACL}>
+ <input type="submit" name="Delpkg" value="{t}Remove{/t}" {$OptionsACL}>
+ <input type="submit" name="Conpkg" value="{t}Configure{/t}" {$OptionsACL} disabled>
</td>
</tr>
</table>
diff --git a/plugins/admin/fai/faiPackageConfiguration.tpl b/plugins/admin/fai/faiPackageConfiguration.tpl
index 4d0de8e8e08427e31209fe2b1ffc9ce2851b96f9..1bd55ddf2dead58e9b960c371d3f4cb66d586c2c 100644 (file)
<input name="SaveObjectConfig" value="Use" type="submit">
<input name="CancelObjectConfig" value="Cancel" type="submit">
</div>
-<input type="hidden" name="ignore">
index e2edeff86ea36049aa10ed96c790a23f907dc4b4..6c1a17e26c707dc09bd77fa81b9459ea07327441 100644 (file)
</tr>
</table>
<div align="right" style="align:right;">
- <input name="SaveSubObject" value="Use" type="submit">
+ <input name="SaveSubObject" value="Add" type="submit">
<input name="CancelSubObject" value="Cancel" type="submit">
</div>
<input type="hidden" name="ignore">
index 258a6fd58d855c610c2cabcf7753305a5f8014fb..3458d88c19913d44740f38ed1b3343b69b61ad43 100644 (file)
<input name="SaveObjectNew" value="{t}Continue{/t}" type="submit" {$ContinueACL}>
<input name="edit_cancel" value="{t}Cancel{/t}" type="submit">
</div>
-<input type="hidden" name="ignore">
index b49352384050b7e1aff3451dab5e55e587064bde..62c4788fb4c711e85cd5d2276bcf87bda56be47f 100644 (file)
</tr>
</table summary="">
<div align="right" style="align:right;">
- <input name="SaveSubObject" value="Use" type="submit">
+ <input name="SaveSubObject" value="Add" type="submit">
<input name="CancelSubObject" value="Cancel" type="submit">
</div>
-<input type="hidden" name="ignore">
index 7f6b7ada08836ab4b1afe7b899c36f31797bc082..0017e6095012e2b3bb2d43019a4dc1c5887bcddb 100644 (file)
<input type="file" name="ImportFile">
<input type="submit" name="ImportUpload" value="{t}Import script{/t}">
</div>
-
<br>
<div style="align:right;" align="right">
<input type="submit" value="{t}Save{/t}" name="SaveSubObject">
index 6afe0286f7323f39e287d9e015899f105fef48c9..8f838e28ade277cdc537f41c857057b1bceebdde 100644 (file)
<input type="hidden" name="SubObjectFormSubmitted" value="1">
+
+<h2><img alt="" src="images/house.png" valign="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2>
<table width="100%" summary="">
- <tr>
- <td valign="top" width="50%">
- <h2><img alt="" src="images/house.png" align="middle" title="{t}Generic{/t}"> {t}Generic{/t}</h2>
- <table>
- <tr>
- <td>
- {t}Name{/t}{$must}
- </td>
- <td>
- <input value="{$Object_cn}" name="Object_cn">
- </td>
- </tr>
- <tr>
- <td>
- {t}Description{/t}
- </td>
- <td>
- <input size=40 value="{$Object_description}" name="Object_description">
- </td>
- </tr>
- </table>
- </td>
- <td style="border-left: 1px solid rgb(160, 160, 160);">
-
- </td>
+<tr>
+ <td width="50%">
+ {t}Name{/t}{$must}
+ <input value="{$Object_cn}" name="Object_cn" size="13">
+ </td>
+ <td>
+ {t}Description{/t}
+ <input size="35" value="{$Object_description}" name="Object_description">
+ </td>
+</tr>
+</table>
+
+<p class="seperator"> </p>
+
+<table width="100%" summary="">
+<tr>
+ <td colspan=2><h2><img alt="" src="images/fai_template.png" valign="middle" title="{t}Template attributes{/t}"> {t}Template attributes{/t}</h2></td>
+</tr>
+<tr>
+ <td style="vertical-align:top;width:50%;border-right:1px solid #B0B0B0">
+ <table>
+ <tr>
+ <td style="vertical-align:top">
+ <LABEL for="Object_FAItemplateFile">
+ {t}File{/t}{$must}
+ </LABEL>
+ </td>
+ <td style="vertical-align:top">
+ {$status}
+ {if $Object_FAItemplatePath}
+ <a href="getbin.php?rand={$rand}"><img alt="{t}Save template{/t}..." title="{t}Save template{/t}..." src="images/save.png" border="0" align="center" /></a>
+ {/if}
+ <br>
+ <br>
+ <input type="file" name="FAItemplateFile" value="{$Object_FAItemplateFile}" id="Object_FAItemplateFile">
+ <input type="submit" value="{t}Upload{/t}" name="TmpFileUpload">
+ <br>
+ <br>
+ </td>
+ </tr><tr>
+ <td>
+ <LABEL for="Object_FAItemplatePath">
+ {t}Destination path{/t}{$must}
+ </LABEL>
+ </td>
+ <td>
+ <input type="text" name="Object_FAItemplatePath" value="{$Object_FAItemplatePath}" id="Object_FAItemplatePath" size="45">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr>
+
+ <td>
+ <LABEL for="Object_user">
+ {t}Owner{/t}{$must}
+ </LABEL>
+ </td>
<td>
- <h2><img alt="" src="images/fai_template.png" align="middle" title="{t}Template attributes{/t}"> {t}Template attributes{/t}</h2>
- <table width="100%">
- <tr>
- <td>
- <LABEL for="Object_FAItemplateFile">
- {t}File{/t}{$must}
- </LABEL>
- </td>
- <td>
- <input type="file" name="FAItemplateFile" value="{$Object_FAItemplateFile}" id="Object_FAItemplateFile">
- <input type="submit" value="{t}upload{/t}" name="TmpFileUpload">
- {$status}
- </td>
- </tr>
- <tr>
- <td>
- <LABEL for="Object_FAItemplatePath">
- {t}Destination path{/t}{$must}
- </LABEL>
- </td>
- <td>
- <input type="text" name="Object_FAItemplatePath" value="{$Object_FAItemplatePath}" id="Object_FAItemplatePath">
- </td>
- </tr>
- </table>
+ <input type="text" name="Object_user" value="{$Object_user}" id="Object_user" size="15">
+ </td>
+ </tr><tr>
+ <td style="vertical-align:top">
+ <LABEL for="Object_group">
+ {t}Group{/t}{$must}
+ </LABEL>
+ </td>
+ <td>
+ <input type="text" name="Object_group" value="{$Object_group}" id="Object_group" size="15">
+ <br>
+ <br>
+ </td>
+ </tr><tr>
+ <td style="vertical-align:top">{t}Access{/t}{$must} </td>
+ <td>
+ <table style="border:1px solid #B0B0B0">
+ <colgroup width="55" span="3">
+ </colgroup>
+ <tr>
+ <th>{t}Class{/t}</th>
+ <th>{t}Read{/t}</th>
+ <th>{t}Write{/t}</th>
+ <th>{t}Execute{/t}</th>
+ <th> </th>
+ <th>{t}Special{/t}</th>
+ <th> </th>
+ </tr>
+ <tr><td>{t}User{/t}</td>
+ <td align="center"><input type="checkbox" name="u4" value="4" {$u4}></td>
+ <td align="center"><input type="checkbox" name="u2" value="2" {$u2}></td>
+ <td align="center"><input type="checkbox" name="u1" value="1"> {$u1}</td>
+ <td> </td>
+ <td align="center"><input type="checkbox" name="s4" value="4" {$s4}></td>
+ <td>({t}SUID{/t})</td>
+ </tr>
+
+ <tr><td>{t}Group{/t}</td>
+ <td align="center"><input type="checkbox" name="g4" value="4" {$g4}></td>
+ <td align="center"><input type="checkbox" name="g2" value="2" {$g2}></td>
+ <td align="center"><input type="checkbox" name="g1" value="1" {$g1}></td>
+ <td> </td>
+ <td align="center"><input type="checkbox" name="s2" value="2" {$s2}></td>
+ <td>({t}GUID{/t})</td>
+ </tr>
+
+ <tr><td>{t}Others{/t}</td>
+ <td align="center"><input type="checkbox" name="o4" value="4" {$o4}></td>
+ <td align="center"><input type="checkbox" name="o2" value="2" {$o2}></td>
+ <td align="center"><input type="checkbox" name="o1" value="1" {$o1}></td>
+ <td> </td>
+ <td align="center"><input type="checkbox" name="s1" value="1" {$s1}></td>
+ <td>({t}sticky{/t})</td>
+ </tr>
</td>
- </tr>
-</table>
+ </tr></table>
+
+ </td></tr></table>
+ </td>
+</tr>
+<tr>
+<td colspan=2>
+<br>
<p class="seperator"> </p>
<br>
<div style="align:right;" align="right">
<input type="submit" value="{t}Save{/t}" name="SaveSubObject">
<input type="submit" value="{t}Cancel{/t}" name="CancelSubObject">
</div>
-
+</td>
+</tr>
+</table>