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

Fixes: #2595 The code should follow code guidelines

parent 0bfb5bf2
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003 Cajus Pollmeier
Copyright (C) 2011-2013 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class singleUserSelect extends management
{
protected $skipFooter = TRUE;
protected $skipHeader = TRUE;
function __construct($config,$ui)
{
$this->config = $config;
$this->ui = $ui;
$this->storagePoints = array(get_ou("userRDN"));
# // 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("singleUser-filter.xml", true, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
# }
$this->setFilter($filter);
// Build headpage
$headpage = new listing(get_template_path("singleUser-list.xml", true, dirname(__FILE__)));
$headpage->setFilter($filter);
parent::__construct($config, $ui, "user", $headpage);
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
<div class="contentboxh">
<p class="contentboxh">
<img src="images/launch.png" align="right" alt="[F]">{t}Filter{/t}
</p>
</div>
<div class="contentboxb">
{$SCOPE}
<table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
<tr>
<td>
<label for="NAME">
<img src="images/lists/search.png" align=middle>&nbsp;{t}Name{/t}
</label>
</td>
<td>
{$NAME}
</td>
</tr>
</table>
<table summary="" width="100%" style="background:#EEEEEE;border-top:1px solid #B0B0B0;">
<tr>
<td width="100%" align="right">
{$APPLY}
</td>
</tr>
</table>
</div>
<?xml version="1.0" encoding="UTF-8"?>
<filterdef>
<definition>
<category>groups</category>
<template>../plugins/admin/groups/singleUserSelect/singleUser-filter.tpl</template>
<initial>true</initial>
</definition>
<search>
<query>
<backend>LDAPBlacklist</backend>
<filter>(&amp;(objectClass=gosaAccount)$NAME)</filter>
<attribute>dn</attribute>
<attribute>objectClass</attribute>
<attribute>cn</attribute>
<attribute>sn</attribute>
<attribute>givenName</attribute>
<attribute>uid</attribute>
<attribute>description</attribute>
</query>
<scope>auto</scope>
</search>
<element>
<type>textfield</type>
<tag>NAME</tag>
<size>20</size>
<maxlength>60</maxlength>
<default></default>
<unset></unset>
<set>(|(sn=*$*)(givenName=*$*)(cn=*$*)(uid=*$*))</set>
<alphabet>true</alphabet>
<autocomplete>
<backend>LDAPBlacklist</backend>
<filter>(&amp;(objectClass=gosaAccount)(|(sn=*$NAME*)(givenName=*$NAME*)(cn=*$NAME*)(uid=*$NAME*)))</filter>
<attribute>cn</attribute>
<frequency>0.5</frequency>
<characters>3</characters>
</autocomplete>
</element>
</filterdef>
<table summary="" style="width:100%;height:100%; vertical-align:top; text-align:left;" cellpadding=2>
<tr>
<td style="vertical-align:top; width:100%;">
<div class="contentboxh">
<p class="contentboxh">&nbsp;{$HEADLINE}&nbsp;{$SIZELIMIT}</p>
</div>
<div class="contentboxb">
<div style='background:white;padding:3px;'>
<table><tr>
<td>{$ROOT}&nbsp;</td><td>{$BACK}&nbsp;</td><td>{$HOME}&nbsp;</td><td>{$RELOAD}&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td>{t}Base{/t} {$BASE}&nbsp;</td><td>{$SEPARATOR}&nbsp;</td><td><img src='images/rocket.png' alt='' class='center'></td><td> {$ACTIONS}</td>
</tr></table>
</div>
</div>
<div style='height:4px;'>
</div>
{$LIST}
</td>
<td style='vertical-align:top;min-width:250px'>
{$FILTER}
</td>
</tr>
</table>
<p class="plugbottom">
<input type=submit name="add_users_finish" value="{msgPool type=addButton}">
&nbsp;
<input type=submit name="add_users_cancel" value="{msgPool type=cancelButton}">
</p>
<input type="hidden" name="ignore">
<?xml version="1.0" encoding="UTF-8"?>
<list>
<definition>
<departmentBrowser>true</departmentBrowser>
<departmentRootVisible>false</departmentRootVisible>
<baseMode>true</baseMode>
<multiSelect>false</multiSelect>
<template>../plugins/admin/groups/singleUserSelect/singleUser-list.tpl</template>
<label>Please select the desired entries</label>
<defaultSortColumn>1</defaultSortColumn>
<objectType>
<label>User</label>
<objectClass>gosaAccount</objectClass>
<category>users</category>
<class>user</class>
<image>plugins/users/images/iconMini.png</image>
</objectType>
</definition>
<table>
<layout>|20px;c||||80px;r|</layout>
<department>
<value>%{filter:objectType(dn,objectClass)}</value>
</department>
<department>
<value>%{filter:departmentLink(row,dn,description)}</value>
<span>1</span>
</department>
<column>
<value>%{filter:objectType(dn,objectClass)}</value>
</column>
<column>
<label>Given name</label>
<sortAttribute>givenName</sortAttribute>
<sortType>string</sortType>
<value>%{givenName}</value>
<export>true</export>
</column>
<column>
<label>Surname</label>
<sortAttribute>sn</sortAttribute>
<sortType>string</sortType>
<value>%{sn}</value>
<export>true</export>
</column>
<column>
<label>Login</label>
<sortAttribute>uid</sortAttribute>
<sortType>string</sortType>
<value>%{uid}</value>
<export>true</export>
</column>
<column>
<label>Actions</label>
<value>%{filter:actions(dn,row,objectClass)}</value>
</column>
</table>
<actionmenu>
</actionmenu>
<actiontriggers snapshot="false" copypaste="false">
<action>
<name>selectUser</name>
<type>entry</type>
<image>images/empty.png</image>
<label>Select user</label>
</action>
<action>
<name>selectUser</name>
<type>entry</type>
<image>images/lists/edit.png</image>
<label>Select user</label>
</action>
</actiontriggers>
</list>
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003 Cajus Pollmeier
......@@ -22,42 +21,36 @@
class userGroupSelect 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->storagePoints = array(get_ou("userRDN"), get_ou("groupRDN"));
# // 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("selectUserGroup-filter.xml", true, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
#}
// Build filter
$filter = new filter(get_template_path("selectUserGroup-filter.xml", TRUE, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
$this->setFilter($filter);
// Build headpage
$headpage = new listing(get_template_path("selectUserGroup-list.xml", true, dirname(__FILE__)));
$headpage = new listing(get_template_path("selectUserGroup-list.xml", TRUE, dirname(__FILE__)));
$headpage->setFilter($filter);
parent::__construct($config, $ui, "object", $headpage);
}
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:
?>
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003 Cajus Pollmeier
......@@ -22,31 +21,59 @@
class userSelect extends management
{
protected $skipFooter = TRUE;
protected $skipHeader = TRUE;
function __construct($config,$ui)
function __construct($config, $ui)
{
$this->config = $config;
$this->ui = $ui;
$this->storagePoints = array(get_ou("userRDN"));
# // 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("user-filter.xml", true, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
# }
// Build filter
$filter = new filter(get_template_path("user-filter.xml", TRUE, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
$this->setFilter($filter);
// Build headpage
$headpage = new listing(get_template_path("user-list.xml", true, dirname(__FILE__)));
$headpage = new listing(get_template_path("user-list.xml", TRUE, dirname(__FILE__)));
$headpage->registerElementFilter("selectLink", get_class($this)."::filterSelectLink");
$headpage->setFilter($filter);
parent::__construct($config, $ui, "user", $headpage);
}
static function filterSelectLink()
{
// TODO : replace this with javascript that select the line
$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;add_users_finish=1' title='$dn'>$trans</a>";
}
return '';
}
}
class singleUserSelect extends userSelect
{
function __construct($config, $ui)
{
parent::__construct($config, $ui);
$this->headpage->multiSelect = FALSE;
}
static function filterSelectLink()
{
$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;add_users_finish=1' title='$dn'>$trans</a>";
}
return '';
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
?>
......@@ -40,7 +40,7 @@
<label>Given name</label>
<sortAttribute>givenName</sortAttribute>
<sortType>string</sortType>
<value>%{givenName}</value>
<value>%{filter:selectLink(pid,row,dn,givenName)}</value>
<export>true</export>
</column>
......@@ -48,7 +48,7 @@
<label>Surname</label>
<sortAttribute>sn</sortAttribute>
<sortType>string</sortType>
<value>%{sn}</value>
<value>%{filter:selectLink(pid,row,dn,sn)}</value>
<export>true</export>
</column>
......@@ -56,10 +56,9 @@
<label>Login</label>
<sortAttribute>uid</sortAttribute>
<sortType>string</sortType>
<value>%{uid}</value>
<value>%{filter:selectLink(pid,row,dn,uid)}</value>
<export>true</export>
</column>
</table>
<actionmenu>
......
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