changeset 20:c3a974bdb435

a bit further on flag+parm
author Charlie Root
date Tue, 16 Jan 2018 13:09:08 -0500
parents 49706603be30
children 678dcc5152a8
files plugins/thunderbird_labels/tb_label.js plugins/thunderbird_labels/thunderbird_labels.php skins/larry/mail.css skins/larry/templates/mail.html
diffstat 4 files changed, 37 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/thunderbird_labels/tb_label.js	Mon Jan 15 10:29:29 2018 -0500
+++ b/plugins/thunderbird_labels/tb_label.js	Tue Jan 16 13:09:08 2018 -0500
@@ -47,16 +47,26 @@
   	  message.flags.tb_labels.sort(function(a,b) {return a-b;});
   	  if (rcmail.env.tb_label_style=='bullets') {
   	    // bullets UI style
-        for (idx in message.flags.tb_labels) {
-          spanobj.append("<span class='label"+message.flags.tb_labels[idx]+"'>&#8226;</span>");
-        }
-      } else {
-        // thunderbird UI style
-        for (idx in message.flags.tb_labels) {
-          rowobj.addClass('label' + message.flags.tb_labels[idx]);
-        }
-      }
-		}
+	    for (idx in message.flags.tb_labels) {
+	      spanobj.append("<span class='label"+message.flags.tb_labels[idx]+"'>&#8226;</span>");
+	    }
+	  } else {
+	    // thunderbird UI style
+	    for (idx in message.flags.tb_labels) {
+	      rowobj.addClass('label' + message.flags.tb_labels[idx]);
+	    }
+	  }
+	  }
+	}
+	if (message.flags && message.flags.tb_lparms) {
+	  if (message.flags.tb_lparms.length) {
+	    for (parm in message.flags.tb_lparms) {
+	      col="dates"; // should look up parm.number somewhere FIXME
+	      var tdobj = rowobj.find("td."+col);
+	      tdobj.append("<span class='labelparm"+parm.number+"'>"+
+			     parm.parm+"</span>");
+	    }
+	  }
 	}
 }
 
@@ -85,6 +95,7 @@
 {
 	var headers_table = $('table.headers-table');
 	var preview_frame = $('#messagecontframe');
+	var label_name = rcmail.env.tb_label_custom_labels[toggle_label_no];
 	// preview frame exists, simulate environment of single message view
 	if (preview_frame.length)
 	{
@@ -100,7 +111,7 @@
 		if (onoff == true) {
 		  if (rcmail.env.tb_label_style=='bullets') {
 		    $('#labelbox').append("<span class='tb_label_span"+toggle_label_no+"'>" +
-			    rcmail.env.tb_label_custom_labels[toggle_label_no] + "</span>");
+			    label_name + "</span>");
 		  } else {
 		    headers_table.addClass('label'+toggle_label_no);
 		  }
--- a/plugins/thunderbird_labels/thunderbird_labels.php	Mon Jan 15 10:29:29 2018 -0500
+++ b/plugins/thunderbird_labels/thunderbird_labels.php	Tue Jan 16 13:09:08 2018 -0500
@@ -330,7 +330,7 @@
 		{
 			#rcube::write_log($this->name, print_r($message->flags, true));
 			$message->list_flags['extra_flags']['tb_labels'] = array(); # always set extra_flags, needed for javascript later!
-			if (is_array($message->flags))
+			$message->list_flags['extra_flags']['tb_parms'] = array();
 			foreach ($message->flags as $flagname => $flagvalue)
 			{
 				$flag = is_numeric("$flagvalue")? $flagname:$flagvalue;// for compatibility with < 0.5.4
@@ -339,7 +339,15 @@
 				{
 					$flag_no = preg_replace('/^\$?label/', '', $flag);
 					rcube::write_log($this->name, "Flag:".$flag." Flag_no:".$flag_no);
-					$message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no;
+					if ($ppos = strpos($flag_no,'_') > -1) {
+					  // We have a flag parameter value...
+					  $message->list_flags['extra_flags']['tb_lparms'][]=array(
+                                         'number' => substr($flag_no,0,$ppos),
+					 'parm' => substr($flag_no,$ppos+1));
+					}
+					else {
+					  $message->list_flags['extra_flags']['tb_labels'][] = (int)$flag_no;
+					}
 				}
 			}
 		}
--- a/skins/larry/mail.css	Mon Jan 15 10:29:29 2018 -0500
+++ b/skins/larry/mail.css	Tue Jan 16 13:09:08 2018 -0500
@@ -264,9 +264,12 @@
 }
 
 .messagelist tr > .date {
-	width: 155px;
+	width: 100px;
 }
 
+.messagelist tr > .dates {
+	width: 100px;
+}
 .messagelist tr > .folder {
 	width: 135px;
 }
--- a/skins/larry/templates/mail.html	Mon Jan 15 10:29:29 2018 -0500
+++ b/skins/larry/templates/mail.html	Tue Jan 16 13:09:08 2018 -0500
@@ -216,6 +216,7 @@
 		<ul class="proplist">
 			<li><label class="disabled"><input type="checkbox" name="list_col[]" value="threads" checked disabled /> <span><roundcube:label name="threads" /></span></label></li>
 			<li><label class="disabled"><input type="checkbox" name="list_col[]" value="subject" checked disabled /> <span><roundcube:label name="subject" /></span></label></li>
+			<li><label><input type="checkbox" name="list_col[]" value="dates" /> <span><roundcube:label name="Booking Dates" /></span></label></li>
 			<li><label><input type="checkbox" name="list_col[]" value="fromto" /> <span><roundcube:label name="fromto" /></span></label></li>
 			<li><label><input type="checkbox" name="list_col[]" value="from" /> <span><roundcube:label name="from" /></span></label></li>
 			<li><label><input type="checkbox" name="list_col[]" value="to" /> <span><roundcube:label name="to" /></span></label></li>