Changeset f8e8af7 in github


Ignore:
Timestamp:
Sep 15, 2010 5:27:45 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
acbf0f5
Parents:
f12d218
Message:
  • Settings block (fieldset) can have any content (not only a table with hardcoded structure)
Location:
program/steps/settings
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/steps/settings/edit_prefs.inc

    rb25dfd0 rf8e8af7  
    3535 
    3636  unset($attrib['form']); 
    37    
     37 
    3838  list($form_start, $form_end) = get_form_tags($attrib, 'save-prefs', null, 
    3939    array('name' => '_section', 'value' => $CURR_SECTION)); 
     
    4242 
    4343  foreach ($SECTIONS[$CURR_SECTION]['blocks'] as $idx => $block) { 
    44     if ($block['options']) { 
     44    if (!empty($block['options'])) { 
    4545      $table = new html_table(array('cols' => 2)); 
    4646 
    4747      foreach ($block['options'] as $option) { 
    4848        if ($option['advanced']) 
    49           $table->set_row_attribs('advanced'); 
    50      
     49              $table->set_row_attribs('advanced'); 
     50 
    5151        $table->add('title', $option['title']); 
    52         $table->add(null, $option['content']); 
    53         } 
    54      
     52            $table->add(null, $option['content']); 
     53      } 
     54 
    5555      $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $table->show($attrib)); 
    56       } 
    5756    } 
     57    else if (!empty($block['content'])) { 
     58      $out .= html::tag('fieldset', null, html::tag('legend', null, $block['name']) . $block['content']); 
     59    } 
     60  } 
    5861 
    5962  return $out . $form_end; 
  • program/steps/settings/func.inc

    rd11fb20 rf8e8af7  
    3636  $OUTPUT->set_env('contentframe', $attrib['name']); 
    3737  $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/blank.gif'); 
    38    
     38 
    3939  return html::iframe($attrib); 
    4040} 
     
    4444{ 
    4545  global $RCMAIL; 
    46    
     46 
    4747  // add id to message list table if not specified 
    4848  if (!strlen($attrib['id'])) 
     
    5050 
    5151  list($list, $cols) = rcmail_user_prefs(); 
    52              
     52 
    5353  // create XHTML table 
    5454  $out = rcube_table_output($attrib, $list, $cols, 'id'); 
     
    9797 
    9898  $form_start = $form_end = ''; 
    99    
     99 
    100100  if (empty($EDIT_FORM)) { 
    101101    $request_key = $action . (isset($id) ? '.'.$id : ''); 
     
    108108          'noclose' => true 
    109109        ) + $attrib); 
    110      
     110 
    111111    if (is_array($hidden)) { 
    112112      $hiddenfields = new html_hiddenfield($hidden); 
    113113      $form_start .= $hiddenfields->show(); 
    114114    } 
    115      
     115 
    116116    $form_end = !strlen($attrib['form']) ? '</form>' : ''; 
    117117 
     
    140140 
    141141  $sections = $plugin['list']; 
    142          
     142 
    143143  $config = $RCMAIL->config->all(); 
    144144  $no_override = array_flip($RCMAIL->config->get('dont_override', array())); 
    145    
     145 
    146146  foreach ($sections as $idx => $sect) { 
    147    
     147 
    148148    if ($current && $sect['id'] != $current) 
    149149      continue; 
    150    
     150 
    151151    $blocks = array(); 
    152      
     152 
    153153    switch ($sect['id']) { 
    154154    // general 
    155155    case 'general': 
    156      
     156 
    157157    $blocks = array( 
    158158      'main' => array('name' => Q(rcube_label('mainoptions'))), 
    159159      'list' => array('name' => Q(rcube_label('listoptions'))), 
    160160    ); 
    161      
     161 
    162162    // language selection 
    163163    if (!isset($no_override['language'])) { 
     
    276276      } 
    277277    } 
    278      
    279     break;     
    280      
     278 
     279    break; 
     280 
    281281    // Mailbox view (mail screen) 
    282282    case 'mailbox': 
    283      
     283 
    284284    $blocks = array( 
    285285      'main' => array('name' => Q(rcube_label('mainoptions'))), 
     
    303303      // apply default if config option is not set at all 
    304304      $config['preview_pane_mark_read'] = $RCMAIL->config->get('preview_pane_mark_read', 0); 
    305        
     305 
    306306      $field_id = 'rcmfd_preview_pane_mark_read'; 
    307307      $select_delay = new html_select(array('name' => '_preview_pane_mark_read', 'id' => $field_id, 
     
    343343      $select_autoexpand_threads->add(rcube_label('do_expand'), 1); 
    344344      $select_autoexpand_threads->add(rcube_label('expand_only_unread'), 2); 
    345        
     345 
    346346      $blocks['main']['options']['autoexpand_threads'] = array( 
    347347        'title' => html::label($field_id, Q(rcube_label('autoexpand_threads'))), 
     
    387387 
    388388    break; 
    389      
     389 
    390390    // Message viewing 
    391391    case 'mailview': 
    392      
     392 
    393393    $blocks = array( 
    394394      'main' => array('name' => Q(rcube_label('mainoptions'))), 
     
    453453 
    454454    break; 
    455      
     455 
    456456    // Mail composition 
    457457    case 'compose': 
    458      
     458 
    459459    $blocks = array( 
    460460      'main' => array('name' => Q(rcube_label('mainoptions'))), 
     
    559559 
    560560    break; 
    561      
     561 
    562562    // Special IMAP folders 
    563563    case 'folders': 
    564      
     564 
    565565    $blocks = array( 
    566566      'main' => array('name' => Q(rcube_label('mainoptions'))), 
     
    606606 
    607607    break; 
    608      
     608 
    609609    // Server settings 
    610610    case 'server': 
    611      
     611 
    612612    $blocks = array( 
    613613      'main' => array('name' => Q(rcube_label('mainoptions'))), 
     
    677677      ); 
    678678    } 
    679      
     679 
    680680    break; 
    681681    } 
     
    683683    $data = $RCMAIL->plugins->exec_hook('preferences_list', array('section' => $sect['id'], 'blocks' => $blocks)); 
    684684    $found = false; 
    685      
     685 
    686686    // create output 
    687687    foreach ($data['blocks'] as $block) { 
    688       if ($block['options']) { 
    689         foreach ($block['options'] as $option) { 
    690           $found = true; 
    691           break 2; 
    692         } 
     688      if (!empty($block['content']) || !empty($block['options'])) { 
     689        $found = true; 
     690            break; 
    693691      } 
    694692    } 
     
    710708 
    711709  $dir = opendir($path); 
    712    
     710 
    713711  if (!$dir) 
    714712        return false; 
    715    
     713 
    716714  while (($file = readdir($dir)) !== false) 
    717715  { 
Note: See TracChangeset for help on using the changeset viewer.