Ignore:
Timestamp:
Feb 27, 2007 6:33:56 PM (6 years ago)
Author:
thomasb
Message:

devel-addressbook: interface to public ldap directories with drag & drop copying

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/devel-addressbook/program/steps/addressbook/func.inc

    r495 r499  
    4646// set data source env 
    4747$OUTPUT->set_env('source', $source ? $source : '0'); 
     48$OUTPUT->set_env('readonly', $CONTACTS->readonly, false); 
    4849 
    4950 
     
    6364    ' onmouseup="return %s.folder_mouse_up(\'%s\')">%s'. 
    6465    "</a></li>\n"; 
     66     
     67  $js_list = array("$local_id" => array('id' => $local_id, 'readonly' => false)); 
    6568 
    6669  // allow the following attributes to be added to the <ul> tag 
     
    8386  { 
    8487    $js_id = JQ($id); 
     88    $dom_id = preg_replace('/[^a-z0-9\-_]/i', '', $id); 
    8589    $out .= sprintf($line_templ, 
    86       'rcmli'.preg_replace('/[^a-z0-9\-_]/i', '', $id), 
     90      'rcmli'.$dom_id, 
    8791      $current == $id ? 'selected' : '', 
    8892      Q(rcmail_self_url('list', array('_source' => $id))), 
     
    96100      $js_id, 
    97101      !empty($prop['name']) ? Q($prop['name']) : Q($id)); 
     102       
     103    $js_list[$dom_id] = array('id' => $id, 'readonly' => !$prop['writeable']); 
    98104  } 
    99105   
     
    101107 
    102108  $OUTPUT->add_gui_object('folderlist', $attrib['id']); 
     109  $OUTPUT->set_env('address_sources', $js_list); 
    103110   
    104111  return $out; 
     
    113120  // count contacts for this user 
    114121  $result = $CONTACTS->list_records(); 
    115   $rowcount = $result['count']; 
    116   $firstrow = $result['first']; 
    117    
    118   unset($result['count'], $result['first']); 
    119122   
    120123  // add id to message list table if not specified 
     
    124127  // define list of cols to be displayed 
    125128  $a_show_cols = array('name'); 
    126    
     129 
    127130  // create XHTML table 
    128   $out = rcube_table_output($attrib, $result, $a_show_cols, $CONTACTS->primary_key); 
     131  $out = rcube_table_output($attrib, $result->records, $a_show_cols, $CONTACTS->primary_key); 
    129132   
    130133  // set client env 
    131134  $OUTPUT->add_gui_object('contactslist', $attrib['id']); 
    132135  $OUTPUT->set_env('current_page', (int)$CONTACTS->list_page); 
    133   $OUTPUT->set_env('pagecount', ceil($rowcount/$CONTACTS->page_size)); 
     136  $OUTPUT->set_env('pagecount', ceil($result->count/$CONTACTS->page_size)); 
    134137  $OUTPUT->include_script('list.js'); 
    135138   
     
    145148  global $OUTPUT; 
    146149 
    147   if (empty($result) || $result['count'] == 0) 
     150  if (empty($result) || $result->count == 0) 
    148151    return; 
    149152 
    150   unset($result['count'], $result['first']); 
    151    
    152153  // define list of cols to be displayed 
    153154  $a_show_cols = array('name'); 
    154155   
    155   foreach ($result as $i => $row) 
     156  while ($row = $result->next()) 
    156157    { 
    157158    $a_row_cols = array(); 
     
    212213    $result = $CONTACTS->count(); 
    213214   
    214   if ($result['count'] == 0) 
     215  if ($result->count == 0) 
    215216    $out = rcube_label('nocontactsfound'); 
    216217  else 
     
    218219      'name' => 'contactsfromto', 
    219220      'vars' => array( 
    220         'from'  => $result['first'] + 1, 
    221         'to'    => min($result['count'], $result['first'] + $CONTACTS->page_size), 
    222         'count' => $result['count']) 
     221        'from'  => $result->first + 1, 
     222        'to'    => min($result->count, $result->first + $CONTACTS->page_size), 
     223        'count' => $result->count) 
    223224      )); 
    224225 
Note: See TracChangeset for help on using the changeset viewer.