diff --git a/addressbook/inc/class.boaddressbook.inc.php b/addressbook/inc/class.boaddressbook.inc.php index b6a7c2f09a..e904e46a83 100644 --- a/addressbook/inc/class.boaddressbook.inc.php +++ b/addressbook/inc/class.boaddressbook.inc.php @@ -74,8 +74,9 @@ $this->use_session = True; } - $start = get_var('start', array('POST','GET')); + $start = intval(get_var('start', array('POST','GET'))); $query = get_var('query', array('POST','GET')); + $cquery = get_var('cquery', array('GET')); $sort = get_var('sort', array('POST','GET')); $order = get_var('order', array('POST','GET')); $filter = get_var('filter', array('POST','GET')); @@ -83,6 +84,7 @@ $this->start = (!empty($start) || ($start == '0')) ? $start : $this->start; $this->query = (empty($query) && !empty($this->query)) || !empty($query) ? $query : $this->query; + $this->cquery = (empty($cquery) && !empty($this->cquery)) || !empty($cquery) ? $cquery : $this->cquery; $this->sort = (!empty($sort)) ? $sort : $this->sort; $this->order = (!empty($order)) ? $order : $this->order; $this->filter = (!empty($filter) || ($filter == '0')) ? $filter : $this->filter; @@ -104,7 +106,8 @@ 'sort' => $this->sort, 'order' => $this->order, 'filter' => $this->filter, - 'cat_id' => $this->cat_id + 'cat_id' => $this->cat_id, + 'cquery' => $this->cquery ); echo '
BO:'; _debug_array($data); @@ -189,6 +192,7 @@ $this->start = $data['start']; $this->query = $data['query']; + $this->cquery = $data['cquery']; $this->sort = $data['sort']; $this->order = $data['order']; $this->filter = $data['filter']; diff --git a/addressbook/inc/class.soaddressbook.inc.php b/addressbook/inc/class.soaddressbook.inc.php index d731ba4901..c354a66405 100644 --- a/addressbook/inc/class.soaddressbook.inc.php +++ b/addressbook/inc/class.soaddressbook.inc.php @@ -65,7 +65,8 @@ $data['query'], $data['filter'], $data['sort'], - $data['order'] + $data['order'], + $data['cquery'] ); } diff --git a/addressbook/inc/class.uiaddressbook.inc.php b/addressbook/inc/class.uiaddressbook.inc.php index 7592141c15..f4b5fa036c 100644 --- a/addressbook/inc/class.uiaddressbook.inc.php +++ b/addressbook/inc/class.uiaddressbook.inc.php @@ -72,6 +72,7 @@ { $this->start = $this->bo->start; $this->query = $this->bo->query; + $this->cquery = $this->bo->cquery; $this->sort = $this->bo->sort; $this->order = $this->bo->order; $this->filter = $this->bo->filter; @@ -87,6 +88,7 @@ $data = array( 'start' => $this->start, 'query' => $this->query, + 'cquery' => $this->cquery, 'sort' => $this->sort, 'order' => $this->order, 'filter' => $this->filter, @@ -102,6 +104,7 @@ $data = array( 'start' => $this->start, 'query' => $this->query, + 'cquery' => $this->cquery, 'sort' => $this->sort, 'order' => $this->order, 'filter' => $this->filter, @@ -267,6 +270,38 @@ $this->template->set_block('addressbook_list_t','row','row'); $this->template->set_block('addressbook_list_t','remsearch','remsearch'); $this->template->set_block('addressbook_list_t','addressbook_footer','addressbook_footer'); + $this->template->set_block('addressbook_list_t','addressbook_alpha','addressbook_alpha'); + + $aar = explode(',',lang('alphabet')); + $aar[] = 'all'; + while(list(,$char) = @each($aar)) + { + if($this->cquery == $char || + ($char == 'all' && !$this->cquery)) + { + $this->template->set_var('charbgcolor','#000000'); + $this->template->set_var('charcolor','#FFFFFF'); + } + else + { + $this->template->set_var('charbgcolor',$GLOBALS['phpgw_info']['theme']['th_bg']); + $this->template->set_var('charcolor',$GLOBALS['phpgw_info']['theme']['th_text']); + } + if($char == 'all') + { + $this->template->set_var('charlink', + $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index&cquery=') + ); + } + else + { + $this->template->set_var('charlink', + $GLOBALS['phpgw']->link('/index.php','menuaction=addressbook.uiaddressbook.index&cquery=' . $char) + ); + } + $this->template->set_var('char',$char != 'all' ? strtoupper($char) : lang('all')); + $this->template->fp('alphalinks','addressbook_alpha',True); + } $custom = $this->fields->read_custom_fields(); $customfields = array(); @@ -431,6 +466,7 @@ 'fields' => $columns_to_display, 'filter' => $qfilter, 'query' => $this->query, + 'cquery' => $this->cquery, 'sort' => $this->sort, 'order' => $this->order ));