Changeset 4374 in subversion


Ignore:
Timestamp:
Dec 28, 2010 3:31:19 AM (2 years ago)
Author:
thomasb
Message:

Only parse vcards if necessary; refresh saved search set after contact deletion

Location:
branches/devel-addressbook/program
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-addressbook/program/include/main.inc

    r4242 r4374  
    798798      // format each col 
    799799      foreach ($a_show_cols as $col) 
    800         $table->add($col, Q($row_data[$col])); 
     800        $table->add($col, Q(is_array($row_data[$col]) ? $row_data[$col][0] : $row_data[$col])); 
    801801         
    802802      $c++; 
  • branches/devel-addressbook/program/include/rcube_addressbook.php

    r4361 r4374  
    6565 
    6666    /** 
     67     * Refresh saved search set after data has changed 
     68     * 
     69     * @return mixed New search set 
     70     */ 
     71    function refresh_search() 
     72    { 
     73        return $this->get_search_set(); 
     74    } 
     75 
     76    /** 
    6777     * List the current set of contact records 
    6878     * 
  • branches/devel-addressbook/program/include/rcube_contacts.php

    r4314 r4374  
    156156     * List the current set of contact records 
    157157     * 
    158      * @param  array   List of cols to show 
     158     * @param  array   List of cols to show, Null means all 
    159159     * @param  int     Only return this number of records, use negative values for tail 
    160160     * @param  boolean True to skip the count query (select only) 
     
    191191            $this->group_id); 
    192192 
     193        // determine whether we have to parse the vcard or if only db cols are requested 
     194        $read_vcard = !$cols || count(array_intersect($cols, array_keys($sql_arr))) < count($cols); 
     195         
    193196        while ($sql_result && ($sql_arr = $this->db->fetch_assoc($sql_result))) { 
    194197            $sql_arr['ID'] = $sql_arr[$this->primary_key]; 
    195             $sql_arr['email'] = preg_split('/,\s*/', $sql_arr['email']); 
     198 
     199            if ($read_vcard) 
     200                $sql_arr = $this->convert_db_data($sql_arr); 
     201            else 
     202                $sql_arr['email'] = preg_split('/,\s*/', $sql_arr['email']); 
     203             
    196204            // make sure we have a name to display 
    197205            if (empty($sql_arr['name'])) 
    198206                $sql_arr['name'] = $sql_arr['email'][0]; 
     207 
    199208            $this->result->add($sql_arr); 
    200209        } 
  • branches/devel-addressbook/program/steps/addressbook/delete.inc

    r4172 r4374  
    3939        $result = $CONTACTS->count(); 
    4040 
     41        // update saved search after data changed 
     42        if (($search_request = $_REQUEST['_search']) && isset($_SESSION['search'][$search_request])) 
     43            $_SESSION['search'][$search_request] = $CONTACTS->refresh_search(); 
     44 
    4145        // update message count display 
    4246        $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size)); 
  • branches/devel-addressbook/program/steps/addressbook/func.inc

    r4358 r4374  
    175175    global $CONTACTS, $OUTPUT; 
    176176 
     177    // define list of cols to be displayed 
     178    $a_show_cols = array('name'); 
     179 
    177180    // count contacts for this user 
    178     $result = $CONTACTS->list_records(); 
     181    $result = $CONTACTS->list_records($a_show_cols); 
    179182 
    180183    // add id to message list table if not specified 
    181184    if (!strlen($attrib['id'])) 
    182185        $attrib['id'] = 'rcmAddressList'; 
    183  
    184     // define list of cols to be displayed 
    185     $a_show_cols = array('name'); 
    186186 
    187187    // create XHTML table 
  • branches/devel-addressbook/program/steps/addressbook/list.inc

    r3989 r4374  
    2121 
    2222// get contacts for this user 
    23 $result = $CONTACTS->list_records(); 
     23$result = $CONTACTS->list_records(array('name')); 
    2424 
    2525// update message count display 
  • branches/devel-addressbook/program/steps/addressbook/search.inc

    r4150 r4374  
    66 |                                                                       | 
    77 | This file is part of the Roundcube Webmail client                     | 
    8  | Copyright (C) 2005-2007, Roundcube Dev. - Switzerland                 | 
     8 | Copyright (C) 2005-2010, Roundcube Dev. - Switzerland                 | 
    99 | Licensed under the GNU GPL                                            | 
    1010 |                                                                       | 
     
    2929$result = $CONTACTS->search(array('name','email'), $search); 
    3030 
     31// save search settings in session 
     32$_SESSION['search'][$search_request] = $CONTACTS->get_search_set(); 
     33 
    3134if ($result->count > 0) 
    3235{ 
    33   // save search settings in session 
    34   $_SESSION['search'][$search_request] = $CONTACTS->get_search_set(); 
    35  
    3636  // create javascript list 
    3737  rcmail_js_contacts_list($result); 
Note: See TracChangeset for help on using the changeset viewer.