changeset 12:ff1f27bd05ad

partial success in getting back_link to message when making event from mail
author Charlie Root
date Sat, 13 Jan 2018 09:39:32 -0500
parents d57f154e7764
children 40bacaff7f07
files plugins/calendar/calendar_ui.js plugins/calendar/skins/larry/templates/eventedit.html
diffstat 2 files changed, 11 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/calendar/calendar_ui.js	Sat Jan 13 09:38:33 2018 -0500
+++ b/plugins/calendar/calendar_ui.js	Sat Jan 13 09:39:32 2018 -0500
@@ -399,7 +399,8 @@
       if (event.location)
         $('#event-location').html('@ ' + text2html(event.location)).show();
       if (event.description)
-        $('#event-description').show().children('.event-text').html(text2html(event.description, 300, 6));
+        $('#event-description').show().html(event.description);
+                                     //children('.event-text').html(text2html(event.description, 300, 6));
       if (event.vurl)
         $('#event-url').show().children('.event-text').html(render_link(event.vurl));
       
@@ -670,7 +671,6 @@
       // event details
       var title = $('#edit-title').val(event.title || '');
       var location = $('#edit-location').val(event.location || '');
-      var description = $('#edit-description').text(event.description || '');
       var vurl = $('#edit-url').val(event.vurl || '');
       var categories = $('#edit-categories').val(event.categories);
       var calendars = $('#edit-calendar').val(event.calendar);
@@ -722,12 +722,16 @@
         $('<option>').attr('value', event.categories).text(event.categories).appendTo(categories).prop('selected', true);
       }
 
+      var description;
       if ($.isArray(event.links) && event.links.length) {
-          render_message_links(event.links, $('#edit-event-links .event-text'), true, 'calendar');
-          $('#edit-event-links').show();
+	render_message_links(event.links, $('#edit-event-links .event-text'), true, 'calendar');
+	// hack! database_driver doesn't save the links property :-(
+	description = $('#edit-description').html("<div><a href='"+event.links[0].mailurl+"'>"+event.links[0].subject+"</a>\n<textarea class='text' rows='5' cols='40'>"+(event.description || '')+"</textarea></div>");
+	$('#edit-event-links').show();
       }
       else {
-          $('#edit-event-links').hide();
+	description = $('#edit-description').html("<div><textarea class='text' rows='5' cols='40'>"+(event.description || '')+"</textarea></div>");
+        $('#edit-event-links').hide();
       }
 
       // show warning if editing a recurring event
@@ -836,7 +840,7 @@
           end: date2servertime(end),
           allday: allday.checked?1:0,
           title: title.val(),
-          description: description.val(),
+          description: description.html(),
           location: location.val(),
           categories: categories.val(),
           vurl: vurl.val(),
--- a/plugins/calendar/skins/larry/templates/eventedit.html	Sat Jan 13 09:38:33 2018 -0500
+++ b/plugins/calendar/skins/larry/templates/eventedit.html	Sat Jan 13 09:39:32 2018 -0500
@@ -18,7 +18,7 @@
 			<div class="event-section">
 				<label for="edit-description"><roundcube:label name="calendar.description" /></label>
 				<br />
-				<textarea name="description" id="edit-description" class="text" rows="5" cols="40"></textarea>
+				<div name="description" id="edit-description"></div>
 			</div>
 			<div class="event-section">
 				<label for="edit-url"><roundcube:label name="calendar.url" /></label>