/********************************************************************************* * SugarCRM Community Edition is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc. * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU Affero General Public License version 3 as published by the * Free Software Foundation with the addition of the following permission added * to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK * IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY * OF NON INFRINGEMENT OF THIRD PARTY RIGHTS. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more * details. * * You should have received a copy of the GNU Affero General Public License along with * this program; if not, see http://www.gnu.org/licenses or write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301 USA. * * You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road, * SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * these Appropriate Legal Notices must retain the display of the "Powered by * SugarCRM" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by SugarCRM". ********************************************************************************/ SugarClass.inherit("SugarWidgetListView","SugarClass");function SugarWidgetListView(){this.init();} SugarWidgetListView.prototype.init=function(){} SugarWidgetListView.prototype.load=function(parentNode){this.parentNode=parentNode;this.display();} SugarWidgetListView.prototype.display=function(){if(typeof GLOBAL_REGISTRY['result_list']=='undefined'){this.display_loading();return;} var div=document.getElementById('list_div_win');div.style.display='block';var html='';html+='';html+='';html+='';html+='';html+='';html+='';html+='';for(var i=0;i';html+='';html+='';html+='';html+='';html+='';html+='';} html+='
 '+GLOBAL_REGISTRY['meeting_strings']['LBL_NAME']+''+GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+''+GLOBAL_REGISTRY['meeting_strings']['LBL_PHONE']+' 
'+bean.fields.full_name+''+bean.fields.email1+''+bean.fields.phone_work+'';hidden='visible';if(!disabled){} 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=document.createElement("div");html.setAttribute('class','schedulerInvitees');var h3=document.createElement("h3");h3.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_ADD_INVITEE'];html.appendChild(h3);var table1=document.createElement("table");table1.setAttribute('class','edit view');table1.setAttribute('border','0');table1.setAttribute('cellpadding','0');table1.setAttribute('cellspacing','0');table1.setAttribute('width','100%');var row1=table1.insertRow(0);var cell1=row1.insertCell(0);var form=document.createElement("form");form.setAttribute('name','schedulerwidget');form.setAttribute('id',this.form_id);form.setAttribute('onsubmit','SugarWidgetSchedulerSearch.submit(this);return false;');var table2=document.createElement("table");table2.setAttribute('border','0');table2.setAttribute('cellpadding','0');table2.setAttribute('cellspacing','0');table2.setAttribute('width','100%');var row2=table2.insertRow(0);var cell21=row2.insertCell(0);cell21.setAttribute('scope','col');cell21.setAttribute('nowrap','nowrap');var label1=document.createElement("label");label1.setAttribute('for','search_first_name');label1.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_FIRST_NAME']+':  ';cell21.appendChild(label1);var input1=document.createElement("input");input1.setAttribute('name','search_first_name');input1.setAttribute('id','search_first_name');input1.setAttribute('value','');input1.setAttribute('type','text');input1.setAttribute('size','10');cell21.appendChild(input1);var cell22=row2.insertCell(1);cell22.setAttribute('scope','col');cell22.setAttribute('nowrap','nowrap');var label2=document.createElement("label");label2.setAttribute('for','search_last_name');label2.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_LAST_NAME']+':  ';cell22.appendChild(label2);var input2=document.createElement("input");input2.setAttribute('name','search_last_name');input2.setAttribute('id','search_last_name');input2.setAttribute('value','');input2.setAttribute('type','text');input2.setAttribute('size','10');cell22.appendChild(input2);var cell23=row2.insertCell(2);cell23.setAttribute('scope','col');cell23.setAttribute('nowrap','nowrap');var label3=document.createElement("label");label3.setAttribute('for','search_email');label3.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+':  ';cell23.appendChild(label3);var input3=document.createElement("input");input3.setAttribute('name','search_email');input3.setAttribute('id','search_email');input3.setAttribute('value','');input3.setAttribute('type','text');input3.setAttribute('size','10');cell23.appendChild(input3);var cell24=row2.insertCell(3);cell24.setAttribute('valign','center');var input3=document.createElement("input");input3.setAttribute('class','button');input3.setAttribute('id','invitees_search');input3.setAttribute('value',GLOBAL_REGISTRY['meeting_strings']['LBL_SEARCH_BUTTON']);input3.setAttribute('type','submit');cell24.appendChild(input3);form.appendChild(table2);cell1.appendChild(form);html.appendChild(table1);this.parentNode.appendChild(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);var create_invitees=document.createElement("div");create_invitees.setAttribute('id','create-invitees');create_invitees.setAttribute('style','margin-bottom: 10px;');var empty_search_message=document.createElement("div");empty_search_message.setAttribute('id','empty-search-message');empty_search_message.setAttribute('style','display: none;');empty_search_message.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_EMPTY_SEARCH_RESULT'];create_invitees.appendChild(empty_search_message);var h3=document.createElement("h3");h3.setAttribute('id','create-invitees-title');h3.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_CREATE_INVITEE'];create_invitees.appendChild(h3);var create_invitees_buttons=document.createElement("div");create_invitees_buttons.setAttribute('id','create-invitees-buttons');var button1=document.createElement("button");button1.setAttribute('id','create_invitee_as_contact');button1.setAttribute('type','button');button1.setAttribute('onclick','SugarWidgetSchedulerSearch.showCreateForm(\'Contacts\');');button1.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_CREATE_CONTACT'];create_invitees_buttons.appendChild(button1);var button2=document.createElement("button");button2.setAttribute('id','create_invitee_as_lead');button2.setAttribute('type','button');button2.setAttribute('onclick','SugarWidgetSchedulerSearch.showCreateForm(\'Leads\');');button2.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_CREATE_LEAD'];create_invitees_buttons.appendChild(button2);create_invitees.appendChild(create_invitees_buttons);var create_invitee_edit=document.createElement("div");create_invitee_edit.setAttribute('id','create-invitee-edit');create_invitee_edit.setAttribute('style','display: none;');var form1=document.createElement("form");form1.setAttribute('name','createInviteeForm');form1.setAttribute('id','createInviteeForm');form1.setAttribute('onsubmit','SugarWidgetSchedulerSearch.createInvitee(this); return false;');var input4=document.createElement("input");input4.setAttribute('name','inviteeModule');input4.setAttribute('value','Contacts');input4.setAttribute('type','hidden');form1.appendChild(input4);var table3=document.createElement("table");table3.setAttribute('class','edit view');table3.setAttribute('cellpadding','0');table3.setAttribute('cellspacing','0');table3.setAttribute('style','width: 330px; margin-top: 2px;');var row3=table3.insertRow(0);var cell31=row3.insertCell(0);cell31.setAttribute('valign','top');cell31.setAttribute('width','33%');cell31.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_FIRST_NAME']+':';var cell32=row3.insertCell(1);cell32.setAttribute('valign','top');var input5=document.createElement("input");input5.setAttribute('name','first_name');input5.setAttribute('size','19');input5.setAttribute('type','text');cell32.appendChild(input5);var row4=table3.insertRow(1);var cell41=row4.insertCell(0);cell41.setAttribute('valign','top');cell41.setAttribute('width','33%');cell41.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_LAST_NAME']+':';var cell42=row4.insertCell(1);cell42.setAttribute('valign','top');var input6=document.createElement("input");input6.setAttribute('name','last_name');input6.setAttribute('size','19');input6.setAttribute('type','text');cell42.appendChild(input6);var row5=table3.insertRow(2);var cell51=row5.insertCell(0);cell51.setAttribute('valign','top');cell51.setAttribute('width','33%');cell51.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+':';var cell52=row5.insertCell(1);cell52.setAttribute('valign','top');var input7=document.createElement("input");input7.setAttribute('name','email1');input7.setAttribute('size','19');input7.setAttribute('type','text');cell52.appendChild(input7);form1.appendChild(table3);var button3=document.createElement("button");button3.setAttribute('id','create-invitee-btn');button3.setAttribute('type','button');button3.setAttribute('onclick','SugarWidgetSchedulerSearch.createInvitee(this.form);');button3.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_CREATE_AND_ADD'];form1.appendChild(button3);var button4=document.createElement("button");button4.setAttribute('id','cancel-create-invitee-btn');button4.setAttribute('type','button');button4.setAttribute('onclick','SugarWidgetSchedulerSearch.hideCreateForm();');button4.innerHTML=GLOBAL_REGISTRY['meeting_strings']['LBL_CANCEL_CREATE_INVITEE'];form1.appendChild(button4);create_invitee_edit.appendChild(form1);create_invitees.appendChild(create_invitee_edit);this.parentNode.appendChild(create_invitees);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 ';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";}}}}}