added preferences page to infolog

This commit is contained in:
Ralf Becker 2001-07-14 15:49:04 +00:00
parent eb8b31b9c4
commit 2a3e445fac
4 changed files with 71 additions and 7 deletions

View File

@ -51,9 +51,6 @@
'confirm' => 'confirm','reject' => 'reject','email' => 'email', 'confirm' => 'confirm','reject' => 'reject','email' => 'email',
'fax' => 'fax' ) 'fax' => 'fax' )
); );
$this->longnames = 0; // should go into preferences
$this->listChilds = 1;
$this->so = CreateObject('infolog.soinfolog'); $this->so = CreateObject('infolog.soinfolog');
$this->data = &$this->so->data; $this->data = &$this->so->data;
$this->grants = &$this->so->grants; $this->grants = &$this->so->grants;
@ -62,7 +59,7 @@
} }
function accountInfo($id,$account_data=0,$longname=0) { function accountInfo($id,$account_data=0,$longname=0) {
global $phpgw; global $phpgw,$phpgw_info;
if (!$id) return ' '; if (!$id) return ' ';
@ -72,7 +69,7 @@
$accounts->read_repository(); $accounts->read_repository();
$account_data = $accounts->data; $account_data = $accounts->data;
} }
if ($longnames) if ($phpgw_info['user']['preferences']['infolog']['longNames'])
return $account_data['firstname'].' '.$account_data['lastname']; return $account_data['firstname'].' '.$account_data['lastname'];
return $account_data['account_lid']; return $account_data['account_lid'];

View File

@ -22,6 +22,7 @@
'add' => True, 'add' => True,
'edit' => True, 'edit' => True,
'delete' => True, 'delete' => True,
'preferences' => True
); );
var $icons; var $icons;
var $data; var $data;
@ -315,7 +316,8 @@
$sql_query = "AND (info_from like '%$query%' OR info_subject like '%$query%' OR info_des like '%$query%') "; $sql_query = "AND (info_from like '%$query%' OR info_subject like '%$query%' OR info_des like '%$query%') ";
$pid = 'AND info_id_parent='.($action == 'sp' ? $info_id : 0); $pid = 'AND info_id_parent='.($action == 'sp' ? $info_id : 0);
if ($this->bo->listChilds && $action != 'sp') if (!$phpgw_info['user']['preferences']['infolog']['listNoSubs'] &&
$action != 'sp')
$pid = ''; $pid = '';
$db->query("SELECT COUNT(*) FROM phpgw_infolog WHERE $filtermethod $pid $sql_query",__LINE__,__FILE__); $db->query("SELECT COUNT(*) FROM phpgw_infolog WHERE $filtermethod $pid $sql_query",__LINE__,__FILE__);
@ -758,4 +760,52 @@
$t->pfp('out','info_delete'); $t->pfp('out','info_delete');
} }
} }
function preferences( ) {
global $phpgw,$phpgw_info;
global $save;
$prefs = array(
'homeShowEvents' => 'Show open Events: Tasks/Calls/Notes on main screen',
'listNoSubs' => 'List no Subs/Childs',
'longNames' => 'Show full usernames'
);
$phpgw->preferences->read_repository();
if ($save) {
while (list($pref,$lang) = each($prefs)) {
$phpgw->preferences->add('infolog',$pref);
}
$phpgw->preferences->save_repository(True);
Header('Location: '.$phpgw->link('/preferences/index.php'));
$phpgw->common->phpgw_exit();
} else {
$phpgw->common->phpgw_header();
echo parse_navbar();
$t = &$this->template; $html = &$this->html;
$t->set_file(array('info_prefs' => 'preferences.tpl'));
$vars = Array(
'title' => lang('InfoLog preferences'),
'text' => ' ',
'action_url' => $html->link('/index.php',
$this->menuaction('preferences')),
'bg_h_color' => $phpgw_info['theme']['th_bg'],
'save_button' => $html->submit_button('save','Save'),
);
$t->set_var($vars);
$t->set_block('info_prefs', 'pref_line', 'pref_linehandle');
while (list($pref,$lang) = each($prefs)) {
$t->set_var('bg_nm_color',$this->nextmatchs->alternate_row_color());
$t->set_var('field',lang($lang));
$t->set_var('data',$html->checkbox($pref,$phpgw_info['user']['preferences']['infolog'][$pref]));
$t->parse('pref_linehandle','pref_line',True);
}
$t->pfp('out','info_prefs');
}
}
} }

View File

@ -16,7 +16,7 @@
// Only Modify the $file and $title variables..... // Only Modify the $file and $title variables.....
$title = $appname; $title = $appname;
$file = Array( $file = Array(
// 'Preferences' => $phpgw->link('/infolog/preferences.php'), 'Preferences' => $phpgw->link('/index.php','menuaction=infolog.uiinfolog.preferences'),
'Grant Access' => $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname), 'Grant Access' => $phpgw->link('/preferences/acl_preferences.php','acl_app='.$appname),
'Edit Categories' => $phpgw->link('/preferences/categories.php','cats_app='.$appname) 'Edit Categories' => $phpgw->link('/preferences/categories.php','cats_app='.$appname)
); );

View File

@ -0,0 +1,17 @@
<p><b>{title}:</b><hr><p>
<form action="{action_url}" method="POST">
<table border="0" align="center" width="90%">
<!-- BEGIN pref_header -->
<tr bgcolor="{bg_h_color}">
<td colspan="2">{text}</td>
</tr>
<!-- END pref_header -->
<!-- BEGIN pref_line -->
<tr bgcolor="{bg_nm_color}">
<td align="right">{field}</td>
<td align="center">{data}</td>
</tr>
<!-- END pref_line -->
</table>
<center>{save_button}</center>
</form>