phpgw --> egw

This commit is contained in:
Ralf Becker 2005-11-03 14:33:39 +00:00
parent a41761660e
commit 373d7c68a2

View File

@ -12,7 +12,7 @@
/* $Id$ */ /* $Id$ */
$GLOBALS['phpgw_info']['flags'] = array( $GLOBALS['egw_info']['flags'] = array(
'noheader' => True, 'noheader' => True,
'nonavbar' => True, 'nonavbar' => True,
'currentapp' => 'addressbook', 'currentapp' => 'addressbook',
@ -22,23 +22,22 @@
include('../header.inc.php'); include('../header.inc.php');
// add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv) // add a content-type header to overwrite an existing default charset in apache (AddDefaultCharset directiv)
header('Content-type: text/html; charset='.$GLOBALS['phpgw']->translation->charset()); header('Content-type: text/html; charset='.$GLOBALS['egw']->translation->charset());
include('templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/head.inc.php'); include('templates/'.$GLOBALS['egw_info']['user']['preferences']['common']['template_set'].'/head.inc.php');
$GLOBALS['phpgw']->template->set_root(PHPGW_TEMPLATE_DIR); $GLOBALS['egw']->template->set_root(EGW_TEMPLATE_DIR);
$GLOBALS['phpgw']->template->set_file(array( $GLOBALS['egw']->template->set_file(array(
'addressbook_list_t' => 'addressbook.tpl', 'addressbook_list_t' => 'addressbook.tpl',
)); ));
$GLOBALS['phpgw']->template->set_block('addressbook_list_t','addressbook_list','list'); $GLOBALS['egw']->template->set_block('addressbook_list_t','addressbook_list','list');
$contacts = CreateObject('phpgwapi.contacts'); $contacts =& CreateObject('phpgwapi.contacts');
$cats = CreateObject('phpgwapi.categories'); $cats =& CreateObject('phpgwapi.categories','','addressbook');
$cats->app_name = 'addressbook';
$include_personal = True; $include_personal = True;
$GLOBALS['phpgw']->template->set_var(array( $GLOBALS['egw']->template->set_var(array(
'lang_search' => lang('Search'), 'lang_search' => lang('Search'),
'lang_select_cats' => lang('Show all categorys'), 'lang_select_cats' => lang('Show all categorys'),
'lang_done' => lang('Done'), 'lang_done' => lang('Done'),
@ -68,10 +67,10 @@
); );
$link = '/phpgwapi/addressbook.php'; $link = '/phpgwapi/addressbook.php';
$full_link = $GLOBALS['phpgw']->link($link,$common_vars+array( $full_link = $GLOBALS['egw']->link($link,$common_vars+array(
'start' => $start, 'start' => $start,
)); ));
$GLOBALS['phpgw']->template->set_var('form_action',$full_link); $GLOBALS['egw']->template->set_var('form_action',$full_link);
$qfilter = 'tid=n'; $qfilter = 'tid=n';
switch($filter) switch($filter)
@ -82,7 +81,7 @@
$qfilter .=',access=private'; $qfilter .=',access=private';
// fall-through // fall-through
case 'yours': case 'yours':
$qfilter .= ',owner='.$GLOBALS['phpgw_info']['user']['account_id']; $qfilter .= ',owner='.$GLOBALS['egw_info']['user']['account_id'];
break; break;
default: default:
if(is_numeric($filter)) if(is_numeric($filter))
@ -97,16 +96,16 @@
$qfilter .= ',cat_id='.$cat_id; $qfilter .= ',cat_id='.$cat_id;
} }
if ($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0) if ($GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'] > 0)
{ {
$offset = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs']; $offset = $GLOBALS['egw_info']['user']['preferences']['common']['maxmatchs'];
} }
else else
{ {
$offset = 15; $offset = 15;
} }
$account_id = $GLOBALS['phpgw_info']['user']['account_id']; $account_id = $GLOBALS['egw_info']['user']['account_id'];
$cols = array ( $cols = array (
'n_given' => 'n_given', 'n_given' => 'n_given',
@ -132,9 +131,9 @@
$entries = $contacts->read($start,$offset,$cols,$query,$qfilter,$sort,$order,$account_id); $entries = $contacts->read($start,$offset,$cols,$query,$qfilter,$sort,$order,$account_id);
} }
//------------------------------------------- nextmatch -------------------------------------------- //------------------------------------------- nextmatch --------------------------------------------
$GLOBALS['phpgw']->template->set_var('left',$GLOBALS['phpgw']->nextmatchs->left( $GLOBALS['egw']->template->set_var('left',$GLOBALS['egw']->nextmatchs->left(
$link,$start,$contacts->total_records,'&'.explode('&',$common_vars))); $link,$start,$contacts->total_records,'&'.explode('&',$common_vars)));
$GLOBALS['phpgw']->template->set_var('right',$GLOBALS['phpgw']->nextmatchs->right( $GLOBALS['egw']->template->set_var('right',$GLOBALS['egw']->nextmatchs->right(
$link,$start,$contacts->total_records,'&'.explode('&',$common_vars))); $link,$start,$contacts->total_records,'&'.explode('&',$common_vars)));
foreach(array( foreach(array(
'n_given' => lang('Firstname'), 'n_given' => lang('Firstname'),
@ -142,20 +141,20 @@
'org_name' => lang('Company'), 'org_name' => lang('Company'),
) as $col => $translation) ) as $col => $translation)
{ {
$GLOBALS['phpgw']->template->set_var('sort_'.$col,$GLOBALS['phpgw']->nextmatchs->show_sort_order( $GLOBALS['egw']->template->set_var('sort_'.$col,$GLOBALS['egw']->nextmatchs->show_sort_order(
$sort,$col,$order,$link,$translation,'&cat_id='.$cat_id)); $sort,$col,$order,$link,$translation,'&cat_id='.$cat_id));
} }
if ($contacts->total_records > $offset) if ($contacts->total_records > $offset)
{ {
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing %1 - %2 of %3', $GLOBALS['egw']->template->set_var('lang_showing',lang('showing %1 - %2 of %3',
1+$start,$start+$offset>$contacts->total_records ? $contacts->total_records : $start+$offset, 1+$start,$start+$offset>$contacts->total_records ? $contacts->total_records : $start+$offset,
$contacts->total_records)); $contacts->total_records));
} }
else else
{ {
$GLOBALS['phpgw']->template->set_var('lang_showing',lang('showing %1',$contacts->total_records)); $GLOBALS['egw']->template->set_var('lang_showing',lang('showing %1',$contacts->total_records));
} }
// --------------------------------------- end nextmatch ------------------------------------------ // --------------------------------------- end nextmatch ------------------------------------------
@ -169,14 +168,14 @@
'cc' => lang('Cc'), 'cc' => lang('Cc'),
'bcc'=> lang('Bcc')) as $target => $lang_target) 'bcc'=> lang('Bcc')) as $target => $lang_target)
{ {
$GLOBALS['phpgw']->template->set_var('title_'.$type.'_'.$target, $GLOBALS['egw']->template->set_var('title_'.$type.'_'.$target,
lang('Insert all %1 addresses of the %2 contacts in %3',$lang_type, lang('Insert all %1 addresses of the %2 contacts in %3',$lang_type,
$contacts->total_records,$lang_target)); $contacts->total_records,$lang_target));
} }
} }
// ------------------- list header variable template-declaration ----------------------- // ------------------- list header variable template-declaration -----------------------
$GLOBALS['phpgw']->template->set_var('cats_list',$cats->formated_list('select','all',$cat_id,'True')); $GLOBALS['egw']->template->set_var('cats_list',$cats->formated_list('select','all',$cat_id,'True'));
$filter_list = ''; $filter_list = '';
foreach(array( foreach(array(
@ -187,7 +186,7 @@
{ {
$filter_list .= "<option value=\"$id\"".($filter == $id ? ' selected':'').">$translation</option>\n"; $filter_list .= "<option value=\"$id\"".($filter == $id ? ' selected':'').">$translation</option>\n";
} }
$GLOBALS['phpgw']->template->set_var(array( $GLOBALS['egw']->template->set_var(array(
'query' => $query, 'query' => $query,
'filter_list' => $filter_list, 'filter_list' => $filter_list,
)); ));
@ -197,8 +196,8 @@
if ($entries) if ($entries)
foreach ($entries as $entry) foreach ($entries as $entry)
{ {
$GLOBALS['phpgw']->template->set_var('tr_class', $GLOBALS['egw']->template->set_var('tr_class',
$GLOBALS['phpgw']->nextmatchs->alternate_row_color('',True)); $GLOBALS['egw']->nextmatchs->alternate_row_color('',True));
$firstname = $entry['n_given']; $firstname = $entry['n_given'];
if (!$firstname) if (!$firstname)
@ -273,17 +272,17 @@
$hemail = htmlspecialchars($hemail); $hemail = htmlspecialchars($hemail);
// --------------------- template declaration for list records -------------------------- // --------------------- template declaration for list records --------------------------
$GLOBALS['phpgw']->template->set_var(array( $GLOBALS['egw']->template->set_var(array(
'firstname' => $firstname, 'firstname' => $firstname,
'lastname' => $lastname, 'lastname' => $lastname,
'company' => $company 'company' => $company
)); ));
$GLOBALS['phpgw']->template->set_var('id',$id); $GLOBALS['egw']->template->set_var('id',$id);
$GLOBALS['phpgw']->template->set_var('email',$email); $GLOBALS['egw']->template->set_var('email',$email);
$GLOBALS['phpgw']->template->set_var('hemail',$hemail); $GLOBALS['egw']->template->set_var('hemail',$hemail);
$GLOBALS['phpgw']->template->parse('list','addressbook_list',True); $GLOBALS['egw']->template->parse('list','addressbook_list',True);
} }
} }
// --------------------------- end record declaration --------------------------- // --------------------------- end record declaration ---------------------------
@ -307,11 +306,11 @@
{ {
if ($inserted || $inserted === 0) if ($inserted || $inserted === 0)
{ {
$GLOBALS['phpgw']->template->set_var('message','<b>'. $GLOBALS['egw']->template->set_var('message','<b>'.
lang('%1 email addresses inserted',(int)$_GET['inserted']).'</b>'); lang('%1 email addresses inserted',(int)$_GET['inserted']).'</b>');
} }
$GLOBALS['phpgw']->template->parse('out','addressbook_list_t',True); $GLOBALS['egw']->template->parse('out','addressbook_list_t',True);
$GLOBALS['phpgw']->template->p('out'); $GLOBALS['egw']->template->p('out');
} }
$GLOBALS['phpgw']->common->phpgw_exit(); $GLOBALS['egw']->common->egw_exit();
?> ?>