renderers require a reference to the record
authorCornelius Weiß <mail@corneliusweiss.de>
Tue, 3 Jan 2012 13:47:04 +0000 (14:47 +0100)
committerCornelius Weiß <mail@corneliusweiss.de>
Tue, 3 Jan 2012 13:47:04 +0000 (14:47 +0100)
tine20/Calendar/js/iMIPDetailsPanel.js

index ecac46d..2b619bb 100644 (file)
@@ -46,21 +46,26 @@ Tine.Calendar.iMIPDetailsPanel = Ext.extend(Tine.Calendar.EventDetailsPanel, {
      * init this component
      */
     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)) {
-            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);
+        try {
+            this.app = Tine.Tinebase.appMgr.get('Calendar');
+            
             
-        Tine.Calendar.iMIPDetailsPanel.superclass.initComponent.call(this);
+            this.iMIPrecord = new Tine.Calendar.Model.iMIP(this.preparedPart.preparedData);
+            if (! 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);
+        } catch (e) {
+            Tine.log.error('Tine.Calendar.iMIPDetailsPanel::initComponent');
+            Tine.log.error(e.stack ? e.stack : e);
+        }
     },
     
     /**
@@ -156,77 +161,81 @@ Tine.Calendar.iMIPDetailsPanel = Ext.extend(Tine.Calendar.EventDetailsPanel, {
      * show/layout iMIP panel
      */
     showIMIP: function() {
-        
-        var singleRecordPanel = this.getSingleRecordPanel(),
-            preconditions = this.iMIPrecord.get('preconditions'),
-            method = this.iMIPrecord.get('method'),
-            event = this.iMIPrecord.get('event'),
-            myAttenderRecord = event.getMyAttenderRecord(),
-            myAttenderstatus = myAttenderRecord ? myAttenderRecord.get('status') : null;
+        try {
+            var singleRecordPanel = this.getSingleRecordPanel(),
+                preconditions = this.iMIPrecord.get('preconditions'),
+                method = this.iMIPrecord.get('method'),
+                event = this.iMIPrecord.get('event'),
+                myAttenderRecord = event.getMyAttenderRecord(),
+                myAttenderstatus = myAttenderRecord ? myAttenderRecord.get('status') : null;
+                
+            // reset actions
+            Ext.each(this.actions, function(action) {action.setHidden(true)});
             
-        // reset actions
-        Ext.each(this.actions, function(action) {action.setHidden(true)});
-        
-        // check preconditions
-        if (preconditions) {
-            if (preconditions.hasOwnProperty('EVENTEXISTS')) {
-                this.iMIPclause.setText(this.app.i18n._("The event of this message does not exist"));
-            }
+            // check preconditions
+            if (preconditions) {
+                if (preconditions.hasOwnProperty('EVENTEXISTS')) {
+                    this.iMIPclause.setText(this.app.i18n._("The event of this message does not exist"));
+                }
+                
+                else if (preconditions.hasOwnProperty('ORIGINATOR')) {
+                    // display spam box -> might be accepted by user?
+                    this.iMIPclause.setText(this.app.i18n._("The sender is not authorised to update the event"));
+                }
+                
+                else if (preconditions.hasOwnProperty('RECENT')) {
+    //            else if (preconditions.hasOwnProperty('TOPROCESS')) {
+                    this.iMIPclause.setText(this.app.i18n._("This message is already processed"));
+                }
+                
+                else if (preconditions.hasOwnProperty('ATTENDEE')) {
+                    // party crush button?
+                    this.iMIPclause.setText(this.app.i18n._("You are not an attendee of this event"));
+                } 
+                
+                else {
+                    this.iMIPclause.setText(this.app.i18n._("Unsupported message"));
+                }
+            } 
             
-            else if (preconditions.hasOwnProperty('ORIGINATOR')) {
-                // display spam box -> might be accepted by user?
-                this.iMIPclause.setText(this.app.i18n._("The sender is not authorised to update the event"));
+            // method specific text / actions
+            else {
+                switch (method) {
+                    case 'REQUEST':
+                        if (! myAttenderRecord) {
+                            // might happen in shared folders -> we might want to become a party crusher?
+                            this.iMIPclause.setText(this.app.i18n._("This is an event invitation for someone else."));
+                        } else if (myAttenderstatus !== 'NEEDS-ACTION') {
+                            this.iMIPclause.setText(this.app.i18n._("You have already replied to this event invitation."));
+                        } else {
+                            this.iMIPclause.setText(this.app.i18n._('You received an event invitation. Set your response to:'));
+                            Ext.each(this.statusActions, function(action) {action.setHidden(false)});
+                        }
+                        break;
+                        
+                        
+                    case 'REPLY':
+                        // Someone replied => autoprocessing atm.
+                        this.iMIPclause.setText(this.app.i18n._('An invited attendee responded to the invitation.'));
+                        break;
+                        
+                    default:            
+                        this.iMIPclause.setText(this.app.i18n._("Unsupported method"));
+                        break;
+                }
             }
             
-            else if (preconditions.hasOwnProperty('RECENT')) {
-//            else if (preconditions.hasOwnProperty('TOPROCESS')) {
-                this.iMIPclause.setText(this.app.i18n._("This message is already processed"));
-            }
+            this.getLoadMask().hide();
+            singleRecordPanel.setVisible(true);
+            singleRecordPanel.setHeight(150);
             
-            else if (preconditions.hasOwnProperty('ATTENDEE')) {
-                // party crush button?
-                this.iMIPclause.setText(this.app.i18n._("You are not an attendee of this event"));
-            } 
             
-            else {
-                this.iMIPclause.setText(this.app.i18n._("Unsupported message"));
-            }
-        } 
-        
-        // method specific text / actions
-        else {
-            switch (method) {
-                case 'REQUEST':
-                    if (! myAttenderRecord) {
-                        // might happen in shared folders -> we might want to become a party crusher?
-                        this.iMIPclause.setText(this.app.i18n._("This is an event invitation for someone else."));
-                    } else if (myAttenderstatus !== 'NEEDS-ACTION') {
-                        this.iMIPclause.setText(this.app.i18n._("You have already replied to this event invitation."));
-                    } else {
-                        this.iMIPclause.setText(this.app.i18n._('You received an event invitation. Set your response to:'));
-                        Ext.each(this.statusActions, function(action) {action.setHidden(false)});
-                    }
-                    break;
-                    
-                    
-                case 'REPLY':
-                    // Someone replied => autoprocessing atm.
-                    this.iMIPclause.setText(this.app.i18n._('An invited attendee responded to the invitation.'));
-                    break;
-                    
-                default:            
-                    this.iMIPclause.setText(this.app.i18n._("Unsupported method"));
-                    break;
-            }
-        }
-        
-        this.getLoadMask().hide();
-        singleRecordPanel.setVisible(true);
-        singleRecordPanel.setHeight(150);
-        
-        try {
+            this.record = event;
             singleRecordPanel.loadRecord(event);
         } catch (e) {
+            Tine.log.error('Tine.Calendar.iMIPDetailsPanel::showIMIP');
+            Tine.log.error(e.stack ? e.stack : e);
+            
             singleRecordPanel.setVisible(false);
         }