removed old accounts-popup

This commit is contained in:
Ralf Becker 2004-06-15 10:19:02 +00:00
parent f2a16d4e52
commit 1bc44b879d
2 changed files with 0 additions and 493 deletions

View File

@ -544,340 +544,4 @@
return $data;
}
function accounts_popup($app)
{
$group_id = get_var('group_id',array('GET','POST'));
/*if(isset($_GET['group_id']))
{
$group_id = $_GET['group_id'];
}*/
if(isset($_POST['query']))
{
$GLOBALS['query'] = $_POST['query'];
}
if(isset($_POST['start']))
{
$start = (int)$_POST['start'];
}
else
{
$start = 0;
}
if(isset($_GET['order']))
{
$order = $_GET['order'];
}
else
{
$order = 'account_lid';
}
if(isset($_GET['sort']))
{
$sort = $_GET['sort'];
}
else
{
$sort = 'ASC';
}
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
$GLOBALS['phpgw']->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('phpgwapi'));
$GLOBALS['phpgw']->template->set_file(array('accounts_list_t' => 'accounts_popup.tpl'));
$GLOBALS['phpgw']->template->set_block('accounts_list_t','group_cal','cal');
$GLOBALS['phpgw']->template->set_block('accounts_list_t','group_other','other');
$GLOBALS['phpgw']->template->set_block('accounts_list_t','group_all','all');
$GLOBALS['phpgw']->template->set_block('accounts_list_t','bla_intro','ibla');
$GLOBALS['phpgw']->template->set_block('accounts_list_t','other_intro','iother');
$GLOBALS['phpgw']->template->set_block('accounts_list_t','all_intro','iall');
$GLOBALS['phpgw']->template->set_block('accounts_list_t','accounts_list','list');
$GLOBALS['phpgw']->template->set_var('title',$GLOBALS['phpgw_info']['site_title']);
$GLOBALS['phpgw']->template->set_var('charset',$GLOBALS['phpgw']->translation->charset());
$GLOBALS['phpgw']->template->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
$GLOBALS['phpgw']->template->set_var('lang_search',lang('search'));
$GLOBALS['phpgw']->template->set_var('lang_groups',lang('user groups'));
$GLOBALS['phpgw']->template->set_var('lang_accounts',lang('user accounts'));
$GLOBALS['phpgw']->template->set_var('img',$GLOBALS['phpgw']->common->image('phpgwapi','select'));
$GLOBALS['phpgw']->template->set_var('lang_select_user',lang('Select user'));
$GLOBALS['phpgw']->template->set_var('lang_select_group',lang('Select group'));
$GLOBALS['phpgw']->template->set_var('css_file',$GLOBALS['phpgw_info']['server']['webserver_url'] . SEP . 'phpgwapi' . SEP . 'templates'
. SEP . 'idots' . SEP . 'css' . SEP . 'idots.css');
switch($app)
{
case 'calendar':
$action = 'calendar.uicalendar.accounts_popup';
$GLOBALS['phpgw']->template->set_var('select_name',"participants[]'][0]");
$GLOBALS['phpgw']->template->set_var('js_function','ExchangeAccountSelect');
$GLOBALS['phpgw']->template->fp('ibla','bla_intro',True);
$GLOBALS['phpgw']->template->fp('iall','all_intro',True);
break;
case 'admin':
$action = 'admin.uiaccounts.accounts_popup';
$GLOBALS['phpgw']->template->set_var('select_name',"account_user[]']");
$GLOBALS['phpgw']->template->set_var('js_function','ExchangeAccountSelect');
$GLOBALS['phpgw']->template->set_var('lang_perm',lang('group name'));
$GLOBALS['phpgw']->template->fp('iother','other_intro',True);
break;
case 'projects':
$action = 'projects.uiprojects.accounts_popup';
$GLOBALS['phpgw']->template->set_var('select_name',"values[coordinator]']");
$GLOBALS['phpgw']->template->set_var('js_function','ExchangeAccountText');
$GLOBALS['phpgw']->template->fp('iother','other_intro',True);
$GLOBALS['phpgw']->template->fp('iall','all_intro',True);
break;
case 'e_projects':
$action = 'projects.uiprojects.e_accounts_popup';
$app = 'projects';
$GLOBALS['phpgw']->template->set_var('select_name',"employees[]']");
$GLOBALS['phpgw']->template->set_var('js_function','ExchangeAccountSelect');
$GLOBALS['phpgw']->template->fp('iother','other_intro',True);
$GLOBALS['phpgw']->template->fp('iall','all_intro',True);
break;
}
$GLOBALS['phpgw']->template->set_var('lang_perm',lang('Groups with permission for %1',lang($app)));
$GLOBALS['phpgw']->template->set_var('lang_nonperm',lang('Groups without permission for %1',lang($app)));
$link_data = array
(
'menuaction' => $action,
'group_id' => $group_id
);
$app_groups = array();
if ($app != 'admin')
{
$user_groups = $this->membership($this->account);
$app_user = $GLOBALS['phpgw']->acl->get_ids_for_location('run',1,$app);
for ($i = 0;$i<count($app_user);$i++)
{
$type = $this->get_type($app_user[$i]);
if($type == 'g')
{
$app_groups[] = $app_user[$i];
$members[] = $GLOBALS['phpgw']->acl->get_ids_for_location($app_user[$i],1,'phpgw_group');
}
}
$i = count($app_user);
while(is_array($members) && list(,$mem) = each($members))
{
for($j=0;$j<count($mem);$j++)
{
$app_user[$i] = $mem[$j];
$i++;
}
}
//_debug_array($app_user);
}
else
{
$all_groups = $this->get_list('groups');
$all_user = $this->get_list('accounts');
while(is_array($all_groups) && list(,$agroup) = each($all_groups))
{
$user_groups[] = array
(
'account_id' => $agroup['account_id'],
'account_name' => $agroup['account_firstname']
);
}
for($j=0;$j<count($user_groups);$j++)
{
$app_groups[$i] = $user_groups[$j]['account_id'];
$i++;
}
for($j=0;$j<count($all_user);$j++)
{
$app_user[$i] = $all_user[$j]['account_id'];
$i++;
}
}
while (is_array($user_groups) && list(,$group) = each($user_groups))
{
if (in_array($group['account_id'],$app_groups))
{
$GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color));
//$link_data['group_id'] = $group['account_id'];
$GLOBALS['phpgw']->template->set_var('link_user_group',$GLOBALS['phpgw']->link('/index.php','menuaction=' . $action . '&group_id=' . $group['account_id']));
$GLOBALS['phpgw']->template->set_var('name_user_group',$group['account_name']);
$GLOBALS['phpgw']->template->set_var('account_display',$GLOBALS['phpgw']->common->grab_owner_name($group['account_id']));
$GLOBALS['phpgw']->template->set_var('accountid',$group['account_id']);
switch($app)
{
case 'calendar': $GLOBALS['phpgw']->template->fp('cal','group_cal',True); break;
default: $GLOBALS['phpgw']->template->fp('other','group_other',True); break;
}
}
else
{
if ($app != 'admin')
{
$GLOBALS['phpgw']->template->set_var('link_all_group',$GLOBALS['phpgw']->link('/index.php','menuaction=' . $action . '&group_id=' . $group['account_id']));
$GLOBALS['phpgw']->template->set_var('name_all_group',$group['account_name']);
$GLOBALS['phpgw']->template->set_var('accountid',$group['account_id']);
$GLOBALS['phpgw']->template->fp('all','group_all',True);
}
}
}
if (!$GLOBALS['query'])
{
if (isset($group_id) && !empty($group_id))
{
//echo 'GROUP_ID: ' . $group_id;
$users = $GLOBALS['phpgw']->acl->get_ids_for_location($group_id,1,'phpgw_group');
for ($i=0;$i<count($users);$i++)
{
if (in_array($users[$i],$app_user))
{
$GLOBALS['phpgw']->accounts->account_id = $users[$i];
$GLOBALS['phpgw']->accounts->read_repository();
switch ($order)
{
case 'account_firstname':
$id = $GLOBALS['phpgw']->accounts->data['firstname'];
break;
case 'account_lastname':
$id = $GLOBALS['phpgw']->accounts->data['lastname'];
break;
case 'account_lid':
default:
$id = $GLOBALS['phpgw']->accounts->data['account_lid'];
break;
}
$id .= $GLOBALS['phpgw']->accounts->data['lastname']; // default sort-order
$id .= $GLOBALS['phpgw']->accounts->data['firstname'];
$id .= $GLOBALS['phpgw']->accounts->data['account_id']; // make our index unique
$val_users[$id] = array
(
'account_id' => $GLOBALS['phpgw']->accounts->data['account_id'],
'account_lid' => $GLOBALS['phpgw']->accounts->data['account_lid'],
'account_firstname' => $GLOBALS['phpgw']->accounts->data['firstname'],
'account_lastname' => $GLOBALS['phpgw']->accounts->data['lastname']
);
}
}
if (is_array($val_users))
{
if ($sort != 'DESC')
{
ksort($val_users);
}
else
{
krsort($val_users);
}
}
$val_users = array_values($val_users); // get a numeric index
}
$total = count($val_users);
}
else
{
switch($app)
{
case 'calendar': $select = 'both'; break;
default: $select = 'accounts'; break;
}
$entries = $this->get_list($select,$start,$sort,$order,$GLOBALS['query']);
$total = $this->total;
for ($i=0;$i<count($entries);$i++)
{
if (in_array($entries[$i]['account_id'],$app_user))
{
$val_users[] = array
(
'account_id' => $entries[$i]['account_id'],
'account_lid' => $entries[$i]['account_lid'],
'account_firstname' => $entries[$i]['account_firstname'],
'account_lastname' => $entries[$i]['account_lastname']
);
}
}
}
// --------------------------------- nextmatch ---------------------------
$left = $this->nextmatchs->left('/index.php',$start,$total,$link_data);
$right = $this->nextmatchs->right('/index.php',$start,$total,$link_data);
$GLOBALS['phpgw']->template->set_var('left',$left);
$GLOBALS['phpgw']->template->set_var('right',$right);
$GLOBALS['phpgw']->template->set_var('lang_showing',$this->nextmatchs->show_hits($total,$start));
// -------------------------- end nextmatch ------------------------------------
$GLOBALS['phpgw']->template->set_var('search_action',$GLOBALS['phpgw']->link('/index.php',$link_data));
$GLOBALS['phpgw']->template->set_var('search_list',$this->nextmatchs->search(array('query' => $GLOBALS['query'], 'search_obj' => 1)));
// ---------------- list header variable template-declarations --------------------------
// -------------- list header variable template-declaration ------------------------
$GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']);
$GLOBALS['phpgw']->template->set_var('sort_lid',$this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data));
$GLOBALS['phpgw']->template->set_var('sort_firstname',$this->nextmatchs->show_sort_order($sort,'account_firstname',$order,'/index.php',lang('Firstname'),$link_data));
$GLOBALS['phpgw']->template->set_var('sort_lastname',$this->nextmatchs->show_sort_order($sort,'account_lastname',$order,'/index.php',lang('Lastname'),$link_data));
// ------------------------- end header declaration --------------------------------
$stop = $start + $this->nextmatchs->maxmatches;
for ($i=$start;$i<count($val_users)&&$i<$stop;$i++)
{
$GLOBALS['phpgw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color));
$firstname = $val_users[$i]['account_firstname'];
if (!$firstname) { $firstname = '&nbsp;'; }
$lastname = $val_users[$i]['account_lastname'];
if (!$lastname) { $lastname = '&nbsp;'; }
// ---------------- template declaration for list records --------------------------
$GLOBALS['phpgw']->template->set_var(array
(
'lid' => $val_users[$i]['account_lid'],
'firstname' => $firstname,
'lastname' => $lastname,
'accountid' => $val_users[$i]['account_id'],
'account_display' => $GLOBALS['phpgw']->common->grab_owner_name($val_users[$i]['account_id'])
));
$GLOBALS['phpgw']->template->fp('list','accounts_list',True);
}
$GLOBALS['phpgw']->template->set_var('start',$start);
$GLOBALS['phpgw']->template->set_var('sort',$sort);
$GLOBALS['phpgw']->template->set_var('order',$order);
$GLOBALS['phpgw']->template->set_var('query',$GLOBALS['query']);
$GLOBALS['phpgw']->template->set_var('group_id',$group_id);
$GLOBALS['phpgw']->template->set_var('lang_done',lang('done'));
$GLOBALS['phpgw']->template->pfp('out','accounts_list_t',True);
$GLOBALS['phpgw']->common->phpgw_exit();
}
}
/*!
@class_end accounts
*/

