Commit b1f37234 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

Fixes #5044 Migrated GPG select dialog to simpleSelectManagement

parent d21b2132
......@@ -18,12 +18,34 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class pgpKeySelect extends management
class pgpKeySelect extends simpleSelectManagement
{
protected $skipFooter = TRUE;
protected $skipHeader = TRUE;
protected $objectTypes = array();
protected $autoFilter = FALSE;
protected $departmentBrowser = FALSE;
protected $departmentRootVisible = FALSE;
protected $baseMode = FALSE;
protected $multiSelect = TRUE;
function __construct()
{
$this->listXMLPath = get_template_path('pgpKeySelect-list.xml', TRUE, dirname(__FILE__));
parent::__construct();
}
function configureHeadpage ()
{
parent::configureHeadpage();
$this->headpage->registerElementFilter('pgpDate', 'pgpKeySelect::filterPgpDate');
$this->headpage->registerElementFilter('pgpSize', 'pgpKeySelect::filterPgpSize');
$this->headpage->registerElementFilter('pgpDisabled', 'pgpKeySelect::filterPgpRevoked');
$this->headpage->registerElementFilter('pgpRevoked', 'pgpKeySelect::filterPgpRevoked');
}
/* Build the filter */
function configureFilter ()
{
global $config;
......@@ -39,28 +61,15 @@ class pgpKeySelect extends management
} else {
msg_dialog::display(_('Configuration error'), _('You need to configure GPG base dn through the addons section first'));
}
$filter = new filter(get_template_path('pgpKeySelect-filter.xml', TRUE, dirname(__FILE__)));
$filter->setObjectStorage($this->storagePoints);
$this->setFilter($filter);
// Build headpage
$headpage = new listing(get_template_path('pgpKeySelect-list.xml', TRUE, dirname(__FILE__)));
$headpage->registerElementFilter('pgpDate', 'pgpKeySelect::filterPgpDate');
$headpage->registerElementFilter('pgpSize', 'pgpKeySelect::filterPgpSize');
$headpage->registerElementFilter('pgpDisabled', 'pgpKeySelect::filterPgpRevoked');
$headpage->registerElementFilter('pgpRevoked', 'pgpKeySelect::filterPgpRevoked');
$headpage->setBase($config->current['BASE']);
$headpage->setFilter($filter);
parent::__construct('', $headpage);
}
function renderList()
{
$smarty = get_smarty();
$smarty->assign('objectFilters', array());
return parent::renderList();
$this->filter->setObjectStorage($this->storagePoints);
$this->filter->category = 'user';
$this->filter->query['0']['backend'] = 'LDAPBlacklist';
$attributes = array('pgpKeyID', 'pgpUserID', 'pgpKeyCreateTime', 'pgpKeyExpireTime', 'pgpKeyType', 'pgpKeySize');
$this->filter->query[0]['filter'] = '$NAME';
$this->filter->query[0]['attribute'] = $attributes;
$this->filter->elements['NAME']['set'] = '(|('.join('=*$*)(', $attributes).'=*$*))';
$this->filter->elements['NAME']['autocomplete']['filter'] = '(|('.join('=*$NAME*)(', $attributes).'=*$NAME*))';
$this->filter->elements['NAME']['autocomplete']['attribute'] = $attributes;
}
static function filterSingleValue($value, $func)
......
<?xml version="1.0" encoding="UTF-8"?>
<filterdef>
<definition>
<category>groups</category>
<template>simple-filter.tpl</template>
<initial>true</initial>
</definition>
<search>
<query>
<backend>LDAPBlacklist</backend>
<filter>(&amp;(objectClass=pgpKeyInfo)$NAME)</filter>
<attribute>dn</attribute>
<attribute>objectClass</attribute>
<attribute>pgpKeyID</attribute>
<attribute>pgpUserID</attribute>
<attribute>pgpKeyCreateTime</attribute>
<attribute>pgpKeyExpireTime</attribute>
<attribute>pgpKeyType</attribute>
<attribute>pgpKeySize</attribute>
<attribute>pgpRevoked</attribute>
<attribute>pgpDisabled</attribute>
</query>
<scope>auto</scope>
</search>
<element>
<type>textfield</type>
<tag>NAME</tag>
<size>20</size>
<maxlength>60</maxlength>
<default></default>
<unset></unset>
<set>(pgpUserID=*$*)</set>
<alphabet>false</alphabet>
<autocomplete>
<backend>LDAPBlacklist</backend>
<filter>(pgpUserID=*$NAME*)</filter>
<attribute>pgpUserID</attribute>
<frequency>0.5</frequency>
<characters>3</characters>
</autocomplete>
</element>
</filterdef>
{include file={filePath file="simple-list.tpl"}}
<p class="plugbottom">
<input type="submit" name="add_finish" value="{msgPool type=addButton}"/>
&nbsp;
<input type="submit" name="add_cancel" value="{msgPool type=cancelButton}"/>
</p>
......@@ -6,7 +6,8 @@
<departmentRootVisible>false</departmentRootVisible>
<baseMode>false</baseMode>
<multiSelect>true</multiSelect>
<template>../plugins/personal/gpg/pgpKeySelect/pgpKeySelect-list.tpl</template>
<template>simple-select-list.tpl</template>
<module>simple</module>
<label>Please select the desired entries</label>
<defaultSortColumn>1</defaultSortColumn>
......@@ -17,7 +18,6 @@
<class>gpgAccount</class>
<image>geticon.php?context=status&amp;icon=dialog-password&amp;size=16</image>
</objectType>
</definition>
<table>
......@@ -29,7 +29,7 @@
<department>
<value>%{filter:departmentLink(row,dn,description)}</value>
<span>1</span>
<span>2</span>
</department>
<column>
......@@ -40,7 +40,7 @@
<label>Key ID</label>
<sortAttribute>pgpKeyID</sortAttribute>
<sortType>string</sortType>
<value>%{pgpKeyID}</value>
<value>%{filter:selectLink(pid,row,dn,pgpKeyID)}</value>
<export>true</export>
</column>
......@@ -48,7 +48,7 @@
<label>User</label>
<sortAttribute>pgpUserID</sortAttribute>
<sortType>string</sortType>
<value>%{pgpUserID}</value>
<value>%{filter:selectLink(pid,row,dn,pgpUserID)}</value>
<export>true</export>
</column>
......@@ -99,7 +99,6 @@
<value>%{filter:pgpDisabled(pgpDisabled)}</value>
<export>true</export>
</column>
</table>
<actionmenu>
......
Supports Markdown
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