Extension:MKCalendar/mkcalendar.js

";   return st;  }  this.addguests  = function ( id, user, istatus, updated ){    this.guests[this.guests.length] = new oEventGuests( id, user, istatus, updated)  } }

function mkcalendar ( user, wuser, mode, ausers, resources, group ) { this.debugmode = false; this.user     = user; this.wuser    = wuser; this.mode     = mode; this.mkcEvents = []; this.ausers   = ausers.split("--"); this.resources = resources.split("--"); this.group    = group; //this.ausersfullname = ausersfullname.split("--"); //this.ausersemail = ausersemail.split("--"); //this.startdate = new Date; //FUNCTIONS //################################################################################################## //##################################################################################################  this.addevent = function ( id, user, what, whento, whenyet, erepeat, ewhere, desc, remainder, remainderm, shared, updater, updated, invite, guests ) {   this.mkcEvents[this.mkcEvents.length] = new oEvent( id, user, what, whento, whenyet, erepeat, ewhere, desc, remainder, remainderm, shared, updater, updated, invite, guests ); } //##################################################################################################  //##################################################################################################  this.listevents = function {   var i  = 0; var st = "\n";

if ( this.mkcEvents.length > 0 ){ st += ' \n";   } else {      st += "Nincs esemény\n";    }    return st;  }  //##################################################################################################  //##################################################################################################  this.smiley = function   {    var a = document.getElementById("mcalusersel");    a.selected = this.wuser;    a.value = this.wuser;    this.getusernames;  }  //##################################################################################################  //##################################################################################################  this.groupevents = function   {    var i  = 0;    var j  = 0;    var sorok = 10;    var st = "\n";    var d = new Date;    var esemenyek = "";    //alert("Nyek");    //curr_width = mydiv.offsetWidth;    //var curr_width1 = Math.round( (curr_width-50) / 7); //d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); //d.setDate(mcald.getDate); d.setFullYear(mcald.getFullYear,mcald.getMonth,mcald.getDate); //alert(mcald.getFullYear+"."+mcald.getMonth+"."+mcald.getDate); st += ' '; st += ' '; st += ' ' + "\n"; st += ' ' + "\n"; //d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); //d.setDate(mcald.getDate); d.setFullYear(mcald.getFullYear,mcald.getMonth,mcald.getDate); for (i = 0; i<sorok; i++) { st += ' '+monthname[d.getMonth]+"."+d.getDate+'  '; d.setDate(d.getDate+1); }   st += ' -  '; st += ' ' + "\n"; return st; } //##################################################################################################  //##################################################################################################  this.drawcal = function ( view, direction ) {   //alert ( window.innerHeight ); curr_height = window.innerHeight-200; var st = ""; //alert (view); switch( view ) {   case "month": mcald.setMonth( mcald.getMonth + direction); st += this.month_view; break; case "events": st += this.listevents; break; case "groupevents": st += this.groupevents; break; default: var i = 0; var d = new Date; var hetfotavolsaga = cce(d.getDay) - 1 ;

if(direction==0){ mcald.setDate( mcald.getDate - hetfotavolsaga); } else if (direction == "res"){ direction = 0; } else if ( direction === "new" ||          direction === "update" ||           direction === "delete" ||           direction === "accept" ||           direction === "denied" ||           direction === "fresh" ){ direction = 0; }

mcald.setDate( mcald.getDate + direction); //d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); //d.setDate(mcald.getDate); d.setFullYear(mcald.getFullYear,mcald.getMonth,mcald.getDate);

//alert( "direction: "+direction+"d.getDate: "+d.getDate+" d.getMonth: "+ (d.getMonth+1) + " d.getDay: "+d.getDay +     //       "mcald.getDate: "+mcald.getDate+" mcald.getMonth: "+ (mcald.getMonth+1) + " mcald.getDay: "+mcald.getDay );

var mydiv = document.getElementById("mkcalendar"); curr_width = mydiv.offsetWidth; var curr_width1 = Math.round( (curr_width-50) / 7); //mydiv.style.width = "200px" //alert (curr_width); var ccdate = d.getFullYear+"-"+monthphp(d.getMonth)+"-"+d.getDate; //alert( ccdate ); //st += " " \n";     st += ' " + "\n"; st += this.week_view(7, curr_width1); if (this.debugmode ) { st += this.listevents };   }

document.getElementById('mkcalendar').innerHTML = st; if( view=="week" ){ document.getElementById('mkcalendar2').scrollTop = 280; document.getElementById("mkcalendar2").style.height = (window.innerHeight-200)+"px"; }   curr_height = window.innerHeight-200; } //##################################################################################################  //##################################################################################################  this.mimport_file_upload = function {   return false; } //##################################################################################################  //##################################################################################################  this.change_user_div = function {   retval = ""; retval += ' aa '; return retval; } //##################################################################################################  //##################################################################################################    this.change_user = function {   document.getElementById('mkcaluseradd').style.visibility= "visible"; } //##################################################################################################  //##################################################################################################  this.getusernames = function {   var v = document.getElementById('mcalusersel').value; this.user = v;   //document.getElementById('mkcaluseradd').style.visibility= "hidden";

var d = new Date; //mcald.setDate( mcald.getDate); //d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); //d.setDate(mcald.getDate); d.setFullYear(mcald.getFullYear,mcald.getMonth,mcald.getDate);

var ccdate = d.getFullYear+"-"+monthphp(d.getMonth)+"-"+d.getDate; //alert(ccdate); MakeRequest( "fresh", ccdate, this.user, this.wuser, this.mode); return false; } //##################################################################################################  //##################################################################################################  this.divtobbnapos = function ( d ) { //d az egyenlő a hétfővel var retval= ''; var j=0; var i=0; var one_day=1000*60*60*24;

//alert(d.getFullYear + "." + (d.getMonth+1) + "." + d.getDate);

for (i=0; i < this.mkcEvents.length; i++){ //01234567890123456789     //2009-07-20 06:00:00      //var ztol = new Date; //var sunwhento_day = new d;     //sunday.setDate(sunday.getDate+6); var whento_day = parseInt(this.mkcEvents[i].whento.substr(8,2) ,10); var whenyet_day = parseInt(this.mkcEvents[i].whenyet.substr(8,2),10); //Csak a Többnapos eseményekkel foglalkozunk if (whento_day != whenyet_day ){ var tcoll = 3; var tcoll2 = 0; var j=0; var t = new Date; var yet = new Date; var mondist = 0; var weekper = 0; var mondistneg = 0; //t.setFullYear( parseInt(this.mkcEvents[i].whento.substr(0,4),10) ); //t.setMonth(   parseInt(this.mkcEvents[i].whento.substr(5,2),10)-1 ); //t.setDate(    parseInt(this.mkcEvents[i].whento.substr(8,2),10) ); t.setFullYear( parseInt(this.mkcEvents[i].whento.substr(0,4),10),                      parseInt(this.mkcEvents[i].whento.substr(5,2),10)-1,                       parseInt(this.mkcEvents[i].whento.substr(8,2),10) ); t.setHours(0,0,0); //yet.setFullYear( parseInt(this.mkcEvents[i].whenyet.substr(0,4),10) ); //yet.setMonth(   parseInt(this.mkcEvents[i].whenyet.substr(5,2),10)-1 ); //yet.setDate(    parseInt(this.mkcEvents[i].whenyet.substr(8,2),10) ); yet.setFullYear( parseInt(this.mkcEvents[i].whenyet.substr(0,4),10),                        parseInt(this.mkcEvents[i].whenyet.substr(5,2),10)-1,                         parseInt(this.mkcEvents[i].whenyet.substr(8,2),10) ); yet.setHours(0,0,0); //tcoll2 = Math.round( whenyet_day - day)+1; mondist = Math.ceil((t.getTime-d.getTime)/(one_day)); //alert ( t.getDate+" - "+ d.getDate +" = " + a ); //b = //tcoll2 = Math.round( whenyet_day - whento_day) + 1 - Math.abs(mondist); if ( mondist < 0 ){ mondistneg = mondist; weekper = 0 ; } else { weekper = Math.ceil((t.getTime - d.getTime)/(one_day) ); }       tcoll2 = (yet.getTime-t.getTime)/(one_day) + 1 + mondistneg; //alert (a + "one_day: " +one_day);

retval += ' '+ "\n"; for (j=0; j < weekper; j++){ retval += ' '+ "\n"; }       retval += '' + "\n" + '' + "\n" + "" + this.mkcEvents[i].whento.substr(8,2) + ". -től " + this.mkcEvents[i].whenyet.substr(8,2) + ". -ig " + this.mkcEvents[i].updater + " " + //this.mkcEvents[i].user + " " + "\n" + this.mkcEvents[i].what + //" " + "\n" + //"tcoll2:" + tcoll2 + " whento_day - d.getDate = " + whento_day + " - " + d.getDate + " " + "\n" + " ";       retval += '  ' + "\n"; }   }    return retval; } //##################################################################################################  //##################################################################################################  this.divfd = function ( d ) {   var retval= ''; for (i=0; i < this.mkcEvents.length; i++){ //01234567890123456789     //2009-07-20 06:00:00      //var ztol = new Date; var day = d.getDate; var day2 = this.mkcEvents[i].whento.substr(8,2); var tol2 = this.mkcEvents[i].whento.substr(11); var ig2 = this.mkcEvents[i].whenyet.substr(11); if ( tol2 == "00:00:00" && ig2 == "23:59:59" ){ if ( day == day2 ){ //alert(day +" - " + day2); retval += '' + //this.mkcEvents[i].user + " " + "" + this.mkcEvents[i].what + " "; }     }      //break; }   return retval; } //##################################################################################################  //##################################################################################################  this.month_view = function {   var st = "\n"; var d = new Date; var mydiv = document.getElementById("mkcalendar"); var ccdate = mcald.getFullYear+"-"+monthphp(mcald.getMonth)+"-1"; curr_width = mydiv.offsetWidth; var cw = Math.round( curr_width / 7);

//d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); //d.setDate(1); d.setFullYear(mcald.getFullYear,mcald.getMonth,mcald.getDate); d.setHours(0,0,0);

m = d.getMonth + 1; myear = d.getFullYear; h = true; st += ' " + "\n";   st += this.listevents;    return st;  }  //##################################################################################################  //##################################################################################################  this.getevents  = function ( date, user ) {    var st = "";    var i=0;    for (i=0; i< this.mkcEvents.length; i++) {      //01234567890123456789      //2009-07-20 06:00:00      if ( this.mkcEvents[i].whento.substr(8,2) == date ||           ( this.mkcEvents[i].whento.substr(8,2) <= date &&             this.mkcEvents[i].whenyet.substr(8,2) >= date ) ) {        if ( user == "all") {          st += ''+ this.mkcEvents[i].what +" \n";        } else {          if ( this.mkcEvents[i].user == user ) {            st += ''+ this.mkcEvents[i].what +" \n"; }       }      }    }    return st; } //##################################################################################################  //##################################################################################################  this.week_view = function ( hview, cellwidth ) {   var st = ""; var i = 0; var j = 0; var d = new Date; var ds = new Date; //d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); //d.setDate(mcald.getDate); d.setFullYear(mcald.getFullYear, mcald.getMonth, mcald.getDate ); d.setHours(0,0,1); //alert(d.getHours + ":" + d.getMinutes + ":" +d.getSeconds); if ( d.getWeek == ds.getWeek ){ ee = true; } else { ee = false; }

st += ''; st += this.drawevents_div; st += this.draw_add_edit_event; st += this.draw_add_edit_event_guests; st += ' ";   st += " \n";    return st;  }  //##################################################################################################  //##################################################################################################  this.drawevents_div = function   {    var st = "";    var x=52; var y=0; var z=40; var i=0;    var mydiv = document.getElementById("mkcalendar");    curr_width = mydiv.offsetWidth;    var curr_width1 = Math.round( (curr_width-50) / 7);    //if (curr_width1>50){ curr_width1 -= 40; }    for (i=0; i < this.mkcEvents.length; i++){      var evname = ;      var mleft = ;      var mwidth = '';      if(this.user == this.mkcEvents[i].user ){        evname = "eventdiv";      } else {        evname = "eventdivother";      }      //csak a NEM egésznapos és az egynapnál rövidebb eseményekkel foglalkozunk      if ( !( this.mkcEvents[i].whento.substr(11)  == "00:00:00" && this.mkcEvents[i].whenyet.substr(11) == "23:59:59" ) &&          this.mkcEvents[i].whento.substr(8,2)  == this.mkcEvents[i].whenyet.substr(8,2) ){ //alert(this.mkcEvents[i].what); switch ( this.mkcEvents[i].erepeat ) { case "daily": mleft = "52"; mwidth = (curr_width1*7)-40; break; case "weekday": mleft = "52"; mwidth = (curr_width1*5)-40; break; default: mleft = mkc_whento_x ( this.mkcEvents[i].whento ); mwidth = curr_width1-30; }       st += ''; st += "" + mkc_pt_time(this.mkcEvents[i].whento) + " - " + mkc_pt_time(this.mkcEvents[i].whenyet) + " " +this.mkcEvents[i].updater +" \n";

if ( this.mkcEvents[i].invite == "1"){ //alert(this.mkcEvents[i].isuseraccept( this.user )+this.user); if ( this.mkcEvents[i].isuseraccept( this.user ) ) { st += ' '; } else { st += ' '; }       }        if ( this.mkcEvents[i].remainder == "email"){ st += ' '; }       if ( this.mkcEvents[i].remainder == "sms"){ st += ' '; } /*else { st += ''; }*/       //st += " "; //st += "" + this.mkcEvents[i].user + " "; st += this.mkcEvents[i].what; st += " \n"; //x += 50; }   }    return st; } //##################################################################################################  //##################################################################################################  this.draw_add_edit_event_guests = function ( m ) {   var st =' '+ ' '+"\n"+ '<img src="/mediawiki/extensions/mkcalendar/windowclose.png" '+ 'title="Bezár" onclick="return mcal.add_edit_event_guest_hide(0)">'+"\n"+ ' '+"\n"+ ' '+         ' ';    return st; } //##################################################################################################  //##################################################################################################  this.add_edit_event_guest_hide = function ( mode ){ var seldiv = document.getElementById('addeventdivguests'); var t = document.getElementById('mkeaguestshidden'); var id = document.getElementById('mkeaguesth').value; //alert ("id hossza: "+id.length); //this.mkcEvents[id].guests = []; var s = ""; if ( mode == 1) { if ( id.length < 1 ){ this.addevent ( "", "", "", "", "", "", "", "", "", "", "", "", "", "", "" ); id = this.mkcEvents.length - 1; }     if ( this.group=="resources" ){ this.mkcEvents[id].guests = []; for (i=0; i<this.resources.length; i++){ if ( document.getElementById( 'guests'+i ).checked ){ if ( s =='' ){ s += document.getElementById( 'guests'+i ).value; } else { s += "; " + document.getElementById( 'guests'+i ).value; }           this.mkcEvents[id].addguests('', document.getElementById( 'guests'+i ).value, 'sent', 'most' ); }       }      } else { this.mkcEvents[id].guests = []; for (i=0; i<this.ausers.length; i++){ if ( document.getElementById( 'guests'+i ).checked ){ if ( s =='' ){ s += document.getElementById( 'guests'+i ).value; } else { s += "; " + document.getElementById( 'guests'+i ).value; }           this.mkcEvents[id].addguests('', document.getElementById( 'guests'+i ).value, 'sent', 'most' ); }       }      }      t.value = s;      //alert ( t.value ); //alert(this.mkcEvents[id].guestslist); document.getElementById('mkeaguests').innerHTML = this.mkcEvents[id].guestslistf( this.mkcEvents[id].user ); //document.getElementById('mkeaguestshidden').value = this.mkcEvents[eventi].guestslist( this.mkcEvents[eventi].user ); }   seldiv.style.visibility= "hidden"; return false; } //##################################################################################################  //##################################################################################################  this.guestsedit = function {   var e = document.getElementById('addeventdiv'); var v = document.getElementById('addeventdivguests'); var t = document.getElementById('mkeaguestshidden'); //alert("e.style.top:"+e.style.top); //parseInt(tol.substr(11,2),10); v.style.top = (parseInt(e.style.top,10)+80)+"px"; v.style.left = (parseInt(e.style.left,10)+260)+"px"; v.style.visibility= "visible"; //update //alert (t.value); if ( this.group=="resources" ){ for (i=0; i<this.resources.length; i++){ if ( t.value.search( document.getElementById( 'guests'+i ).value ) > -1) { document.getElementById( 'guests'+i ).checked = true; } else { document.getElementById( 'guests'+i ).checked = false; }     }    } else { for (i=0; i<this.ausers.length; i++){ if ( t.value.search( document.getElementById( 'guests'+i ).value ) > -1) { document.getElementById( 'guests'+i ).checked = true; } else { document.getElementById( 'guests'+i ).checked = false; }     }    }  }  //##################################################################################################  //##################################################################################################  this.draw_add_edit_event = function ( m ) {   var st = ' '+"\n"+ ' '+"\n"+ '<img src="/mediawiki/extensions/mkcalendar/windowclose.png" '+ 'title="Bezár" onclick="return mcal.add_edit_event_hide(0)">'+"\n"+ ' '+"\n"+ ' '+"\n"+ 'Töröl! '+"\n"+ ' '+"\n"+ '<form onsubmit="return mcal.add_edit_event_hide(1)">'+"\n"+ '<input type="hidden" name="mkeaid"     id="mkeaid" >'+"\n"+ '<input type="hidden" name="mkeaupdater" id="mkeaupdater" >'+"\n"+ '<input type="hidden" name="mkeauser"   id="mkeauser" >'+"\n"+ '<input type="hidden" name="mkeaguestshidden" id="mkeaguestshidden" >'+"\n"+ ' '+"\n"+ ' '+"\n"+ ' '   return st; } //##################################################################################################  //##################################################################################################  this.remain = function {   //alert("Be szeretnék liba csöcsbe harapni!"); var a = document.getElementById('mkearemainder'); var b = document.getElementById('mkearemainderm');

if ( a.value == "nothing" ){ b.disabled = true; b.value = "nothing"; //alert(a.value); } else { b.disabled = false; b.value = "aday"; //alert(a.value); } }  //##################################################################################################  //##################################################################################################  this.repeat = function ( obj ) { //alert ( obj.value ); var whento = document.getElementById('mkeawhento'); var whenyet = document.getElementById('mkeawhenyet') if ( !sfulldayto ) { sfulldayto = whento.value; sfulldayyet = whenyet.value; }   switch( obj.value ){ case "daily": sfulldayto = whento.value; sfulldayyet = whenyet.value; whento.readOnly = true; whento.value = "0000.00.00"; whenyet.readOnly = true; whenyet.value = "0000.00.00"; break; case "weekday": sfulldayto = whento.value; sfulldayyet = whenyet.value; whento.readOnly = true; whento.value = "0000.00.00"; whenyet.readOnly = true; whenyet.value = "0000.00.00"; break; case "weekly": sfulldayto = whento.value; sfulldayyet = whenyet.value; whento.readOnly = false; whenyet.readOnly = true; whenyet.value = "0000.00.00"; break; case "monthly": //readonly az whenyet év hónap break; case "yearly": //readonly az whenyet év break; default: whento.readOnly = false; whento.readOnly = false; whenyet.readOnly = false; whenyet.readOnly = false; whento.value = sfulldayto; whenyet.value = sfulldayyet; }   return true; } //##################################################################################################  //##################################################################################################  this.fullday = function {   //alert(document.getElementById('mkeafday').checked); if (document.getElementById('mkeafday').checked == true ){ sfulldaytot=document.getElementById('mkeawhentot').value; sfulldayyett=document.getElementById('mkeawhenyett').value; document.getElementById('mkeawhentot').value = "00:00:00"; document.getElementById('mkeawhentot').readOnly = true; document.getElementById('mkeawhenyett').value = "23:59:59"; document.getElementById('mkeawhenyett').readOnly = true; } else { document.getElementById('mkeawhenyett').value = document.getElementById('mkeawhentot').value; document.getElementById('mkeawhentot').readOnly = false; document.getElementById('mkeawhenyett').readOnly = false; document.getElementById('mkeawhentot').value = sfulldaytot; document.getElementById('mkeawhenyett').value = sfulldayyett; }

} //##################################################################################################  //##################################################################################################  this.add_edit_event_popup = function ( obj, mode ) {   var top = obj.offsetTop; var left = obj.offsetLeft; /*var top = "300"; var left = "200";*/ var h = document.getElementById('addeventdiv').offsetHeight; var w = document.getElementById('addeventdiv').offsetWidth; var i = 0; var h = 0; var m = 0; var curr_width1 = Math.round( (curr_width-48) / 7); var d = new Date;

var eventi = obj.id.substr(8); var id = obj.id; //var t = document.getElementById('mkeaguests'); //t.value = ""; //alert("eventi:"+eventi);

document.getElementById('mkeaguesth').value = eventi; document.getElementById('addeventdivguests').style.visibility= "hidden";

//d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); d.setFullYear(mcald.getFullYear,mcald.getMonth,mcald.getDate); d.setHours(0,0,0);

if ( mode==0 ){ i= Math.round(left / curr_width1 ); h= Math.round(top / 40 ); m= Math.round((top / 20) * 30 ); d.setMinutes(m); d.setDate(mcald.getDate + i); document.getElementById('mkeaid').value = ''; document.getElementById('mkeauser').value = this.user; document.getElementById('mkeawhat').value = ''; document.getElementById('mkearepeats').value = 'doesnotrepeat'; document.getElementById('mkeawhere').value = ''; document.getElementById('mkeadescr').value = ''; document.getElementById('mkearemainder').value = 'nothing'; document.getElementById('mkearemainderm').value = 'nothing'; document.getElementById('mkearemainderm').disabled = true; document.getElementById('mkeapublic').value = 'public'; document.getElementById('mkeawhento').value = d.getFullYear +"."+ fillz((d.getMonth+1)) +"."+ fillz(d.getDate); document.getElementById('mkeawhentot').value = fillz(d.getHours) +":"+ fillz(d.getMinutes) +":"+ fillz(d.getSeconds); document.getElementById('mkeawhenyet').value = d.getFullYear +"."+ fillz((d.getMonth+1)) +"."+ fillz(d.getDate); document.getElementById('mkeawhenyett').value = fillz(d.getHours) +":"+ fillz(d.getMinutes) +":"+ fillz(d.getSeconds); document.getElementById('mkeasend').value = 'Új eseményt ment'; document.getElementById('mkeasend').disabled = false; document.getElementById('mkeawhentot').readOnly = false; document.getElementById('mkeawhenyett').readOnly = false; document.getElementById('mkeafday').checked = false; document.getElementById('mkeawhat').readOnly       = false; document.getElementById('mkeawhento').readOnly     = false; document.getElementById('mkeawhenyet').readOnly    = false; document.getElementById('mkeafday').disabled       = false; document.getElementById('mkearepeats').disabled    = false; document.getElementById('mkeawhere').readOnly      = false; document.getElementById('mkeadescr').readOnly      = false; document.getElementById('mkearemainder').disabled  = false; document.getElementById('mkeapublic').disabled     = false; document.getElementById('mkeaeditg').style.visibility = "visible"; document.getElementById('mkeaguests').innerHTML = ""; document.getElementById('mkeaguestshidden').value = ""; for ( i=0; i<this.ausers.length; i++ ){ //alert("this.ausers[i]: '"+this.ausers[i]+"'"); document.getElementById('guests'+i).disabled = false; document.getElementById('guests'+i).checked = false; }     //document.getElementById('mkeasend2').style.visibility = 'hidden'; if ( top > window.innerHeight - 290) { document.getElementById('addeventdiv').style.top = ( window.innerHeight - 290 ) +"px"; } else { document.getElementById('addeventdiv').style.top = top +"px"; }     if ( left > curr_width - 506 ) { document.getElementById('addeventdiv').style.left = ( curr_width - 506 ) +"px"; } else { document.getElementById('addeventdiv').style.left = left +"px"; }     document.getElementById('addeventdivdelete').style.visibility= "hidden"; //    M  Ó  D  O  S  Í  T !!! -  M  Ó  D  O  S  Í  T !!! } else { //nem tölti fel a guestet helyesen // ez alább meg van document.getElementById('mkeaguests').innerHTML = this.mkcEvents[id].guestslistf( this.mkcEvents[id].user );

document.getElementById('mkeaupdater').value = this.mkcEvents[eventi].updater; document.getElementById('addeventdivdelete').style.visibility= "visible"; //alert("eventi user:" + this.mkcEvents[eventi].user + " this.user:"+ this.user + " shared" +this.mkcEvents[eventi].shared ); if ( this.mkcEvents[eventi].user != this.wuser &&          this.mkcEvents[eventi].shared == "private" &&           this.mkcEvents[eventi].invite != "1" ){ document.getElementById('addeventdivdelete').style.visibility= "hidden"; alert ("Privát esemény. "+"wsuer: "+this.wuser+" user: "+this.user ) ; return; }     document.getElementById('mkeaid').value = this.mkcEvents[eventi].id; document.getElementById('mkeauser').value = this.mkcEvents[eventi].user; document.getElementById('mkeawhat').value = this.mkcEvents[eventi].what; document.getElementById('mkearepeats').value = this.mkcEvents[eventi].erepeat; document.getElementById('mkeawhere').value = this.mkcEvents[eventi].ewhere; document.getElementById('mkeadescr').value = this.mkcEvents[eventi].desc; document.getElementById('mkearemainder').value = this.mkcEvents[eventi].remainder; document.getElementById('mkearemainderm').value = this.mkcEvents[eventi].remainderm; document.getElementById('mkeaguests').innerHTML = this.mkcEvents[eventi].guestslistf( this.mkcEvents[eventi].user ); document.getElementById('mkeaguestshidden').value = this.mkcEvents[eventi].guestslist( this.mkcEvents[eventi].user ); document.getElementById('mkeapublic').value = this.mkcEvents[eventi].shared; document.getElementById('mkeawhento').value = this.mkcEvents[eventi].whento.substr(0,10); document.getElementById('mkeawhentot').value = this.mkcEvents[eventi].whento.substr(11); document.getElementById('mkeawhenyet').value = this.mkcEvents[eventi].whenyet.substr(0,10); document.getElementById('mkeawhenyett').value = this.mkcEvents[eventi].whenyet.substr(11); if (this.mkcEvents[eventi].whento.substr(8,2) != this.mkcEvents[eventi].whenyet.substr(8,2) ||         ( this.mkcEvents[eventi].whento.substr(11)== "00:00:00" && this.mkcEvents[eventi].whenyet.substr(11)== "23:59:59" ) ) { var a = document.getElementById('mkcalendar2').scrollTop; document.getElementById('addeventdiv').style.top = (top + a) +"px"; document.getElementById('addeventdiv').style.left = 150 +"px"; } else { if ( top > window.innerHeight - 290) { document.getElementById('addeventdiv').style.top = ( window.innerHeight - 290 ) +"px"; } else { document.getElementById('addeventdiv').style.top = top +"px"; }       if ( left > curr_width - 506 ) { document.getElementById('addeventdiv').style.left = ( curr_width - 506 ) +"px"; } else { document.getElementById('addeventdiv').style.left = left +"px"; }     }      //M e g h í v ó ? if ( this.mkcEvents[eventi].invite == "1"){ if ( this.wuser != this.user ){ document.getElementById('addeventdivdelete').style.visibility= "hidden"; alert ("Nem a te meghívód!"+"wikiuser: "+this.wuser+" force user: "+this.user ) ; return; }       //alert("Ez egy meghívó vazze!"); document.getElementById('mkeawhat').readOnly       = true; document.getElementById('mkeawhentot').readOnly    = true; document.getElementById('mkeawhento').readOnly     = true; document.getElementById('mkeawhenyet').readOnly    = true; document.getElementById('mkeawhenyett').readOnly   = true; document.getElementById('mkeafday').disabled       = true; document.getElementById('mkearepeats').disabled    = true; document.getElementById('mkeawhere').readOnly      = true; document.getElementById('mkeadescr').readOnly      = true; document.getElementById('mkearemainder').disabled  = true; document.getElementById('mkearemainderm').disabled = true; document.getElementById('mkeapublic').disabled     = true; document.getElementById('mkeaeditg').style.visibility= "hidden"; //document.getElementById('addeventdivdelete').style.visibility= "hidden"; document.getElementById('addeventdivdeleteb').innerHTML = "Elutasít"; //document.getElementById('mkeasend2').style.visibility = 'visible'; if ( this.mkcEvents[eventi].isuseraccept( this.wuser ) ){ document.getElementById('mkeasend').value = 'Már elfogadtad!'; document.getElementById('mkeasend').disabled = true; } else { document.getElementById('mkeasend').value = 'Elfogad'; document.getElementById('mkeasend').disabled = false; }

for ( i=0; i<this.ausers.length; i++ ){ document.getElementById('guests'+i).disabled = true; if ( document.getElementById('mkeaguests').innerHTML.match( this.ausers[i] ) ) { document.getElementById('guests'+i).checked = true; if (this.wuser == this.ausers[i] ){ document.getElementById('guests'+i).disabled = false; }         }        }      } else { document.getElementById('mkeawhat').readOnly       = false; document.getElementById('mkeawhento').readOnly     = false; document.getElementById('mkeawhenyet').readOnly    = false; document.getElementById('mkeafday').disabled       = false; document.getElementById('mkearepeats').disabled    = false; document.getElementById('mkeawhere').readOnly      = false; document.getElementById('mkeadescr').readOnly      = false; document.getElementById('mkearemainder').disabled  = false; document.getElementById('mkeapublic').disabled     = false; document.getElementById('mkeaeditg').style.visibility= "visible"; document.getElementById('addeventdivdeleteb').innerHTML = "Töröl"; //document.getElementById('mkeasend2').style.visibility = 'hidden'; for ( i=0; i<this.ausers.length; i++ ){ //alert("this.ausers[i]: '"+this.ausers[i]+"'"); document.getElementById('guests'+i).disabled = false; document.getElementById('guests'+i).checked = false; if ( this.mkcEvents[eventi].guests.length > 0 ){ if ( this.mkcEvents[eventi].isuseringuests( this.ausers[i] ) ) { document.getElementById('guests'+i).checked = true; }          }        }      if ( this.mkcEvents[eventi].whento.substr(11)  == "00:00:00" &&           this.mkcEvents[eventi].whenyet.substr(11) == "23:59:59" ){ document.getElementById('mkeawhentot').readOnly = true; document.getElementById('mkeawhenyett').readOnly = true; document.getElementById('mkeafday').checked = true; } else { document.getElementById('mkeawhentot').readOnly = false; document.getElementById('mkeawhenyett').readOnly = false; document.getElementById('mkeafday').checked = false; }     if ( this.mkcEvents[eventi].remainder == "nothing") { document.getElementById('mkearemainderm').disabled = true; } else { document.getElementById('mkearemainderm').disabled = false; }     document.getElementById('mkeasend').value = 'Módosít'; document.getElementById('mkeasend').disabled = false; }   }

if ( top > (24*20*2)-h ) { top = (24*20*2)-h; } if ( left > curr_width-w ) { left = (24*20*2)-w; } //alert ("top: " + top + " left: " + left + " height: " + w);

document.getElementById('addeventdiv').style.visibility= "visible";

} //##################################################################################################  //##################################################################################################  this.add_edit_event_hide = function ( m ) {   var ccdate = mcald.getFullYear+"-"+monthphp(mcald.getMonth)+"-"+mcald.getDate; var query = //"user="       + this.user + "&" + "user="       + document.getElementById('mkeauser').value + "&" + "updater="    + this.wuser + "&" + "wuser="      + this.wuser + "&" + "id="         + document.getElementById('mkeaid').value + "&" + "what="       + document.getElementById('mkeawhat').value + "&" + "whento="     + document.getElementById('mkeawhento').value + " " + document.getElementById('mkeawhentot').value + "&" + "whenyet="    + document.getElementById('mkeawhenyet').value + " " + document.getElementById('mkeawhenyett').value + "&" + "erepeat="    + document.getElementById('mkearepeats').value + "&" + "ewhere="     + document.getElementById('mkeawhere').value + "&" + "description=" + document.getElementById('mkeadescr').value + "&" + "remainder="  + document.getElementById('mkearemainder').value + "&" + "remainderm=" + document.getElementById('mkearemainderm').value + "&" + "shared="     + document.getElementById('mkeapublic').value + "&" + "guests="     + document.getElementById('mkeaguestshidden').value + "&" + "submit="     + document.getElementById('mkeasend').value; document.getElementById('addeventdiv').style.visibility= "hidden"; document.getElementById('addeventdivdelete').style.visibility= "hidden"; document.getElementById('addeventdivguests').style.visibility= "hidden"; document.getElementById('mkeaeditg').style.visibility= "hidden"; //document.getElementById('mkeasend2').style.visibility = 'hidden'; if( m==1 ) { switch ( document.getElementById('mkeasend').value ){ case "Módosít": if ( this.user == document.getElementById('mkeauser').value){ MakeRequestEditNew( "update", query, ccdate, this.mode ); } else { alert("Általad nem módosítható az esemény."); }         break; case "Új eseményt ment": MakeRequestEditNew( "new", query, ccdate, this.mode ); break; case "Elfogad": //MakeRequest( "accept", ccdate, this.user, this.wuser, this.mode ); //alert("this.user: "+this.user+" this.wuser: "+this.wuser); MakeRequestEditNew( "accept", query, ccdate, this.mode ); break; }   }    if( m==-1 ) { if ( document.getElementById('addeventdivdeleteb').innerHTML == "Elutasít" ){ //MakeRequest( "denied", ccdate, this.user, this.wuser, this.mode ); MakeRequestEditNew( "denied", query, ccdate, this.mode ); } else { //alert("user: "+this.user+" wuser: "+this.wuser+" euser: " + document.getElementById('mkeauser').value); if( this.user == this.wuser ||           document.getElementById('mkeaupdater').value == this.wuser ){ var r=confirm("Biztos hogy TÖRLÖD az eseményt?"); if (r==true){ MakeRequestEditNew( "delete", query, ccdate, this.mode ); }       } else { alert("Nem törölheted az eseményt mivel nem a tiéd!"); return false; }

}   }    return false; } }

