Changeset 3124 in subversion
- Timestamp:
- Nov 21, 2009 1:56:23 PM (4 years ago)
- Location:
- branches/devel-threads
- Files:
-
- 5 edited
-
THREADS (modified) (3 diffs)
-
program/js/app.js (modified) (9 diffs)
-
program/steps/mail/func.inc (modified) (7 diffs)
-
program/steps/mail/list.inc (modified) (3 diffs)
-
skins/default/functions.js (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/devel-threads/THREADS
r3121 r3124 14 14 - removed 'index_sort' option, now we're using empty 'message_sort_col' for 15 15 this purpose 16 - popup menu for list column/sorting/view selection (not finished yet)16 - popup menu for messages list column/sorting/view selection 17 17 - added sorting by ARRIVAL 18 18 - added sorting by CC … … 31 31 root or child message), 32 32 - "Expand All Unread" button 33 - columns/sort/view selector (popup) with 'default sorting' support34 33 - thread tree icons 35 34 - reset autoexpand feature if collapse-all/expand-all was used. Save state for next page … … 42 41 - thread css: message row height, thread/status icon alignment 43 42 - remove 'indexsort' label from localization files 43 - use jQuery.inArray instead of find_in_array() (common.js) 44 44 45 45 KNOWN ISSUES: -
branches/devel-threads/program/js/app.js
r3123 r3124 174 174 document.onmouseup = function(e){ return p.doc_mouse_up(e); }; 175 175 176 this.set_message_coltypes(this.env.coltypes); 176 177 this.message_list.init(); 177 178 this.enable_command('toggle_status', 'toggle_flag', true); … … 188 189 this.message_list.expand(null); 189 190 } 190 191 if (this.env.coltypes)192 this.set_message_coltypes(this.env.coltypes);193 191 194 192 // enable mail commands … … 1471 1469 } 1472 1470 1473 // global variable 'subject_col' may be not defined yet1474 if (this.env.subject_col == null && this.env.coltypes)1475 {1476 var found;1477 if((found = find_in_array('subject', this.env.coltypes)) >= 0)1478 this.set_env('subject_col', found);1479 }1480 1481 1471 // set eventhandler to message icon 1482 1472 if (this.env.subject_col != null … … 1487 1477 row.icon._row = row.obj; 1488 1478 row.icon.onmousedown = function(e) { p.command('toggle_status', this); }; 1489 }1490 1491 // global variable 'flagged_col' may be not defined yet1492 if (this.env.flagged_col == null && this.env.coltypes)1493 {1494 var found;1495 if((found = find_in_array('flag', this.env.coltypes)) >= 0)1496 this.set_env('flagged_col', found);1497 1479 } 1498 1480 … … 1597 1579 1598 1580 // add each submitted col 1599 for (var n = 0; n < this. coltypes.length; n++) {1600 var c = this. coltypes[n];1581 for (var n = 0; n < this.env.coltypes.length; n++) { 1582 var c = this.env.coltypes[n]; 1601 1583 col = document.createElement('td'); 1602 1584 col.className = String(c).toLowerCase(); … … 1652 1634 this.set_list_options = function(cols, sort_col, sort_order, threads) 1653 1635 { 1654 var update, add_url ;1636 var update, add_url = ''; 1655 1637 1656 1638 if (this.env.sort_col != sort_col || this.env.sort_order != sort_order) { … … 1661 1643 if (this.env.threading != threads) { 1662 1644 update = 1; 1663 add_url = '&_threads=' + threads; 1645 add_url += '&_threads=' + threads; 1646 } 1647 1648 if (cols.join() != this.env.coltypes.join()) { 1649 update = 1; 1650 add_url += '&_cols=' + cols.join(','); 1664 1651 } 1665 1652 … … 4084 4071 }; 4085 4072 4086 // for reordering column array, Konqueror workaround 4087 this.set_message_coltypes = function(coltypes) 4073 // for reordering column array (Konqueror workaround) 4074 // and for setting some message list global variables 4075 this.set_message_coltypes = function(coltypes, replace) 4088 4076 { 4089 this. coltypes = coltypes;4077 this.env.coltypes = coltypes; 4090 4078 4091 4079 // set correct list titles 4092 var cell, col ;4080 var cell, col, found, n; 4093 4081 var thead = this.gui_objects.messagelist ? this.gui_objects.messagelist.tHead : null; 4094 for (var n=0; thead && n<this.coltypes.length; n++) 4095 { 4096 col = this.coltypes[n]; 4082 4083 // replace old column headers 4084 if (thead && replace) 4085 this.gui_objects.messagelist.tHead.innerHTML = replace; 4086 4087 for (n=0; thead && n<this.env.coltypes.length; n++) 4088 { 4089 col = this.env.coltypes[n]; 4097 4090 if ((cell = thead.rows[0].cells[n]) && (col=='from' || col=='to')) 4098 4091 { … … 4100 4093 if (cell.firstChild && cell.firstChild.tagName.toLowerCase()=='a') 4101 4094 { 4102 cell.firstChild.innerHTML = this.get_label(this. coltypes[n]);4095 cell.firstChild.innerHTML = this.get_label(this.env.coltypes[n]); 4103 4096 cell.firstChild.onclick = function(){ return rcmail.command('sort', this.__col, this); }; 4104 4097 cell.firstChild.__col = col; 4105 4098 } 4106 4099 else 4107 cell.innerHTML = this.get_label(this. coltypes[n]);4100 cell.innerHTML = this.get_label(this.env.coltypes[n]); 4108 4101 4109 4102 cell.id = 'rcm'+col; 4110 4103 } 4111 else if (col == 'subject' && this.message_list) 4112 this.message_list.subject_col = n; 4113 } 4104 } 4105 4106 // remove excessive columns 4107 for (var i=n; thead && n<thead.rows[0].cells.length; i++) 4108 thead.rows[0].removeChild(thead.rows[0].cells[i]); 4109 4110 this.env.subject_col = null; 4111 this.env.flagged_col = null; 4112 4113 if((found = find_in_array('subject', this.env.coltypes)) >= 0) { 4114 this.set_env('subject_col', found); 4115 if (this.message_list) 4116 this.message_list.subject_col = found; 4117 } 4118 if((found = find_in_array('flag', this.env.coltypes)) >= 0) 4119 this.set_env('flagged_col', found); 4114 4120 }; 4115 4121 -
branches/devel-threads/program/steps/mail/func.inc
r3123 r3124 132 132 $skin_path = $CONFIG['skin_path']; 133 133 $image_tag = '<img src="%s%s" alt="%s" />'; 134 // check to see if we have some settings for sorting135 $sort_col = $_SESSION['sort_col'];136 $sort_order = $_SESSION['sort_order'];137 134 138 135 // add some labels to client … … 157 154 $a_show_cols = preg_split('/[\s,;]+/', strip_quotes($attrib['columns'])); 158 155 159 // s tore column list in a session-variable156 // save some variables for use in ajax list 160 157 $_SESSION['list_columns'] = $a_show_cols; 161 162 // define sortable columns 163 $a_sort_cols = array('subject', 'date', 'from', 'to', 'size', 'cc'); 164 158 $_SESSION['list_attrib'] = $attrib; 159 $_SESSION['skin_path'] = $skin_path; 160 165 161 $mbox = $IMAP->get_mailbox_name(); 166 162 $delim = $IMAP->get_hierarchy_delimiter(); … … 170 166 && ($f = array_search('from', $a_show_cols)) && !array_search('to', $a_show_cols)) 171 167 $a_show_cols[$f] = 'to'; 172 173 // add col definition 174 $out .= '<colgroup>'; 175 176 foreach ($a_show_cols as $col) 177 $out .= ($col!='attachment') ? sprintf('<col class="%s" />', $col) : '<col class="icon" />'; 178 179 $out .= "</colgroup>\n"; 180 181 // add table title 182 $out .= "<thead><tr>\n"; 183 184 $javascript = ''; 185 foreach ($a_show_cols as $col) 186 { 187 // get column name 188 switch ($col) 189 { 190 case 'flag': 191 $col_name = sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], ''); 192 break; 193 case 'attachment': 194 $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], ''); 195 break; 196 default: 197 $col_name = Q(rcube_label($col)); 198 } 199 200 // make sort links 201 $sort = ''; 202 if (in_array($col, $a_sort_cols)) 203 { 204 // have buttons configured 205 if (!empty($attrib['sortdescbutton']) || !empty($attrib['sortascbutton'])) 206 { 207 $sort = ' '; 208 209 // asc link 210 if (!empty($attrib['sortascbutton'])) 211 { 212 $sort .= $OUTPUT->button(array( 213 'command' => 'sort', 214 'prop' => $col.'_ASC', 215 'image' => $attrib['sortascbutton'], 216 'align' => 'absmiddle', 217 'title' => 'sortasc')); 218 } 219 220 // desc link 221 if (!empty($attrib['sortdescbutton'])) 222 { 223 $sort .= $OUTPUT->button(array( 224 'command' => 'sort', 225 'prop' => $col.'_DESC', 226 'image' => $attrib['sortdescbutton'], 227 'align' => 'absmiddle', 228 'title' => 'sortdesc')); 229 } 230 } 231 // just add a link tag to the header 232 else 233 { 234 $col_name = sprintf( 235 '<a href="./#sort" onclick="return %s.command(\'sort\',\'%s\',this)" title="%s">%s</a>', 236 JS_OBJECT_NAME, 237 $col, 238 rcube_label('sortby'), 239 $col_name); 240 } 241 } 242 243 $sort_class = $col==$sort_col ? " sorted$sort_order" : ''; 244 245 // put it all together 246 if ($col != 'attachment') { 247 // list options menu link 248 if ($col == 'subject' && !empty($attrib['optionsmenuicon'])) { 249 $list_menu = $OUTPUT->button(array( 250 'name' => 'listmenulink', 251 'id' => 'listmenulink', 252 // 'command' => '', 253 // 'prop' => '', 254 'image' => $attrib['optionsmenuicon'], 255 'align' => 'absmiddle', 256 'style' => 'float: left; padding-right: 5px', 257 'title' => 'listoptions')); 258 } else 259 $list_menu = ''; 260 261 $out .= '<td class="'.$col.$sort_class.'" id="rcm'.$col.'">' . "$list_menu$col_name$sort</td>\n"; 262 } 263 else 264 $out .= '<td class="icon" id="rcm'.$col.'">' . "$col_name$sort</td>\n"; 265 } 266 267 $out .= "</tr></thead>\n<tbody>\n"; 168 169 $out .= '<thead>'.rcmail_message_list_head($attrib, $a_show_cols).'</thead>'; 170 $out .= "\n<tbody>\n"; 268 171 269 172 // no messages in this mailbox … … 406 309 $OUTPUT->set_env('current_page', $IMAP->list_page); 407 310 $OUTPUT->set_env('pagecount', ceil($message_count/$IMAP->page_size)); 408 $OUTPUT->set_env('sort_col', $ sort_col);409 $OUTPUT->set_env('sort_order', $ sort_order);311 $OUTPUT->set_env('sort_col', $_SESSION['sort_col']); 312 $OUTPUT->set_env('sort_order', $_SESSION['sort_order']); 410 313 411 314 if ($attrib['messageicon']) … … 443 346 * or to replace the whole list (IE only) 444 347 */ 445 function rcmail_js_message_list($a_headers, $insert_top=FALSE, $replace=TRUE )348 function rcmail_js_message_list($a_headers, $insert_top=FALSE, $replace=TRUE, $head_replace=FALSE) 446 349 { 447 350 global $CONFIG, $IMAP, $OUTPUT; … … 461 364 462 365 $browser = new rcube_browser; 463 464 $OUTPUT->command('set_message_coltypes', $a_show_cols); 366 367 $thead = $head_replace ? rcmail_message_list_head($_SESSION['list_attrib'], $a_show_cols) : NULL; 368 369 $OUTPUT->command('set_message_coltypes', $a_show_cols, $thead); 465 370 466 371 // remove 'attachment' and 'flag' columns, we don't need them here … … 548 453 549 454 455 /* 456 * Creates <THEAD> for message list table 457 */ 458 function rcmail_message_list_head($attrib, $a_show_cols) 459 { 460 global $CONFIG; 461 462 $skin_path = $_SESSION['skin_path']; 463 $image_tag = '<img src="%s%s" alt="%s" />'; 464 465 // check to see if we have some settings for sorting 466 $sort_col = $_SESSION['sort_col']; 467 $sort_order = $_SESSION['sort_order']; 468 469 // define sortable columns 470 $a_sort_cols = array('subject', 'date', 'from', 'to', 'size', 'cc'); 471 472 $out = '<tr>'; 473 474 foreach ($a_show_cols as $col) 475 { 476 // get column name 477 switch ($col) 478 { 479 case 'flag': 480 $col_name = sprintf($image_tag, $skin_path, $attrib['unflaggedicon'], ''); 481 break; 482 case 'attachment': 483 $col_name = sprintf($image_tag, $skin_path, $attrib['attachmenticon'], ''); 484 break; 485 default: 486 $col_name = Q(rcube_label($col)); 487 } 488 489 // make sort links 490 $sort = ''; 491 if (in_array($col, $a_sort_cols)) 492 { 493 $col_name = sprintf( 494 '<a href="./#sort" onclick="return %s.command(\'sort\',\'%s\',this)" title="%s">%s</a>', 495 JS_OBJECT_NAME, 496 $col, 497 rcube_label('sortby'), 498 $col_name); 499 } 500 501 $sort_class = $col==$sort_col ? " sorted$sort_order" : ''; 502 503 // put it all together 504 if ($col != 'attachment') { 505 // list options menu link 506 if ($col == 'subject' && !empty($attrib['optionsmenuicon'])) { 507 $list_menu = sprintf('<a href="#"><img src="%s%s" id="%s" align="absmiddle" style="%s" title="%s" alt="" /></a>', 508 $skin_path, 509 $attrib['optionsmenuicon'], 510 'listmenulink', 511 'float: left; padding-right: 5px', 512 rcube_label('listoptions') 513 ); 514 } else 515 $list_menu = ''; 516 517 $out .= '<td class="'.$col.$sort_class.'" id="rcm'.$col.'">' . "$list_menu$col_name$sort</td>\n"; 518 } 519 else 520 $out .= '<td class="icon" id="rcm'.$col.'">' . "$col_name$sort</td>\n"; 521 } 522 523 $out .= '</tr>'; 524 525 return $out; 526 } 527 528 550 529 /** 551 530 * return an HTML iframe for loading mail content -
branches/devel-threads/program/steps/mail/list.inc
r3120 r3124 34 34 $_SESSION['sort_col'] = $save_arr['message_sort_col'] = $sort_col; 35 35 $_SESSION['sort_order'] = $save_arr['message_sort_order'] = $sort_order; 36 37 $RCMAIL->user->save_prefs($save_arr);38 36 } 39 37 else … … 43 41 $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order']; 44 42 } 43 44 // is there a set of columns for this request? 45 if ($cols = get_input_value('_cols', RCUBE_INPUT_GET)) 46 { 47 $save_arr = array(); 48 $_SESSION['list_columns'] = $save_arr['list_cols'] = explode(',', $cols); 49 } 50 51 if ($save_arr) 52 $RCMAIL->user->save_prefs($save_arr); 45 53 46 54 $mbox_name = $IMAP->get_mailbox_name(); … … 73 81 if (isset($a_headers) && count($a_headers)) 74 82 { 75 rcmail_js_message_list($a_headers );83 rcmail_js_message_list($a_headers, FALSE, TRUE, (bool) $cols); 76 84 if ($search_request) 77 85 $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $count)); -
branches/devel-threads/skins/default/functions.js
r3112 r3124 126 126 this.messagemenu = $('#messagemenu'); 127 127 this.listmenu = $('#listmenu'); 128 this.add_listmenulink(); 129 } 130 131 rcube_mail_ui.prototype = { 132 133 add_listmenulink: function() 134 { 128 135 var ref = rcube_find_object('listmenulink'); 129 130 136 if (ref) 131 137 ref.onclick = function () { rcmail_ui.show_listmenu() }; 132 } 133 134 rcube_mail_ui.prototype = { 138 }, 135 139 136 140 show_markmenu: function(show) … … 204 208 $('input[name="view"][value="thread"]').attr('checked', rcmail.env.threading ? 1 : 0); 205 209 $('input[name="view"][value="list"]').attr('checked', rcmail.env.threading ? 0 : 1); 210 // list columns 211 var cols = $('input[name="list_col[]"]'); 212 for (var i=0; i<cols.length; i++) { 213 var found = 0; 214 if (cols[i].value != 'from') 215 found = jQuery.inArray(cols[i].value, rcmail.env.coltypes) != -1; 216 else 217 found = (jQuery.inArray('from', rcmail.env.coltypes) != -1 218 || jQuery.inArray('to', rcmail.env.coltypes) != -1); 219 $(cols[i]).attr('checked',found ? 1 : 0); 220 } 206 221 } 207 222 this.listmenu[show?'show':'hide'](); … … 216 231 var thread = $('input[name="view"]:checked').val(); 217 232 var cols = $('input[name="list_col[]"]:checked') 218 .map(function(){ return $(this).val(); }).get();233 .map(function(){ return this.value; }).get(); 219 234 220 235 rcmail.set_list_options(cols, sort, ord, thread == 'thread' ? 1 : 0); … … 272 287 rcube_event.add_listener({ object:rcmail_ui, method:'body_mouseup', event:'mouseup' }); 273 288 rcube_event.add_listener({ object:rcmail_ui, method:'body_keypress', event:'keypress' }); 274 } 289 rcube_event.add_listener({ object:rcmail_ui, method:'add_listmenulink', event:'listupdate' }); 290 }
Note: See TracChangeset
for help on using the changeset viewer.
