Changeset 631 in subversion


Ignore:
Timestamp:
Jul 2, 2007 12:01:59 PM (6 years ago)
Author:
till
Message:

+ addressbook plugin

Location:
branches/devel-vnext/program
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-vnext/program/include/bootstrap.php

    r622 r631  
    3434$include_path.= $INSTALL_PATH . 'program' . PATH_SEPARATOR; 
    3535$include_path.= $INSTALL_PATH . 'program/lib' . PATH_SEPARATOR; 
     36$include_path.= '/usr/share/Zend-SVN/library' . PATH_SEPARATOR; 
    3637$include_path.= ini_get('include_path'); 
    3738 
  • branches/devel-vnext/program/include/main.inc

    r630 r631  
    7373        $registry->set('BROWSER', $BROWSER, 'core'); 
    7474 
    75         self::tfk_debug('// load browser'); 
     75        //self::tfk_debug('// load browser'); 
    7676 
    7777        // load configuration 
     
    7979        $registry->set('CONFIG', $CONFIG, 'core'); 
    8080 
    81         self::tfk_debug('// load config'); 
     81        //self::tfk_debug('// load config'); 
    8282 
    8383        // set session garbage collecting time according to session_lifetime 
     
    9494        $registry->set('DB', $DB, 'core'); 
    9595 
    96         self::tfk_debug('// init db'); 
     96        //self::tfk_debug('// init db'); 
    9797 
    9898        // use database for storing session data 
     
    104104        $registry->set('sess_id', $sess_id, 'core'); 
    105105 
    106         self::tfk_debug('// session'); 
     106        //self::tfk_debug('// session'); 
    107107 
    108108        // create session and set session vars 
     
    162162        $conf = is_array($rcmail_config) ? $rcmail_config : array(); 
    163163 
    164         self::tfk_debug("// test"); 
     164        //self::tfk_debug("// test"); 
    165165 
    166166        // load host-specific configuration 
     
    287287                            $_SESSION['imap_host'], 
    288288                            $_SESSION['username'], 
    289                             decrypt_passwd($_SESSION['password']), 
     289                            self::decrypt_passwd($_SESSION['password']), 
    290290                            $_SESSION['imap_port'], 
    291291                            $_SESSION['imap_ssl'] 
  • branches/devel-vnext/program/js/app.js

    r630 r631  
    868868        break; 
    869869 
    870       case 'add-contact': 
    871         this.add_contact(props); 
    872         break; 
     870        case 'add-contact': 
     871            this.add_contact(props); 
     872            break; 
    873873 
    874874      // quicksearch 
     
    19371937    }; 
    19381938 
    1939   // send remote request to add a new contact 
    1940   this.add_contact = function(value) 
    1941     { 
    1942     if (value) 
    1943       this.http_post('addcontact', '_address='+value); 
    1944  
    1945     return true; 
     1939    // send remote request to add a new contact 
     1940    this.add_contact = function(value) 
     1941    { 
     1942        if (value) { 
     1943            this.http_post('addcontact', '_address='+value); 
     1944        } 
     1945        return true; 
    19461946    }; 
    19471947 
  • branches/devel-vnext/program/steps/addressbook/delete.inc

    r589 r631  
    1919 
    2020*/ 
     21$registry = rc_registry::getInstance(); 
     22$CONTACTS = $registry->get('CONTACTS', 'core'); 
     23$OUTPUT   = $registry->get('OUTPUT', 'core'); 
    2124 
    22 if (($cid = get_input_value('_cid', RCUBE_INPUT_POST)) && preg_match('/^[0-9]+(,[0-9]+)*$/', $cid)) 
    23   { 
    24   $deleted = $CONTACTS->delete($cid); 
    25   if (!$deleted) 
    26     { 
    27     // send error message 
    28     exit; 
     25if (($cid = get_input_value('_cid', RCUBE_INPUT_POST)) && preg_match('/^[0-9]+(,[0-9]+)*$/', $cid)) { 
     26    $deleted = $CONTACTS->delete($cid); 
     27    if (!$deleted) { 
     28        // send error message 
     29        exit; 
    2930    } 
    3031 
    31   // count contacts for this user 
    32   $result = $CONTACTS->count(); 
     32    // count contacts for this user 
     33    $result = $CONTACTS->count(); 
    3334 
    34   // update message count display 
    35   $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size)); 
    36   $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count)); 
     35    // update message count display 
     36    $OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size)); 
     37    $OUTPUT->command('set_rowcount', rcmail_get_rowcount_text($result->count)); 
    3738 
    38   // add new rows from next page (if any) 
    39   $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size); 
    40   if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages) 
    41     rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted)); 
    42  
    43   // send response 
    44   $OUTPUT->send(); 
    45   } 
    46  
     39    // add new rows from next page (if any) 
     40    $pages = ceil(($result->count + $deleted) / $CONTACTS->page_size); 
     41    if ($_GET['_from'] != 'show' && $pages > 1 && $CONTACTS->list_page < $pages) { 
     42        rcmail_js_contacts_list($CONTACTS->list_records(null, -$deleted)); 
     43    } 
     44    // send response 
     45    $OUTPUT->send(); 
     46} 
    4747exit; 
    4848?> 
  • branches/devel-vnext/program/steps/addressbook/edit.inc

    r623 r631  
    2020*/ 
    2121 
     22$registry = rc_registry::getInstance(); 
     23$CONTACTS = $registry->get('CONTACTS', 'core'); 
     24$OUTPUT   = $registry->get('OUTPUT', 'core'); 
    2225 
    2326if (($cid = rc_main::get_input_value('_cid', RCUBE_INPUT_GPC)) && ($record = $CONTACTS->get_record($cid, true))) { 
     
    5457    if ($attrib['part']) { 
    5558        $out = $form_start; 
    56         $out .= rcmail_get_edit_field($attrib['part'], $record[$attrib['part']], $attrib);  
     59        $out .= rcmail_get_edit_field($attrib['part'], $record[$attrib['part']], $attrib); 
    5760        return $out; 
    5861    } 
     
    7477    } 
    7578    $out .= "\n</table>$form_end"; 
    76     return $out;   
     79    return $out; 
    7780} 
    7881 
     
    100103                        ) 
    101104        ); 
    102      
     105 
    103106        if (($result = $CONTACTS->get_result()) && ($record = $result->first())) { 
    104107            $hiddenfields->add(array('name' => '_cid', 'value' => $record['ID'])); 
     
    108111        $form_start .= $hiddenfields->show(); 
    109112    } 
    110      
     113 
    111114    $form_end  = (strlen($EDIT_FORM) && !strlen($attrib['form'])) ? '</form>' : ''; 
    112115    $form_name = strlen($attrib['form']) ? $attrib['form'] : 'form'; 
    113    
     116 
    114117    if (!strlen($EDIT_FORM)) { 
    115118        $OUTPUT->add_gui_object('editform', $form_name); 
     
    118121    $registry->set('EDIT_FORM', $EDIT_FORM, 'core'); 
    119122 
    120     return array($form_start, $form_end);   
     123    return array($form_start, $form_end); 
    121124} 
    122  
    123  
    124125 
    125126if (!$CONTACTS->get_result() && template_exists('addcontact')) { 
  • branches/devel-vnext/program/steps/addressbook/func.inc

    r623 r631  
    2222require_once 'include/rcube_contacts.inc'; 
    2323require_once 'include/rcube_ldap.inc'; 
     24require_once 'include/rcube_contacts_macbay.inc'; 
     25 
     26$registry = rc_registry::getInstance(); 
     27$CONFIG   = $registry->get('CONFIG', 'core'); 
     28$OUTPUT   = $registry->get('OUTPUT', 'core'); 
     29 
     30rc_main::tfk_debug("ABOOK PLUGIN? " . $CONFIG['addressbook_plugin']); 
    2431 
    2532// instantiate a contacts object according to the given source 
    26 if (($source = get_input_value('_source', RCUBE_INPUT_GPC)) && isset($CONFIG['ldap_public'][$source])) 
    27   $CONTACTS = new rcube_ldap($CONFIG['ldap_public'][$source]); 
    28 else 
    29   $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']); 
    30  
     33if (($source = get_input_value('_source', RCUBE_INPUT_GPC)) && isset($CONFIG['ldap_public'][$source])) { 
     34    $CONTACTS = new rcube_ldap($CONFIG['ldap_public'][$source]); 
     35} 
     36else { 
     37    if (isset($CONFIG['addressbook_plugin']) && empty($CONFIG['addressbook_plugin']) === FALSE) { 
     38        $CONTACTS = new rcube_contacts_macbay( 
     39                            $_SESSION['username'], 
     40                            $_SESSION['password'] 
     41        ); 
     42    } 
     43    else { 
     44        $DB       = $registry->get('DB', 'core'); 
     45        $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']); 
     46    } 
     47} 
    3148$CONTACTS->set_pagesize($CONFIG['pagesize']); 
     49$registry->set('CONTACTS', $CONTACTS, 'core'); 
    3250 
    3351// set list properties and session vars 
    34 if (!empty($_GET['_page'])) 
    35   { 
    36   $CONTACTS->set_page(intval($_GET['_page'])); 
    37   $_SESSION['page'] = $_GET['_page']; 
    38   } 
    39 else 
    40   $CONTACTS->set_page(isset($_SESSION['page']) ?$_SESSION['page'] : 1); 
     52if (!empty($_GET['_page'])) { 
     53    $CONTACTS->set_page(intval($_GET['_page'])); 
     54    $_SESSION['page'] = $_GET['_page']; 
     55} 
     56else { 
     57    $CONTACTS->set_page(isset($_SESSION['page']) ?$_SESSION['page'] : 1); 
     58} 
     59$CONTACTS = $registry->set('CONTACTS', $CONTACTS, 'core'); 
    4160 
    4261// set message set for search result 
    43 if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) 
    44   $CONTACTS->set_search_set($_SESSION['search'][$_REQUEST['_search']]); 
    45  
     62if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) { 
     63    $CONTACTS->set_search_set($_SESSION['search'][$_REQUEST['_search']]); 
     64} 
    4665// set data source env 
    4766$OUTPUT->set_env('source', $source ? $source : '0'); 
     
    5069// add list of address sources to client env 
    5170$js_list = array("0" => array('id' => 0, 'readonly' => false)); 
    52 foreach ((array)$CONFIG['ldap_public'] as $id => $prop) 
    53   $js_list[$id] = array('id' => $id, 'readonly' => !$prop['writeable']); 
     71foreach ((array)$CONFIG['ldap_public'] as $id => $prop) { 
     72    $js_list[$id] = array('id' => $id, 'readonly' => !$prop['writeable']); 
     73} 
    5474$OUTPUT->set_env('address_sources', $js_list); 
    5575 
     
    5777function rcmail_directory_list($attrib) 
    5878{ 
    59   global $CONFIG, $OUTPUT; 
    60    
    61   if (!$attrib['id']) 
    62     $attrib['id'] = 'rcmdirectorylist'; 
    63  
    64   $local_id = '0'; 
    65   $current = get_input_value('_source', RCUBE_INPUT_GPC); 
    66   $line_templ = '<li id="%s" class="%s"><a href="%s"' . 
    67     ' onclick="return %s.command(\'list\',\'%s\',this)"' . 
    68     ' onmouseover="return %s.focus_folder(\'%s\')"' . 
    69     ' onmouseout="return %s.unfocus_folder(\'%s\')"' . 
    70     ' onmouseup="return %s.folder_mouse_up(\'%s\')">%s'. 
    71     "</a></li>\n"; 
    72      
    73   // allow the following attributes to be added to the <ul> tag 
    74   $out = '<ul' . rc_main::create_attrib_string($attrib, array('style', 'class', 'id')) . ">\n"; 
    75   $out .= sprintf($line_templ, 
    76     'rcmli'.$local_id, 
    77     !$current ? 'selected' : '', 
    78     rc_main::Q(rc_main::rcmail_url('list', array('_source' => 0))), 
    79     JS_OBJECT_NAME, 
    80     $local_id, 
    81     JS_OBJECT_NAME, 
    82     $local_id, 
    83     JS_OBJECT_NAME, 
    84     $local_id, 
    85     JS_OBJECT_NAME, 
    86     $local_id, 
    87     rcube_label('personaladrbook')); 
    88    
    89   foreach ((array)$CONFIG['ldap_public'] as $id => $prop) 
    90   { 
    91     $js_id = rc_main_::JQ($id); 
    92     $dom_id = preg_replace('/[^a-z0-9\-_]/i', '', $id); 
    93     $out .= sprintf($line_templ, 
    94       'rcmli'.$dom_id, 
    95       $current == $id ? 'selected' : '', 
    96       rc_main::Q(rc_main::rcmail_url('list', array('_source' => $id))), 
    97       JS_OBJECT_NAME, 
    98       $js_id, 
    99       JS_OBJECT_NAME, 
    100       $js_id, 
    101       JS_OBJECT_NAME, 
    102       $js_id, 
    103       JS_OBJECT_NAME, 
    104       $js_id, 
    105       !empty($prop['name']) ? rc_main::Q($prop['name']) : rc_main::Q($id)); 
    106   } 
    107    
    108   $out .= '</ul>'; 
    109  
    110   $OUTPUT->add_gui_object('folderlist', $attrib['id']); 
    111    
    112   return $out; 
     79    $registry = rc_registry::getInstance(); 
     80    $CONFIG   = $registry->get('CONFIG', 'core'); 
     81    $OUTPUT   = $registry->get('OUTPUT', 'core'); 
     82 
     83    if (!$attrib['id']) { 
     84        $attrib['id'] = 'rcmdirectorylist'; 
     85    } 
     86 
     87    $local_id = '0'; 
     88    $current = rc_main::get_input_value('_source', RCUBE_INPUT_GPC); 
     89 
     90    $line_templ = '<li id="%s" class="%s"><a href="%s"'; 
     91    $line_templ.= ' onclick="return %s.command(\'list\',\'%s\',this)"'; 
     92    $line_templ.= ' onmouseover="return %s.focus_folder(\'%s\')"'; 
     93    $line_templ.= ' onmouseout="return %s.unfocus_folder(\'%s\')"'; 
     94    $line_templ.= ' onmouseup="return %s.folder_mouse_up(\'%s\')">%s'; 
     95    $line_templ.= "</a></li>\n"; 
     96 
     97    // allow the following attributes to be added to the <ul> tag 
     98    $out = '<ul' . rc_main::create_attrib_string($attrib, array('style', 'class', 'id')) . ">\n"; 
     99    $out.= sprintf( 
     100                $line_templ, 
     101                'rcmli'.$local_id, 
     102                !$current ? 'selected' : '', 
     103                rc_main::Q(rc_main::rcmail_url('list', array('_source' => 0))), 
     104                JS_OBJECT_NAME, 
     105                $local_id, 
     106                JS_OBJECT_NAME, 
     107                $local_id, 
     108                JS_OBJECT_NAME, 
     109                $local_id, 
     110                JS_OBJECT_NAME, 
     111                $local_id, 
     112                rcube_label('personaladrbook') 
     113    ); 
     114 
     115    foreach ((array)$CONFIG['ldap_public'] as $id => $prop) { 
     116        $js_id = rc_main_::JQ($id); 
     117        $dom_id = preg_replace('/[^a-z0-9\-_]/i', '', $id); 
     118        $out .= sprintf( 
     119                    $line_templ, 
     120                    'rcmli'.$dom_id, 
     121                    $current == $id ? 'selected' : '', 
     122                    rc_main::Q(rc_main::rcmail_url('list', array('_source' => $id))), 
     123                    JS_OBJECT_NAME, 
     124                    $js_id, 
     125                    JS_OBJECT_NAME, 
     126                    $js_id, 
     127                    JS_OBJECT_NAME, 
     128                    $js_id, 
     129                    JS_OBJECT_NAME, 
     130                    $js_id, 
     131                    !empty($prop['name']) ? rc_main::Q($prop['name']) : rc_main::Q($id) 
     132        ); 
     133    } 
     134 
     135    $out .= '</ul>'; 
     136 
     137    $OUTPUT->add_gui_object('folderlist', $attrib['id']); 
     138 
     139    return $out; 
    113140} 
    114141 
     
    116143// return the message list as HTML table 
    117144function rcmail_contacts_list($attrib) 
    118   { 
    119   global $CONTACTS, $OUTPUT; 
    120    
    121   // count contacts for this user 
    122   $result = $CONTACTS->list_records(); 
    123    
    124   // add id to message list table if not specified 
    125   if (!strlen($attrib['id'])) 
    126     $attrib['id'] = 'rcmAddressList'; 
    127    
    128   // define list of cols to be displayed 
    129   $a_show_cols = array('name'); 
    130  
    131   // create XHTML table 
    132   $out = rcube_table_output($attrib, $result->records, $a_show_cols, $CONTACTS->primary_key); 
    133    
    134   // set client env 
    135   $OUTPUT->add_gui_object('contactslist', $attrib['id']); 
    136   $OUTPUT->set_env('current_page', (int)$CONTACTS->list_page); 
    137   $OUTPUT->set_env('pagecount', ceil($result->count/$CONTACTS->page_size)); 
    138   $OUTPUT->include_script('list.js'); 
    139    
    140   // add some labels to client 
    141   rcube_add_label('deletecontactconfirm'); 
    142    
    143   return $out; 
    144   } 
     145{ 
     146    $registry = rc_registry::getInstance(); 
     147    $CONTACTS = $registry->get('CONTACTS', 'core'); 
     148    $OUTPUT   = $registry->get('OUTPUT', 'core'); 
     149 
     150    // count contacts for this user 
     151    $result = $CONTACTS->list_records(); 
     152 
     153    // add id to message list table if not specified 
     154    if (!strlen($attrib['id'])) { 
     155        $attrib['id'] = 'rcmAddressList'; 
     156    } 
     157    // define list of cols to be displayed 
     158    $a_show_cols = array('name'); 
     159 
     160    // create XHTML table 
     161    $out = rc_main::rcube_table_output( 
     162                $attrib, 
     163                $result->records, 
     164                $a_show_cols, 
     165                $CONTACTS->primary_key 
     166    ); 
     167 
     168    // set client env 
     169    $OUTPUT->add_gui_object('contactslist', $attrib['id']); 
     170    $OUTPUT->set_env('current_page', (int)$CONTACTS->list_page); 
     171    $OUTPUT->set_env('pagecount', ceil($result->count/$CONTACTS->page_size)); 
     172    $OUTPUT->include_script('list.js'); 
     173 
     174    // add some labels to client 
     175    rcube_add_label('deletecontactconfirm'); 
     176 
     177    return $out; 
     178} 
    145179 
    146180 
    147181function rcmail_js_contacts_list($result, $prefix='') 
    148   { 
    149   global $OUTPUT; 
    150  
    151   if (empty($result) || $result->count == 0) 
    152     return; 
    153  
    154   // define list of cols to be displayed 
    155   $a_show_cols = array('name'); 
    156    
    157   while ($row = $result->next()) 
    158     { 
    159     $a_row_cols = array(); 
    160      
    161     // format each col 
    162     foreach ($a_show_cols as $col) 
    163       $a_row_cols[$col] = $row[$col]; 
    164      
    165     $OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols); 
    166     } 
    167   } 
     182{ 
     183    $registry = rc_registry::getInstance(); 
     184    $OUTPUT   = $registry->get('OUTPUT', 'core'); 
     185 
     186    if (empty($result) || $result->count == 0) { 
     187        return; 
     188    } 
     189    // define list of cols to be displayed 
     190    $a_show_cols = array('name'); 
     191 
     192    while ($row = $result->next()) { 
     193        $a_row_cols = array(); 
     194 
     195        // format each col 
     196        foreach ($a_show_cols as $col) { 
     197            $a_row_cols[$col] = $row[$col]; 
     198        } 
     199        $OUTPUT->command($prefix.'add_contact_row', $row['ID'], $a_row_cols); 
     200    } 
     201} 
    168202 
    169203 
    170204// similar function as /steps/settings/identities.inc::rcmail_identity_frame() 
    171205function rcmail_contact_frame($attrib) 
    172   { 
    173   global $OUTPUT; 
    174  
    175   if (!$attrib['id']) 
    176     $attrib['id'] = 'rcmcontactframe'; 
    177      
    178   $attrib['name'] = $attrib['id']; 
    179   $attrib_str = rc_main::create_attrib_string($attrib, array('name', 'id', 'class', 'style', 'src', 'width', 'height', 'frameborder')); 
    180  
    181   $OUTPUT->set_env('contentframe', $attrib['name']); 
    182   $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif'); 
    183   return '<iframe'. $attrib_str . '></iframe>'; 
     206{ 
     207    $registry = rc_registry::getInstance(); 
     208    $OUTPUT   = $registry->get('OUTPUT', 'core'); 
     209 
     210    if (!$attrib['id']) { 
     211        $attrib['id'] = 'rcmcontactframe'; 
     212    } 
     213    $attrib['name'] = $attrib['id']; 
     214    $attrib_str = rc_main::create_attrib_string( 
     215                        $attrib, 
     216                        array( 
     217                            'name', 
     218                            'id', 
     219                            'class', 
     220                            'style', 
     221                            'src', 
     222                            'width', 
     223                            'height', 
     224                            'frameborder' 
     225                        ) 
     226    ); 
     227 
     228    $OUTPUT->set_env('contentframe', $attrib['name']); 
     229    $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif'); 
     230    return '<iframe'. $attrib_str . '></iframe>'; 
    184231  } 
    185232 
    186233 
    187234function rcmail_rowcount_display($attrib) 
    188   { 
    189   global $OUTPUT; 
    190    
    191   if (!$attrib['id']) 
    192     $attrib['id'] = 'rcmcountdisplay'; 
    193  
    194   $OUTPUT->add_gui_object('countdisplay', $attrib['id']); 
    195  
    196   // allow the following attributes to be added to the <span> tag 
    197   $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id')); 
    198  
    199   $out = '<span' . $attrib_str . '>'; 
    200   $out .= rcmail_get_rowcount_text(); 
    201   $out .= '</span>'; 
    202   return $out; 
    203   } 
     235{ 
     236    $registry = rc_registry::getInstance(); 
     237    $OUTPUT   = $registry->get('OUTPUT', 'core'); 
     238 
     239    if (!$attrib['id']) { 
     240        $attrib['id'] = 'rcmcountdisplay'; 
     241    } 
     242    $OUTPUT->add_gui_object('countdisplay', $attrib['id']); 
     243 
     244    // allow the following attributes to be added to the <span> tag 
     245    $attrib_str = rc_main::create_attrib_string($attrib, array('style', 'class', 'id')); 
     246 
     247    $out = '<span' . $attrib_str . '>'; 
     248    $out .= rcmail_get_rowcount_text(); 
     249    $out .= '</span>'; 
     250    return $out; 
     251} 
    204252 
    205253 
    206254 
    207255function rcmail_get_rowcount_text() 
    208   { 
    209   global $CONTACTS; 
    210    
    211   // read nr of contacts 
    212   $result = $CONTACTS->get_result(); 
    213   if (!$result) 
    214     $result = $CONTACTS->count(); 
    215    
    216   if ($result->count == 0) 
    217     $out = rcube_label('nocontactsfound'); 
    218   else 
    219     $out = rcube_label(array( 
    220       'name' => 'contactsfromto', 
    221       'vars' => array( 
    222         'from'  => $result->first + 1, 
    223         'to'    => min($result->count, $result->first + $CONTACTS->page_size), 
    224         'count' => $result->count) 
    225       )); 
    226  
    227   return $out; 
    228   } 
    229    
    230    
     256{ 
     257    $registry = rc_registry::getInstance(); 
     258    $CONTACTS = $registry->get('CONTACTS', 'core'); 
     259 
     260    // read nr of contacts 
     261    $result = $CONTACTS->get_result(); 
     262    if (!$result) { 
     263        $result = $CONTACTS->count(); 
     264    } 
     265    if ($result->count == 0) { 
     266        $out = rcube_label('nocontactsfound'); 
     267    } 
     268    else { 
     269        $out = rcube_label(array( 
     270                    'name' => 'contactsfromto', 
     271                    'vars' => array( 
     272                                'from'  => $result->first + 1, 
     273                                'to'    => min($result->count, $result->first + $CONTACTS->page_size), 
     274                                'count' => $result->count) 
     275                    ) 
     276        ); 
     277    } 
     278    return $out; 
     279} 
     280 
     281 
    231282// register UI objects 
    232 $OUTPUT->add_handlers(array( 
    233   'directorylist' => 'rcmail_directory_list', 
    234   'addresslist' => 'rcmail_contacts_list', 
    235   'addressframe' => 'rcmail_contact_frame', 
    236   'recordscountdisplay' => 'rcmail_rowcount_display', 
    237   'searchform' => 'rcmail_search_form' 
    238 )); 
    239  
     283$OUTPUT->add_handlers( 
     284    array( 
     285        'directorylist'       => 'rcmail_directory_list', 
     286        'addresslist'         => 'rcmail_contacts_list', 
     287        'addressframe'        => 'rcmail_contact_frame', 
     288        'recordscountdisplay' => 'rcmail_rowcount_display', 
     289        'searchform'          => 'rcmail_search_form' 
     290    ) 
     291); 
    240292?> 
  • branches/devel-vnext/program/steps/addressbook/search.inc

    r589 r631  
    1919 
    2020*/ 
     21$registry = rc_registry::getInstance(); 
     22$CONTACTS = $registry->get('CONTACTS', 'core'); 
     23$OUTPUT   = $registry->get('OUTPUT', 'core'); 
     24 
    2125 
    2226$CONTACTS->set_page(1); 
    2327$_SESSION['page'] = 1; 
    2428 
    25 $search = trim(get_input_value('_q', RCUBE_INPUT_GET)); 
     29$search = trim(rc_main::get_input_value('_q', RCUBE_INPUT_GET)); 
    2630$search_request = md5('addr'.$search); 
    2731 
     
    2933$result = $CONTACTS->search(array('name','email'), $search); 
    3034 
    31 if ($result->count > 0) 
    32 { 
    33   // save search settings in session 
    34   $_SESSION['search'][$search_request] = $CONTACTS->get_search_set(); 
    35    
    36   // create javascript list 
    37   rcmail_js_contacts_list($result); 
     35if ($result->count > 0) { 
     36    // save search settings in session 
     37    $_SESSION['search'][$search_request] = $CONTACTS->get_search_set(); 
     38 
     39    // create javascript list 
     40    rcmail_js_contacts_list($result); 
    3841} 
    39 else 
    40 { 
    41   $OUTPUT->show_message('nocontactsfound', 'warning'); 
    42   $search_request = -1; 
     42else { 
     43    $OUTPUT->show_message('nocontactsfound', 'warning'); 
     44    $search_request = -1; 
    4345} 
    4446 
     
    4749$OUTPUT->set_env('pagecount', ceil($result->count / $CONTACTS->page_size)); 
    4850$OUTPUT->command('set_rowcount', rcmail_get_rowcount_text()); 
    49    
     51 
    5052// send response 
    5153$OUTPUT->send(); 
  • branches/devel-vnext/program/steps/mail/compose.inc

    r626 r631  
    156156/****** get contacts for this user and add them to client scripts ********/ 
    157157require_once 'include/rcube_contacts.inc'; 
     158require_once 'include/rcube_contacts_macbay.inc'; 
    158159 
    159 $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']); 
    160 $CONTACTS->set_pagesize(1000); 
     160if (isset($CONFIG['addressbook_plugin'])) { 
     161    $CONTACTS = new rcube_contacts_macbay($_SESSION['username'], $_SESSION['password']); 
     162} 
     163else { 
     164    $DB = $registry->get('DB', 'core'); 
    161165 
     166    $CONTACTS = new rcube_contacts($DB, $_SESSION['user_id']); 
     167    $CONTACTS->set_pagesize(1000); 
     168} 
    162169if ($result = $CONTACTS->list_records()) { 
    163170    $a_contacts = array(); 
  • branches/devel-vnext/program/steps/mail/func.inc

    r629 r631  
    12811281    $sa_attrib = $registry->get('sa_attrib', 'core'); 
    12821282 
    1283     rc_main::tfk_debug('rcmail_message_headers: hello? hello!'); 
     1283    //rc_main::tfk_debug('rcmail_message_headers: hello? hello!'); 
    12841284 
    12851285    // keep header table attrib 
     
    12971297    } 
    12981298 
    1299     rc_main::tfk_debug('MESSAGE: ' . var_export($MESSAGE, true)); 
     1299    //rc_main::tfk_debug('MESSAGE: ' . var_export($MESSAGE, true)); 
    13001300 
    13011301    // get associative array of headers object 
     
    13121312    $standard_headers = array('subject', 'from', 'organization', 'to', 'cc', 'bcc', 'reply-to', 'date'); 
    13131313 
    1314     rc_main::tfk_debug('rcmail_message_headers: ' . var_export($headers, true)); 
     1314    //rc_main::tfk_debug('rcmail_message_headers: ' . var_export($headers, true)); 
    13151315 
    13161316    foreach ($standard_headers as $hkey) { 
     
    17181718                        rc_main::Q($part['mailto']), 
    17191719                        rc_main::Q($part['name'])); 
    1720             /** 
    1721              * Build icon to allow adding to addressbook. 
    1722              * @ignore 
    1723              */ 
    1724             /* 
    17251720            if ($addicon) { 
    17261721                $out .= sprintf( 
     
    17321727                            $addicon 
    17331728                ); 
    1734             }*/ 
     1729            } 
    17351730        } 
    17361731        else { 
Note: See TracChangeset for help on using the changeset viewer.