diff --git a/infolog/inc/class.boinfolog.inc.php b/infolog/inc/class.boinfolog.inc.php index 020a7860fb..b34c888f0e 100644 --- a/infolog/inc/class.boinfolog.inc.php +++ b/infolog/inc/class.boinfolog.inc.php @@ -51,9 +51,6 @@ 'confirm' => 'confirm','reject' => 'reject','email' => 'email', 'fax' => 'fax' ) ); - $this->longnames = 0; // should go into preferences - $this->listChilds = 1; - $this->so = CreateObject('infolog.soinfolog'); $this->data = &$this->so->data; $this->grants = &$this->so->grants; @@ -62,7 +59,7 @@ } function accountInfo($id,$account_data=0,$longname=0) { - global $phpgw; + global $phpgw,$phpgw_info; if (!$id) return ' '; @@ -72,7 +69,7 @@ $accounts->read_repository(); $account_data = $accounts->data; } - if ($longnames) + if ($phpgw_info['user']['preferences']['infolog']['longNames']) return $account_data['firstname'].' '.$account_data['lastname']; return $account_data['account_lid']; diff --git a/infolog/inc/class.uiinfolog.inc.php b/infolog/inc/class.uiinfolog.inc.php index 0533b58015..2bd8bb47ad 100644 --- a/infolog/inc/class.uiinfolog.inc.php +++ b/infolog/inc/class.uiinfolog.inc.php @@ -22,6 +22,7 @@ 'add' => True, 'edit' => True, 'delete' => True, + 'preferences' => True ); var $icons; var $data; @@ -315,7 +316,8 @@ $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); - if ($this->bo->listChilds && $action != 'sp') + if (!$phpgw_info['user']['preferences']['infolog']['listNoSubs'] && + $action != 'sp') $pid = ''; $db->query("SELECT COUNT(*) FROM phpgw_infolog WHERE $filtermethod $pid $sql_query",__LINE__,__FILE__); @@ -758,4 +760,52 @@ $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'); + } + } } diff --git a/infolog/inc/hook_preferences.inc.php b/infolog/inc/hook_preferences.inc.php index dab1cba178..97c932d9e9 100644 --- a/infolog/inc/hook_preferences.inc.php +++ b/infolog/inc/hook_preferences.inc.php @@ -16,7 +16,7 @@ // Only Modify the $file and $title variables..... $title = $appname; $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), 'Edit Categories' => $phpgw->link('/preferences/categories.php','cats_app='.$appname) ); diff --git a/infolog/templates/default/preferences.tpl b/infolog/templates/default/preferences.tpl new file mode 100644 index 0000000000..a49866e887 --- /dev/null +++ b/infolog/templates/default/preferences.tpl @@ -0,0 +1,17 @@ +
{title}:
+