summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 68c43f4)
raw | patch | inline | side by side (parent: 68c43f4)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 13 May 2005 11:10:13 +0000 (11:10 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 13 May 2005 11:10:13 +0000 (11:10 +0000) |
plugins/admin/systems/class_servService.inc | patch | blob | history | |
plugins/admin/systems/servservice.tpl | patch | blob | history |
diff --git a/plugins/admin/systems/class_servService.inc b/plugins/admin/systems/class_servService.inc
index 68fdd380b96f194787ec550a88c734d985a49412..cd8788a566b224f6cbe135007099350934f57104 100644 (file)
var $cli_description= "Some longer text\nfor help";
var $cli_parameters= array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ var $goExportEntry = array();
+ var $goTimeSource = array();
+ var $goLdapBase= "";
+ var $goXdmcPlsEnabled= "";
+ var $goFontPath= "";
+ var $goNTPServer="";
+ var $goLdapServer="";
+ var $goTerminalServer="";
+ var $goSyslogServer="";
+ var $goCupsServer="";
+
+
/* attribute list for save action */
- var $attributes= array();
- var $objectclasses= array();
+ var $attributes = array("goExportEntry","goTimeSource","goLdapBase","goXdmcpIsEnabled","goFontPath");
+ var $objectclasses = array("top","goServer");
+ var $additionaloc = array(
+
+ "goNfsServer" => array("goExportEntry"),
+ "goNtpServer" => array("goTimeSource"),
+ "goLdapServer" => array("goLdapBase"),
+ "goTerminalServer"=> array("goXdmcpIsEnabled", "goFontPath")
+// "goSyslogServer" => array(""),
+// "goCupsServer" => array("")
+ );
+
+
+
+
+
+
+
+
function servservice ($config, $dn= NULL)
{
plugin::plugin ($config, $dn);
+ /* Always is account... */
+
+ foreach ($this->additionaloc as $oc => $dummy){
+ if (isset($this->attrs['objectClass']) && in_array($oc, $this->attrs['objectClass'])){
+ $this->objectclasses[$oc]= $oc;
+ }
+ }
/* Always is account... */
$this->is_account= TRUE;
}
+
+
function execute()
{
/* Fill templating stuff */
$smarty= get_smarty();
- return($smarty->fetch (get_template_path('servservice.tpl', TRUE)));
+ /*
+ Handling for Nfs Export Entries
+ */
+
+ /* Here we add a new entry */
+ if(isset($_POST['NewNfsAdd']))
+ {
+ $this->attrs['goExportEntry'][]=$_POST['NewNfsExport'];
+ }
+
+
+
+ /* Deleting an Entry, is a bit more complicated than adding one*/
+ if(isset($_POST['DelNfsEnt']))
+ {
+ /* Go through all entries an skip the selected (The one we want to delete)*/
+ foreach($this->attrs['goExportEntry'] as $key => $val)
+ {
+ /* Add all entries in an new Array, because when deleting one entry, the could be broken*/
+ if(($val != $_POST['goExportEntry'] ))
+ {
+ /* Skip the entry that we want to delete*/
+ $new_arr[]=$val;
+ }
+ }
+ /* Deleting complete so add result to the attrs */
+ $this->attrs['goExportEntry']=$new_arr;
+ }
+
+ /* Set the entry which we want to show in the frontend */
+ $this->goExportEntry = ($this->attrs['goExportEntry']);
+ unset($this->goExportEntry['count']);
+
+
+
+ /*
+ Handling for NTP Export Entries
+ */
+
+ /* Here we add a new entry */
+ if(isset($_POST['NewNTPAdd']))
+ {
+ $this->attrs['goTimeSource'][]=$_POST['NewNTPExport'];
+ }
+
+ /*Deleting an Entry, is a bit more complicated than adding one*/
+ if(isset($_POST['DelNTPEnt']))
+ {
+ /* Go through all entries an skip the selected (The one we want to delete)*/
+ foreach($this->attrs['goTimeSource'] as $key => $val)
+ {
+ /* Add all entries in an new Array, because wehn deleting one entry, the could be broken*/
+ if($val != $_POST['goTimeSource'] )
+ {
+ /* Skip the entry that we want to delete*/
+ $new_arr[]=$val;
+ }
+ }
+ /* Deleting complete so add result to the attrs */
+ $this->attrs['goTimeSource']=$new_arr;
+ }
+
+ /* Set the entry which we want to show in the frontend */
+ $this->goTimeSource = ($this->attrs['goTimeSource']);
+ unset($this->goTimeSource['count']);
+
+
+
+
+ /* Attributes... */
+ foreach ($this->attributes as $attr){
+ $smarty->assign("$attr", $this->$attr);
+ $smarty->assign("$attr"."ACL", chkacl($this->acl, $attr));
+ }
+
+
+ /* Classes... */
+ foreach ($this->additionaloc as $oc => $dummy){
+ if (isset($this->objectclasses[$oc])){
+ $smarty->assign("$oc", "checked");
+ $smarty->assign("$oc"."ACL", chkacl($this->acl, $oc));
+ } else {
+ $smarty->assign("$oc"."State", "disabled");
+ }
+ }
+
+ return($smarty->fetch (get_template_path('servservice.tpl', TRUE)));
}
function remove_from_parent()
/* Save data to object */
function save_object()
{
- plugin::save_object();
+ plugin::save_object();
+
+ /* Save checkbox state */
+ foreach ($this->additionaloc as $oc => $dummy){
+ if (isset($_POST[$oc]) && $_POST[$oc] == '1'){
+ $this->objectclasses[$oc]= $oc;
+ } else {
+ unset($this->objectclasses[$oc]);
+ }
+ }
+
}
/* Save to LDAP */
function save()
{
+ /* Normalize lazy objectclass arrays */
+ $objectclasses= array();
+ foreach($this->objectclasses as $oc){
+ $objectclasses[]= $oc;
+ }
+
+ $this->objectclasses= $objectclasses;
plugin::save();
+ /* Remove objectclasses */
+ unset ($this->attrs['objectClass']);
+ foreach($this->objectclasses as $oc){
+ $this->attrs['objectClass'][]= $oc;
+ }
+
+ /* Adapt sieve server if needed */
+ if (in_array('goImapServer', $this->objectclasses)){
+ $this->attrs['goImapSieveServer']= preg_replace('/:.*$/', '',
+ preg_replace('/^{([^}]+)}$/', '\\1',
+ $this->attrs['goImapConnect']));
+ }
+
+ /* Remove unneeded attributes */
+ foreach ($this->additionaloc as $oc => $attrs){
+ if (!in_array($oc, $this->objectclasses)){
+ foreach ($attrs as $attr){
+ $this->attrs[$attr]= array();
+ }
+ }
+ }
+
+ /* Write to LDAP */
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+ show_ldap_error($ldap->get_error());
+
/* Optionally execute a command after we're done */
- #$this->handle_post_events($mode);
+ if ($this->initially_was_account == $this->is_account){
+ if ($this->is_modified){
+ $this->handle_post_events("mofify");
+ }
+ } else {
+ $this->handle_post_events("add");
+ }
+
}
}
index 53a90bffae3d87177f8eeb064b8fc81d1f9a3781..61bf58be91a65ec5fe2c9090592d2613e5fd9600 100644 (file)
-Empty
+{t}Useful lheadline here.{/t}
+<p class="seperator">
+
+</p>
+<table style="width:100%">
+ <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}
+ onchange="changeState('goExportEntry');
+ changeState('NewNfsExportId');
+ changeState('DelNfsEntId');
+ changeState('NewNfsAddId');">
+
+ <b>{t}Nfs Export{/t}</b>
+ <table>
+ <tr>
+ <td>{t}NFS Exports{/t}</td>
+ <td>
+ <select style="width:350px;" id="goExportEntry" name="goExportEntry" {$goNfsServerState} size=4 multiple {$trustmodeACL} {$trusthide}>
+ {html_options values=$goExportEntry output=$goExportEntry}
+ </select>
+ <br>
+ <input type="text" value="enabled" name="NewNfsExport" {$goNfsServerState} id="NewNfsExportId">
+ <input type="submit" value="{t}Add{/t}" name="NewNfsAdd" {$goNfsServerState} id="NewNfsAddId">
+ <input type="submit" value="{t}Delete{/t}" name="DelNfsEnt" {$goNfsServerState} id="DelNfsEntId">
+ </td>
+ </tr>
+ </table>
+
+ <p class="seperator"> </p>
+
+ <br>
+
+ <input type=checkbox name="goNtpServer" value="1" {$goNtpServer} {$goNtpServerACL}
+ onchange="changeState('goTimeEntry');
+ changeState('NewNTPExportId');
+ changeState('DelNTPEntId');
+ changeState('NewNTPAddId');">
+
+ <b>{t}Time Service{/t}</b>
+ <table>
+ <tr>
+ <td>{t}NFS Exports{/t}</td>
+ <td>
+ <select style="width:350px;" id="goTimeEntry" name="goTimeSource" {$goNTPServerState} size=4 multiple {$trustmodeACL} {$trusthide}>
+ {html_options values=$goTimeSource output=$goTimeSource}
+ </select>
+ <br>
+ <input type="text" value="enabled" name="NewNTPExport" {$goNtpServerState} id="NewNTPExportId">
+ <input type="submit" value="{t}Add{/t}" name="NewNTPAdd" {$goNtpServerState} id="NewNTPAddId">
+ <input type="submit" value="{t}Delete{/t}" name="DelNTPEnt" {$goNtpServerState} id="DelNTPEntId">
+ </td>
+ </tr>
+ </table>
+
+
+
+ </td>
+ <td width="50%">
+
+ <input type=checkbox name="goLdapServer" value="1" {$goLdapServer} {$goLdapServerACL}
+ onchange="changeState('goLdapBaseId');">
+
+ <b>{t}LDAP Service{/t}</b>
+
+ <table>
+ <tr>
+ <td>{t}Base{/t}</td>
+ <input type="text" value="enabled" name="goLdapBase" {$goLdapServerState} id="goLdapBaseId">
+ <td>
+ </td>
+ </tr>
+ </table>
+
+
+ <p class="seperator"> </p>
+ <br>
+
+ <input type=checkbox name="goTerminalServer" value="1" {$goTerminalServer} {$goTerminalServerACL}
+ onchange="changeState('FontPathId');
+ changeState('Temporariid');">
+
+ <b>{t}Terminal Service{/t}</b>
+
+ <table>
+ <tr>
+ <td> Font path </td>
+ <td> <input type="text" value="enabled" name="goFontPath" {$goTerminalServerState} id="FontPathId"></td>
+ </tr>
+ <tr>
+ <td>Temporary disable login </td>
+ <td><input type="checkbox" value="1" name="goXdmcpIsEnabled" {$goTerminalServerState} id="Temporariid"> </td>
+ </tr>
+ </table>
+
+
+
+
+ <p class="seperator"> </p>
+ <br>
+
+ <input type=checkbox name="goSyslogServer" value="1" {$goSyslogServer} {$goSyslogServerACL}>
+
+ <b>{t}Syslog Service{/t}</b>
+
+ <p class="seperator"> </p>
+ <br>
+
+
+ <input type=checkbox name="goCupsServer" value="1" {$goCupsServer} {$goCupsServerACL}>
+
+ <b>{t} Print Service{/t}</b>
+ </td>
+ </tr>
+</table>