Ignore:
Timestamp:
Jun 15, 2011 7:04:06 AM (2 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
feac485
Parents:
fd89754
Message:
  • Fixed initial directory selection
File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/steps/addressbook/func.inc

    recf295f rca7dda4  
    6363    $js_list = $RCMAIL->get_address_sources(); 
    6464 
     65    $source = get_input_value('_source', RCUBE_INPUT_GPC); 
     66 
    6567    // use first directory by default 
    66     $source = $js_list[key($js_list)]['id']; 
     68    if (!strlen($source) || !isset($js_list[$source])) 
     69        $source = $js_list[key($js_list)]['id']; 
    6770 
    6871    // find writeable source 
     
    156159    $local_id = '0'; 
    157160    $jsdata = array(); 
    158     $current = get_input_value('_source', RCUBE_INPUT_GPC); 
     161 
    159162    $line_templ = html::tag('li', array( 
    160163        'id' => 'rcmli%s', 'class' => 'addressbook %s'), 
     
    163166            'onclick' => "return ".JS_OBJECT_NAME.".command('list','%s',this)"), '%s')); 
    164167 
    165     // currently selected is the first address source in the list 
    166     if (!isset($current)) 
    167         $current = strval(key((array)$OUTPUT->env['address_sources'])); 
    168  
    169     foreach ((array)$OUTPUT->env['address_sources'] as $j => $source) { 
     168    $sources = (array) $OUTPUT->env['address_sources']; 
     169    reset($sources); 
     170 
     171    // currently selected source 
     172    $current = get_input_value('_source', RCUBE_INPUT_GPC); 
     173    if (!strlen($current) || !isset($sources[$source])) 
     174        $current = strval(key($sources)); 
     175 
     176    foreach ($sources as $j => $source) { 
    170177        $id = strval($source['id'] ? $source['id'] : $j); 
    171178        $js_id = JQ($id); 
Note: See TracChangeset for help on using the changeset viewer.