Changeset 1580 in subversion


Ignore:
Timestamp:
Jun 30, 2008 5:36:18 AM (5 years ago)
Author:
alec
Message:
  • Added flag column on messages list (#1484623)
Location:
trunk/roundcubemail
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/CHANGELOG

    r1576 r1580  
    11CHANGELOG RoundCube Webmail 
    22--------------------------- 
     3 
     42008/06/30 (alec) 
     5---------- 
     6- Added flag column on messages list (#1484623) 
    37 
    482008/06/24 (alec) 
  • trunk/roundcubemail/program/include/rcube_imap.php

    r1562 r1580  
    13161316    else if ($flag=='UNSEEN') 
    13171317      $result = iil_C_Unseen($this->conn, $this->mailbox, join(',', array_values($msg_ids))); 
     1318    else if ($flag=='UNFLAGGED') 
     1319      $result = iil_C_UnFlag($this->conn, $this->mailbox, join(',', array_values($msg_ids)), 'FLAGGED'); 
    13181320    else 
    13191321      $result = iil_C_Flag($this->conn, $this->mailbox, join(',', array_values($msg_ids)), $flag); 
  • trunk/roundcubemail/program/js/app.js

    r1570 r1580  
    137137 
    138138          this.message_list.init(); 
    139           this.enable_command('toggle_status', true); 
     139          this.enable_command('toggle_status', 'toggle_flag', true); 
    140140           
    141141          if (this.gui_objects.mailcontframe) 
     
    374374      row.unread = this.env.messages[uid].unread ? true : false; 
    375375      row.replied = this.env.messages[uid].replied ? true : false; 
     376      row.flagged = this.env.messages[uid].flagged ? true : false; 
    376377      } 
    377378 
     
    383384      row.icon._row = row.obj; 
    384385      row.icon.onmousedown = function(e) { p.command('toggle_status', this); }; 
     386      } 
     387 
     388    // global variable 'flagged_col' may be not defined yet 
     389    if (!this.env.flagged_col && this.env.coltypes) 
     390      { 
     391      var found; 
     392      if((found = find_in_array('flag', this.env.coltypes)) >= 0) 
     393          this.set_env('flagged_col', found+1); 
     394      } 
     395 
     396    // set eventhandler to flag icon, if icon found 
     397    if (this.env.flagged_col && (row.flagged_icon = row.obj.cells[this.env.flagged_col].childNodes[0])  
     398        && row.flagged_icon.nodeName=='IMG') 
     399      { 
     400      var p = this; 
     401      row.flagged_icon.id = 'flaggedicn_'+row.uid; 
     402      row.flagged_icon._row = row.obj; 
     403      row.flagged_icon.onmousedown = function(e) { p.command('toggle_flag', this); }; 
    385404      } 
    386405  }; 
     
    709728        break; 
    710729         
     730      case 'toggle_flag': 
     731        if (props && !props._row) 
     732          break; 
     733 
     734        var uid; 
     735        var flag = 'flagged'; 
     736 
     737        if (props._row.uid) 
     738          { 
     739          uid = props._row.uid; 
     740          this.message_list.dont_select = true; 
     741          // toggle flagged/unflagged 
     742          if (this.message_list.rows[uid].flagged) 
     743            flag = 'unflagged'; 
     744          } 
     745        this.mark_message(flag, uid); 
     746        break; 
     747 
    711748      case 'always-load': 
    712749        if (this.env.uid && this.env.sender) { 
     
    15271564      for (var n=0; n<selection.length; n++) 
    15281565        { 
    1529           a_uids[a_uids.length] = selection[n]; 
     1566          a_uids[a_uids.length] = selection[n]; 
    15301567        } 
    15311568      } 
     
    15391576        if ((flag=='read' && this.message_list.rows[id].unread)  
    15401577            || (flag=='unread' && !this.message_list.rows[id].unread) 
    1541             || (flag=='delete' && !this.message_list.rows[id].deleted) 
    1542             || (flag=='undelete' && this.message_list.rows[id].deleted)) 
     1578        || (flag=='delete' && !this.message_list.rows[id].deleted) 
     1579            || (flag=='undelete' && this.message_list.rows[id].deleted) 
     1580            || (flag=='flagged' && !this.message_list.rows[id].flagged) 
     1581            || (flag=='unflagged' && this.message_list.rows[id].flagged)) 
    15431582          { 
    15441583            r_uids[r_uids.length] = id; 
     
    15591598        case 'undelete': 
    15601599          this.toggle_delete_status(r_uids); 
     1600          break; 
     1601        case 'flagged': 
     1602        case 'unflagged': 
     1603          this.toggle_flagged_status(flag, a_uids); 
    15611604          break; 
    15621605      } 
     
    16261669  } 
    16271670   
     1671   
     1672  // set image to flagged or unflagged 
     1673  this.toggle_flagged_status = function(flag, a_uids) 
     1674  { 
     1675    // mark all message rows as flagged/unflagged 
     1676    var icn_src; 
     1677    var rows = this.message_list.rows; 
     1678    for (var i=0; i<a_uids.length; i++) 
     1679      { 
     1680      uid = a_uids[i]; 
     1681      if (rows[uid]) 
     1682        { 
     1683        rows[uid].flagged = (flag=='flagged' ? true : false); 
     1684 
     1685        if (rows[uid].flagged && this.env.flaggedicon) 
     1686          icn_src = this.env.flaggedicon; 
     1687        else if (this.env.unflaggedicon) 
     1688          icn_src = this.env.unflaggedicon; 
     1689 
     1690        if (rows[uid].flagged_icon && icn_src) 
     1691          rows[uid].flagged_icon.src = icn_src; 
     1692        } 
     1693      } 
     1694 
     1695    this.http_post('mark', '_uid='+a_uids.join(',')+'&_flag='+flag); 
     1696  }; 
    16281697   
    16291698  // mark all message rows as deleted/undeleted 
     
    32443313        cell.id = 'rcmHead'+col; 
    32453314        } 
    3246          
    3247       if (col == 'subject' && this.message_list) 
     3315      else if (col == 'subject' && this.message_list) 
    32483316        this.message_list.subject_col = n+1; 
     3317      else if (col == 'flag' && this.env.unflaggedicon) 
     3318        { 
     3319          cell.innerHTML = '<img src="'+this.env.unflaggedicon+'" alt="" />'; 
     3320        } 
    32493321      } 
    32503322  }; 
     
    32623334    this.env.messages[uid] = {deleted:flags.deleted?1:0, 
    32633335                              replied:flags.replied?1:0, 
    3264                               unread:flags.unread?1:0}; 
     3336                              unread:flags.unread?1:0, 
     3337                              flagged:flags.flagged?1:0}; 
    32653338     
    32663339    var row = document.createElement('TR'); 
     
    32773350    var col = document.createElement('TD'); 
    32783351    col.className = 'icon'; 
    3279     col.innerHTML = icon ? '<img src="'+icon+'" alt="" border="0" />' : ''; 
     3352    col.innerHTML = icon ? '<img src="'+icon+'" alt="" />' : ''; 
    32803353    row.appendChild(col); 
    32813354 
     
    32863359      col = document.createElement('TD'); 
    32873360      col.className = String(c).toLowerCase(); 
    3288       col.innerHTML = cols[c]; 
     3361       
     3362      if (c=='flag') 
     3363        { 
     3364        if (flags.flagged && this.env.flaggedicon) 
     3365          col.innerHTML = '<img src="'+this.env.flaggedicon+'" alt="" />'; 
     3366        else if(this.env.unflaggedicon) 
     3367          col.innerHTML = '<img src="'+this.env.unflaggedicon+'" alt="" />'; 
     3368        } 
     3369      else 
     3370        col.innerHTML = cols[c]; 
     3371 
    32893372      row.appendChild(col); 
    32903373      } 
     
    32923375    col = document.createElement('TD'); 
    32933376    col.className = 'icon'; 
    3294     col.innerHTML = attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" border="0" />' : ''; 
     3377    col.innerHTML = attachment && this.env.attachmenticon ? '<img src="'+this.env.attachmenticon+'" alt="" />' : ''; 
    32953378    row.appendChild(col); 
    32963379 
  • trunk/roundcubemail/program/lib/imap.inc

    r1565 r1580  
    150150        var $forwarded = false; 
    151151        var $junk = false; 
     152        var $flagged = false; 
    152153} 
    153154 
     
    17591760                                                        } else if (strcasecmp($val, '$MDNSent') == 0) { 
    17601761                                                            $result[$id]->mdn_sent = true; 
     1762                                                        } else if (strcasecmp($val, 'Flagged') == 0) { 
     1763                                                             $result[$id]->flagged = true; 
    17611764                                                        } 
    17621765                                                } 
  • trunk/roundcubemail/program/localization/en_US/labels.inc

    r1536 r1580  
    142142$labels['markread']         = 'As read'; 
    143143$labels['markunread']       = 'As unread'; 
     144$labels['markflagged']         = 'As flagged'; 
     145$labels['markunflagged']       = 'As unflagged'; 
    144146 
    145147$labels['select'] = 'Select'; 
  • trunk/roundcubemail/program/localization/pl_PL/labels.inc

    r1541 r1580  
    136136$labels['markunread'] = 'Jako nieprzeczytanÄ 
    137137'; 
     138$labels['markflagged'] = 'Jako oflagowanÄ 
     139'; 
     140$labels['markunflagged'] = 'Jako nieoflagowanÄ 
     141'; 
    138142$labels['select'] = 'Zaznacz'; 
    139143$labels['all'] = 'Wszystkie'; 
  • trunk/roundcubemail/program/steps/mail/func.inc

    r1570 r1580  
    7575 
    7676 
    77  
    7877/** 
    7978 * return the message list as HTML table 
     
    8483 
    8584  $skin_path = $CONFIG['skin_path']; 
    86   $image_tag = '<img src="%s%s" alt="%s" border="0" />'; 
     85  $image_tag = '<img src="%s%s" alt="%s" />'; 
    8786 
    8887  // check to see if we have some settings for sorting 
     
    104103 
    105104  $out = '<table' . $attrib_str . ">\n"; 
    106  
    107105 
    108106  // define list of cols to be displayed 
     
    134132    { 
    135133    // get column name 
    136     $col_name = Q(rcube_label($col)); 
     134    $col_name = $col != 'flag' ? Q(rcube_label($col)) : sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], ''); 
    137135 
    138136    // make sort links 
     
    198196  foreach ($a_headers as $i => $header)  //while (list($i, $header) = each($a_headers)) 
    199197    { 
    200     $message_icon = $attach_icon = ''; 
     198    $message_icon = $attach_icon = $flagged_icon = ''; 
    201199    $js_row_arr = array(); 
    202200    $zebra_class = $i%2 ? 'even' : 'odd'; 
     
    209207    if ($header->answered) 
    210208      $js_row_arr['replied'] = true; 
     209    if ($header->flagged) 
     210      $js_row_arr['flagged'] = true; 
     211 
    211212    // set message icon   
    212213    if ($attrib['deletedicon'] && $header->deleted) 
     
    218219    else if ($attrib['messageicon']) 
    219220      $message_icon = $attrib['messageicon']; 
     221 
     222    if ($attrib['flaggedicon'] && $header->flagged) 
     223      $flagged_icon = $attrib['flaggedicon']; 
     224    else if ($attrib['unflaggedicon'] && !$header->flagged) 
     225      $flagged_icon = $attrib['unflaggedicon']; 
    220226     
    221227    // set attachment icon 
     
    227233                    $header->seen ? '' : ' unread', 
    228234                    $header->deleted ? ' deleted' : '', 
     235                    $header->flagged ? ' flagged' : '', 
    229236                    $zebra_class);     
    230237     
    231238    $out .= sprintf("<td class=\"icon\">%s</td>\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : ''); 
     239 
    232240 
    233241    if (!empty($header->charset)) 
     
    247255        $cont = sprintf('<a href="%s" onclick="return rcube_event.cancel(event)">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont); 
    248256        } 
     257      else if ($col=='flag') 
     258        $cont = $flagged_icon ? sprintf($image_tag, $skin_path, $flagged_icon, '') : ''; 
    249259      else if ($col=='size') 
    250260        $cont = show_bytes($header->$col); 
     
    289299  if ($attrib['attachmenticon']) 
    290300    $OUTPUT->set_env('attachmenticon', $skin_path . $attrib['attachmenticon']); 
     301  if ($attrib['flaggedicon']) 
     302    $OUTPUT->set_env('flaggedicon', $skin_path . $attrib['flaggedicon']); 
     303  if ($attrib['unflaggedicon']) 
     304    $OUTPUT->set_env('unflaggedicon', $skin_path . $attrib['unflaggedicon']); 
    291305   
    292306  $OUTPUT->set_env('messages', $a_js_message_arr); 
     
    354368    $a_msg_flags['unread'] = $header->seen ? 0 : 1; 
    355369    $a_msg_flags['replied'] = $header->answered ? 1 : 0; 
     370    $a_msg_flags['flagged'] = $header->flagged ? 1 : 0; 
     371     
    356372    $OUTPUT->command('add_message_row', 
    357373      $header->uid, 
  • trunk/roundcubemail/program/steps/mail/mark.inc

    r1292 r1580  
    2323  'delete' => 'DELETED', 
    2424  'read' => 'SEEN', 
    25   'unread' => 'UNSEEN'); 
     25  'unread' => 'UNSEEN', 
     26  'flagged' => 'FLAGGED', 
     27  'unflagged' => 'UNFLAGGED'); 
    2628 
    2729if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_value('_flag', RCUBE_INPUT_POST))) 
  • trunk/roundcubemail/skins/default/mail.css

    r1571 r1580  
    457457} 
    458458 
    459 #messagelist tr td.icon 
     459#messagelist tr td.icon, 
     460#messagelist tr td.flag 
    460461{ 
    461462  width: 16px; 
  • trunk/roundcubemail/skins/default/templates/mail.html

    r1303 r1580  
    6969  deletedIcon="/images/icons/deleted.png" 
    7070  repliedIcon="/images/icons/replied.png" 
    71   attachmentIcon="/images/icons/attachment.png" /> 
     71  attachmentIcon="/images/icons/attachment.png" 
     72  flaggedIcon="/images/icons/flagged.png" 
     73  unflaggedIcon="/images/icons/unflagged.png" /> 
    7274</div> 
    7375 
     
    113115    <li><roundcube:button command="mark" prop="read" label="markread" classAct="active" /></li> 
    114116    <li><roundcube:button command="mark" prop="unread" label="markunread" classAct="active" /></li> 
     117    <li><roundcube:button command="mark" prop="flagged" label="markflagged" classAct="active" /></li> 
     118    <li><roundcube:button command="mark" prop="unflagged" label="markunflagged" classAct="active" /></li> 
    115119  </ul> 
    116120</div> 
Note: See TracChangeset for help on using the changeset viewer.