[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [15587] Admin: user handling
From: |
sigurdne |
Subject: |
[Fmsystem-commits] [15587] Admin: user handling |
Date: |
Mon, 5 Sep 2016 18:14:12 +0000 (UTC) |
Revision: 15587
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=15587
Author: sigurdne
Date: 2016-09-05 18:14:11 +0000 (Mon, 05 Sep 2016)
Log Message:
-----------
Admin: user handling
Modified Paths:
--------------
trunk/admin/inc/class.boaccounts.inc.php
trunk/admin/inc/class.uiaccounts.inc.php
trunk/admin/js/base/groups.js
trunk/admin/templates/base/groups.xsl
trunk/phpgwapi/inc/accounts/class.accounts_.inc.php
Modified: trunk/admin/inc/class.boaccounts.inc.php
===================================================================
--- trunk/admin/inc/class.boaccounts.inc.php 2016-09-05 11:32:05 UTC (rev
15586)
+++ trunk/admin/inc/class.boaccounts.inc.php 2016-09-05 18:14:11 UTC (rev
15587)
@@ -186,13 +186,12 @@
if ( !$id ) // add new group?
{
$new_group->id = $id;
- $id =
$GLOBALS['phpgw']->accounts->create($new_group, $values['account_user'],
+ $id =
$GLOBALS['phpgw']->accounts->create($new_group, array(),
array(), array_keys($values['account_apps']));
}
else //edit group
{
-
$GLOBALS['phpgw']->accounts->update_group($new_group, $values['account_user'],
-
$values['account_apps']);
+
$GLOBALS['phpgw']->accounts->update_group($new_group, $values['account_apps']);
}
//Delete cached menu for members of group
Modified: trunk/admin/inc/class.uiaccounts.inc.php
===================================================================
--- trunk/admin/inc/class.uiaccounts.inc.php 2016-09-05 11:32:05 UTC (rev
15586)
+++ trunk/admin/inc/class.uiaccounts.inc.php 2016-09-05 18:14:11 UTC (rev
15587)
@@ -27,6 +27,7 @@
*/
phpgw::import_class('phpgwapi.jquery');
+ phpgw::import_class('phpgwapi.uicommon_jquery');
/**
* phpGroupWare Administration - Accounts User Interface
@@ -39,7 +40,7 @@
* @subpackage admin
* @category accounts
*/
- class admin_uiaccounts
+ class admin_uiaccounts extends phpgwapi_uicommon_jquery
{
/**
* @var array $public_functions Publicly available methods
@@ -57,7 +58,11 @@
'clear_user_cache' => true,
'clear_cache' => true,
'global_message' => true,
- 'home_screen_message' => true
+ 'home_screen_message' => true,
+ 'query' => true,
+ 'remove_group_user' => true,
+ 'reset_group_users' => true,
+ 'add_group_users' => true,
);
/**
@@ -82,6 +87,8 @@
*/
public function __construct()
{
+ parent::__construct();
+
$GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
$GLOBALS['phpgw_info']['flags']['menu_selection'] =
'admin::admin';
@@ -93,6 +100,152 @@
&&
$GLOBALS['phpgw_info']['server']['ldap_extra_attributes'];
}
+ function query( )
+ {
+ $account_id = phpgw::get_var('group_id',
'int');
+
+ if ( !$account_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return;
+ }
+
+ $type = phpgw::get_var('type');
+ $search = phpgw::get_var('search');
+ $order = phpgw::get_var('order');
+ $dir = $order[0]['dir'];
+ $columns = phpgw::get_var('columns');
+ $results = phpgw::get_var('length', 'int', 'REQUEST',
0);
+ $allrows = phpgw::get_var('length', 'int') == -1;
+ $query = $search['value'];
+ $start = phpgw::get_var('start', 'int', 'REQUEST', 0);
+
+
+ switch ($columns[$order[0]['column']]['data'])
+ {
+ case 'id':
+ $order = 'account_id';
+ break;
+ case 'name':
+ $order = 'account_lastname';
+ break;
+ default:
+ $order = 'account_lastname';
+ break;
+ }
+
+ $accounts =& $GLOBALS['phpgw']->accounts;
+
+ $group_members = $accounts->member($account_id);
+
+ //local application admin
+ if(!$GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin'))
+ {
+ $available_apps =
$GLOBALS['phpgw_info']['apps'];
+ $valid_users = array();
+ foreach($available_apps as $_app => $dummy)
+ {
+
if($GLOBALS['phpgw']->acl->check('admin', phpgwapi_acl::ADD, $_app))
+ {
+ $_valid_users =
$GLOBALS['phpgw']->acl->get_user_list_right(phpgwapi_acl::READ, 'run', $_app);
+
+ foreach($_valid_users as $_user)
+ {
+ $valid_users[] =
$_user['account_id'];
+ }
+ unset($_user);
+ unset($_valid_users);
+ }
+ }
+
+ $valid_users = array_unique($valid_users);
+
+ $account_list =
$GLOBALS['phpgw']->accounts->get_list('accounts', -1,$dir, $order, $query);
+ foreach($account_list as $user)
+ {
+ if(!in_array($user->id, $valid_users))
+ {
+ unset($account_list[$user->id]);
+ }
+ }
+ unset($user);
+ }
+ else
+ {
+ $account_list = $accounts->get_list('accounts',
-1, $dir, $order, $query);
+ }
+
+ $members = array();
+ $user_list = array();
+ foreach ( $account_list as $id => $user )
+ {
+ if(isset($group_members[$id]))
+ {
+ $member_list[] = array
+ (
+ 'id' => $id,
+ 'lid' => $user->lid,
+ 'name' => $user->__toString()
+ );
+ }
+ else
+ {
+ $user_list[] = array
+ (
+ 'id' => $id,
+ 'lid' => $user->lid,
+ 'name' => $user->__toString()
+ );
+ }
+ }
+
+ switch ($type)
+ {
+ case 'included_users':
+ $values = $member_list;
+ break;
+ case 'not_included_users':
+ $values = $user_list;
+ break;
+ default :
+ $values = array();
+ }
+
+ $total_records = count($values);
+ if (!$allrows)
+ {
+ if ($results)
+ {
+ $num_rows = $results;
+ }
+ else
+ {
+ $num_rows =
isset($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) ?
intval($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']) :
15;
+ }
+
//_debug_array(array($start,$this->total_records,$this->total_records,$num_rows));
+ $page = ceil(( $start / $total_records ) *
($total_records / $num_rows));
+
+ $out = array_chunk($values, $num_rows);
+
+ $result_data = array('results' => $out[$page]);
+ }
+ else
+ {
+ $result_data = array('results' => $values);
+ }
+
+ $link_data = array(
+ 'menuaction' => 'admin.uiaccounts.edit_user',
+ );
+
+ $result_data['total_records'] = $total_records;
+ $result_data['draw'] = phpgw::get_var('draw', 'int');
+
+ array_walk($result_data['results'], array($this,
'_add_links'), $link_data);
+ return $this->jquery_results($result_data);
+
+ }
/**
* Render a list of groups
*
@@ -574,15 +727,7 @@
{
$values =
phpgw::get_var('values', 'string', 'POST', array());
$account_apps =
phpgw::get_var('account_apps', 'string', 'POST');
- $account_user =
phpgw::get_var('account_user', 'int', 'POST');
- $values['account_user'] = array();
- if (is_array($account_user))
- {
-
- $values['account_user'] = $account_user;
- }
-
$values['account_apps'] = array();
if ( is_array($account_apps) &&
count($account_apps) )
{
@@ -625,7 +770,7 @@
$group_members = $accounts->member($account_id);
- //local application admin
+/* //local application admin
if(!$GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin'))
{
$available_apps =
$GLOBALS['phpgw_info']['apps'];
@@ -683,7 +828,7 @@
);
}
}
-
+*/
//FIXME this needs to be provided by the app itself -
thats why we have hooks
$apps_with_acl = array
(
@@ -783,7 +928,7 @@
// this is in the api, so lets not waste loops looking
for it the app tpl dirs
$GLOBALS['phpgw']->xslttpl->add_file('msgbox',
PHPGW_TEMPLATE_DIR, 3);
- $GLOBALS['phpgw']->xslttpl->add_file('groups');
+// $GLOBALS['phpgw']->xslttpl->add_file('groups');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('edit group');
if ( $account_id )
@@ -793,6 +938,7 @@
$data = array
(
+ 'datatable_def' =>
$this->_get_tableDef_user('edit', $account_id),
'page_title' => $account_id ?
lang('edit group') : lang('add group'),
'account_id' => $account_id,
'app_list' => $app_list,
@@ -801,8 +947,8 @@
'menuaction' => 'admin.uiaccounts.edit_group',
'account_id' => $account_id
)),
- 'guser_list' => $user_list,
- 'member_list' => $member_list,
+// 'guser_list' => $user_list,
+// 'member_list' => $member_list,
'img_close' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_close', '.png', false),
'img_save' =>
$GLOBALS['phpgw']->common->image('phpgwapi', 'stock_save', '.png', false),
'lang_cancel' => lang('cancel'),
@@ -814,9 +960,197 @@
'tabs' =>
phpgwapi_jquery::tabview_generate($tabs, 'data','group_edit_tabview')
);
- $GLOBALS['phpgw']->xslttpl->set_var('phpgw',
array('group_edit' => $data));
+ self::render_template_xsl(array('groups',
'datatable_inline'), array('group_edit' => $data));
}
+ function remove_group_user( )
+ {
+ $group_id = phpgw::get_var('group_id',
'int');
+ $account_user = (array)phpgw::get_var('account_user',
'int');
+
+ if ( !$group_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return array('error' => 'error');
+ }
+
+ if($group_id && isset($_POST['account_user']))
+ {
+ foreach ($account_user as $user_id)
+ {
+
$GLOBALS['phpgw']->accounts->delete_account4group($user_id, $group_id);
+ //Delete cached menu for members of
group
+ phpgwapi_cache::user_clear('phpgwapi',
'menu', $user_id);
+ }
+ return array('message' => 'OK');
+ }
+ }
+
+ function reset_group_users( )
+ {
+ $group_id = phpgw::get_var('group_id',
'int');
+ $account_user = array();
+
+ if ( !$group_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return array('error' => 'error');
+ }
+
+ if($group_id && isset($_POST))
+ {
+ $members =
$GLOBALS['phpgw']->accounts->member($group_id);
+ foreach($members as $entry)
+ {
+
$GLOBALS['phpgw']->accounts->delete_account4group($entry['account_id'],
$group_id);
+ //Delete cached menu for members of
group
+ phpgwapi_cache::user_clear('phpgwapi',
'menu', $entry['account_id']);
+ }
+ return array('message' => 'OK');
+ }
+ }
+
+ function add_group_users( )
+ {
+ $group_id = phpgw::get_var('group_id',
'int');
+ $account_user = (array)phpgw::get_var('account_user',
'int');
+
+ if ( !$group_id
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::EDIT, 'admin')
+ &&
!$GLOBALS['phpgw']->acl->check('group_access', phpgwapi_acl::PRIV, 'admin') )
+ {
+ return array('error' => 'error');
+ }
+
+ if($group_id && isset($_POST['account_user']))
+ {
+ foreach ($account_user as $user_id)
+ {
+
$GLOBALS['phpgw']->accounts->add_user2group($user_id, $group_id);
+ //Delete cached menu for members of
group
+ phpgwapi_cache::user_clear('phpgwapi',
'menu', $user_id);
+ }
+ return array('message' => 'OK');
+ }
+ }
+
+ private function _get_tableDef_user( $mode, $group_id )
+ {
+ $columns_def = array(
+ array('key' => 'id', 'label' => 'ID',
'className' => '','sortable' => true, 'hidden' => false,'formatter' =>
'JqueryPortico.formatLink'),
+ array('key' => 'lid', 'label' =>
lang('loginid'), 'className' => '', 'sortable' => true,'hidden' => false),
+ array('key' => 'name', 'label' => lang('name'),
'className' => '', 'sortable' => true,'hidden' => false),
+ );
+
+
+ if ($mode == 'edit')
+ {
+ $tabletools_user1 = array(
+ array('my_name' => 'select_all'),
+ array('my_name' => 'select_none')
+ );
+ $tabletools_user1[] = array
+ (
+ 'my_name' => 'remove',
+ 'text' => lang('remove'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'admin.uiaccounts.remove_group_user',
+ 'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'
+ )) . ";
+ var parameters = " .
json_encode(array('parameter' => array(array('name' => 'account_user',
+ 'source' =>
'id')))) . ";
+ removeUser(oArgs, parameters);
+ "
+ );
+
+ $tabletools_user1[] = array
+ (
+ 'my_name' => 'reset',
+ 'text' => lang('reset'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'admin.uiaccounts.reset_group_users',
+ 'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'
+ )) . ";
+ var parameters = " .
json_encode(array('parameter' => array(array('name' => 'account_user',
+ 'source' =>
'id')))) . ";
+ removeUser(oArgs, parameters);
+ "
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_1',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'admin.uiaccounts.query',
+ 'type' => 'included_users',
'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'))),
+ 'data' => json_encode(array()),
+ 'ColumnDefs' => $columns_def,
+ 'tabletools' => $tabletools_user1,
+ 'config' => array(
+ // array('disableFilter' => true),
+ )
+ );
+
+ $tabletools_user2 = array(
+ array('my_name' => 'select_all'),
+ array('my_name' => 'select_none')
+ );
+ $tabletools_user2[] = array
+ (
+ 'my_name' => 'add',
+ 'text' => lang('add'),
+ 'type' => 'custom',
+ 'custom_code' => "
+ var oArgs = " .
json_encode(array(
+ 'menuaction' =>
'admin.uiaccounts.add_group_users',
+ 'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'
+ )) . ";
+ var parameters = " .
json_encode(array('parameter' => array(array('name' => 'account_user',
+ 'source' =>
'id')))) . ";
+ addUser(oArgs, parameters);
+ "
+ );
+
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_2',
+ 'requestUrl' =>
json_encode(self::link(array('menuaction' => 'admin.uiaccounts.query',
+ 'type' => 'not_included_users',
'group_id' => $group_id,
+ 'phpgw_return_as' => 'json'))),
+ 'data' => json_encode(array()),
+ 'ColumnDefs' => $columns_def,
+ 'tabletools' => $tabletools_user2,
+ 'config' => array(
+ // array('disableFilter' => true)
+ )
+ );
+ }
+ else
+ {
+ $datatable_def[] = array
+ (
+ 'container' => 'datatable-container_1',
+ 'requestUrl' => "''",
+ 'data' => json_encode(array()),
+ 'ColumnDefs' => $columns_def,
+ 'config' => array(
+ // array('disableFilter' => true)
+ )
+ );
+ }
+
+ return $datatable_def;
+ }
+
/**
* Render a form for editing a user account
*
@@ -840,6 +1174,8 @@
}
$account_id = phpgw::get_var('account_id', 'int');
+ $id = phpgw::get_var('id', 'int');
+ $account_id = $account_id ? $account_id : $id;
if ( $account_id )
{
$user =
$GLOBALS['phpgw']->accounts->get($account_id);
Modified: trunk/admin/js/base/groups.js
===================================================================
--- trunk/admin/js/base/groups.js 2016-09-05 11:32:05 UTC (rev 15586)
+++ trunk/admin/js/base/groups.js 2016-09-05 18:14:11 UTC (rev 15587)
@@ -1,25 +1,93 @@
-/** Written by & (c) Dave Hall 2006 **/
-function updateManager()
+
+get_user_data = function ()
{
- var manager = document.getElementById('group_manager');
- var curManagerVal = manager.options[manager.selectedIndex].value;
- while ( manager.childNodes.length )
+ if (set_user_data === 0)
{
- manager.removeChild(manager.firstChild);
+ oTable1.dataTableSettings[1]['oFeatures']['bServerSide'] = true;
+ JqueryPortico.updateinlineTableHelper(oTable1,
link_included_user_items);
+
+ oTable2.dataTableSettings[2]['oFeatures']['bServerSide'] = true;
+ oTable2.dataTableSettings[2]['ajax'] = {url:
link_not_included_user_items, data: {}, type: 'GET'};
+ JqueryPortico.updateinlineTableHelper(oTable2);
+
+ set_user_data = 1;
}
-
- var users = document.getElementById('account_user');
- var userOption;
- for ( i=0; i < users.options.length; ++i )
+};
+
+getRequestData = function (dataSelected, parameters)
+{
+
+ var data = {};
+
+ $.each(parameters.parameter, function (i, val)
{
- if ( users.options[i].selected )
+ data[val.name] = {};
+ });
+
+ var n = 0;
+ for (var n = 0; n < dataSelected.length; ++n)
+ {
+ $.each(parameters.parameter, function (i, val)
{
- userOption = users.options[i].cloneNode(true);
- if ( userOption.value != curManagerVal )
- {
- userOption.selected = false;
- }
- manager.appendChild(userOption);
- }
+ data[val.name][n] = dataSelected[n][val.source];
+ });
}
-}
+
+ return data;
+};
+
+
+addUser = function (oArgs, parameters)
+{
+
+ var api = $('#datatable-container_2').dataTable().api();
+ var selected = api.rows({selected: true}).data();
+ var nTable = 1;
+
+ if (selected.length == 0)
+ {
+ alert('None selected');
+ return false;
+ }
+
+ var data = getRequestData(selected, parameters);
+ var requestUrl = phpGWLink('index.php', oArgs);
+
+ JqueryPortico.execute_ajax(requestUrl, function (result)
+ {
+
+ // JqueryPortico.show_message(nTable, result);
+
+ oTable1.fnDraw();
+ oTable2.fnDraw();
+
+ }, data, 'POST', 'JSON');
+};
+
+removeUser = function (oArgs, parameters)
+{
+
+ var api = $('#datatable-container_1').dataTable().api();
+ var selected = api.rows({selected: true}).data();
+ var nTable = 1;
+
+ if (selected.length == 0)
+ {
+ alert('None selected');
+ return false;
+ }
+
+ var data = getRequestData(selected, parameters);
+ var requestUrl = phpGWLink('index.php', oArgs);
+
+ JqueryPortico.execute_ajax(requestUrl, function (result)
+ {
+
+// JqueryPortico.show_message(nTable, result);
+
+ oTable1.fnDraw();
+ oTable2.fnDraw();
+
+ }, data, 'POST', 'JSON');
+};
+
Modified: trunk/admin/templates/base/groups.xsl
===================================================================
--- trunk/admin/templates/base/groups.xsl 2016-09-05 11:32:05 UTC (rev
15586)
+++ trunk/admin/templates/base/groups.xsl 2016-09-05 18:14:11 UTC (rev
15587)
@@ -1,239 +1,303 @@
<!-- $Id$ -->
+<xsl:template match="data">
+ <xsl:choose>
+ <xsl:when test="group_edit">
+ <xsl:apply-templates select="group_edit"/>
+ </xsl:when>
+ <xsl:when test="group_list">
+ <xsl:apply-templates select="group_list"/>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:call-template name="jquery_phpgw_i18n"/>
+</xsl:template>
- <xsl:template name="groups">
- <xsl:choose>
- <xsl:when test="group_list">
- <xsl:apply-templates select="group_list"/>
- </xsl:when>
- <xsl:when test="group_edit">
- <xsl:apply-templates select="group_edit"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
<!-- BEGIN group_list -->
- <xsl:template match="group_list">
- <div id="admin_group_list">
- <xsl:if test="search_access = 1">
- <div class="search">
- <xsl:call-template name="search_field"/>
- </div>
- </xsl:if>
-
- <div>
- <xsl:call-template name="nextmatchs"/>
+<xsl:template match="group_list">
+ <div id="admin_group_list">
+ <xsl:if test="search_access = 1">
+ <div class="search">
+ <xsl:call-template name="search_field"/>
</div>
+ </xsl:if>
- <table class="pure-table pure-table-bordered"
border="0" cellspacing="2" cellpadding="2">
- <thead>
- <xsl:apply-templates
select="group_header"/>
- </thead>
- <tbody>
- <xsl:apply-templates
select="group_data"/>
- </tbody>
- </table>
- <xsl:apply-templates select="group_add"/>
+ <div>
+ <xsl:call-template name="nextmatchs"/>
</div>
- </xsl:template>
+ <table class="pure-table pure-table-bordered" border="0"
cellspacing="2" cellpadding="2">
+ <thead>
+ <xsl:apply-templates select="group_header"/>
+ </thead>
+ <tbody>
+ <xsl:apply-templates select="group_data"/>
+ </tbody>
+ </table>
+ <xsl:apply-templates select="group_add"/>
+ </div>
+</xsl:template>
+
<!-- BEGIN group_header -->
- <xsl:template match="group_header">
- <tr>
- <th><a href="{sort_name}"><xsl:value-of
select="lang_name"/></a></th>
- <th><xsl:value-of select="lang_edit"/></th>
- <th><xsl:value-of select="lang_delete"/></th>
- </tr>
- </xsl:template>
+<xsl:template match="group_header">
+ <tr>
+ <th>
+ <a href="{sort_name}">
+ <xsl:value-of select="lang_name"/>
+ </a>
+ </th>
+ <th>
+ <xsl:value-of select="lang_edit"/>
+ </th>
+ <th>
+ <xsl:value-of select="lang_delete"/>
+ </th>
+ </tr>
+</xsl:template>
<!-- BEGIN group_data -->
- <xsl:template match="group_data">
- <tr>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <td><xsl:value-of select="group_name"/></td>
- <td class="action">
- <xsl:variable name="edit_url"
select="edit_url"/>
- <a href="{$edit_url}"
class="th_text"><xsl:value-of select="lang_edit"/></a>
- </td>
- <td class="action">
- <xsl:variable name="delete_url"
select="delete_url"/>
- <a href="{$delete_url}"
class="th_text"><xsl:value-of select="lang_delete"/></a>
- </td>
- </tr>
- </xsl:template>
+<xsl:template match="group_data">
+ <tr>
+ <xsl:attribute name="class">
+ <xsl:choose>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:text>row_off</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>row_on</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ <td>
+ <xsl:value-of select="group_name"/>
+ </td>
+ <td class="action">
+ <xsl:variable name="edit_url" select="edit_url"/>
+ <a href="{$edit_url}" class="th_text">
+ <xsl:value-of select="lang_edit"/>
+ </a>
+ </td>
+ <td class="action">
+ <xsl:variable name="delete_url" select="delete_url"/>
+ <a href="{$delete_url}" class="th_text">
+ <xsl:value-of select="lang_delete"/>
+ </a>
+ </td>
+ </tr>
+</xsl:template>
<!-- BEGIN group_add -->
- <xsl:template match="group_add">
- <div>
- <xsl:if test="add_access = 1">
- <a href="{add_url}"><xsl:value-of
select="lang_add" /></a>
- </xsl:if>
- <a href="{done_url}"><xsl:value-of select="lang_done"
/></a>
- </div>
- </xsl:template>
+<xsl:template match="group_add">
+ <div>
+ <xsl:if test="add_access = 1">
+ <a href="{add_url}">
+ <xsl:value-of select="lang_add" />
+ </a>
+ </xsl:if>
+ <a href="{done_url}">
+ <xsl:value-of select="lang_done" />
+ </a>
+ </div>
+</xsl:template>
<!-- END group_list -->
<!-- BEGIN group_edit -->
- <xsl:template match="group_edit" xmlns:php="http://php.net/xsl">
- <div id="admin_group_edit">
- <h1><xsl:value-of select="page_title" /></h1>
- <xsl:if test="msgbox_data != ''">
- <xsl:call-template name="msgbox"/>
- </xsl:if>
+<xsl:template match="group_edit" xmlns:php="http://php.net/xsl">
+ <div id="admin_group_edit">
+ <h1>
+ <xsl:value-of select="page_title" />
+ </h1>
+ <xsl:if test="msgbox_data != ''">
+ <xsl:call-template name="msgbox"/>
+ </xsl:if>
- <form name='body_form' action="{edit_url}"
method="post" onsubmit="process_list('all_users[]', 'account_user[]')">
- <div class="yui-navset" id="group_edit_tabview">
- <xsl:value-of
disable-output-escaping="yes" select="tabs" />
+ <form name='body_form' action="{edit_url}" method="post"
onsubmit="process_list('all_users[]', 'account_user[]')">
+ <div class="yui-navset" id="group_edit_tabview">
+ <xsl:value-of disable-output-escaping="yes"
select="tabs" />
- <div class="yui-content">
+ <div class="yui-content">
- <div id="group">
-
<h2><xsl:value-of select="php:function('lang', 'group')" /></h2>
- <input
type="hidden" name="values[account_id]" value="{account_id}"/>
- <ul
id="admin_account_form">
- <li>
-
<label for="account_name"><xsl:value-of select="php:function('lang', 'group
name')" /></label>
-
<input name="values[account_name]" value="{value_account_name}"
id="account_name" /><br class="eol" />
- </li>
- </ul>
+ <div id="group">
+ <h2>
+ <xsl:value-of
select="php:function('lang', 'group')" />
+ </h2>
+ <input type="hidden"
name="values[account_id]" value="{account_id}"/>
+ <ul id="admin_account_form">
+ <li>
+ <label
for="account_name">
+
<xsl:value-of select="php:function('lang', 'group name')" />
+ </label>
+ <input
name="values[account_name]" value="{value_account_name}" id="account_name" />
+ <br class="eol"
/>
+ </li>
+ </ul>
- <table
border="0" align="center" width="100%">
- <tbody
align="center">
-
<tr bgcolor="">
-
<td width="45%"><xsl:value-of select="php:function('lang', 'all
users')" /></td>
-
<td width="10%"></td>
-
<td width="45%"><xsl:value-of select="php:function('lang', 'members')"
/></td>
-
</tr>
-
<tr bgcolor="">
-
<td width="45%">
-
<select multiple ='multiple' size="10" name="all_users[]"
style="width:220">
-
<xsl:apply-templates select="guser_list"/>
-
</select>
-
</td>
-
<td width="10%">
-
<table border="0" align="center">
+ <!--table border="0"
align="center" width="100%">
+ <tbody align="center">
+ <tr bgcolor="">
+ <td
width="45%">
+
<xsl:value-of select="php:function('lang', 'all users')" />
+ </td>
+ <td
width="10%"></td>
+ <td
width="45%">
+
<xsl:value-of select="php:function('lang', 'members')" />
+ </td>
+ </tr>
+ <tr bgcolor="">
+ <td
width="45%">
+
<select multiple ='multiple' size="10" name="all_users[]" style="width:220">
+
<xsl:apply-templates select="guser_list"/>
+
</select>
+ </td>
+ <td
width="10%">
+
<table border="0" align="center">
<tbody align="center">
<tr>
-
<td>
-
<input type="button"
onClick="move('all_users[]','account_user[]','','account_user[]')"
value=">>"/>
-
</td>
+
<td>
+
<input type="button"
onClick="move('all_users[]','account_user[]','','account_user[]')"
value=">>"/>
+
</td>
</tr>
<tr>
-
<td>
-
<input type="button"
onClick="move('account_user[]','all_users[]','','account_user[]')"
value="<<"/>
-
</td>
+
<td>
+
<input type="button"
onClick="move('account_user[]','all_users[]','','account_user[]')"
value="<<"/>
+
</td>
</tr>
</tbody>
-
</table>
-
</td>
-
<td width="45%">
-
<select multiple = 'multiple' size="10" name="account_user[]"
id="account_user" style="width:220">
-
<xsl:apply-templates select="member_list"/>
-
</select>
-
</td>
-
</tr>
- </tbody>
- </table>
- </div>
-
- <div id="apps">
-
<h2><xsl:value-of select="php:function('lang', 'applications')" /></h2>
- <ul
class="app_list">
-
<xsl:apply-templates select="app_list" />
- </ul>
- </div>
+
</table>
+ </td>
+ <td
width="45%">
+
<select multiple = 'multiple' size="10" name="account_user[]" id="account_user"
style="width:220">
+
<xsl:apply-templates select="member_list"/>
+
</select>
+ </td>
+ </tr>
+ </tbody>
+ </table-->
+ <div>
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_1'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl' />
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+
<xsl:with-param name="tabletools" select ='tabletools' />
+
<xsl:with-param name="data" select ='data' />
+
<xsl:with-param name="config" select ='config' />
+
</xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
</div>
+ <div>
+ <xsl:for-each
select="datatable_def">
+ <xsl:if
test="container = 'datatable-container_2'">
+
<xsl:call-template name="table_setup">
+
<xsl:with-param name="container" select ='container'/>
+
<xsl:with-param name="requestUrl" select ='requestUrl' />
+
<xsl:with-param name="ColumnDefs" select ='ColumnDefs' />
+
<xsl:with-param name="tabletools" select ='tabletools' />
+
<xsl:with-param name="data" select ='data' />
+
<xsl:with-param name="config" select ='config' />
+
</xsl:call-template>
+ </xsl:if>
+ </xsl:for-each>
+ </div>
</div>
- <div class="button_group">
- <input type="submit" name="save"
value="{lang_save}" />
- <input type="submit" name="cancel"
value="{lang_cancel}" />
+
+ <div id="apps">
+ <h2>
+ <xsl:value-of
select="php:function('lang', 'applications')" />
+ </h2>
+ <ul class="app_list">
+ <xsl:apply-templates
select="app_list" />
+ </ul>
+ </div>
</div>
- </form>
- </div>
- </xsl:template>
+ </div>
+ <div class="button_group">
+ <input type="submit" name="save"
value="{lang_save}" />
+ <input type="submit" name="cancel"
value="{lang_cancel}" />
+ </div>
+ </form>
+ </div>
+</xsl:template>
- <xsl:template match="guser_list">
- <option value="{account_id}">
- <xsl:value-of select="account_name" />
- </option>
- </xsl:template>
+<xsl:template match="guser_list">
+ <option value="{account_id}">
+ <xsl:value-of select="account_name" />
+ </option>
+</xsl:template>
- <xsl:template match="member_list">
- <option value="{account_id}">
- <xsl:value-of select="account_name" />
- </option>
- </xsl:template>
+<xsl:template match="member_list">
+ <option value="{account_id}">
+ <xsl:value-of select="account_name" />
+ </option>
+</xsl:template>
- <xsl:template match="app_list">
- <li>
- <xsl:attribute name="class">
- <xsl:choose>
- <xsl:when test="position() mod 2 = 0">
- <xsl:text>row_off</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>row_on</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
-
+<xsl:template match="app_list">
+ <li>
+ <xsl:attribute name="class">
<xsl:choose>
- <xsl:when test="acl_url != ''">
- <a href="{acl_url}"><img
src="{acl_img}" title="{acl_img_name}" alt="{acl_img_name}" /></a>
+ <xsl:when test="position() mod 2 = 0">
+ <xsl:text>row_off</xsl:text>
</xsl:when>
<xsl:otherwise>
- <img src="{acl_img}"
title="{acl_img_name}" alt="{acl_img_name}" />
+ <xsl:text>row_on</xsl:text>
</xsl:otherwise>
</xsl:choose>
- <xsl:text> </xsl:text>
- <xsl:choose>
- <xsl:when test="grant_url != ''">
- <a href="{grant_url}"><img
src="{grant_img}" title="{grant_img_name}" alt="{grant_img_name}" /></a>
- </xsl:when>
- <xsl:otherwise>
+ </xsl:attribute>
+
+ <xsl:choose>
+ <xsl:when test="acl_url != ''">
+ <a href="{acl_url}">
+ <img src="{acl_img}"
title="{acl_img_name}" alt="{acl_img_name}" />
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="{acl_img}" title="{acl_img_name}"
alt="{acl_img_name}" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:text> </xsl:text>
+ <xsl:choose>
+ <xsl:when test="grant_url != ''">
+ <a href="{grant_url}">
<img src="{grant_img}"
title="{grant_img_name}" alt="{grant_img_name}" />
- </xsl:otherwise>
- </xsl:choose>
+ </a>
+ </xsl:when>
+ <xsl:otherwise>
+ <img src="{grant_img}" title="{grant_img_name}"
alt="{grant_img_name}" />
+ </xsl:otherwise>
+ </xsl:choose>
- <xsl:choose>
- <xsl:when test="i_am_admin = '1'">
- <input type="checkbox" id="{elmid}"
name="{checkbox_name}" value="1">
- <xsl:if test="checked = '1'">
- <xsl:attribute
name="checked">
-
<xsl:text>checked</xsl:text>
- </xsl:attribute>
- </xsl:if>
- </input>
- </xsl:when>
- <xsl:otherwise>
- <input type="hidden" id="{elmid}"
name="{checkbox_name}">
- <xsl:if test="checked = '1'">
- <xsl:attribute
name="value">
-
<xsl:text>1</xsl:text>
- </xsl:attribute>
- </xsl:if>
- </input>
- <input type="checkbox" readonly='true'>
- <xsl:if test="checked = '1'">
- <xsl:attribute
name="checked">
-
<xsl:text>checked</xsl:text>
- </xsl:attribute>
- </xsl:if>
- </input>
- </xsl:otherwise>
- </xsl:choose>
- <label for="{elmid}">
- <xsl:value-of select="app_title" />
- </label>
- </li>
- </xsl:template>
+ <xsl:choose>
+ <xsl:when test="i_am_admin = '1'">
+ <input type="checkbox" id="{elmid}"
name="{checkbox_name}" value="1">
+ <xsl:if test="checked = '1'">
+ <xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:when>
+ <xsl:otherwise>
+ <input type="hidden" id="{elmid}"
name="{checkbox_name}">
+ <xsl:if test="checked = '1'">
+ <xsl:attribute name="value">
+ <xsl:text>1</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+ <input type="checkbox" readonly='true'>
+ <xsl:if test="checked = '1'">
+ <xsl:attribute name="checked">
+
<xsl:text>checked</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ </input>
+ </xsl:otherwise>
+ </xsl:choose>
+ <label for="{elmid}">
+ <xsl:value-of select="app_title" />
+ </label>
+ </li>
+</xsl:template>
Modified: trunk/phpgwapi/inc/accounts/class.accounts_.inc.php
===================================================================
--- trunk/phpgwapi/inc/accounts/class.accounts_.inc.php 2016-09-05 11:32:05 UTC
(rev 15586)
+++ trunk/phpgwapi/inc/accounts/class.accounts_.inc.php 2016-09-05 18:14:11 UTC
(rev 15587)
@@ -649,35 +649,16 @@
* Update the data for a group
*
* @param object $group the phpgwapi_account_group object to
use for the update
- * @param array $users the list of users who belong in the
group
* @param array $modules the list of modules the group shall
have access to
*
* @return integer the group id
*/
- public function update_group($group, $users, $modules = null)
+ public function update_group($group, $modules = null)
{
$this->account = $group;
$this->account_id = $group->id;
$this->save_repository();
- // handle group memberships
- $old_users = array_keys($this->member($group->id));
- $new_users = $users;
- $drop_users = array_diff($old_users, $new_users);
- if ( is_array($drop_users) && count($drop_users) )
- {
- foreach ( $drop_users as $user )
- {
- $this->delete_account4group($user,
$group->id);
- }
- }
- unset($old_users, $users, $drop_users);
-
- foreach ( $new_users as $user )
- {
- $this->add_user2group($user, $group->id);
- }
-
// module permissions
if ( is_array($modules) )
{
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [15587] Admin: user handling,
sigurdne <=