MoonKiKi: web2.0 and ajax... the evolution road

Sunday, March 22, 2009

added some feature in moogenda for a great customization

Now MooGenda has

  • a general object: this.cal that contains the json events data retrieved from getEventUrl
  • an onShowWeek and onShowDay events
  • an onWrite

In this way you can make something like that


var MYCustomMooGenda = new Class({

Extends: MooGenda,


initialize: function(options){
this.parent(options);

some istruction


this.addEvent('onShowWeek',function(){
some istruction

}.bind(this));

this.addEvent('onShowDay',function(){
some istruction
});

},


eventDetail: function(ev) {

var id = ev.retrieve('event_id')
var title = ev.retrieve('event_title')
var desc = ev.retrieve('event_desc')
var timeLong = ev.retrieve('event_h')
var timeStart = ev.retrieve('event_start')
var dayNum = ev.retrieve('displayNum')+"";
if (dayNum.substr(0,1)=="0")
dayNum=dayNum.substr(1);
var type= $('monthEl'+dayNum+ id).retrieve('type');
var cnt = new Element('div');
cnt.set('html', "" + title + "

" + desc+
"
START AT:"+timeStart+
"
TIME LONG:"+timeLong+
"
DAY:"+dayNum+
"


"
);


cnt.setStyle('padding', '10px');
cnt.setStyle('border', '1px solid #1d1d1d');
cnt.setStyle('width', '400px');
cnt.setStyle('text-align', 'justify');
cnt.setStyle('font-family', 'Trebuchet MS,geneva,arial,sans-serif');
cnt.setStyle('font-size', '14px');

cnt.addClass(type);
this.getTypeIco(type).inject(cnt,'top');

var crudBlock = new CrudBlock({'id':ev.id+'CrudBlock'});
cnt.grab(crudBlock.getABlock());

var close=new Element('input',{
type:'button',
value:"close",
id:'close'+id
})
cnt.grab(close);

var elem = new StickyWin({
content: cnt,
relativeTo: ev.id,
position: 'upperRight'
});
var obj=this;
cnt.addEvent('click',function(){
if($(this.id))
$(this.id).setStyle('z-index',obj.z++);
}.bind(elem));

close.addEvent('click',function(){
this.destroy();
}.bind(elem)
);
},
addEventCal: function(cell) {
var dayNum = cell.retrieve('displayNum')+"";
if (dayNum.substr(0,1)=="0")
dayNum=dayNum.substr(1);

this.addEventCalDayNum(dayNum);
},

addEventCalDayNum: function(dayNum) {


var cnt = new Element('div');
cnt.set('html', " title

desc"+
"
START AT: timeStart"+
"
TIME LONG: timeLong"+
"
DAY: "+dayNum+
"


"
);

cnt.addClass('riunione');
cnt.setStyle('padding', '10px');
cnt.setStyle('border', '1px solid #1d1d1d');
cnt.setStyle('width', '400px');
cnt.setStyle('text-align', 'justify');
cnt.setStyle('font-family', 'Trebuchet MS,geneva,arial,sans-serif');
cnt.setStyle('font-size', '14px');


var close=new Element('input',{
type:'button',
value:"close",
id:'close'+dayNum
})
cnt.grab(close);

var elem = new StickyWin({
content: cnt,
relativeTo: $(document.body),
position: 'center'
});
var obj=this;
cnt.addEvent('click',function(){
if($(this.id))
$(this.id).setStyle('z-index',obj.z++);
}.bind(elem));

close.addEvent('click',function(){
this.destroy();
}.bind(elem)
);

}

});

2 comments:

  1. Ti ringrazio Nunzio...
    mi sono iscritto al feed del tuo blog, lo trovo davvero molto utile, una ricca fonte di informazioni.Adesso provvedo ad iscrivermi al gruppo su google che mi hai indicato.

    Ciao e buona giornata!

    ReplyDelete
  2. Ciao Marbio,
    grazie. Cerco di sfruttare l'inglese per portare l'italian style ;) in giro per il mondo.
    Fammi sapere come ti trovi con la MooGenda, prossimamente faro' un video di alcune personalizzazioni a pagamento.

    ReplyDelete