summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4857dcc)
raw | patch | inline | side by side (parent: 4857dcc)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 9 Dec 2005 06:11:51 +0000 (06:11 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 9 Dec 2005 06:11:51 +0000 (06:11 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2263 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_servRepository.inc | patch | blob | history | |
plugins/admin/systems/class_servRepositorySetup.inc | patch | blob | history |
diff --git a/plugins/admin/systems/class_servRepository.inc b/plugins/admin/systems/class_servRepository.inc
index a205138978ce365e7101111a40332dcb8d283084..21aa551ace56f4b17612120b5093686235d93f9e 100644 (file)
var $cli_parameters = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
/* attribute list for save action */
-// var $ignore_account = TRUE;
+ // var $ignore_account = TRUE;
var $attributes = array("FAIrepository");
var $objectclasses = array("FAIrepositoryServer");
{
plugin::plugin ($config, $dn);
$this->repositories = array();
- for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
- $tmp = split("\|",$this->attrs['FAIrepository'][$i]);
- $tmp2 = array();
- $tmp3 = array();
-
- $tmp2['ParentServer'] = $tmp[1];
- $tmp2['Url'] = $tmp[0];
- $tmp2['Release'] = $tmp[2];
-
- $tmp3 = split(",",$tmp[3]);
-
- foreach($tmp3 as $sec){
- $tmp2['Sections'][$sec]=$sec;
- }
- $this->repositories[$tmp[2]]=$tmp2;
-
+ if(isset($this->attrs['FAIrepository'])){
+ for($i = 0; $i < $this->attrs['FAIrepository']['count']; $i++){
+ $tmp = split("\|",$this->attrs['FAIrepository'][$i]);
+ $tmp2 = array();
+ $tmp3 = array();
+
+ $tmp2['ParentServer'] = $tmp[1];
+ if(empty($tmp[1])){
+ $tmp2['ParentServer'] = "none";
+ }
+ $tmp2['Url'] = $tmp[0];
+ $tmp2['Release'] = $tmp[2];
+
+ $tmp3 = split(",",$tmp[3]);
+
+ foreach($tmp3 as $sec){
+ $tmp2['Sections'][$sec]=$sec;
+ }
+ $this->repositories[$tmp[2]]=$tmp2;
+ }
}
}
$once = false;
foreach($_POST as $name => $value){
+ if((preg_match("/^delete_/",$name))&&(!$once)){
+ if(isset($this->repositories[$value])){
+ $once = true;
+ unset($this->repositories[$value]);
+ }
+ }
+
if((preg_match("/^edit_/",$name))&&(!$once)){
if(isset($this->repositories[$value])){
$once = true;
}
}
}
+
+ if((isset($_GET['act']))&&($_GET['act']=="open")&&(isset($_GET['id']))){
+ $obj = $this->repositories[$_GET['id']];
+ $obj['initialy_was'] = $obj['Release'];
+ $this->dialog = new servRepositorySetup($this->config,$this->dn,$obj);
+ $this->dialog->acl = $this->acl;
+ }
if(isset($_POST['AddRepository'])){
$this->dialog = new servRepositorySetup($this->config,$this->dn);
$divlist = new divSelectBox("repositories");
$divlist->setHeight(400);
-
- $edit = "<input type='image' value='%s' name='edit_%s' src='images/edit.png'>";
+ $link = "<a href='?plug=".$_GET['plug']."&act=open&id=%s'>%s</a>";
+ $edit = "<input type='image' value='%s' name='edit_%s' src='images/edit.png'> ";
+ $delete = "<input type='image' value='%s' name='delete_%s' src='images/edittrash.png'>";
foreach($this->repositories as $name => $reps){
$str = " ";
}
$divlist->AddEntry(array(
- array("string"=>$name),
- array("string"=>_("Sections")." :".$str),
- array("string"=>preg_replace("/%s/",$name,$edit),"attach"=>"style='border-right:0px;'")
+ array("string"=>preg_replace("/%s/",$name,$link)),
+ array("string"=>sprintf($link,$name,_("Sections")." :".$str)),
+ array("string"=>preg_replace("/%s/",$name,$edit.$delete),"attach"=>"style='border-right:0px;'")
));
}
function remove_from_parent()
{
- /* This cannot be removed... */
+ plugin::remove_from_parent();
+ $ldap= $this->config->get_ldap_link();
+ $ldap->cd ($this->config->current['BASE']);
+
+ $ldap->cat($this->dn);
+
+ if($ldap->count()){
+ $ldap->cd($this->dn);
+ $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");
+ }
}
$str.=$sec.",";
}
$str=preg_replace("/,$/","",$str);
+
+ if($conf['ParentServer']=="none"){
+ $conf['ParentServer'] ="";
+ }
+
$arr[]=$conf['Url']."|".$conf['ParentServer']."|".$conf['Release']."|".$str;
}
$this->attrs['FAIrepository'] = $arr;
diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc
index 2fa8a7cf6fa8551cb0dc13170e21ddde3a4071cd..3336616a0dbeead0e99491261948a00f9f929c59 100644 (file)
var $objectclasses = array("whatever");
/* Attributes */
- var $Release;
- var $ParentServer;
- var $Url;
- var $Sections=array();
- var $ParentServers;
-
+ var $Release ="";
+ var $ParentServer ="";
+ var $Url ="";
+ var $Sections =array();
+ var $ParentServers ="";
var $initialy_was=false;
function servRepositorySetup ($config, $dn= NULL,$data = false)
{
plugin::plugin ($config, $dn);
if($data != false){
- $this->Sections= $data['Sections'];
- $this->Url= $data['Url'];
- $this->Release= $data['Release'];
- $this->ParentServer= $data['ParentServer'];
- if(isset($data['initialy_was'])){
- $this->initialy_was= $data['initialy_was'];
+ foreach(array("Sections","Release","Url","ParentServer","initialy_was") as $atr){
+ if(isset($data[$atr])){
+ $this->$atr = $data[$atr];
+ }
}
}
}
{
$message= array();
- if(!isset($this->Release)){
+ 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);
}
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()){
$ret[$attr['cn'][0]]= $attr['cn'][0];