diff --git a/plugins/admin/systems/class_servRepositorySetup.inc b/plugins/admin/systems/class_servRepositorySetup.inc
index 24f1c92bd483a512ecdea67ecfe360e30c02a313..40f37b0628acca88f431cc89042a7e16b31cdcf2 100644 (file)
var $ParentServers = "";
var $initialy_was = false;
var $cn = "";
+ var $parent = "";
- function servRepositorySetup ($config, $dn= NULL,$data = false)
+ function servRepositorySetup (&$config, $dn= NULL,$data = false)
{
plugin::plugin ($config, $dn);
if($data != false){
$smarty= get_smarty();
if((isset($_POST['AddSection']))&&(isset($_POST['SectionName']))&&(!empty($_POST['SectionName']))){
- $this->Sections[$_POST['SectionName']]=$_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){
$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);
- $smarty->assign($attr."ACL" ,chkacl($this->acl,$attr));
}
$tmp = $this->getParentServers();
/* Save data to object */
function save_object()
{
- plugin::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];
+ }
+ }
+ }
}
function GetHookElements()
{
$ret = array();
- $cmd= search_config($this->config->data['TABS'], "servrepository", "EXTERNAL_HOOK");
+ $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 EXTERNAL_HOOK '%s' please check your gosa.conf."),$cmd));
+ 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 EXTERNAL_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
+ 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[1]] = $hookinfo[0];
+ if(preg_match("/;/",$hook)){
+ $hookinfo = split(";",$hook);
+ $ret[$hookinfo[0]] = $hookinfo[0];
}else{
$ret[$hook] = $hook;
}