fix single print
authorStefanie Stamer <s.stamer@metaways.de>
Mon, 26 Jun 2017 14:30:31 +0000 (16:30 +0200)
committerPhilipp Schüle <p.schuele@metaways.de>
Mon, 26 Jun 2017 15:01:44 +0000 (17:01 +0200)
Change-Id: Ica09268abbe6d63715958158ff474e8896e38f70
Reviewed-on: http://gerrit.tine20.com/customers/4950
Reviewed-by: Philipp Schüle <p.schuele@metaways.de>
Tested-by: Philipp Schüle <p.schuele@metaways.de>
tine20/Addressbook/js/Printer/ContactRecord.js
tine20/Calendar/js/Printer/EventRecord.js

index 9ea37a8..11fec8e 100644 (file)
@@ -6,40 +6,41 @@ Tine.Addressbook.Printer.ContactRenderer = Ext.extend(Ext.ux.Printer.BaseRendere
     generateBody: function(contact) {
         var i18n = Tine.Tinebase.appMgr.get('Addressbook').i18n;
 
-        var bodyTpl = new Ext.XTemplate(
-            '<div class="rp-print-single">',
-            '{[Tine.widgets.printer.headerRenderer()]}',
-            '<table><tr><td>',
+        return new Promise(function (fulfill, reject) {
+            var bodyTpl = new Ext.XTemplate(
+                '<div class="rp-print-single">',
+                '{[Tine.widgets.printer.headerRenderer()]}',
+                '<table><tr><td>',
                 '<div class="rp-print-single-image">',
                 '<img src="{jpegphoto}">',
                 '</div>',
-            '</td><td>',
-            '<div class="rp-print-single-block">',
+                '</td><td>',
+                '<div class="rp-print-single-block">',
                 '<div class="rp-print-single-details-row">',
-                    '<span class="rp-print-single-value">{salutation} {n_prefix}</span>',
+                '<span class="rp-print-single-value">{salutation} {n_prefix}</span>',
                 '</div>',
                 '<div class="rp-print-single-summary">',
-                    '<span class="adb-print-single-value">{n_fn}</span>',
+                '<span class="adb-print-single-value">{n_fn}</span>',
                 '</div>',
                 '<div class="rp-print-single-details-row">',
-                    '{[this.fieldRenderer(values.org_name, "Company")]}',
+                '{[this.fieldRenderer(values.org_name, "Company")]}',
                 '</div>',
                 '<div class="rp-print-single-details-row">',
-                    '{[this.fieldRenderer(values.org_unit, "Unit")]}',
+                '{[this.fieldRenderer(values.org_unit, "Unit")]}',
                 '</div>',
                 '<div class="rp-print-single-details-row">',
-                    '{[this.fieldRenderer(values.industry, "Industry")]}',
+                '{[this.fieldRenderer(values.industry, "Industry")]}',
                 '</div>',
                 '<div class="rp-print-single-details-row">',
-                    '{[this.fieldRenderer(values.title, "Job Title")]}',
+                '{[this.fieldRenderer(values.title, "Job Title")]}',
                 '</div>',
                 '<div class="rp-print-single-details-row">',
-                    '{[this.fieldRenderer(values.bday, "Birthday")]}',
+                '{[this.fieldRenderer(values.bday, "Birthday")]}',
                 '</div>',
-            '</div>',
-            '</td></tr></table></br>',
-            '<div class="cal-print-single-block-heading">', i18n._('Contact Information'), '</div>',
-            '<div class="rp-print-single-block">',
+                '</div>',
+                '</td></tr></table></br>',
+                '<div class="cal-print-single-block-heading">', i18n._('Contact Information'), '</div>',
+                '<div class="rp-print-single-block">',
                 '<div class="rp-print-single-details-row">',
                 '{[this.fieldRenderer(values.tel_work, "Phone")]}',
                 '</div>',
@@ -61,43 +62,44 @@ Tine.Addressbook.Printer.ContactRenderer = Ext.extend(Ext.ux.Printer.BaseRendere
                 '<div class="rp-print-single-details-row">',
                 '{[this.fieldRenderer(values.url, "Web")]}',
                 '</div>',
-            '</div>',
-            '</br>',
-            '<div class="cal-print-single-block-heading">', i18n._('Company Address'), '</div>',
-            '<div class="rp-print-single-block">',
+                '</div>',
+                '</br>',
+                '<div class="cal-print-single-block-heading">', i18n._('Company Address'), '</div>',
+                '<div class="rp-print-single-block">',
                 "{[this.addressRenderer({'street': 'adr_one_street', 'street2': 'adr_one_street2', 'postalcode': 'adr_one_postalcode', 'locality': 'adr_one_locality', 'region': 'adr_one_region','country': 'adr_one_countryname'})]}",
-            '</div>',
-            '</br>',
-            '<div class="cal-print-single-block-heading">', i18n._('Private Address'), '</div>',
-            '<div class="rp-print-single-block">',
-            "{[this.addressRenderer({'street': 'adr_two_street', 'street2': 'adr_two_street2', 'postalcode': 'adr_two_postalcode', 'locality': 'adr_two_locality', 'region': 'adr_two_region','country': 'adr_two_countryname'})]}",
-            '</div>',
-            '</br>',
-            '{[this.customFieldRenderer(values.customfields)]}',
-            '</br>',
-            '<div class="cal-print-single-block-heading">', i18n._('Related to'), '</div>',
-            '<div class="rp-print-single-block">',
-            '{[this.relationRenderer(values.relations)]}',
-            '</div>',
-            '</div>',
+                '</div>',
+                '</br>',
+                '<div class="cal-print-single-block-heading">', i18n._('Private Address'), '</div>',
+                '<div class="rp-print-single-block">',
+                "{[this.addressRenderer({'street': 'adr_two_street', 'street2': 'adr_two_street2', 'postalcode': 'adr_two_postalcode', 'locality': 'adr_two_locality', 'region': 'adr_two_region','country': 'adr_two_countryname'})]}",
+                '</div>',
+                '</br>',
+                '{[this.customFieldRenderer(values.customfields)]}',
+                '</br>',
+                '<div class="cal-print-single-block-heading">', i18n._('Related to'), '</div>',
+                '<div class="rp-print-single-block">',
+                '{[this.relationRenderer(values.relations)]}',
+                '</div>',
+                '</div>',
 
-        {
-            customFieldRenderer: function(values) {
-                return Tine.widgets.customfields.Renderer.renderAll('Addressbook', Tine.Addressbook.Model.Contact, values);
-            },
-            fieldRenderer: function(fieldValue, label) {
-                return Tine.widgets.printer.fieldRenderer('Addressbook', Tine.Addressbook.Model.Contact, fieldValue, label);
-            },
-            addressRenderer: function(config) {
-                var renderer = Tine.widgets.grid.RendererManager.get('Addressbook', 'Addressbook_Model_Contact', 'addressblock', 'displayPanel');
-                return renderer(null, null, contact, null, null,null, config);
-            },
-            relationRenderer: function(values) {
-                return Tine.widgets.relation.Renderer.renderAll(values);
+                {
+                    customFieldRenderer: function (values) {
+                        return Tine.widgets.customfields.Renderer.renderAll('Addressbook', Tine.Addressbook.Model.Contact, values);
+                    },
+                    fieldRenderer: function (fieldValue, label) {
+                        return Tine.widgets.printer.fieldRenderer('Addressbook', Tine.Addressbook.Model.Contact, fieldValue, label);
+                    },
+                    addressRenderer: function (config) {
+                        var renderer = Tine.widgets.grid.RendererManager.get('Addressbook', 'Addressbook_Model_Contact', 'addressblock', 'displayPanel');
+                        return renderer(null, null, contact, null, null, null, config);
+                    },
+                    relationRenderer: function (values) {
+                        return Tine.widgets.relation.Renderer.renderAll(values);
 
-            }
+                    }
 
-        });
-        return bodyTpl.apply(contact.data);
+                });
+            fulfill(bodyTpl.apply(contact.data));
+        })
     }
 });
