this.zap.on({ // events used by this specific application's life-cycle:
// an item is being replied to by you:
load: function(o){
editor.reset(); // clear out form
// swap to and from (its a reply)
var temp=o.data.from;
o.data.from=o.data.to;
o.data.to=temp;
// transform body to contain the old message :
o.data.body="\n---------------------\n"+
veneer.date(o.date).toLocaleString()+"\n>>\t"+o.data.body.split("\n").join("\n>>\t");
// populate the form
editor.value=o.data;
// add "re:" to the subject line
subject.value="re: "+subject.value.replace(/^re: /,"");
editor.scrollIntoView(true);
},
// an item was saved by you:
save: function(o){
editor.reset(); // clear out form
},
// an item was updated or created by anyone:
item: function(o){
var myUserName=document.getElementsByName("from")[0].value;
if(o.data.to==myUserName){ tmpl.prepend(o); }
},
// the archive is connected and ready to go:
ready: function(){
this.resume();
}
}); // end application events
Back to DemosVeneer Home