Changeset d59aaa1 in github


Ignore:
Timestamp:
Nov 23, 2008 7:25:15 AM (4 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
9c314bc
Parents:
dcf780a
Message:
  • Allow setting attachment col position in 'list_cols' option
  • Allow override 'list_cols' via skin (#1485577)
  • Fix: allow empty attribs in templates
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r3e48d2ee rd59aaa1  
    11CHANGELOG RoundCube Webmail 
    22--------------------------- 
     3 
     42008/11/23 (alec) 
     5---------- 
     6- Allow setting attachment col position in 'list_cols' option 
     7- Allow override 'list_cols' via skin (#1485577) 
    38 
    492008/11/21 (alec) 
  • config/main.inc.php.dist

    r95d90f8 rd59aaa1  
    111111$rcmail_config['sendmail_delay'] = 0; 
    112112 
    113 // These cols are shown in the message list 
    114 // available cols are: subject, from, to, cc, replyto, date, size, encoding, flag 
    115 $rcmail_config['list_cols'] = array('subject', 'from', 'date', 'size', 'flag'); 
     113// These cols are shown in the message list. Available cols are: 
     114// subject, from, to, cc, replyto, date, size, encoding, flag, attachment 
     115$rcmail_config['list_cols'] = array('subject', 'from', 'date', 'size', 'flag', 'attachment'); 
    116116 
    117117// Includes should be interpreted as PHP files 
  • program/include/main.inc

    rbe5d4ab rd59aaa1  
    662662  { 
    663663  $attrib = array(); 
    664   preg_match_all('/\s*([-_a-z]+)=(["\'])??(?(2)([^\2]+)\2|(\S+?))/Ui', stripslashes($str), $regs, PREG_SET_ORDER); 
     664  preg_match_all('/\s*([-_a-z]+)=(["\'])??(?(2)([^\2]*)\2|(\S+?))/Ui', stripslashes($str), $regs, PREG_SET_ORDER); 
    665665 
    666666  // convert attributes to an associative array (name => value) 
  • program/js/app.js

    re538b3d rd59aaa1  
    566566        var sort_order = a_sort[1] ? a_sort[1].toUpperCase() : null; 
    567567        var header; 
    568          
     568 
    569569        // no sort order specified: toggle 
    570570        if (sort_order==null) 
     
    580580 
    581581        // set table header class 
    582         if (header = document.getElementById('rcmHead'+this.env.sort_col)) 
     582        if (header = document.getElementById('rcm'+this.env.sort_col)) 
    583583          this.set_classname(header, 'sorted'+(this.env.sort_order.toUpperCase()), false); 
    584         if (header = document.getElementById('rcmHead'+sort_col)) 
     584        if (header = document.getElementById('rcm'+sort_col)) 
    585585          this.set_classname(header, 'sorted'+sort_order, true); 
    586586 
     
    34283428          cell.innerHTML = this.get_label(this.coltypes[n]); 
    34293429 
    3430         cell.id = 'rcmHead'+col; 
     3430        cell.id = 'rcm'+col; 
    34313431        } 
    34323432      else if (col == 'subject' && this.message_list) 
     
    34993499        else if(this.env.unflaggedicon) 
    35003500          col.innerHTML = '<img src="'+this.env.unflaggedicon+'" alt="" />'; 
    3501         } 
     3501      } 
     3502      else if (c=='attachment') 
     3503        col.innerHTML = attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : ''; 
    35023504      else 
    35033505        col.innerHTML = cols[c]; 
     
    35053507      row.appendChild(col); 
    35063508      } 
    3507  
    3508     col = document.createElement('TD'); 
    3509     col.className = 'icon'; 
    3510     col.innerHTML = attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : ''; 
    3511     row.appendChild(col); 
    35123509 
    35133510    this.message_list.insert_row(row, attop); 
  • program/steps/mail/func.inc

    r4e5b11a rd59aaa1  
    115115  $out = '<table' . $attrib_str . ">\n"; 
    116116 
    117   // define list of cols to be displayed 
    118   $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); 
     117  // define list of cols to be displayed based on parameter or config 
     118  if (empty($attrib['columns'])) 
     119      $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); 
     120  else 
     121      $a_show_cols = explode(',', strip_quotes($attrib['columns'])); 
     122 
     123  // store column list in a session-variable 
     124  $_SESSION['list_columns'] = $a_show_cols; 
     125   
     126  // define sortable columns 
    119127  $a_sort_cols = array('subject', 'date', 'from', 'to', 'size'); 
    120128 
     
    131139 
    132140  foreach ($a_show_cols as $col) 
    133     $out .= sprintf('<col class="%s" />', $col); 
    134  
    135   $out .= '<col class="icon" />'; 
     141    $out .= ($col!='attachment') ? sprintf('<col class="%s" />', $col) : '<col class="icon" />'; 
     142 
    136143  $out .= "</colgroup>\n"; 
    137144 
     
    143150    { 
    144151    // get column name 
    145     $col_name = $col != 'flag' ? Q(rcube_label($col)) : sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], ''); 
     152    switch ($col) 
     153      { 
     154      case 'flag': 
     155        $col_name = sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], ''); 
     156        break; 
     157      case 'attachment': 
     158        $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], ''); 
     159        break; 
     160      default: 
     161        $col_name = Q(rcube_label($col)); 
     162    } 
    146163 
    147164    // make sort links 
     
    191208 
    192209    // put it all together 
    193     $out .= '<td class="'.$col.$sort_class.'" id="rcmHead'.$col.'">' . "$col_name$sort</td>\n";     
    194     } 
    195  
    196   $out .= '<td class="icon">'.($attrib['attachmenticon'] ? sprintf($image_tag, $skin_path, $attrib['attachmenticon'], '') : '&nbsp;')."</td>\n"; 
     210    if ($col!='attachment') 
     211      $out .= '<td class="'.$col.$sort_class.'" id="rcm'.$col.'">' . "$col_name$sort</td>\n"; 
     212    else     
     213      $out .= '<td class="icon" id="rcm'.$col.'">' . "$col_name$sort</td>\n"; 
     214    } 
     215 
    197216  $out .= "</tr></thead>\n<tbody>\n"; 
    198217 
     
    284303        $cont = Q($header->$col); 
    285304         
    286       $out .= '<td class="'.$col.'">' . $cont . "</td>\n"; 
    287       } 
    288  
    289     $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : ''); 
     305      if ($col!='attachment') 
     306        $out .= '<td class="'.$col.'">' . $cont . "</td>\n"; 
     307      else 
     308        $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : ''); 
     309      } 
     310 
    290311    $out .= "</tr>\n"; 
    291312     
     
    343364  global $CONFIG, $IMAP, $OUTPUT; 
    344365 
    345   $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); 
     366  if (empty($_SESSION['list_columns'])) 
     367    $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); 
     368  else 
     369    $a_show_cols = $_SESSION['list_columns']; 
     370 
    346371  $mbox = $IMAP->get_mailbox_name(); 
    347372 
     
    364389    if (!empty($header->charset)) 
    365390      $IMAP->set_charset($header->charset); 
     391 
     392    // remove 'attachment' and 'flag' columns, we don't need them here 
     393    if(($key = array_search('attachment', $a_show_cols)) !== FALSE) 
     394      unset($a_show_cols[$key]); 
     395    if(($key = array_search('flag', $a_show_cols)) !== FALSE) 
     396      unset($a_show_cols[$key]); 
    366397 
    367398    // format each col; similar as in rcmail_message_list() 
  • skins/default/templates/mail.html

    re538b3d rd59aaa1  
    4747  id="messagelist" 
    4848  cellspacing="0" 
     49  columns="" 
    4950  summary="Message list" 
    5051  messageIcon="/images/icons/dot.png" 
Note: See TracChangeset for help on using the changeset viewer.