summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f600123)
raw | patch | inline | side by side (parent: f600123)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Jan 2008 16:18:16 +0000 (16:18 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 17 Jan 2008 16:18:16 +0000 (16:18 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8473 594d385d-05f5-0310-b6e9-bd551577e9d8
46 files changed:
diff --git a/gosa-core/plugins/admin/systems/services/cups/class_goCupsServer.inc b/gosa-core/plugins/admin/systems/services/cups/class_goCupsServer.inc
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-
-class goCupsServer extends goService{
-
- var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server supports cups management.";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goCupsServer");
- var $attributes = array();
- var $StatusFlag = "goCupsServerStatus";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goCupsServer");
-
- var $DisplayName = "";
- var $dn = NULL;
- var $acl;
- var $cn = "";
- var $goCupsServerStatus = "";
- var $view_logged =FALSE;
-
- function goCupsServer(&$config,$dn)
- {
- goService::goService($config,$dn);
- $this->DisplayName = _("Print service");
- }
-
-
- function execute()
- {
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
- $smarty = get_smarty();
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- }
- return($smarty->fetch(get_template_path("goCupsServer.tpl",TRUE,dirname(__FILE__))));
- }
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("Print service");
- $fields['AllowEdit'] = false;
- return($fields);
- }
-
- function check()
- {
- $message = plugin::check();
- return($message);
- }
-
- function save_object()
- {
- plugin::save_object();
- }
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Cups"),
- "plDescription" => _("Print service")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 100,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "start" => _("Start"),
- "stop" => _("Stop"),
- "restart" => _("Restart"),
-
- "plProvidedAcls"=> array()
- ));
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/cups/goCupsServer.tpl b/gosa-core/plugins/admin/systems/services/cups/goCupsServer.tpl
+++ /dev/null
@@ -1,9 +0,0 @@
-<h2>{t}Print Service{/t} {t}enabled{/t}</h2>
-
-<p class='seperator'> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/gosa-core/plugins/admin/systems/services/kiosk/class_goKioskService.inc b/gosa-core/plugins/admin/systems/services/kiosk/class_goKioskService.inc
+++ /dev/null
@@ -1,245 +0,0 @@
-<?php
-
-class goKioskService extends goService{
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goEnvironmentServer");
- var $attributes = array("gotoKioskProfile","cn");
- var $StatusFlag = "";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goKioskService");
-
- var $baseDir = "../kiosk";
- var $filesToAttach = array();
- var $cn = "unknown";
- var $gotoKioskProfiles= array();
- var $gotoKioskProfile = array();
-
- var $server_path = "http://%cn/kiosk";
-
- function goKioskService(&$config,$dn)
- {
- goService::goService($config,$dn);
-
- $this->DisplayName = _("Kiosk profile service");
- $this->baseDir = $this->config->search('environment', 'kioskpath',array('menu','tabs'));
- $this->server_path = preg_replace("/%cn/", $this->cn, $this->server_path);
-
- /* Load list of profiles and check if they still exists */
- if ($this->baseDir == ""){
- print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!"));
- }else{
- $this->gotoKioskProfiles = array();
- if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){
- for($i = 0 ; $i < $this->attrs['gotoKioskProfile']['count']; $i ++){
- $url = $this->attrs['gotoKioskProfile'][$i];
- $this->server_path = preg_replace("/\/[^\/]*$/","",$url);
- $name= preg_replace("/^.*\//","",$url);
- $this->gotoKioskProfiles[] = array('url' => $url ,
- 'name' => $name ,
- 'initial' =>TRUE,
- 'exists' => file_exists($this->baseDir."/".$name));
- }
- }
- }
- }
-
-
- function remove_from_parent()
- {
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*/".$this->cn."/*))",array("cn"));
- $str ="";
- $cnt = 3;
- while($cnt && $attrs = $ldap->fetch()){
- $str .= $attrs['cn'][0].", ";
- $cnt --;
- }
- $str = preg_replace("/, $/","",$str);
- if($cnt != 3){
- print_red(sprintf(_("Can not remove kiosk profile service, it is currently in use by following user(s) : %s."),$str));
- }else{
- goService::remove_from_parent();
- }
- }
-
-
- function execute()
- {
- /* log actions */
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
- /* Fill templating stuff */
- $smarty= get_smarty();
- $display= "";
-
- /* Add new kiosk profile
- * in profile directory ($this->baseDir);
- */
- if((isset($_POST['profileAdd']))&&(isset($_FILES['newProfile']))){
- $file = $_FILES['newProfile'];
- if(!file_exists($this->baseDir.$file['name'])){
- $tmp = array(
- 'url' => "" ,
- 'name' => $file['name'] ,
- 'initial' => FALSE,
- 'tmp_name'=> $file['tmp_name'],
- 'content' => file_get_contents($file['tmp_name']),
- 'exists' => TRUE);
- $this->gotoKioskProfiles[] = $tmp;
- }
- if(!is_writeable($this->baseDir)){
- print_red(sprintf(_("Can't save new kiosk profiles, possibly permission denied for folder: '%s'."),$this->baseDir));
- }
- }
-
- $only_once = true;
- foreach($_POST as $name => $value){
-
- if((preg_match("/^delkiosk_/",$name))&&($only_once)){
-
- /* Get id, name and path */
- $only_once = false;
- $id = preg_replace("/^delkiosk_/","",$name);
- $id = preg_replace("/_.*$/","",$id);
- $name = $this->gotoKioskProfiles[$id]['name'];
- $filename = $this->baseDir."/".$name;
-
- /* check if profile is still in use */
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*".$name.")",array("cn","uid","gotoKioskProfile"));
- $used_by = "";
- $cnt = 3;
- while(($attrs = $ldap->fetch()) && ($cnt)){
- $cnt --;
- $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]);
- if($check == $name){
- $used_by .= $attrs['cn'][0].", ";
- }
- }
- $used_by = preg_replace("/, $/","",$used_by);
- if(!empty($used_by)){
- print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by));
- }else{
- if($this->gotoKioskProfiles[$id]['initial']){
- $res = @unlink($filename);
- if(!$res){
- if(!is_writeable($filename)){
- print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
- }
- if(!file_exists($filename)){
- print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename));
- }
- }
- unset($this->gotoKioskProfiles[$id]);
- }
- }
- }
- }
-
- /* Display list of profiles */
- $divlist = new divSelectBox("KioskProfiles");
- $divlist -> SetHeight (300);
- foreach($this->gotoKioskProfiles as $key => $val ){
- $divlist->AddEntry(array(
- array("string"=>"<a target='_blank' href='getkiosk.php?id=".$val['name']."'>".$val['name']."</a>"),
- array("string"=>"<input type='image' src='images/edittrash.png'
- class='center' alt='delete' name='delkiosk_".$key."'>" ,
- "attach"=>" style='border-right: 0px;width:24px; text-align:center;' ")
- ));
- }
-
- /* Assign all existing profiles to smarty */
- $smarty->assign("divlist",$divlist->DrawList());
- $smarty = get_smarty();
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- }
- $smarty->assign("server_path",$this->server_path);
- return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__))));
- }
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("Kiosk profile service");
- $fields['AllowEdit'] = TRUE;
- $fields['AllowStart'] = false;
- $fields['AllowStop'] = false;
- $fields['AllowRestart'] = false;
- return($fields);
- }
-
- function check()
- {
- $message = plugin::check();
- return($message);
- }
-
- function save()
- {
- goService::save();
-
- $method = $this->server_path."/";
- $method = preg_replace("/\/\/*$/","/",$method);
- $this->attrs['gotoKioskProfile'] = array();
- foreach($this->gotoKioskProfiles as $profile){
- if(!$profile['initial']){
-
- $contents = $profile['content'];
- $path = $this->baseDir."/".$profile['name'];
- $fp = @fopen($path,"w");
- if(!$fp){
- print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
- }else{
- fwrite($fp,$contents,strlen($contents));
- $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
- }
- @unlink($profile['tmp_name']);
- }else{
- $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
- }
- }
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- show_ldap_error($ldap->get_error(),_("Wohl kaum"));
- }
-
-
- function save_object()
- {
- if(isset($_POST['goKioskPosted'])){
- goService::save_object();
- if(isset($_POST['server_path'])){
- $this->server_path = get_post("server_path");
- }
- }
- }
-
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Kiosk"),
- "plDescription" => _("Kiosk profile management")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 100,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array()
- ));
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/kiosk/goKioskService.tpl b/gosa-core/plugins/admin/systems/services/kiosk/goKioskService.tpl
+++ /dev/null
@@ -1,24 +0,0 @@
-<h2><img alt="" class="center" src="images/house.png" align="middle"> <LABEL for="gotoKioskProfile">{t}Kiosk profile management{/t}</ LABEL></h2>
-
- <input type="hidden" name="dialogissubmitted" value="1">
-
-{t}Server path{/t} <input name="server_path" style="width:300px;" value="{$server_path}">
-<br>
-<br>
-{$divlist}
-<input type="file" size=50 name="newProfile" value="{t}Browse{/t}">
-<input type="submit" name="profileAdd" value="{t}Add{/t}">
-
-<p class='seperator'> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goKioskPosted" value="1">
-
-<script language="JavaScript" type="text/javascript">
- <!-- // First input field on page
- focus_field('gotoKioskProfile');
- -->
-</script>
diff --git a/gosa-core/plugins/admin/systems/services/ldap/class_goLdapServer.inc b/gosa-core/plugins/admin/systems/services/ldap/class_goLdapServer.inc
+++ /dev/null
@@ -1,97 +0,0 @@
-<?php
-
-class goLdapServer extends goService{
-
- var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server has goLdapServer defined.";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goLdapServer");
- var $attributes = array("goLdapBase");
- var $StatusFlag = "goLdapServerStatus";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goLdapServer");
-
- var $DisplayName = "";
- var $dn = NULL;
- var $cn = "";
- var $goLdapServerStatus = "";
- var $goLdapBase = "";
- var $view_logged =FALSE;
-
- function goLdapServer(&$config,$dn)
- {
- goService::goService($config,$dn);
- $this->DisplayName = _("LDAP service");
- }
-
-
- function execute()
- {
-
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
- $smarty = get_smarty();
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- }
- $tmp = $this->plInfo();
- foreach($tmp['plProvidedAcls'] as $name => $translated){
- $smarty->assign($name."ACL",$this->getacl($name));
- }
- return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__))));
- }
-
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("LDAP Service");
- $fields['AllowEdit'] = true;
- return($fields);
- }
-
-
-
- function check()
- {
- $message = plugin::check();
- if(empty($this->goLdapBase)){
- $message[] = _("The given base is empty or contains invalid characters.");
- }
- return($message);
- }
-
-
- function save_object()
- {
- if(isset($_POST['goLdapServerPosted'])){
- plugin::save_object();
- }
- }
-
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Ldap"),
- "plDescription" => _("Ldap")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 96,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array(
- "goLdapBase" => _("Ldap base"))
- ));
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/ldap/goLdapServer.tpl b/gosa-core/plugins/admin/systems/services/ldap/goLdapServer.tpl
+++ /dev/null
@@ -1,13 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}LDAP service{/t}</h2>
-{t}LDAP URI{/t}{$must}
-{render acl=$goLdapBaseACL}
-<input type="text" size="80" value="{$goLdapBase}" name="goLdapBase" id="goLdapBaseId">
-{/render}
-
-<p class='seperator'> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goLdapServerPosted" value="1">
diff --git a/gosa-core/plugins/admin/systems/services/nfs/class_servNfs.inc b/gosa-core/plugins/admin/systems/services/nfs/class_servNfs.inc
+++ /dev/null
@@ -1,267 +0,0 @@
-<?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("description","type","charset","path","option", "volume");
- var $objectclasses = array("whatever");
- var $is_account = true;
-
- var $name =""; // Name of
- var $description =""; // description
- var $type =""; // Type FS/Samba/NCP
- var $charset =""; // charset
- var $host =""; // hostname
- var $types =array(); // Array Types NFS/Samba/NCP/netatalk
- var $charsets =array(); // Array with charsets
- var $path =""; // Path
- var $volume =""; // Volume
- var $option =""; // Options
- var $is_edit =false;
- var $create_mount_init = false; //mount entry set for this entry (while editing)?
- var $create_mount = false; //save mount entry
-
- var $parent = NULL;
- var $view_logged = FALSE;
-
- function servnfs (&$config, $parent,$entry= false,$mount =false)
- {
- $this->parent = $parent;
- $dn = $parent->dn;
- plugin::plugin ($config, $dn);
-
- $this->types = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
- if($dn){
- $this->host = substr($dn, 3, strpos($dn, ',')-3);
- }
-
- $this->charsets = array();
-
- if(!file_exists(CONFIG_DIR."/encodings")){
- print_red(sprintf(_("The file '%s/encodings' does not exist, can't get supported charsets."),CONFIG_DIR));
- }else{
- if(!is_readable(CONFIG_DIR."/encodings")){
- print_red(sprintf(_("Can't read '%s/encodings', please check permissions."),CONFIG_DIR));
- }else{
- $fp = fopen(CONFIG_DIR."/encodings","r");
- $i = 100;
- while(!feof($fp)&&$i){
- $i -- ;
- $str = trim(fgets($fp,256));
-
- /* Skip comments */
- if(!preg_match("/^#/",$str)){
- $arr = split("\=",$str);
- if(count($arr)==2){
- $this->charsets[$arr[0]]=$arr[1];
- }
- }
- }
- }
- }
-
- if($entry){
- list($this->name, $this->description, $this->type, $this->charset,
- $this->path, $this->option, $this->volume)= split("\|",$entry."|");
- $this->is_edit = true;
-
- }else{
- $this->attributes[] = "name";
- }
-
-
- $this->create_mount_init = $mount;
- }
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
- /* Fill templating stuff */
- $smarty= get_smarty();
-
- $smarty->assign("charsets" ,$this->charsets);
- $smarty->assign("types" ,$this->types);
-
- /* attrs to smarty*/
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- }
-
- $tmp = $this->parent->plInfo();
- foreach($tmp['plProvidedAcls'] as $name => $translation){
- $smarty->assign($name."ACL",$this->parent->getacl($name));
- }
-
- $smarty->assign("name",$this->name);
- if($this->is_edit){
- $smarty->assign("nameACL", preg_replace("/w/","",$this->parent->getacl("name")));
- }
- $smarty->assign("allow_mounts", $this->parent->allow_mounts);
- $smarty->assign("mount_checked", "");
-
- $smarty->assign("appleMountsACL", $this->getacl("appleMounts"));
-
- if (($this->type == "netatalk") || ($this->type == "NFS")) {
- if ($this->create_mount_init) {
- $smarty->assign("mount_checked", "checked");
- } else {
- $tmp = split(",", $this->dn);
- $clip = $tmp[0] . ",".get_ou('serverou');
- $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
- switch ($this->type) {
- case "netatalk" : {
- $mountdn = "cn=".$this->host.":/".$this->name.",".$mountsdn;
- break;
- }
- case "NFS" : {
- $mountdn = "cn=".$this->host.":".$this->path.",".$mountsdn;
- break;
- }
- default : {
- continue;
- }
- }
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($mountdn, array('dn'));
- $attrs = $ldap->fetch();
- if (count($attrs) > 0) {
- $smarty->assign("mount_checked", "checked");
- }
- }
- }
-
- $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()
- {
- if(isset($_POST['servnfs_posted'])){
-
- foreach($this->attributes as $name){
- if($this->parent->acl_is_writeable($name) && isset($_POST[$name])){
- $this->$name = $_POST[$name];
- }
- }
-
- if ((isset($_POST['netatalk_mount'])) && (($this->type == "netatalk") || ($this->type == "NFS"))) {
- $this->create_mount = true;
- } else {
- $this->create_mount = false;
- }
- }
- }
-
-
- /* Check supplied data */
- function check()
- {
- /* Call common method to give check the hook */
- $message= plugin::check();
-
- // fixme : a check for the path ? ?
- if(empty($this->path)){
- $message[]=_("Please specify a valid path for your setup.");
- }
-
- // only 0-9a-z
- if(!$this->is_edit){
- if(!preg_match("/^[a-z0-9\._äüö]*$/ui",$this->name)){
- $message[]=_("Please specify a valid name for your share.");
- }
- if(empty($this->name)){
- $message[]=_("Please specify a name for your share.");
- }
- }
-
- if(!empty($this->description) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->description)){
- $message[]=_("Description contains invalid characters.");
- }
-
- if(!empty($this->volume) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->volume)){
- $message[]=_("Volume contains invalid characters.");
- }
-
- if(preg_match("/\|/",$this->path)){
- $message[]=_("Path contains invalid characters.");
- }
-
- if(!empty($this->option) && preg_match("/^[^a-z0-9\._äüö,=\+ -]*$/ui",$this->option)){
- $message[]=_("Option contains invalid characters.");
- }
-
- /* remove a / at the end of the path, we neither need it there nor
- * do we want to check for it later.
- */
- if(substr($this->path, -1, 1) == '/') {
- $this->path=substr($this->path, 0, -1);
- }
-
- $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;
- if(isset($test['goExportEntry'])){
- foreach($test['goExportEntry'] as $entry){
- $tmp = split("\|",$entry);
- if($tmp[0] == $this->name){
- $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->name."|";
- $s_return.= $this->description."|";
- $s_return.= $this->type."|";
- $s_return.= $this->charset."|";
- $s_return.= $this->path."|";
- $s_return.= $this->option."|";
- $s_return.= $this->volume;
-
- return(array($this->name=>$s_return));
- }
-
- function should_create_mount() {
- return $this->create_mount;
- }
-
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/nfs/servnfs.tpl b/gosa-core/plugins/admin/systems/services/nfs/servnfs.tpl
+++ /dev/null
@@ -1,144 +0,0 @@
-<h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle"> {t}Edit share{/t}</h2>
-<table summary="{t}NFS setup{/t}" width="100%">
- <tr>
- <td width="45%" style="vertical-align:top">
- <!--Table left-top-->
- <table summary="">
- <tr>
- <td>
- {t}Name{/t} {$must}
- </td>
- <td>
-{render acl=$nameACL}
- <input type="text" name="name" value="{$name}" >
-{/render}
- </td>
- </tr>
- <tr>
- <td>
- {t}Description{/t}
- </td>
- <td>
-{render acl=$descriptionACL}
- <input type="text" size="40" name="description" value="{$description}">
-{/render}
- </td>
- </tr>
- <tr>
- <td>
- {t}Path{/t} / {t}Volume{/t}
- </td>
- <td>
-{render acl=$pathACL}
- <input type="text" size="40" name="path" value="{$path}">
-{/render}
- </td>
- </tr>
- <tr>
- <td>
- <div id="vlabel">{t}Server{/t}</div>
- </td>
- <td>
-{render acl=$volumeACL}
- <input type="text" id="volume" size="40" name="volume" value="{$volume}">
-{/render}
- </td>
- </tr>
- </table>
- </td>
- <td style="border-left:1px solid #A0A0A0">
-
- <!--Table right-top-->
- <table summary="">
- <tr>
- <td style="vertical-align:top">
-
- {t}Type{/t}
- </td>
- <td>
-{render acl=$typeACL}
- <select size="1" name="type" id="sharetype">
- {html_options options=$types selected=$type}
- </select>
-{/render}
- {if $allow_mounts == TRUE}
- <br><br>
-{render acl=$netatalkmountACL}
- <input type="checkbox" name="netatalk_mount" id="netatalk_mount" {$mount_checked} />
-{/render}
- <label for="netatalk_mount">{t}Auto-mount share on Apple systems{/t}</label>
- <br>
- <br>
- {/if}
-
- {literal}
- <script language="JavaScript">
- document.getElementById('sharetype').onchange=function() {
- var foobar=this[this.selectedIndex].value;
- var box=document.getElementById('netatalk_mount');
- var volume=document.getElementById('volume');
- var vlabel=document.getElementById('vlabel');
- {/literal}
- <!-- Only add checkbox enable/disable js part if checkbox is available -->
- {if $allow_mounts == TRUE}
- {literal}
- if(foobar=="NFS"||foobar=="netatalk"){
- box.disabled=false;
- } else {
- box.disabled=true;
- box.checked=false;
- }
- {/literal}
- {/if}
- {literal}
- if(foobar=="NCP"){
- volume.style.visibility="visible";
- vlabel.style.visibility="visible";
- } else {
- volume.style.visibility="hidden";
- vlabel.style.visibility="hidden";
- }
- };
- document.getElementById('sharetype').onchange();
- </script>
- {/literal}
- </td>
- </tr>
- <tr>
- <td>
- {t}Codepage{/t}
- </td>
- <td>
-{render acl=$charsetACL}
- <select size="1" name="charset">
- {html_options options=$charsets selected=$charset}
- </select>
-{/render}
- </td>
- </tr>
- <tr>
- <td>
- {t}Option{/t}
- </td>
- <td>
-{render acl=$optionACL}
- <input type="text" name="option" value="{$option}">
-{/render}
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td colspan=2>
- <p class="seperator"> </p>
- </td>
- </tr>
- <tr>
- <td colspan=2 style="text-align:right">
- <input type="submit" name="NFSsave" value="{t}Save{/t}">
- <input type="submit" name="NFScancel" value="{t}Cancel{/t}">
- </td>
- </tr>
-</table>
-<input type='hidden' name='servnfs_posted' value='1'>
diff --git a/gosa-core/plugins/admin/systems/services/ntp/class_goNtpServer.inc b/gosa-core/plugins/admin/systems/services/ntp/class_goNtpServer.inc
+++ /dev/null
@@ -1,147 +0,0 @@
-<?php
-
-class goNtpServer extends goService{
-
- var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goNtpServer");
- var $attributes = array("goTimeSource");
- var $StatusFlag = "goNtpServerStatus";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goNtpServer");
-
- var $DisplayName = "";
- var $dn = NULL;
- var $goTimeSource = array();
- var $goNtpServerStatus= "";
- var $acl;
- var $cn = "";
- var $view_logged =FALSE;
-
- function goNtpServer(&$config,$dn)
- {
- goService::goService($config,$dn);
- $this->DisplayName = _("Time service (NTP)");
-
- /* Load arrays */
- $tmp = array();
- if (isset($this->attrs['goTimeSource'])){
- for ($i= 0; $i<$this->attrs['goTimeSource']['count']; $i++){
- $tmp[$this->attrs['goTimeSource'][$i]]= $this->attrs['goTimeSource'][$i];
- }
- }
- $this->goTimeSource= $tmp;
- }
-
-
- function execute()
- {
- $smarty = get_smarty();
-
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
- /* Here we add a new entry */
- if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && $this->acl_is_writeable("goTimeSource")) {
- $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
- asort($this->goTimeSource);
- }
-
- /* Deleting an Entry, is a bit more complicated than adding one*/
- if((isset($_POST['DelNTPEnt'])) && (isset($_POST['goTimeSource'])) && $this->acl_is_writeable("goTimeSource")) {
- foreach ($_POST['goTimeSource'] as $entry){
- if (isset($this->goTimeSource[$entry])){
- unset($this->goTimeSource[$entry]);
- }
- }
- }
-
- $smarty->assign("goNtpServerACL", $this->getacl("goNtpServer")) ;
- $smarty->assign("goTimeSource" , $this->goTimeSource);
- return($smarty->fetch(get_template_path("goNtpServer.tpl",TRUE,dirname(__FILE__))));
- }
-
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("Time service (NTP)");
- $fields['AllowEdit'] = true;
- return($fields);
- }
-
-
- function save()
- {
- plugin::save();
- $this->attrs['goTimeSource'] =array();
- foreach($this->goTimeSource as $entry){
- $this->attrs['goTimeSource'][] = $entry;
- }
- /* Check if this is a new entry ... add/modify */
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- }else{
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- }
- show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/goNtpServer with dn '%s' failed."),$this->dn));
- if($this->initially_was_account){
- $this->handle_post_events("modify");
- new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }else{
- $this->handle_post_events("add");
- new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }
- }
-
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Time service"),
- "plDescription" => _("Time service - NTP")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 91,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array(
- "goTimeSource" =>_("Ntp source"))
- ));
- }
-
-
- function PrepareForCopyPaste($source)
- {
- plugin::PrepareForCopyPaste($source);
-
- /* Load arrays */
- $tmp = array();
- if (isset($source['goTimeSource'])){
- for ($i= 0; $i<$source['goTimeSource']['count']; $i++){
- $tmp[$source['goTimeSource'][$i]]= $source['goTimeSource'][$i];
- }
- }
- $this->goTimeSource= $tmp;
-
-
- }
-
- function check(){ return array();}
-
- function save_object(){;}
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/ntp/goNtpServer.tpl b/gosa-core/plugins/admin/systems/services/ntp/goNtpServer.tpl
+++ /dev/null
@@ -1,32 +0,0 @@
-<br>
-<h2>{t}Time server{/t}</h2>
-<br>
-<table summary="" style="width:100%">
-<tr>
- <td>
-{render acl=$goNtpServerACL}
- <select style="width:100%;" id="goTimeEntry" name="goTimeSource[]" size=8 multiple>
- {html_options values=$goTimeSource output=$goTimeSource}
- <option disabled> </option>
- </select>
-{/render}
-<br>
-{render acl=$goNtpServerACL}
- <input type="text" name="NewNTPExport" id="NewNTPExportId">
-{/render}
-{render acl=$goNtpServerACL}
- <input type="submit" value="{t}Add{/t}" name="NewNTPAdd" id="NewNTPAddId">
-{/render}
-{render acl=$goNtpServerACL}
- <input type="submit" value="{t}Delete{/t}" name="DelNTPEnt" id="DelNTPEntId">
-{/render}
-</td>
-</tr>
-</table>
-
-<p class="seperator"> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
diff --git a/gosa-core/plugins/admin/systems/services/repository/class_divListRepositories.inc b/gosa-core/plugins/admin/systems/services/repository/class_divListRepositories.inc
+++ /dev/null
@@ -1,84 +0,0 @@
-<?php
-
-class divListRepository extends MultiSelectWindow
-{
- /* CheckBoxes, to change default values modify $this->AddCheckBox */
- var $parent ;
- var $ui ;
-
- var $regex ="*";
-
- function divListRepository ($config,$parent)
- {
- MultiSelectWindow::MultiSelectWindow($config,"Repository", "server");
-
- $this->parent = $parent;
- $this->ui = get_userinfo();
-
- $this->SetTitle("repositories");
- $this->SetSummary(_("List of configured repositories."));
- $this->SetInformation(_("This menu allows you to create, delete and edit repository settings."));
- $this->EnableCloseButton(FALSE);
- $this->EnableSaveButton(FALSE);
- $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'"));
- $this->AddHeader(array("string"=>_("Sections")));
- $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'"));
- $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE);
- $this->EnableAplhabet(TRUE);
- }
-
- function GenHeader()
- {
- if($this->parent->acl_is_createable()){
- $this->SetListHeader("<input type=\"image\" src=\"images/fai_new_packages.png\" title=\""._("Add repository")."\" name=\"AddRepository\">");
- }
- }
-
- function execute()
- {
- $this->ClearElementsList();
- $this->GenHeader();
- }
-
- function setEntries($list)
- {
- $link = "<a href='?plug=".$_GET['plug']."&act=open_repository&id=%s'>%s</a>";
- $edit = "<input type='image' value='%s' name='edit_%s' src='images/edit.png'> ";
-
- /* Hide delete icon, if delete is not allowed */
- if($this->parent->acl_is_removeable()){
- $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
- }else{
- $delete = "<img src='images/empty.png' alt=' '>";
- }
-
- foreach($list as $name => $reps){
-
- $str = " ";
- if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){
- foreach($reps['Sections'] as $sec){
- $str.=$sec." ";
- }
- $this->AddElement(array(
- array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
- array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
- array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text- align:right;'")
- ));
- }
- }
-
- }
-
- function Save()
- {
- MultiSelectWindow :: Save();
- }
-
- function save_object()
- {
- /* Save automatic created POSTs like regex, checkboxes */
- MultiSelectWindow :: save_object();
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/repository/class_servRepository.inc b/gosa-core/plugins/admin/systems/services/repository/class_servRepository.inc
+++ /dev/null
@@ -1,366 +0,0 @@
-<?php
-
-class servrepository extends goService
-{
- /* CLI vars */
- var $cli_summary = "Manage server basic 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("FAIrepository");
- var $objectclasses = array("FAIrepositoryServer");
-
- /* Repositories */
- var $repositories = array();
- var $FAIrepository = array();
- var $conflicts = array("FAIrepositoryServer");
- var $DisplayName = "";
- var $StatusFlag = "";
-
- var $view_logged = FALSE;
- var $fai_activated = FALSE;
-
- var $divlist = NULL;
-
- function servrepository (&$config, $dn= NULL, $parent= NULL)
- {
- plugin::plugin ($config, $dn, $parent);
-
- $this->DisplayName = _("Repository service");
-
- /* Skip this if fai is deactivated */
- $tmp= $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
- if(!empty($tmp)){
- $this->fai_activated = TRUE;
- }else{
- return;
- }
-
- $this->repositories = array();
- if(isset($this->attrs['FAIrepository'])){
- for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
- $tmp = split("\|",$this->attrs['FAIrepository'][$i]);
- $tmp2 = array();
- $tmp3 = array();
-
- if(isset($tmp[1])){
- $tmp2['ParentServer'] = $tmp[1];
- if(empty($tmp[1])){
- $tmp2['ParentServer'] = "none";
- }
- }else{
- $tmp2['ParentServer'] = "none";
- }
-
- if(isset($tmp[0])){
- $tmp2['Url'] = $tmp[0];
- }else{
- $tmp2['Url'] = "";
- }
-
- if(isset($tmp[2])){
- $tmp2['Release'] = $tmp[2];
- }else{
- $tmp2['Release'] = "";
- }
-
- if(isset($tmp[3])){
- $tmp3 = split(",",$tmp[3]);
- foreach($tmp3 as $sec){
- $tmp2['Sections'][$sec]=$sec;
- }
- }else{
- $tmp['Section']=array();
- }
-
- $this->repositories[$tmp[2]]=$tmp2;
- }
- }
-
-
- /* Create divlist */
- $this->divlist = new divListRepository($this->config,$this);
- }
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
- if(!$this->fai_activated){
- $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
- return $str;
- }
-
- /* Fill templating stuff */
- $smarty= get_smarty();
- $smarty->assign("is_createable",$this->acl_is_createable());
- $display= "";
-
- /* Show tab dialog headers */
- /*
- ADD / EDIT Repository
- Dialog Handling
- */
- $once = false;
- if(isset($_POST['servRepository'])){
- foreach($_POST as $name => $value){
-
- if(preg_match("/AddRepository/",$name) && $this->acl_is_createable()){
- $once = true;
- $this->dialog = new servRepositorySetup($this->config,$this->dn);
- $this->dialog->parent = $this;
- }
-
- if((preg_match("/^delete_/",$name)) && (!$once) && $this->acl_is_removeable()){
- $once = true;
- $value = preg_replace("/delete_/","",$name);
- $value = base64_decode(preg_replace("/_.*$/","",$value));
-
- $url = $this->repositories[$value]['Url'];
- $release = $this->repositories[$value]['Release'];
-
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($this->config->current['BASE']);
-
- $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
-
- $found = false;
- $found_in = " ";
- while($attrs = $ldap->fetch()){
- foreach($attrs['FAIclass'] as $class){
- if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
- $found = true;
- $found_in .= $attrs['cn'][0]." ";
- }
- }
- }
-
- if($found){
- print_red(sprintf(_("You can't delete this release, it is still used by these workstations [%s]. Please solve this dependencies first, to keep data base consistency."),$found_in));
- }else{
- if(isset($this->repositories[$value])){
- unset($this->repositories[$value]);
- }
- }
- }
-
- if((preg_match("/^edit_/",$name))&&(!$once)){
- $value = preg_replace("/edit_/","",$name);
- $value = base64_decode(preg_replace("/_.$/","",$value));
-
- if(isset($this->repositories[$value])){
-
- $ldap = $this->config->get_ldap_link();
- $ldap->cd ($this->config->current['BASE']);
-
- $url = $this->repositories[$value]['Url'];
- $release = $this->repositories[$value]['Release'];
-
- $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
-
- $found = false;
- $found_in = " ";
- while($attrs = $ldap->fetch()){
- foreach($attrs['FAIclass'] as $class){
- if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
- $found = true;
- $found_in .= $attrs['cn'][0]." ";
- }
- }
- }
-
- if($found){
- print_red(sprintf(_("Be careful editing this release, it is still used by these workstations [%s]."),$found_in));
- }
-
- if(isset($this->repositories[$value])){
- $once = true;
- $obj = $this->repositories[$value];
-
- /* to be able to detect if this was renamed */
- $obj['initialy_was'] = $obj['Release'];
- $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
- $this->dialog->parent = $this;
- }
- }
- }
- }
- }
- if((isset($_GET['act']))&&($_GET['act']=="open_repository")&&(isset($_GET['id']))){
- $obj = $this->repositories[base64_decode($_GET['id'])];
- $obj['initialy_was'] = $obj['Release'];
- $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
- $this->dialog->parent = $this;
- }
-
- if(isset($_POST['repository_setup_save']) && is_object($this->dialog)){
- $this->dialog->save_object();
- if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){
- print_red(_("This name is already in use."));
- }else
-
- if(count($this->dialog->check())!=0){
- foreach($this->dialog->check() as $msg){
- print_red($msg);
- }
- }else{
- $obj = $this->dialog->save();
- if($this->dialog->is_new_name()){
- $oldname = $this->dialog->initialy_was;
- $this->repositories[$obj['Release']]=$obj;
- unset($this->repositories[$oldname]);
- }else{
- $this->repositories[$obj['Release']]=$obj;
- }
- $this->dialog = FALSE;
- $this->is_dialog= false;
- }
- }
-
- if(isset($_POST['repository_setup_cancel'])){
- $this->dialog=FALSE;
- $this->is_dialog = false;
- }
-
- if(is_object($this->dialog)){
- $this->dialog->save_object();
- $this->is_dialog = true;
- return($this->dialog->execute());
- }
-
- /*
- Repository setup dialog handling /END
- */
-
-
- $link = "<a href='?plug=".$_GET['plug']."&act=open_repository&id=%s'>%s</a>";
- $edit = "<input type='image' value='%s' name='edit_%s' src='images/edit.png'> ";
-
- /* Hide delete icon, if delete is not allowed */
- if($this->acl_is_removeable()){
- $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
- }else{
- $delete = "<img src='images/empty.png' alt=' '>";
- }
-
- $this->divlist->execute();
- $this->divlist->setEntries($this->repositories);
- $smarty->assign("Repositories",$this->divlist->Draw());
- $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE,dirname(__FILE__)));
- return($display);
- }
-
-
- /* Save data to object */
- function save_object()
- {
- plugin::save_object();
- if(is_object($this->divlist)){
- $this->divlist->save_object();
- }
- }
-
-
- /* Check supplied data */
- function check()
- {
- /* Call common method to give check the hook */
- $message= plugin::check();
- return ($message);
- }
-
-
- /* Save to LDAP */
- function save()
- {
- if(!$this->fai_activated) return;
-
- plugin::save();
-
- $arr = array();
- foreach($this->repositories as $servername => $conf){
- $str = "";
- foreach($conf['Sections'] as $sec){
- $str.=$sec.",";
- }
- $str=preg_replace("/,$/","",$str);
-
- if($conf['ParentServer']=="none"){
- $conf['ParentServer'] ="";
- }
-
- $arr[]=$conf['Url']."|".$conf['ParentServer']."|".$conf['Release']."|".$str;
- }
- $this->attrs['FAIrepository'] = $arr;
-
- $ldap= $this->config->get_ldap_link();
- $ldap->cd ($this->config->current['BASE']);
-
- $ldap->cat($this->dn, array('dn'));
-
- if($ldap->count()){
- $ldap->cd($this->dn);
- $this->cleanup();
- $ldap->modify ($this->attrs);
-
- $this->handle_post_events("modify");
- }else{
- $ldap->cd ($this->config->current['BASE']);
- $ldap->create_missing_trees($this->dn);
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- $this->handle_post_events("add");
- }
-
- if($this->initially_was_account){
- new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }else{
- new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }
- }
-
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("Repository service");
- $fields['AllowEdit'] = true;
- $fields['AllowStart'] = $fields['AllowStop'] = $fields['AllowRestart'] = false;
- return($fields);
- }
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Repository"),
- "plDescription" => _("Repository service")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 84,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array(
- "cn" => _("Name"),
- "start" => _("Start"),
- "stop" => _("Stop"),
- "restart" => _("Restart"),
- "Release" => _("Releases"),
- "Section" => _("Sections"),
- "ParentServer" => _("Parent server"),
- "Url" => _("Url"))
- ));
- }
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/repository/class_servRepositorySetup.inc b/gosa-core/plugins/admin/systems/services/repository/class_servRepositorySetup.inc
+++ /dev/null
@@ -1,225 +0,0 @@
-<?php
-
-class servRepositorySetup extends plugin
-{
- /* CLI vars */
- var $cli_summary = "Manage FAI repositories";
- 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("Release","ParentServer","Url","cn");
- var $objectclasses = array("whatever");
-
- /* Attributes */
- var $Release = "";
- var $ParentServer = "";
- var $Url = "";
- var $Sections = array();
- var $ParentServers = "";
- var $initialy_was = false;
- var $cn = "";
- var $parent = "";
-
- function servRepositorySetup (&$config, $dn= NULL,$data = false)
- {
- plugin::plugin ($config, $dn);
- if($data != false){
- foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){
- if(isset($data[$atr])){
- $this->$atr = $data[$atr];
- }
- }
- }
- }
-
- function GetName()
- {
- return($this->Release);
- }
-
- function is_new_name()
- {
- if(!$this->initialy_was){
- return(true);
- }else{
- if($this->Release != $this->initialy_was){
- return(true);
- }
- }
- return(false);
- }
-
-
-
- function execute()
- {
- /* Call parent execute */
- plugin::execute();
-
- /* Fill templating stuff */
- $smarty= get_smarty();
-
- if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
-
- /* Replace multiple spaces with a single, and cut of white spaces (trim)*/
- $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName']));
-
- /* check if there are more than one entry given ( "section1 section2 )*/
- if(preg_match("/ /",$val)){
-
- /* Generate list of new section names */
- $vals = split(" ",$val);
-
- /* Add new entries */
- foreach($vals as $entry){
- $entry = trim($entry);
- $this->Sections[$entry]=$entry;
- }
- }else{
- $this->Sections[$val]=$val;
- }
- }
-
- foreach($_POST as $name => $value){
- if(preg_match("/^delete_/",$name)){
-
- $val = preg_replace("/^delete_/","",$name);
- $val = base64_decode(preg_replace("/_.*$/","",$val));
-
- if(isset($this->Sections[$val])){
- unset($this->Sections[$val]);
- }
- }
- }
-
- $divlist = new divSelectBox("servRepositorySetup");
- $divlist->setHeight("220");
-
- $dellink = "<input type='image' src='images/edittrash.png' title='delete' alt='delete' name='delete_%s' value='%s'>";
-
- foreach($this->Sections as $sec){
- $divlist->AddEntry(array(
- array("string"=>$sec),
- array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'")
- ));
- }
-
- $smarty->assign("Sections",$divlist->DrawList());
-
- /* Get && assign acls */
- $tmp = $this->parent->plInfo();
- foreach($tmp['plProvidedAcls'] as $name => $translated){
- $smarty->assign($name."ACL",$this->parent->getacl($name));
- }
-
- /* Assign values */
- foreach($this->attributes as $attr){
- $smarty->assign($attr ,$this->$attr);
- }
-
- $tmp = $this->getParentServers();
- $smarty->assign("ParentServers" ,$tmp);
- $smarty->assign("ParentServerKeys",array_flip($tmp));
-
- return($smarty->fetch(get_template_path('servRepositorySetup.tpl', TRUE,dirname(__FILE__))));
- }
-
- /* Save data to object */
- function save_object()
- {
- if(isset($_POST['servRepositorySetup_Posted'])) {
-
- foreach($this->attributes as $attr){
- if(($this->parent->acl_is_writeable($attr)) && (isset($_POST[$attr]))){
- $this->$attr = $_POST[$attr];
- }
- }
- }
- }
-
-
- /* Check supplied data */
- function check()
- {
- /* Call common method to give check the hook */
- $message= plugin::check();
-
- if(empty($this->Release)){
- $message[]=_("Please enter a value for 'release'.");
- }
-
- if(empty($this->Url)){
- $message[] = _("Please specify a valid value for 'url'.");
- }
-
- return ($message);
- }
-
-
- /* Save to LDAP */
- function save()
- {
- $tmp = array();
- $tmp['ParentServer'] = $this->ParentServer;
- $tmp['Url'] = $this->Url;
- $tmp['Release'] = $this->Release;
- $tmp['Sections'] = $this->Sections;
- return($tmp);
- }
-
- function getParentServers()
- {
- $ret = array();
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
- while($attr = $ldap->fetch()){
- if($attr['cn'][0] == $this->cn) continue;
- $ret[$attr['cn'][0]]= $attr['cn'][0];
- }
-
- $ret = array_merge($ret,$this->GetHookElements());
-
- $ret['none']= " ";
- asort($ret);
- return($ret);
- }
-
- /* this funtions calls a defined hook
- and parses all additional serverdata
- */
- function GetHookElements()
- {
- $ret = array();
- $cmd = $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs'));
- if(!empty($cmd)){
- $res = shell_exec($cmd);
- $res2 = trim($res);
- if(!$res){
- print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd));
- }elseif(empty($res2)){
- print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
- }else{
- $tmp = split("\n",$res);
- foreach($tmp as $hook){
- /* skip empty */
- if(empty($hook)) continue;
-
- if(preg_match("/;/",$hook)){
- $hookinfo = split(";",$hook);
- $ret[$hookinfo[0]] = $hookinfo[0];
- }else{
- $ret[$hook] = $hook;
- }
- }
- }
- }
- return($ret);
- }
-
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/repository/servRepository.tpl b/gosa-core/plugins/admin/systems/services/repository/servRepository.tpl
+++ /dev/null
@@ -1,9 +0,0 @@
-{$Repositories}
-<input type="hidden" name="servRepository" value="1">
-
-<p class="seperator"> </p>
-<div style="width:100%; text-align:right;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
diff --git a/gosa-core/plugins/admin/systems/services/repository/servRepositorySetup.tpl b/gosa-core/plugins/admin/systems/services/repository/servRepositorySetup.tpl
+++ /dev/null
@@ -1,58 +0,0 @@
-<h2><img src="images/fai_small.png" alt=''> {t}Repository{/t}</h2>
-
-<table width="100%" summary=''>
- <tr>
- <td width="50%" valign="top" style="border-right:1px solid #A0A0A0">
- <table summary=''>
- <tr>
- <td>{t}Parent server{/t}
- </td>
- <td>
-{render acl=$ParentServerACL}
- <select name="ParentServer">
- {html_options options=$ParentServers values=$ParentServerKeys selected=$ParentServer}
- </select>
-{/render}
- </td>
- </tr>
- <tr>
- <td>{t}Release{/t}
- </td>
- <td>
-{render acl=$ReleaseACL}
- <input type="text" value="{$Release}" name="Release">
-{/render}
- </td>
- </tr>
- <tr>
- <td>{t}URL{/t}
- </td>
- <td>
-{render acl=$UrlACL}
- <input type="text" size="40" value="{$Url}" name="Url">
-{/render}
- </td>
- </tr>
- </table>
- </td>
- <td>
- {t}Sections{/t}<br>
-{render acl=$SectionACL}
- {$Sections}
-{/render}
-{render acl=$SectionACL}
- <input type="text" name="SectionName" value="" style='width:100%;'>
-{/render}
-{render acl=$SectionACL}
- <input type="submit" name="AddSection" value="{t}Add{/t}">
-{/render}
- </td>
- </tr>
-</table>
-<input type='hidden' name='servRepositorySetup_Posted' value='1'>
-<p class="plugbottom">
- <input type=submit name="repository_setup_save" value="{t}Apply{/t}">
-
- <input type=submit name="repository_setup_cancel" value="{t}Cancel{/t}">
-</p>
-
diff --git a/gosa-core/plugins/admin/systems/services/shares/class_goShareServer.inc b/gosa-core/plugins/admin/systems/services/shares/class_goShareServer.inc
+++ /dev/null
@@ -1,409 +0,0 @@
-<?php
-
-class goShareServer extends goService{
-
- var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server supports shares.";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goShareServer");
- var $attributes = array("goExportEntry");
- var $StatusFlag = "goShareServerStatus";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goShareServer");
-
- var $DisplayName = "";
- var $dn = NULL;
- var $cn = "";
- var $goShareServerStatus = "";
- var $goExportEntry = array();
- var $allow_mounts = false;
- var $mounts_to_remove = array();
- var $mounts_to_add = array();
- var $view_logged =FALSE;
-
- function goShareServer(&$config,$dn)
- {
- goService::goService($config,$dn);
-
- $this->DisplayName = _("File service");
-
- $tmp =array();
- if(isset($this->attrs['goExportEntry'])){
- if(isset($this->attrs['goExportEntry']['count'])){
- for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){
- $entry= $this->attrs['goExportEntry'][$i];
- $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
- }
- }
- }
- $this->goExportEntryList = $tmp;
-
- $ldap = $this->config->get_ldap_link();
- $avl_objectclasses = $ldap->get_objectclasses();
- if (isset($avl_objectclasses["mount"])) {
- $this->allow_mounts = true;
- }
- }
-
-
- function execute()
- {
- $smarty = get_smarty();
-
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
-
- if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList'])) && ($this->acl_is_writeable("name"))){
- if($this->allow_mounts){
- foreach($_POST['goExportEntryList'] as $entry){
- $this->deleteFromMountList($this->goExportEntryList[$entry]);
- }
- }
- foreach($_POST['goExportEntryList'] as $entry){
- $this->deleteFromList($entry);
- }
- }
-
- if(isset($_POST['NewNfsAdd']) && ($this->acl_is_writeable("name"))){
- $this->oldone = NULL;
- $this->o_subWindow = new servnfs($this->config, $this);
- $this->o_subWindow->set_acl_category("server");
- $this->o_subWindow->set_acl_base($this->dn);
- $this->dialog = true;
- }
-
- if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList']))){
- $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]];
- $add_mount=isset($this->mounts_to_add[$entry]);
- $this->oldone=$entry;
- $this->o_subWindow = new servnfs($this->config,$this,$entry,$add_mount);
- $this->o_subWindow->set_acl_base($this->dn);
- $this->o_subWindow->set_acl_category("server");
- $this->dialog = true;
- }
- if(isset($this->o_subWindow)){
- $this->o_subWindow->save_object(TRUE);
- }
-
- /* Save NFS setup */
- if(isset($_POST['NFSsave']) && isset($this->o_subWindow) && is_object($this->o_subWindow)){
- 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);
- if($this->allow_mounts){
- if($this->oldone != NULL) {
- $this->deleteFromMountList($this->oldone);
- }
- if ($this->o_subWindow->should_create_mount()) {
- $this->addToMountList($newone);
- }
- }
- unset($this->o_subWindow);
- $this->dialog = false;
- }
- }
-
- /* Cancel NFS setup */
- if(isset($_POST['NFScancel'])){
- $this->oldone = NULL;
- unset($this->o_subWindow);
- $this->dialog = false;
- }
-
- /* Execute NFS setup dialog*/
- if(isset($this->o_subWindow)){
- return $this->o_subWindow->execute();
- }
-
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- }
-
- /* Set acls */
- $tmp = $this->plInfo();
- foreach($tmp['plProvidedAcls'] as $name => $translated){
- $smarty->assign($name."ACL",$this->getacl($name));
- }
- $smarty->assign("createable",$this->acl_is_createable());
- $smarty->assign("removeable",$this->acl_is_removeable());
-
- $tellSmarty= array();
- ksort($this->goExportEntryList);
- foreach($this->goExportEntryList as $name=>$values){
- $tmp = split("\|",$values);
- $tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")";
- }
- $smarty->assign("goExportEntry",array_keys($tellSmarty));
- $smarty->assign("goExportEntryKeys",($tellSmarty));
- return($smarty->fetch(get_template_path("goShareServer.tpl",TRUE,dirname(__FILE__))));
- }
-
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("File service (Shares)");
- $fields['AllowEdit'] = true;
- return($fields);
- }
-
-
- function save()
- {
- plugin::save();
-
- /* Arrays */
- foreach (array("goExportEntryList"=>"goExportEntry") as $source => $destination){
- $this->attrs[$destination]= array();
- foreach ($this->$source as $element){
- $this->attrs[$destination][]= $element;
- }
- }
-
-
- /* Process netatalk mounts */
- if($this->allow_mounts) {
- $this->process_mounts();
- }
-
- /* Check if this is a new entry ... add/modify */
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- }else{
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- }
- show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn));
- if($this->initially_was_account){
- $this->handle_post_events("modify");
- new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }else{
- $this->handle_post_events("add");
- new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }
- }
-
-
- function check()
- {
- $message = plugin::check();
- return($message);
- }
-
-
- function save_object()
- {
- if(isset($_POST['goShareServerPosted'])){
- plugin::save_object();
- }
- }
-
- function addToList($entry){
- $key = key($entry);
- $this->goExportEntryList[$key]=$entry[$key];
- }
-
- function deleteFromList($id)
- {
- /* Check if the share is used by someone */
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*||*))", array("cn"));
- $cnt= $ldap->count();
- if ($cnt){
- $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt);
- $msg.= "<br><br><ul>";
- while ($attrs= $ldap->fetch()){
- $msg.= "<li>".$attrs["cn"][0]."</li>";
- }
- $msg.= "</ul>"._("Please correct the share-/profile settings of these users");
- print_red($msg);
-
- } else {
- /* Finally remove it */
- unset($this->goExportEntryList[$id]);
- }
- }
-
- function process_mounts() {
-
- $clip = "cn=" . $this->cn . ",".get_ou('serverou');
- $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
-
- $mounts = array(
- "objectClass" => "container",
- "cn" => "mounts"
- );
-
- # load data from mounts container
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($mountsdn, array('dn'));
- $attrs = $ldap->fetch();
-
- # mounts container not present yet, so we create it
- if (count($attrs) == 0) {
- $ldap->cd($mountsdn);
- $ldap->add($mounts);
- show_ldap_error($ldap->get_error(), sprintf(_("Creating system server/shares (mount container) with dn '%s' failed."),$this->dn));
- new log("modify","server/".get_class($this),$mountsdn,array_keys($mounts),$ldap->get_error());
- }
-
- # remove deleted mounts from the container
- foreach ($this->mounts_to_remove as $entry) {
- $mount=$this->returnMountEntry($entry);
- $mountdn = "cn=".$mount["cn"].","."$mountsdn";
-
- $ldap->cat($mountdn, array('dn'));
- $attrs = $ldap->fetch();
-
- if (count($attrs) != 0) {
- $ldap->rmdir($mountdn);
- show_ldap_error($ldap->get_error(), sprintf(_("Removing system server/shares (mount container) with dn '%s' failed."),$this->dn));
- new log("remove","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
- }
- }
-
- # add new mounts to the container
- foreach ($this->mounts_to_add as $entry) {
- $mount=$this->returnMountEntry($entry);
- $mountdn = "cn=".$mount["cn"].","."$mountsdn";
- $ldap->cd($mountdn);
- $ldap->add($mount);
- show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/shares (mount container) with dn '%s' failed."),$this->dn));
- new log("create","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
- }
- }
-
- function addToMountList($entry)
- {
- if($this->acl_is_writeable("name")){
- $key = key($entry);
- $type = $this->get_share_type($entry[$key]);
- if (($type == "netatalk") || ($type == "NFS")) {
- $this->mounts_to_add[$entry[$key]] = $entry[$key];
- unset($this->mounts_to_remove[$entry[$key]]);
- }
- }
- }
-
- function deleteFromMountList($entry)
- {
- if($this->acl_is_writeable("name")){
- $type = $this->get_share_type($entry);
- if (($type == "netatalk") || ($type == "NFS")) {
- $this->mounts_to_remove[$entry] = $entry;
- unset($this->mounts_to_add[$entry]);
- }
- }
- }
-
- function get_share_type($share)
- {
- $tmp = split("\|", $share);
- return $tmp[2];
- }
-
- function returnMountEntry($entry)
- {
- $item = split("\|", $entry);
- $name = $item[0];
- $description = $item[1];
- $type = $item[2];
- $charset = $item[3];
- $path = $item[4];
- $options = $item[5];
-
- switch ($type) {
- case "netatalk" : {
- $mount = array(
- "mountDirectory" => "/Network/Servers/",
- "mountOption" => array(
- "net",
- "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/"
- ),
- "mountType" => "url",
- "objectClass" => "mount",
- "cn" => $this->cn .":/".$name
- );
- break;
- }
- case "NFS" : {
- $mount = array(
- "mountDirectory" => "/Network/Servers/",
- "mountOption" => "net",
- "mountType" => "nfs",
- "objectClass" => "mount",
- "cn" => $this->cn .":".$path
- );
- break;
- }
- default : {
- continue;
- }
- }
- return $mount;
- }
-
-
- function PrepareForCopyPaste($source)
- {
- plugin::PrepareForCopyPaste($source);
-
- $tmp =array();
- if(isset($source['goExportEntry'])){
- if(isset($source['goExportEntry']['count'])){
- for($i= 0; $i<$source['goExportEntry']['count']; $i++){
- $entry= $source['goExportEntry'][$i];
- $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
- }
- }
- }
- $this->goExportEntryList = $tmp;
- $this->goExportEntry = $tmp;
- }
-
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("File service (Shares)"),
- "plDescription" => _("File service - Shares")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 90,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array(
- "name" => _("Name"),
- "netatalkmount" => _("Apple mounts"),
- "description" => _("Description"),
- "type" => _("Type"),
- "charset" => _("Charset"),
- "path" => _("Path"),
- "option" => _("Option"),
- "volume" => _("Volume"))
-
- ));
- }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/shares/goShareServer.tpl b/gosa-core/plugins/admin/systems/services/shares/goShareServer.tpl
+++ /dev/null
@@ -1,33 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Shares{/t}</h2>
- <table summary="" style="width:100%">
- <tr>
- <td>
-{render acl=$nameACL mode=read_active}
- <select style="width:100%" id="goExportEntry" name="goExportEntryList[]" size=12 multiple >
- {html_options values=$goExportEntry output=$goExportEntryKeys}
- <option disabled> </option>
- </select>
-{/render}
- <br>
-
-{render acl=$nameACL}
- <input type="submit" value="{t}Add{/t}" name="NewNfsAdd" id="NewNfsAddId" {if !$createable} disabled {/if}>
-{/render}
-{render acl=$nameACL mode=read_active}
- <input type="submit" value="{t}Edit{/t}" name="NewNfsEdit" id="NewNfsEditId">
-{/render}
-{render acl=$nameACL}
- <input type="submit" value="{t}Delete{/t}" name="DelNfsEnt" id="DelNfsEntId" {if !$removeable} disabled {/if}>
-{/render}
- </td>
- </tr>
- </table>
-
-
-<p class='seperator'> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goShareServerPosted" value="1">
diff --git a/gosa-core/plugins/admin/systems/services/syslog/class_goLogDBServer.inc b/gosa-core/plugins/admin/systems/services/syslog/class_goLogDBServer.inc
+++ /dev/null
@@ -1,106 +0,0 @@
-<?php
-
-class goLogDBServer extends goService{
-
- var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goLogDBServer");
- var $attributes = array("goLogAdmin", "goLogPassword");
- var $StatusFlag = "goLogDBServerStatus";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goLogDBServer");
-
- var $DisplayName = "";
- var $dn = NULL;
- var $acl;
- var $cn = "";
- var $goLogDBServerStatus = "";
- var $goLogAdmin = "";
- var $goLogPassword = "";
- var $view_logged =FALSE;
-
-
- function goLogDBServer(&$config,$dn)
- {
- goService::goService($config,$dn);
- $this->DisplayName = _("Syslog service database");
- }
-
-
- function execute()
- {
- $smarty = get_smarty();
-
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
- $tmp = $this->plInfo();
- foreach($tmp['plProvidedAcls'] as $name => $translation){
- $smarty->assign($name."ACL",$this->getacl($name));
- }
-
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- }
- return($smarty->fetch(get_template_path("goLogDBServer.tpl",TRUE,dirname(__FILE__))));
- }
-
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("Syslog service database");
- $fields['AllowEdit'] = true;
- return($fields);
- }
-
-
- function check()
- {
- $message = plugin::check();
- if (empty($this->goLogAdmin)){
- $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
- }
- if (empty($this->goLogPassword)){
- $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
- }
- return($message);
- }
-
-
- function save_object()
- {
- if(isset($_POST['goLogDBServerPosted'])){
- plugin::save_object();
- }
- }
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Logging database"),
- "plDescription" => _("Logging database")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 97,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array(
- "start" => _("Start"),
- "stop" => _("Stop"),
- "restart" => _("Restart"),
- "goLogAdmin" => _("Admin"),
- "goLogPassword" => _("Password"))
- ));
- }
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/syslog/class_goSyslogServer.inc b/gosa-core/plugins/admin/systems/services/syslog/class_goSyslogServer.inc
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-class goSyslogServer extends goService{
-
- var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server has syslog server enabled.";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goSyslogServer");
- var $attributes = array();
- var $StatusFlag = "goSyslogServerStatus";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goSyslogServer");
-
- var $DisplayName = "";
- var $dn = NULL;
- var $acl;
- var $cn = "";
- var $goSyslogServerStatus = "";
- var $view_logged =FALSE;
-
- function goSyslogServer(&$config,$dn)
- {
- goService::goService($config,$dn);
- $this->DisplayName = _("Syslog server");
- }
-
-
- function execute()
- {
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
-
- $smarty = get_smarty();
- return($smarty->fetch(get_template_path("goSyslogServer.tpl",TRUE,dirname(__FILE__))));
- }
-
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("Syslog server");
- $fields['AllowEdit'] = false;
- return($fields);
- }
-
- function check()
- {
- $message = plugin::check();
- return($message);
- }
-
-
- function save_object()
- {
- plugin::save_object();
- }
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Logging service"),
- "plDescription" => _("Logging service")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 88,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array()
- ));
- }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/syslog/goLogDBServer.tpl b/gosa-core/plugins/admin/systems/services/syslog/goLogDBServer.tpl
+++ /dev/null
@@ -1,27 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Logging database information{/t}</h2>
-<table summary="">
- <tr>
- <td>{t}Logging DB user{/t}{$must}</td>
- <td>
-{render acl=$goLogAdminACL}
- <input name="goLogAdmin" id="goLogAdmin" size=30 maxlength=60 value="{$goLogAdmin}">
-{/render}
- </td>
- </tr>
- <tr>
- <td>{t}Password{/t}{$must}</td>
- <td>
-{render acl=$goLogPasswordACL}
- <input type=password name="goLogPassword" id="goLogPassword" size=30 maxlength=60 value="{$goLogPassword}">
-{/render}
- </td>
- </tr>
- </table>
-
-<p class='seperator'> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goLogDBServerPosted" value="1">
diff --git a/gosa-core/plugins/admin/systems/services/syslog/goSyslogServer.tpl b/gosa-core/plugins/admin/systems/services/syslog/goSyslogServer.tpl
+++ /dev/null
@@ -1,9 +0,0 @@
-<h2>{t}Syslog Service{/t} {t}enabled{/t}</h2>
-
-<p class='seperator'> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/gosa-core/plugins/admin/systems/services/terminal/class_goTerminalServer.inc b/gosa-core/plugins/admin/systems/services/terminal/class_goTerminalServer.inc
+++ /dev/null
@@ -1,141 +0,0 @@
-<?php
-
-class goTerminalServer extends goService{
-
- var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
- var $cli_description = "Some longer text\nfor help";
- var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
-
- /* This plugin only writes its objectClass */
- var $objectclasses = array("goTerminalServer");
- var $attributes = array("goXdmcpIsEnabled", "goFontPath");
- var $StatusFlag = "goTerminalServerStatus";
-
- /* This class can't be assigned twice so it conflicts with itsself */
- var $conflicts = array("goTerminalServer");
-
- var $DisplayName = "";
- var $dn = NULL;
- var $acl;
- var $cn = "";
- var $goTerminalServerStatus = "";
- var $goXdmcpIsEnabled = false;
- var $goFontPath = "";
- var $view_logged =FALSE;
-
-
- function goTerminalServer(&$config,$dn)
- {
- goService::goService($config,$dn);
- $this->DisplayName = _("Terminal service");
- }
-
-
- function execute()
- {
- $smarty = get_smarty();
-
- if($this->is_account && !$this->view_logged){
- $this->view_logged = TRUE;
- new log("view","server/".get_class($this),$this->dn);
- }
-
-
- $tmp = $this->plinfo();
- foreach($tmp['plProvidedAcls'] as $name => $translation){
- $smarty->assign($name."ACL",$this->getacl($name));
- }
-
- foreach($this->attributes as $attr){
- $smarty->assign($attr,$this->$attr);
- }
- return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__))));
- }
-
-
- function getListEntry()
- {
- $fields = goService::getListEntry();
- $fields['Message'] = _("Terminal service");
- $fields['AllowEdit'] = true;
- return($fields);
- }
-
-
- function save()
- {
- plugin::save();
-
- if(!$this->goXdmcpIsEnabled){
- $this->attrs['goXdmcpIsEnabled'] = "0";
- }
-
- /* Check if this is a new entry ... add/modify */
- $ldap = $this->config->get_ldap_link();
- $ldap->cat($this->dn,array("objectClass"));
- if($ldap->count()){
- $ldap->cd($this->dn);
- $ldap->modify($this->attrs);
- }else{
- $ldap->cd($this->dn);
- $ldap->add($this->attrs);
- }
- show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/terminalServer with dn '%s' failed."),$this->dn));
- if($this->initially_was_account){
- $this->handle_post_events("modify");
- new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }else{
- $this->handle_post_events("add");
- new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
- }
- }
-
-
- function check()
- {
- $message = plugin::check();
- if(empty($this->goFontPath)){
- $message[]=_("Terminal server, must have fontpath specified.");
- }
-
- return($message);
- }
-
-
- function save_object()
- {
- if(isset($_POST['goTerminalServerPosted'])){
- plugin::save_object();
- if($this->acl_is_writeable("goXdmcpIsEnabled")){
- if(isset($_POST['goXdmcpIsEnabled'])){
- $this->goXdmcpIsEnabled = true;
- }else{
- $this->goXdmcpIsEnabled = false;
- }
- }
- }
- }
-
-
- /* Return plugin informations for acl handling */
- static function plInfo()
- {
- return (array(
- "plShortName" => _("Terminal service"),
- "plDescription" => _("Terminal service")." ("._("Services").")",
- "plSelfModify" => FALSE,
- "plDepends" => array(),
- "plPriority" => 87,
- "plSection" => array("administration"),
- "plCategory" => array("server"),
-
- "plProvidedAcls"=> array(
- "goXdmcpIsEnabled" => _("Temporary disable login"),
- "goFontPath" => _("Font path"))
- ));
- }
-
-
-}
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/gosa-core/plugins/admin/systems/services/terminal/goTerminalServer.tpl b/gosa-core/plugins/admin/systems/services/terminal/goTerminalServer.tpl
+++ /dev/null
@@ -1,27 +0,0 @@
-<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Terminal service{/t}</h2>
-<table summary="">
- <tr>
- <td colspan=2>
-{render acl=$goXdmcpIsEnabledACL}
- <input type="checkbox" value="true" name="goXdmcpIsEnabled" id="Temporariid" {if $goXdmcpIsEnabled} checked {/if}>
-{/render}
- {t}Temporary disable login{/t}
- </td>
- </tr>
- <tr>
- <td>{t}Font path{/t}</td>
- <td>
-{render acl=$goXdmcpIsEnabledACL}
- <input type="text" value="{$goFontPath}" name="goFontPath" id="FontPathId">
-{/render}
- </td>
- </tr>
- </table>
-
-<p class='seperator'> </p>
-<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
- <input type='submit' name='SaveService' value='{t}Save{/t}'>
-
- <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
-</div>
-<input type="hidden" name="goTerminalServerPosted" value="1">
diff --git a/gosa-plugins/goto/admin/systems/services/cups/class_goCupsServer.inc b/gosa-plugins/goto/admin/systems/services/cups/class_goCupsServer.inc
--- /dev/null
@@ -0,0 +1,85 @@
+<?php
+
+class goCupsServer extends goService{
+
+ var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server supports cups management.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goCupsServer");
+ var $attributes = array();
+ var $StatusFlag = "goCupsServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goCupsServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $acl;
+ var $cn = "";
+ var $goCupsServerStatus = "";
+ var $view_logged =FALSE;
+
+ function goCupsServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+ $this->DisplayName = _("Print service");
+ }
+
+
+ function execute()
+ {
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ $smarty = get_smarty();
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+ return($smarty->fetch(get_template_path("goCupsServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Print service");
+ $fields['AllowEdit'] = false;
+ return($fields);
+ }
+
+ function check()
+ {
+ $message = plugin::check();
+ return($message);
+ }
+
+ function save_object()
+ {
+ plugin::save_object();
+ }
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Cups"),
+ "plDescription" => _("Print service")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 100,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "start" => _("Start"),
+ "stop" => _("Stop"),
+ "restart" => _("Restart"),
+
+ "plProvidedAcls"=> array()
+ ));
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/cups/goCupsServer.tpl b/gosa-plugins/goto/admin/systems/services/cups/goCupsServer.tpl
--- /dev/null
@@ -0,0 +1,9 @@
+<h2>{t}Print Service{/t} {t}enabled{/t}</h2>
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/gosa-plugins/goto/admin/systems/services/kiosk/class_goKioskService.inc b/gosa-plugins/goto/admin/systems/services/kiosk/class_goKioskService.inc
--- /dev/null
@@ -0,0 +1,245 @@
+<?php
+
+class goKioskService extends goService{
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goEnvironmentServer");
+ var $attributes = array("gotoKioskProfile","cn");
+ var $StatusFlag = "";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goKioskService");
+
+ var $baseDir = "../kiosk";
+ var $filesToAttach = array();
+ var $cn = "unknown";
+ var $gotoKioskProfiles= array();
+ var $gotoKioskProfile = array();
+
+ var $server_path = "http://%cn/kiosk";
+
+ function goKioskService(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+
+ $this->DisplayName = _("Kiosk profile service");
+ $this->baseDir = $this->config->search('environment', 'kioskpath',array('menu','tabs'));
+ $this->server_path = preg_replace("/%cn/", $this->cn, $this->server_path);
+
+ /* Load list of profiles and check if they still exists */
+ if ($this->baseDir == ""){
+ print_red(_("There is no KIOSKPATH defined in your gosa.conf. Can't manage kiosk profiles!"));
+ }else{
+ $this->gotoKioskProfiles = array();
+ if(isset($this->attrs['gotoKioskProfile']) && is_array($this->attrs['gotoKioskProfile'])){
+ for($i = 0 ; $i < $this->attrs['gotoKioskProfile']['count']; $i ++){
+ $url = $this->attrs['gotoKioskProfile'][$i];
+ $this->server_path = preg_replace("/\/[^\/]*$/","",$url);
+ $name= preg_replace("/^.*\//","",$url);
+ $this->gotoKioskProfiles[] = array('url' => $url ,
+ 'name' => $name ,
+ 'initial' =>TRUE,
+ 'exists' => file_exists($this->baseDir."/".$name));
+ }
+ }
+ }
+ }
+
+
+ function remove_from_parent()
+ {
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*/".$this->cn."/*))",array("cn"));
+ $str ="";
+ $cnt = 3;
+ while($cnt && $attrs = $ldap->fetch()){
+ $str .= $attrs['cn'][0].", ";
+ $cnt --;
+ }
+ $str = preg_replace("/, $/","",$str);
+ if($cnt != 3){
+ print_red(sprintf(_("Can not remove kiosk profile service, it is currently in use by following user(s) : %s."),$str));
+ }else{
+ goService::remove_from_parent();
+ }
+ }
+
+
+ function execute()
+ {
+ /* log actions */
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+ $display= "";
+
+ /* Add new kiosk profile
+ * in profile directory ($this->baseDir);
+ */
+ if((isset($_POST['profileAdd']))&&(isset($_FILES['newProfile']))){
+ $file = $_FILES['newProfile'];
+ if(!file_exists($this->baseDir.$file['name'])){
+ $tmp = array(
+ 'url' => "" ,
+ 'name' => $file['name'] ,
+ 'initial' => FALSE,
+ 'tmp_name'=> $file['tmp_name'],
+ 'content' => file_get_contents($file['tmp_name']),
+ 'exists' => TRUE);
+ $this->gotoKioskProfiles[] = $tmp;
+ }
+ if(!is_writeable($this->baseDir)){
+ print_red(sprintf(_("Can't save new kiosk profiles, possibly permission denied for folder: '%s'."),$this->baseDir));
+ }
+ }
+
+ $only_once = true;
+ foreach($_POST as $name => $value){
+
+ if((preg_match("/^delkiosk_/",$name))&&($only_once)){
+
+ /* Get id, name and path */
+ $only_once = false;
+ $id = preg_replace("/^delkiosk_/","",$name);
+ $id = preg_replace("/_.*$/","",$id);
+ $name = $this->gotoKioskProfiles[$id]['name'];
+ $filename = $this->baseDir."/".$name;
+
+ /* check if profile is still in use */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(&(objectClass=gotoEnvironment)(gotoKioskProfile=*".$name.")",array("cn","uid","gotoKioskProfile"));
+ $used_by = "";
+ $cnt = 3;
+ while(($attrs = $ldap->fetch()) && ($cnt)){
+ $cnt --;
+ $check = preg_replace("/^.*\//i","",$attrs['gotoKioskProfile'][0]);
+ if($check == $name){
+ $used_by .= $attrs['cn'][0].", ";
+ }
+ }
+ $used_by = preg_replace("/, $/","",$used_by);
+ if(!empty($used_by)){
+ print_red(sprintf(_("Can't remove kioks profile, it is still in use by the following objects '%s'."),$used_by));
+ }else{
+ if($this->gotoKioskProfiles[$id]['initial']){
+ $res = @unlink($filename);
+ if(!$res){
+ if(!is_writeable($filename)){
+ print_red(sprintf(_("Can't delete '%s'. Error was: permission denied."), $filename));
+ }
+ if(!file_exists($filename)){
+ print_red(sprintf(_("Can't delete '%s'. Error was: file doesn't exist."), $filename));
+ }
+ }
+ unset($this->gotoKioskProfiles[$id]);
+ }
+ }
+ }
+ }
+
+ /* Display list of profiles */
+ $divlist = new divSelectBox("KioskProfiles");
+ $divlist -> SetHeight (300);
+ foreach($this->gotoKioskProfiles as $key => $val ){
+ $divlist->AddEntry(array(
+ array("string"=>"<a target='_blank' href='getkiosk.php?id=".$val['name']."'>".$val['name']."</a>"),
+ array("string"=>"<input type='image' src='images/edittrash.png'
+ class='center' alt='delete' name='delkiosk_".$key."'>" ,
+ "attach"=>" style='border-right: 0px;width:24px; text-align:center;' ")
+ ));
+ }
+
+ /* Assign all existing profiles to smarty */
+ $smarty->assign("divlist",$divlist->DrawList());
+ $smarty = get_smarty();
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+ $smarty->assign("server_path",$this->server_path);
+ return($smarty->fetch(get_template_path("goKioskService.tpl",TRUE,dirname(__FILE__))));
+ }
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Kiosk profile service");
+ $fields['AllowEdit'] = TRUE;
+ $fields['AllowStart'] = false;
+ $fields['AllowStop'] = false;
+ $fields['AllowRestart'] = false;
+ return($fields);
+ }
+
+ function check()
+ {
+ $message = plugin::check();
+ return($message);
+ }
+
+ function save()
+ {
+ goService::save();
+
+ $method = $this->server_path."/";
+ $method = preg_replace("/\/\/*$/","/",$method);
+ $this->attrs['gotoKioskProfile'] = array();
+ foreach($this->gotoKioskProfiles as $profile){
+ if(!$profile['initial']){
+
+ $contents = $profile['content'];
+ $path = $this->baseDir."/".$profile['name'];
+ $fp = @fopen($path,"w");
+ if(!$fp){
+ print_red(_("Can't save new kiosk profiles, possibly permission denied for folder")." : ",$path);
+ }else{
+ fwrite($fp,$contents,strlen($contents));
+ $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
+ }
+ @unlink($profile['tmp_name']);
+ }else{
+ $this->attrs['gotoKioskProfile'][] = $method.$profile['name'];
+ }
+ }
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+ show_ldap_error($ldap->get_error(),_("Wohl kaum"));
+ }
+
+
+ function save_object()
+ {
+ if(isset($_POST['goKioskPosted'])){
+ goService::save_object();
+ if(isset($_POST['server_path'])){
+ $this->server_path = get_post("server_path");
+ }
+ }
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Kiosk"),
+ "plDescription" => _("Kiosk profile management")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 100,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array()
+ ));
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/kiosk/goKioskService.tpl b/gosa-plugins/goto/admin/systems/services/kiosk/goKioskService.tpl
--- /dev/null
@@ -0,0 +1,24 @@
+<h2><img alt="" class="center" src="images/house.png" align="middle"> <LABEL for="gotoKioskProfile">{t}Kiosk profile management{/t}</ LABEL></h2>
+
+ <input type="hidden" name="dialogissubmitted" value="1">
+
+{t}Server path{/t} <input name="server_path" style="width:300px;" value="{$server_path}">
+<br>
+<br>
+{$divlist}
+<input type="file" size=50 name="newProfile" value="{t}Browse{/t}">
+<input type="submit" name="profileAdd" value="{t}Add{/t}">
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goKioskPosted" value="1">
+
+<script language="JavaScript" type="text/javascript">
+ <!-- // First input field on page
+ focus_field('gotoKioskProfile');
+ -->
+</script>
diff --git a/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc b/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc
--- /dev/null
@@ -0,0 +1,97 @@
+<?php
+
+class goLdapServer extends goService{
+
+ var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server has goLdapServer defined.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goLdapServer");
+ var $attributes = array("goLdapBase");
+ var $StatusFlag = "goLdapServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goLdapServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $cn = "";
+ var $goLdapServerStatus = "";
+ var $goLdapBase = "";
+ var $view_logged =FALSE;
+
+ function goLdapServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+ $this->DisplayName = _("LDAP service");
+ }
+
+
+ function execute()
+ {
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ $smarty = get_smarty();
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+ return($smarty->fetch(get_template_path("goLdapServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("LDAP Service");
+ $fields['AllowEdit'] = true;
+ return($fields);
+ }
+
+
+
+ function check()
+ {
+ $message = plugin::check();
+ if(empty($this->goLdapBase)){
+ $message[] = _("The given base is empty or contains invalid characters.");
+ }
+ return($message);
+ }
+
+
+ function save_object()
+ {
+ if(isset($_POST['goLdapServerPosted'])){
+ plugin::save_object();
+ }
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Ldap"),
+ "plDescription" => _("Ldap")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 96,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "goLdapBase" => _("Ldap base"))
+ ));
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/ldap/goLdapServer.tpl b/gosa-plugins/goto/admin/systems/services/ldap/goLdapServer.tpl
--- /dev/null
@@ -0,0 +1,13 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}LDAP service{/t}</h2>
+{t}LDAP URI{/t}{$must}
+{render acl=$goLdapBaseACL}
+<input type="text" size="80" value="{$goLdapBase}" name="goLdapBase" id="goLdapBaseId">
+{/render}
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goLdapServerPosted" value="1">
diff --git a/gosa-plugins/goto/admin/systems/services/nfs/class_servNfs.inc b/gosa-plugins/goto/admin/systems/services/nfs/class_servNfs.inc
--- /dev/null
@@ -0,0 +1,267 @@
+<?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("description","type","charset","path","option", "volume");
+ var $objectclasses = array("whatever");
+ var $is_account = true;
+
+ var $name =""; // Name of
+ var $description =""; // description
+ var $type =""; // Type FS/Samba/NCP
+ var $charset =""; // charset
+ var $host =""; // hostname
+ var $types =array(); // Array Types NFS/Samba/NCP/netatalk
+ var $charsets =array(); // Array with charsets
+ var $path =""; // Path
+ var $volume =""; // Volume
+ var $option =""; // Options
+ var $is_edit =false;
+ var $create_mount_init = false; //mount entry set for this entry (while editing)?
+ var $create_mount = false; //save mount entry
+
+ var $parent = NULL;
+ var $view_logged = FALSE;
+
+ function servnfs (&$config, $parent,$entry= false,$mount =false)
+ {
+ $this->parent = $parent;
+ $dn = $parent->dn;
+ plugin::plugin ($config, $dn);
+
+ $this->types = array("CIFS" => "CIFS", "NFS"=>"NFS","samba"=>"samba","netatalk"=>"netatalk","NCP"=>"NCP");
+ if($dn){
+ $this->host = substr($dn, 3, strpos($dn, ',')-3);
+ }
+
+ $this->charsets = array();
+
+ if(!file_exists(CONFIG_DIR."/encodings")){
+ print_red(sprintf(_("The file '%s/encodings' does not exist, can't get supported charsets."),CONFIG_DIR));
+ }else{
+ if(!is_readable(CONFIG_DIR."/encodings")){
+ print_red(sprintf(_("Can't read '%s/encodings', please check permissions."),CONFIG_DIR));
+ }else{
+ $fp = fopen(CONFIG_DIR."/encodings","r");
+ $i = 100;
+ while(!feof($fp)&&$i){
+ $i -- ;
+ $str = trim(fgets($fp,256));
+
+ /* Skip comments */
+ if(!preg_match("/^#/",$str)){
+ $arr = split("\=",$str);
+ if(count($arr)==2){
+ $this->charsets[$arr[0]]=$arr[1];
+ }
+ }
+ }
+ }
+ }
+
+ if($entry){
+ list($this->name, $this->description, $this->type, $this->charset,
+ $this->path, $this->option, $this->volume)= split("\|",$entry."|");
+ $this->is_edit = true;
+
+ }else{
+ $this->attributes[] = "name";
+ }
+
+
+ $this->create_mount_init = $mount;
+ }
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+
+ $smarty->assign("charsets" ,$this->charsets);
+ $smarty->assign("types" ,$this->types);
+
+ /* attrs to smarty*/
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+
+ $tmp = $this->parent->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translation){
+ $smarty->assign($name."ACL",$this->parent->getacl($name));
+ }
+
+ $smarty->assign("name",$this->name);
+ if($this->is_edit){
+ $smarty->assign("nameACL", preg_replace("/w/","",$this->parent->getacl("name")));
+ }
+ $smarty->assign("allow_mounts", $this->parent->allow_mounts);
+ $smarty->assign("mount_checked", "");
+
+ $smarty->assign("appleMountsACL", $this->getacl("appleMounts"));
+
+ if (($this->type == "netatalk") || ($this->type == "NFS")) {
+ if ($this->create_mount_init) {
+ $smarty->assign("mount_checked", "checked");
+ } else {
+ $tmp = split(",", $this->dn);
+ $clip = $tmp[0] . ",".get_ou('serverou');
+ $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
+ switch ($this->type) {
+ case "netatalk" : {
+ $mountdn = "cn=".$this->host.":/".$this->name.",".$mountsdn;
+ break;
+ }
+ case "NFS" : {
+ $mountdn = "cn=".$this->host.":".$this->path.",".$mountsdn;
+ break;
+ }
+ default : {
+ continue;
+ }
+ }
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($mountdn, array('dn'));
+ $attrs = $ldap->fetch();
+ if (count($attrs) > 0) {
+ $smarty->assign("mount_checked", "checked");
+ }
+ }
+ }
+
+ $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()
+ {
+ if(isset($_POST['servnfs_posted'])){
+
+ foreach($this->attributes as $name){
+ if($this->parent->acl_is_writeable($name) && isset($_POST[$name])){
+ $this->$name = $_POST[$name];
+ }
+ }
+
+ if ((isset($_POST['netatalk_mount'])) && (($this->type == "netatalk") || ($this->type == "NFS"))) {
+ $this->create_mount = true;
+ } else {
+ $this->create_mount = false;
+ }
+ }
+ }
+
+
+ /* Check supplied data */
+ function check()
+ {
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
+ // fixme : a check for the path ? ?
+ if(empty($this->path)){
+ $message[]=_("Please specify a valid path for your setup.");
+ }
+
+ // only 0-9a-z
+ if(!$this->is_edit){
+ if(!preg_match("/^[a-z0-9\._äüö]*$/ui",$this->name)){
+ $message[]=_("Please specify a valid name for your share.");
+ }
+ if(empty($this->name)){
+ $message[]=_("Please specify a name for your share.");
+ }
+ }
+
+ if(!empty($this->description) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->description)){
+ $message[]=_("Description contains invalid characters.");
+ }
+
+ if(!empty($this->volume) && preg_match("/^[^a-z0-9\._äüö\+ -]*$/ui",$this->volume)){
+ $message[]=_("Volume contains invalid characters.");
+ }
+
+ if(preg_match("/\|/",$this->path)){
+ $message[]=_("Path contains invalid characters.");
+ }
+
+ if(!empty($this->option) && preg_match("/^[^a-z0-9\._äüö,=\+ -]*$/ui",$this->option)){
+ $message[]=_("Option contains invalid characters.");
+ }
+
+ /* remove a / at the end of the path, we neither need it there nor
+ * do we want to check for it later.
+ */
+ if(substr($this->path, -1, 1) == '/') {
+ $this->path=substr($this->path, 0, -1);
+ }
+
+ $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;
+ if(isset($test['goExportEntry'])){
+ foreach($test['goExportEntry'] as $entry){
+ $tmp = split("\|",$entry);
+ if($tmp[0] == $this->name){
+ $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->name."|";
+ $s_return.= $this->description."|";
+ $s_return.= $this->type."|";
+ $s_return.= $this->charset."|";
+ $s_return.= $this->path."|";
+ $s_return.= $this->option."|";
+ $s_return.= $this->volume;
+
+ return(array($this->name=>$s_return));
+ }
+
+ function should_create_mount() {
+ return $this->create_mount;
+ }
+
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/nfs/servnfs.tpl b/gosa-plugins/goto/admin/systems/services/nfs/servnfs.tpl
--- /dev/null
@@ -0,0 +1,144 @@
+<h2><img class="center" alt="" src="images/fai_partitionTable.png" align="middle"> {t}Edit share{/t}</h2>
+<table summary="{t}NFS setup{/t}" width="100%">
+ <tr>
+ <td width="45%" style="vertical-align:top">
+ <!--Table left-top-->
+ <table summary="">
+ <tr>
+ <td>
+ {t}Name{/t} {$must}
+ </td>
+ <td>
+{render acl=$nameACL}
+ <input type="text" name="name" value="{$name}" >
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Description{/t}
+ </td>
+ <td>
+{render acl=$descriptionACL}
+ <input type="text" size="40" name="description" value="{$description}">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Path{/t} / {t}Volume{/t}
+ </td>
+ <td>
+{render acl=$pathACL}
+ <input type="text" size="40" name="path" value="{$path}">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="vlabel">{t}Server{/t}</div>
+ </td>
+ <td>
+{render acl=$volumeACL}
+ <input type="text" id="volume" size="40" name="volume" value="{$volume}">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td style="border-left:1px solid #A0A0A0">
+
+ <!--Table right-top-->
+ <table summary="">
+ <tr>
+ <td style="vertical-align:top">
+
+ {t}Type{/t}
+ </td>
+ <td>
+{render acl=$typeACL}
+ <select size="1" name="type" id="sharetype">
+ {html_options options=$types selected=$type}
+ </select>
+{/render}
+ {if $allow_mounts == TRUE}
+ <br><br>
+{render acl=$netatalkmountACL}
+ <input type="checkbox" name="netatalk_mount" id="netatalk_mount" {$mount_checked} />
+{/render}
+ <label for="netatalk_mount">{t}Auto-mount share on Apple systems{/t}</label>
+ <br>
+ <br>
+ {/if}
+
+ {literal}
+ <script language="JavaScript">
+ document.getElementById('sharetype').onchange=function() {
+ var foobar=this[this.selectedIndex].value;
+ var box=document.getElementById('netatalk_mount');
+ var volume=document.getElementById('volume');
+ var vlabel=document.getElementById('vlabel');
+ {/literal}
+ <!-- Only add checkbox enable/disable js part if checkbox is available -->
+ {if $allow_mounts == TRUE}
+ {literal}
+ if(foobar=="NFS"||foobar=="netatalk"){
+ box.disabled=false;
+ } else {
+ box.disabled=true;
+ box.checked=false;
+ }
+ {/literal}
+ {/if}
+ {literal}
+ if(foobar=="NCP"){
+ volume.style.visibility="visible";
+ vlabel.style.visibility="visible";
+ } else {
+ volume.style.visibility="hidden";
+ vlabel.style.visibility="hidden";
+ }
+ };
+ document.getElementById('sharetype').onchange();
+ </script>
+ {/literal}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Codepage{/t}
+ </td>
+ <td>
+{render acl=$charsetACL}
+ <select size="1" name="charset">
+ {html_options options=$charsets selected=$charset}
+ </select>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ {t}Option{/t}
+ </td>
+ <td>
+{render acl=$optionACL}
+ <input type="text" name="option" value="{$option}">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2>
+ <p class="seperator"> </p>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2 style="text-align:right">
+ <input type="submit" name="NFSsave" value="{t}Save{/t}">
+ <input type="submit" name="NFScancel" value="{t}Cancel{/t}">
+ </td>
+ </tr>
+</table>
+<input type='hidden' name='servnfs_posted' value='1'>
diff --git a/gosa-plugins/goto/admin/systems/services/ntp/class_goNtpServer.inc b/gosa-plugins/goto/admin/systems/services/ntp/class_goNtpServer.inc
--- /dev/null
@@ -0,0 +1,147 @@
+<?php
+
+class goNtpServer extends goService{
+
+ var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports NTP service.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goNtpServer");
+ var $attributes = array("goTimeSource");
+ var $StatusFlag = "goNtpServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goNtpServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $goTimeSource = array();
+ var $goNtpServerStatus= "";
+ var $acl;
+ var $cn = "";
+ var $view_logged =FALSE;
+
+ function goNtpServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+ $this->DisplayName = _("Time service (NTP)");
+
+ /* Load arrays */
+ $tmp = array();
+ if (isset($this->attrs['goTimeSource'])){
+ for ($i= 0; $i<$this->attrs['goTimeSource']['count']; $i++){
+ $tmp[$this->attrs['goTimeSource'][$i]]= $this->attrs['goTimeSource'][$i];
+ }
+ }
+ $this->goTimeSource= $tmp;
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ /* Here we add a new entry */
+ if(isset($_POST['NewNTPAdd']) && $_POST['NewNTPExport'] != "" && $this->acl_is_writeable("goTimeSource")) {
+ $this->goTimeSource[$_POST['NewNTPExport']]= $_POST['NewNTPExport'];
+ asort($this->goTimeSource);
+ }
+
+ /* Deleting an Entry, is a bit more complicated than adding one*/
+ if((isset($_POST['DelNTPEnt'])) && (isset($_POST['goTimeSource'])) && $this->acl_is_writeable("goTimeSource")) {
+ foreach ($_POST['goTimeSource'] as $entry){
+ if (isset($this->goTimeSource[$entry])){
+ unset($this->goTimeSource[$entry]);
+ }
+ }
+ }
+
+ $smarty->assign("goNtpServerACL", $this->getacl("goNtpServer")) ;
+ $smarty->assign("goTimeSource" , $this->goTimeSource);
+ return($smarty->fetch(get_template_path("goNtpServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Time service (NTP)");
+ $fields['AllowEdit'] = true;
+ return($fields);
+ }
+
+
+ function save()
+ {
+ plugin::save();
+ $this->attrs['goTimeSource'] =array();
+ foreach($this->goTimeSource as $entry){
+ $this->attrs['goTimeSource'][] = $entry;
+ }
+ /* Check if this is a new entry ... add/modify */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($this->dn,array("objectClass"));
+ if($ldap->count()){
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+ }else{
+ $ldap->cd($this->dn);
+ $ldap->add($this->attrs);
+ }
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/goNtpServer with dn '%s' failed."),$this->dn));
+ if($this->initially_was_account){
+ $this->handle_post_events("modify");
+ new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ $this->handle_post_events("add");
+ new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Time service"),
+ "plDescription" => _("Time service - NTP")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 91,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "goTimeSource" =>_("Ntp source"))
+ ));
+ }
+
+
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+
+ /* Load arrays */
+ $tmp = array();
+ if (isset($source['goTimeSource'])){
+ for ($i= 0; $i<$source['goTimeSource']['count']; $i++){
+ $tmp[$source['goTimeSource'][$i]]= $source['goTimeSource'][$i];
+ }
+ }
+ $this->goTimeSource= $tmp;
+
+
+ }
+
+ function check(){ return array();}
+
+ function save_object(){;}
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/ntp/goNtpServer.tpl b/gosa-plugins/goto/admin/systems/services/ntp/goNtpServer.tpl
--- /dev/null
@@ -0,0 +1,32 @@
+<br>
+<h2>{t}Time server{/t}</h2>
+<br>
+<table summary="" style="width:100%">
+<tr>
+ <td>
+{render acl=$goNtpServerACL}
+ <select style="width:100%;" id="goTimeEntry" name="goTimeSource[]" size=8 multiple>
+ {html_options values=$goTimeSource output=$goTimeSource}
+ <option disabled> </option>
+ </select>
+{/render}
+<br>
+{render acl=$goNtpServerACL}
+ <input type="text" name="NewNTPExport" id="NewNTPExportId">
+{/render}
+{render acl=$goNtpServerACL}
+ <input type="submit" value="{t}Add{/t}" name="NewNTPAdd" id="NewNTPAddId">
+{/render}
+{render acl=$goNtpServerACL}
+ <input type="submit" value="{t}Delete{/t}" name="DelNTPEnt" id="DelNTPEntId">
+{/render}
+</td>
+</tr>
+</table>
+
+<p class="seperator"> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
diff --git a/gosa-plugins/goto/admin/systems/services/repository/class_divListRepositories.inc b/gosa-plugins/goto/admin/systems/services/repository/class_divListRepositories.inc
--- /dev/null
@@ -0,0 +1,84 @@
+<?php
+
+class divListRepository extends MultiSelectWindow
+{
+ /* CheckBoxes, to change default values modify $this->AddCheckBox */
+ var $parent ;
+ var $ui ;
+
+ var $regex ="*";
+
+ function divListRepository ($config,$parent)
+ {
+ MultiSelectWindow::MultiSelectWindow($config,"Repository", "server");
+
+ $this->parent = $parent;
+ $this->ui = get_userinfo();
+
+ $this->SetTitle("repositories");
+ $this->SetSummary(_("List of configured repositories."));
+ $this->SetInformation(_("This menu allows you to create, delete and edit repository settings."));
+ $this->EnableCloseButton(FALSE);
+ $this->EnableSaveButton(FALSE);
+ $this->AddHeader(array("string"=>_("Release"),"attach"=>"style='width:80px;'"));
+ $this->AddHeader(array("string"=>_("Sections")));
+ $this->AddHeader(array("string"=>_("Options"),"attach"=>"style='border-right:0px;width:55px;'"));
+ $this->AddRegex("regex",_("Regular expression for matching object names"),"*",TRUE);
+ $this->EnableAplhabet(TRUE);
+ }
+
+ function GenHeader()
+ {
+ if($this->parent->acl_is_createable()){
+ $this->SetListHeader("<input type=\"image\" src=\"images/fai_new_packages.png\" title=\""._("Add repository")."\" name=\"AddRepository\">");
+ }
+ }
+
+ function execute()
+ {
+ $this->ClearElementsList();
+ $this->GenHeader();
+ }
+
+ function setEntries($list)
+ {
+ $link = "<a href='?plug=".$_GET['plug']."&act=open_repository&id=%s'>%s</a>";
+ $edit = "<input type='image' value='%s' name='edit_%s' src='images/edit.png'> ";
+
+ /* Hide delete icon, if delete is not allowed */
+ if($this->parent->acl_is_removeable()){
+ $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
+ }else{
+ $delete = "<img src='images/empty.png' alt=' '>";
+ }
+
+ foreach($list as $name => $reps){
+
+ $str = " ";
+ if(preg_match("/".str_replace("*",".*",$this->regex)."/",$reps['Release'])){
+ foreach($reps['Sections'] as $sec){
+ $str.=$sec." ";
+ }
+ $this->AddElement(array(
+ array("string"=>sprintf($link,base64_encode($name),$name),"attach"=>"style='width:80px;'"),
+ array("string"=>sprintf($link,base64_encode($name),_("Sections")." :".$str)),
+ array("string"=>preg_replace("/%s/",base64_encode($name),$edit.$delete),"attach"=>"style='border-right:0px;width:55px;text- align:right;'")
+ ));
+ }
+ }
+
+ }
+
+ function Save()
+ {
+ MultiSelectWindow :: Save();
+ }
+
+ function save_object()
+ {
+ /* Save automatic created POSTs like regex, checkboxes */
+ MultiSelectWindow :: save_object();
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/repository/class_servRepository.inc b/gosa-plugins/goto/admin/systems/services/repository/class_servRepository.inc
--- /dev/null
@@ -0,0 +1,366 @@
+<?php
+
+class servrepository extends goService
+{
+ /* CLI vars */
+ var $cli_summary = "Manage server basic 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("FAIrepository");
+ var $objectclasses = array("FAIrepositoryServer");
+
+ /* Repositories */
+ var $repositories = array();
+ var $FAIrepository = array();
+ var $conflicts = array("FAIrepositoryServer");
+ var $DisplayName = "";
+ var $StatusFlag = "";
+
+ var $view_logged = FALSE;
+ var $fai_activated = FALSE;
+
+ var $divlist = NULL;
+
+ function servrepository (&$config, $dn= NULL, $parent= NULL)
+ {
+ plugin::plugin ($config, $dn, $parent);
+
+ $this->DisplayName = _("Repository service");
+
+ /* Skip this if fai is deactivated */
+ $tmp= $this->config->search("faiManagement", "CLASS",array('menu','tabs'));
+ if(!empty($tmp)){
+ $this->fai_activated = TRUE;
+ }else{
+ return;
+ }
+
+ $this->repositories = array();
+ if(isset($this->attrs['FAIrepository'])){
+ for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
+ $tmp = split("\|",$this->attrs['FAIrepository'][$i]);
+ $tmp2 = array();
+ $tmp3 = array();
+
+ if(isset($tmp[1])){
+ $tmp2['ParentServer'] = $tmp[1];
+ if(empty($tmp[1])){
+ $tmp2['ParentServer'] = "none";
+ }
+ }else{
+ $tmp2['ParentServer'] = "none";
+ }
+
+ if(isset($tmp[0])){
+ $tmp2['Url'] = $tmp[0];
+ }else{
+ $tmp2['Url'] = "";
+ }
+
+ if(isset($tmp[2])){
+ $tmp2['Release'] = $tmp[2];
+ }else{
+ $tmp2['Release'] = "";
+ }
+
+ if(isset($tmp[3])){
+ $tmp3 = split(",",$tmp[3]);
+ foreach($tmp3 as $sec){
+ $tmp2['Sections'][$sec]=$sec;
+ }
+ }else{
+ $tmp['Section']=array();
+ }
+
+ $this->repositories[$tmp[2]]=$tmp2;
+ }
+ }
+
+
+ /* Create divlist */
+ $this->divlist = new divListRepository($this->config,$this);
+ }
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ if(!$this->fai_activated){
+ $str = "<h2>"._("You can't use this plugin until FAI is activated.")."</h2>";
+ return $str;
+ }
+
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+ $smarty->assign("is_createable",$this->acl_is_createable());
+ $display= "";
+
+ /* Show tab dialog headers */
+ /*
+ ADD / EDIT Repository
+ Dialog Handling
+ */
+ $once = false;
+ if(isset($_POST['servRepository'])){
+ foreach($_POST as $name => $value){
+
+ if(preg_match("/AddRepository/",$name) && $this->acl_is_createable()){
+ $once = true;
+ $this->dialog = new servRepositorySetup($this->config,$this->dn);
+ $this->dialog->parent = $this;
+ }
+
+ if((preg_match("/^delete_/",$name)) && (!$once) && $this->acl_is_removeable()){
+ $once = true;
+ $value = preg_replace("/delete_/","",$name);
+ $value = base64_decode(preg_replace("/_.*$/","",$value));
+
+ $url = $this->repositories[$value]['Url'];
+ $release = $this->repositories[$value]['Release'];
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd ($this->config->current['BASE']);
+
+ $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
+
+ $found = false;
+ $found_in = " ";
+ while($attrs = $ldap->fetch()){
+ foreach($attrs['FAIclass'] as $class){
+ if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
+ $found = true;
+ $found_in .= $attrs['cn'][0]." ";
+ }
+ }
+ }
+
+ if($found){
+ print_red(sprintf(_("You can't delete this release, it is still used by these workstations [%s]. Please solve this dependencies first, to keep data base consistency."),$found_in));
+ }else{
+ if(isset($this->repositories[$value])){
+ unset($this->repositories[$value]);
+ }
+ }
+ }
+
+ if((preg_match("/^edit_/",$name))&&(!$once)){
+ $value = preg_replace("/edit_/","",$name);
+ $value = base64_decode(preg_replace("/_.$/","",$value));
+
+ if(isset($this->repositories[$value])){
+
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd ($this->config->current['BASE']);
+
+ $url = $this->repositories[$value]['Url'];
+ $release = $this->repositories[$value]['Release'];
+
+ $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass"));
+
+ $found = false;
+ $found_in = " ";
+ while($attrs = $ldap->fetch()){
+ foreach($attrs['FAIclass'] as $class){
+ if(preg_match("/".str_replace("/","\/",$release)."$/i",$class)){
+ $found = true;
+ $found_in .= $attrs['cn'][0]." ";
+ }
+ }
+ }
+
+ if($found){
+ print_red(sprintf(_("Be careful editing this release, it is still used by these workstations [%s]."),$found_in));
+ }
+
+ if(isset($this->repositories[$value])){
+ $once = true;
+ $obj = $this->repositories[$value];
+
+ /* to be able to detect if this was renamed */
+ $obj['initialy_was'] = $obj['Release'];
+ $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
+ $this->dialog->parent = $this;
+ }
+ }
+ }
+ }
+ }
+ if((isset($_GET['act']))&&($_GET['act']=="open_repository")&&(isset($_GET['id']))){
+ $obj = $this->repositories[base64_decode($_GET['id'])];
+ $obj['initialy_was'] = $obj['Release'];
+ $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
+ $this->dialog->parent = $this;
+ }
+
+ if(isset($_POST['repository_setup_save']) && is_object($this->dialog)){
+ $this->dialog->save_object();
+ if(($this->dialog->is_new_name())&&(isset($this->repositories[$this->dialog->GetName()]))){
+ print_red(_("This name is already in use."));
+ }else
+
+ if(count($this->dialog->check())!=0){
+ foreach($this->dialog->check() as $msg){
+ print_red($msg);
+ }
+ }else{
+ $obj = $this->dialog->save();
+ if($this->dialog->is_new_name()){
+ $oldname = $this->dialog->initialy_was;
+ $this->repositories[$obj['Release']]=$obj;
+ unset($this->repositories[$oldname]);
+ }else{
+ $this->repositories[$obj['Release']]=$obj;
+ }
+ $this->dialog = FALSE;
+ $this->is_dialog= false;
+ }
+ }
+
+ if(isset($_POST['repository_setup_cancel'])){
+ $this->dialog=FALSE;
+ $this->is_dialog = false;
+ }
+
+ if(is_object($this->dialog)){
+ $this->dialog->save_object();
+ $this->is_dialog = true;
+ return($this->dialog->execute());
+ }
+
+ /*
+ Repository setup dialog handling /END
+ */
+
+
+ $link = "<a href='?plug=".$_GET['plug']."&act=open_repository&id=%s'>%s</a>";
+ $edit = "<input type='image' value='%s' name='edit_%s' src='images/edit.png'> ";
+
+ /* Hide delete icon, if delete is not allowed */
+ if($this->acl_is_removeable()){
+ $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
+ }else{
+ $delete = "<img src='images/empty.png' alt=' '>";
+ }
+
+ $this->divlist->execute();
+ $this->divlist->setEntries($this->repositories);
+ $smarty->assign("Repositories",$this->divlist->Draw());
+ $display.= $smarty->fetch(get_template_path('servRepository.tpl', TRUE,dirname(__FILE__)));
+ return($display);
+ }
+
+
+ /* Save data to object */
+ function save_object()
+ {
+ plugin::save_object();
+ if(is_object($this->divlist)){
+ $this->divlist->save_object();
+ }
+ }
+
+
+ /* Check supplied data */
+ function check()
+ {
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+ return ($message);
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ if(!$this->fai_activated) return;
+
+ plugin::save();
+
+ $arr = array();
+ foreach($this->repositories as $servername => $conf){
+ $str = "";
+ foreach($conf['Sections'] as $sec){
+ $str.=$sec.",";
+ }
+ $str=preg_replace("/,$/","",$str);
+
+ if($conf['ParentServer']=="none"){
+ $conf['ParentServer'] ="";
+ }
+
+ $arr[]=$conf['Url']."|".$conf['ParentServer']."|".$conf['Release']."|".$str;
+ }
+ $this->attrs['FAIrepository'] = $arr;
+
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd ($this->config->current['BASE']);
+
+ $ldap->cat($this->dn, array('dn'));
+
+ if($ldap->count()){
+ $ldap->cd($this->dn);
+ $this->cleanup();
+ $ldap->modify ($this->attrs);
+
+ $this->handle_post_events("modify");
+ }else{
+ $ldap->cd ($this->config->current['BASE']);
+ $ldap->create_missing_trees($this->dn);
+ $ldap->cd($this->dn);
+ $ldap->add($this->attrs);
+ $this->handle_post_events("add");
+ }
+
+ if($this->initially_was_account){
+ new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Repository service");
+ $fields['AllowEdit'] = true;
+ $fields['AllowStart'] = $fields['AllowStop'] = $fields['AllowRestart'] = false;
+ return($fields);
+ }
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Repository"),
+ "plDescription" => _("Repository service")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 84,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "cn" => _("Name"),
+ "start" => _("Start"),
+ "stop" => _("Stop"),
+ "restart" => _("Restart"),
+ "Release" => _("Releases"),
+ "Section" => _("Sections"),
+ "ParentServer" => _("Parent server"),
+ "Url" => _("Url"))
+ ));
+ }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/repository/class_servRepositorySetup.inc b/gosa-plugins/goto/admin/systems/services/repository/class_servRepositorySetup.inc
--- /dev/null
@@ -0,0 +1,225 @@
+<?php
+
+class servRepositorySetup extends plugin
+{
+ /* CLI vars */
+ var $cli_summary = "Manage FAI repositories";
+ 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("Release","ParentServer","Url","cn");
+ var $objectclasses = array("whatever");
+
+ /* Attributes */
+ var $Release = "";
+ var $ParentServer = "";
+ var $Url = "";
+ var $Sections = array();
+ var $ParentServers = "";
+ var $initialy_was = false;
+ var $cn = "";
+ var $parent = "";
+
+ function servRepositorySetup (&$config, $dn= NULL,$data = false)
+ {
+ plugin::plugin ($config, $dn);
+ if($data != false){
+ foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){
+ if(isset($data[$atr])){
+ $this->$atr = $data[$atr];
+ }
+ }
+ }
+ }
+
+ function GetName()
+ {
+ return($this->Release);
+ }
+
+ function is_new_name()
+ {
+ if(!$this->initialy_was){
+ return(true);
+ }else{
+ if($this->Release != $this->initialy_was){
+ return(true);
+ }
+ }
+ return(false);
+ }
+
+
+
+ function execute()
+ {
+ /* Call parent execute */
+ plugin::execute();
+
+ /* Fill templating stuff */
+ $smarty= get_smarty();
+
+ if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
+
+ /* Replace multiple spaces with a single, and cut of white spaces (trim)*/
+ $val = preg_replace("/\ \ * /" , " ", trim($_POST['SectionName']));
+
+ /* check if there are more than one entry given ( "section1 section2 )*/
+ if(preg_match("/ /",$val)){
+
+ /* Generate list of new section names */
+ $vals = split(" ",$val);
+
+ /* Add new entries */
+ foreach($vals as $entry){
+ $entry = trim($entry);
+ $this->Sections[$entry]=$entry;
+ }
+ }else{
+ $this->Sections[$val]=$val;
+ }
+ }
+
+ foreach($_POST as $name => $value){
+ if(preg_match("/^delete_/",$name)){
+
+ $val = preg_replace("/^delete_/","",$name);
+ $val = base64_decode(preg_replace("/_.*$/","",$val));
+
+ if(isset($this->Sections[$val])){
+ unset($this->Sections[$val]);
+ }
+ }
+ }
+
+ $divlist = new divSelectBox("servRepositorySetup");
+ $divlist->setHeight("220");
+
+ $dellink = "<input type='image' src='images/edittrash.png' title='delete' alt='delete' name='delete_%s' value='%s'>";
+
+ foreach($this->Sections as $sec){
+ $divlist->AddEntry(array(
+ array("string"=>$sec),
+ array("string"=>sprintf($dellink,base64_encode($sec),$sec),"attach"=>"style='border-right:0px;width:20px;'")
+ ));
+ }
+
+ $smarty->assign("Sections",$divlist->DrawList());
+
+ /* Get && assign acls */
+ $tmp = $this->parent->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->parent->getacl($name));
+ }
+
+ /* Assign values */
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr ,$this->$attr);
+ }
+
+ $tmp = $this->getParentServers();
+ $smarty->assign("ParentServers" ,$tmp);
+ $smarty->assign("ParentServerKeys",array_flip($tmp));
+
+ return($smarty->fetch(get_template_path('servRepositorySetup.tpl', TRUE,dirname(__FILE__))));
+ }
+
+ /* Save data to object */
+ function save_object()
+ {
+ if(isset($_POST['servRepositorySetup_Posted'])) {
+
+ foreach($this->attributes as $attr){
+ if(($this->parent->acl_is_writeable($attr)) && (isset($_POST[$attr]))){
+ $this->$attr = $_POST[$attr];
+ }
+ }
+ }
+ }
+
+
+ /* Check supplied data */
+ function check()
+ {
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
+ if(empty($this->Release)){
+ $message[]=_("Please enter a value for 'release'.");
+ }
+
+ if(empty($this->Url)){
+ $message[] = _("Please specify a valid value for 'url'.");
+ }
+
+ return ($message);
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ $tmp = array();
+ $tmp['ParentServer'] = $this->ParentServer;
+ $tmp['Url'] = $this->Url;
+ $tmp['Release'] = $this->Release;
+ $tmp['Sections'] = $this->Sections;
+ return($tmp);
+ }
+
+ function getParentServers()
+ {
+ $ret = array();
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(objectClass=FAIrepositoryServer)",array("*"));
+ while($attr = $ldap->fetch()){
+ if($attr['cn'][0] == $this->cn) continue;
+ $ret[$attr['cn'][0]]= $attr['cn'][0];
+ }
+
+ $ret = array_merge($ret,$this->GetHookElements());
+
+ $ret['none']= " ";
+ asort($ret);
+ return($ret);
+ }
+
+ /* this funtions calls a defined hook
+ and parses all additional serverdata
+ */
+ function GetHookElements()
+ {
+ $ret = array();
+ $cmd = $this->config->search("servrepository", "REPOSITORY_HOOK",array('tabs'));
+ if(!empty($cmd)){
+ $res = shell_exec($cmd);
+ $res2 = trim($res);
+ if(!$res){
+ print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd));
+ }elseif(empty($res2)){
+ print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
+ }else{
+ $tmp = split("\n",$res);
+ foreach($tmp as $hook){
+ /* skip empty */
+ if(empty($hook)) continue;
+
+ if(preg_match("/;/",$hook)){
+ $hookinfo = split(";",$hook);
+ $ret[$hookinfo[0]] = $hookinfo[0];
+ }else{
+ $ret[$hook] = $hook;
+ }
+ }
+ }
+ }
+ return($ret);
+ }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/repository/servRepository.tpl b/gosa-plugins/goto/admin/systems/services/repository/servRepository.tpl
--- /dev/null
@@ -0,0 +1,9 @@
+{$Repositories}
+<input type="hidden" name="servRepository" value="1">
+
+<p class="seperator"> </p>
+<div style="width:100%; text-align:right;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
diff --git a/gosa-plugins/goto/admin/systems/services/repository/servRepositorySetup.tpl b/gosa-plugins/goto/admin/systems/services/repository/servRepositorySetup.tpl
--- /dev/null
@@ -0,0 +1,58 @@
+<h2><img src="images/fai_small.png" alt=''> {t}Repository{/t}</h2>
+
+<table width="100%" summary=''>
+ <tr>
+ <td width="50%" valign="top" style="border-right:1px solid #A0A0A0">
+ <table summary=''>
+ <tr>
+ <td>{t}Parent server{/t}
+ </td>
+ <td>
+{render acl=$ParentServerACL}
+ <select name="ParentServer">
+ {html_options options=$ParentServers values=$ParentServerKeys selected=$ParentServer}
+ </select>
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Release{/t}
+ </td>
+ <td>
+{render acl=$ReleaseACL}
+ <input type="text" value="{$Release}" name="Release">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}URL{/t}
+ </td>
+ <td>
+{render acl=$UrlACL}
+ <input type="text" size="40" value="{$Url}" name="Url">
+{/render}
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td>
+ {t}Sections{/t}<br>
+{render acl=$SectionACL}
+ {$Sections}
+{/render}
+{render acl=$SectionACL}
+ <input type="text" name="SectionName" value="" style='width:100%;'>
+{/render}
+{render acl=$SectionACL}
+ <input type="submit" name="AddSection" value="{t}Add{/t}">
+{/render}
+ </td>
+ </tr>
+</table>
+<input type='hidden' name='servRepositorySetup_Posted' value='1'>
+<p class="plugbottom">
+ <input type=submit name="repository_setup_save" value="{t}Apply{/t}">
+
+ <input type=submit name="repository_setup_cancel" value="{t}Cancel{/t}">
+</p>
+
diff --git a/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc b/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc
--- /dev/null
@@ -0,0 +1,409 @@
+<?php
+
+class goShareServer extends goService{
+
+ var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server supports shares.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goShareServer");
+ var $attributes = array("goExportEntry");
+ var $StatusFlag = "goShareServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goShareServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $cn = "";
+ var $goShareServerStatus = "";
+ var $goExportEntry = array();
+ var $allow_mounts = false;
+ var $mounts_to_remove = array();
+ var $mounts_to_add = array();
+ var $view_logged =FALSE;
+
+ function goShareServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+
+ $this->DisplayName = _("File service");
+
+ $tmp =array();
+ if(isset($this->attrs['goExportEntry'])){
+ if(isset($this->attrs['goExportEntry']['count'])){
+ for($i= 0; $i<$this->attrs['goExportEntry']['count']; $i++){
+ $entry= $this->attrs['goExportEntry'][$i];
+ $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
+ }
+ }
+ }
+ $this->goExportEntryList = $tmp;
+
+ $ldap = $this->config->get_ldap_link();
+ $avl_objectclasses = $ldap->get_objectclasses();
+ if (isset($avl_objectclasses["mount"])) {
+ $this->allow_mounts = true;
+ }
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+
+ if((isset($_POST['DelNfsEnt']))&&(isset($_POST['goExportEntryList'])) && ($this->acl_is_writeable("name"))){
+ if($this->allow_mounts){
+ foreach($_POST['goExportEntryList'] as $entry){
+ $this->deleteFromMountList($this->goExportEntryList[$entry]);
+ }
+ }
+ foreach($_POST['goExportEntryList'] as $entry){
+ $this->deleteFromList($entry);
+ }
+ }
+
+ if(isset($_POST['NewNfsAdd']) && ($this->acl_is_writeable("name"))){
+ $this->oldone = NULL;
+ $this->o_subWindow = new servnfs($this->config, $this);
+ $this->o_subWindow->set_acl_category("server");
+ $this->o_subWindow->set_acl_base($this->dn);
+ $this->dialog = true;
+ }
+
+ if((isset($_POST['NewNfsEdit']))&&(isset($_POST['goExportEntryList']))){
+ $entry = $this->goExportEntryList[$_POST['goExportEntryList'][0]];
+ $add_mount=isset($this->mounts_to_add[$entry]);
+ $this->oldone=$entry;
+ $this->o_subWindow = new servnfs($this->config,$this,$entry,$add_mount);
+ $this->o_subWindow->set_acl_base($this->dn);
+ $this->o_subWindow->set_acl_category("server");
+ $this->dialog = true;
+ }
+ if(isset($this->o_subWindow)){
+ $this->o_subWindow->save_object(TRUE);
+ }
+
+ /* Save NFS setup */
+ if(isset($_POST['NFSsave']) && isset($this->o_subWindow) && is_object($this->o_subWindow)){
+ 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);
+ if($this->allow_mounts){
+ if($this->oldone != NULL) {
+ $this->deleteFromMountList($this->oldone);
+ }
+ if ($this->o_subWindow->should_create_mount()) {
+ $this->addToMountList($newone);
+ }
+ }
+ unset($this->o_subWindow);
+ $this->dialog = false;
+ }
+ }
+
+ /* Cancel NFS setup */
+ if(isset($_POST['NFScancel'])){
+ $this->oldone = NULL;
+ unset($this->o_subWindow);
+ $this->dialog = false;
+ }
+
+ /* Execute NFS setup dialog*/
+ if(isset($this->o_subWindow)){
+ return $this->o_subWindow->execute();
+ }
+
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+
+ /* Set acls */
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translated){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+ $smarty->assign("createable",$this->acl_is_createable());
+ $smarty->assign("removeable",$this->acl_is_removeable());
+
+ $tellSmarty= array();
+ ksort($this->goExportEntryList);
+ foreach($this->goExportEntryList as $name=>$values){
+ $tmp = split("\|",$values);
+ $tellSmarty[$name] = $tmp[0]." ".$tmp[4]." (".$tmp[2].")";
+ }
+ $smarty->assign("goExportEntry",array_keys($tellSmarty));
+ $smarty->assign("goExportEntryKeys",($tellSmarty));
+ return($smarty->fetch(get_template_path("goShareServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("File service (Shares)");
+ $fields['AllowEdit'] = true;
+ return($fields);
+ }
+
+
+ function save()
+ {
+ plugin::save();
+
+ /* Arrays */
+ foreach (array("goExportEntryList"=>"goExportEntry") as $source => $destination){
+ $this->attrs[$destination]= array();
+ foreach ($this->$source as $element){
+ $this->attrs[$destination][]= $element;
+ }
+ }
+
+
+ /* Process netatalk mounts */
+ if($this->allow_mounts) {
+ $this->process_mounts();
+ }
+
+ /* Check if this is a new entry ... add/modify */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($this->dn,array("objectClass"));
+ if($ldap->count()){
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+ }else{
+ $ldap->cd($this->dn);
+ $ldap->add($this->attrs);
+ }
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/shares with dn '%s' failed."),$this->dn));
+ if($this->initially_was_account){
+ $this->handle_post_events("modify");
+ new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ $this->handle_post_events("add");
+ new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
+ }
+
+
+ function check()
+ {
+ $message = plugin::check();
+ return($message);
+ }
+
+
+ function save_object()
+ {
+ if(isset($_POST['goShareServerPosted'])){
+ plugin::save_object();
+ }
+ }
+
+ function addToList($entry){
+ $key = key($entry);
+ $this->goExportEntryList[$key]=$entry[$key];
+ }
+
+ function deleteFromList($id)
+ {
+ /* Check if the share is used by someone */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cd($this->config->current['BASE']);
+ $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*||*))", array("cn"));
+ $cnt= $ldap->count();
+ if ($cnt){
+ $msg= sprintf(_("The share can't be removed since it is still used by %d users:"), $cnt);
+ $msg.= "<br><br><ul>";
+ while ($attrs= $ldap->fetch()){
+ $msg.= "<li>".$attrs["cn"][0]."</li>";
+ }
+ $msg.= "</ul>"._("Please correct the share-/profile settings of these users");
+ print_red($msg);
+
+ } else {
+ /* Finally remove it */
+ unset($this->goExportEntryList[$id]);
+ }
+ }
+
+ function process_mounts() {
+
+ $clip = "cn=" . $this->cn . ",".get_ou('serverou');
+ $mountsdn = "cn=mounts," . substr($this->dn, strlen($clip));
+
+ $mounts = array(
+ "objectClass" => "container",
+ "cn" => "mounts"
+ );
+
+ # load data from mounts container
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($mountsdn, array('dn'));
+ $attrs = $ldap->fetch();
+
+ # mounts container not present yet, so we create it
+ if (count($attrs) == 0) {
+ $ldap->cd($mountsdn);
+ $ldap->add($mounts);
+ show_ldap_error($ldap->get_error(), sprintf(_("Creating system server/shares (mount container) with dn '%s' failed."),$this->dn));
+ new log("modify","server/".get_class($this),$mountsdn,array_keys($mounts),$ldap->get_error());
+ }
+
+ # remove deleted mounts from the container
+ foreach ($this->mounts_to_remove as $entry) {
+ $mount=$this->returnMountEntry($entry);
+ $mountdn = "cn=".$mount["cn"].","."$mountsdn";
+
+ $ldap->cat($mountdn, array('dn'));
+ $attrs = $ldap->fetch();
+
+ if (count($attrs) != 0) {
+ $ldap->rmdir($mountdn);
+ show_ldap_error($ldap->get_error(), sprintf(_("Removing system server/shares (mount container) with dn '%s' failed."),$this->dn));
+ new log("remove","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
+ }
+ }
+
+ # add new mounts to the container
+ foreach ($this->mounts_to_add as $entry) {
+ $mount=$this->returnMountEntry($entry);
+ $mountdn = "cn=".$mount["cn"].","."$mountsdn";
+ $ldap->cd($mountdn);
+ $ldap->add($mount);
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving system server/shares (mount container) with dn '%s' failed."),$this->dn));
+ new log("create","server/".get_class($this),$mountdn,array_keys($mount),$ldap->get_error());
+ }
+ }
+
+ function addToMountList($entry)
+ {
+ if($this->acl_is_writeable("name")){
+ $key = key($entry);
+ $type = $this->get_share_type($entry[$key]);
+ if (($type == "netatalk") || ($type == "NFS")) {
+ $this->mounts_to_add[$entry[$key]] = $entry[$key];
+ unset($this->mounts_to_remove[$entry[$key]]);
+ }
+ }
+ }
+
+ function deleteFromMountList($entry)
+ {
+ if($this->acl_is_writeable("name")){
+ $type = $this->get_share_type($entry);
+ if (($type == "netatalk") || ($type == "NFS")) {
+ $this->mounts_to_remove[$entry] = $entry;
+ unset($this->mounts_to_add[$entry]);
+ }
+ }
+ }
+
+ function get_share_type($share)
+ {
+ $tmp = split("\|", $share);
+ return $tmp[2];
+ }
+
+ function returnMountEntry($entry)
+ {
+ $item = split("\|", $entry);
+ $name = $item[0];
+ $description = $item[1];
+ $type = $item[2];
+ $charset = $item[3];
+ $path = $item[4];
+ $options = $item[5];
+
+ switch ($type) {
+ case "netatalk" : {
+ $mount = array(
+ "mountDirectory" => "/Network/Servers/",
+ "mountOption" => array(
+ "net",
+ "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/"
+ ),
+ "mountType" => "url",
+ "objectClass" => "mount",
+ "cn" => $this->cn .":/".$name
+ );
+ break;
+ }
+ case "NFS" : {
+ $mount = array(
+ "mountDirectory" => "/Network/Servers/",
+ "mountOption" => "net",
+ "mountType" => "nfs",
+ "objectClass" => "mount",
+ "cn" => $this->cn .":".$path
+ );
+ break;
+ }
+ default : {
+ continue;
+ }
+ }
+ return $mount;
+ }
+
+
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+
+ $tmp =array();
+ if(isset($source['goExportEntry'])){
+ if(isset($source['goExportEntry']['count'])){
+ for($i= 0; $i<$source['goExportEntry']['count']; $i++){
+ $entry= $source['goExportEntry'][$i];
+ $tmp[preg_replace('/\|.*$/', '', $entry)]= $entry;
+ }
+ }
+ }
+ $this->goExportEntryList = $tmp;
+ $this->goExportEntry = $tmp;
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("File service (Shares)"),
+ "plDescription" => _("File service - Shares")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 90,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "name" => _("Name"),
+ "netatalkmount" => _("Apple mounts"),
+ "description" => _("Description"),
+ "type" => _("Type"),
+ "charset" => _("Charset"),
+ "path" => _("Path"),
+ "option" => _("Option"),
+ "volume" => _("Volume"))
+
+ ));
+ }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/shares/goShareServer.tpl b/gosa-plugins/goto/admin/systems/services/shares/goShareServer.tpl
--- /dev/null
@@ -0,0 +1,33 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Shares{/t}</h2>
+ <table summary="" style="width:100%">
+ <tr>
+ <td>
+{render acl=$nameACL mode=read_active}
+ <select style="width:100%" id="goExportEntry" name="goExportEntryList[]" size=12 multiple >
+ {html_options values=$goExportEntry output=$goExportEntryKeys}
+ <option disabled> </option>
+ </select>
+{/render}
+ <br>
+
+{render acl=$nameACL}
+ <input type="submit" value="{t}Add{/t}" name="NewNfsAdd" id="NewNfsAddId" {if !$createable} disabled {/if}>
+{/render}
+{render acl=$nameACL mode=read_active}
+ <input type="submit" value="{t}Edit{/t}" name="NewNfsEdit" id="NewNfsEditId">
+{/render}
+{render acl=$nameACL}
+ <input type="submit" value="{t}Delete{/t}" name="DelNfsEnt" id="DelNfsEntId" {if !$removeable} disabled {/if}>
+{/render}
+ </td>
+ </tr>
+ </table>
+
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goShareServerPosted" value="1">
diff --git a/gosa-plugins/goto/admin/systems/services/syslog/class_goLogDBServer.inc b/gosa-plugins/goto/admin/systems/services/syslog/class_goLogDBServer.inc
--- /dev/null
@@ -0,0 +1,106 @@
+<?php
+
+class goLogDBServer extends goService{
+
+ var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goLogDBServer");
+ var $attributes = array("goLogAdmin", "goLogPassword");
+ var $StatusFlag = "goLogDBServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goLogDBServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $acl;
+ var $cn = "";
+ var $goLogDBServerStatus = "";
+ var $goLogAdmin = "";
+ var $goLogPassword = "";
+ var $view_logged =FALSE;
+
+
+ function goLogDBServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+ $this->DisplayName = _("Syslog service database");
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+ $tmp = $this->plInfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translation){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+ return($smarty->fetch(get_template_path("goLogDBServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Syslog service database");
+ $fields['AllowEdit'] = true;
+ return($fields);
+ }
+
+
+ function check()
+ {
+ $message = plugin::check();
+ if (empty($this->goLogAdmin)){
+ $message[]= sprintf_("The attribute user is empty or contains invalid characters.");
+ }
+ if (empty($this->goLogPassword)){
+ $message[]= sprintf_("The attribute password is empty or contains invalid characters.");
+ }
+ return($message);
+ }
+
+
+ function save_object()
+ {
+ if(isset($_POST['goLogDBServerPosted'])){
+ plugin::save_object();
+ }
+ }
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Logging database"),
+ "plDescription" => _("Logging database")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 97,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "start" => _("Start"),
+ "stop" => _("Stop"),
+ "restart" => _("Restart"),
+ "goLogAdmin" => _("Admin"),
+ "goLogPassword" => _("Password"))
+ ));
+ }
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/syslog/class_goSyslogServer.inc b/gosa-plugins/goto/admin/systems/services/syslog/class_goSyslogServer.inc
--- /dev/null
@@ -0,0 +1,83 @@
+<?php
+
+class goSyslogServer extends goService{
+
+ var $cli_summary = "This plugin is used within the ServerService Pluign \nand indicates that this server has syslog server enabled.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goSyslogServer");
+ var $attributes = array();
+ var $StatusFlag = "goSyslogServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goSyslogServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $acl;
+ var $cn = "";
+ var $goSyslogServerStatus = "";
+ var $view_logged =FALSE;
+
+ function goSyslogServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+ $this->DisplayName = _("Syslog server");
+ }
+
+
+ function execute()
+ {
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+
+ $smarty = get_smarty();
+ return($smarty->fetch(get_template_path("goSyslogServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Syslog server");
+ $fields['AllowEdit'] = false;
+ return($fields);
+ }
+
+ function check()
+ {
+ $message = plugin::check();
+ return($message);
+ }
+
+
+ function save_object()
+ {
+ plugin::save_object();
+ }
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Logging service"),
+ "plDescription" => _("Logging service")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 88,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array()
+ ));
+ }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/syslog/goLogDBServer.tpl b/gosa-plugins/goto/admin/systems/services/syslog/goLogDBServer.tpl
--- /dev/null
@@ -0,0 +1,27 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Logging database information{/t}</h2>
+<table summary="">
+ <tr>
+ <td>{t}Logging DB user{/t}{$must}</td>
+ <td>
+{render acl=$goLogAdminACL}
+ <input name="goLogAdmin" id="goLogAdmin" size=30 maxlength=60 value="{$goLogAdmin}">
+{/render}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Password{/t}{$must}</td>
+ <td>
+{render acl=$goLogPasswordACL}
+ <input type=password name="goLogPassword" id="goLogPassword" size=30 maxlength=60 value="{$goLogPassword}">
+{/render}
+ </td>
+ </tr>
+ </table>
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goLogDBServerPosted" value="1">
diff --git a/gosa-plugins/goto/admin/systems/services/syslog/goSyslogServer.tpl b/gosa-plugins/goto/admin/systems/services/syslog/goSyslogServer.tpl
--- /dev/null
@@ -0,0 +1,9 @@
+<h2>{t}Syslog Service{/t} {t}enabled{/t}</h2>
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goCupsServerPosted" value="1">
diff --git a/gosa-plugins/goto/admin/systems/services/terminal/class_goTerminalServer.inc b/gosa-plugins/goto/admin/systems/services/terminal/class_goTerminalServer.inc
--- /dev/null
@@ -0,0 +1,141 @@
+<?php
+
+class goTerminalServer extends goService{
+
+ var $cli_summary = "This pluign is used within the ServerService Pluign \nand indicates that this server supports asterisk management.";
+ var $cli_description = "Some longer text\nfor help";
+ var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
+
+ /* This plugin only writes its objectClass */
+ var $objectclasses = array("goTerminalServer");
+ var $attributes = array("goXdmcpIsEnabled", "goFontPath");
+ var $StatusFlag = "goTerminalServerStatus";
+
+ /* This class can't be assigned twice so it conflicts with itsself */
+ var $conflicts = array("goTerminalServer");
+
+ var $DisplayName = "";
+ var $dn = NULL;
+ var $acl;
+ var $cn = "";
+ var $goTerminalServerStatus = "";
+ var $goXdmcpIsEnabled = false;
+ var $goFontPath = "";
+ var $view_logged =FALSE;
+
+
+ function goTerminalServer(&$config,$dn)
+ {
+ goService::goService($config,$dn);
+ $this->DisplayName = _("Terminal service");
+ }
+
+
+ function execute()
+ {
+ $smarty = get_smarty();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","server/".get_class($this),$this->dn);
+ }
+
+
+ $tmp = $this->plinfo();
+ foreach($tmp['plProvidedAcls'] as $name => $translation){
+ $smarty->assign($name."ACL",$this->getacl($name));
+ }
+
+ foreach($this->attributes as $attr){
+ $smarty->assign($attr,$this->$attr);
+ }
+ return($smarty->fetch(get_template_path("goTerminalServer.tpl",TRUE,dirname(__FILE__))));
+ }
+
+
+ function getListEntry()
+ {
+ $fields = goService::getListEntry();
+ $fields['Message'] = _("Terminal service");
+ $fields['AllowEdit'] = true;
+ return($fields);
+ }
+
+
+ function save()
+ {
+ plugin::save();
+
+ if(!$this->goXdmcpIsEnabled){
+ $this->attrs['goXdmcpIsEnabled'] = "0";
+ }
+
+ /* Check if this is a new entry ... add/modify */
+ $ldap = $this->config->get_ldap_link();
+ $ldap->cat($this->dn,array("objectClass"));
+ if($ldap->count()){
+ $ldap->cd($this->dn);
+ $ldap->modify($this->attrs);
+ }else{
+ $ldap->cd($this->dn);
+ $ldap->add($this->attrs);
+ }
+ show_ldap_error($ldap->get_error(), sprintf(_("Saving server services/terminalServer with dn '%s' failed."),$this->dn));
+ if($this->initially_was_account){
+ $this->handle_post_events("modify");
+ new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }else{
+ $this->handle_post_events("add");
+ new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ }
+ }
+
+
+ function check()
+ {
+ $message = plugin::check();
+ if(empty($this->goFontPath)){
+ $message[]=_("Terminal server, must have fontpath specified.");
+ }
+
+ return($message);
+ }
+
+
+ function save_object()
+ {
+ if(isset($_POST['goTerminalServerPosted'])){
+ plugin::save_object();
+ if($this->acl_is_writeable("goXdmcpIsEnabled")){
+ if(isset($_POST['goXdmcpIsEnabled'])){
+ $this->goXdmcpIsEnabled = true;
+ }else{
+ $this->goXdmcpIsEnabled = false;
+ }
+ }
+ }
+ }
+
+
+ /* Return plugin informations for acl handling */
+ static function plInfo()
+ {
+ return (array(
+ "plShortName" => _("Terminal service"),
+ "plDescription" => _("Terminal service")." ("._("Services").")",
+ "plSelfModify" => FALSE,
+ "plDepends" => array(),
+ "plPriority" => 87,
+ "plSection" => array("administration"),
+ "plCategory" => array("server"),
+
+ "plProvidedAcls"=> array(
+ "goXdmcpIsEnabled" => _("Temporary disable login"),
+ "goFontPath" => _("Font path"))
+ ));
+ }
+
+
+}
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/gosa-plugins/goto/admin/systems/services/terminal/goTerminalServer.tpl b/gosa-plugins/goto/admin/systems/services/terminal/goTerminalServer.tpl
--- /dev/null
@@ -0,0 +1,27 @@
+<h2><img class="center" alt="" align="middle" src="images/rightarrow.png" /> {t}Terminal service{/t}</h2>
+<table summary="">
+ <tr>
+ <td colspan=2>
+{render acl=$goXdmcpIsEnabledACL}
+ <input type="checkbox" value="true" name="goXdmcpIsEnabled" id="Temporariid" {if $goXdmcpIsEnabled} checked {/if}>
+{/render}
+ {t}Temporary disable login{/t}
+ </td>
+ </tr>
+ <tr>
+ <td>{t}Font path{/t}</td>
+ <td>
+{render acl=$goXdmcpIsEnabledACL}
+ <input type="text" value="{$goFontPath}" name="goFontPath" id="FontPathId">
+{/render}
+ </td>
+ </tr>
+ </table>
+
+<p class='seperator'> </p>
+<div style="width:100%; text-align:right;padding-top:10px;padding-bottom:3px;">
+ <input type='submit' name='SaveService' value='{t}Save{/t}'>
+
+ <input type='submit' name='CancelService' value='{t}Cancel{/t}'>
+</div>
+<input type="hidden" name="goTerminalServerPosted" value="1">