function SugarClass(){this.init();} SugarClass.prototype.init=function(){} SugarClass.inherit=function(className,parentClassName){var str=className+".prototype = new "+parentClassName+"();";str+=className+".prototype.constructor = "+className+";";str+=className+".superclass = "+parentClassName+".prototype;";try{eval(str);}catch(e){}} SugarClass.inherit("SugarContainer","SugarClass");function SugarContainer(root_div){GLOBAL_REGISTRY.container=this;this.init(root_div);} SugarContainer.prototype.init=function(root_div){this.root_div=root_div;SugarContainer.superclass.init.call(this);} SugarContainer.prototype.start=function(root_widget){this.root_widget=new root_widget();this.root_widget.load(this.root_div);} if(typeof(global_request_registry)=="undefined"){var global_request_registry=new Object();} var req_count=0;SugarClass.inherit("SugarDateTime","SugarClass");function SugarDateTime(){this.init(root_div);} SugarDateTime.prototype.init=function(root_div){this.root_div=root_div;} SugarDateTime.mysql2jsDateTime=function(mysql_date,mysql_time){var match=new RegExp(date_reg_format);if(((result=match.exec(mysql_date)))==null){return null;} var match2=new RegExp(time_reg_format);if((result2=match2.exec(mysql_time))==null){result2=[0,0,0,0];} var match3=/^0(\d)/;if((result3=match3.exec(result2[1]))!=null){result2[1]=result3[1];} if(typeof(result2[3])!='undefined'){if(result2[3]=='pm'||result2[3]=='PM'){if(parseInt(result2[1])!=12){result2[1]=parseInt(result2[1])+12;}} else if(result2[1]==12){result2[1]=0;}} return new Date(result[date_reg_positions['Y']],result[date_reg_positions['m']]-1,result[date_reg_positions['d']],result2[1],result2[2],0,0);} SugarDateTime.prototype.getFormattedDate=function(date_obj){var returnDate='';var userDateFormat=GLOBAL_REGISTRY['current_user']['fields']['date_time_format']['date'];var dow=GLOBAL_REGISTRY['calendar_strings']['dom_cal_weekdays_long'][date_obj.getDay()];var month=date_obj.getMonth()+1;month=GLOBAL_REGISTRY['calendar_strings']['dom_cal_month_long'][month];returnDate=dow;for(i=0;i<5;i++){switch(userDateFormat.charAt(i)){case"Y":returnDate+=" "+date_obj.getFullYear();break;case"m":returnDate+=" "+month;break;case"d":returnDate+=" "+date_obj.getDate();break;default:}} return returnDate;} SugarDateTime.getFormattedDate=SugarDateTime.prototype.getFormattedDate;SugarDateTime.prototype.getFormattedDOW=function(date_obj){var hour=config.strings.mod_strings.Calendar.dow[date_obj.getDay()];} SugarDateTime.getFormattedDOW=SugarDateTime.prototype.getFormattedDOW;SugarDateTime.getAMPM=function(date_obj){var hour=date_obj.getHour();var am_pm='AM';if(hour>12){hour-=12;am_pm='PM';} else if(hour==12){am_pm='PM';} else if(hour==0){hour=12;} return am_pm;} SugarDateTime.getFormattedHour=SugarDateTime.prototype.getFormattedHour;SugarDateTime.prototype.parseUTCDate=function(date_string){var match=/(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z/;if(((result=match.exec(date_string)))!=null){var new_date=new Date(Date.UTC(result[1],result[2]-1,result[3],result[4],result[5],parseInt(result[6])+time_offset));return new_date;}} SugarDateTime.parseUTCDate=SugarDateTime.prototype.parseUTCDate;SugarDateTime.prototype.parseAdjustedDate=function(date_string,dst_start,dst_end,gmt_offset_secs){var match=/(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z/;dst_start_parse=match.exec(dst_start);dst_end_parse=match.exec(dst_end);if(dst_start_parse==null||dst_end_parse==null){var new_date=new Date(result[1],result[2]-1,result[3],result[4],result[5],parseInt(result[6]));new_date=new Date(new_date.getTime()+gmt_offset_secs*1000);}else{dst_start_obj=new Date(dst_start_parse[1],dst_start_parse[2]-1,dst_start_parse[3],dst_start_parse[4],dst_start_parse[5],parseInt(dst_start_parse[6]));dst_end_obj=new Date(dst_end_parse[1],dst_end_parse[2]-1,dst_end_parse[3],dst_end_parse[4],dst_end_parse[5],parseInt(dst_end_parse[6]));if(((result=match.exec(date_string)))!=null){var new_date=new Date(result[1],result[2]-1,result[3],result[4],result[5],parseInt(result[6]));var event_ts=new_date.getTime();var dst_start_ts=dst_start_obj.getTime();var dst_end_ts=dst_end_obj.getTime();if(((event_ts>=dst_start_ts||event_tsdst_end_ts)||(event_ts>=dst_start_ts&&event_ts=0&&startmins<15){startdate.setUTCMinutes(0);} else if(startmins>=15&&startmins<30){startdate.setUTCMinutes(15);} else if(startmins>=30&&startmins<45){startdate.setUTCMinutes(30);} else{startdate.setUTCMinutes(45);} while(startdate.valueOf()';html+=''+GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+'';html+=''+GLOBAL_REGISTRY['meeting_strings']['LBL_PHONE']+'';html+=' ';html+='';for(var i=0;i';html+='';html+=''+bean.fields.full_name+'';html+=''+bean.fields.email1+'';html+=''+bean.fields.phone_work+'';html+='';hidden='visible';if(!disabled){} html+='';html+='';html+='';} html+='';div.innerHTML=html;} SugarWidgetListView.prototype.display_loading=function(){} SugarClass.inherit("SugarWidgetSchedulerSearch","SugarClass");function SugarWidgetSchedulerSearch(){this.init();} SugarWidgetSchedulerSearch.prototype.init=function(){this.form_id='scheduler_search';GLOBAL_REGISTRY['widget_element_map']=new Object();GLOBAL_REGISTRY['widget_element_map'][this.form_id]=this;GLOBAL_REGISTRY.scheduler_search_obj=this;} SugarWidgetSchedulerSearch.prototype.load=function(parentNode){this.parentNode=parentNode;this.display();} SugarWidgetSchedulerSearch.submit=function(form){SugarWidgetSchedulerSearch.hideCreateForm();var conditions=new Array();if(form.search_first_name.value!=''){conditions[conditions.length]={"name":"first_name","op":"starts_with","value":form.search_first_name.value}} if(form.search_last_name.value!=''){conditions[conditions.length]={"name":"last_name","op":"starts_with","value":form.search_last_name.value}} if(form.search_email.value!=''){conditions[conditions.length]={"name":"email1","op":"starts_with","value":form.search_email.value}} var query={"modules":["Users","Contacts","Leads"],"group":"and","field_list":['id','full_name','email1','phone_work'],"conditions":conditions};global_request_registry[req_count]=[this,'display'];req_id=global_rpcClient.call_method('query',query);global_request_registry[req_id]=[GLOBAL_REGISTRY['widget_element_map'][form.id],'refresh_list'];} SugarWidgetSchedulerSearch.prototype.refresh_list=function(rslt){GLOBAL_REGISTRY['result_list']=rslt['list'];if(rslt['list'].length>0){this.list_view.display();document.getElementById('empty-search-message').style.display='none';}else{document.getElementById('list_div_win').style.display='none';document.getElementById('empty-search-message').style.display='';}} SugarWidgetSchedulerSearch.prototype.display=function(){var html='

'+GLOBAL_REGISTRY['meeting_strings']['LBL_ADD_INVITEE']+'

';html+='
';html+='
';html+='' html+='';html+='';html+='';html+='';html+='';html+='
      
';html+='
';html+='
';this.parentNode.innerHTML+=html;var div=document.createElement('div');div.setAttribute('id','list_div_win');div.style.overflow='auto';div.style.width='100%';div.style.height='100%';div.style.display='none';this.parentNode.appendChild(div);html='';html+='
';html+='';html+='

'+GLOBAL_REGISTRY['meeting_strings']['LBL_CREATE_INVITEE']+'

';html+='
';html+=' ';html+=' ';html+='
';html+='';html+='
';this.parentNode.innerHTML+=html;addToValidate('createInviteeForm','last_name','last_name',true,GLOBAL_REGISTRY['meeting_strings']['LBL_LAST_NAME']);this.list_view=new SugarWidgetListView();this.list_view.load(div);} SugarWidgetSchedulerSearch.showCreateForm=function(module){document.getElementById('create-invitee-edit').style.display='';document.getElementById('create-invitees-buttons').style.display='none';document.getElementById('list_div_win').style.display='none';document.forms['createInviteeForm'].elements['inviteeModule'].value=module;document.getElementById('empty-search-message').style.display='none';if(typeof document.createInviteeForm.first_name!='undefined'&&typeof document.schedulerwidget.search_first_name!='undefined') document.createInviteeForm.first_name.value=document.schedulerwidget.search_first_name.value;if(typeof document.createInviteeForm.last_name!='undefined'&&typeof document.schedulerwidget.search_last_name!='undefined') document.createInviteeForm.last_name.value=document.schedulerwidget.search_last_name.value;if(typeof document.createInviteeForm.email1!='undefined'&&typeof document.schedulerwidget.search_email!='undefined') document.createInviteeForm.email1.value=document.schedulerwidget.search_email.value;} SugarWidgetSchedulerSearch.hideCreateForm=function(module){document.getElementById('create-invitee-edit').style.display='none';document.getElementById('create-invitees-buttons').style.display='';document.forms['createInviteeForm'].reset();} SugarWidgetSchedulerSearch.resetSearchForm=function(){if(GLOBAL_REGISTRY.scheduler_search_obj&&document.forms[GLOBAL_REGISTRY.scheduler_search_obj.form_id]){document.forms[GLOBAL_REGISTRY.scheduler_search_obj.form_id].reset();}} SugarWidgetSchedulerSearch.createInvitee=function(form){if(!(check_form('createInviteeForm'))){return false;} document.getElementById('create-invitee-btn').setAttribute('disabled','disabled');document.getElementById('cancel-create-invitee-btn').setAttribute('disabled','disabled');ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVING'));var callback={success:function(response){var rObj=eval("("+response.responseText+")");ajaxStatus.hideStatus();if(typeof rObj.noAccess!='undefined'){var alertMsg=GLOBAL_REGISTRY['meeting_strings']['LBL_NO_ACCESS'];alertMsg=alertMsg.replace("\$module",rObj.module);SugarWidgetSchedulerSearch.hideCreateForm();alert(alertMsg);return false;} GLOBAL_REGISTRY.focus.users_arr[GLOBAL_REGISTRY.focus.users_arr.length]=rObj;GLOBAL_REGISTRY.scheduler_attendees_obj.display();SugarWidgetSchedulerSearch.hideCreateForm();SugarWidgetSchedulerSearch.resetSearchForm();document.getElementById('create-invitee-btn').removeAttribute('disabled');document.getElementById('cancel-create-invitee-btn').removeAttribute('disabled');}};var fieldList=['id','full_name','email1','phone_work'];var t=[];for(i in fieldList){t.push("fieldList[]="+encodeURIComponent(fieldList[i]));} var postData=t.join("&");var url="index.php?module=Calendar&action=CreateInvitee&sugar_body_only=true";YAHOO.util.Connect.setForm(document.forms['createInviteeForm']);YAHOO.util.Connect.asyncRequest('POST',url,callback,postData);} SugarClass.inherit("SugarWidgetScheduler","SugarClass");function SugarWidgetScheduler(){this.init();} SugarWidgetScheduler.prototype.init=function(){} SugarWidgetScheduler.prototype.load=function(parentNode){this.parentNode=parentNode;this.display();} SugarWidgetScheduler.fill_invitees=function(form){for(var i=0;i';html+='';html+='';html+='';html+='';html+='';for(var i=0;i<(this.timeslots.length/this.segments);i++){var hours=this.timeslots[i*this.segments].date_obj.getHours();var am_pm='';if(time_reg_format.indexOf('A')>=0||time_reg_format.indexOf('a')>=0){am_pm="AM";if(hours>12){am_pm="PM";hours-=12;} if(hours==12){am_pm="PM";} if(hours==0){hours=12;am_pm="AM";} if(time_reg_format.indexOf('a')>=0){am_pm=am_pm.toLowerCase();} if(hours!=0&&hours!=12&&i!=0){am_pm="";}} var form_hours=hours+time_separator+"00";html+='';} html+='';html+='';html+='

'+top_date+'

 '+form_hours+am_pm+' 
';if(this.parentNode.childNodes.length<1) this.parentNode.innerHTML+='
'+html+'
';else this.parentNode.childNodes[0].innerHTML=html;var thetable="schedulerTable";if(typeof(GLOBAL_REGISTRY)=='undefined'){return;} if((typeof(GLOBAL_REGISTRY.focus.users_arr)=='undefined'||GLOBAL_REGISTRY.focus.users_arr.length==0)&&document.forms[form_name].record.value==''&&typeof(GLOBAL_REGISTRY.FIRST_REMOVE)=='undefined'){GLOBAL_REGISTRY.focus.users_arr=[GLOBAL_REGISTRY.current_user];} if(typeof GLOBAL_REGISTRY.focus.users_arr_hash=='undefined'){GLOBAL_REGISTRY.focus.users_arr_hash=new Object();} for(var i=0;i-1) {$('#add_parent_invitee').parent().css('display','');} else {$('#add_parent_invitee').parent().css('display','none');}} SugarWidgetSchedulerAttendees.formAddParent=function() {parent_id=$("#parent_id").val();parent_name=$("#parent_name").val();parent_type=$("#parent_type option:selected").text();if(parent_id.length>0&&$.inArray(parent_type,SugarWidgetSchedulerAttendees.allowedTypes)>-1) {invitee={fields:{id:parent_id,full_name:parent_name},module:parent_type};contains=false;for(var i=0;i ';td.innerHTML=img;td.innerHTML=td.innerHTML;if(this.focus_bean.fields.full_name) td.innerHTML+=' '+this.focus_bean.fields.full_name;else td.innerHTML+=' '+this.focus_bean.fields.name;this.add_freebusy_nodes(tr);var td=document.createElement('td');tr.appendChild(td);td.className='schedulerAttendeeDeleteCell';td.noWrap=true;td.innerHTML=' ' +''+GLOBAL_REGISTRY['meeting_strings']['LBL_REMOVE']+' ' +GLOBAL_REGISTRY['meeting_strings']['LBL_REMOVE']+'';this.element=tr;this.element_index=this.thetable.rows.length-1;},null,this);} SugarWidgetScheduleRow.deleteRow=function(bean_id){for(var i=0;i1){td.style.backgroundColor="#AA4D4D";}}}}}/* End of File modules/Meetings/jsclass_scheduler.js */