⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jsclass_scheduler.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
/** * SugarCRM is a customer relationship management program developed by * SugarCRM, Inc. Copyright (C) 2004 - 2007 SugarCRM Inc. *  * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU 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 General Public License for more * details. *  * You should have received a copy of the GNU 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 General Public License version 3. *  * In accordance with Section 7(b) of the GNU 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". *///////////////////////////////////////////////////// class: SugarWidgetListView// widget to display a list view////////////////////////////////////////////////////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';	//div.style.height='125px';	var html = '<table width="100%" cellpadding="0" cellspacing="0" border="0" class="listView">';	html += '<tr>';	html += '<td scope="col" width="2%" class="listViewThS1" NOWRAP>&nbsp;</td>';	html += '<td scope="col" width="20%" class="listViewThS1" NOWRAP>'+GLOBAL_REGISTRY['meeting_strings']['LBL_NAME']+'</td>';	html += '<td scope="col" width="20%" class="listViewThS1" NOWRAP>'+GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+'</td>';	html += '<td scope="col" width="20%" class="listViewThS1" NOWRAP>'+GLOBAL_REGISTRY['meeting_strings']['LBL_PHONE']+'</td>';	html += '<td scope="col" width="18%" class="listViewThS1" NOWRAP>&nbsp;</td>';	html += '</tr>';	//var html = '<table width="100%" cellpadding="0" cellspacing="0">';	for(var i=0;i<GLOBAL_REGISTRY['result_list'].length;i++) {		var bean = GLOBAL_REGISTRY['result_list'][i];		var disabled = false;		var className='schedulerEvenListRow';		if(typeof(GLOBAL_REGISTRY.focus.users_arr_hash[ bean.fields.id]) != 'undefined') {			disabled = true;		}		if((i%2) == 0) {			className='schedulerOddListRow';		} else {			className='schedulerEvenListRow';		}		if(typeof (bean.fields.first_name) == 'undefined') {			bean.fields.first_name = '';		}		if(typeof (bean.fields.email1) == 'undefined') {			bean.fields.email1 = '';		}		if(typeof (bean.fields.phone_work) == 'undefined') {			bean.fields.phone_work = '';		}		html += '<tr class="'+className+'">';//		html += '<td class="'+className+'"><img src="'+GLOBAL_REGISTRY.config['site_url']+'/themes/'+GLOBAL_REGISTRY.current_user.theme+'/images/'+bean.module+'s.gif"/></td>';		html += '<td class="'+className+'"><img src="'+GLOBAL_REGISTRY.config['site_url']+'/themes/default/images/'+bean.module+'s.gif"/></td>';		html += '<td class="'+className+'">'+bean.fields.full_name+'</td>';		html += '<td class="'+className+'">'+bean.fields.email1+'</td>';		html += '<td class="'+className+'">'+bean.fields.phone_work+'</td>';		html += '<td class="'+className+'" align="right">';		//	hidden = 'hidden';		hidden = 'visible';		if(!disabled) {			//	hidden = 'visible';		}		html += '<input type="button" class="button" onclick="this.disabled=true;SugarWidgetSchedulerAttendees.form_add_attendee('+i+');" value="'+GLOBAL_REGISTRY['meeting_strings']['LBL_ADD_BUTTON']+'"/ style="visibility: '+hidden+'"/>';		html += '</td>';		html += '</tr>';		html += '<tr><td colspan="20" class="listViewHRS1"></td></tr>';	}	html += '</table>';	this.parentNode.innerHTML = html;}SugarWidgetListView.prototype.display_loading = function() {}//////////////////////////////////////////////////// class: SugarWidgetSchedulerSearch// widget to display the meeting scheduler search box////////////////////////////////////////////////////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;}SugarWidgetSchedulerSearch.prototype.load = function(parentNode) {	this.parentNode = parentNode;	this.display();}SugarWidgetSchedulerSearch.submit = function(form) {	//construct query obj:	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"],"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'];	this.list_view.display();}SugarWidgetSchedulerSearch.prototype.display = function() {	var html ='<br/><h5 class="listViewSubHeadS1">'+GLOBAL_REGISTRY['meeting_strings']['LBL_ADD_INVITEE']+'</h5><table border="0" cellpadding="0" cellspacing="0" width="100%" class="tabForm">';	html +='<tr><td>';	html += '<form name="schedulerwidget" id="'+this.form_id+'" onsubmit="SugarWidgetSchedulerSearch.submit(this);return false;">';	html += '<table width="100%" cellpadding="0" cellspacing="0" width="100%" >'	html += '<tr>';	//html += '<form id="'+this.form_id+'"><table width="100%"><tbody><tr>';	html += '<td class="dataLabel" nowrap><b>'+GLOBAL_REGISTRY['meeting_strings']['LBL_FIRST_NAME']+':</b>&nbsp;&nbsp;<input class="dataField" name="search_first_name" value="" type="text" size="10"></td>';	html += '<td class="dataLabel" nowrap><b>'+GLOBAL_REGISTRY['meeting_strings']['LBL_LAST_NAME']+':</b>&nbsp;&nbsp;<input class="dataField" name="search_last_name" value="" type="text" size="10"></td>';	html += '<td class="dataLabel" nowrap><b>'+GLOBAL_REGISTRY['meeting_strings']['LBL_EMAIL']+':</b>&nbsp;&nbsp;<input class="dataField" name="search_email" type="text" value="" size="15"></td>';	//html += '<td valign="center"><input type="submit" onclick="SugarWidgetSchedulerSearch.submit(this.form);" value="Search" ></td></tr></tbody></table></form>';	html += '<td valign="center"><input type="submit" class="button" value="'+GLOBAL_REGISTRY['meeting_strings']['LBL_SEARCH_BUTTON']+'" ></td></tr>';	html += '</table>';	html += '</form>';	html += '</td></tr></table>';	// append the list_view as the third row of the outside table	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= '125px';	div.style.display = 'none';	this.list_view = new SugarWidgetListView();	this.list_view.load(div);	this.parentNode.appendChild(document.createElement('br'));	this.parentNode.appendChild(div);}//////////////////////////////////////////////////// class: SugarWidgetScheduler// widget to display the meeting scheduler////////////////////////////////////////////////////SugarClass.inherit("SugarWidgetScheduler","SugarClass");function SugarWidgetScheduler() {	this.init();}SugarWidgetScheduler.prototype.init = function() {	//var row = new	SugarWidgetScheduleAttendees();	//row.load(this);}SugarWidgetScheduler.prototype.load = function(parentNode) {	this.parentNode = parentNode;	this.display();}SugarWidgetScheduler.fill_invitees = function(form) {	for(var i=0;i<GLOBAL_REGISTRY.focus.users_arr.length;i++) {		if(GLOBAL_REGISTRY.focus.users_arr[i].module == 'User') {			form.user_invitees.value += GLOBAL_REGISTRY.focus.users_arr[i].fields.id + ",";		} else if(GLOBAL_REGISTRY.focus.users_arr[i].module == 'Contact') {			form.contact_invitees.value += GLOBAL_REGISTRY.focus.users_arr[i].fields.id + ",";		}	}}SugarWidgetScheduler.update_time = function() {	var date_start = document.EditView.date_start.value;	var hour_start = parseInt(date_start.substring(11,13), 10);	var minute_start = parseInt(date_start.substring(14,16), 10);	var has_meridiem = /am|pm/i.test(date_start);	if(has_meridiem) {	var meridiem = trim(date_start.substring(16));	}	GLOBAL_REGISTRY.focus.fields.date_start = date_start;	if(has_meridiem) {		GLOBAL_REGISTRY.focus.fields.time_start = hour_start + time_separator + minute_start + meridiem;	} else {		GLOBAL_REGISTRY.focus.fields.time_start = hour_start + time_separator + minute_start;	}	GLOBAL_REGISTRY.focus.fields.duration_hours = document.EditView.duration_hours.value;	GLOBAL_REGISTRY.focus.fields.duration_minutes = document.EditView.duration_minutes.value;	GLOBAL_REGISTRY.focus.fields.datetime_start = SugarDateTime.mysql2jsDateTime(GLOBAL_REGISTRY.focus.fields.date_start,GLOBAL_REGISTRY.focus.fields.time_start);	GLOBAL_REGISTRY.scheduler_attendees_obj.init();	GLOBAL_REGISTRY.scheduler_attendees_obj.display();}SugarWidgetScheduler.prototype.display = function() {	var table = document.createElement('table');	table.width="100%";	table.border="0";	table.cellspacing="0";	var tr = table.insertRow(table.rows.length);	var td = tr.insertCell(tr.cells.length);	//	td.appendChild(document.createTextNode('dflkj'));	var attendees = new SugarWidgetSchedulerAttendees();	attendees.load(td);	var tr = table.insertRow(table.rows.length);	var td = tr.insertCell(tr.cells.length);	var search = new SugarWidgetSchedulerSearch();	search.load(td);	if(this.parentNode.childNodes.length == 0) {		this.parentNode.appendChild(table);	} else {		this.parentNode.replaceChild(table,this.parentNode.childNodes[0]);	}}//////////////////////////////////////////////////// class: SugarWidgetSchedulerAttendees// widget to display the meeting attendees and availability////////////////////////////////////////////////////SugarClass.inherit("SugarWidgetSchedulerAttendees","SugarClass");function SugarWidgetSchedulerAttendees() {	this.init();}SugarWidgetSchedulerAttendees.prototype.init = function() {	// this.datetime = new SugarDateTime();	GLOBAL_REGISTRY.scheduler_attendees_obj = this;	var date_start = document.EditView.date_start.value;	var hour_start = parseInt(date_start.substring(11,13), 10);	var minute_start = parseInt(date_start.substring(14,16), 10);	var has_meridiem = /am|pm/i.test(date_start);	if(has_meridiem) {	var meridiem = trim(date_start.substring(16));	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -