From 3ba8a10bb3e56a20f8e4102a8f1d4882fdfba7a5 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 9 Jun 2006 11:24:38 +0000 Subject: [PATCH] Added repository service git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3765 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_servRepository.inc | 73 ++++++++++++++++++- plugins/admin/systems/servRepository.tpl | 9 +++ 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc index 9a3114e80..44b59d757 100644 --- a/plugins/admin/systems/class_servRepository.inc +++ b/plugins/admin/systems/class_servRepository.inc @@ -19,13 +19,21 @@ class servrepository extends plugin var $dialog = NULL; /* Repositories */ - var $repositories = array(); - var $FAIrepository = array(); + var $repositories = array(); + var $FAIrepository = array(); + + + var $conflicts = array("FAIrepositoryServer"); + var $DisplayName = ""; + var $StatusFlag = ""; + function servrepository ($config, $dn= NULL) { plugin::plugin ($config, $dn); + $this->DisplayName = _("Repository service"); + $this->repositories = array(); if(isset($this->attrs['FAIrepository'])){ for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){ @@ -362,6 +370,67 @@ class servrepository extends plugin } } + /* Get updates for status flag */ + function updateStatusState() + { + if(empty($this->StatusFlag)) return; + + $attrs = array(); + $flag = $this->StatusFlag; + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->cn); + $ldap->cat($this->dn,array($flag)); + if($ldap->count()){ + $attrs = $ldap->fetch(); + } + if(isset($attrs[$flag][0])){ + $this->$flag = $attrs[$flag][0]; + } + } + + + function getListEntry() + { + $this->updateStatusState(); + $flag = $this->StatusFlag; + if(empty($flag)){ + $fields['Status'] = ""; + }else{ + $fields['Status'] = $this->$flag; + } + $fields['Message'] = _("Repository service"); + $fields['AllowStart'] = true; + $fields['AllowStop'] = true; + $fields['AllowRestart'] = true; + $fields['AllowRemove']= true; + $fields['AllowEdit'] = true; + return($fields); + } + + + /* Directly save new status flag */ + function setStatus($value) + { + if($value == "none") return; + if(!$this->initially_was_account) return; + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->dn); + $ldap->cat($this->dn,array("objectClass")); + if($ldap->count()){ + + $tmp = $ldap->fetch(); + for($i = 0; $i < $tmp['objectClass']['count']; $i ++){ + $attrs['objectClass'][] = $tmp['objectClass'][$i]; + } + $flag = $this->StatusFlag; + $attrs[$flag] = $value; + $this->$flag = $value; + $ldap->modify($attrs); + show_ldap_error($ldap->get_error()); + $this->action_hook(); + } + } + } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: diff --git a/plugins/admin/systems/servRepository.tpl b/plugins/admin/systems/servRepository.tpl index 8213703a2..84a4bcdb9 100644 --- a/plugins/admin/systems/servRepository.tpl +++ b/plugins/admin/systems/servRepository.tpl @@ -57,3 +57,12 @@ + +

 

+

+

+ +   + +
+

-- 2.30.2