0012010: show dtstart in subject when composing mails from calendar
authorPhilipp Schüle <p.schuele@metaways.de>
Fri, 8 Jul 2016 09:13:57 +0000 (11:13 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 11 Jul 2016 09:26:20 +0000 (11:26 +0200)
* also moves datetime renderer to Event model

https://forge.tine20.org/view.php?id=12010

Change-Id: If1ecb0c3ecf62c2080f0f649a0fa7cbae4cdd9f0
Reviewed-on: http://gerrit.tine20.com/customers/3329
Tested-by: Philipp Schüle <p.schuele@metaways.de>
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Calendar/js/AttendeeGridPanel.js
tine20/Calendar/js/EventDetailsPanel.js
tine20/Calendar/js/Model.js
tine20/Felamimail/js/Felamimail.js
tine20/Felamimail/js/GridPanelHook.js

index fca370a..f775738 100644 (file)
@@ -426,7 +426,7 @@ Tine.Calendar.AttendeeGridPanel = Ext.extend(Ext.grid.EditorGridPanel, {
                     handler: function() {
                         var email = Tine.Felamimail.getEmailStringFromContact(new Tine.Addressbook.Model.Contact(attender.get('user_id')));
                         var record = new Tine.Felamimail.Model.Message({
-                            subject: this.record.get('summary'),
+                            subject: this.record.get('summary') + ' - ' + Tine.Calendar.Model.Event.datetimeRenderer(this.record.get('dtstart')),
                             to: [email]
                         }, 0);
                         var popupWindow = Tine.Felamimail.MessageEditDialog.openWindow({
index 15c25ca..6cd4bd3 100644 (file)
@@ -62,13 +62,7 @@ Tine.Calendar.EventDetailsPanel = Ext.extend(Tine.widgets.grid.DetailsPanel, {
      * @return {String}
      */
     datetimeRenderer: function(dt) {
-        var app = Tine.Tinebase.appMgr.get('Calendar');
-
-        if (! dt) {
-            return app.i18n._('Unknown date');
-        }
-        
-        return String.format(app.i18n._("{0} {1} o'clock"), dt.format('l') + ', ' + Tine.Tinebase.common.dateRenderer(dt), dt.format('H:i'));
+        return Tine.Calendar.Model.Event.datetimeRenderer(dt);
     },
     
     transpRenderer: function(transp) {
index 9649942..b0e6492 100644 (file)
@@ -341,6 +341,16 @@ Tine.Calendar.Model.Event.getFilterModel = function() {
     ];
 };
 
+Tine.Calendar.Model.Event.datetimeRenderer = function(dt) {
+    var app = Tine.Tinebase.appMgr.get('Calendar');
+
+    if (! dt) {
+        return app.i18n._('Unknown date');
+    }
+
+    return String.format(app.i18n._("{0} {1} o'clock"), dt.format('l') + ', ' + Tine.Tinebase.common.dateRenderer(dt), dt.format('H:i'));
+};
+
 // register grants for calendar containers
 Tine.widgets.container.GrantsManager.register('Calendar_Model_Event', function(container) {
     var grants = Tine.widgets.container.GrantsManager.defaultGrants();
index 8e73c77..64e9c13 100644 (file)
@@ -156,7 +156,9 @@ Tine.Felamimail.Application = Ext.extend(Tine.Tinebase.Application, {
             app: this,
             foreignAppName: 'Calendar',
             modelName: 'Event',
-            subjectField: 'summary',
+            subjectFn: function(record) {
+                return record.get('summary') + ' - ' + Tine.Calendar.Model.Event.datetimeRenderer(record.get('dtstart'));
+            },
             addMailFromRecord: function(mailAddresses, record) {
                 Ext.each(record.get('attendee'), function(attender) {
                     Tine.log.debug('Tine.Felamimail.Application::initGridPanelHooks/addMailFromRecord() - Calendar attender:');
index 5ac087a..a310bbc 100644 (file)
@@ -154,6 +154,7 @@ Ext.apply(Tine.Felamimail.GridPanelHook.prototype, {
     mailAddresses: null,
     subject: null,
     subjectField: null,
+    subjectFn: null,
     
     /**
      * get addressbook contact grid panel
@@ -328,6 +329,8 @@ Ext.apply(Tine.Felamimail.GridPanelHook.prototype, {
         action.setDisabled(this.getMailAddresses(records).length == 0);
         if (this.subjectField && records.length > 0) {
             this.subject = records[0].get(this.subjectField);
+        } else if (Ext.isFunction(this.subjectFn)) {
+            this.subject = this.subjectFn(records[0]);
         }
     }
 });