/*
 
Copyright 2009 Palm, Inc.  All rights reserved.

*/

var SenderrorDashboardAssistant = Class.create({
	
	initialize: function(details) {
		this.details = details;
	},

	setup: function() {
		var content = Mojo.View.render({object: this.details,
										template: 'senderror-dashboard/error-details'
										});
		this.controller.sceneElement.update(content);
		this.controller.sceneElement.observe(Mojo.Event.tap, this.tapHandler.bindAsEventListener(this));
	},

	tapHandler: function(event) {
		this.controller.serviceRequest('palm://com.palm.applicationManager', {
	                    method: 'open',
	                    parameters: {
							id: 'com.palm.app.email',
							params: { 'folderInfo': this.details.folderInfo }
						}
	                });
		// Close our stage by looking up the stage name in this roundabout way
		Mojo.Controller.getAppController().closeStage(this.controller.window.name);
	},
	
	updateDashboard: function(details) {
		this.details = details;
		var content = Mojo.View.render({object: this.details,
										template: 'senderror-dashboard/error-details'
										});
		this.controller.sceneElement.update(content);
	},

});
