diff --git a/addressbook/inc/functions.inc.php b/addressbook/inc/functions.inc.php index b00ae75409..796d6bc7fd 100755 --- a/addressbook/inc/functions.inc.php +++ b/addressbook/inc/functions.inc.php @@ -38,6 +38,35 @@ } } + /* Generic formatted list function */ + function formatted_list($name,$list,$id='',$default=False,$java=False) + { + if ($java) + { + $jselect = ' onChange="this.form.submit();"'; + } + + $select = "\n" .''."\n"; + $select .= '' . "\n"; + + return $select; + } + function read_custom_fields($start='',$limit='',$query='',$sort='ASC') { global $phpgw,$phpgw_info; diff --git a/addressbook/index.php b/addressbook/index.php index 4f09b73c9d..44a60c7108 100755 --- a/addressbook/index.php +++ b/addressbook/index.php @@ -115,13 +115,25 @@ $offset = 30; } - // Set qfilter to display entries where tid=n (normal contact entry), - // else they may be accounts, etc. - if (!$filter) { $filter = 'none'; } + if (!$filter) + { + $filter = 'none'; + } + if($phpgw_info['user']['preferences']['addressbook']['default_filter']) + { + $filter = $phpgw_info['user']['preferences']['addressbook']['default_filter']; + } + /* + Set qfilter to display entries where tid=n (normal contact entry), + else they may be accounts, etc. + */ $qfilter = 'tid=n'; - - switch ($filter) { + switch ($filter) + { + case 'blank': + $nosearch = True; + break; case 'none': break; case 'private': @@ -132,7 +144,8 @@ default: $qfilter .= ',owner='.$filter; } - if ($cat_id) { + if ($cat_id) + { $qfilter .= ',cat_id='.$cat_id; } @@ -164,8 +177,16 @@ if (!$userid) { $userid = $phpgw_info['user']['account_id']; } - // read the entry list - $entries = addressbook_read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order,$userid); + if ($nosearch && !$query) + { + $entries = array(); + $this->total_records = 0; + } + else + { + /* read the entry list */ + $entries = addressbook_read_entries($start,$offset,$qcols,$query,$qfilter,$sort,$order,$userid); + } $search_filter = $phpgw->nextmatchs->show_tpl('/addressbook/index.php', $start, $this->total_records,"&order=$order&filter=$filter&sort=$sort&query=$query&cat_id=$cat_id","75%", diff --git a/addressbook/preferences.php b/addressbook/preferences.php index 41818e8eea..64372ab9dc 100644 --- a/addressbook/preferences.php +++ b/addressbook/preferences.php @@ -78,7 +78,15 @@ { $phpgw->preferences->delete('addressbook','mainscreen_showbirthdays'); } - + if ($default_filter) + { + $phpgw->preferences->delete('addressbook','default_filter'); + $phpgw->preferences->add('addressbook','default_filter'); + } + else + { + $phpgw->preferences->delete('addressbook','default_filter'); + } if ($autosave_category) { $phpgw->preferences->delete('addressbook','autosave_category'); @@ -163,34 +171,42 @@ . '>' . $cf . '' . "\n" . '' . "\n"; } - $t->set_var(custom_fields,$custom_var); + $t->set_var('custom_fields',$custom_var); } else { - $t->set_var(custom_fields,''); + $t->set_var('custom_fields',''); } $tr_color = $phpgw->nextmatchs->alternate_row_color($tr_color); $t->set_var(tr_color,$tr_color); - $t->set_var(lang_showbirthday,lang('show birthday reminders on main screen')); + $t->set_var('lang_showbirthday',lang('show birthday reminders on main screen')); if ($phpgw_info['user']['preferences']['addressbook']['mainscreen_showbirthdays']) { - $t->set_var(show_birthday,' checked'); + $t->set_var('show_birthday',' checked'); } else { - $t->set_var(show_birthday,''); + $t->set_var('show_birthday',''); } - $t->set_var(lang_autosave,lang('Autosave default category')); + $list = array( + '' => lang('All'), + 'private' => lang('Private'), + 'blank' => lang('Blank') + ); + $t->set_var('lang_default_filter',lang('Default Filter')); + $t->set_var('filter_select',formatted_list('default_filter',$list,$phpgw_info['user']['preferences']['addressbook']['default_filter'])); + + $t->set_var('lang_autosave',lang('Autosave default category')); if ($phpgw_info['user']['preferences']['addressbook']['autosave_category']) { - $t->set_var(autosave,' checked'); + $t->set_var('autosave',' checked'); } else { - $t->set_var(autosave,''); + $t->set_var('autosave',''); } $t->set_var('lang_defaultcat',lang('Default Category')); $t->set_var('cat_select',cat_option($phpgw_info['user']['preferences']['addressbook']['default_category'])); @@ -203,6 +219,10 @@ $t->set_var('lang_other',lang('Other').' '.lang('Fields')); $t->set_var('lang_otherprefs',lang('Other').' '.lang('Preferences')); $t->set_var('lang_submit',lang('submit')); + $t->set_var('th_bg',$phpgw_info['theme']['th_bg']); + $t->set_var('th_text',$phpgw_info['theme']['th_text']); + $t->set_var('row_on',$phpgw_info['theme']['row_on']); + $t->set_var('row_off',$phpgw_info['theme']['row_off']); $t->pparse('out','preferences'); $phpgw->common->phpgw_footer(); diff --git a/addressbook/templates/default/preferences.tpl b/addressbook/templates/default/preferences.tpl index 2dba91bd30..651099a3b3 100644 --- a/addressbook/templates/default/preferences.tpl +++ b/addressbook/templates/default/preferences.tpl @@ -2,128 +2,114 @@
{lang_abprefs}:
+ + + +