fix for external invitations
[tine20] / tine20 / Calendar / js / iMIPDetailsPanel.js
index 223f6de..e90c9d1 100644 (file)
@@ -47,18 +47,18 @@ Tine.Calendar.iMIPDetailsPanel = Ext.extend(Tine.Calendar.EventDetailsPanel, {
      */
     initComponent: function() {
         this.app = Tine.Tinebase.appMgr.get('Calendar');
-
+        
         this.iMIPrecord = new Tine.Calendar.Model.iMIP(this.preparedPart.preparedData);
-        if (! Ext.isFunction(this.iMIPrecord.get('event').beginEdit)) {
+        if (! this.iMIPrecord.get('event') || ! Ext.isFunction(this.iMIPrecord.get('event').beginEdit)) {
             this.iMIPrecord.set('event', Tine.Calendar.backend.recordReader({
                 responseText: Ext.util.JSON.encode(this.preparedPart.preparedData.event)
             }));
         }
-
+        
         this.initIMIPToolbar();
-
+        
         this.on('afterrender', this.showIMIP, this);
-
+        
         Tine.Calendar.iMIPDetailsPanel.superclass.initComponent.call(this);
     },
     
@@ -125,7 +125,6 @@ Tine.Calendar.iMIPDetailsPanel = Ext.extend(Tine.Calendar.EventDetailsPanel, {
             this.iMIPrecord.set('event', Tine.Calendar.backend.recordReader({
                 responseText: Ext.util.JSON.encode(result.event)
             }));
-            
             this.showIMIP();
         }, this);
     },
@@ -238,7 +237,7 @@ Tine.Calendar.iMIPDetailsPanel = Ext.extend(Tine.Calendar.EventDetailsPanel, {
                     this.iMIPclause.setText(this.app.i18n._('An invited attendee responded to the invitation.'));
                     break;
                     
-                default:            
+                default:
                     this.iMIPclause.setText(this.app.i18n._("Unsupported method"));
                     break;
             }
@@ -248,8 +247,13 @@ Tine.Calendar.iMIPDetailsPanel = Ext.extend(Tine.Calendar.EventDetailsPanel, {
         singleRecordPanel.setVisible(true);
         singleRecordPanel.setHeight(150);
         
-        
-        this.record = event;
-        singleRecordPanel.loadRecord(event);
+        if (existingEvent) {
+            this.record = Tine.Calendar.backend.recordReader({
+                responseText: Ext.util.JSON.encode(existingEvent)
+            });
+        } else {
+            this.record = event;
+        }
+        singleRecordPanel.loadRecord(this.record);
     }
 });