Opened 7 years ago

Closed 6 years ago

Last modified 5 years ago

#1484008 closed Feature Patches (fixed)

Preview pane

Reported by: wobin Owned by: wobin
Priority: 5 Milestone: 0.2-beta
Component: User Interface Version: 0.1-beta
Severity: normal Keywords:
Cc:

Description

Here's my patch to add support for a preview pane in the main window. The preview pane is user-configurable, and is disabled by default.

If the patch is not readable or properly cut&pasteable it can be fetched from http://eddy.introweb.nl/~robin/software/roundcube/20060908-r340-preview.patch.

Index: program/include/main.inc
===================================================================
--- program/include/main.inc	(revision 340)
+++ program/include/main.inc	(working copy)
@@ -1199,6 +1199,7 @@
         'charsetselector' => 'rcmail_charset_selector',
         'searchform' => 'rcmail_search_form',
         'receiptcheckbox' => 'rcmail_receipt_checkbox',
+        'preview' => 'rcmail_message_preview',
         
         // ADDRESS BOOK
         'addresslist' => 'rcmail_contacts_list',
Index: program/localization/nl_NL/labels.inc
===================================================================
--- program/localization/nl_NL/labels.inc	(revision 340)
+++ program/localization/nl_NL/labels.inc	(working copy)
@@ -202,6 +202,7 @@
 $labels['pagesize']  = 'Rijen per pagina';
 $labels['signature'] = 'Onderschrift';
 $labels['dstactive']  = 'Zomertijd';
+$labels['preview'] = 'Voorbeeldvenster';
 
 $labels['folder']  = 'Map';
 $labels['folders']  = 'Mappen';
Index: program/localization/en_US/labels.inc
===================================================================
--- program/localization/en_US/labels.inc	(revision 340)
+++ program/localization/en_US/labels.inc	(working copy)
@@ -201,6 +201,7 @@
 $labels['pagesize']  = 'Rows per page';
 $labels['signature'] = 'Signature';
 $labels['dstactive']  = 'Daylight savings';
+$labels['preview'] = 'Preview message';
 
 $labels['autosavedraft']  = 'Automatically save draft';
 $labels['everynminutes']  = 'every $n minutes';
Index: program/js/app.js
===================================================================
--- program/js/app.js	(revision 340)
+++ program/js/app.js	(working copy)
@@ -126,7 +126,7 @@
           }
 
         // enable mail commands
-        this.enable_command('list', 'checkmail', 'compose', 'add-contact', 'search', 'reset-search', true);
+        this.enable_command('list', 'checkmail', 'compose', 'add-contact', 'search', 'reset-search', 'load-attachment', true);
         
         if (this.env.action=='show')
           {
@@ -761,6 +761,7 @@
           var input_pagesize = rcube_find_object('_pagesize');
           var input_name  = rcube_find_object('_name');
           var input_email = rcube_find_object('_email');
+          var input_preview = rcube_find_object('_preview');
 
           // user prefs
           if (input_pagesize && isNaN(input_pagesize.value))
@@ -1445,6 +1446,8 @@
 
     this.last_selected = id;
     this.set_classname(this.list_rows[id].obj, 'focused', true);        
+    if (this.env.preview)
+      this.show_preview(id);
   };
 
   this.shift_select = function(id, control) {
@@ -1509,6 +1512,31 @@
 
     return true;  
     };
+
+
+  // when user clicks on a row
+  this.show_preview = function(id, safe)
+    {
+    var add_url = '';
+    var target = window;
+    var contentframe = rcube_find_object('mailcontframe');
+    var previewpane = rcube_find_object('previewpane');
+
+    if (id && contentframe && previewpane)
+      {
+      rcmail.set_busy(true, 'loading');
+      if (previewpane.style.display=='none')
+        {
+        contentframe.style.height = (contentframe.offsetHeight/2) + 'px';
+        previewpane.style.top = (contentframe.offsetTop+contentframe.offsetHeight) + 'px';
+        previewpane.style.display = 'block';
+        var message = rcube_find_object('rcmrow' + id);
+        message.scrollIntoView();
+        }
+      var url = '_action=preview&_uid='+id;
+      rcmail.http_request('preview', url, true);
+      }
+    };
     
 
   // when user doble-clicks on a row
@@ -3583,6 +3611,12 @@
       case 'expunge':
         this.enable_command('select-all', 'select-none', 'expunge', this.env.messagecount ? true : false);
         break;
+
+      case 'preview':
+        var previewpane = rcube_find_object('previewpane');
+        previewpane.innerHTML = request_obj.get_text();
+        previewpane.scrollTop = 0;
+        break;
       }
 
     request_obj.reset();
Index: program/steps/settings/func.inc
===================================================================
--- program/steps/settings/func.inc	(revision 340)
+++ program/steps/settings/func.inc	(working copy)
@@ -235,4 +235,4 @@
   }
 
 
