From 078adf9da77f7ca6a3c02f9ef71be687aedb8856 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 19 Jul 2006 15:36:35 -0400
Subject: [PATCH] Improved usability (Ticket #1483807) and HTML validity; applied patch #1328032; fixed bug #1443200

---
 CHANGELOG                            |    7 +++
 program/include/main.inc             |    9 +++-
 program/steps/mail/show.inc          |    4 +-
 program/lib/imap.inc                 |    2 
 skins/default/templates/compose.html |   47 ++++++++++++++---------
 program/include/rcube_imap.inc       |   30 +++------------
 6 files changed, 52 insertions(+), 47 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 6ead1dc..5cb0901 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,13 @@
 CHANGELOG RoundCube Webmail
 ---------------------------
 
+2006/07/19 (thomasb)
+----------
+- Correct entity encoding of link urls (HTML validity)
+- Moved back button in compose step (Ticket #)
+- Added absolute URLs to several buttons (for "open in new window")
+
+
 2006/07/18 (thomasb)
 ----------
 - Fixed password with spaces issue (Bug #1364122)
diff --git a/program/include/main.inc b/program/include/main.inc
index ef2ecbf..e77df19 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1274,6 +1274,9 @@
   static $sa_buttons = array();
   static $s_button_count = 100;
   
+  // these commands can be called directly via url
+  $a_static_commands = array('compose', 'list');
+  
   $skin_path = $CONFIG['skin_path'];
   
   if (!($attrib['command'] || $attrib['name']))
@@ -1352,9 +1355,11 @@
                                 $attrib['imagesel'] ? $skin_path.$attrib['imagesel'] : $attrib['classsel'],
                                 $attrib['imageover'] ? $skin_path.$attrib['imageover'] : ''));
 
-    // make valid href to task buttons
+    // make valid href to specific buttons
     if (in_array($attrib['command'], $MAIN_TASKS))
-      $attrib['href'] = ereg_replace('_task=[a-z]+', '_task='.$attrib['command'], $COMM_PATH);
+      $attrib['href'] = htmlentities(ereg_replace('_task=[a-z]+', '_task='.$attrib['command'], $COMM_PATH));
+    else if (in_array($attrib['command'], $a_static_commands))
+      $attrib['href'] = htmlentities($COMM_PATH.'&_action='.$attrib['command']);
     }
 
   // overwrite attributes
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc
index bc12eac..177d05a 100644
--- a/program/include/rcube_imap.inc
+++ b/program/include/rcube_imap.inc
@@ -501,29 +501,11 @@
     $start_msg = ($this->list_page-1) * $this->page_size;
     
     list($begin, $end) = $this->_get_message_range($max, $page);
-    
-    /*    
-    if ($page=='all')
-      {
-      $begin = 0;
-      $end = $max;
-      }
-    else if (!$this->get_capability('sort') && $this->sort_order=='DESC')
-      {
-      $begin = $max - $this->page_size - $start_msg;
-      $end =   $max - $start_msg;
-      }
-    else
-      {
-      $begin = $start_msg;
-      $end   = $start_msg + $this->page_size;
-      }
-
-    if ($begin < 0) $begin = 0;
-    if ($end < 0) $end = $max;
-    if ($end > $max) $end = $max;
-	*/
-	
+  
+  	// mailbox is empty
+    if ($begin >= $end)
+      return array();
+    	
 //console("fetch headers $start_msg to ".($start_msg+$this->page_size)." (msg $begin to $end)");
 
     $headers_sorted = FALSE;
@@ -553,7 +535,7 @@
         }
       else
         {
-        $msgs = sprintf("%d:%d", $begin+1, $end);
+        $msgs = sprintf("%d:%d", $begin+1, $end);        
         $sorted = FALSE;
         }
 
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index b8f3dea..70abdc4 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -1755,7 +1755,7 @@
 		$line=iil_ReadLine($fp, 500);
 		$line=iil_MultLine($fp, $line);
 		$a = explode(" ", $line);
