diff options
author | thomascube <thomas@roundcube.net> | 2007-05-17 18:41:24 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2007-05-17 18:41:24 +0000 |
commit | 41bece1a1adffb524daa2203dfb91211f63989d8 (patch) | |
tree | 7c1846c510c0b66bfe750f0bc87aca0fc48e1601 /program | |
parent | 5870871ae1f8a0f3b40436483a43cf3aafa35b2d (diff) |
Add link to message subjects (#1484257); don't make selected list items bold; remove duplicate function
Diffstat (limited to 'program')
-rw-r--r-- | program/include/main.inc | 30 | ||||
-rw-r--r-- | program/include/rcmail_template.inc | 4 | ||||
-rw-r--r-- | program/js/list.js | 7 | ||||
-rw-r--r-- | program/steps/addressbook/func.inc | 4 | ||||
-rw-r--r-- | program/steps/addressbook/mailto.inc | 2 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 28 |
6 files changed, 37 insertions, 38 deletions
diff --git a/program/include/main.inc b/program/include/main.inc index 71534f6b1..6aa8b91a1 100644 --- a/program/include/main.inc +++ b/program/include/main.inc @@ -753,8 +753,15 @@ function rcmail_overwrite_action($action) } -// compose a URL to the given action -function rcmail_self_url($action, $p=array(), $task=null) +/** + * Compose an URL for a specific action + * + * @param string Request action + * @param array More URL parameters + * @param string Request task (omit if the same) + * @return The application URL + */ +function rcmail_url($action, $p=array(), $task=null) { global $MAIN_TASKS, $COMM_PATH; $qstring = ''; @@ -1123,25 +1130,6 @@ function strip_newlines($str) } -/** - * Compose an URL for a specific action - * - * @param string Request action - * @param array More URL parameters - * @return The application URL - */ -function rcmail_url($action, $param=NULL) -{ - $url = $GLOBALS['COMM_PATH'] . '&'.$action; - - if (is_array($param)) - foreach ($param as $p => $val) - $url .= sprintf('&%s=%s', urlencode($p), urlencode($val)); - - return $url; -} - - // return boolean if a specific template exists function template_exists($name) { diff --git a/program/include/rcmail_template.inc b/program/include/rcmail_template.inc index 6e3fe52b8..3609bec1b 100644 --- a/program/include/rcmail_template.inc +++ b/program/include/rcmail_template.inc @@ -563,9 +563,9 @@ class rcmail_template extends rcube_html_page // make valid href to specific buttons if (in_array($attrib['command'], $MAIN_TASKS)) - $attrib['href'] = Q(rcmail_self_url(null, null, $attrib['command'])); + $attrib['href'] = Q(rcmail_url(null, null, $attrib['command'])); else if (in_array($attrib['command'], $a_static_commands)) - $attrib['href'] = Q(rcmail_self_url($attrib['command'])); + $attrib['href'] = Q(rcmail_url($attrib['command'])); } // overwrite attributes diff --git a/program/js/list.js b/program/js/list.js index 719585893..23a9c349c 100644 --- a/program/js/list.js +++ b/program/js/list.js @@ -584,7 +584,7 @@ drag_mouse_move: function(e) // get subjects of selectedd messages var names = ''; - var c, subject, obj; + var c, node, subject, obj; for(var n=0; n<this.selection.length; n++) { if (n>12) // only show 12 lines @@ -599,10 +599,11 @@ drag_mouse_move: function(e) subject = ''; for(c=0; c<obj.childNodes.length; c++) - if (!subject && obj.childNodes[c].nodeName=='TD' && obj.childNodes[c].firstChild && obj.childNodes[c].firstChild.nodeType==3) + if (obj.childNodes[c].nodeName=='TD' && (node = obj.childNodes[c].firstChild) && (node.nodeType==3 || node.nodeName=='A')) { - subject = obj.childNodes[c].firstChild.data; + subject = node.nodeType==3 ? node.data : node.innerHTML; names += (subject.length > 50 ? subject.substring(0, 50)+'...' : subject) + '<br />'; + break; } } } diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc index 5329270c2..397b0a12d 100644 --- a/program/steps/addressbook/func.inc +++ b/program/steps/addressbook/func.inc @@ -71,7 +71,7 @@ function rcmail_directory_list($attrib) $out .= sprintf($line_templ, 'rcmli'.$local_id, !$current ? 'selected' : '', - Q(rcmail_self_url('list', array('_source' => 0))), + Q(rcmail_url('list', array('_source' => 0))), JS_OBJECT_NAME, $local_id, JS_OBJECT_NAME, @@ -89,7 +89,7 @@ function rcmail_directory_list($attrib) $out .= sprintf($line_templ, 'rcmli'.$dom_id, $current == $id ? 'selected' : '', - Q(rcmail_self_url('list', array('_source' => $id))), + Q(rcmail_url('list', array('_source' => $id))), JS_OBJECT_NAME, $js_id, JS_OBJECT_NAME, diff --git a/program/steps/addressbook/mailto.inc b/program/steps/addressbook/mailto.inc index ddbec30d0..27217e5c8 100644 --- a/program/steps/addressbook/mailto.inc +++ b/program/steps/addressbook/mailto.inc @@ -36,7 +36,7 @@ if (!empty($mailto)) $mailto_str = join(', ', $mailto); $mailto_id = substr(md5($mailto_str), 0, 16); $_SESSION['mailto'][$mailto_id] = $mailto_str; - $OUTPUT->command('redirect', rcmail_self_url('compose', array('_mailto' => $mailto_id), 'mail')); + $OUTPUT->command('redirect', rcmail_url('compose', array('_mailto' => $mailto_id), 'mail')); } else $OUTPUT->show_message('nocontactsfound', 'warning'); diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 1848d301a..991c3c168 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -58,7 +58,7 @@ if (!empty($_GET['_search']) && isset($_SESSION['search'][$_GET['_search']])) // define url for getting message parts if (strlen($_GET['_uid'])) - $GET_URL = sprintf('%s&_action=get&_mbox=%s&_uid=%d', $COMM_PATH, $IMAP->get_mailbox_name(), get_input_value('_uid', RCUBE_INPUT_GET)); + $GET_URL = rcmail_url('get', array('_mbox'=>$IMAP->get_mailbox_name(), '_uid'=>get_input_value('_uid', RCUBE_INPUT_GET))); // set current mailbox in client environment @@ -233,7 +233,7 @@ function rcmail_render_folder_tree_html(&$arrFolders, &$special, &$mbox_name, $m $zebra_class, $unread_count ? ' unread' : '', $folder['id']==$mbox_name ? ' selected' : '', - Q(rcmail_self_url('', array('_mbox' => $folder['id']))), + Q(rcmail_url('', array('_mbox' => $folder['id']))), JS_OBJECT_NAME, $js_name, JS_OBJECT_NAME, @@ -323,9 +323,11 @@ function rcmail_message_list($attrib) // define list of cols to be displayed $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); $a_sort_cols = array('subject', 'date', 'from', 'to', 'size'); + + $mbox = $IMAP->get_mailbox_name(); // show 'to' instead of from in sent messages - if (($IMAP->get_mailbox_name()==$CONFIG['sent_mbox'] || $IMAP->get_mailbox_name()==$CONFIG['drafts_mbox']) && ($f = array_search('from', $a_show_cols)) + if (($mbox==$CONFIG['sent_mbox'] || $mbox==$CONFIG['drafts_mbox']) && ($f = array_search('from', $a_show_cols)) && !array_search('to', $a_show_cols)) $a_show_cols[$f] = 'to'; @@ -382,11 +384,12 @@ function rcmail_message_list($attrib) // just add a link tag to the header else { - $col_name = sprintf('<a href="./#sort" onclick="return %s.command(\'sort\',\'%s\',this)" title="%s">%s</a>', - JS_OBJECT_NAME, - $col, - rcube_label('sortby'), - $col_name); + $col_name = sprintf( + '<a href="./#sort" onclick="return %s.command(\'sort\',\'%s\',this)" title="%s">%s</a>', + JS_OBJECT_NAME, + $col, + rcube_label('sortby'), + $col_name); } } @@ -453,8 +456,11 @@ function rcmail_message_list($attrib) $cont = Q(rcmail_address_string($header->$col, 3, $attrib['addicon']), 'show'); else if ($col=='subject') { + $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; + $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid'; $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset)); if (empty($cont)) $cont = Q(rcube_label('nosubject')); + $cont = sprintf('<a href="%s" onclick="return false">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont); } else if ($col=='size') $cont = show_bytes($header->$col); @@ -513,9 +519,10 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE) global $CONFIG, $IMAP, $OUTPUT; $a_show_cols = is_array($CONFIG['list_cols']) ? $CONFIG['list_cols'] : array('subject'); + $mbox = $IMAP->get_mailbox_name(); // show 'to' instead of from in sent messages - if (($IMAP->get_mailbox_name() == $CONFIG['sent_mbox'] || $IMAP->get_mailbox_name() == $CONFIG['drafts_mbox']) + if (($mbox == $CONFIG['sent_mbox'] || $mbox == $CONFIG['drafts_mbox']) && (($f = array_search('from', $a_show_cols)) !== false) && array_search('to', $a_show_cols) === false) $a_show_cols[$f] = 'to'; @@ -535,8 +542,11 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE) $cont = Q(rcmail_address_string($header->$col, 3), 'show'); else if ($col=='subject') { + $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; + $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid'; $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset)); if (!$cont) $cont = Q(rcube_label('nosubject')); + $cont = sprintf('<a href="%s" onclick="return false">%s</a>', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont); } else if ($col=='size') $cont = show_bytes($header->$col); |