index c970785..0cabd8f 100644 (file)
@@ -4,56 +4,58 @@ Tine.Calendar.Printer.EventRenderer = Ext.extend(Ext.ux.Printer.BaseRenderer, {
     generateBody: function(event) {
         var i18n = Tine.Tinebase.appMgr.get('Calendar').i18n;
 
-        var bodyTpl = new Ext.XTemplate(
-            '<div class="cal-print-single">',
-                '<div class="cal-print-single-logo">',
-                    '<img src="' + Tine.logo + '">',
-                '</div>',
-                '<div class="cal-print-single-summary">',
-                    '<span class="cal-print-single-label">', i18n._('Summary'), '</span>',
-                    '<span class="cal-print-single-value">{summary}</span>',
-                '</div>',
-                '<div class="cal-print-single-organizer">',
-                    '<span class="cal-print-single-label">', i18n._('Organizer'), '</span>',
-                    '<span class="cal-print-single-value">{[values.organizer.n_fileas]}</span>',
-                '</div>',
-                '<div class="cal-print-single-block-heading">', i18n._('Description'), '</div>',
-                '<div class="cal-print-single-block">',
-                    '<div class="cal-print-single-description">{description}</div>',
-                '</div>',
-                '<div class="cal-print-single-block-heading">', i18n._('Details'), '</div>',
-                '<div class="cal-print-single-block">',
-                    '<div class="print-single-details-row">',
-                        '<span class="cal-print-single-label">', i18n._('Location'), '</span>',
-                        '<span class="cal-print-single-value">{location}</span>',
+        return new Promise(function (fulfill, reject) {
+            var bodyTpl = new Ext.XTemplate(
+                '<div class="cal-print-single">',
+                    '<div class="cal-print-single-logo">',
+                        '<img src="' + Tine.logo + '">',
                     '</div>',
-                    '<div class="print-single-details-row">',
-                        '<span class="cal-print-single-label">', i18n._('Start Time'), '</span>',
-                        '<span class="cal-print-single-value">{[this.datetimeRenderer(values.dtstart)]}</span>',
+                    '<div class="cal-print-single-summary">',
+                        '<span class="cal-print-single-label">', i18n._('Summary'), '</span>',
+                        '<span class="cal-print-single-value">{summary}</span>',
                     '</div>',
-                    '<div class="print-single-details-row">',
-                        '<span class="cal-print-single-label">', i18n._('End Time'), '</span>',
-                        '<span class="cal-print-single-value">{[this.datetimeRenderer(values.dtend)]}</span>',
+                    '<div class="cal-print-single-organizer">',
+                        '<span class="cal-print-single-label">', i18n._('Organizer'), '</span>',
+                        '<span class="cal-print-single-value">{[values.organizer.n_fileas]}</span>',
+                    '</div>',
+                    '<div class="cal-print-single-block-heading">', i18n._('Description'), '</div>',
+                    '<div class="cal-print-single-block">',
+                        '<div class="cal-print-single-description">{description}</div>',
+                    '</div>',
+                    '<div class="cal-print-single-block-heading">', i18n._('Details'), '</div>',
+                    '<div class="cal-print-single-block">',
+                        '<div class="print-single-details-row">',
+                            '<span class="cal-print-single-label">', i18n._('Location'), '</span>',
+                            '<span class="cal-print-single-value">{location}</span>',
+                        '</div>',
+                        '<div class="print-single-details-row">',
+                            '<span class="cal-print-single-label">', i18n._('Start Time'), '</span>',
+                            '<span class="cal-print-single-value">{[this.datetimeRenderer(values.dtstart)]}</span>',
+                        '</div>',
+                        '<div class="print-single-details-row">',
+                            '<span class="cal-print-single-label">', i18n._('End Time'), '</span>',
+                            '<span class="cal-print-single-value">{[this.datetimeRenderer(values.dtend)]}</span>',
+                        '</div>',
+                        // @TODO print rrule
+                        '{[this.customFieldRenderer(values.customfields)]}',
+                    '</div>',
+                    '<div class="cal-print-single-block-heading">', i18n._('Attendee'), '</div>',
+                    '<div class="cal-print-single-block">',
+                        '{[this.attendeeRenderer(values.attendee)]}',
                     '</div>',
-                    // @TODO print rrule
-                    '{[this.customFieldRenderer(values.customfields)]}',
-                '</div>',
-                '<div class="cal-print-single-block-heading">', i18n._('Attendee'), '</div>',
-                '<div class="cal-print-single-block">',
-                    '{[this.attendeeRenderer(values.attendee)]}',
                 '</div>',
-            '</div>',
 
-            {
-                datetimeRenderer: Tine.Calendar.EventDetailsPanel.prototype.datetimeRenderer,
-                attendeeRenderer: Tine.Calendar.EventDetailsPanel.prototype.attendeeRenderer,
-                customFieldRenderer: function(values) {
-                    return Tine.widgets.customfields.Renderer.renderAll('Calendar', Tine.Calendar.Model.Event, values);
+                {
+                    datetimeRenderer: Tine.Calendar.EventDetailsPanel.prototype.datetimeRenderer,
+                    attendeeRenderer: Tine.Calendar.EventDetailsPanel.prototype.attendeeRenderer,
+                    customFieldRenderer: function(values) {
+                        return Tine.widgets.customfields.Renderer.renderAll('Calendar', Tine.Calendar.Model.Event, values);
+                    }
                 }
-            }
-        );
+            );
 
-        return bodyTpl.apply(event.data);
+            fulfill(bodyTpl.apply(event.data));
+        });
     },
 
     getTitle: function(event) {