Hi,
I am trying to create a logic for updating a single occurrence from a recurring event, with IBM Domino database.
what do I need to send to the database?
- the new event
- the “hidden” event in the recurring pattern
I am not finding the new id given to the new event nor the information needed to hide the specific occurence.
function init() {
var eventTypeOptions = [ <Computed Value> ];
var xmlHttp;
try { xmlHttp=new XMLHttpRequest(); }
catch (e) { 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; }
}
}
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
document.getElementById("justaminute").innerHTML="";
var SB_DateFormat= "<Computed Value>"+" %H:%i"
var UPeList = [<Computed Value>];
var UTeList= [<Computed Value>];
var UPaList= [<Computed Value>];
var events = new String(xmlHttp.responseText);
var FormatDate = scheduler.date.date_to_str("<Computed Value>");
var FormatTime = scheduler.date.date_to_str("%H:%i");
var FormatXmlDate = scheduler.date.date_to_str("%d.%m.%Y %H:%i");
scheduler.templates.calendar_time = scheduler.date.date_to_str(SB_DateFormat);
scheduler.templates.event_bar_text = function(start, end, event) {
var ll=eventTypeOptions.length;
for(var j=0; j<ll; j++){ if(eventTypeOptions[j].key==event.event_type){var et=eventTypeOptions[j].label; break;} }
if (et!=null) {var TText = event.text+" ( <i>"+et+"</i> ) " + event.id ;} else {TText = event.text;}
return TText;
};
scheduler.xy.menu_width = 0;
scheduler.config.first_hour = 6;
scheduler.config.last_hour = 20;
scheduler.config.time_step = 15;
scheduler.config.event_duration = 60;
scheduler.config.limit_time_select = true;
// scheduler.config.hour_size_px = 43; //
scheduler.config.ajax_error="alert";
scheduler.config.xml_date= "%d.%m.%Y %H:%i";
scheduler.config.repeat_date = "<Computed Value>";
scheduler.config.api_date = SB_DateFormat;
scheduler.config.include_end_by = true;
scheduler.config.multi_day = false;
scheduler.config.repeat_precise = true;
scheduler.config.occurrence_timestamp_in_utc = true;
scheduler.config.details_on_dblclick = true;
scheduler.config.details_on_create = true;
scheduler.attachEvent("onClick",function(){ return false; }); //prevent editing outside lightbox
/* ------------------------------------------------------------------------------------------------------------------------------- */
scheduler.attachEvent("onBeforeEventChanged", function(ev, e, is_new, original){
if (is_new) { return true;}
if (!is_new) {
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) { return true; }
}
var ThisID = encodeURIComponent(original.id);
// Can't be original.id, where is the new id?
if (original.SBid.length>0) {var SBX = original.SBid; } // this is not working
else { var SBX = "IS_NEW"; alert('SBX = IS_NEW '); return false; }
var Subj = encodeURIComponent(ev.text);
var NT = encodeURIComponent(ev.event_type);
var SDate = FormatDate(ev.start_date);
var STime = FormatTime(ev.start_date);
var EDate = FormatDate(ev.end_date);
var ETime = FormatTime(ev.end_date);
var evLoc = encodeURIComponent(ev.event_loc);
var DoE = ""
if (ev.rec_type) {
DoE = FormatDate(ev._end_date);
var RecType = ev.rec_type;
if (RecType.length>0) {
if ( RecType.substring(RecType.length-1)!="#") { var Rep = encodeURIComponent(RecType);}
else { var Rep = encodeURIComponent(RecType +"#"+ document.forms[0].date_of_end.value); }
} else {var Rep = ""; }
} else { var Rep=""; }
var UPe = encodeURIComponent(ev.event_concerns);
var UTe = encodeURIComponent(ev.event_teams);
var UPa = encodeURIComponent(ev.event_partners);
var jj=Math.random()+"";
xmlHttp.open("GET",'UpdateCalendar?OpenAgent&Rand='+jj+'&ID=<Computed Value>&Language='+document.getElementById("TipLanguage").value+ '&DHX='+ThisID+'&SBX='+SBX+'&Subj='+Subj+'&NT='+NT+'&SD='+SDate+'&STime='+STime+'&ED='+EDate+'&ETime='+ETime+'&DoE='+DoE+'&Loc='+evLoc+'&Rep='+Rep+'&UPe='+UPe+'&UTe='+UTe+'&UPa='+UPa+'&PF='+PF+'&Stop=');
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlHttp.send();
return true;
}
});
/* ------------------------------------------------------------------------------------------------------------------------------- */
scheduler.attachEvent("onEventSave",function(id,ev,is_new){
var thisEvent = scheduler.getEvent(id);
if (!ev.text) { alert("<Computed Value>"); return false; }
if (is_new) { var SBX = "IS_NEW"; }
else { var SBX = thisEvent.SBid; }
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
var Res = new String(xmlHttp.responseText);
if (is_new) {
scheduler.getEvent(id).SBid = Res;
scheduler.updateEvent(id);
}
return true;
}
}
var Subj = encodeURIComponent(ev.text);
var NT = encodeURIComponent(ev.event_type);
var SDate = FormatDate(ev.start_date);
var STime = FormatTime(ev.start_date);
var EDate = FormatDate(ev.end_date);
var ETime = FormatTime(ev.end_date);
var evLoc = encodeURIComponent(ev.event_loc);
var DoE = ""
if (ev.rec_type) {
if (ev._end_date) { DoE = FormatDate(ev._end_date); }
var RecType = ev.rec_type;
if (RecType.length>0) {
if ( RecType=="none") { var Rep = RecType; }
else if ( RecType.substring(RecType.length-1)!="#" ) { var Rep = encodeURIComponent(RecType); }
else { var Rep = encodeURIComponent(RecType +"#"+ document.forms[0].date_of_end.value);
alert('DoE='+DoE+' RecType');
}
}
else { var Rep = "";
alert('DoE='+DoE+', ev.rec_type length=0 ');
}
}
else { var Rep="";
alert('DoE="'+DoE+'", ev.rec_type does not exist');
}
var UPe = encodeURIComponent(ev.event_concerns);
var UTe = encodeURIComponent(ev.event_teams);
var UPa = encodeURIComponent(ev.event_partners);
var jj=Math.random()+"";
xmlHttp.open("GET",'UpdateCalendar?OpenAgent&Rand='+jj+'&ID=<Computed Value>&Language='+document.getElementById("TipLanguage").value+ '&DHX='+id+'&SBX='+SBX+'&Subj='+Subj+'&NT='+NT+'&SD='+SDate+'&STime='+STime+'&ED='+EDate+'&ETime='+ETime+'&DoE='+DoE+'&Loc='+evLoc+'&Rep='+Rep+'&UPe='+UPe+'&UTe='+UTe+'&UPa='+UPa+'&PF='+PF+'&Stop=');
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded")
xmlHttp.send(null);
return true;
});
/* ------------------------------------------------------------------------------------------------------------------------------- */
scheduler.attachEvent("onConfirmedBeforeEventDelete", function(id,e){
var eve = scheduler.getEvent(id);
xmlHttp.onreadystatechange=function() {
if(xmlHttp.readyState==4) {
var Res = new String(xmlHttp.responseText); // alert('responsetext : ' + Res);
if (Res.indexOf("eventRemoved") > -1) { return true; }
else {return false;}
}
}
var jj=Math.random()+"";
xmlHttp.open("GET",'UpdateCalendarDelete?OpenAgent&Rand='+jj+'&SBID='+eve.SBid+'&Stop=');
xmlHttp.setRequestHeader("Content-type","application/x-www-form-urlencoded")
xmlHttp.send(null);
return true;
});
/* ------------------------------------------------------------------------------------------------------------------------------- */
scheduler.attachEvent("onLightbox", function(id){
var lightbox_form = scheduler.getLightbox(); // this will generate lightbox form
var inputs = lightbox_form.getElementsByTagName('input');
var date_of_end = null;
// var msg = ""
for (var i=0; i<inputs.length; i++) {
if (inputs[i].name == "date_of_end") {
date_of_end = inputs[i];
// break;
}
// msg = msg +"["+ i +"] (name: "+ inputs[i].name + ") value="+ inputs[i].value +"\n";
}
// alert(msg);
var repeat_end_date_format = scheduler.date.date_to_str(scheduler.config.repeat_date);
var show_minical = function(){
if (scheduler.isCalendarVisible())
scheduler.destroyCalendar();
else {
scheduler.renderCalendar({
position:date_of_end,
date: scheduler.getState().date,
navigation:true,
handler:function(date,calendar) {
date_of_end.value = repeat_end_date_format(date);
scheduler.destroyCalendar()
}
});
}
};
date_of_end.onclick = show_minical;
if(!scheduler._new_event) { document.forms[0].date_of_end.value = FormatDate( scheduler.getEvent(id)._end_date) ;}
$("#lb_concerns").autocomplete({ lookup: UPeList, delimiter: /(,|;)\s*/, width: 150 });
$("#lb_teams").autocomplete({ lookup: UTeList, delimiter: /(,|;)\s*/, width: 150 });
$("#lb_partners").autocomplete({ lookup: UPaList, delimiter: /(,|;)\s*/, width: 150 });
$("div.dhx_custom_button").css({ "width": "100px" });
$("div.dhx_cal_lsection").css({ "width": "115px" });
$("div.dhx_repeat_center").css({ "width": "320px" });
$("div.dhx_repeat_right").css({ "width": "190px" }); // not enough space for finnish and swedish words
});
/* ------------------------------------------------------------------------------------------------------------------------------- */
scheduler.attachEvent("onBeforeLightbox", function(id){
var ev = scheduler.getEvent(id);
if(scheduler._new_event){
ev.start_date.setHours(9);
ev.end_date.setHours(10);
ev.event_concerns = "<Computed Value>";
}
// if(!scheduler._new_event&ev._end_date){ alert('ev._end_date: '+ev._end_date); }
return true;
});
/* ------------------------------------------------------------------------------------------------------------------------------- */
// scheduler.attachEvent("onAfterLightbox", function (){
// var recdates = JSON.stringify( scheduler.getRecDates(4) );
// alert('rec dates: ' + recdates );
// return false;
// });
/* ------------------------------------------------------------------------------------------------------------------------------- */
scheduler.locale.labels.section_type = "<Computed Value>";
scheduler.locale.labels.section_location = "<Computed Value>";
scheduler.locale.labels.section_lb_concerns = v91_Concerns; // "<Computed Value>";
scheduler.locale.labels.section_lb_teams = "<Computed Value>";
scheduler.locale.labels.section_lb_partners = "<Computed Value>";
scheduler.form_blocks["autocompleted"] = {
render:function(sns) {
var ACA = "<div class='dhx_cal_ltext' style='height:30px;'> <input id='"+sns.name+"' type='text' style='width:80%;'></div> ";
return ACA;
},
set_value:function(node, value, ev) {
node.childNodes[1].value = value || "";
},
get_value:function(node, ev) {
return node.childNodes[1].value;
},
focus:function(node) {
var a = node.childNodes[1];
a.select();
a.focus();
}
};
scheduler.config.lightbox.sections=[
{name:"description", height:50, map_to:"text", type:"textarea", focus:true},
{name:"type", height:24, map_to:"event_type", type:"select", options:eventTypeOptions },
{name:"location", height:24, map_to:"event_loc", type:"textarea"},
{name:"lb_concerns", height:30, map_to:"event_concerns", type:"autocompleted"},
{name:"lb_teams", height:30, map_to:"event_teams", type:"autocompleted"},
{name:"lb_partners", height:30, map_to:"event_partners", type:"autocompleted"},
{name:"recurring", height:115, type:"recurring", map_to:"rec_type", button:"recurring"},
{name:"time", height:72, type:"calendar_time", map_to:"auto"}
];
scheduler.init('scheduler_here',new Date(),"month");
scheduler.parse( decodeURIComponent( events.substring(0, events.length-1)), "json");
return true;
}
else {
var waitsymbol="<br><img src='busy.gif' width=18px height=18px >";
document.getElementById("justaminute").innerHTML=waitsymbol;
}
}
var jj=Math.random()+"";
xmlHttp.open("GET", 'GetCalendarData?OpenAgent&Rand='+jj+'&ID=<Computed Value>&Language='+document.getElementById("TipLanguage").value+'&PF='+PF+'&Stop=');
xmlHttp.send(null);
}
pls, help me to the right direction, thanks