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

📄 subpaneltiles.js

📁 SugarCRM5.1 开源PHP客户关系管理系统
💻 JS
📖 第 1 页 / 共 2 页
字号:
/** * SubPanelTiles javascript file * * 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". */ var request_id = 0;var current_child_field = '';var current_subpanel_url = '';var child_field_loaded = new Object();var request_map = new Object();function get_module_name(){	if(typeof(window.document.forms['DetailView']) == 'undefined') {		return '';	} else {			//check to see if subpanel_parent_module input exists.  If so override module name		//this is used in the case when the subpanel contents are of the same module as the current module		//and the record in $_REQUEST is of the parent object.  By specifying the subpanel_parent_module,		//you allow normal processing to continue.  For an example, see trackdetailview.html/php in campaigns module		if(typeof(window.document.forms['DetailView'].elements['subpanel_parent_module']) != 'undefined' &&		window.document.forms['DetailView'].elements['subpanel_parent_module'].value != ''){			return window.document.forms['DetailView'].elements['subpanel_parent_module'].value;		}		return window.document.forms['DetailView'].elements['module'].value;	}}/*this function will take in three parameters, m,i,a and recreate navigation* m = module* i = record id* a = action (detail/edit)* This is done to minimize page size* */function subp_nav(m,i,a,t){	if(t.href.search(/#/) < 0){		//no need to process if url has already been converted		return;	}	if(a=='d'){		a='DetailView';	}else{		a='EditView';	}	url = "index.php?module="+m+"&action="+a+"&record="+i+"&parent_module="+get_module_name()+"&parent_id="+get_record_id()+"&return_module="+get_module_name()+"&return_id="+get_record_id()+"&return_action=DetailView";	t.href = url;}/*this function will take in three parameters, m,i,a and recreate navigation* m = module* i = record id* a = action (detail/edit)* This is done to minimize page size* */function sub_p_rem(sp,lf,li,rp){	return_url = "index.php?module="+get_module_name()+"&action=SubPanelViewer&subpanel="+sp+"&record="+get_record_id()+"&sugar_body_only=1&inline=1";	remove_url = "index.php?module="+ get_module_name()			+ "&action=DeleteRelationship"			+ "&record="+ get_record_id()			+ "&linked_field="+ lf  //$linked_field"			+ "&linked_id="+ li //$record"			+ "&return_url=" + escape(escape(return_url))			+ "&refresh_page=" + rp;//$refresh_page"	showSubPanel(sp,remove_url,true);}function sp_rem_conf(){	return confirm(SUGAR.language.get('app_strings', 'NTC_REMOVE_CONFIRMATION'))}function get_record_id(){	return window.document.forms['DetailView'].elements['record'].value;}function get_layout_def_key(){	if(typeof(window.document.forms['DetailView'].elements['layout_def_key']) == 'undefined')return '';	return window.document.forms['DetailView'].elements['layout_def_key'].value;}function save_finished(args){	var child_field = request_map[args.request_id];	delete (child_field_loaded[child_field] );	showSubPanel(child_field);}function set_return_and_save_background(popup_reply_data){	var form_name = popup_reply_data.form_name;	var name_to_value_array = popup_reply_data.name_to_value_array;	var passthru_data = popup_reply_data.passthru_data;	// construct the POST request	var query_array =  new Array();	if (name_to_value_array != 'undefined') {		for (var the_key in name_to_value_array)		{			if(the_key == 'toJSON')			{				/* just ignore */			}			else			{				query_array.push(the_key+"="+name_to_value_array[the_key]);			}		}	}  	//construct the muulti select list	var selection_list = popup_reply_data.selection_list;	if (selection_list != 'undefined') {		for (var the_key in selection_list)		{			query_array.push('subpanel_id[]='+selection_list[the_key])		}  		}	var module = get_module_name();	var id = get_record_id();	query_array.push('value=DetailView');	query_array.push('module='+module);	query_array.push('http_method=get');	query_array.push('return_module='+module);	query_array.push('return_id='+id);	query_array.push('record='+id);	query_array.push('isDuplicate=false');	query_array.push('action=Save2');	query_array.push('inline=1');	var refresh_page = escape(passthru_data['refresh_page']);	for (prop in passthru_data) {		if (prop=='link_field_name') {			query_array.push('subpanel_field_name='+escape(passthru_data[prop]));			} else {			if (prop=='module_name') {				query_array.push('subpanel_module_name='+escape(passthru_data[prop]));				} else {				query_array.push(prop+'='+escape(passthru_data[prop]));				}		}	}		var query_string = query_array.join('&');	request_map[request_id] = passthru_data['child_field'];	var returnstuff = http_fetch_sync('index.php',query_string);	request_id++; 	got_data(returnstuff, true); 	if(refresh_page == 1){ 		document.location.reload(true); 	}}function got_data(args, inline){	var list_subpanel = document.getElementById('list_subpanel_'+request_map[args.request_id].toLowerCase());	//this function assumes that we are always working with a subpanel..	//add a null check to prevent failures when we are not.	if (list_subpanel != null) {		var subpanel = document.getElementById('subpanel_'+request_map[args.request_id].toLowerCase());		var child_field = request_map[args.request_id].toLowerCase();		if(inline){			child_field_loaded[child_field] = 2;			list_subpanel.innerHTML='';			list_subpanel.innerHTML=args.responseText;		}else{			child_field_loaded[child_field] = 1;			subpanel.innerHTML='';			subpanel.innerHTML=args.responseText;						/* walk into the DOM and insert the list_subpanel_* div */			var inlineTable = subpanel.getElementsByTagName('table');			inlineTable = inlineTable[1];			inlineTable = subpanel.removeChild(inlineTable);			var listDiv = document.createElement('div');			listDiv.id = 'list_subpanel_'+request_map[args.request_id].toLowerCase();			subpanel.appendChild(listDiv);			listDiv.appendChild(inlineTable);		}		subpanel.style.display = '';		set_div_cookie(subpanel.cookie_name, '');		if (current_child_field != '' && child_field != current_child_field)		{			// commented out for now.  this was originally used by tab UI of subpanels			//hideSubPanel(current_child_field);		}		current_child_field = child_field;	}}function showSubPanel(child_field,url,force_load){	var inline = 1;	if ( typeof(force_load) == 'undefined')	{		force_load = false;	}		if (force_load || typeof( child_field_loaded[child_field] ) == 'undefined')	{		request_map[request_id] = child_field;		if ( typeof (url) == 'undefined' || url == null)		{			var module = get_module_name();			var id = get_record_id();			var layout_def_key = get_layout_def_key();						url = 'index.php?sugar_body_only=1&module='+module+'&subpanel='+child_field+'&action=SubPanelViewer&inline=' + inline + '&record='+id + '&layout_def_key='+ layout_def_key;		}		if ( url.indexOf('http://') != 0  && url.indexOf('https://') != 0)		{			url = ''+url ;		}		current_subpanel_url = url;		// http_fetch_async(url,got_data,request_id++);		var returnstuff = http_fetch_sync(url+ '&inline=' + inline + '&ajaxSubpanel=true');		request_id++;		got_data(returnstuff, inline);	}	else	{		var subpanel = document.getElementById('subpanel_'+child_field);		subpanel.style.display = '';				set_div_cookie(subpanel.cookie_name, '');		if (current_child_field != '' && child_field != current_child_field)		{			hideSubPanel(current_child_field);		}		current_child_field = child_field;	}	if(typeof(url) != 'undefined' && url.indexOf('refresh_page=1') > 0){		document.location.reload();	}}function markSubPanelLoaded(child_field){	child_field_loaded[child_field] = 2;}function hideSubPanel(child_field){	var subpanel = document.getElementById('subpanel_'+child_field);	subpanel.style.display = 'none';	set_div_cookie(subpanel.cookie_name, 'none');}var sub_cookie_name = get_module_name() + '_divs';var temp = Get_Cookie(sub_cookie_name);var div_cookies = new Array();if(temp && typeof(temp) != 'undefined'){	div_cookies = get_sub_cookies(temp);}function set_div_cookie(name, display){	div_cookies[name] = display;	Set_Cookie(sub_cookie_name, subs_to_cookie(div_cookies), 3000, false, false,false);}function local_open_popup(name, width, height,arg1, arg2, arg3, params){	return open_popup(name, width, height,arg1,arg2,arg3, params);}SUGAR.subpanelUtils = function() {	var originalLayout = null;	var subpanelContents = {};	var subpanelLocked = {};			return {		// get the current subpanel layout		getLayout: function(asString, ignoreHidden) {		    subpanels = document.getElementById('subpanel_list');		    subpanelIds = new Array();		    for(wp = 0; wp < subpanels.childNodes.length; wp++) {		      if(typeof subpanels.childNodes[wp].id != 'undefined' && subpanels.childNodes[wp].id.match(/whole_subpanel_[\w-]*/) && (typeof ignoreHidden == 'undefined' || subpanels.childNodes[wp].style.display != 'none')) {				subpanelIds.push(subpanels.childNodes[wp].id.replace(/whole_subpanel_/,''));		      }		    }			if(asString) return subpanelIds.join(',');			else return subpanelIds;		},		// called when subpanel is picked up		onDrag: function(e, id) {

⌨️ 快捷键说明

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