-?>
\ No newline at end of file
+?>
Index: program/steps/settings/save_prefs.inc
===================================================================
--- program/steps/settings/save_prefs.inc	(revision 340)
+++ program/steps/settings/save_prefs.inc	(working copy)
@@ -49,4 +49,4 @@
 // overwrite action variable  
 $OUTPUT->add_script(sprintf("\n%s.set_env('action', '%s');", $JS_OBJECT_NAME, $_action));  
 
-?>
\ No newline at end of file
+?>
Index: program/steps/mail/get.inc
===================================================================
--- program/steps/mail/get.inc	(revision 340)
+++ program/steps/mail/get.inc	(working copy)
@@ -142,4 +142,4 @@
 header('HTTP/1.1 404 Not Found');
 exit;
 
-?>
\ No newline at end of file
+?>
Index: program/steps/mail/show.inc
===================================================================
--- program/steps/mail/show.inc	(revision 340)
+++ program/steps/mail/show.inc	(working copy)
@@ -171,6 +171,8 @@
 
 if ($_action=='print')
   parse_template('printmessage');
+else if ($_action=='preview')
+  parse_template('previewmessage');
 else
   parse_template('message');
-?>
\ No newline at end of file
+?>
Index: program/steps/mail/func.inc
===================================================================
--- program/steps/mail/func.inc	(revision 340)
+++ program/steps/mail/func.inc	(working copy)
@@ -480,6 +480,7 @@
   $javascript .= sprintf("%s.set_env('pagecount', %d);\n", $JS_OBJECT_NAME, ceil($message_count/$IMAP->page_size));
   $javascript .= sprintf("%s.set_env('sort_col', '%s');\n", $JS_OBJECT_NAME, $sort_col);
   $javascript .= sprintf("%s.set_env('sort_order', '%s');\n", $JS_OBJECT_NAME, $sort_order);
+  $javascript .= sprintf("%s.set_env('preview', '%s');\n", $JS_OBJECT_NAME, $CONFIG['preview']);
   
   if ($attrib['messageicon'])
     $javascript .= sprintf("%s.set_env('messageicon', '%s%s');\n", $JS_OBJECT_NAME, $skin_path, $attrib['messageicon']);
Index: skins/default/mail.css
===================================================================
--- skins/default/mail.css	(revision 340)
+++ skins/default/mail.css	(working copy)
@@ -120,7 +120,30 @@
   height: expression((parseInt(document.documentElement.clientHeight)-125)+'px');
 }
 
+#previewpane
+{
+  position: absolute;
+  display: none;
+  top: 85px;
+  left: 200px;
+  right: 40px;
+  bottom: 40px;
+  border: 1px solid #999999;
+  border-top: none;
+  background-color: #F9F9F9;
+  overflow: auto;
+  /* css hack for IE */
+  width: expression((parseInt(document.documentElement.clientWidth)-240)+'px');
+  height: expression((
+    parseInt(document.documentElement.clientHeight) -
+    parseInt(document.getElementById('mailcontframe').clientHeight) - 125)+'px');
+}
 
+body > div#previewpane
+{
+  height: auto;
+}
+
 #messagepartframe
 {
   border: 1px solid #999999;
Index: skins/default/templates/mail.html
===================================================================
--- skins/default/templates/mail.html	(revision 340)
+++ skins/default/templates/mail.html	(working copy)
@@ -52,6 +52,8 @@
   attachmentIcon="/images/icons/attachment.png" />
 </div>
 
+<div id="previewpane" style="display: none;"></div>
+
 <div id="listcontrols">
 <roundcube:label name="select" />:&nbsp;
 <roundcube:button command="select-all" label="all" classAct="active" />&nbsp;
Index: index.php
===================================================================
--- index.php	(revision 340)
+++ index.php	(working copy)
@@ -247,7 +247,7 @@
   {
   include_once('program/steps/mail/func.inc');
   
-  if ($_action=='show' || $_action=='print')
+  if ($_action=='show' || $_action=='print' || $_action=='preview')
     include('program/steps/mail/show.inc');
 
   if ($_action=='get')

Attachments (1)

roundcube-preview-svn361.patch (10.2 KB) - added by wobin 7 years ago.
Updated the patch to work with RoundCube SVN #361

Download all attachments as: .zip

Change History (4)

comment:1 Changed 7 years ago by wobin

  • Owner set to wobin
  • Status changed from new to assigned

Changed 7 years ago by wobin

Updated the patch to work with RoundCube SVN #361

comment:2 Changed 6 years ago by robin

  • Resolution set to fixed
  • Status changed from assigned to closed

Preview pane was implemented in SVN388.

comment:3 Changed 6 years ago by jpingle

  • Milestone set to 0.2-beta
Note: See TracTickets for help on using tickets.