function addevents_from_response { var t = ajaxresponse.split("\n"); var i = 0; var sr = 0; for(i=0; i<t.length; i++){ var s = t[i].split("||"); //alert (s[0]); //mcal.addevent('Mkepler', 'valami1', '2009-07-21 09:00:00', '2009-07-21 10:00:00', 'doesnotrepeat', 'valahol1', 'valamiért1', 'popup', 'public' ); if ( s[0].length > 0 ) { if (s[0]=="event") { mcal.addevent(s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9], s[10], s[11], s[12], s[13], s[14] ); sr=i; }     if (s[0]=="guest") { //mcal.mkcEvents[$i].addguests(       mcal.mkcEvents[ mcal.mkcEvents.length - 1 ].addguests(s[1], s[2], s[3], s[4] );      }    }  } }

function mkc_pt_time(t){ return t.substr(11,5); }

function mkc_whento_z ( tol, ig ){ //01234567890123456789 //2009-07-20 06:00:00  //var ztol = new Date; var t = parseInt(tol.substr(11,2),10); var tm = parseInt(tol.substr(14,2),10); var i = parseInt(ig.substr(11,2),10); var im = parseInt(ig.substr(14,2),10); var r = Math.round( ((((60*i)+im)-((60*t)+tm))/60)*40); if ( r < 20 ) { r = 20;} return r-4; }

function mkc_whento_x ( w ){ var mydiv = document.getElementById("mkcalendar"); curr_width = mydiv.offsetWidth; var curr_width1 = Math.round( (curr_width-48) / 7); var d = new Date; var t = new Date; //d.setFullYear(mcald.getFullYear); //d.setMonth(mcald.getMonth); //d.setDate(mcald.getDate); d.setFullYear(mcald.getFullYear,mcald.getMonth,mcald.getDate); d.setHours(0,0,0); //01234567890123456789 //2009-07-20 06:00:00  //t.setFullYear( parseInt(w.substr(0,4),10) ); //t.setMonth(   parseInt(w.substr(5,2),10)-1 ); //t.setDate(    parseInt(w.substr(8,2),10) ); t.setFullYear(parseInt(w.substr(0,4),10),               parseInt(w.substr(5,2),10)-1,                parseInt(w.substr(8,2),10) ); t.setHours(0,0,0); s = cce(t.getDay) - cce(d.getDay); //alert(s); //var t = parseInt(w.substr(8,2),10); return (( s )*(curr_width1-3))+52; }

function mkc_whento_y ( w ){ //alert (w); //01234567890123456789 //2009-07-20 06:00:00 var t = parseInt(w.substr(11,2),10); var tm = parseInt(w.substr(14,2),10); //alert ( (((t*60)+tm)/60)*40 ); return (((t*60)+tm)/60)*40; }

function fillz ( n ) { var s = n + ""; if ( s.length>1) return s; if ( s.length==1) return "0"+s; }

function cce ( wd ) { if (wd == 0 ) { return 7; } return wd; }

function monthphp( wd ) { return wd + 1; }

function dstr_to_date ( dstr ){ var d = new Date; //0123456789012345678 //2009-07-25 13:00:00 --> java date object //d.setFullYear(dstr.substring(0,4)); //d.setMonth(dstr.substring(5,7)); //d.setDate(dstr.substring(8,10)); d.setFullYear(dstr.substring(0,4), dstr.substring(5,7), dstr.substring(8,10)); d.setHours(dstr.substring(11,13)); d.setMinutes(dstr.substring(14,16)); d.setSeconds(dstr.substring(17)); return d; }

function mkcmask ( tinput, mask ){ //alert (t.value, mask); return true; /// IDEIGLENESEN NEM CSINÁL SEMMIT!!!!!!!!! var st = ''; var i=0; var origi = tinput.value; var last = tinput.value.substr( tinput.value.length -1 ); tinput.value = origi.substr(0,mask.length);

//alert ( MyKeyID ); switch( MyKeyID ) { case 8: //alert ("backspace"); break; case 46: //alert ("del"); break; default: while (i < tinput.value.length && i < mask.length ){ if ( mask.substr(i,1) == "y" ){ if ( ! tinput.value.substr(i,1).match(/[0-9]/) ){ tinput.value = tinput.value.substr(0,i) + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == "m" ){ if ( ! tinput.value.substr(i,1).match(/[0-9]/) ){ tinput.value = tinput.value.substr(0,i) + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == "d" ){ if ( ! tinput.value.substr(i,1).match(/[0-9]/) ){ tinput.value = tinput.value.substr(0,i) + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == "9" ){ if ( ! tinput.value.substr(i,1).match(/[0-9]/) ){ tinput.value = tinput.value.substr(0,i) + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == "h" ){ if ( ! tinput.value.substr(i,1).match(/[0-9]/) ){ tinput.value = tinput.value.substr(0,i) + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == "i" ){ if ( ! tinput.value.substr(i,1).match(/[0-9]/) ){ tinput.value = tinput.value.substr(0,i) + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == "s" ){ if ( ! tinput.value.substr(i,1).match(/[0-9]/) ){ tinput.value = tinput.value.substr(0,i) + tinput.value.substr(i+1); }     }      //---      if ( mask.substr(i,1) == "." ){ if ( ! tinput.value.substr(i,1).match(/\./) ){ tinput.value = tinput.value.substr(0,i) + "." + last + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == "-" ){ if ( ! tinput.value.substr(i,1).match(/\-/) ){ tinput.value = tinput.value.substr(0,i) + "-" + last + tinput.value.substr(i+1); }     }      if ( mask.substr(i,1) == ":" ){ if ( ! tinput.value.substr(i,1).match(/\:/) ){ tinput.value = tinput.value.substr(0,i) + ":" + last + tinput.value.substr(i+1); }     }      i++; } }  //alert(i); return true; }

//-AJAX--- //##################################################################################################-- //##################################################################################################--

function getXMLHttp { var xmlHttp;

try {   //Firefox, Opera 8.0+, Safari xmlHttp = new XMLHttpRequest; } catch(e) {   //Internet Explorer try {     xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); }   catch(e) {     try {       xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }     catch(e) {       alert("Your browser does not support AJAX!"); return false; }   }  }  return xmlHttp; }

function MakeRequest( direction, keres, user, wuser, mode ) { var xmlHttp = getXMLHttp; xmlHttp.onreadystatechange = function {   if(xmlHttp.readyState == 4) {     HandleResponse(xmlHttp.responseText, direction, mode); } }  var st="mkc="+direction+"&std="+keres+"&user="+user+"&wuser="+wuser+"&mode="+mode; xmlHttp.open("GET", "/mediawiki/extensions/mkcalendar/mkcalendar.ajax.php?" + st + "", true); xmlHttp.send(null); }

function MakeRequestEditNew( muvelet, keres, cdate, mode ) { var xmlHttp = getXMLHttp; xmlHttp.onreadystatechange = function {   if(xmlHttp.readyState == 4) {     HandleResponse(xmlHttp.responseText, muvelet, mode); } }  var st="mkc="+muvelet+"&std="+cdate+"&"+keres+"&mode="+mode; xmlHttp.open("GET", "/mediawiki/extensions/mkcalendar/mkcalendar.ajax.php?" + st + "", true); xmlHttp.send(null); }

function HandleResponse(response, dir, mode ) { if ( mcal.debugmode ){ document.getElementById('ResponseDiv').innerHTML = response; } ajaxresponse = response; mcal.mkcEvents = []; addevents_from_response; mcal.drawcal(mode, dir); }