Here is the solution I used until cfoucehr posted the fix for emailtemplates zimlet.
I created a very simple zimlet (merging code from the
'Single and double clicked (via javascript)' example and
this post) that on click creates an appointment with the details that are preset in the zimlet source code.
It is a very hardcoded and dumb solution, but it works, and it can be useful if you for example olny need one or two appointment templates.
It's composed by two files:
com_zimbra_single_appointment_template.xml :
Code:
<zimlet name="com_zimbra_single_appointment_template" version="0.1" description="Creates a preset appointment on click">
<include>com_zimbra_single_appointment_template.js</include>
<handlerObject>com_zimbra_single_appointment_template_HandlerObject</handlerObject>
<zimletPanelItem label="Create preset appointment">
<toolTipText>Click to create a preset appointment</toolTipText>
</zimletPanelItem>
</zimlet> com_zimbra_single_appointment_template.
js :
Code:
/**
* Defines the Zimlet handler class.
*
*/
function com_zimbra_single_appointment_template_HandlerObject() {
}
/**
* Makes the Zimlet class a subclass of ZmZimletBase.
*
*/
com_zimbra_single_appointment_template_HandlerObject.prototype = new ZmZimletBase();
com_zimbra_single_appointment_template_HandlerObject.prototype.constructor = com_zimbra_single_appointment_template_HandlerObject;
/**
* This method gets called by the Zimlet framework when single-click is performed.
*
*/
com_zimbra_single_appointment_template_HandlerObject.prototype.singleClicked =
function() {
this.displayStatusMessage("Creating preset appointment...");
var apptComposeController = AjxDispatcher.run("GetApptComposeController");
if (apptComposeController) {
var appt = new ZmAppt();
/*Insert appointment details modifying these attributes*/
appt.setName("Test");
appt.setTextNotes("Insert notes here\r\n");
appt.setStartDate("3/2/2007");
appt.setEndDate("3/2/2007");
appt.startDate.setHours(7,00);
appt.endDate.setHours(8,00);
apptComposeController.show(appt);
}
};
Zip both of them in com_zimbra_single_appointment_template.zip and you can deploy the zimlet using admin console.