summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ac74ce1)
raw | patch | inline | side by side (parent: ac74ce1)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 23 Aug 2005 09:47:33 +0000 (09:47 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 23 Aug 2005 09:47:33 +0000 (09:47 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1206 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_servNfs.inc | [new file with mode: 0644] | patch | blob |
plugins/admin/systems/class_servService.inc | patch | blob | history | |
plugins/admin/systems/servnfs.tpl | [new file with mode: 0644] | patch | blob |
plugins/admin/systems/servservice.tpl | patch | blob | history |
diff --git a/plugins/admin/systems/class_servNfs.inc b/plugins/admin/systems/class_servNfs.inc
--- /dev/null
@@ -0,0 +1,153 @@
+<?php
+
+class servnfs extends plugin
+{
+ /* CLI vars */
+ var $cli_summary = "Manage server objects";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* attribute list for save action */
+ var $ignore_account = TRUE;
+ var $attributes = array("NFSdescription","NFStype","NFScharset","NFSpath","NFSoption");
+ var $objectclasses = array("whatever");
+ var $is_account = true;
+
+ var $NFSname =""; // Name of NFS
+ var $NFSdescription =""; // description
+ var $NFStype =""; // Type NFS/Samba/NCP
+ var $NFScharset =""; // charset
+ var $NFStypes =array(); // Array Types NFS/Samba/NCP
+ var $NFScharsets =array(); // Array with charsets
+ var $NFSpath =""; // Path
+ var $NFSoption =""; // Options
+ var $is_edit =false;
+
+
+ function servnfs ($config, $dn= NULL,$entry = false)
+ {
+ plugin::plugin ($config, $dn);
+ $this->NFStypes = array("NFS"=>"NFS","samba"=>"samba","NCP"=>"NCP");
+ $this->NFScharsets = array("UTF-8" => "UTF-8",
+ "ISO8859-1"=>"ISO8859-1 (Latin 1)",
+ "ISO8859-2"=>"ISO8859-2 (Latin 2)",
+ "ISO8859-3"=>"ISO8859-3 (Latin 3)",
+ "ISO8859-4"=>"ISO8859-4 (Latin 4)",
+ "ISO8859-5"=>"ISO8859-5 (Latin 5)");
+
+ if($entry){
+ $tmp = split("\|",$entry);
+ $this->NFSname = $tmp[0]; // Name of NFS
+ $this->NFSdescription = $tmp[1]; // description
+ $this->NFStype = $tmp[2]; // Type NFS/Samba/NCP
+ $this->NFScharset = $tmp[3]; // charset
+ $this->NFSpath = $tmp[4]; // Path
+ $this->NFSoption = $tmp[5]; // Options
+ $this->is_edit = true;
+ }else{
+ $this->attributes[] = "NFSname";
+ }
+ }
+
+ function execute()
+ {
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+
+ $smarty->assign("NFScharsets" ,$this->NFScharsets);
+ $smarty->assign("NFStypes" ,$this->NFStypes);
+
+ /* attrs to smarty*/
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+
+ $smarty->assign("NFSnameACL","");
+
+ if($this->is_edit){
+ $smarty->assign("NFSnameACL"," disabled ");
+ $smarty->assign("NFSname","");
+ }
+
+ $display= $smarty->fetch(get_template_path('servnfs.tpl', TRUE));
+ return($display);
+ }
+
+ function remove_from_parent()
+ {
+ /* This cannot be removed... */
+ }
+
+
+ /* Save data to object */
+ function save_object()
+ {
+ plugin::save_object(TRUE);
+ if(isset($_POST['NFSpath'])){
+ foreach($this->attributes as $attr){
+ $this->$attr = $_POST[$attr];
+ }
+ }
+ }
+
+
+ /* Check supplied data */
+ function check()
+ {
+ $message= array();
+
+ // fixme : a check for the path ? ?
+ if(empty($this->NFSpath)){
+ $message[]=_("Please specify a valid path for your setup.");
+ }
+
+ // only 0-9a-z
+ if(!$this->is_edit){
+ if(preg_match("/[^a-z0-9]/i",$this->NFSname)){
+ $message[]=_("Please specify a valid name for your setup.");
+ }
+ if(empty($this->NFSname)){
+ $message[]=_("Please specify a name for your setup.");
+ }
+ }
+
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(objectClass=goShareServer)", array("goExportEntry"));
+ while($test = $ldap->fetch()){
+ if($test['dn']==$this->dn)
+ continue;
+ foreach($test['goExportEntry'] as $entry){
+ $tmp = split("\|",$entry);
+ if($tmp[0] == $this->NFSname){
+ $message[]="Name already in use";
+ }
+ }
+ }
+ return ($message);
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ /* Everything seems perfect, lets
+ generate an new export Entry
+ */
+
+ $s_return = "";
+
+ $s_return.= $this->NFSname."|";
+ $s_return.= $this->NFSdescription."|";
+ $s_return.= $this->NFStype."|";
+ $s_return.= $this->NFScharset."|";
+ $s_return.= $this->NFSpath."|";
+ $s_return.= $this->NFSoption;
+
+ return(array($this->NFSname=>$s_return));
+ }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc
index 176316384f03c099ec88fbfbfcfb2b632a031b7e..020f6d58d5b26eab772e6dce69362aab2269b948 100644 (file)
var $goTerminalServer="";
var $goSyslogServer="";
var $goCupsServer="";
+ var $o_subWindow = NULL;
/* attribute list for save action */
var $ignore_account= TRUE;
var $attributes = array("goLdapBase","goXdmcpIsEnabled","goFontPath");
- var $possible_objectclasses= array( "goNfsServer", "goNtpServer", "goServer", "goLdapServer",
+ var $possible_objectclasses= array( "goShareServer", "goNtpServer", "goServer", "goLdapServer",
"goTerminalServer", "goSyslogServer", "goCupsServer");
var $objectclasses = array("top","goServer");
- var $additionaloc = array( "goNfsServer" => array("goExportEntry"),
+ var $additionaloc = array( "goShareServer" => array("goExportEntry"),
"goNtpServer" => array("goTimeSource"),
"goLdapServer" => array("goLdapBase"),
"goTerminalServer"=> array("goXdmcpIsEnabled", "goFontPath"),
}
/* Load arrays */
- foreach (array("goTimeSource", "goExportEntry") as $name){
+ foreach (array("goTimeSource") as $name){
$tmp= array();
if (isset($this->attrs[$name])){
for ($i= 0; $i<$this->attrs[$name]['count']; $i++){
$this->$name= $tmp;
}
+ $tmp =array();
+ $tmp2=array();
+ unset($this->attrs['goExportEntry']['count']);
+ if((isset($this->attrs['goExportEntry']))&&(isset($this->attrs['goExportEntry']))){
+ foreach($this->attrs['goExportEntry'] as $entry){
+ $tmp2= split("\|",$entry);
+ $tmp[$tmp2[0]]= $entry;
+ }
+ }
+ $this->goExportEntry = $tmp;
+
/* Always is account... */
$this->is_account= TRUE;
}
+ function addToList($entry){
+ $key = key($entry);
+ $this->goExportEntry[$key]=$entry[$key];
+ }
+
+ function deleteFromList($id){
+ unset($this->goExportEntry[$id]);
+ }
+
function execute()
{
$smarty->assign("staticAddress", "");
- /* Here we add a new entry */
- if(isset($_POST['NewNfsAdd']) && $_POST['NewNfsExport'] != "") {
- $this->goExportEntry[$_POST['NewNfsExport']]= $_POST['NewNfsExport'];
- asort($this->goExportEntry);
+ if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntry']))){
+ $this->deleteFromList($_POST['goExportEntry']);
}
- /* Deleting an Entry, is a bit more complicated than adding one*/
- if(isset($_POST['DelNfsEnt']) && isset($_POST['goExportEntry'])) {
- foreach ($_POST['goExportEntry'] as $entry){
- if (isset($this->goExportEntry[$entry])){
- unset($this->goExportEntry[$entry]);
+ if(isset($_POST['NewNfsAdd'])){
+ $this->o_subWindow = new servnfs($this->config, $this->dn);
+ $this->dialog = true;
+ }
+
+ if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntry']))){
+ $entry = $this->goExportEntry[$_POST['goExportEntry']];
+ $this->o_subWindow = new servnfs($this->config, $this->dn,$entry);
+ $this->dialog = true;
+ }
+
+ if(isset($this->o_subWindow)){
+ $this->o_subWindow->save_object(TRUE);
+ }
+
+ /* Save NFS setup */
+ if(isset($_POST['NFSsave'])){
+ if(count($this->o_subWindow->check())>0){
+ foreach($this->o_subWindow->check() as $msg) {
+ print_red($msg);
}
+ }else{
+ $this->o_subWindow->save_object();
+ $newone = $this->o_subWindow->save();
+ $this->addToList($newone) ;
+ unset($this->o_subWindow);
+ $this->dialog = false;
}
}
+
+ /* Cancel NFS setup */
+ if(isset($_POST['NFScancel'])){
+ unset($this->o_subWindow);
+ $this->dialog = false;
+ }
+
+ /* Execute NFS setup dialog*/
+ if(isset($this->o_subWindow)){
+ return $this->o_subWindow->execute();
+ }
/* Here we add a new entry */
if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "") {
$smarty->assign("$attr"."ACL", chkacl($this->acl, $attr));
$smarty->assign($attr."State","");
}
-
- /* Arrays */
- foreach (array("goTimeSource", "goExportEntry") as $name){
- $smarty->assign("$name", $this->$name);
- $smarty->assign("$name"."ACL", chkacl($this->acl, $name));
- $smarty->assign($name."State","");
+
+ $tellSmarty=array();
+ foreach($this->goExportEntry as $name=>$values){
+ $tmp = split("\|",$values);
+ $tellSmarty[$name] = $tmp[0]." ".$tmp[4];
}
+ $smarty->assign("goExportEntry",array_keys($tellSmarty));
+ $smarty->assign("goExportEntryKeys",($tellSmarty));
+ $smarty->assign("goExportEntryACL", chkacl($this->acl, "goExportEntry"));
+
+ $smarty->assign("goTimeSource", $this->goTimeSource);
+ $smarty->assign("goTimeSourceACL", chkacl($this->acl, "goTimeSource"));
+ $smarty->assign("goTimeSourceState","");
+
/* Classes... */
foreach ($this->additionaloc as $oc => $dummy){
}
}
+ if(!count($this->goExportEntry)){
+ $smarty->assign("goShareServerState", " disabled ");
+ }
+
/* Different handling for checkbox */
if($this->goXdmcpIsEnabled == "true"){
$smarty->assign("goXdmcpIsEnabled","checked");
/* Save to LDAP */
function save()
{
+
plugin::save();
$tmp= array();
$this->attrs[$name][]= $element;
}
}
+
+ $oc = array();
+ foreach($this->attrs['objectClass'] as $name){
+ if($name!="goNfsServer"){
+ $oc[]=$name;
+ }
+ }
+ $this->attrs['objectClass']=$oc;
/* Write to LDAP */
$ldap= $this->config->get_ldap_link();
diff --git a/plugins/admin/systems/servnfs.tpl b/plugins/admin/systems/servnfs.tpl
--- /dev/null
@@ -0,0 +1,86 @@
+<h2><img alt="" src="images/select_phone.png" align="middle"> Freigabe bearbeiten</h2>
+<table summary="{t}NFS setup{/t}" width="100%">
+ <tr>
+ <td width="45%">
+ <!--Table left-top-->
+ <table >
+ <tr>
+ <td>
+ {t}Name{/t} {$must}
+ </td>
+ <td>
+ <input type="text" name="NFSname" value="{$NFSname}" {$NFSnameACL}>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Description{/t}
+ </td>
+ <td>
+ <input type="text" name="NFSdescription" value="{$NFSdescription}">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+
+ <!--Table right-top-->
+ <table>
+ <tr>
+ <td>
+ {t}Type{/t}
+ </td>
+ <td>
+ <select size="1" name="NFStype">
+ {html_options options=$NFStypes selected=$NFStype}
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Charset{/t}
+ </td>
+ <td>
+ <select size="1" name="NFScharset">
+ {html_options options=$NFScharsets selected=$NFScharset}
+ </select>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2>
+ <p class="seperator"> </p>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <!--Table bottom-->
+ <table>
+ <tr>
+ <td>
+ {t}Path{/t}
+ </td>
+ <td>
+ <input type="text" name="NFSpath" value="{$NFSpath}">
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ <table>
+ <tr>
+ <td>
+ {t}Option{/t}
+ </td>
+ <td>
+ <input type="text" name="NFSoption" value="{$NFSoption}">
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+</table>
+<input type="submit" name="NFSsave" value="{t}Save{/t}">
+<input type="submit" name="NFScancel" value="{t}Cancel{/t}">
index bb2cbf8dcc17f4bdec598915bb33ecd75db72d48..8cac0f4873f5bd1666612afd008f8d6b6319eb88 100644 (file)
<tr>
<td style="vertical-align:top; border-right:1px solid #A0A0A0; padding-right:5px;" width="50%">
- <input type=checkbox name="goNfsServer" value="1" {$goNfsServer} {$goNfsServerACL}
+ <input type=checkbox name="goShareServer" value="1" {$goShareServer} {$goShareServer}
onchange="changeState('goExportEntry');
- changeState('NewNfsExportId');
+ changeState('NewNfsEditId');
changeState('DelNfsEntId');
changeState('NewNfsAddId');">
<table summary="">
<tr>
<td>
- <select style="width:350px;" id="goExportEntry" name="goExportEntry[]" {$goExportEntryACL} {$goNfsServerState} size=4 multiple >
- {html_options values=$goExportEntry output=$goExportEntry}
+ <select style="width:350px;" id="goExportEntry" name="goExportEntry" {$goExportEntryACL} {$goShareServerState} size=4 multiple >
+ {html_options values=$goExportEntry output=$goExportEntryKeys}
<option disabled> </option>
</select>
<br>
- <input type="text" name="NewNfsExport" {$goNfsServerState} id="NewNfsExportId">
- <input type="submit" value="{t}Add{/t}" name="NewNfsAdd" {$goNfsServer} {$goExportEntryACL} {$goNfsServerState} id="NewNfsAddId">
- <input type="submit" value="{t}Delete{/t}" name="DelNfsEnt" {$goNfsServer} {$goExportEntryACL} {$goNfsServerState} id="DelNfsEntId">
+ <input type="submit" value="{t}Edit{/t}" name="NewNfsEdit" {$goShareServer} {$goExportEntryACL} {$goShareServerState} id="NewNfsEditId">
+ <input type="submit" value="{t}Add{/t}" name="NewNfsAdd" {$goShareServer} {$goExportEntryACL} {$goShareServerState} id="NewNfsAddId">
+ <input type="submit" value="{t}Delete{/t}" name="DelNfsEnt" {$goShareServer} {$goExportEntryACL} {$goShareServerState} id="DelNfsEntId">
</td>
</tr>
</table>