View File

@ -1,157 +0,0 @@
<!-- $Id$ -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML LANG="en">
<head>
<title>{title}</title>
<meta http-equiv="content-type" content="text/html"; charset="{charset}">
<script LANGUAGE="JavaScript">
var userSelectBox = opener.document.forms["app_form"].elements['{select_name};
function ExchangeAccountSelect(thisform)
{
NewEntry = new Option(thisform.elements['accountdisplay'].value,thisform.elements['accountid'].value,false,true);
userSelectBox.options[userSelectBox.length] = NewEntry;
}
</script>
<script LANGUAGE="JavaScript">
function ExchangeAccountText(thisform)
{
opener.document.app_form.accountid.value = thisform.elements['accountid'].value;
opener.document.app_form.accountname.value = thisform.elements['accountdisplay'].value;
}
</script>
<link rel="stylesheet" type="text/css" href="{css_file}">
</head>
<body>
<center>
<table border="0" width="100%">
<tr>
<td colspan="4">
<table border="0" width="100%">
<tr>
{left}
<td align="center"><font face="{font}">{lang_showing}</font></td>
{right}
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" colspan="4" align="right">
<form method="POST" action="{search_action}">
<input type="text" name="query">&nbsp;<input type="submit" name="search" value="{lang_search}">
</form>
</td>
</tr>
</table>
<table border="0" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" width="20%">
<table border="0" width="100%" cellpadding="2" cellspacing="2">
<tr>
<td bgcolor="{th_bg}" colspan="2" align="center"><font face="{font}"><b>{lang_groups}</b></font></td>
</tr>
<!-- BEGIN bla_intro -->
<tr>
<td bgcolor="{th_bg}" colspan="2"><font face="{font}">{lang_perm}</font></td>
</tr>
<!-- END bla_intro -->
<!-- BEGIN other_intro -->
<tr>
<td bgcolor="{th_bg}" colspan="2"><font face="{font}">{lang_perm}</font></td>
</tr>
<!-- END other_intro -->
<!-- BEGIN group_cal -->
<tr bgcolor="{tr_color}">
<td><a href="{link_user_group}"><font face="{font}">{name_user_group}</font></a></td>
<td align="center">
<form>
<input type="hidden" name="accountid" value="{accountid}">
<input type="hidden" name="accountdisplay" value="{account_display}">
<input type="image" src="{img}" onClick="{js_function}(this.form); return false;" name="{lang_select_group}" title="{lang_select_group}">
</form>
</td>
</tr>
<!-- END group_cal -->
<!-- BEGIN group_other -->
<tr bgcolor="{tr_color}">
<td><a href="{link_user_group}"><font face="{font}">{name_user_group}</font></a></td>
</tr>
<!-- END group_other -->
<!-- BEGIN all_intro -->
<tr height="5">
<td>&nbsp;</td>
</tr>
<tr>
<td bgcolor="{th_bg}" colspan="2"><font face="{font}">{lang_nonperm}</font></td>
</tr>
<!-- END all_intro -->
<!-- BEGIN group_all -->
<tr bgcolor="{tr_color}">
<td colspan="2"><a href="{link_all_group}"><font face="{font}">{name_all_group}</font></a></td>
</tr>
<!-- END group_all -->
</table>
</td>
<td width="80%" valign="top">
<table border="0" width="100%" cellpadding="2" cellspacing="2">
<tr bgcolor="{th_bg}">
<td width="100%" bgcolor="{th_bg}" align="center" colspan="4"><font face="{font}"><b>{lang_accounts}</b></font></td>
</tr>
<tr bgcolor="{th_bg}">
<td width="30%" bgcolor="{th_bg}" align="center"><font face="{font}">{sort_lid}</font></td>
<td width="30%" bgcolor="{th_bg}" align="center"><font face="{font}">{sort_firstname}</font></td>
<td width="30%" bgcolor="{th_bg}" align="center"><font face="{font}">{sort_lastname}</font></td>
<td width="10%" bgcolor="{th_bg}">&nbsp;</td>
</tr>
<!-- BEGIN accounts_list -->
<tr bgcolor="{tr_color}">
<td><font face="{font}">{lid}</font></td>
<td><font face="{font}">{firstname}</font></td>
<td><font face="{font}">{lastname}</font></td>
<form>
<input type="hidden" name="accountid" value="{accountid}">
<input type="hidden" name="accountdisplay" value="{account_display}">
<td align="center">
<input type="image" src="{img}" onClick="{js_function}(this.form); return false;" name="{lang_select_user}" title="{lang_select_user}"></td>
</form>
</tr>
<!-- END accounts_list -->
</table>
</td>
</tr>
</table>
<table cellpadding="2" cellspacing="2">
<tr>
<form>
<input type="hidden" name="start" value="{start}">
<input type="hidden" name="sort" value="{sort}">
<input type="hidden" name="order" value="{order}">
<input type="hidden" name="query" value="{query}">
<input type="hidden" name="group_id" value="{group_id}">
<td><font face="{font}"><input type="button" name="Done" value="{lang_done}" onClick="window.close()"></font></td>
</form>
</tr>
</table>
</center>
</body>
</html>