-		if (($line[0]=="*") && ($a[1]=="LSUB")){
+		if (($line[0]=="*") && ($a[1]=="LSUB" || $a[1]=="LIST")){
 			$line = rtrim($line);
             // split one line
 			$a=iil_ExplodeQuotedString(" ", $line);
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index 27fc44b..26a3d33 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -109,8 +109,8 @@
                         $attach_prop['filename'],
                         show_bytes($attach_prop['size']));
       else
-        $out .= sprintf('<li><a href="%s&_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n",
-                        $GET_URL,
+        $out .= sprintf('<li><a href="%s&amp;_part=%s" onclick="return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)">%s</a></li>'."\n",
+                        htmlentities($GET_URL),
                         $attach_prop['part_id'],
                         $JS_OBJECT_NAME,
                         $attach_prop['part_id'],
diff --git a/skins/default/templates/compose.html b/skins/default/templates/compose.html
index e5db5a5..a65dcb7 100644
--- a/skins/default/templates/compose.html
+++ b/skins/default/templates/compose.html
@@ -38,9 +38,8 @@
 <form name="form" action="./" method="post">
 
 <div id="messagetoolbar">
-<roundcube:button command="list" image="/images/buttons/back_act.png" imageSel="/images/buttons/back_sel.png" imageAct="/images/buttons/back_act.png" width="32" height="32" title="backtolist" />
+<!--<roundcube:button command="list" image="/images/buttons/back_act.png" imageSel="/images/buttons/back_sel.png" imageAct="/images/buttons/back_act.png" width="32" height="32" title="backtolist" />-->
 <roundcube:button command="send" imageSel="/images/buttons/send_sel.png" imageAct="/images/buttons/send_act.png" imagePas="/images/buttons/send_pas.png" width="32" height="32" title="sendmessage" />
-<!--<roundcube:button command="contacts" imageSel="/images/buttons/contacts_sel.png" imageAct="/images/buttons/contacts_act.png" imagePas="/images/buttons/contacts_pas.png" width="32" height="32" title="addressbook" />-->
 <roundcube:button command="spellcheck" imageSel="/images/buttons/spellcheck_sel.png" imageAct="/images/buttons/spellcheck_act.png" imagePas="/images/buttons/spellcheck_pas.png" width="32" height="32" title="checkspelling" />
 <roundcube:button command="add-attachment" imageSel="/images/buttons/attach_sel.png" imageAct="/images/buttons/attach_act.png" imagePas="/images/buttons/attach_pas.png" width="32" height="32" title="addattachment" />
 <roundcube:button command="savedraft" imageSel="/images/buttons/drafts_sel.png" imageAct="/images/buttons/drafts_act.png" imagePas="/images/buttons/drafts_pas.png" width="32" height="32" title="savemessage" />
@@ -56,10 +55,13 @@
 </div>
 
 <div id="compose-container">
-<table border="0" cellspacing="0" cellpadding="1" style="width:100%; height:100%;" summary=""><tr>
+<table border="0" cellspacing="0" cellpadding="1" style="width:100%; height:99%;" summary="">
+<tbody>
+<tr>
 <td>
 
-<table border="0" cellspacing="0" cellpadding="1" id="compose-headers" summary=""><tr>
+<table border="0" cellspacing="0" cellpadding="1" id="compose-headers" summary="">
+<tbody><tr>
 
 <td class="title"><label for="rcmcomposefrom"><roundcube:label name="from" /></label></td>
 <td><roundcube:object name="composeHeaders" part="from" form="form" id="rcmcomposefrom" tabindex="1" /></td>
@@ -86,27 +88,43 @@
 <td class="title top"><label for="rcmcomposereplyto"><roundcube:label name="replyto" /></label></td>
 <td><roundcube:object name="composeHeaders" part="replyto" form="form" id="rcmcomposereplyto" size="80" tabindex="5" /></td>
 
-<!-- </tr><tr>
-
-<td><roundcube:object name="composeAttachment" size="20" /></td> -->
-
 </tr><tr>
 
 <td class="title"><label for="compose-subject"><roundcube:label name="subject" /></label></td>
 <td><roundcube:object name="composeSubject" id="compose-subject" form="form" tabindex="6" /></td>
 
-</tr></table>
+</tr>
+</tbody>
+</table>
 
 </td>
 
 </tr><tr>
 
 <td style="width:100%; height:95%; vertical-align:top;">
-<roundcube:object name="composeBody" id="compose-body" form="form" cols="80" rows="20" wrap="virtual" tabindex="7" /><br />
+<roundcube:object name="composeBody" id="compose-body" form="form" cols="80" rows="20" wrap="virtual" tabindex="7" />
+</td>
+
+</tr><tr>
+
+<td>
+
+<table border="0" cellspacing="0" width="100%" summary=""><tbody><tr>
+
+<td>
+<roundcube:button type="input" command="send" class="button" label="sendmessage" />
+<roundcube:button type="input" command="list" class="button" label="cancel" />
+</td>
+<td align="right">
 <roundcube:label name="charset" />:&nbsp;<roundcube:object name="charsetSelector" tabindex="8" />
 </td>
 
-</tr></table>
+</tr></tbody></table>
+
+</td>
+</tr>
+</tbody>
+</table>
 
 </div>
 
@@ -130,13 +148,6 @@
 //-->
 </script>
 
-<!--
-<div id="attachment-form">
-<roundcube:object name="composeAttachment" size="20" /><br />
-<input type="button" value="<roundcube:label name='close' />" onclick="rcmail_show_attachment_form(0)" />
-<input type="button" value="<roundcube:label name='send' />" onclick="rcmail.command('send-attachment', this)" />
-</div>
--->
 
 </body>
 </html>

--
Gitblit v1.9.1