Commit 98a2ecbc authored by Côme Bernigaud's avatar Côme Bernigaud Committed by Benoit Mortier
Browse files

Fixes: #2595 Clean objectSelect and fixed tabs_ogroup

parent fea1e1bb
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003 Cajus Pollmeier
......@@ -22,76 +21,62 @@
class objectSelect extends management
{
// Tab definition
protected $skipFooter = TRUE;
protected $skipHeader = TRUE;
function __construct($config,$ui)
function __construct($config, $ui)
{
$this->config = $config;
$this->ui = $ui;
$this->ui = $ui;
$this->storagePoints = array(
get_ou("userRDN"),
get_ou("groupRDN"),
get_ou("applicationRDN"),
get_ou("terminalRDN"),
get_ou("workstationRDN"),
get_ou("sambaMachineAccountRDN"),
get_ou("serverRDN"),
get_ou("printerRDN"),
get_ou("phoneRDN"));
get_ou("userRDN"),
get_ou("groupRDN"),
get_ou("applicationRDN"),
get_ou("terminalRDN"),
get_ou("workstationRDN"),
get_ou("sambaMachineAccountRDN"),
get_ou("serverRDN"),
get_ou("printerRDN"),
get_ou("phoneRDN")
);
# // Build filter
# if (session::global_is_set(get_class($this)."_filter")){
# $filter= session::global_get(get_class($this)."_filter");
# } else {
$filter = new filter(get_template_path("selectObject-filter.xml", true, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
#}
// Build filter
$filter = new filter(get_template_path("selectObject-filter.xml", TRUE, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
$this->setFilter($filter);
// Build headpage
$headpage = new listing(get_template_path("selectObject-list.xml", true, dirname(__FILE__)));
$headpage->registerElementFilter("depLabel", "objectSelect::filterDepLabel");
$this->registerAction("open","openEntry");
$headpage = new listing(get_template_path("selectObject-list.xml", TRUE, dirname(__FILE__)));
$headpage->registerElementFilter("selectLink", "objectSelect::filterSelectLink");
$headpage->setFilter($filter);
parent::__construct($config, $ui, "object", $headpage);
}
// An action handler which enables to switch into deparmtment by clicking the names.
function openEntry($action,$entry)
{
$headpage = $this->getHeadpage();
$headpage->setBase(array_pop($entry));
}
// A filter which allows to open a department by clicking on the departments name.
static function filterDepLabel($row,$dn,$pid,$base,$objectClass, $cn)
static function filterSelectLink()
{
$cn = $cn[0];
if(!in_array('gosaDepartment', $objectClass)){
return($cn);
}
if($dn == $base){
$cn =".";
$pid = func_get_arg(0);
$row = func_get_arg(1);
$dn = func_get_arg(2);
$trans = func_get_arg(3)[0];
if ($trans != "") {
return "<a href='?plug=".$_GET['plug']."&amp;PID=$pid&amp;act=listing_select_$row&amp;objectSelect_save=1' title='$dn'>$trans</a>";
}
$dn= LDAP::fix(func_get_arg(1));
return("<a href='?plug=".$_GET['plug']."&amp;PID=$pid&amp;act=listing_open_$row' title='$dn'>$cn</a>");
return '';
}
function save()
{
$act = $this->detectPostActions();
$act = $this->detectPostActions();
$headpage = $this->getHeadpage();
if(!isset($act['targets'])) return(array());
if (!isset($act['targets'])) {
return array();
}
$ret = array();
foreach($act['targets'] as $dn){
foreach ($act['targets'] as $dn) {
$ret[] = $headpage->getEntry($dn);
}
return($ret);
return $ret;
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
......@@ -2,8 +2,8 @@
<list>
<definition>
<departmentBrowser>false</departmentBrowser>
<departmentRootVisible>false</departmentRootVisible>
<departmentBrowser>true</departmentBrowser>
<departmentRootVisible>true</departmentRootVisible>
<baseMode>true</baseMode>
<multiSelect>true</multiSelect>
<template>../plugins/admin/ogroups/objectSelect/selectObject-list.tpl</template>
......@@ -112,7 +112,7 @@
<label>Name</label>
<sortAttribute>cn</sortAttribute>
<sortType>string</sortType>
<value>%{filter:depLabel(row,dn,pid,base,objectClass,cn)}</value>
<value>%{filter:selectLink(row,dn,pid,cn)}</value>
<export>true</export>
</column>
......
......@@ -263,10 +263,10 @@ class ogrouptabs extends tabs
/* Don't touch base object */
if ($name != 'ogroup') {
$obj->parent = &$this;
$obj->uid = $baseobject->uid;
$obj->uid = $baseobject->cn;
$obj->cn = $baseobject->cn;
$obj->sn = $baseobject->uid;
$obj->givenName = $baseobject->uid;
$obj->sn = $baseobject->cn;
$obj->givenName = $baseobject->cn;
$this->by_object[$name]= $obj;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment