mirror of
https://github.com/salesagility/SuiteCRM.git
synced 2025-03-16 22:33:34 +00:00
reformat code and update license headers
This commit is contained in:
parent
d5ccac53a1
commit
64a653eb41
24 changed files with 8156 additions and 8322 deletions
include
SubPanel
SugarCharts/Jit/js
SugarFields/Fields/Collection
javascript
jssource/src_files
include
MySugar/javascript
SubPanel
SugarCharts/Jit/js
SugarDependentDropdown/javascript
SugarFields/Fields/Collection
javascript
ytree
modules
modules
|
@ -36,13 +36,11 @@
|
|||
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
|
||||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
*/
|
||||
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{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;}
|
||||
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{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;}}
|
||||
function subp_nav(m,i,a,t,r){if(t.href.search(/#/)<0){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";if(r)
|
||||
{url+="&return_relationship="+r;}
|
||||
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";if(r){url+="&return_relationship="+r;}
|
||||
t.href=url;}
|
||||
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"
|
||||
|
@ -58,51 +56,32 @@ function sub_p_del(sp,submod,subrec,rp){return_url="index.php?module="+get_modul
|
|||
+"&return_url="+escape(return_url)
|
||||
+"&refresh_page="+rp;showSubPanel(sp,remove_url,true);}
|
||||
function sp_del_conf(){return confirm(SUGAR.language.get('app_strings','NTC_DELETE_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;var select_entire_list=typeof(popup_reply_data.select_entire_list)=='undefined'?0:popup_reply_data.select_entire_list;var current_query_by_page=popup_reply_data.current_query_by_page;var query_array=new Array();if(name_to_value_array!='undefined'){for(var the_key in name_to_value_array)
|
||||
{if(the_key=='toJSON')
|
||||
{}
|
||||
else
|
||||
{query_array.push(the_key+"="+name_to_value_array[the_key]);}}}
|
||||
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])}}
|
||||
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;var select_entire_list=typeof(popup_reply_data.select_entire_list)=='undefined'?0:popup_reply_data.select_entire_list;var current_query_by_page=popup_reply_data.current_query_by_page;var query_array=new Array();if(name_to_value_array!='undefined'){for(var the_key in name_to_value_array){if(the_key=='toJSON'){}
|
||||
else{query_array.push(the_key+"="+name_to_value_array[the_key]);}}}
|
||||
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');query_array.push('select_entire_list='+select_entire_list);if(select_entire_list==1){query_array.push('current_query_by_page='+current_query_by_page);}
|
||||
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 if(prop=='prospect_ids'){for(var i=0;i<passthru_data[prop].length;i++){query_array.push(prop+'[]='+escape(passthru_data[prop][i]));}}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++;if(typeof returnstuff!='undefined'&&typeof returnstuff.responseText!='undefined'&&returnstuff.responseText.length!=0){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());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;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);}
|
||||
SUGAR.util.evalScript(args.responseText);subpanel.style.display='';set_div_cookie(subpanel.cookie_name,'');if(current_child_field!=''&&child_field!=current_child_field)
|
||||
{}
|
||||
function got_data(args,inline){var list_subpanel=document.getElementById('list_subpanel_'+request_map[args.request_id].toLowerCase());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;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);}
|
||||
SUGAR.util.evalScript(args.responseText);subpanel.style.display='';set_div_cookie(subpanel.cookie_name,'');if(current_child_field!=''&&child_field!=current_child_field){}
|
||||
current_child_field=child_field;$("ul.clickMenu").each(function(index,node){$(node).sugarActionMenu();});}}
|
||||
function showSubPanel(child_field,url,force_load,layout_def_key)
|
||||
{var inline=1;if(typeof(force_load)=='undefined'||force_load==null)
|
||||
{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();if(typeof(layout_def_key)=='undefined'||layout_def_key==null){layout_def_key=get_layout_def_key();}
|
||||
function showSubPanel(child_field,url,force_load,layout_def_key){var inline=1;if(typeof(force_load)=='undefined'||force_load==null){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();if(typeof(layout_def_key)=='undefined'||layout_def_key==null){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;}
|
||||
if(url.indexOf('http://')!=0&&url.indexOf('https://')!=0){url=''+url;}
|
||||
current_subpanel_url=url;var returnstuff=http_fetch_sync(url+'&inline='+inline+'&ajaxSubpanel=true');request_id++;got_data(returnstuff,inline);$('#whole_subpanel_'+child_field+' .table-responsive').footable();}
|
||||
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);}
|
||||
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!=null&&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');}
|
||||
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);}
|
||||
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,subpanelContents={},subpanelLocked={},currentPanelDiv;return{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;},onDrag:function(e,id){originalLayout=SUGAR.subpanelUtils.getLayout(true,true);},onDrop:function(e,id){newLayout=SUGAR.subpanelUtils.getLayout(true,true);if(originalLayout!=newLayout){SUGAR.subpanelUtils.saveLayout(newLayout);}},saveLayout:function(order){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVING_LAYOUT'));if(typeof SUGAR.subpanelUtils.currentSubpanelGroup!='undefined'){var orderList=SUGAR.subpanelUtils.getLayout(false,true);var currentGroup=SUGAR.subpanelUtils.currentSubpanelGroup;}
|
||||
var success=function(data){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVED_LAYOUT'));window.setTimeout('ajaxStatus.hideStatus()',2000);if(typeof SUGAR.subpanelUtils.currentSubpanelGroup!='undefined'){SUGAR.subpanelUtils.reorderSubpanelSubtabs(currentGroup,orderList);}}
|
||||
|
@ -115,27 +94,20 @@ if(savedModule!=''){savedModule='_'+savedModule;}
|
|||
savedModule=parts[i]+savedModule;if(window.ModuleSubPanels&&window.ModuleSubPanels[savedModule]){subPanels=subPanels.concat(window.ModuleSubPanels[savedModule]);}}
|
||||
for(var i=0;i<subPanels.length;i++){showSubPanel(subPanels[i],null,true);}
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_SAVED'));window.setTimeout('ajaxStatus.hideStatus()',1000);for(var i=0;i<saveButton.length;i++){saveButton[i].disabled=false;}}}
|
||||
YAHOO.util.Connect.setForm(theForm,true,true);var cObj=YAHOO.util.Connect.asyncRequest('POST','index.php',{success:success,failure:success,upload:success});return false;},sendAndRetrieve:function(theForm,theDiv,loadingStr){var quickCreateDiv=YAHOO.util.Selector.query("div.quickcreate",null,true);if(quickCreateDiv)
|
||||
{var form=YAHOO.util.Selector.query("form",quickCreateDiv,true);if(form)
|
||||
{var moduleName=YAHOO.util.Selector.query('input[name=module]',form,true).value;var buttonName=moduleName+"_subpanel_cancel_button";var cancelled=false;SUGAR.subpanelUtils.cancelCreate(buttonName,function()
|
||||
{cancelled=true;});if(cancelled)
|
||||
{return false;}}}
|
||||
YAHOO.util.Connect.setForm(theForm,true,true);var cObj=YAHOO.util.Connect.asyncRequest('POST','index.php',{success:success,failure:success,upload:success});return false;},sendAndRetrieve:function(theForm,theDiv,loadingStr){var quickCreateDiv=YAHOO.util.Selector.query("div.quickcreate",null,true);if(quickCreateDiv){var form=YAHOO.util.Selector.query("form",quickCreateDiv,true);if(form){var moduleName=YAHOO.util.Selector.query('input[name=module]',form,true).value;var buttonName=moduleName+"_subpanel_cancel_button";var cancelled=false;SUGAR.subpanelUtils.cancelCreate(buttonName,function(){cancelled=true;});if(cancelled){return false;}}}
|
||||
function success(data){var theDivObj=document.getElementById(theDiv),divName=theDiv+'_newDiv',form_el;SUGAR.subpanelUtils.dataToDOMAvail=false;if(typeof currentPanelDiv!='undefined'&¤tPanelDiv!=null){var button_elements=YAHOO.util.Selector.query('td.buttons',currentPanelDiv,false);YAHOO.util.Dom.setStyle(button_elements,'display','');}
|
||||
SUGAR.subpanelUtils.removeSubPanel();subpanelContents[theDiv]={};subpanelContents[theDiv]['list']=theDivObj;subpanelContents[theDiv]['newDiv']=document.createElement('div');subpanelContents[theDiv]['newDiv'].innerHTML='<script type="text/javascript">SUGAR.subpanelUtils.dataToDOMAvail=true;</script>'+data.responseText;subpanelContents[theDiv]['newDiv'].id=divName;subpanelContents[theDiv]['newDiv'].className='quickcreate';var button_elements=YAHOO.util.Selector.query('td.buttons',theDiv,false);YAHOO.util.Dom.setStyle(button_elements,'display','none');button_elements=YAHOO.util.Selector.query('ul.SugarActionMenu',theDiv,false);YAHOO.util.Dom.setStyle(button_elements,'display','none');theDivObj.parentNode.insertBefore(subpanelContents[theDiv]['newDiv'],theDivObj);currentPanelDiv=divName;if(!SUGAR.subpanelUtils.dataToDOMAvail){SUGAR.util.evalScript(data.responseText);}
|
||||
form_el=YAHOO.util.Selector.query('form',divName,true);YAHOO.util.Dom.setStyle(form_el,'padding-bottom','10px');subpanelLocked[theDiv]=false;setTimeout("enableQS(false)",500);ajaxStatus.hideStatus();}
|
||||
if(subpanelLocked[theDiv]===true){return false;}
|
||||
subpanelLocked[theDiv]=true;loadingStr=loadingStr||SUGAR.language.get('app_strings','LBL_LOADING');ajaxStatus.showStatus(loadingStr);YAHOO.util.Connect.setForm(theForm);YAHOO.util.Connect.asyncRequest('POST','index.php',{success:success,failure:success});return false;},cancelCreate:function(buttonName,cancelCallback){var element=document.getElementById(buttonName),theForm=element.form,confirmMsg=onUnloadEditView(theForm);do{element=element.parentNode;}while(element.className!='quickcreate'&&element.parentNode);var theDiv=element.id.substr(0,element.id.length-7);if(typeof(subpanelContents[theDiv])=='undefined')
|
||||
return false;if(confirmMsg!=null){if(!confirm(confirmMsg)){if("function"===typeof cancelCallback)
|
||||
{cancelCallback();}
|
||||
return false;if(confirmMsg!=null){if(!confirm(confirmMsg)){if("function"===typeof cancelCallback){cancelCallback();}
|
||||
return false;}else{disableOnUnloadEditView(theForm);}}
|
||||
SUGAR.subpanelUtils.removeSubPanel();var button_elements=YAHOO.util.Selector.query('td.buttons',theDiv,false);YAHOO.util.Dom.setStyle(button_elements,'display','');button_elements=YAHOO.util.Selector.query('ul.SugarActionMenu',theDiv,false);YAHOO.util.Dom.setStyle(button_elements,'display','');return false;},loadSubpanelGroupFromMore:function(group){SUGAR.subpanelUtils.updateSubpanelMoreTab(group);SUGAR.subpanelUtils.loadSubpanelGroup(group);},updateSubpanelMoreTab:function(group){var moreTab=document.getElementById(SUGAR.subpanelUtils.subpanelMoreTab+'_sp_tab');moreTab.id=group+'_sp_tab';moreTab.getElementsByTagName('a')[0].innerHTML=group;moreTab.getElementsByTagName('a')[0].href="javascript:SUGAR.subpanelUtils.loadSubpanelGroup('"+group+"');";var menuLink=document.getElementById(group+'_sp_mm');menuLink.id=SUGAR.subpanelUtils.subpanelMoreTab+'_sp_mm';menuLink.href="javascript:SUGAR.subpanelUtils.loadSubpanelGroupFromMore('"+SUGAR.subpanelUtils.subpanelMoreTab+"');";menuLink.innerHTML=SUGAR.subpanelUtils.subpanelMoreTab;SUGAR.subpanelUtils.subpanelMoreTab=group;},removeSubPanel:function(){var currentPanelEl=null;if(typeof currentPanelDiv!='undefined'&¤tPanelDiv!=null){currentPanelEl=document.getElementById(currentPanelDiv);}
|
||||
if(currentPanelEl!=null){currentPanelEl.parentNode.removeChild(currentPanelEl);SUGAR.ajaxUI.cleanGlobals();currentPanelDiv=null;}},loadSubpanelGroup:function(group){if(SUGAR.subpanelUtils.loadedGroups[group]){SUGAR.subpanelUtils.updateSubpanel(group);}else{SUGAR.subpanelUtils.loadedGroups.push(group);var needed=[];for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp])=='string'&&!document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp])){needed.push(SUGAR.subpanelUtils.subpanelGroups[group][group_sp]);}}
|
||||
var success=function(){SUGAR.subpanelUtils.updateSubpanelEventHandlers(needed);SUGAR.subpanelUtils.updateSubpanels(group);};if(needed.length){ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_LOADING'));SUGAR.util.retrieveAndFill(SUGAR.subpanelUtils.requestUrl+needed.join(','),'subpanel_list',null,success,null,true);}else{SUGAR.subpanelUtils.updateSubpanels(group);}}
|
||||
SUGAR.subpanelUtils.setGroupCookie(group);},updateSubpanels:function(group){var sp_list=document.getElementById('subpanel_list');for(sp in sp_list.childNodes){if(sp_list.childNodes[sp].id){sp_list.childNodes[sp].style.display='none';}}
|
||||
for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp])!='string')
|
||||
{continue;}
|
||||
var cur=document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp]);if(cur==null)
|
||||
{continue;}
|
||||
for(group_sp in SUGAR.subpanelUtils.subpanelGroups[group]){if(typeof(SUGAR.subpanelUtils.subpanelGroups[group][group_sp])!='string'){continue;}
|
||||
var cur=document.getElementById('whole_subpanel_'+SUGAR.subpanelUtils.subpanelGroups[group][group_sp]);if(cur==null){continue;}
|
||||
cur.style.display='block';}
|
||||
SUGAR.subpanelUtils.updateSubpanelTabs(group);},updateSubpanelTabs:function(group){if(SUGAR.subpanelUtils.showLinks){SUGAR.subpanelUtils.updateSubpanelSubtabs(group);document.getElementById('subpanelSubTabs').innerHTML=SUGAR.subpanelUtils.subpanelSubTabs[group];}
|
||||
oldTab=document.getElementById(SUGAR.subpanelUtils.currentSubpanelGroup+'_sp_tab');if(oldTab){oldTab.className='';oldTab.getElementsByTagName('a')[0].className='';}
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
/*********************************************************************************
|
||||
/**
|
||||
*
|
||||
* SugarCRM Community Edition is a customer relationship management program developed by
|
||||
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
|
||||
|
||||
* SuiteCRM is an extension to SugarCRM Community Edition developed by Salesagility Ltd.
|
||||
* Copyright (C) 2011 - 2014 Salesagility Ltd.
|
||||
*
|
||||
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
|
||||
* Copyright (C) 2011 - 2017 SalesAgility Ltd.
|
||||
*
|
||||
* 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
|
||||
|
@ -14,7 +15,7 @@
|
|||
*
|
||||
* 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
|
||||
* 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
|
||||
|
@ -32,24 +33,18 @@
|
|||
* 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 and "Supercharged by SuiteCRM" logo. If the display of the logos is not
|
||||
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
|
||||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
********************************************************************************/
|
||||
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
|
||||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
*/
|
||||
function loadSugarChart(chartId,jsonFilename,css,chartConfig){if(document.getElementById(chartId)==null){return false;}
|
||||
var labelType,useGradients,nativeTextSupport,animate;(function(){var ua=navigator.userAgent,typeOfCanvas=typeof HTMLCanvasElement,nativeCanvasSupport=(typeOfCanvas=='object'||typeOfCanvas=='function'),textSupport=nativeCanvasSupport&&(typeof document.createElement('canvas').getContext('2d').fillText=='function');labelType='Native';nativeTextSupport=labelType=='Native';useGradients=nativeCanvasSupport;animate=false;})();var delay=500;switch(chartConfig["chartType"]){case"barChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}}
|
||||
var handleSuccess=function(o){if(o.responseText!==undefined&&o.responseText!="No Data"){SUGAR.util.globalEval('json = ('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var marginBottom=(chartConfig["orientation"]=='vertical'&&json.values.length>8)?20*4:20;if(chartConfig["orientation"]=='vertical')
|
||||
{function fixChartContainer(event,itemsCount)
|
||||
{var region=YAHOO.util.Dom.getRegion('content');if(region&®ion.width)
|
||||
{var realWidth=itemsCount*40;if(realWidth>region.width)
|
||||
{var chartCanvas=YAHOO.util.Dom.getElementsByClassName('chartCanvas','div');var chartContainer=YAHOO.util.Dom.getElementsByClassName('chartContainer','div');if(chartContainer.length>0&&chartCanvas.length>0)
|
||||
{chartContainer=YAHOO.util.Dom.get(chartContainer[0])
|
||||
var handleSuccess=function(o){if(o.responseText!==undefined&&o.responseText!="No Data"){SUGAR.util.globalEval('json = ('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var marginBottom=(chartConfig["orientation"]=='vertical'&&json.values.length>8)?20*4:20;if(chartConfig["orientation"]=='vertical'){function fixChartContainer(event,itemsCount){var region=YAHOO.util.Dom.getRegion('content');if(region&®ion.width){var realWidth=itemsCount*40;if(realWidth>region.width){var chartCanvas=YAHOO.util.Dom.getElementsByClassName('chartCanvas','div');var chartContainer=YAHOO.util.Dom.getElementsByClassName('chartContainer','div');if(chartContainer.length>0&&chartCanvas.length>0){chartContainer=YAHOO.util.Dom.get(chartContainer[0])
|
||||
YAHOO.util.Dom.setStyle(chartContainer,'width',region.width+'px')
|
||||
chartCanvas=YAHOO.util.Dom.get(chartCanvas[0]);YAHOO.util.Dom.setStyle(chartCanvas,'width',realWidth+'px');if(!event)
|
||||
{YAHOO.util.Event.addListener(window,"resize",fixChartContainer,json.values.length);}}}}}
|
||||
chartCanvas=YAHOO.util.Dom.get(chartCanvas[0]);YAHOO.util.Dom.setStyle(chartCanvas,'width',realWidth+'px');if(!event){YAHOO.util.Event.addListener(window,"resize",fixChartContainer,json.values.length);}}}}}
|
||||
fixChartContainer(null,json.values.length);}
|
||||
var barChart=new $jit.BarChart({injectInto:chartId,animate:false,nodeCount:json.values.length,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',shadow:{enable:true,size:2},orientation:chartConfig["orientation"],hoveredColor:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},Ticks:{enable:true,color:css["gridLineColor"]},barsOffset:(chartConfig["orientation"]=="vertical")?30:20,Margin:{top:20,left:30,right:20,bottom:marginBottom},ScrollNote:{text:(chartConfig["scroll"]&&SUGAR.util.isTouchScreen())?"Use two fingers to scroll":"",size:12},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},labelOffset:5,type:useGradients?chartConfig["barType"]+':gradient':chartConfig["barType"],showAggregates:true,showLabels:true,Label:{type:labelType,size:12,family:css["font-family"],color:css["color"],colorAlt:"#ffffff"},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"<br><a href='"+elem.link+"'>Click to drilldown</a>":"<br>Click to drilldown";}else{drillDown="";}
|
||||
if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";}
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem."+chartConfig["tip"]+" + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});barChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=barChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols),table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem."+chartConfig["tip"]+" + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});barChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=barChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length / cols),table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
+legend["color"][j]+'\'> </div>';}
|
||||
table+='</td>';table+='<td class=\'label\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+=legend["name"][j];}
|
||||
table+='</td>';j++;}
|
||||
|
@ -59,7 +54,7 @@ var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',ba
|
|||
var handleSuccess=function(o){if(o.responseText!==undefined&&o.responseText!="No Data"){SUGAR.util.globalEval('json = ('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var lineChart=new $jit.LineChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',selectOnHover:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},Ticks:{enable:true,color:css["gridLineColor"]},Margin:{top:20,left:40,right:40,bottom:20},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},labelOffset:5,type:useGradients?chartConfig["lineType"]+':gradient':chartConfig["lineType"],showAggregates:true,showLabels:true,Label:{type:labelType,size:12,family:css["font-family"],color:css["color"],colorAlt:"#ffffff"},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"<br><a href='"+elem.link+"'>Click to drilldown</a>":"<br>Click to drilldown";}else{drillDown="";}
|
||||
if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){var value="elem.valuelabel";}else{var value="elem.value";}
|
||||
if(elem.collision){SUGAR.util.globalEval("name = elem."+chartConfig["tip"]+";");var content='<table>';for(var i=0;i<name.length;i++){content+='<tr><td><b>'+name[i]+'</b>:</td><td> '+elem.value[i]+' - '+elem.percentage[i]+'%'+'</td></tr>';}
|
||||
content+='</table>';tip.innerHTML=content;}else{SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem."+chartConfig["tip"]+" + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}}});lineChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=lineChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols),table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
content+='</table>';tip.innerHTML=content;}else{SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem."+chartConfig["tip"]+" + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}}});lineChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=lineChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length / cols),table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
+legend["color"][j]+'\'> </div>';}
|
||||
table+='</td>';table+='<td class=\'label\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+=legend["name"][j];}
|
||||
table+='</td>';j++;}
|
||||
|
@ -68,7 +63,7 @@ table+="</table>";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilen
|
|||
var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;case"pieChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}}
|
||||
var handleSuccess=function(o){if(o.responseText!==undefined){SUGAR.util.globalEval('json = ('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var pieChart=new $jit.PieChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',labelType:properties['labels'],hoveredColor:false,offset:50,sliceOffset:0,labelOffset:30,type:useGradients?chartConfig["pieType"]+':gradient':chartConfig["pieType"],showLabels:true,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},Margin:{top:20,left:20,right:20,bottom:20},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},Label:{type:labelType,size:12,family:css["font-family"],color:css["color"]},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"<br><a href='"+elem.link+"'>Click to drilldown</a>":"<br>Click to drilldown";}else{drillDown="";}
|
||||
if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";}
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem.label + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});pieChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=pieChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols);table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem.label + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});pieChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=pieChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length / cols);table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
+legend["color"][j]+'\'> </div>';}
|
||||
table+='</td>';table+='<td class=\'label\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+=legend["name"][j];}
|
||||
table+='</td>';j++;}
|
||||
|
@ -77,7 +72,7 @@ table+="</table>";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilen
|
|||
var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;case"funnelChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}}
|
||||
var handleSuccess=function(o){if(o.responseText!==undefined&&o.responseText!="No Data"){SUGAR.util.globalEval('json = ('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var funnelChart=new $jit.FunnelChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',orientation:"vertical",hoveredColor:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:20},segmentOffset:20,Margin:{top:20,left:20,right:20,bottom:20},Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},labelOffset:10,type:useGradients?chartConfig["funnelType"]+':gradient':chartConfig["funnelType"],showAggregates:true,showLabels:true,Label:{type:labelType,size:12,family:css["font-family"],color:css["color"],colorAlt:"#ffffff"},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"<br><a href='"+elem.link+"'>Click to drilldown</a>":"<br>Click to drilldown";}else{drillDown="";}
|
||||
if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";}
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem."+chartConfig["tip"]+" + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});funnelChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=funnelChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols);table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem."+chartConfig["tip"]+" + '</b>: ' + "+value+" + ' - ' + elem.percentage + '%' + drillDown");}}});funnelChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=funnelChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length / cols);table="<table cellpadding='0' cellspacing='0' align='left'>";var j=0;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
+legend["color"][j]+'\'> </div>';}
|
||||
table+='</td>';table+='<td class=\'label\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+=legend["name"][j];}
|
||||
table+='</td>';j++;}
|
||||
|
@ -86,18 +81,12 @@ table+="</table>";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilen
|
|||
var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;case"gaugeChart":var handleFailure=function(o){alert('fail');if(o.responseText!==undefined){alert('failed');}}
|
||||
var handleSuccess=function(o){if(o.responseText!==undefined){SUGAR.util.globalEval('json = ('+o.responseText+')');var properties=$jit.util.splat(json.properties)[0];var gaugeChart=new $jit.GaugeChart({injectInto:chartId,animate:false,renderBackground:chartConfig['imageExportType']=="jpg"?true:false,backgroundColor:'rgb(255,255,255)',colorStop1:'rgba(255,255,255,.8)',colorStop2:'rgba(255,255,255,0)',labelType:properties['labels'],hoveredColor:false,Title:{text:properties['title'],size:16,color:'#444444',offset:20},Subtitle:{text:properties['subtitle'],size:11,color:css["color"],offset:5},offset:20,gaugeStyle:{backgroundColor:'#aaaaaa',borderColor:'#999999',needleColor:'rgba(255,0,0,.8)',borderSize:4,positionFontSize:24,positionOffset:2},type:useGradients?chartConfig["gaugeType"]+':gradient':chartConfig["gaugeType"],showLabels:true,Events:{enable:true,onClick:function(node){if(!node||SUGAR.util.isTouchScreen())return;if(node.link=='undefined'||node.link=='')return;window.location.href=node.link;}},Label:{type:labelType,size:12,family:css["font-family"],color:css["color"]},Tips:{enable:true,onShow:function(tip,elem){if(elem.link!='undefined'&&elem.link!=''){drillDown=(SUGAR.util.isTouchScreen())?"<br><a href='"+elem.link+"'>Click to drilldown</a>":"<br>Click to drilldown";}else{drillDown="";}
|
||||
if(elem.valuelabel!='undefined'&&elem.valuelabel!=undefined&&elem.valuelabel!=''){value="elem.valuelabel";}else{value="elem.value";}
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem.label + '</b>: ' + "+value+" + drillDown");}}});gaugeChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=gaugeChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length/cols);table="<table cellpadding='0' cellspacing='0' align='left'>";var j=1;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
SUGAR.util.globalEval("tip.innerHTML = '<b>' + elem.label + '</b>: ' + "+value+" + drillDown");}}});gaugeChart.loadJSON(json);var list=$jit.id('legend'+chartId);var legend=gaugeChart.getLegend(),cols=(typeof SUGAR=='undefined'||typeof SUGAR.mySugar=='undefined')?8:4,rows=Math.ceil(legend["name"].length / cols);table="<table cellpadding='0' cellspacing='0' align='left'>";var j=1;for(i=0;i<rows;i++){table+="<tr>";for(td=0;td<cols;td++){table+='<td width=\'16\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+='<div class=\'query-color\' style=\'background-color:'
|
||||
+legend["color"][j]+'\'> </div>';}
|
||||
table+='</td>';table+='<td class=\'label\' valign=\'top\'>';if(legend["name"][j]!=undefined){table+=legend["name"][j];}
|
||||
table+='</td>';j++;}
|
||||
table+="</tr>";}
|
||||
table+="</table>";list.innerHTML=table;$jit.util.saveImageTest(chartId,jsonFilename,chartConfig["imageExportType"]);trackWindowResize(gaugeChart,chartId,json);}}
|
||||
var callback={success:handleSuccess,failure:handleFailure,argument:{foo:'foo',bar:''}};var request=YAHOO.util.Connect.asyncRequest('GET',jsonFilename+"?r="+new Date().getTime(),callback);break;}
|
||||
function trackWindowResize(chart,chartId,json)
|
||||
{var origWindowWidth=document.documentElement.scrollWidth,container=document.getElementById(chartId),widget=document.getElementById(chartId+"-canvaswidget");var timeout;YAHOO.util.Event.addListener(window,"resize",function()
|
||||
{if(timeout)
|
||||
{clearTimeout(timeout);}
|
||||
timeout=setTimeout(function()
|
||||
{var newWindowWidth=document.documentElement.scrollWidth;if(newWindowWidth!=origWindowWidth)
|
||||
{widget.style.display="none";setTimeout(function()
|
||||
{var width=container.offsetWidth;widget.style.display="";chart.resizeGraph(json,width);origWindowWidth=newWindowWidth;},0);}},delay);});}}
|
||||
function trackWindowResize(chart,chartId,json){var origWindowWidth=document.documentElement.scrollWidth,container=document.getElementById(chartId),widget=document.getElementById(chartId+"-canvaswidget");var timeout;YAHOO.util.Event.addListener(window,"resize",function(){if(timeout){clearTimeout(timeout);}
|
||||
timeout=setTimeout(function(){var newWindowWidth=document.documentElement.scrollWidth;if(newWindowWidth!=origWindowWidth){widget.style.display="none";setTimeout(function(){var width=container.offsetWidth;widget.style.display="";chart.resizeGraph(json,width);origWindowWidth=newWindowWidth;},0);}},delay);});}}
|
|
@ -69,16 +69,8 @@ this.first=false;},js_more_detail:function(id){var more_img=document.getElementB
|
|||
divCount++;}}
|
||||
for(var j=0;j<divsToClean.length;j++){this.remove(divsToClean[j]);}
|
||||
return isFirstFieldEmpty;},show_arrow_label:function(show){var more_div=document.getElementById('more_div_'+this.field_element_name);if(more_div){more_div.style.display=show?'':'none';}},is_expanded:function(){var more_div=document.getElementById('more_div_'+this.field_element_name);if(more_div){return more_div.style.display=='';}
|
||||
return false;}};SUGAR.collection.safe_clone=function(e,recursive)
|
||||
{if(e.nodeName=="#text")
|
||||
{return document.createTextNode(e.data);}
|
||||
if(!e.tagName)return false;var newNode=document.createElement(e.tagName);if(!newNode)return false;var properties=['id','class','style','name','type','valign','border','width','height','top','bottom','left','right','scope','row','columns','src','href','className','align','nowrap'];if(SUGAR.isIE7&&e.tagName.toLowerCase()=='input')
|
||||
{var properties=['id','class','style','name','type','valign','border','width','top','bottom','left','right','scope','row','columns','src','href','className','align','nowrap'];}
|
||||
for(var i in properties)
|
||||
{if(e[properties[i]])
|
||||
{if((properties[i]!='style'||!SUGAR.isIE)&&(properties[i]!='href'||e.tagName=='a'||e.tagName=='iframe')){if(properties[i]=="type"){newNode.setAttribute(properties[i],e[properties[i]]);}else{newNode[properties[i]]=e[properties[i]];}}}}
|
||||
if(recursive)
|
||||
{for(var i in e.childNodes)
|
||||
{if(e.childNodes[i].nodeName&&(!e.className||e.className!="yui-ac-container"))
|
||||
{var child=SUGAR.collection.safe_clone(e.childNodes[i],true);if(child)newNode.appendChild(child);}}}
|
||||
return false;}};SUGAR.collection.safe_clone=function(e,recursive){if(e.nodeName=="#text"){return document.createTextNode(e.data);}
|
||||
if(!e.tagName)return false;var newNode=document.createElement(e.tagName);if(!newNode)return false;var properties=['id','class','style','name','type','valign','border','width','height','top','bottom','left','right','scope','row','columns','src','href','className','align','nowrap'];if(SUGAR.isIE7&&e.tagName.toLowerCase()=='input'){var properties=['id','class','style','name','type','valign','border','width','top','bottom','left','right','scope','row','columns','src','href','className','align','nowrap'];}
|
||||
for(var i in properties){if(e[properties[i]]){if((properties[i]!='style'||!SUGAR.isIE)&&(properties[i]!='href'||e.tagName=='a'||e.tagName=='iframe')){if(properties[i]=="type"){newNode.setAttribute(properties[i],e[properties[i]]);}else{newNode[properties[i]]=e[properties[i]];}}}}
|
||||
if(recursive){for(var i in e.childNodes){if(e.childNodes[i].nodeName&&(!e.className||e.className!="yui-ac-container")){var child=SUGAR.collection.safe_clone(e.childNodes[i],true);if(child)newNode.appendChild(child);}}}
|
||||
return newNode;}}
|
|
@ -37,8 +37,7 @@
|
|||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
*/
|
||||
SUGAR.importWizard={};SUGAR.importWizard=function(){return{renderDialog:function(importModuleVAR,actionVar,sourceVar){var oBody=document.getElementsByTagName('BODY').item(0);if(!document.getElementById("importWizardDialog")){var importWizardDialogDiv=document.createElement("div");importWizardDialogDiv.id="importWizardDialog";importWizardDialogDiv.style.display="none";importWizardDialogDiv.className="dashletPanelMenu wizard import";importWizardDialogDiv.innerHTML='<div class="hd"><a href="javascript:void(0)" onClick="javascript:SUGAR.importWizard.closeDialog();"><div class="container-close"> </div></a><div class="title" id="importWizardDialogTitle"></div></div><div class="bd"><div class="screen" id="importWizardDialogDiv"></div><div id="submitDiv"></div></div>';oBody.appendChild(importWizardDialogDiv);}
|
||||
YAHOO.util.Event.onContentReady("importWizardDialog",function()
|
||||
{SUGAR.importWizard.dialog=new YAHOO.widget.Dialog("importWizardDialog",{width:"950px",height:"565px",fixedcenter:true,draggable:false,visible:false,modal:true,close:false});var oHead=document.getElementsByTagName('HEAD').item(0);if(!document.getElementById("sugar_grp_yui_widgets")){var oScript=document.createElement("script");oScript.type="text/javascript";oScript.id="sugar_grp_yui_widgets";oScript.src="cache/include/javascript/sugar_grp_yui_widgets.js";oHead.appendChild(oScript);}
|
||||
YAHOO.util.Event.onContentReady("importWizardDialog",function(){SUGAR.importWizard.dialog=new YAHOO.widget.Dialog("importWizardDialog",{width:"950px",height:"565px",fixedcenter:true,draggable:false,visible:false,modal:true,close:false});var oHead=document.getElementsByTagName('HEAD').item(0);if(!document.getElementById("sugar_grp_yui_widgets")){var oScript=document.createElement("script");oScript.type="text/javascript";oScript.id="sugar_grp_yui_widgets";oScript.src="cache/include/javascript/sugar_grp_yui_widgets.js";oHead.appendChild(oScript);}
|
||||
var success=function(data){var response=YAHOO.lang.JSON.parse(data.responseText);importWizardDialogDiv=document.getElementById('importWizardDialogDiv');var submitDiv=document.getElementById('submitDiv');var importWizardDialogTitle=document.getElementById('importWizardDialogTitle');importWizardDialogDiv.innerHTML=response['html'];importWizardDialogTitle.innerHTML=response['title'];submitDiv.innerHTML=response['submitContent'];document.getElementById('importWizardDialog').style.display='';SUGAR.importWizard.dialog.render();SUGAR.importWizard.dialog.show();SUGAR.util.globalEval(response['script']);}
|
||||
var cObj=YAHOO.util.Connect.asyncRequest('GET','index.php?module=Import&action='+actionVar+'&import_module='+importModuleVAR+'&source='+sourceVar,{success:success,failure:success});return false;});},closeDialog:function(){SUGAR.importWizard.dialog.hide();var importWizardDialogDiv=document.getElementById('importWizardDialogDiv');var submitDiv=document.getElementById('submitDiv');importWizardDialogDiv.innerHTML="";submitDiv.innerHTML="";SUGAR.importWizard.dialog.destroy();},renderLoadingDialog:function(){SUGAR.importWizard.loading=new YAHOO.widget.Panel("loading",{width:"240px",fixedcenter:true,close:false,draggable:false,constraintoviewport:false,modal:true,visible:false,effect:[{effect:YAHOO.widget.ContainerEffect.SLIDE,duration:0.5},{effect:YAHOO.widget.ContainerEffect.FADE,duration:.5}]});SUGAR.importWizard.loading.setBody('<div id="loadingPage" align="center" style="vertical-align:middle;"><img src="'+SUGAR.themes.image_server+'index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=img_loading.gif" align="absmiddle" /> <b>'+SUGAR.language.get('app_strings','LBL_LOADING_PAGE')+'</b></div>');SUGAR.importWizard.loading.render(document.body);if(document.getElementById('loading_c'))
|
||||
document.getElementById('loading_c').style.display='none';}};}();
|
|
@ -36,46 +36,30 @@
|
|||
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
|
||||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
*/
|
||||
function closePopup(){var closePopup=window.opener.get_close_popup();if(closePopup)
|
||||
{window.close();}}
|
||||
function confirmDialog(arrayContents,formName){var newData='';var labels='';var oldData='';SUGAR.util.globalEval("var data = {"+arrayContents.join(",")+"}");var opener=window.opener.document;for(var key in data)
|
||||
{var displayValue=replaceHTMLChars(data[key]);if(opener.forms[formName]&&opener.getElementById(key+'_label')!=null&&!key.match(/account/))
|
||||
{var dataLabel=opener.getElementById(key+'_label').innerHTML.replace(/\n/gi,'').replace(/<\/?[^>]+(>|$)/g,"");labels+=dataLabel+' \n';newData+=dataLabel+' '+displayValue+'\n';if(window.opener.document.forms[formName].elements[key]){oldData+=dataLabel+' '+opener.forms[formName].elements[key].value+'\n';}}}
|
||||
var popupConfirm=0;if(data['account_id']&&(newData.split("\n").length-1)>2)
|
||||
{if(newData!=oldData&&oldData!=labels)
|
||||
{if(confirm(SUGAR.language.get('app_strings','NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM')+'\n\n'+newData))
|
||||
{popupConfirm=1;}else{popupConfirm=-1;}}}
|
||||
function closePopup(){var closePopup=window.opener.get_close_popup();if(closePopup){window.close();}}
|
||||
function confirmDialog(arrayContents,formName){var newData='';var labels='';var oldData='';SUGAR.util.globalEval("var data = {"+arrayContents.join(",")+"}");var opener=window.opener.document;for(var key in data){var displayValue=replaceHTMLChars(data[key]);if(opener.forms[formName]&&opener.getElementById(key+'_label')!=null&&!key.match(/account/)){var dataLabel=opener.getElementById(key+'_label').innerHTML.replace(/\n/gi,'').replace(/<\/?[^>]+(>|$)/g,"");labels+=dataLabel+' \n';newData+=dataLabel+' '+displayValue+'\n';if(window.opener.document.forms[formName].elements[key]){oldData+=dataLabel+' '+opener.forms[formName].elements[key].value+'\n';}}}
|
||||
var popupConfirm=0;if(data['account_id']&&(newData.split("\n").length-1)>2){if(newData!=oldData&&oldData!=labels){if(confirm(SUGAR.language.get('app_strings','NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM')+'\n\n'+newData)){popupConfirm=1;}else{popupConfirm=-1;}}}
|
||||
return popupConfirm;}
|
||||
function send_back(module,id)
|
||||
{var associated_row_data=associated_javascript_data[id];SUGAR.util.globalEval("var temp_request_data = "+window.document.forms['popup_query_form'].request_data.value);if(temp_request_data.jsonObject){var request_data=temp_request_data.jsonObject;}else{var request_data=temp_request_data;}
|
||||
var passthru_data=Object();if(typeof(request_data.passthru_data)!='undefined')
|
||||
{passthru_data=request_data.passthru_data;}
|
||||
var form_name=request_data.form_name;var field_to_name_array=request_data.field_to_name_array;SUGAR.util.globalEval("var call_back_function = window.opener."+request_data.call_back_function);var array_contents=Array();var fill_array_contents=function(the_key,the_name)
|
||||
{var the_value='';if(module!=''&&id!=''){if(associated_row_data['DOCUMENT_NAME']&&the_key.toUpperCase()=="NAME"){the_value=associated_row_data['DOCUMENT_NAME'];}else if((the_key.toUpperCase()=='USER_NAME'||the_key.toUpperCase()=='LAST_NAME'||the_key.toUpperCase()=='FIRST_NAME')&&typeof(is_show_fullname)!='undefined'&&is_show_fullname&&form_name!='search_form'){the_value=associated_row_data['FULL_NAME'];}else{the_value=associated_row_data[the_key.toUpperCase()];}}
|
||||
function send_back(module,id){var associated_row_data=associated_javascript_data[id];SUGAR.util.globalEval("var temp_request_data = "+window.document.forms['popup_query_form'].request_data.value);if(temp_request_data.jsonObject){var request_data=temp_request_data.jsonObject;}else{var request_data=temp_request_data;}
|
||||
var passthru_data=Object();if(typeof(request_data.passthru_data)!='undefined'){passthru_data=request_data.passthru_data;}
|
||||
var form_name=request_data.form_name;var field_to_name_array=request_data.field_to_name_array;SUGAR.util.globalEval("var call_back_function = window.opener."+request_data.call_back_function);var array_contents=Array();var fill_array_contents=function(the_key,the_name){var the_value='';if(module!=''&&id!=''){if(associated_row_data['DOCUMENT_NAME']&&the_key.toUpperCase()=="NAME"){the_value=associated_row_data['DOCUMENT_NAME'];}else if((the_key.toUpperCase()=='USER_NAME'||the_key.toUpperCase()=='LAST_NAME'||the_key.toUpperCase()=='FIRST_NAME')&&typeof(is_show_fullname)!='undefined'&&is_show_fullname&&form_name!='search_form'){the_value=associated_row_data['FULL_NAME'];}else{the_value=associated_row_data[the_key.toUpperCase()];}}
|
||||
if(typeof(the_value)=='string'){the_value=the_value.replace(/\r\n|\n|\r/g,'\\n');}
|
||||
array_contents.push('"'+the_name+'":"'+the_value+'"');}
|
||||
for(var the_key in field_to_name_array)
|
||||
{if(the_key!='toJSON')
|
||||
{if(YAHOO.lang.isArray(field_to_name_array[the_key])){for(var i=0;i<field_to_name_array[the_key].length;i++){fill_array_contents(the_key,field_to_name_array[the_key][i]);}}
|
||||
for(var the_key in field_to_name_array){if(the_key!='toJSON'){if(YAHOO.lang.isArray(field_to_name_array[the_key])){for(var i=0;i<field_to_name_array[the_key].length;i++){fill_array_contents(the_key,field_to_name_array[the_key][i]);}}
|
||||
else{fill_array_contents(the_key,field_to_name_array[the_key]);}}}
|
||||
var popupConfirm=confirmDialog(array_contents,form_name);SUGAR.util.globalEval("var name_to_value_array = {"+array_contents.join(",")+"}");closePopup();var result_data={"form_name":form_name,"name_to_value_array":name_to_value_array,"passthru_data":passthru_data,"popupConfirm":popupConfirm};call_back_function(result_data);}
|
||||
function send_back_teams(module,form,field,error_message,request_data,form_team_id)
|
||||
{var array_contents=Array();if(form_team_id){array_contents.push(form_team_id);}else{var j=0;for(i=0;i<form.elements.length;i++){if(form.elements[i].name==field){if(form.elements[i].checked==true){array_contents.push(form.elements[i].value);}}}}
|
||||
function send_back_teams(module,form,field,error_message,request_data,form_team_id){var array_contents=Array();if(form_team_id){array_contents.push(form_team_id);}else{var j=0;for(i=0;i<form.elements.length;i++){if(form.elements[i].name==field){if(form.elements[i].checked==true){array_contents.push(form.elements[i].value);}}}}
|
||||
if(array_contents.length==0){window.alert(error_message);return;}
|
||||
var field_to_name_array=request_data.field_to_name_array;var array_teams=new Array();for(team_id in array_contents){if(typeof array_contents[team_id]=='string'){var team={"team_id":associated_javascript_data[array_contents[team_id]].ID,"team_name":associated_javascript_data[array_contents[team_id]].NAME};array_teams.push(team);}}
|
||||
var passthru_data=Object();if(typeof request_data.call_back_function=='undefined'&&typeof request_data=='object'){request_data=YAHOO.lang.JSON.parse(request_data.value);}
|
||||
if(typeof(request_data.passthru_data)!='undefined')
|
||||
{passthru_data=request_data.passthru_data;}
|
||||
if(typeof(request_data.passthru_data)!='undefined'){passthru_data=request_data.passthru_data;}
|
||||
var form_name=request_data.form_name;var field_name=request_data.field_name;closePopup();SUGAR.util.globalEval("var call_back_function = window.opener."+request_data.call_back_function);var result_data={"form_name":form_name,"field_name":field_name,"teams":array_teams,"passthru_data":passthru_data};call_back_function(result_data);}
|
||||
function send_back_selected(module,form,field,error_message,request_data)
|
||||
{var array_contents=Array();var j=0;for(i=0;i<form.elements.length;i++){if(form.elements[i].name==field){if(form.elements[i].checked==true){++j;array_contents.push('"'+"ID_"+j+'":"'+form.elements[i].value+'"');}}}
|
||||
function send_back_selected(module,form,field,error_message,request_data){var array_contents=Array();var j=0;for(i=0;i<form.elements.length;i++){if(form.elements[i].name==field){if(form.elements[i].checked==true){++j;array_contents.push('"'+"ID_"+j+'":"'+form.elements[i].value+'"');}}}
|
||||
if(array_contents.length==0){window.alert(error_message);return;}
|
||||
SUGAR.util.globalEval("var selection_list_array = {"+array_contents.join(",")+"}");SUGAR.util.globalEval("var temp_request_data = "+window.document.forms['popup_query_form'].request_data.value);if(temp_request_data.jsonObject){var request_data=temp_request_data.jsonObject;}else{var request_data=temp_request_data;}
|
||||
var passthru_data=Object();if(typeof(request_data.passthru_data)!='undefined')
|
||||
{passthru_data=request_data.passthru_data;}
|
||||
var passthru_data=Object();if(typeof(request_data.passthru_data)!='undefined'){passthru_data=request_data.passthru_data;}
|
||||
var form_name=request_data.form_name;var field_to_name_array=request_data.field_to_name_array;closePopup();SUGAR.util.globalEval("var call_back_function = window.opener."+request_data.call_back_function);var result_data={"form_name":form_name,"selection_list":selection_list_array,"passthru_data":passthru_data,"select_entire_list":form.select_entire_list.value,"current_query_by_page":form.current_query_by_page.value};call_back_function(result_data);}
|
||||
function toggleMore(spanId,img_id,module,action,params){toggle_more_go=function(){oReturn=function(body,caption,width,theme){$(".ui-dialog").find(".open").dialog("close");var el='#'+spanId+' img';if(action=='DisplayInlineTeams')
|
||||
{el='#'+spanId;}
|
||||
function toggleMore(spanId,img_id,module,action,params){toggle_more_go=function(){oReturn=function(body,caption,width,theme){$(".ui-dialog").find(".open").dialog("close");var el='#'+spanId+' img';if(action=='DisplayInlineTeams'){el='#'+spanId;}
|
||||
var $dialog=$('<div class="open"></div>').html(body).dialog({autoOpen:false,title:caption,width:300,position:{my:'right top',at:'left top',of:$(el)}});var width=$dialog.dialog("option","width");var pos=$(el).offset();var ofWidth=$(el).width();if((pos.left+ofWidth)-40<width){$dialog.dialog("option","position",{my:'left top',at:'right top',of:$(el)});}
|
||||
$dialog.dialog('open');}
|
||||
success=function(data){SUGAR.util.globalEval(data.responseText);SUGAR.util.additionalDetailsCache[spanId]=new Array();SUGAR.util.additionalDetailsCache[spanId]['body']=result['body'];SUGAR.util.additionalDetailsCache[spanId]['caption']=result['caption'];SUGAR.util.additionalDetailsCache[spanId]['width']=result['width'];SUGAR.util.additionalDetailsCache[spanId]['theme']=result['theme'];ajaxStatus.hideStatus();return oReturn(SUGAR.util.additionalDetailsCache[spanId]['body'],SUGAR.util.additionalDetailsCache[spanId]['caption'],SUGAR.util.additionalDetailsCache[spanId]['width'],SUGAR.util.additionalDetailsCache[spanId]['theme']);}
|
||||
|
@ -84,5 +68,4 @@ return oReturn(SUGAR.util.additionalDetailsCache[spanId]['body'],SUGAR.util.addi
|
|||
return;ajaxStatus.showStatus(SUGAR.language.get('app_strings','LBL_LOADING'));url='index.php?module='+module+'&action='+action+'&'+params;SUGAR.util.additionalDetailsCalls[spanId]=YAHOO.util.Connect.asyncRequest('GET',url,{success:success,failure:success});return false;}
|
||||
SUGAR.util.additionalDetailsRpcCall=window.setTimeout('toggle_more_go()',250);}
|
||||
SUGAR.util.doWhen("window.document.forms['popup_query_form'] != null "
|
||||
+"&& typeof(window.document.forms['popup_query_form'].request_data) != 'undefined'",function(){if(window.document.forms['popup_query_form'].request_data.value=="")
|
||||
{window.document.forms['popup_query_form'].request_data.value=window.opener.get_popup_request_data();}});$(document).ready(function(){$("ul.clickMenu").each(function(index,node){$(node).sugarActionMenu();});});
|
||||
+"&& typeof(window.document.forms['popup_query_form'].request_data) != 'undefined'",function(){if(window.document.forms['popup_query_form'].request_data.value==""){window.document.forms['popup_query_form'].request_data.value=window.opener.get_popup_request_data();}});$(document).ready(function(){$("ul.clickMenu").each(function(index,node){$(node).sugarActionMenu();});});
|
|
@ -46,15 +46,8 @@ if(!document.forms[qs_obj.form].elements[qsFields[qsField].id].readOnly&&qs_obj[
|
|||
if(!loaded){QSProcessedFieldsArray[qs_index_id]=true;qsFields[qsField].form_id=form_id;var sqs=sqs_objects[qs_index_id];var resultDiv=document.createElement('div');resultDiv.id=combo_id+"_results";Dom.insertAfter(resultDiv,qsFields[qsField]);var fields=qs_obj.field_list.slice();fields[fields.length]="module";var ds=new YAHOO.util.DataSource("index.php?",{responseType:YAHOO.util.XHRDataSource.TYPE_JSON,responseSchema:{resultsList:'fields',total:'totalCount',fields:fields,metaNode:"fields",metaFields:{total:'totalCount',fields:"fields"}},connMethodPost:true});var forceSelect=!((qsFields[qsField].form&&typeof(qsFields[qsField].form)=='object'&&qsFields[qsField].form.name=='search_form')||qsFields[qsField].className.match('sqsNoAutofill')!=null);var search=new YAHOO.widget.AutoComplete(qsFields[qsField],resultDiv,ds,{typeAhead:forceSelect,forceSelection:forceSelect,fields:fields,sqs:sqs,animSpeed:0.25,qs_obj:qs_obj,inputElement:qsFields[qsField],generateRequest:function(sQuery){var item_id=this.inputElement.form_id+'_'+this.inputElement.name;this.sqs=updateSqsFromQSFieldsArray(item_id,this.sqs);if(QSCallbacksArray[item_id]){QSCallbacksArray[item_id](this.sqs);}
|
||||
var out=SUGAR.util.paramsToUrl({to_pdf:'true',module:'Home',action:'quicksearchQuery',data:YAHOO.lang.JSON.stringify(this.sqs),query:decodeURIComponent(sQuery)});return out;},setFields:function(data,filter){this.updateFields(data,filter);},updateFields:function(data,filter){for(var i in this.fields){for(var key in this.qs_obj.field_list){if(this.fields[i]==this.qs_obj.field_list[key]&&document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]&&this.qs_obj.populate_list[key].match(filter)){var displayValue=data[i].replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value=displayValue;SUGAR.util.callOnChangeListers(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]);}}}
|
||||
SUGAR.util.callOnChangeListers(this._elTextbox);},clearFields:function(){for(var key in this.qs_obj.field_list){if(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]){document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value="";SUGAR.util.callOnChangeListers(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]);}}
|
||||
this.oldValue="";}});if(/^(billing_|shipping_)?account_name$/.exec(qsFields[qsField].name))
|
||||
{search.clearFields=function(){for(var i in{name:0,id:1}){for(var key in this.qs_obj.field_list){if(i==this.qs_obj.field_list[key]&&document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]])
|
||||
{document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value="";}}}};search.setFields=function(data,filter)
|
||||
{var label_str='';var label_data_str='';var current_label_data_str='';var label_data_hash=new Array();for(var i in this.fields){for(var key in this.qs_obj.field_list){if(this.fields[i]==this.qs_obj.field_list[key]&&document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]&&document.getElementById(this.qs_obj.populate_list[key]+'_label')&&this.qs_obj.populate_list[key].match(filter)){var displayValue=data[i].replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');var data_label=document.getElementById(this.qs_obj.populate_list[key]+'_label').innerHTML.replace(/\n/gi,'').replace(/<\/?[^>]+(>|$)/g,"");label_and_data=data_label+' '+displayValue;if(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]&&!label_data_hash[data_label])
|
||||
{label_str+=data_label+' \n';label_data_str+=label_and_data+'\n';label_data_hash[data_label]=true;current_label_data_str+=data_label+' '+document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value+'\n';}}}}
|
||||
if(label_str!=current_label_data_str&¤t_label_data_str!=label_data_str){module_key=(typeof document.forms[form_id].elements['module']!='undefined')?document.forms[form_id].elements['module'].value:'app_strings';warning_label=SUGAR.language.translate(module_key,'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM')+'\n\n'+label_data_str;if(!confirm(warning_label))
|
||||
{this.updateFields(data,/account_id/);}else{if(Dom.get('shipping_checkbox'))
|
||||
{if(this.inputElement.id=='shipping_account_name')
|
||||
{filter=Dom.get('shipping_checkbox').checked?/(account_id|office_phone)/:filter;}else if(this.inputElement.id=='billing_account_name'){filter=Dom.get('shipping_checkbox').checked?filter:/(account_id|office_phone|billing)/;}}else if(Dom.get('alt_checkbox')){filter=Dom.get('alt_checkbox').checked?filter:/^(?!alt)/;}
|
||||
this.oldValue="";}});if(/^(billing_|shipping_)?account_name$/.exec(qsFields[qsField].name)){search.clearFields=function(){for(var i in{name:0,id:1}){for(var key in this.qs_obj.field_list){if(i==this.qs_obj.field_list[key]&&document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]){document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value="";}}}};search.setFields=function(data,filter){var label_str='';var label_data_str='';var current_label_data_str='';var label_data_hash=new Array();for(var i in this.fields){for(var key in this.qs_obj.field_list){if(this.fields[i]==this.qs_obj.field_list[key]&&document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]&&document.getElementById(this.qs_obj.populate_list[key]+'_label')&&this.qs_obj.populate_list[key].match(filter)){var displayValue=data[i].replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');var data_label=document.getElementById(this.qs_obj.populate_list[key]+'_label').innerHTML.replace(/\n/gi,'').replace(/<\/?[^>]+(>|$)/g,"");label_and_data=data_label+' '+displayValue;if(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]&&!label_data_hash[data_label]){label_str+=data_label+' \n';label_data_str+=label_and_data+'\n';label_data_hash[data_label]=true;current_label_data_str+=data_label+' '+document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value+'\n';}}}}
|
||||
if(label_str!=current_label_data_str&¤t_label_data_str!=label_data_str){module_key=(typeof document.forms[form_id].elements['module']!='undefined')?document.forms[form_id].elements['module'].value:'app_strings';warning_label=SUGAR.language.translate(module_key,'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM')+'\n\n'+label_data_str;if(!confirm(warning_label)){this.updateFields(data,/account_id/);}else{if(Dom.get('shipping_checkbox')){if(this.inputElement.id=='shipping_account_name'){filter=Dom.get('shipping_checkbox').checked?/(account_id|office_phone)/:filter;}else if(this.inputElement.id=='billing_account_name'){filter=Dom.get('shipping_checkbox').checked?filter:/(account_id|office_phone|billing)/;}}else if(Dom.get('alt_checkbox')){filter=Dom.get('alt_checkbox').checked?filter:/^(?!alt)/;}
|
||||
this.updateFields(data,filter);}}else{this.updateFields(data,filter);}};}
|
||||
if(typeof(SUGAR.config.quicksearch_querydelay)!='undefined'){search.queryDelay=Number(SUGAR.config.quicksearch_querydelay);}
|
||||
search.itemSelectEvent.subscribe(function(e,args){var data=args[2];var fields=this.fields;this.setFields(data,/\S/);if(typeof(this.qs_obj['post_onblur_function'])!='undefined'){collection_extended=new Array();for(var i in fields){for(var key in this.qs_obj.field_list){if(fields[i]==this.qs_obj.field_list[key]){collection_extended[this.qs_obj.field_list[key]]=data[i];}}}
|
||||
|
@ -62,8 +55,5 @@ SUGAR.util.globalEval(this.qs_obj['post_onblur_function']+'(collection_extended,
|
|||
this.getInputEl().value=data[this.key];this.itemSelectEvent.fire(this,"",data);}});search.typeAheadEvent.subscribe(function(e,args){this.getInputEl().value=this.getInputEl().value.replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');});if(typeof QSFieldsArray[combo_id]=='undefined'&&qsFields[qsField].id){QSFieldsArray[combo_id]=search;}}}}});}
|
||||
function registerSingleSmartInputListener(input){if((c=input.className)&&(c.indexOf("sqsEnabled")!=-1)){enableQS(true);}}
|
||||
if(typeof QSFieldsArray=='undefined'){QSFieldsArray=new Array();QSProcessedFieldsArray=new Array();QSCallbacksArray=new Array();}
|
||||
function updateSqsFromQSFieldsArray(sqsId,sqsToUpdate)
|
||||
{if(typeof(QSFieldsArray[sqsId])!='undefined'&&sqsToUpdate!=QSFieldsArray[sqsId].sqs)
|
||||
{return QSFieldsArray[sqsId].sqs;}
|
||||
else
|
||||
{return sqsToUpdate;}}
|
||||
function updateSqsFromQSFieldsArray(sqsId,sqsToUpdate){if(typeof(QSFieldsArray[sqsId])!='undefined'&&sqsToUpdate!=QSFieldsArray[sqsId].sqs){return QSFieldsArray[sqsId].sqs;}
|
||||
else{return sqsToUpdate;}}
|
|
@ -130,8 +130,7 @@ function loadXML(){var gURL='index.php?module=Reports&action=fillUserCombo';if(w
|
|||
xmlhttp.open("GET",gURL,false);xmlhttp.onreadystatechange=loadUsers;xmlhttp.send(null);loadUsers();}
|
||||
else if(window.ActiveXObject){xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');if(xmlhttp){xmlhttp.onreadystatechange=loadUsers;xmlhttp.open('GET',gURL,false);xmlhttp.send();}}}
|
||||
function loadUsers(){if(xmlhttp.readyState==4){if(xmlhttp.status==200||xmlhttp.status==0){if(window.ActiveXObject)
|
||||
xmlhttp.responseXML.loadXML(xmlhttp.responseText);var acc=xmlhttp.responseXML.getElementsByTagName('data');var opts='';for(var i=0;i<acc.length;i++)
|
||||
{val=getNodeValue(acc[i],'datavalue');SUGAR.util.globalEval("users_array[users_array.length] = ("+val+")");}}}}
|
||||
xmlhttp.responseXML.loadXML(xmlhttp.responseText);var acc=xmlhttp.responseXML.getElementsByTagName('data');var opts='';for(var i=0;i<acc.length;i++){val=getNodeValue(acc[i],'datavalue');SUGAR.util.globalEval("users_array[users_array.length] = ("+val+")");}}}}
|
||||
function getNodeValue(obj,tag){return obj.getElementsByTagName(tag)[0].firstChild.nodeValue;}
|
||||
function addFilterInputText(row,filter){var cell=document.createElement("td");var new_input=document.createElement("input");new_input.type="text";if(typeof(filter.input_name0)=='undefined'){filter.input_name0='';}
|
||||
new_input.value=filter.input_name0;new_input.name="text_input";new_input.size="30";new_input.maxsize="255";new_input.visible="true";cell.appendChild(new_input);row.appendChild(cell);var filter_row=filters_arr[filters_count_map[current_filter_id]];filter_row.input_field0=new_input;filter_row.input_field1=null;}
|
||||
|
@ -247,8 +246,7 @@ else{document.EditView[sort_dir].value="d";}}
|
|||
else{document.EditView[sort_by].value=column_name;document.EditView[sort_dir].value="a";}
|
||||
document.EditView.to_pdf.value='';document.EditView.to_csv.value='';document.EditView['report_offset'].value=0;if(fill_form()==true){document.EditView.submit();}}
|
||||
function set_offset(offset){document.EditView['report_offset'].value=offset;document.EditView.to_pdf.value='';document.EditView.to_csv.value='';if(fill_form()==true){document.EditView.submit();}}
|
||||
function load_page(){reload_joins();current_module=document.EditView.self.options[document.EditView.self.options.selectedIndex].value;reload_join_rows('regular');all_fields=getAllFieldsMapped(current_module);if(form_submit!="true")
|
||||
{remakeGroups();reload_groups();reload_filters();}
|
||||
function load_page(){reload_joins();current_module=document.EditView.self.options[document.EditView.self.options.selectedIndex].value;reload_join_rows('regular');all_fields=getAllFieldsMapped(current_module);if(form_submit!="true"){remakeGroups();reload_groups();reload_filters();}
|
||||
reload_columns('regular');}
|
||||
function reload_joins(){for(var index in report_def.full_table_list){var curr_table=report_def.full_table_list[index];if(index!="self"){add_related(curr_table.parent,index);option_selectbox=document.getElementById('outer_'+index);if(option_selectbox!=null){if(curr_table.optional!=null&&curr_table.optional==true){option_selectbox.checked=true;}
|
||||
else{option_selectbox.checked=false;}}
|
||||
|
|
|
@ -109,9 +109,9 @@ initMySugar = function () {
|
|||
// Show new dashlet position
|
||||
$('.dashletcontainer').find('.dashletPanel').css('display', 'block');
|
||||
// hide placeholder
|
||||
$('.dashletcontainer').find('div').each(function(e,v) {
|
||||
$('.dashletcontainer').find('div').each(function (e, v) {
|
||||
|
||||
if($(v).html() == '' && typeof $(v).attr('id') === 'undefined' && typeof $(v).attr('class') === 'undefined') {
|
||||
if ($(v).html() == '' && typeof $(v).attr('id') === 'undefined' && typeof $(v).attr('class') === 'undefined') {
|
||||
$(this).css('display', 'none');
|
||||
}
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -38,49 +38,49 @@
|
|||
*/
|
||||
|
||||
SUGAR.dependentDropdown = {
|
||||
/*
|
||||
* Container for "action" metadata - allows DD to parse saved choices and apply them at display time
|
||||
*/
|
||||
currentAction : null,
|
||||
/*
|
||||
* Flag to turn on debug mode.
|
||||
* Current debug output:
|
||||
* SUGAR.dependentDropdown._stack - simple list of this class' called methods
|
||||
*/
|
||||
debugMode : false
|
||||
/*
|
||||
* Container for "action" metadata - allows DD to parse saved choices and apply them at display time
|
||||
*/
|
||||
currentAction: null,
|
||||
/*
|
||||
* Flag to turn on debug mode.
|
||||
* Current debug output:
|
||||
* SUGAR.dependentDropdown._stack - simple list of this class' called methods
|
||||
*/
|
||||
debugMode: false
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle drop-down dependencies
|
||||
* @param object HTML form element object
|
||||
*/
|
||||
SUGAR.dependentDropdown.handleDependentDropdown = function(el) {
|
||||
/**
|
||||
*
|
||||
*
|
||||
* PROTOTYPE THIS METHOD TO CUSTOMIZE RESPONSES FOR YOUR DEPENDENT DROPDOWNS
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
if(SUGAR.dependentDropdown.debugMode) SUGAR.dependentDropdown.utils.debugStack('handleDependentDropdown');
|
||||
|
||||
/*
|
||||
* el.id example:
|
||||
* "criteriaGroup::0:::0:-:crit0id"
|
||||
* [grouping from metadata]::[index]:::[elementIndex]:-:[assignedID from metadata]
|
||||
* index is row-number
|
||||
* elementIndex is the index of the current element in this row
|
||||
var index = el.id.slice(el.id.indexOf("::") + 2, el.id.indexOf(":::"));
|
||||
var elementRow = el.boxObject.parentBox;
|
||||
var elementIndex = el.id.slice(el.id.indexOf(":::") + 3, el.id.indexOf(":-:"));
|
||||
SUGAR.dependentDropdown.handleDependentDropdown = function (el) {
|
||||
/**
|
||||
*
|
||||
*
|
||||
* PROTOTYPE THIS METHOD TO CUSTOMIZE RESPONSES FOR YOUR DEPENDENT DROPDOWNS
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
/**
|
||||
if(SUGAR.dependentDropdown.debugMode) SUGAR.dependentDropdown.utils.debugStack('handleDependentDropdown');
|
||||
|
||||
elementIndex++;
|
||||
var elementKey = "element" + elementIndex;
|
||||
var focusElement = SUGAR.dependentDropdown.dropdowns[focusDD].elements[elementKey];
|
||||
|
||||
if(focusElement) {
|
||||
/*
|
||||
* el.id example:
|
||||
* "criteriaGroup::0:::0:-:crit0id"
|
||||
* [grouping from metadata]::[index]:::[elementIndex]:-:[assignedID from metadata]
|
||||
* index is row-number
|
||||
* elementIndex is the index of the current element in this row
|
||||
var index = el.id.slice(el.id.indexOf("::") + 2, el.id.indexOf(":::"));
|
||||
var elementRow = el.boxObject.parentBox;
|
||||
var elementIndex = el.id.slice(el.id.indexOf(":::") + 3, el.id.indexOf(":-:"));
|
||||
|
||||
elementIndex++;
|
||||
var elementKey = "element" + elementIndex;
|
||||
var focusElement = SUGAR.dependentDropdown.dropdowns[focusDD].elements[elementKey];
|
||||
|
||||
if(focusElement) {
|
||||
if(focusElement.handlers) {
|
||||
try {
|
||||
focusElement = focusElement.handlers[el.value];
|
||||
|
@ -93,219 +93,214 @@ SUGAR.dependentDropdown.handleDependentDropdown = function(el) {
|
|||
SUGAR.dependentDropdown.generateElement(focusElement, elementRow, index, elementIndex);
|
||||
} else {
|
||||
}
|
||||
*/
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
SUGAR.dependentDropdown.generateElement = function (focusElement, elementRow, index, elementIndex) {
|
||||
if (SUGAR.dependentDropdown.debugMode) SUGAR.dependentDropdown.utils.debugStack('generateElement');
|
||||
|
||||
var tmp = null;
|
||||
|
||||
if (focusElement) {
|
||||
/* get sandbox to play in */
|
||||
var sandbox = SUGAR.dependentDropdown.utils.generateElementContainer(focusElement, elementRow, index, elementIndex);
|
||||
|
||||
/* handle labels that appear 'left' or 'top' */
|
||||
if (focusElement.label) {
|
||||
focusLabel = {
|
||||
tag: 'span',
|
||||
cls: 'routingLabel',
|
||||
html: " " + focusElement.label + " "
|
||||
}
|
||||
|
||||
switch (focusElement.label_pos) {
|
||||
case "top":
|
||||
focusLabel.html = focusElement.label + "<br />";
|
||||
break;
|
||||
|
||||
case "bottom":
|
||||
focusLabel.html = "<br />" + focusElement.label;
|
||||
break;
|
||||
}
|
||||
|
||||
if (focusElement.label_pos == 'left' || focusElement.label_pos == 'top') {
|
||||
YAHOO.ext.DomHelper.append(sandbox, focusLabel);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* FUN PART BELOW
|
||||
*/
|
||||
switch (focusElement.type) {
|
||||
case 'input':
|
||||
/*
|
||||
* focusElement.values can be lazy-loaded via JS call
|
||||
*/
|
||||
if (typeof(focusElement.values) == 'string') {
|
||||
SUGAR.util.globalEval('retValue = ' + focusElement.values);
|
||||
focusElement.values = retValue;
|
||||
}
|
||||
|
||||
/* Define the key-value that is to be used to pre-select a value in the dropdown */
|
||||
var preselect = SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name);
|
||||
|
||||
if (preselect.match(/::/))
|
||||
preselect = '';
|
||||
|
||||
tmp = YAHOO.ext.DomHelper.append(sandbox, {
|
||||
tag: 'input',
|
||||
id: focusElement.grouping + "::" + index + ":::" + elementIndex + ":-:" + focusElement.id,
|
||||
name: focusElement.grouping + "::" + index + "::" + focusElement.name,
|
||||
cls: 'input',
|
||||
onchange: focusElement.onchange,
|
||||
value: preselect
|
||||
}, true);
|
||||
var newElement = tmp.dom;
|
||||
break;
|
||||
|
||||
|
||||
case 'select':
|
||||
tmp = YAHOO.ext.DomHelper.append(sandbox, {
|
||||
tag: 'select',
|
||||
id: focusElement.grouping + "::" + index + ":::" + elementIndex + ":-:" + focusElement.id,
|
||||
name: focusElement.grouping + "::" + index + "::" + focusElement.name,
|
||||
cls: 'input',
|
||||
onchange: focusElement.onchange
|
||||
}, true);
|
||||
var newElement = tmp.dom;
|
||||
|
||||
/*
|
||||
* focusElement.values can be lazy-loaded via JS call
|
||||
*/
|
||||
if (typeof(focusElement.values) == 'string') {
|
||||
SUGAR.util.globalEval('retValue = ' + focusElement.values);
|
||||
focusElement.values = retValue;
|
||||
}
|
||||
|
||||
SUGAR.dependentDropdown.generateElement = function(focusElement, elementRow, index, elementIndex) {
|
||||
if(SUGAR.dependentDropdown.debugMode) SUGAR.dependentDropdown.utils.debugStack('generateElement');
|
||||
|
||||
var tmp = null;
|
||||
|
||||
if(focusElement) {
|
||||
/* get sandbox to play in */
|
||||
var sandbox = SUGAR.dependentDropdown.utils.generateElementContainer(focusElement, elementRow, index, elementIndex);
|
||||
|
||||
/* handle labels that appear 'left' or 'top' */
|
||||
if(focusElement.label) {
|
||||
focusLabel = {
|
||||
tag : 'span',
|
||||
cls : 'routingLabel',
|
||||
html : " " + focusElement.label + " "
|
||||
}
|
||||
|
||||
switch(focusElement.label_pos) {
|
||||
case "top":
|
||||
focusLabel.html = focusElement.label + "<br />";
|
||||
break;
|
||||
|
||||
case "bottom":
|
||||
focusLabel.html = "<br />" + focusElement.label;
|
||||
break;
|
||||
}
|
||||
|
||||
if(focusElement.label_pos == 'left' || focusElement.label_pos == 'top') {
|
||||
YAHOO.ext.DomHelper.append(sandbox, focusLabel);
|
||||
}
|
||||
}
|
||||
/* Define the key-value that is to be used to pre-select a value in the dropdown */
|
||||
var preselect = SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name);
|
||||
|
||||
/**********************************************************************
|
||||
* FUN PART BELOW
|
||||
*/
|
||||
switch(focusElement.type) {
|
||||
case 'input':
|
||||
/*
|
||||
* focusElement.values can be lazy-loaded via JS call
|
||||
*/
|
||||
if(typeof(focusElement.values) == 'string') {
|
||||
SUGAR.util.globalEval('retValue = ' + focusElement.values);
|
||||
focusElement.values = retValue;
|
||||
}
|
||||
|
||||
/* Define the key-value that is to be used to pre-select a value in the dropdown */
|
||||
var preselect = SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name);
|
||||
// Loop through the values (passed or generated) and preselect as needed
|
||||
var i = 0;
|
||||
for (var key in focusElement.values) {
|
||||
var selected = (preselect == key) ? true : false;
|
||||
newElement.options[i] = new Option(focusElement.values[key], key, selected);
|
||||
|
||||
if(preselect.match(/::/))
|
||||
preselect = '';
|
||||
// ie6/7 workaround
|
||||
if (selected) {
|
||||
newElement.options[i].selected = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
|
||||
tmp = YAHOO.ext.DomHelper.append(sandbox, {
|
||||
tag : 'input',
|
||||
id : focusElement.grouping + "::" + index + ":::" + elementIndex + ":-:" + focusElement.id,
|
||||
name : focusElement.grouping + "::" + index + "::" + focusElement.name,
|
||||
cls : 'input',
|
||||
onchange : focusElement.onchange,
|
||||
value : preselect
|
||||
}, true);
|
||||
var newElement = tmp.dom;
|
||||
break;
|
||||
case 'none':
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
alert('implement checkbox pls');
|
||||
break;
|
||||
case 'multiple':
|
||||
alert('implement multiple pls');
|
||||
break;
|
||||
|
||||
case 'select':
|
||||
tmp = YAHOO.ext.DomHelper.append(sandbox, {
|
||||
tag : 'select',
|
||||
id : focusElement.grouping + "::" + index + ":::" + elementIndex + ":-:" + focusElement.id,
|
||||
name : focusElement.grouping + "::" + index + "::" + focusElement.name,
|
||||
cls : 'input',
|
||||
onchange : focusElement.onchange
|
||||
}, true);
|
||||
var newElement = tmp.dom;
|
||||
|
||||
/*
|
||||
* focusElement.values can be lazy-loaded via JS call
|
||||
*/
|
||||
if(typeof(focusElement.values) == 'string') {
|
||||
SUGAR.util.globalEval('retValue = ' + focusElement.values);
|
||||
focusElement.values = retValue;
|
||||
}
|
||||
|
||||
/* Define the key-value that is to be used to pre-select a value in the dropdown */
|
||||
var preselect = SUGAR.dependentDropdown.utils.getPreselectKey(focusElement.name);
|
||||
|
||||
// Loop through the values (passed or generated) and preselect as needed
|
||||
var i = 0;
|
||||
for(var key in focusElement.values) {
|
||||
var selected = (preselect == key) ? true : false;
|
||||
newElement.options[i] = new Option(focusElement.values[key], key, selected);
|
||||
default:
|
||||
if (SUGAR.dependentDropdown.dropdowns.debugMode) {
|
||||
alert("Improper type defined: [ " + focusElement.type + "]");
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
// ie6/7 workaround
|
||||
if(selected) {
|
||||
newElement.options[i].selected = true;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'none':
|
||||
break;
|
||||
|
||||
case 'checkbox':
|
||||
alert('implement checkbox pls');
|
||||
break;
|
||||
case 'multiple':
|
||||
alert('implement multiple pls');
|
||||
break;
|
||||
|
||||
default:
|
||||
if(SUGAR.dependentDropdown.dropdowns.debugMode) {
|
||||
alert("Improper type defined: [ " + focusElement.type + "]");
|
||||
}
|
||||
return;
|
||||
break;
|
||||
}
|
||||
/* handle label placement *after* or *below* the drop-down */
|
||||
if (focusElement.label) {
|
||||
if (focusElement.label_pos == 'right' || focusElement.label_pos == 'bottom') {
|
||||
YAHOO.ext.DomHelper.append(sandbox, focusLabel);
|
||||
}
|
||||
}
|
||||
|
||||
/* handle label placement *after* or *below* the drop-down */
|
||||
if(focusElement.label) {
|
||||
if(focusElement.label_pos == 'right' || focusElement.label_pos == 'bottom') {
|
||||
YAHOO.ext.DomHelper.append(sandbox, focusLabel);
|
||||
}
|
||||
}
|
||||
/* trigger dependent dropdown action to cascade dependencies */
|
||||
try {
|
||||
newElement.onchange();
|
||||
//eval(focusElement.onchange); "this" has no reference
|
||||
} catch (e) {
|
||||
if (SUGAR.dependentDropdown.dropdowns.debugMode) {
|
||||
debugger;
|
||||
}
|
||||
}
|
||||
|
||||
/* trigger dependent dropdown action to cascade dependencies */
|
||||
try {
|
||||
newElement.onchange();
|
||||
//eval(focusElement.onchange); "this" has no reference
|
||||
} catch(e) {
|
||||
if(SUGAR.dependentDropdown.dropdowns.debugMode) {
|
||||
debugger;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//// UTILS
|
||||
SUGAR.dependentDropdown.utils = {
|
||||
/**
|
||||
* creates a DIV container for a given element
|
||||
* @param object focusElement Element in focus' metadata
|
||||
* @param object elementRow Parent DIV container's DOM object
|
||||
* @param int index Index of current elementRow
|
||||
* @param int elementIndex Index of the element in focus relative to others in the definition
|
||||
* @return obj Reference DOM object generated
|
||||
*/
|
||||
generateElementContainer : function(focusElement, elementRow, index, elementIndex) {
|
||||
/* clear out existing element if exists */
|
||||
var oldElement = document.getElementById('elementContainer' + focusElement.grouping + "::" + index + ":::" + elementIndex);
|
||||
|
||||
if(oldElement) {
|
||||
SUGAR.dependentDropdown.utils.removeChildren(oldElement);
|
||||
}
|
||||
|
||||
/* create sandbox to ease removal */
|
||||
var tmp = YAHOO.ext.DomHelper.append(elementRow, {
|
||||
tag : 'span',
|
||||
id : 'elementContainer' + focusElement.grouping + "::" + index + ":::" + elementIndex
|
||||
}, true);
|
||||
|
||||
return tmp.dom;
|
||||
},
|
||||
/**
|
||||
* Finds the preselect key from the User's saved (loaded into memory) metadata
|
||||
* @param string elementName Name of form element - functions as key to user's saved value
|
||||
*/
|
||||
getPreselectKey : function(elementName) {
|
||||
try {
|
||||
if(SUGAR.dependentDropdown.currentAction.action[elementName]) {
|
||||
return SUGAR.dependentDropdown.currentAction.action[elementName];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} catch(e) {
|
||||
if(SUGAR.dependentDropdown.dropdowns.debugMode) {
|
||||
//debugger;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* provides a list of methods called in order when debugging
|
||||
* @param object
|
||||
*/
|
||||
debugStack : function(func) {
|
||||
if(!SUGAR.dependentDropdown._stack) {
|
||||
SUGAR.dependentDropdown._stack = new Array();
|
||||
}
|
||||
|
||||
SUGAR.dependentDropdown._stack.push(func);
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes all child nodes from the passed DOM element
|
||||
*/
|
||||
removeChildren : function(el) {
|
||||
for(i=el.childNodes.length - 1; i >= 0; i--) {
|
||||
if(el.childNodes[i]) {
|
||||
el.removeChild(el.childNodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* creates a DIV container for a given element
|
||||
* @param object focusElement Element in focus' metadata
|
||||
* @param object elementRow Parent DIV container's DOM object
|
||||
* @param int index Index of current elementRow
|
||||
* @param int elementIndex Index of the element in focus relative to others in the definition
|
||||
* @return obj Reference DOM object generated
|
||||
*/
|
||||
generateElementContainer: function (focusElement, elementRow, index, elementIndex) {
|
||||
/* clear out existing element if exists */
|
||||
var oldElement = document.getElementById('elementContainer' + focusElement.grouping + "::" + index + ":::" + elementIndex);
|
||||
|
||||
if (oldElement) {
|
||||
SUGAR.dependentDropdown.utils.removeChildren(oldElement);
|
||||
}
|
||||
|
||||
/* create sandbox to ease removal */
|
||||
var tmp = YAHOO.ext.DomHelper.append(elementRow, {
|
||||
tag: 'span',
|
||||
id: 'elementContainer' + focusElement.grouping + "::" + index + ":::" + elementIndex
|
||||
}, true);
|
||||
|
||||
return tmp.dom;
|
||||
},
|
||||
/**
|
||||
* Finds the preselect key from the User's saved (loaded into memory) metadata
|
||||
* @param string elementName Name of form element - functions as key to user's saved value
|
||||
*/
|
||||
getPreselectKey: function (elementName) {
|
||||
try {
|
||||
if (SUGAR.dependentDropdown.currentAction.action[elementName]) {
|
||||
return SUGAR.dependentDropdown.currentAction.action[elementName];
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
} catch (e) {
|
||||
if (SUGAR.dependentDropdown.dropdowns.debugMode) {
|
||||
//debugger;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* provides a list of methods called in order when debugging
|
||||
* @param object
|
||||
*/
|
||||
debugStack: function (func) {
|
||||
if (!SUGAR.dependentDropdown._stack) {
|
||||
SUGAR.dependentDropdown._stack = new Array();
|
||||
}
|
||||
|
||||
SUGAR.dependentDropdown._stack.push(func);
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes all child nodes from the passed DOM element
|
||||
*/
|
||||
removeChildren: function (el) {
|
||||
for (i = el.childNodes.length - 1; i >= 0; i--) {
|
||||
if (el.childNodes[i]) {
|
||||
el.removeChild(el.childNodes[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -38,104 +38,106 @@
|
|||
*/
|
||||
|
||||
|
||||
SUGAR.importWizard= {};
|
||||
SUGAR.importWizard = {};
|
||||
|
||||
SUGAR.importWizard = function() {
|
||||
return {
|
||||
|
||||
renderDialog: function(importModuleVAR,actionVar,sourceVar){
|
||||
|
||||
//show loading panel
|
||||
//SUGAR.importWizard.renderLoadingDialog();
|
||||
|
||||
|
||||
// create dialog container div
|
||||
var oBody = document.getElementsByTagName('BODY').item(0);
|
||||
if ( !document.getElementById( "importWizardDialog" )) {
|
||||
var importWizardDialogDiv = document.createElement("div");
|
||||
importWizardDialogDiv.id = "importWizardDialog";
|
||||
importWizardDialogDiv.style.display = "none";
|
||||
importWizardDialogDiv.className = "dashletPanelMenu wizard import";
|
||||
importWizardDialogDiv.innerHTML = '<div class="hd"><a href="javascript:void(0)" onClick="javascript:SUGAR.importWizard.closeDialog();"><div class="container-close"> </div></a><div class="title" id="importWizardDialogTitle"></div></div><div class="bd"><div class="screen" id="importWizardDialogDiv"></div><div id="submitDiv"></div></div>';
|
||||
oBody.appendChild(importWizardDialogDiv);
|
||||
}
|
||||
|
||||
|
||||
|
||||
YAHOO.util.Event.onContentReady("importWizardDialog", function()
|
||||
{
|
||||
SUGAR.importWizard.dialog = new YAHOO.widget.Dialog("importWizardDialog",
|
||||
{ width : "950px",
|
||||
height: "565px",
|
||||
fixedcenter : true,
|
||||
draggable:false,
|
||||
visible : false,
|
||||
modal : true,
|
||||
close:false
|
||||
} );
|
||||
|
||||
var oHead = document.getElementsByTagName('HEAD').item(0);
|
||||
// insert requred js files
|
||||
if ( !document.getElementById( "sugar_grp_yui_widgets" )) {
|
||||
var oScript= document.createElement("script");
|
||||
oScript.type = "text/javascript";
|
||||
oScript.id = "sugar_grp_yui_widgets";
|
||||
oScript.src="cache/include/javascript/sugar_grp_yui_widgets.js";
|
||||
oHead.appendChild( oScript);
|
||||
}
|
||||
|
||||
|
||||
|
||||
var success = function(data) {
|
||||
var response = YAHOO.lang.JSON.parse(data.responseText);
|
||||
importWizardDialogDiv = document.getElementById('importWizardDialogDiv');
|
||||
var submitDiv = document.getElementById('submitDiv');
|
||||
var importWizardDialogTitle = document.getElementById('importWizardDialogTitle');
|
||||
importWizardDialogDiv.innerHTML = response['html'];
|
||||
importWizardDialogTitle.innerHTML = response['title'];
|
||||
submitDiv.innerHTML = response['submitContent'];
|
||||
document.getElementById('importWizardDialog').style.display = '';
|
||||
SUGAR.importWizard.dialog.render();
|
||||
SUGAR.importWizard.dialog.show();
|
||||
|
||||
SUGAR.util.globalEval(response['script']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('GET', 'index.php?module=Import&action='+actionVar+'&import_module='+importModuleVAR+'&source='+sourceVar, {success: success, failure: success});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//document.getElementById('importWizardDialog_c').style.display = 'none';
|
||||
},
|
||||
closeDialog: function() {
|
||||
|
||||
SUGAR.importWizard.dialog.hide();
|
||||
var importWizardDialogDiv = document.getElementById('importWizardDialogDiv');
|
||||
var submitDiv = document.getElementById('submitDiv');
|
||||
importWizardDialogDiv.innerHTML = "";
|
||||
submitDiv.innerHTML = "";
|
||||
SUGAR.importWizard.dialog.destroy();
|
||||
},
|
||||
|
||||
renderLoadingDialog: function() {
|
||||
SUGAR.importWizard.loading = new YAHOO.widget.Panel("loading",
|
||||
{ width:"240px",
|
||||
fixedcenter:true,
|
||||
close:false,
|
||||
draggable:false,
|
||||
constraintoviewport:false,
|
||||
modal:true,
|
||||
visible:false,
|
||||
effect:[{effect:YAHOO.widget.ContainerEffect.SLIDE, duration:0.5},
|
||||
{effect:YAHOO.widget.ContainerEffect.FADE, duration:.5}]
|
||||
});
|
||||
SUGAR.importWizard.loading.setBody('<div id="loadingPage" align="center" style="vertical-align:middle;"><img src="' + SUGAR.themes.image_server + 'index.php?entryPoint=getImage&themeName='+SUGAR.themes.theme_name+'&imageName=img_loading.gif" align="absmiddle" /> <b>' + SUGAR.language.get('app_strings', 'LBL_LOADING_PAGE') +'</b></div>');
|
||||
SUGAR.importWizard.loading.render(document.body);
|
||||
if (document.getElementById('loading_c'))
|
||||
document.getElementById('loading_c').style.display = 'none';
|
||||
}
|
||||
};
|
||||
SUGAR.importWizard = function () {
|
||||
return {
|
||||
|
||||
renderDialog: function (importModuleVAR, actionVar, sourceVar) {
|
||||
|
||||
//show loading panel
|
||||
//SUGAR.importWizard.renderLoadingDialog();
|
||||
|
||||
|
||||
// create dialog container div
|
||||
var oBody = document.getElementsByTagName('BODY').item(0);
|
||||
if (!document.getElementById("importWizardDialog")) {
|
||||
var importWizardDialogDiv = document.createElement("div");
|
||||
importWizardDialogDiv.id = "importWizardDialog";
|
||||
importWizardDialogDiv.style.display = "none";
|
||||
importWizardDialogDiv.className = "dashletPanelMenu wizard import";
|
||||
importWizardDialogDiv.innerHTML = '<div class="hd"><a href="javascript:void(0)" onClick="javascript:SUGAR.importWizard.closeDialog();"><div class="container-close"> </div></a><div class="title" id="importWizardDialogTitle"></div></div><div class="bd"><div class="screen" id="importWizardDialogDiv"></div><div id="submitDiv"></div></div>';
|
||||
oBody.appendChild(importWizardDialogDiv);
|
||||
}
|
||||
|
||||
|
||||
YAHOO.util.Event.onContentReady("importWizardDialog", function () {
|
||||
SUGAR.importWizard.dialog = new YAHOO.widget.Dialog("importWizardDialog",
|
||||
{
|
||||
width: "950px",
|
||||
height: "565px",
|
||||
fixedcenter: true,
|
||||
draggable: false,
|
||||
visible: false,
|
||||
modal: true,
|
||||
close: false
|
||||
});
|
||||
|
||||
var oHead = document.getElementsByTagName('HEAD').item(0);
|
||||
// insert requred js files
|
||||
if (!document.getElementById("sugar_grp_yui_widgets")) {
|
||||
var oScript = document.createElement("script");
|
||||
oScript.type = "text/javascript";
|
||||
oScript.id = "sugar_grp_yui_widgets";
|
||||
oScript.src = "cache/include/javascript/sugar_grp_yui_widgets.js";
|
||||
oHead.appendChild(oScript);
|
||||
}
|
||||
|
||||
|
||||
var success = function (data) {
|
||||
var response = YAHOO.lang.JSON.parse(data.responseText);
|
||||
importWizardDialogDiv = document.getElementById('importWizardDialogDiv');
|
||||
var submitDiv = document.getElementById('submitDiv');
|
||||
var importWizardDialogTitle = document.getElementById('importWizardDialogTitle');
|
||||
importWizardDialogDiv.innerHTML = response['html'];
|
||||
importWizardDialogTitle.innerHTML = response['title'];
|
||||
submitDiv.innerHTML = response['submitContent'];
|
||||
document.getElementById('importWizardDialog').style.display = '';
|
||||
SUGAR.importWizard.dialog.render();
|
||||
SUGAR.importWizard.dialog.show();
|
||||
|
||||
SUGAR.util.globalEval(response['script']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
var cObj = YAHOO.util.Connect.asyncRequest('GET', 'index.php?module=Import&action=' + actionVar + '&import_module=' + importModuleVAR + '&source=' + sourceVar, {
|
||||
success: success,
|
||||
failure: success
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
//document.getElementById('importWizardDialog_c').style.display = 'none';
|
||||
},
|
||||
closeDialog: function () {
|
||||
|
||||
SUGAR.importWizard.dialog.hide();
|
||||
var importWizardDialogDiv = document.getElementById('importWizardDialogDiv');
|
||||
var submitDiv = document.getElementById('submitDiv');
|
||||
importWizardDialogDiv.innerHTML = "";
|
||||
submitDiv.innerHTML = "";
|
||||
SUGAR.importWizard.dialog.destroy();
|
||||
},
|
||||
|
||||
renderLoadingDialog: function () {
|
||||
SUGAR.importWizard.loading = new YAHOO.widget.Panel("loading",
|
||||
{
|
||||
width: "240px",
|
||||
fixedcenter: true,
|
||||
close: false,
|
||||
draggable: false,
|
||||
constraintoviewport: false,
|
||||
modal: true,
|
||||
visible: false,
|
||||
effect: [{effect: YAHOO.widget.ContainerEffect.SLIDE, duration: 0.5},
|
||||
{effect: YAHOO.widget.ContainerEffect.FADE, duration: .5}]
|
||||
});
|
||||
SUGAR.importWizard.loading.setBody('<div id="loadingPage" align="center" style="vertical-align:middle;"><img src="' + SUGAR.themes.image_server + 'index.php?entryPoint=getImage&themeName=' + SUGAR.themes.theme_name + '&imageName=img_loading.gif" align="absmiddle" /> <b>' + SUGAR.language.get('app_strings', 'LBL_LOADING_PAGE') + '</b></div>');
|
||||
SUGAR.importWizard.loading.render(document.body);
|
||||
if (document.getElementById('loading_c'))
|
||||
document.getElementById('loading_c').style.display = 'none';
|
||||
}
|
||||
};
|
||||
}();
|
|
@ -44,20 +44,22 @@
|
|||
///////////////////////////////////////////////
|
||||
|
||||
function SugarClass() {
|
||||
this.init();
|
||||
this.init();
|
||||
}
|
||||
|
||||
SugarClass.prototype.init = function() {}
|
||||
SugarClass.prototype.init = function () {
|
||||
}
|
||||
|
||||
// create inheritance for a class
|
||||
SugarClass.inherit = function(className,parentClassName) {
|
||||
var str = className+".prototype = new "+parentClassName+"();";
|
||||
str += className+".prototype.constructor = "+className+";";
|
||||
str += className+".superclass = "+parentClassName+".prototype;";
|
||||
SugarClass.inherit = function (className, parentClassName) {
|
||||
var str = className + ".prototype = new " + parentClassName + "();";
|
||||
str += className + ".prototype.constructor = " + className + ";";
|
||||
str += className + ".superclass = " + parentClassName + ".prototype;";
|
||||
|
||||
try {
|
||||
SUGAR.util.globalEval(str);
|
||||
} catch (e) {}
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
//Root class of Sugar JS Application:
|
||||
|
@ -65,22 +67,22 @@ SugarClass.inherit = function(className,parentClassName) {
|
|||
SugarClass.inherit("SugarContainer", "SugarClass");
|
||||
|
||||
function SugarContainer(root_div) {
|
||||
GLOBAL_REGISTRY.container = this;
|
||||
this.init(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.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);
|
||||
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();
|
||||
if (typeof(global_request_registry) == "undefined") {
|
||||
var global_request_registry = new Object();
|
||||
}
|
||||
var req_count = 0;
|
||||
|
||||
|
@ -90,161 +92,161 @@ var req_count = 0;
|
|||
//
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
SugarClass.inherit("SugarDateTime","SugarClass");
|
||||
SugarClass.inherit("SugarDateTime", "SugarClass");
|
||||
|
||||
function SugarDateTime() {
|
||||
this.init(root_div);
|
||||
this.init(root_div);
|
||||
}
|
||||
|
||||
SugarDateTime.prototype.init = function(root_div) {
|
||||
this.root_div = root_div;
|
||||
SugarDateTime.prototype.init = function (root_div) {
|
||||
this.root_div = root_div;
|
||||
}
|
||||
|
||||
// return the javascript Date object
|
||||
// given the Sugar Meetings date_start/time_start or date_end/time_end
|
||||
SugarDateTime.mysql2jsDateTime = function(mysql_date, mysql_time) {
|
||||
var match = new RegExp(date_reg_format);
|
||||
if (((result = match.exec(mysql_date))) == null) {
|
||||
return null;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
var match2 = new RegExp(time_reg_format);
|
||||
|
||||
if ((result2 = match2.exec(mysql_time)) == null) {
|
||||
result2 = [0,0,0,0];
|
||||
else if (result2[1] == 12) {
|
||||
result2[1] = 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);
|
||||
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);
|
||||
}
|
||||
// make it a static func
|
||||
|
||||
// return the formatted day of the week of the date given a date object
|
||||
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];
|
||||
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;
|
||||
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:
|
||||
// cn: use locale's date separator? probably not.
|
||||
//returnDate += " " + userDateFormat.charAt(i);
|
||||
}
|
||||
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:
|
||||
// cn: use locale's date separator? probably not.
|
||||
//returnDate += " " + userDateFormat.charAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
return returnDate;
|
||||
return returnDate;
|
||||
}
|
||||
|
||||
SugarDateTime.getFormattedDate = SugarDateTime.prototype.getFormattedDate;
|
||||
|
||||
// return the formatted day of the week of the date given a date object
|
||||
SugarDateTime.prototype.getFormattedDOW = function(date_obj) {
|
||||
var hour = config.strings.mod_strings.Calendar.dow[date_obj.getDay()];
|
||||
SugarDateTime.prototype.getFormattedDOW = function (date_obj) {
|
||||
var hour = config.strings.mod_strings.Calendar.dow[date_obj.getDay()];
|
||||
}
|
||||
SugarDateTime.getFormattedDOW = SugarDateTime.prototype.getFormattedDOW;
|
||||
|
||||
// return the formatted hour of the date given a date object
|
||||
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.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;
|
||||
|
||||
//mod.SugarDateTime.getFormattedDate = publ.getFormattedDate;
|
||||
|
||||
// return the javascript Date object given a vCal UTC string
|
||||
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.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) {
|
||||
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);
|
||||
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 (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 (((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_ts < dst_end_ts) && dst_start_ts > dst_end_ts)
|
||||
|| (event_ts >= dst_start_ts && event_ts < dst_end_ts)) {
|
||||
new_date = new Date(new_date.getTime() + 60 * 60 * 1000);
|
||||
}
|
||||
if (((event_ts >= dst_start_ts || event_ts < dst_end_ts) && dst_start_ts > dst_end_ts)
|
||||
|| (event_ts >= dst_start_ts && event_ts < dst_end_ts)) {
|
||||
new_date = new Date(new_date.getTime() + 60 * 60 * 1000);
|
||||
}
|
||||
|
||||
new_date = new Date(new_date.getTime() + gmt_offset_secs * 1000);
|
||||
new_date = new Date(new_date.getTime() + gmt_offset_secs * 1000);
|
||||
|
||||
}
|
||||
}
|
||||
return new_date;
|
||||
}
|
||||
return new_date;
|
||||
}
|
||||
|
||||
SugarDateTime.parseAdjustedDate = SugarDateTime.prototype.parseAdjustedDate;
|
||||
|
||||
// create a hash based on a date
|
||||
SugarDateTime.prototype.getUTCHash = function(startdate) {
|
||||
var month = (startdate.getUTCMonth() < 10) ? "0" + startdate.getUTCMonth() : "" + startdate.getUTCMonth();
|
||||
var day = (startdate.getUTCDate() < 10) ? "0" + startdate.getUTCDate() : "" + startdate.getUTCDate();
|
||||
var hours = (startdate.getUTCHours() < 10) ? "0" + startdate.getUTCHours() : "" + startdate.getUTCHours();
|
||||
var minutes = (startdate.getUTCMinutes() < 10) ? "0" + startdate.getUTCMinutes() : "" + startdate.getUTCMinutes();
|
||||
return startdate.getUTCFullYear() + month + day + hours + minutes;
|
||||
SugarDateTime.prototype.getUTCHash = function (startdate) {
|
||||
var month = (startdate.getUTCMonth() < 10) ? "0" + startdate.getUTCMonth() : "" + startdate.getUTCMonth();
|
||||
var day = (startdate.getUTCDate() < 10) ? "0" + startdate.getUTCDate() : "" + startdate.getUTCDate();
|
||||
var hours = (startdate.getUTCHours() < 10) ? "0" + startdate.getUTCHours() : "" + startdate.getUTCHours();
|
||||
var minutes = (startdate.getUTCMinutes() < 10) ? "0" + startdate.getUTCMinutes() : "" + startdate.getUTCMinutes();
|
||||
return startdate.getUTCFullYear() + month + day + hours + minutes;
|
||||
}
|
||||
|
||||
SugarDateTime.getUTCHash = SugarDateTime.prototype.getUTCHash;
|
||||
|
|
|
@ -38,312 +38,313 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Helper function used in send_backs to close the popup window if closePopup is true.
|
||||
*/
|
||||
function closePopup() {
|
||||
var closePopup = window.opener.get_close_popup();
|
||||
if (closePopup)
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
var closePopup = window.opener.get_close_popup();
|
||||
if (closePopup) {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Bug: 48726
|
||||
* Helper function used in send_backs to show confirm dialog with appropriate message.
|
||||
* Helper function used in send_backs to show confirm dialog with appropriate message.
|
||||
* Collects label data from the the parent window.
|
||||
*
|
||||
*
|
||||
* If similar bugs appear, please refer to Bug 48726, and use these helper functions.
|
||||
*/
|
||||
function confirmDialog(arrayContents, formName) {
|
||||
var newData = '';
|
||||
var labels = '';
|
||||
var oldData = '';
|
||||
var newData = '';
|
||||
var labels = '';
|
||||
var oldData = '';
|
||||
SUGAR.util.globalEval("var data = {" + arrayContents.join(",") + "}");
|
||||
var opener = window.opener.document;
|
||||
for (var key in data)
|
||||
{
|
||||
var displayValue = replaceHTMLChars(data[key]);
|
||||
if (opener.forms[formName] && opener.getElementById(key + '_label') != null && !key.match(/account/))
|
||||
{
|
||||
var dataLabel = opener.getElementById(key + '_label').innerHTML.replace(/\n/gi,'').replace(/<\/?[^>]+(>|$)/g, "");
|
||||
labels += dataLabel + ' \n';
|
||||
newData += dataLabel + ' ' + displayValue + '\n';
|
||||
if(window.opener.document.forms[formName].elements[key]) {
|
||||
oldData += dataLabel + ' ' + opener.forms[formName].elements[key].value + '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
var opener = window.opener.document;
|
||||
for (var key in data) {
|
||||
var displayValue = replaceHTMLChars(data[key]);
|
||||
if (opener.forms[formName] && opener.getElementById(key + '_label') != null && !key.match(/account/)) {
|
||||
var dataLabel = opener.getElementById(key + '_label').innerHTML.replace(/\n/gi, '').replace(/<\/?[^>]+(>|$)/g, "");
|
||||
labels += dataLabel + ' \n';
|
||||
newData += dataLabel + ' ' + displayValue + '\n';
|
||||
if (window.opener.document.forms[formName].elements[key]) {
|
||||
oldData += dataLabel + ' ' + opener.forms[formName].elements[key].value + '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var popupConfirm = 0;
|
||||
if (data['account_id'] && (newData.split("\n").length - 1) > 2)
|
||||
{
|
||||
if(newData != oldData && oldData != labels)
|
||||
{
|
||||
if(confirm(SUGAR.language.get('app_strings', 'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM') + '\n\n' + newData))
|
||||
{
|
||||
popupConfirm = 1;
|
||||
} else {
|
||||
popupConfirm = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return popupConfirm;
|
||||
var popupConfirm = 0;
|
||||
if (data['account_id'] && (newData.split("\n").length - 1) > 2) {
|
||||
if (newData != oldData && oldData != labels) {
|
||||
if (confirm(SUGAR.language.get('app_strings', 'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM') + '\n\n' + newData)) {
|
||||
popupConfirm = 1;
|
||||
} else {
|
||||
popupConfirm = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return popupConfirm;
|
||||
}
|
||||
|
||||
function send_back(module, id)
|
||||
{
|
||||
var associated_row_data = associated_javascript_data[id];
|
||||
function send_back(module, id) {
|
||||
var associated_row_data = associated_javascript_data[id];
|
||||
|
||||
// cn: bug 12274 - stripping false-positive security envelope
|
||||
// cn: bug 12274 - stripping false-positive security envelope
|
||||
SUGAR.util.globalEval("var temp_request_data = " + window.document.forms['popup_query_form'].request_data.value);
|
||||
if(temp_request_data.jsonObject) {
|
||||
var request_data = temp_request_data.jsonObject;
|
||||
} else {
|
||||
var request_data = temp_request_data; // passed data that is NOT incorrectly encoded via JSON.encode();
|
||||
}
|
||||
// cn: end bug 12274 fix
|
||||
|
||||
var passthru_data = Object();
|
||||
if(typeof(request_data.passthru_data) != 'undefined')
|
||||
{
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
var form_name = request_data.form_name;
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
if (temp_request_data.jsonObject) {
|
||||
var request_data = temp_request_data.jsonObject;
|
||||
} else {
|
||||
var request_data = temp_request_data; // passed data that is NOT incorrectly encoded via JSON.encode();
|
||||
}
|
||||
// cn: end bug 12274 fix
|
||||
|
||||
var passthru_data = Object();
|
||||
if (typeof(request_data.passthru_data) != 'undefined') {
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
var form_name = request_data.form_name;
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
|
||||
SUGAR.util.globalEval("var call_back_function = window.opener." + request_data.call_back_function);
|
||||
var array_contents = Array();
|
||||
var array_contents = Array();
|
||||
|
||||
// constructs the array of values associated to the bean that the user clicked
|
||||
var fill_array_contents = function(the_key, the_name)
|
||||
{
|
||||
var the_value = '';
|
||||
if (module != '' && id != '') {
|
||||
if (associated_row_data['DOCUMENT_NAME'] && the_key.toUpperCase() == "NAME") {
|
||||
the_value = associated_row_data['DOCUMENT_NAME'];
|
||||
} else if ((the_key.toUpperCase() == 'USER_NAME' || the_key.toUpperCase() == 'LAST_NAME' || the_key.toUpperCase() == 'FIRST_NAME')
|
||||
&& typeof(is_show_fullname) != 'undefined' && is_show_fullname && form_name != 'search_form') {
|
||||
//if it is from searchform, it will search by assigned_user_name like 'ABC%', then it will return nothing
|
||||
the_value = associated_row_data['FULL_NAME'];
|
||||
} else {
|
||||
the_value = associated_row_data[the_key.toUpperCase()];
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof(the_value) == 'string') {
|
||||
the_value = the_value.replace(/\r\n|\n|\r/g, '\\n');
|
||||
}
|
||||
|
||||
array_contents.push('"' + the_name + '":"' + the_value + '"');
|
||||
// constructs the array of values associated to the bean that the user clicked
|
||||
var fill_array_contents = function (the_key, the_name) {
|
||||
var the_value = '';
|
||||
if (module != '' && id != '') {
|
||||
if (associated_row_data['DOCUMENT_NAME'] && the_key.toUpperCase() == "NAME") {
|
||||
the_value = associated_row_data['DOCUMENT_NAME'];
|
||||
} else if ((the_key.toUpperCase() == 'USER_NAME' || the_key.toUpperCase() == 'LAST_NAME' || the_key.toUpperCase() == 'FIRST_NAME')
|
||||
&& typeof(is_show_fullname) != 'undefined' && is_show_fullname && form_name != 'search_form') {
|
||||
//if it is from searchform, it will search by assigned_user_name like 'ABC%', then it will return nothing
|
||||
the_value = associated_row_data['FULL_NAME'];
|
||||
} else {
|
||||
the_value = associated_row_data[the_key.toUpperCase()];
|
||||
}
|
||||
}
|
||||
|
||||
for(var the_key in field_to_name_array)
|
||||
{
|
||||
if(the_key != 'toJSON')
|
||||
{
|
||||
if (YAHOO.lang.isArray(field_to_name_array[the_key])) {
|
||||
for (var i = 0; i < field_to_name_array[the_key].length; i++) {
|
||||
fill_array_contents(the_key, field_to_name_array[the_key][i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fill_array_contents(the_key, field_to_name_array[the_key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (typeof(the_value) == 'string') {
|
||||
the_value = the_value.replace(/\r\n|\n|\r/g, '\\n');
|
||||
}
|
||||
|
||||
var popupConfirm = confirmDialog(array_contents, form_name);
|
||||
array_contents.push('"' + the_name + '":"' + the_value + '"');
|
||||
}
|
||||
|
||||
for (var the_key in field_to_name_array) {
|
||||
if (the_key != 'toJSON') {
|
||||
if (YAHOO.lang.isArray(field_to_name_array[the_key])) {
|
||||
for (var i = 0; i < field_to_name_array[the_key].length; i++) {
|
||||
fill_array_contents(the_key, field_to_name_array[the_key][i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
fill_array_contents(the_key, field_to_name_array[the_key]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var popupConfirm = confirmDialog(array_contents, form_name);
|
||||
|
||||
SUGAR.util.globalEval("var name_to_value_array = {" + array_contents.join(",") + "}");
|
||||
|
||||
closePopup();
|
||||
|
||||
var result_data = {"form_name":form_name,"name_to_value_array":name_to_value_array,"passthru_data":passthru_data,"popupConfirm":popupConfirm};
|
||||
call_back_function(result_data);
|
||||
closePopup();
|
||||
|
||||
var result_data = {
|
||||
"form_name": form_name,
|
||||
"name_to_value_array": name_to_value_array,
|
||||
"passthru_data": passthru_data,
|
||||
"popupConfirm": popupConfirm
|
||||
};
|
||||
call_back_function(result_data);
|
||||
}
|
||||
|
||||
function send_back_teams(module, form, field, error_message, request_data, form_team_id)
|
||||
{
|
||||
var array_contents = Array();
|
||||
|
||||
if(form_team_id){
|
||||
array_contents.push(form_team_id);
|
||||
}else{
|
||||
var j=0;
|
||||
for (i = 0; i < form.elements.length; i++){
|
||||
if(form.elements[i].name == field) {
|
||||
if (form.elements[i].checked == true) {
|
||||
array_contents.push(form.elements[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (array_contents.length ==0 ) {
|
||||
window.alert(error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
var array_teams = new Array();
|
||||
for(team_id in array_contents) {
|
||||
if(typeof array_contents[team_id] == 'string') {
|
||||
var team = {"team_id" : associated_javascript_data[array_contents[team_id]].ID,
|
||||
"team_name" : associated_javascript_data[array_contents[team_id]].NAME};
|
||||
array_teams.push(team);
|
||||
}
|
||||
}
|
||||
|
||||
var passthru_data = Object();
|
||||
|
||||
if(typeof request_data.call_back_function == 'undefined' && typeof request_data == 'object') {
|
||||
request_data = YAHOO.lang.JSON.parse(request_data.value);
|
||||
}
|
||||
|
||||
if(typeof(request_data.passthru_data) != 'undefined')
|
||||
{
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
|
||||
var form_name = request_data.form_name;
|
||||
var field_name = request_data.field_name;
|
||||
function send_back_teams(module, form, field, error_message, request_data, form_team_id) {
|
||||
var array_contents = Array();
|
||||
|
||||
closePopup();
|
||||
if (form_team_id) {
|
||||
array_contents.push(form_team_id);
|
||||
} else {
|
||||
var j = 0;
|
||||
for (i = 0; i < form.elements.length; i++) {
|
||||
if (form.elements[i].name == field) {
|
||||
if (form.elements[i].checked == true) {
|
||||
array_contents.push(form.elements[i].value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (array_contents.length == 0) {
|
||||
window.alert(error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
var array_teams = new Array();
|
||||
for (team_id in array_contents) {
|
||||
if (typeof array_contents[team_id] == 'string') {
|
||||
var team = {
|
||||
"team_id": associated_javascript_data[array_contents[team_id]].ID,
|
||||
"team_name": associated_javascript_data[array_contents[team_id]].NAME
|
||||
};
|
||||
array_teams.push(team);
|
||||
}
|
||||
}
|
||||
|
||||
var passthru_data = Object();
|
||||
|
||||
if (typeof request_data.call_back_function == 'undefined' && typeof request_data == 'object') {
|
||||
request_data = YAHOO.lang.JSON.parse(request_data.value);
|
||||
}
|
||||
|
||||
if (typeof(request_data.passthru_data) != 'undefined') {
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
|
||||
var form_name = request_data.form_name;
|
||||
var field_name = request_data.field_name;
|
||||
|
||||
closePopup();
|
||||
|
||||
SUGAR.util.globalEval("var call_back_function = window.opener." + request_data.call_back_function);
|
||||
var result_data={"form_name":form_name,"field_name":field_name,"teams":array_teams,"passthru_data":passthru_data};
|
||||
call_back_function(result_data);
|
||||
var result_data = {
|
||||
"form_name": form_name,
|
||||
"field_name": field_name,
|
||||
"teams": array_teams,
|
||||
"passthru_data": passthru_data
|
||||
};
|
||||
call_back_function(result_data);
|
||||
|
||||
}
|
||||
|
||||
function send_back_selected(module, form, field, error_message, request_data)
|
||||
{
|
||||
var array_contents = Array();
|
||||
var j=0;
|
||||
for (i = 0; i < form.elements.length; i++){
|
||||
if(form.elements[i].name == field) {
|
||||
if (form.elements[i].checked == true) {
|
||||
++j;
|
||||
array_contents.push('"' + "ID_" + j + '":"' + form.elements[i].value + '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (array_contents.length ==0 ) {
|
||||
window.alert(error_message);
|
||||
return;
|
||||
}
|
||||
function send_back_selected(module, form, field, error_message, request_data) {
|
||||
var array_contents = Array();
|
||||
var j = 0;
|
||||
for (i = 0; i < form.elements.length; i++) {
|
||||
if (form.elements[i].name == field) {
|
||||
if (form.elements[i].checked == true) {
|
||||
++j;
|
||||
array_contents.push('"' + "ID_" + j + '":"' + form.elements[i].value + '"');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (array_contents.length == 0) {
|
||||
window.alert(error_message);
|
||||
return;
|
||||
}
|
||||
|
||||
SUGAR.util.globalEval("var selection_list_array = {" + array_contents.join(",") + "}");
|
||||
|
||||
// cn: bug 12274 - stripping false-positive security envelope
|
||||
|
||||
// cn: bug 12274 - stripping false-positive security envelope
|
||||
SUGAR.util.globalEval("var temp_request_data = " + window.document.forms['popup_query_form'].request_data.value);
|
||||
|
||||
if(temp_request_data.jsonObject) {
|
||||
var request_data = temp_request_data.jsonObject;
|
||||
} else {
|
||||
var request_data = temp_request_data; // passed data that is NOT incorrectly encoded via JSON.encode();
|
||||
}
|
||||
if (temp_request_data.jsonObject) {
|
||||
var request_data = temp_request_data.jsonObject;
|
||||
} else {
|
||||
var request_data = temp_request_data; // passed data that is NOT incorrectly encoded via JSON.encode();
|
||||
}
|
||||
|
||||
// cn: end bug 12274 fix
|
||||
// cn: end bug 12274 fix
|
||||
|
||||
var passthru_data = Object();
|
||||
if(typeof(request_data.passthru_data) != 'undefined')
|
||||
{
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
var form_name = request_data.form_name;
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
|
||||
closePopup();
|
||||
var passthru_data = Object();
|
||||
if (typeof(request_data.passthru_data) != 'undefined') {
|
||||
passthru_data = request_data.passthru_data;
|
||||
}
|
||||
var form_name = request_data.form_name;
|
||||
var field_to_name_array = request_data.field_to_name_array;
|
||||
|
||||
closePopup();
|
||||
|
||||
SUGAR.util.globalEval("var call_back_function = window.opener." + request_data.call_back_function);
|
||||
var result_data={"form_name":form_name,"selection_list":selection_list_array ,"passthru_data":passthru_data,"select_entire_list":form.select_entire_list.value,"current_query_by_page":form.current_query_by_page.value};
|
||||
call_back_function(result_data);
|
||||
var result_data = {
|
||||
"form_name": form_name,
|
||||
"selection_list": selection_list_array,
|
||||
"passthru_data": passthru_data,
|
||||
"select_entire_list": form.select_entire_list.value,
|
||||
"current_query_by_page": form.current_query_by_page.value
|
||||
};
|
||||
call_back_function(result_data);
|
||||
}
|
||||
|
||||
|
||||
function toggleMore(spanId, img_id, module, action, params) {
|
||||
toggle_more_go = function () {
|
||||
oReturn = function (body, caption, width, theme) {
|
||||
|
||||
function toggleMore(spanId, img_id, module, action, params){
|
||||
toggle_more_go = function() {
|
||||
oReturn = function(body, caption, width, theme) {
|
||||
|
||||
$(".ui-dialog").find(".open").dialog("close");
|
||||
$(".ui-dialog").find(".open").dialog("close");
|
||||
|
||||
var el = '#'+spanId+ ' img';
|
||||
if (action == 'DisplayInlineTeams')
|
||||
{
|
||||
el = '#'+spanId;
|
||||
}
|
||||
var $dialog = $('<div class="open"></div>')
|
||||
.html(body)
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
title: caption,
|
||||
width: 300,
|
||||
position: {
|
||||
my: 'right top',
|
||||
at: 'left top',
|
||||
of: $(el)
|
||||
}
|
||||
});
|
||||
var el = '#' + spanId + ' img';
|
||||
if (action == 'DisplayInlineTeams') {
|
||||
el = '#' + spanId;
|
||||
}
|
||||
var $dialog = $('<div class="open"></div>')
|
||||
.html(body)
|
||||
.dialog({
|
||||
autoOpen: false,
|
||||
title: caption,
|
||||
width: 300,
|
||||
position: {
|
||||
my: 'right top',
|
||||
at: 'left top',
|
||||
of: $(el)
|
||||
}
|
||||
});
|
||||
|
||||
var width = $dialog.dialog( "option", "width" );
|
||||
var pos = $(el).offset();
|
||||
var ofWidth = $(el).width();
|
||||
var width = $dialog.dialog("option", "width");
|
||||
var pos = $(el).offset();
|
||||
var ofWidth = $(el).width();
|
||||
|
||||
if((pos.left + ofWidth) - 40 < width) {
|
||||
$dialog.dialog("option","position",{my: 'left top',at: 'right top',of: $(el)}) ;
|
||||
}
|
||||
if ((pos.left + ofWidth) - 40 < width) {
|
||||
$dialog.dialog("option", "position", {my: 'left top', at: 'right top', of: $(el)});
|
||||
}
|
||||
|
||||
$dialog.dialog('open');
|
||||
$dialog.dialog('open');
|
||||
|
||||
}
|
||||
|
||||
success = function(data) {
|
||||
SUGAR.util.globalEval(data.responseText);
|
||||
}
|
||||
|
||||
SUGAR.util.additionalDetailsCache[spanId] = new Array();
|
||||
SUGAR.util.additionalDetailsCache[spanId]['body'] = result['body'];
|
||||
SUGAR.util.additionalDetailsCache[spanId]['caption'] = result['caption'];
|
||||
SUGAR.util.additionalDetailsCache[spanId]['width'] = result['width'];
|
||||
SUGAR.util.additionalDetailsCache[spanId]['theme'] = result['theme'];
|
||||
ajaxStatus.hideStatus();
|
||||
return oReturn(SUGAR.util.additionalDetailsCache[spanId]['body'], SUGAR.util.additionalDetailsCache[spanId]['caption'], SUGAR.util.additionalDetailsCache[spanId]['width'], SUGAR.util.additionalDetailsCache[spanId]['theme']);
|
||||
}
|
||||
success = function (data) {
|
||||
SUGAR.util.globalEval(data.responseText);
|
||||
|
||||
if(typeof SUGAR.util.additionalDetailsCache[spanId] != 'undefined')
|
||||
return oReturn(SUGAR.util.additionalDetailsCache[spanId]['body'], SUGAR.util.additionalDetailsCache[spanId]['caption'], SUGAR.util.additionalDetailsCache[spanId]['width'], SUGAR.util.additionalDetailsCache[spanId]['theme']);
|
||||
SUGAR.util.additionalDetailsCache[spanId] = new Array();
|
||||
SUGAR.util.additionalDetailsCache[spanId]['body'] = result['body'];
|
||||
SUGAR.util.additionalDetailsCache[spanId]['caption'] = result['caption'];
|
||||
SUGAR.util.additionalDetailsCache[spanId]['width'] = result['width'];
|
||||
SUGAR.util.additionalDetailsCache[spanId]['theme'] = result['theme'];
|
||||
ajaxStatus.hideStatus();
|
||||
return oReturn(SUGAR.util.additionalDetailsCache[spanId]['body'], SUGAR.util.additionalDetailsCache[spanId]['caption'], SUGAR.util.additionalDetailsCache[spanId]['width'], SUGAR.util.additionalDetailsCache[spanId]['theme']);
|
||||
}
|
||||
|
||||
if(typeof SUGAR.util.additionalDetailsCalls[spanId] != 'undefined') // call already in progress
|
||||
return;
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_LOADING'));
|
||||
url = 'index.php?module='+module+'&action='+action+'&'+params;
|
||||
SUGAR.util.additionalDetailsCalls[spanId] = YAHOO.util.Connect.asyncRequest('GET', url, {success: success, failure: success});
|
||||
if (typeof SUGAR.util.additionalDetailsCache[spanId] != 'undefined')
|
||||
return oReturn(SUGAR.util.additionalDetailsCache[spanId]['body'], SUGAR.util.additionalDetailsCache[spanId]['caption'], SUGAR.util.additionalDetailsCache[spanId]['width'], SUGAR.util.additionalDetailsCache[spanId]['theme']);
|
||||
|
||||
return false;
|
||||
}
|
||||
SUGAR.util.additionalDetailsRpcCall = window.setTimeout('toggle_more_go()', 250);
|
||||
if (typeof SUGAR.util.additionalDetailsCalls[spanId] != 'undefined') // call already in progress
|
||||
return;
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_LOADING'));
|
||||
url = 'index.php?module=' + module + '&action=' + action + '&' + params;
|
||||
SUGAR.util.additionalDetailsCalls[spanId] = YAHOO.util.Connect.asyncRequest('GET', url, {
|
||||
success: success,
|
||||
failure: success
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
SUGAR.util.additionalDetailsRpcCall = window.setTimeout('toggle_more_go()', 250);
|
||||
}
|
||||
|
||||
// The following line of code was copy / pasted in a whole bunch of modules.
|
||||
SUGAR.util.doWhen("window.document.forms['popup_query_form'] != null "
|
||||
+ "&& typeof(window.document.forms['popup_query_form'].request_data) != 'undefined'",
|
||||
function() {
|
||||
/* initialize the popup request from the parent */
|
||||
if(window.document.forms['popup_query_form'].request_data.value == "")
|
||||
{
|
||||
window.document.forms['popup_query_form'].request_data.value = window.opener.get_popup_request_data();
|
||||
}
|
||||
+ "&& typeof(window.document.forms['popup_query_form'].request_data) != 'undefined'",
|
||||
function () {
|
||||
/* initialize the popup request from the parent */
|
||||
if (window.document.forms['popup_query_form'].request_data.value == "") {
|
||||
window.document.forms['popup_query_form'].request_data.value = window.opener.get_popup_request_data();
|
||||
}
|
||||
}
|
||||
);
|
||||
$(document).ready(function(){
|
||||
$("ul.clickMenu").each(function(index, node){
|
||||
$(node).sugarActionMenu();
|
||||
});
|
||||
$(document).ready(function () {
|
||||
$("ul.clickMenu").each(function (index, node) {
|
||||
$(node).sugarActionMenu();
|
||||
});
|
||||
});
|
|
@ -38,8 +38,6 @@
|
|||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* browse document for quickSearch fields
|
||||
* Compatible ExtJS 1.1.1 and ExtJS 2.0
|
||||
|
@ -47,331 +45,321 @@
|
|||
* the new sqsEnabled field on the page. If set to false
|
||||
* it will reload all the sqsEnabled fields.
|
||||
*/
|
||||
function enableQS(noReload){
|
||||
YAHOO.util.Event.onDOMReady(function(){
|
||||
//Safety check. If sqs_objects variable is null, we really can't do anything useful
|
||||
if(typeof sqs_objects == 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var Dom = YAHOO.util.Dom;
|
||||
|
||||
//Get all the fields where sqsEnabled is an attribue, these should be the input text fields for quicksearch
|
||||
var qsFields = Dom.getElementsByClassName('sqsEnabled');
|
||||
|
||||
//Now loop through all these fields and process them
|
||||
for(var qsField in qsFields){
|
||||
|
||||
//Safety checks to skip processing of invalid entries
|
||||
if(typeof qsFields[qsField] == 'function' || typeof qsFields[qsField].id == 'undefined') {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Create the index we are using to search for the sqs_objects Array
|
||||
var form_id = qsFields[qsField].form.getAttribute('id');
|
||||
|
||||
//This is a special case where there is an element with id attribute value of "id"
|
||||
//In this case, we get the real_id attribute (occurs in modules/Import/tpls/step3.tpl only).
|
||||
if(typeof form_id == 'object' && qsFields[qsField].form.getAttribute('real_id')) {
|
||||
form_id = qsFields[qsField].form.getAttribute('real_id');
|
||||
}
|
||||
var qs_index_id = form_id + '_' + qsFields[qsField].name;
|
||||
function enableQS(noReload) {
|
||||
YAHOO.util.Event.onDOMReady(function () {
|
||||
//Safety check. If sqs_objects variable is null, we really can't do anything useful
|
||||
if (typeof sqs_objects == 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
//Another safety check, if the sqs_objects entry is not defined, we can't do anything useful
|
||||
if(typeof sqs_objects[qs_index_id] == 'undefined') {
|
||||
qs_index_id = qsFields[qsField].name;
|
||||
if(typeof sqs_objects[qs_index_id] == 'undefined') {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//Track if this field has already been processed. The way the enableQS function is called
|
||||
//is a bit problematic in that it lends itself to a lot of duplicate processing
|
||||
if(QSProcessedFieldsArray[qs_index_id]) {
|
||||
skipSTR = 'collection_0';
|
||||
//the 'collection_0' id is not loaded dynamically, so the first item in the collection will not have an incremental value added to the base id
|
||||
//only skip the additional fields so that cases where a form is closed and reopened without refreshing the screen will still work
|
||||
if (qs_index_id.lastIndexOf(skipSTR) != (qs_index_id.length - skipSTR.length)){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Store sqs_objects entry as a reference for convenience
|
||||
var qs_obj = sqs_objects[qs_index_id];
|
||||
//The loaded variable will be used to check whether or not the quick search field should be created
|
||||
var loaded = false;
|
||||
var Dom = YAHOO.util.Dom;
|
||||
|
||||
if (!document.forms[qs_obj.form]) {
|
||||
continue;
|
||||
}
|
||||
//Skip quicksearch fields that are readOnly or that are disabled since you can't search on them anyway
|
||||
if (!document.forms[qs_obj.form].elements[qsFields[qsField].id].readOnly && qs_obj['disable'] != true) {
|
||||
var combo_id = qs_obj.form + '_' + qsFields[qsField].id;
|
||||
if (Dom.get(combo_id + "_results")) {
|
||||
loaded = true
|
||||
}
|
||||
|
||||
// if loaded == false, then we do the heavy lifting to re-create the quicksearch field
|
||||
if (!loaded) {
|
||||
QSProcessedFieldsArray[qs_index_id] = true;
|
||||
|
||||
qsFields[qsField].form_id = form_id;
|
||||
|
||||
var sqs = sqs_objects[qs_index_id];
|
||||
|
||||
//Initialize the result div
|
||||
var resultDiv = document.createElement('div');
|
||||
resultDiv.id = combo_id + "_results";
|
||||
Dom.insertAfter(resultDiv, qsFields[qsField]);
|
||||
|
||||
//Add the module to the fields so we can read it from the response
|
||||
var fields = qs_obj.field_list.slice();
|
||||
fields[fields.length] = "module";
|
||||
|
||||
//Create the DataSource for this QS
|
||||
var ds = new YAHOO.util.DataSource("index.php?", {
|
||||
responseType: YAHOO.util.XHRDataSource.TYPE_JSON,
|
||||
responseSchema: {
|
||||
resultsList: 'fields',
|
||||
total: 'totalCount',
|
||||
fields: fields,
|
||||
metaNode: "fields",
|
||||
metaFields: {total: 'totalCount', fields:"fields"}
|
||||
},
|
||||
connMethodPost: true
|
||||
});
|
||||
|
||||
// Don't force selection for search fields
|
||||
var forceSelect = !((qsFields[qsField].form && typeof(qsFields[qsField].form) == 'object' && qsFields[qsField].form.name == 'search_form')
|
||||
|| qsFields[qsField].className.match('sqsNoAutofill') != null);
|
||||
|
||||
//Finally Declare the Autocomplete
|
||||
var search = new YAHOO.widget.AutoComplete(qsFields[qsField], resultDiv, ds, {
|
||||
typeAhead: forceSelect,
|
||||
forceSelection : forceSelect,
|
||||
fields: fields,
|
||||
sqs : sqs,
|
||||
animSpeed : 0.25,
|
||||
qs_obj: qs_obj,
|
||||
inputElement: qsFields[qsField],
|
||||
//YUI requires the data, even POST, to be URL encoded
|
||||
generateRequest : function(sQuery) {
|
||||
//preprocess values
|
||||
var item_id = this.inputElement.form_id + '_' + this.inputElement.name;
|
||||
this.sqs = updateSqsFromQSFieldsArray(item_id, this.sqs);
|
||||
if (QSCallbacksArray[item_id]) {
|
||||
QSCallbacksArray[item_id](this.sqs);
|
||||
}
|
||||
var out = SUGAR.util.paramsToUrl({
|
||||
to_pdf: 'true',
|
||||
module: 'Home',
|
||||
action: 'quicksearchQuery',
|
||||
data: YAHOO.lang.JSON.stringify(this.sqs),
|
||||
query: decodeURIComponent(sQuery)
|
||||
});
|
||||
return out;
|
||||
},
|
||||
//Method to fill in form fields with the returned results.
|
||||
//Should be called on select, and must be called from the AC instance scope.
|
||||
setFields : function (data, filter) {
|
||||
this.updateFields(data, filter);
|
||||
},
|
||||
|
||||
updateFields: function(data, filter) {
|
||||
for(var i in this.fields) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
//Check that the field exists and matches the filter
|
||||
if (this.fields[i] == this.qs_obj.field_list[key] &&
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]] &&
|
||||
this.qs_obj.populate_list[key].match(filter)) {
|
||||
//bug: 30823 - remove the apostrophe
|
||||
var displayValue = data[i].replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value = displayValue;
|
||||
SUGAR.util.callOnChangeListers(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
SUGAR.util.callOnChangeListers(this._elTextbox);
|
||||
},
|
||||
clearFields : function() {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
if (document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]){
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value = "";
|
||||
SUGAR.util.callOnChangeListers(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]);
|
||||
}
|
||||
}
|
||||
this.oldValue = "";
|
||||
}
|
||||
});
|
||||
//Get all the fields where sqsEnabled is an attribue, these should be the input text fields for quicksearch
|
||||
var qsFields = Dom.getElementsByClassName('sqsEnabled');
|
||||
|
||||
//C.L. Bug 36575: In event of account_name quicksearch, check to see if we need to warn user
|
||||
//that address fields may change. This code has similarities to code block in set_return method
|
||||
//of sugar_3.js when building the alert message contents.
|
||||
if(/^(billing_|shipping_)?account_name$/.exec(qsFields[qsField].name))
|
||||
{
|
||||
|
||||
//C.L. Bug 36106 only clear the name and id fields
|
||||
search.clearFields = function() {
|
||||
for(var i in {name:0, id:1}) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
//Check that the field exists
|
||||
if (i == this.qs_obj.field_list[key] &&
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]])
|
||||
{
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
search.setFields = function(data, filter)
|
||||
{
|
||||
var label_str = '';
|
||||
var label_data_str = '';
|
||||
var current_label_data_str = '';
|
||||
var label_data_hash = new Array();
|
||||
|
||||
for(var i in this.fields) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
//Check that the field exists and matches the filter
|
||||
if (this.fields[i] == this.qs_obj.field_list[key] &&
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]] &&
|
||||
document.getElementById(this.qs_obj.populate_list[key]+'_label') &&
|
||||
this.qs_obj.populate_list[key].match(filter)) {
|
||||
|
||||
var displayValue = data[i].replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');
|
||||
var data_label = document.getElementById(this.qs_obj.populate_list[key]+'_label').innerHTML.replace(/\n/gi,'').replace(/<\/?[^>]+(>|$)/g, "");
|
||||
|
||||
label_and_data = data_label + ' ' + displayValue;
|
||||
|
||||
//Append to current_label_data_str only if the label and data are unique
|
||||
if(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]] && !label_data_hash[data_label])
|
||||
{
|
||||
label_str += data_label + ' \n';
|
||||
label_data_str += label_and_data + '\n';
|
||||
label_data_hash[data_label] = true;
|
||||
current_label_data_str += data_label + ' ' + document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value + '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(label_str != current_label_data_str && current_label_data_str != label_data_str) {
|
||||
|
||||
module_key = (typeof document.forms[form_id].elements['module'] != 'undefined') ? document.forms[form_id].elements['module'].value : 'app_strings';
|
||||
warning_label = SUGAR.language.translate(module_key, 'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM') + '\n\n' + label_data_str;
|
||||
|
||||
if(!confirm(warning_label))
|
||||
{
|
||||
this.updateFields(data,/account_id/);
|
||||
} else {
|
||||
|
||||
if(Dom.get('shipping_checkbox'))
|
||||
{
|
||||
if(this.inputElement.id == 'shipping_account_name')
|
||||
{
|
||||
//If the copy address checkbox is checked, update account and office_phone
|
||||
filter = Dom.get('shipping_checkbox').checked ? /(account_id|office_phone)/ : filter;
|
||||
} else if(this.inputElement.id == 'billing_account_name') {
|
||||
//If the copy address is checked, update account, office phone and billing addresses
|
||||
filter = Dom.get('shipping_checkbox').checked ? filter : /(account_id|office_phone|billing)/;
|
||||
}
|
||||
} else if(Dom.get('alt_checkbox')) {
|
||||
filter = Dom.get('alt_checkbox').checked ? filter : /^(?!alt)/;
|
||||
}
|
||||
|
||||
this.updateFields(data,filter);
|
||||
}
|
||||
} else {
|
||||
this.updateFields(data,filter);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if ( typeof(SUGAR.config.quicksearch_querydelay) != 'undefined' ) {
|
||||
search.queryDelay = Number(SUGAR.config.quicksearch_querydelay);
|
||||
}
|
||||
|
||||
//fill in the data fields on selection
|
||||
search.itemSelectEvent.subscribe(function(e, args){
|
||||
var data = args[2];
|
||||
var fields = this.fields;
|
||||
this.setFields(data, /\S/);
|
||||
|
||||
//Handle special case where post_onblur_function is set
|
||||
if (typeof(this.qs_obj['post_onblur_function']) != 'undefined') {
|
||||
collection_extended = new Array();
|
||||
for (var i in fields) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
if (fields[i] == this.qs_obj.field_list[key]) {
|
||||
collection_extended[this.qs_obj.field_list[key]] = data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
SUGAR.util.globalEval(this.qs_obj['post_onblur_function'] + '(collection_extended, this.qs_obj.id)');
|
||||
}
|
||||
});
|
||||
|
||||
// We will get the old value firstly when the field lose focus.
|
||||
search.textboxFocusEvent.subscribe(function(){
|
||||
this.oldValue = this.getInputEl().value;
|
||||
});
|
||||
|
||||
//If there is no change for this qucik search field , the value of it will not be cleared.
|
||||
search.selectionEnforceEvent.subscribe(function(e, args){
|
||||
if (this.oldValue != args[1]) {
|
||||
this.clearFields();
|
||||
} else {
|
||||
this.getInputEl().value = this.oldValue;
|
||||
}
|
||||
});
|
||||
|
||||
search.dataReturnEvent.subscribe(function(e, args){
|
||||
//Selected the first returned value if a tab was done before results were returned
|
||||
if (this.getInputEl().value.length == 0 && args[2].length > 0) {
|
||||
var data = [];
|
||||
for(var key in this.qs_obj.field_list) {
|
||||
data[data.length] = args[2][0][this.qs_obj.field_list[key]];
|
||||
}
|
||||
this.getInputEl().value = data[this.key];
|
||||
this.itemSelectEvent.fire(this, "", data);
|
||||
}
|
||||
});
|
||||
//Now loop through all these fields and process them
|
||||
for (var qsField in qsFields) {
|
||||
|
||||
search.typeAheadEvent.subscribe(function (e, args) {
|
||||
this.getInputEl().value = this.getInputEl().value.replace(/&/gi,'&').replace(/</gi,'<').replace(/>/gi,'>').replace(/'/gi,'\'').replace(/"/gi,'"');
|
||||
});
|
||||
|
||||
|
||||
if (typeof QSFieldsArray[combo_id] == 'undefined' && qsFields[qsField].id) {
|
||||
QSFieldsArray[combo_id] = search;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Safety checks to skip processing of invalid entries
|
||||
if (typeof qsFields[qsField] == 'function' || typeof qsFields[qsField].id == 'undefined') {
|
||||
continue;
|
||||
}
|
||||
|
||||
//Create the index we are using to search for the sqs_objects Array
|
||||
var form_id = qsFields[qsField].form.getAttribute('id');
|
||||
|
||||
//This is a special case where there is an element with id attribute value of "id"
|
||||
//In this case, we get the real_id attribute (occurs in modules/Import/tpls/step3.tpl only).
|
||||
if (typeof form_id == 'object' && qsFields[qsField].form.getAttribute('real_id')) {
|
||||
form_id = qsFields[qsField].form.getAttribute('real_id');
|
||||
}
|
||||
var qs_index_id = form_id + '_' + qsFields[qsField].name;
|
||||
|
||||
//Another safety check, if the sqs_objects entry is not defined, we can't do anything useful
|
||||
if (typeof sqs_objects[qs_index_id] == 'undefined') {
|
||||
qs_index_id = qsFields[qsField].name;
|
||||
if (typeof sqs_objects[qs_index_id] == 'undefined') {
|
||||
continue;
|
||||
}
|
||||
});
|
||||
}
|
||||
//Track if this field has already been processed. The way the enableQS function is called
|
||||
//is a bit problematic in that it lends itself to a lot of duplicate processing
|
||||
if (QSProcessedFieldsArray[qs_index_id]) {
|
||||
skipSTR = 'collection_0';
|
||||
//the 'collection_0' id is not loaded dynamically, so the first item in the collection will not have an incremental value added to the base id
|
||||
//only skip the additional fields so that cases where a form is closed and reopened without refreshing the screen will still work
|
||||
if (qs_index_id.lastIndexOf(skipSTR) != (qs_index_id.length - skipSTR.length)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
//Store sqs_objects entry as a reference for convenience
|
||||
var qs_obj = sqs_objects[qs_index_id];
|
||||
//The loaded variable will be used to check whether or not the quick search field should be created
|
||||
var loaded = false;
|
||||
|
||||
if (!document.forms[qs_obj.form]) {
|
||||
continue;
|
||||
}
|
||||
//Skip quicksearch fields that are readOnly or that are disabled since you can't search on them anyway
|
||||
if (!document.forms[qs_obj.form].elements[qsFields[qsField].id].readOnly && qs_obj['disable'] != true) {
|
||||
var combo_id = qs_obj.form + '_' + qsFields[qsField].id;
|
||||
if (Dom.get(combo_id + "_results")) {
|
||||
loaded = true
|
||||
}
|
||||
|
||||
// if loaded == false, then we do the heavy lifting to re-create the quicksearch field
|
||||
if (!loaded) {
|
||||
QSProcessedFieldsArray[qs_index_id] = true;
|
||||
|
||||
qsFields[qsField].form_id = form_id;
|
||||
|
||||
var sqs = sqs_objects[qs_index_id];
|
||||
|
||||
//Initialize the result div
|
||||
var resultDiv = document.createElement('div');
|
||||
resultDiv.id = combo_id + "_results";
|
||||
Dom.insertAfter(resultDiv, qsFields[qsField]);
|
||||
|
||||
//Add the module to the fields so we can read it from the response
|
||||
var fields = qs_obj.field_list.slice();
|
||||
fields[fields.length] = "module";
|
||||
|
||||
//Create the DataSource for this QS
|
||||
var ds = new YAHOO.util.DataSource("index.php?", {
|
||||
responseType: YAHOO.util.XHRDataSource.TYPE_JSON,
|
||||
responseSchema: {
|
||||
resultsList: 'fields',
|
||||
total: 'totalCount',
|
||||
fields: fields,
|
||||
metaNode: "fields",
|
||||
metaFields: {total: 'totalCount', fields: "fields"}
|
||||
},
|
||||
connMethodPost: true
|
||||
});
|
||||
|
||||
// Don't force selection for search fields
|
||||
var forceSelect = !((qsFields[qsField].form && typeof(qsFields[qsField].form) == 'object' && qsFields[qsField].form.name == 'search_form')
|
||||
|| qsFields[qsField].className.match('sqsNoAutofill') != null);
|
||||
|
||||
//Finally Declare the Autocomplete
|
||||
var search = new YAHOO.widget.AutoComplete(qsFields[qsField], resultDiv, ds, {
|
||||
typeAhead: forceSelect,
|
||||
forceSelection: forceSelect,
|
||||
fields: fields,
|
||||
sqs: sqs,
|
||||
animSpeed: 0.25,
|
||||
qs_obj: qs_obj,
|
||||
inputElement: qsFields[qsField],
|
||||
//YUI requires the data, even POST, to be URL encoded
|
||||
generateRequest: function (sQuery) {
|
||||
//preprocess values
|
||||
var item_id = this.inputElement.form_id + '_' + this.inputElement.name;
|
||||
this.sqs = updateSqsFromQSFieldsArray(item_id, this.sqs);
|
||||
if (QSCallbacksArray[item_id]) {
|
||||
QSCallbacksArray[item_id](this.sqs);
|
||||
}
|
||||
var out = SUGAR.util.paramsToUrl({
|
||||
to_pdf: 'true',
|
||||
module: 'Home',
|
||||
action: 'quicksearchQuery',
|
||||
data: YAHOO.lang.JSON.stringify(this.sqs),
|
||||
query: decodeURIComponent(sQuery)
|
||||
});
|
||||
return out;
|
||||
},
|
||||
//Method to fill in form fields with the returned results.
|
||||
//Should be called on select, and must be called from the AC instance scope.
|
||||
setFields: function (data, filter) {
|
||||
this.updateFields(data, filter);
|
||||
},
|
||||
|
||||
updateFields: function (data, filter) {
|
||||
for (var i in this.fields) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
//Check that the field exists and matches the filter
|
||||
if (this.fields[i] == this.qs_obj.field_list[key] &&
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]] &&
|
||||
this.qs_obj.populate_list[key].match(filter)) {
|
||||
//bug: 30823 - remove the apostrophe
|
||||
var displayValue = data[i].replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>').replace(/'/gi, '\'').replace(/"/gi, '"');
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value = displayValue;
|
||||
SUGAR.util.callOnChangeListers(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]);
|
||||
}
|
||||
}
|
||||
}
|
||||
SUGAR.util.callOnChangeListers(this._elTextbox);
|
||||
},
|
||||
clearFields: function () {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
if (document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]) {
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value = "";
|
||||
SUGAR.util.callOnChangeListers(document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]);
|
||||
}
|
||||
}
|
||||
this.oldValue = "";
|
||||
}
|
||||
});
|
||||
|
||||
//C.L. Bug 36575: In event of account_name quicksearch, check to see if we need to warn user
|
||||
//that address fields may change. This code has similarities to code block in set_return method
|
||||
//of sugar_3.js when building the alert message contents.
|
||||
if (/^(billing_|shipping_)?account_name$/.exec(qsFields[qsField].name)) {
|
||||
|
||||
//C.L. Bug 36106 only clear the name and id fields
|
||||
search.clearFields = function () {
|
||||
for (var i in {name: 0, id: 1}) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
//Check that the field exists
|
||||
if (i == this.qs_obj.field_list[key] &&
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]]) {
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
search.setFields = function (data, filter) {
|
||||
var label_str = '';
|
||||
var label_data_str = '';
|
||||
var current_label_data_str = '';
|
||||
var label_data_hash = new Array();
|
||||
|
||||
for (var i in this.fields) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
//Check that the field exists and matches the filter
|
||||
if (this.fields[i] == this.qs_obj.field_list[key] &&
|
||||
document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]] &&
|
||||
document.getElementById(this.qs_obj.populate_list[key] + '_label') &&
|
||||
this.qs_obj.populate_list[key].match(filter)) {
|
||||
|
||||
var displayValue = data[i].replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>').replace(/'/gi, '\'').replace(/"/gi, '"');
|
||||
var data_label = document.getElementById(this.qs_obj.populate_list[key] + '_label').innerHTML.replace(/\n/gi, '').replace(/<\/?[^>]+(>|$)/g, "");
|
||||
|
||||
label_and_data = data_label + ' ' + displayValue;
|
||||
|
||||
//Append to current_label_data_str only if the label and data are unique
|
||||
if (document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]] && !label_data_hash[data_label]) {
|
||||
label_str += data_label + ' \n';
|
||||
label_data_str += label_and_data + '\n';
|
||||
label_data_hash[data_label] = true;
|
||||
current_label_data_str += data_label + ' ' + document.forms[this.qs_obj.form].elements[this.qs_obj.populate_list[key]].value + '\n';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (label_str != current_label_data_str && current_label_data_str != label_data_str) {
|
||||
|
||||
module_key = (typeof document.forms[form_id].elements['module'] != 'undefined') ? document.forms[form_id].elements['module'].value : 'app_strings';
|
||||
warning_label = SUGAR.language.translate(module_key, 'NTC_OVERWRITE_ADDRESS_PHONE_CONFIRM') + '\n\n' + label_data_str;
|
||||
|
||||
if (!confirm(warning_label)) {
|
||||
this.updateFields(data, /account_id/);
|
||||
} else {
|
||||
|
||||
if (Dom.get('shipping_checkbox')) {
|
||||
if (this.inputElement.id == 'shipping_account_name') {
|
||||
//If the copy address checkbox is checked, update account and office_phone
|
||||
filter = Dom.get('shipping_checkbox').checked ? /(account_id|office_phone)/ : filter;
|
||||
} else if (this.inputElement.id == 'billing_account_name') {
|
||||
//If the copy address is checked, update account, office phone and billing addresses
|
||||
filter = Dom.get('shipping_checkbox').checked ? filter : /(account_id|office_phone|billing)/;
|
||||
}
|
||||
} else if (Dom.get('alt_checkbox')) {
|
||||
filter = Dom.get('alt_checkbox').checked ? filter : /^(?!alt)/;
|
||||
}
|
||||
|
||||
this.updateFields(data, filter);
|
||||
}
|
||||
} else {
|
||||
this.updateFields(data, filter);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
if (typeof(SUGAR.config.quicksearch_querydelay) != 'undefined') {
|
||||
search.queryDelay = Number(SUGAR.config.quicksearch_querydelay);
|
||||
}
|
||||
|
||||
//fill in the data fields on selection
|
||||
search.itemSelectEvent.subscribe(function (e, args) {
|
||||
var data = args[2];
|
||||
var fields = this.fields;
|
||||
this.setFields(data, /\S/);
|
||||
|
||||
//Handle special case where post_onblur_function is set
|
||||
if (typeof(this.qs_obj['post_onblur_function']) != 'undefined') {
|
||||
collection_extended = new Array();
|
||||
for (var i in fields) {
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
if (fields[i] == this.qs_obj.field_list[key]) {
|
||||
collection_extended[this.qs_obj.field_list[key]] = data[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
SUGAR.util.globalEval(this.qs_obj['post_onblur_function'] + '(collection_extended, this.qs_obj.id)');
|
||||
}
|
||||
});
|
||||
|
||||
// We will get the old value firstly when the field lose focus.
|
||||
search.textboxFocusEvent.subscribe(function () {
|
||||
this.oldValue = this.getInputEl().value;
|
||||
});
|
||||
|
||||
//If there is no change for this qucik search field , the value of it will not be cleared.
|
||||
search.selectionEnforceEvent.subscribe(function (e, args) {
|
||||
if (this.oldValue != args[1]) {
|
||||
this.clearFields();
|
||||
} else {
|
||||
this.getInputEl().value = this.oldValue;
|
||||
}
|
||||
});
|
||||
|
||||
search.dataReturnEvent.subscribe(function (e, args) {
|
||||
//Selected the first returned value if a tab was done before results were returned
|
||||
if (this.getInputEl().value.length == 0 && args[2].length > 0) {
|
||||
var data = [];
|
||||
for (var key in this.qs_obj.field_list) {
|
||||
data[data.length] = args[2][0][this.qs_obj.field_list[key]];
|
||||
}
|
||||
this.getInputEl().value = data[this.key];
|
||||
this.itemSelectEvent.fire(this, "", data);
|
||||
}
|
||||
});
|
||||
|
||||
search.typeAheadEvent.subscribe(function (e, args) {
|
||||
this.getInputEl().value = this.getInputEl().value.replace(/&/gi, '&').replace(/</gi, '<').replace(/>/gi, '>').replace(/'/gi, '\'').replace(/"/gi, '"');
|
||||
});
|
||||
|
||||
|
||||
if (typeof QSFieldsArray[combo_id] == 'undefined' && qsFields[qsField].id) {
|
||||
QSFieldsArray[combo_id] = search;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function registerSingleSmartInputListener(input) {
|
||||
if ((c = input.className) && (c.indexOf("sqsEnabled") != -1)) {
|
||||
enableQS(true);
|
||||
}
|
||||
if ((c = input.className) && (c.indexOf("sqsEnabled") != -1)) {
|
||||
enableQS(true);
|
||||
}
|
||||
}
|
||||
|
||||
if(typeof QSFieldsArray == 'undefined') {
|
||||
QSFieldsArray = new Array();
|
||||
QSProcessedFieldsArray = new Array();
|
||||
QSCallbacksArray = new Array();
|
||||
if (typeof QSFieldsArray == 'undefined') {
|
||||
QSFieldsArray = new Array();
|
||||
QSProcessedFieldsArray = new Array();
|
||||
QSCallbacksArray = new Array();
|
||||
}
|
||||
// Updates this.sqs of the Autocomplete instance with actual value from QSFieldsArray
|
||||
function updateSqsFromQSFieldsArray(sqsId, sqsToUpdate)
|
||||
{
|
||||
if (typeof(QSFieldsArray[sqsId]) != 'undefined' && sqsToUpdate != QSFieldsArray[sqsId].sqs)
|
||||
{
|
||||
return QSFieldsArray[sqsId].sqs;
|
||||
}
|
||||
else
|
||||
{
|
||||
return sqsToUpdate;
|
||||
}
|
||||
function updateSqsFromQSFieldsArray(sqsId, sqsToUpdate) {
|
||||
if (typeof(QSFieldsArray[sqsId]) != 'undefined' && sqsToUpdate != QSFieldsArray[sqsId].sqs) {
|
||||
return QSFieldsArray[sqsId].sqs;
|
||||
}
|
||||
else {
|
||||
return sqsToUpdate;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -38,72 +38,72 @@
|
|||
*/
|
||||
|
||||
|
||||
function treeinit(tree,treedata,treediv,params) {
|
||||
tree = new YAHOO.widget.TreeView(treediv);
|
||||
|
||||
//create a name space for the tree.
|
||||
//and store the module name;
|
||||
YAHOO.namespace(treediv).param=params;
|
||||
|
||||
var root= tree.getRoot();
|
||||
var tmpNode;
|
||||
function treeinit(tree, treedata, treediv, params) {
|
||||
tree = new YAHOO.widget.TreeView(treediv);
|
||||
|
||||
var data=treedata;
|
||||
//loop thru all root level nodes.
|
||||
for (nodedata in data) {
|
||||
for (node in data[nodedata]) {
|
||||
addNode(root, data[nodedata][node]);
|
||||
}
|
||||
}
|
||||
tree.subscribe("clickEvent", function(o){
|
||||
set_selected_node(this.id, null, o.node);
|
||||
});
|
||||
|
||||
tree.draw();
|
||||
//create a name space for the tree.
|
||||
//and store the module name;
|
||||
YAHOO.namespace(treediv).param = params;
|
||||
|
||||
var root = tree.getRoot();
|
||||
var tmpNode;
|
||||
|
||||
var data = treedata;
|
||||
//loop thru all root level nodes.
|
||||
for (nodedata in data) {
|
||||
for (node in data[nodedata]) {
|
||||
addNode(root, data[nodedata][node]);
|
||||
}
|
||||
}
|
||||
tree.subscribe("clickEvent", function (o) {
|
||||
set_selected_node(this.id, null, o.node);
|
||||
});
|
||||
|
||||
tree.draw();
|
||||
}
|
||||
|
||||
//set clicked node's id in tree's name space.
|
||||
function set_selected_node(treeid, nodeid, node) {
|
||||
if (typeof(node) == 'undefined')
|
||||
node=YAHOO.widget.TreeView.getNode(treeid,nodeid);
|
||||
|
||||
if (typeof(node) != 'undefined') {
|
||||
YAHOO.namespace(treeid).selectednode=node;
|
||||
} else {
|
||||
//clear selection.
|
||||
YAHOO.namespace(treeid).selectednode=null;
|
||||
}
|
||||
if (typeof(node) == 'undefined')
|
||||
node = YAHOO.widget.TreeView.getNode(treeid, nodeid);
|
||||
|
||||
if (typeof(node) != 'undefined') {
|
||||
YAHOO.namespace(treeid).selectednode = node;
|
||||
} else {
|
||||
//clear selection.
|
||||
YAHOO.namespace(treeid).selectednode = null;
|
||||
}
|
||||
}
|
||||
|
||||
//add a node to the tree, function adds nodes recursively.
|
||||
//change this function
|
||||
function addNode(parentnode,nodedef) {
|
||||
var dynamicload=false;
|
||||
var dynamicloadfunction;
|
||||
var childnodes;
|
||||
var expanded=false;
|
||||
|
||||
if (nodedef['data'] != 'undefined') {
|
||||
//get custom property values;
|
||||
if (typeof(nodedef['custom']) != 'undefined') {
|
||||
dynamicload=nodedef['custom']['dynamicload'];
|
||||
dynamicloadfunction=nodedef['custom']['dynamicloadfunction'];
|
||||
expanded=nodedef['custom']['expanded'];
|
||||
}
|
||||
|
||||
var tmpNode=new YAHOO.widget.TextNode(nodedef['data'], parentnode, expanded);
|
||||
|
||||
if (dynamicload) {
|
||||
SUGAR.util.globalEval('e=('+dynamicloadfunction+')');
|
||||
tmpNode.setDynamicLoad(e);
|
||||
}
|
||||
//add child nodes.
|
||||
if (typeof(nodedef['nodes']) != 'undefined') {
|
||||
for (childnodes in nodedef['nodes']) {
|
||||
addNode(tmpNode, nodedef['nodes'][childnodes]);
|
||||
}
|
||||
}
|
||||
}
|
||||
function addNode(parentnode, nodedef) {
|
||||
var dynamicload = false;
|
||||
var dynamicloadfunction;
|
||||
var childnodes;
|
||||
var expanded = false;
|
||||
|
||||
if (nodedef['data'] != 'undefined') {
|
||||
//get custom property values;
|
||||
if (typeof(nodedef['custom']) != 'undefined') {
|
||||
dynamicload = nodedef['custom']['dynamicload'];
|
||||
dynamicloadfunction = nodedef['custom']['dynamicloadfunction'];
|
||||
expanded = nodedef['custom']['expanded'];
|
||||
}
|
||||
|
||||
var tmpNode = new YAHOO.widget.TextNode(nodedef['data'], parentnode, expanded);
|
||||
|
||||
if (dynamicload) {
|
||||
SUGAR.util.globalEval('e=(' + dynamicloadfunction + ')');
|
||||
tmpNode.setDynamicLoad(e);
|
||||
}
|
||||
//add child nodes.
|
||||
if (typeof(nodedef['nodes']) != 'undefined') {
|
||||
for (childnodes in nodedef['nodes']) {
|
||||
addNode(tmpNode, nodedef['nodes'][childnodes]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//use this function to respond to node click.
|
||||
|
@ -111,58 +111,59 @@ function addNode(parentnode,nodedef) {
|
|||
//function will make an ajax call and populate the results in the target.
|
||||
//target type should be of type div, the function does not support other
|
||||
//target types.
|
||||
function node_click(treeid,target,targettype,functioname) {
|
||||
node=YAHOO.namespace(treeid).selectednode;
|
||||
function node_click(treeid, target, targettype, functioname) {
|
||||
node = YAHOO.namespace(treeid).selectednode;
|
||||
|
||||
//request url.
|
||||
var url=site_url.site_url + "/index.php?entryPoint=TreeData&function="+functioname+ construct_url_from_tree_param(node);
|
||||
//request url.
|
||||
var url = site_url.site_url + "/index.php?entryPoint=TreeData&function=" + functioname + construct_url_from_tree_param(node);
|
||||
|
||||
var callback = {
|
||||
success: function (o) {
|
||||
var targetdiv = document.getElementById(o.argument[0]);
|
||||
targetdiv.innerHTML = o.responseText;
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
},
|
||||
failure: function (o) {/*failure handler code*/
|
||||
},
|
||||
argument: [target, targettype]
|
||||
}
|
||||
|
||||
var trobj = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
|
||||
|
||||
var callback = {
|
||||
success: function(o) {
|
||||
var targetdiv=document.getElementById(o.argument[0]);
|
||||
targetdiv.innerHTML=o.responseText;
|
||||
SUGAR.util.evalScript(o.responseText);
|
||||
},
|
||||
failure: function(o) {/*failure handler code*/},
|
||||
argument: [target, targettype]
|
||||
}
|
||||
|
||||
var trobj = YAHOO.util.Connect.asyncRequest('GET',url, callback, null);
|
||||
|
||||
}
|
||||
|
||||
//construs url parameters from node and tree parameters.
|
||||
function construct_url_from_tree_param(node) {
|
||||
var treespace=YAHOO.namespace(node.tree.id);
|
||||
var treespace = YAHOO.namespace(node.tree.id);
|
||||
|
||||
url="&PARAMT_depth="+node.depth;
|
||||
url = "&PARAMT_depth=" + node.depth;
|
||||
|
||||
//add request parameters from the trees name space.
|
||||
if (treespace != 'undefined') {
|
||||
for (tparam in treespace.param) {
|
||||
url=url+"&PARAMT_"+tparam+'='+treespace.param[tparam];
|
||||
}
|
||||
}
|
||||
//add request parameters from the trees name space.
|
||||
if (treespace != 'undefined') {
|
||||
for (tparam in treespace.param) {
|
||||
url = url + "&PARAMT_" + tparam + '=' + treespace.param[tparam];
|
||||
}
|
||||
}
|
||||
|
||||
//add parent nodes id to the url.
|
||||
for (i=node.depth;i>=0;i--) {
|
||||
var currentnode;
|
||||
if (i==node.depth) {
|
||||
currentnode=node;
|
||||
} else {
|
||||
currentnode=node.getAncestor(i);
|
||||
}
|
||||
//add id to url.
|
||||
url=url+"&PARAMN_id"+'_'+currentnode.depth+'='+currentnode.data.id;
|
||||
//add parent nodes id to the url.
|
||||
for (i = node.depth; i >= 0; i--) {
|
||||
var currentnode;
|
||||
if (i == node.depth) {
|
||||
currentnode = node;
|
||||
} else {
|
||||
currentnode = node.getAncestor(i);
|
||||
}
|
||||
//add id to url.
|
||||
url = url + "&PARAMN_id" + '_' + currentnode.depth + '=' + currentnode.data.id;
|
||||
|
||||
//add other requested parameters.
|
||||
if (currentnode.data.param != 'undefined') {
|
||||
for (nparam in currentnode.data.param) {
|
||||
url=url+"&PARAMN_"+nparam+'_'+currentnode.depth+'='+currentnode.data.param[nparam];
|
||||
}
|
||||
}
|
||||
}
|
||||
return url;
|
||||
//add other requested parameters.
|
||||
if (currentnode.data.param != 'undefined') {
|
||||
for (nparam in currentnode.data.param) {
|
||||
url = url + "&PARAMN_" + nparam + '_' + currentnode.depth + '=' + currentnode.data.param[nparam];
|
||||
}
|
||||
}
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
//following function uses an AJAX call to load the children nodes dynamically.
|
||||
|
@ -170,24 +171,25 @@ function construct_url_from_tree_param(node) {
|
|||
//the file must have get_node_data function.
|
||||
//return value must be an array of nodes.
|
||||
function loadDataForNode(node, onCompleteCallback) {
|
||||
var id= node.data.id;
|
||||
var id = node.data.id;
|
||||
|
||||
var params="entryPoint=TreeData&function=get_node_data" + construct_url_from_tree_param(node);
|
||||
var params = "entryPoint=TreeData&function=get_node_data" + construct_url_from_tree_param(node);
|
||||
|
||||
var callback = {
|
||||
success: function(o) {
|
||||
node=o.argument[0];
|
||||
var nodes=YAHOO.lang.JSON.parse(o.responseText);
|
||||
var tmpNode;
|
||||
for (nodedata in nodes) {
|
||||
for (node1 in nodes[nodedata]) {
|
||||
addNode(node, nodes[nodedata][node1]);
|
||||
}
|
||||
}
|
||||
o.argument[1]();
|
||||
},
|
||||
failure: function(o) {/*failure handler code*/},
|
||||
argument: [node, onCompleteCallback]
|
||||
}
|
||||
var trobj = YAHOO.util.Connect.asyncRequest('POST','index.php', callback, params);
|
||||
var callback = {
|
||||
success: function (o) {
|
||||
node = o.argument[0];
|
||||
var nodes = YAHOO.lang.JSON.parse(o.responseText);
|
||||
var tmpNode;
|
||||
for (nodedata in nodes) {
|
||||
for (node1 in nodes[nodedata]) {
|
||||
addNode(node, nodes[nodedata][node1]);
|
||||
}
|
||||
}
|
||||
o.argument[1]();
|
||||
},
|
||||
failure: function (o) {/*failure handler code*/
|
||||
},
|
||||
argument: [node, onCompleteCallback]
|
||||
}
|
||||
var trobj = YAHOO.util.Connect.asyncRequest('POST', 'index.php', callback, params);
|
||||
}
|
|
@ -37,60 +37,65 @@
|
|||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
*/
|
||||
|
||||
var aclviewer = function(){
|
||||
var lastDisplay = '';
|
||||
return {
|
||||
view: function(role_id, role_module){
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php',{'success':aclviewer.display, 'failure':aclviewer.failed}, 'module=ACLRoles&action=EditRole&record=' + role_id + '&category_name=' + role_module);
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_REQUEST_PROCESSED'));
|
||||
},
|
||||
save: function(form_name){
|
||||
var formObject = document.getElementById(form_name);
|
||||
YAHOO.util.Connect.setForm(formObject);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php',{'success':aclviewer.postSave, 'failure':aclviewer.failed} );
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVING'));
|
||||
},
|
||||
postSave: function(o){
|
||||
SUGAR.util.globalEval(o.responseText);
|
||||
aclviewer.view(result['role_id'], result['module']);
|
||||
},
|
||||
display:function(o){
|
||||
aclviewer.lastDisplay = '';
|
||||
ajaxStatus.flashStatus('Done');
|
||||
document.getElementById('category_data').innerHTML = o.responseText;
|
||||
|
||||
},
|
||||
failed:function(){
|
||||
ajax.flashStatus('Could Not Connect');
|
||||
},
|
||||
|
||||
toggleDisplay:function(id){
|
||||
if(aclviewer.lastDisplay != '' && typeof(aclviewer.lastDisplay) != 'undefined'){
|
||||
aclviewer.hideDisplay(aclviewer.lastDisplay);
|
||||
}
|
||||
if(aclviewer.lastDisplay != id){
|
||||
aclviewer.showDisplay(id);
|
||||
aclviewer.lastDisplay = id;
|
||||
} else{
|
||||
aclviewer.lastDisplay = '';
|
||||
}
|
||||
var aclviewer = function () {
|
||||
var lastDisplay = '';
|
||||
return {
|
||||
view: function (role_id, role_module) {
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php', {
|
||||
'success': aclviewer.display,
|
||||
'failure': aclviewer.failed
|
||||
}, 'module=ACLRoles&action=EditRole&record=' + role_id + '&category_name=' + role_module);
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_REQUEST_PROCESSED'));
|
||||
},
|
||||
save: function (form_name) {
|
||||
var formObject = document.getElementById(form_name);
|
||||
YAHOO.util.Connect.setForm(formObject);
|
||||
YAHOO.util.Connect.asyncRequest('POST', 'index.php', {
|
||||
'success': aclviewer.postSave,
|
||||
'failure': aclviewer.failed
|
||||
});
|
||||
ajaxStatus.showStatus(SUGAR.language.get('app_strings', 'LBL_SAVING'));
|
||||
},
|
||||
postSave: function (o) {
|
||||
SUGAR.util.globalEval(o.responseText);
|
||||
aclviewer.view(result['role_id'], result['module']);
|
||||
},
|
||||
display: function (o) {
|
||||
aclviewer.lastDisplay = '';
|
||||
ajaxStatus.flashStatus('Done');
|
||||
document.getElementById('category_data').innerHTML = o.responseText;
|
||||
|
||||
},
|
||||
|
||||
hideDisplay:function(id){
|
||||
document.getElementById(id).style.display = 'none';
|
||||
document.getElementById(id + 'link').style.display = '';
|
||||
|
||||
},
|
||||
|
||||
showDisplay:function(id){
|
||||
document.getElementById(id).style.display = '';
|
||||
document.getElementById(id + 'link').style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
|
||||
};
|
||||
},
|
||||
failed: function () {
|
||||
ajax.flashStatus('Could Not Connect');
|
||||
},
|
||||
|
||||
toggleDisplay: function (id) {
|
||||
if (aclviewer.lastDisplay != '' && typeof(aclviewer.lastDisplay) != 'undefined') {
|
||||
aclviewer.hideDisplay(aclviewer.lastDisplay);
|
||||
}
|
||||
if (aclviewer.lastDisplay != id) {
|
||||
aclviewer.showDisplay(id);
|
||||
aclviewer.lastDisplay = id;
|
||||
} else {
|
||||
aclviewer.lastDisplay = '';
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
hideDisplay: function (id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
document.getElementById(id + 'link').style.display = '';
|
||||
|
||||
},
|
||||
|
||||
showDisplay: function (id) {
|
||||
document.getElementById(id).style.display = '';
|
||||
document.getElementById(id + 'link').style.display = 'none';
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
}();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -43,105 +43,100 @@
|
|||
var lbl_remove = SUGAR.language.get('app_strings', 'LBL_REMOVE');
|
||||
|
||||
function remove_filter(spanfieldid) {
|
||||
var selspan = document.getElementById(spanfieldid);
|
||||
//hide the span
|
||||
selspan.setAttribute("style","visibility:hidden");
|
||||
selspan.innerHTML='';//' '
|
||||
var selspan = document.getElementById(spanfieldid);
|
||||
//hide the span
|
||||
selspan.setAttribute("style", "visibility:hidden");
|
||||
selspan.innerHTML = '';//' '
|
||||
|
||||
//and id to avail list.
|
||||
var ops=object_refs['field_avail_list'].options;
|
||||
var newoption = new Option(selspan.getAttribute("Value"),selspan.getAttribute("ValueId"),false,true);
|
||||
ops.add(newoption);
|
||||
//and id to avail list.
|
||||
var ops = object_refs['field_avail_list'].options;
|
||||
var newoption = new Option(selspan.getAttribute("Value"), selspan.getAttribute("ValueId"), false, true);
|
||||
ops.add(newoption);
|
||||
}
|
||||
function ajax_fetch_sync(url,post_data)
|
||||
{
|
||||
global_xmlhttp = getXMLHTTPinstance();
|
||||
function ajax_fetch_sync(url, post_data) {
|
||||
global_xmlhttp = getXMLHTTPinstance();
|
||||
|
||||
var method = 'GET';
|
||||
if ( typeof(post_data) != 'undefined' )
|
||||
{
|
||||
method = 'POST';
|
||||
}
|
||||
var method = 'GET';
|
||||
if (typeof(post_data) != 'undefined') {
|
||||
method = 'POST';
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
global_xmlhttp.open(method, url,false);
|
||||
}
|
||||
catch(error)
|
||||
{
|
||||
alert('message:'+error.message+":url:"+url);
|
||||
}
|
||||
|
||||
if ( method == 'POST')
|
||||
{
|
||||
global_xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
}
|
||||
try {
|
||||
global_xmlhttp.open(method, url, false);
|
||||
}
|
||||
catch (error) {
|
||||
alert('message:' + error.message + ":url:" + url);
|
||||
}
|
||||
|
||||
global_xmlhttp.send(post_data);
|
||||
var ajax_response = {"responseText":global_xmlhttp.responseText,"responseXML":global_xmlhttp.responseXML};
|
||||
if (method == 'POST') {
|
||||
global_xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
||||
}
|
||||
|
||||
return ajax_response;
|
||||
global_xmlhttp.send(post_data);
|
||||
var ajax_response = {"responseText": global_xmlhttp.responseText, "responseXML": global_xmlhttp.responseXML};
|
||||
|
||||
return ajax_response;
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
//----------------------------------------------------
|
||||
function get_fields_to_dedup(parent_mod)
|
||||
{
|
||||
var rel_map_div_obj = document.getElementById('rel_map');
|
||||
function get_fields_to_dedup(parent_mod) {
|
||||
var rel_map_div_obj = document.getElementById('rel_map');
|
||||
|
||||
if(parent_mod != '')
|
||||
{
|
||||
var request_id = 1;
|
||||
var url = site_url + '/index.php?to_pdf=1&sugar_body_only=1&inline=1&parent_module=' + parent_mod + '&module=MigrationMappings&action=GetRelationshipsToMap';
|
||||
var ajax_return_obj = ajax_fetch_sync(url);
|
||||
if (parent_mod != '') {
|
||||
var request_id = 1;
|
||||
var url = site_url + '/index.php?to_pdf=1&sugar_body_only=1&inline=1&parent_module=' + parent_mod + '&module=MigrationMappings&action=GetRelationshipsToMap';
|
||||
var ajax_return_obj = ajax_fetch_sync(url);
|
||||
|
||||
try { SUGAR.util.globalEval("var responseObj =" + ajax_return_obj['responseText']); }
|
||||
catch(e) { alert(ajax_return_obj['responseText']); }
|
||||
try {
|
||||
SUGAR.util.globalEval("var responseObj =" + ajax_return_obj['responseText']);
|
||||
}
|
||||
catch (e) {
|
||||
alert(ajax_return_obj['responseText']);
|
||||
}
|
||||
|
||||
build_avail_rels_array(responseObj);
|
||||
|
||||
rel_map_div_obj.innerHTML = responseObj['html_content'];
|
||||
}
|
||||
else
|
||||
{
|
||||
rel_map_div_obj.innerHTML = '';
|
||||
}
|
||||
|
||||
return true;
|
||||
build_avail_rels_array(responseObj);
|
||||
|
||||
rel_map_div_obj.innerHTML = responseObj['html_content'];
|
||||
}
|
||||
else {
|
||||
rel_map_div_obj.innerHTML = '';
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function get_dedup_fields()
|
||||
{
|
||||
var parent_div = document.getElementById('filter_def');
|
||||
var node;
|
||||
var spannode;
|
||||
var value;
|
||||
var valueid;
|
||||
var style;
|
||||
document.DedupSetup.dedup_fields.value='';
|
||||
for (node in parent_div.childNodes) {
|
||||
spannode=parent_div.childNodes[node];
|
||||
if (spannode.tagName=='SPAN') {
|
||||
value= spannode.getAttribute('value');
|
||||
valueid=spannode.getAttribute('valueid');
|
||||
style=spannode.getAttribute('style');
|
||||
if (typeof(style) == 'undefined' || style==null || style=='' || style.lastIndexOf('hidden') == -1 ) {
|
||||
if (document.DedupSetup.dedup_fields.value != '') {
|
||||
document.DedupSetup.dedup_fields.value=document.DedupSetup.dedup_fields.value + '#';
|
||||
}
|
||||
document.DedupSetup.dedup_fields.value = document.DedupSetup.dedup_fields.value + valueid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//var selected_fields_obj = document.getElementById('field_include_list[]');
|
||||
function get_dedup_fields() {
|
||||
var parent_div = document.getElementById('filter_def');
|
||||
var node;
|
||||
var spannode;
|
||||
var value;
|
||||
var valueid;
|
||||
var style;
|
||||
document.DedupSetup.dedup_fields.value = '';
|
||||
for (node in parent_div.childNodes) {
|
||||
spannode = parent_div.childNodes[node];
|
||||
if (spannode.tagName == 'SPAN') {
|
||||
value = spannode.getAttribute('value');
|
||||
valueid = spannode.getAttribute('valueid');
|
||||
style = spannode.getAttribute('style');
|
||||
if (typeof(style) == 'undefined' || style == null || style == '' || style.lastIndexOf('hidden') == -1) {
|
||||
if (document.DedupSetup.dedup_fields.value != '') {
|
||||
document.DedupSetup.dedup_fields.value = document.DedupSetup.dedup_fields.value + '#';
|
||||
}
|
||||
document.DedupSetup.dedup_fields.value = document.DedupSetup.dedup_fields.value + valueid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//for(i=0; i < selected_fields_obj.length; i++)
|
||||
//{
|
||||
// document.DedupSetup.dedup_fields.value = document.DedupSetup.dedup_fields.value + selected_fields_obj.options[i].value;
|
||||
// if(i != (selected_fields_obj.length - 1)) { document.DedupSetup.dedup_fields.value += '#'; }
|
||||
//}
|
||||
//var selected_fields_obj = document.getElementById('field_include_list[]');
|
||||
|
||||
//for(i=0; i < selected_fields_obj.length; i++)
|
||||
//{
|
||||
// document.DedupSetup.dedup_fields.value = document.DedupSetup.dedup_fields.value + selected_fields_obj.options[i].value;
|
||||
// if(i != (selected_fields_obj.length - 1)) { document.DedupSetup.dedup_fields.value += '#'; }
|
||||
//}
|
||||
|
||||
// document.DedupSetup.submit();
|
||||
}
|
||||
|
@ -153,256 +148,248 @@ function get_dedup_fields()
|
|||
//-------------------------------------------------------------------
|
||||
//-------------------------------------------------------------------
|
||||
var object_refs = new Object();
|
||||
object_refs['field_include_list'] = document.DedupSetup['field_include_list'];
|
||||
object_refs['field_include_list'] = document.DedupSetup['field_include_list'];
|
||||
object_refs['field_avail_list'] = document.DedupSetup['field_avail_list'];
|
||||
|
||||
function setselected(included_name,avail_name)
|
||||
{
|
||||
var included_columns_ref = object_refs[included_name];
|
||||
var avail_columns_ref = object_refs[avail_name];
|
||||
function setselected(included_name, avail_name) {
|
||||
var included_columns_ref = object_refs[included_name];
|
||||
var avail_columns_ref = object_refs[avail_name];
|
||||
|
||||
var included_td = document.getElementById(included_name+'_td');
|
||||
var avail_td = document.getElementById(avail_name+'_td');
|
||||
var included_td = document.getElementById(included_name + '_td');
|
||||
var avail_td = document.getElementById(avail_name + '_td');
|
||||
|
||||
var selected_avail = new Array();
|
||||
var notselected_avail = new Array();
|
||||
var notselected_include = new Array();
|
||||
var selected_avail = new Array();
|
||||
var notselected_avail = new Array();
|
||||
var notselected_include = new Array();
|
||||
|
||||
for (i=0; i < avail_columns_ref.options.length; i++)
|
||||
{
|
||||
if (avail_columns_ref.options[i].selected == true)
|
||||
{
|
||||
selected_avail[selected_avail.length] = {text:avail_columns_ref.options[i].text, value:avail_columns_ref.options[i].value};
|
||||
}
|
||||
else
|
||||
{
|
||||
notselected_avail[notselected_avail.length] = {text:avail_columns_ref.options[i].text, value:avail_columns_ref.options[i].value};
|
||||
}
|
||||
|
||||
}
|
||||
for (i = 0; i < avail_columns_ref.options.length; i++) {
|
||||
if (avail_columns_ref.options[i].selected == true) {
|
||||
selected_avail[selected_avail.length] = {
|
||||
text: avail_columns_ref.options[i].text,
|
||||
value: avail_columns_ref.options[i].value
|
||||
};
|
||||
}
|
||||
else {
|
||||
notselected_avail[notselected_avail.length] = {
|
||||
text: avail_columns_ref.options[i].text,
|
||||
value: avail_columns_ref.options[i].value
|
||||
};
|
||||
}
|
||||
|
||||
var right_select_html_info = new Object();
|
||||
var right_options = new Array();
|
||||
var right_select = new Object();
|
||||
}
|
||||
|
||||
right_select['name'] = avail_name+ '[]';
|
||||
right_select['id'] = avail_name;
|
||||
right_select['multiple'] = 'true';
|
||||
right_select['size'] = '10';
|
||||
var right_select_html_info = new Object();
|
||||
var right_options = new Array();
|
||||
var right_select = new Object();
|
||||
|
||||
for (i=0;i < notselected_avail.length;i++)
|
||||
{
|
||||
right_options[right_options.length] = notselected_avail[i];
|
||||
}
|
||||
right_select['name'] = avail_name + '[]';
|
||||
right_select['id'] = avail_name;
|
||||
right_select['multiple'] = 'true';
|
||||
right_select['size'] = '10';
|
||||
|
||||
right_select_html_info['options'] = right_options;
|
||||
right_select_html_info['select'] = right_select;
|
||||
for (i = 0; i < notselected_avail.length; i++) {
|
||||
right_options[right_options.length] = notselected_avail[i];
|
||||
}
|
||||
|
||||
var right_html = buildSelectHTML(right_select_html_info);
|
||||
right_select_html_info['options'] = right_options;
|
||||
right_select_html_info['select'] = right_select;
|
||||
|
||||
avail_td.innerHTML = right_html;
|
||||
object_refs[avail_name] = avail_td.getElementsByTagName('select')[0];
|
||||
var right_html = buildSelectHTML(right_select_html_info);
|
||||
|
||||
//////////////////////////////
|
||||
for(p=0; p < selected_avail.length; p++)
|
||||
{
|
||||
addFieldRow(selected_avail[p].value, selected_avail[p].text)
|
||||
}
|
||||
///////////////////////////
|
||||
avail_td.innerHTML = right_html;
|
||||
object_refs[avail_name] = avail_td.getElementsByTagName('select')[0];
|
||||
|
||||
//////////////////////////////
|
||||
for (p = 0; p < selected_avail.length; p++) {
|
||||
addFieldRow(selected_avail[p].value, selected_avail[p].text)
|
||||
}
|
||||
///////////////////////////
|
||||
|
||||
}
|
||||
|
||||
|
||||
function up(name) {
|
||||
var td = document.getElementById(name+'_td');
|
||||
var obj = td.getElementsByTagName('select')[0];
|
||||
obj = (typeof obj == "string") ? document.getElementById(obj) : obj;
|
||||
if (obj.tagName.toLowerCase() != "select" && obj.length < 2)
|
||||
return false;
|
||||
var sel = new Array();
|
||||
var td = document.getElementById(name + '_td');
|
||||
var obj = td.getElementsByTagName('select')[0];
|
||||
obj = (typeof obj == "string") ? document.getElementById(obj) : obj;
|
||||
if (obj.tagName.toLowerCase() != "select" && obj.length < 2)
|
||||
return false;
|
||||
var sel = new Array();
|
||||
|
||||
for (i=0; i<obj.length; i++) {
|
||||
if (obj[i].selected == true) {
|
||||
sel[sel.length] = i;
|
||||
}
|
||||
}
|
||||
for (i in sel) {
|
||||
if (sel[i] != 0 && !obj[sel[i]-1].selected) {
|
||||
var tmp = new Array(obj[sel[i]-1].text, obj[sel[i]-1].value);
|
||||
obj[sel[i]-1].text = obj[sel[i]].text;
|
||||
obj[sel[i]-1].value = obj[sel[i]].value;
|
||||
obj[sel[i]].text = tmp[0];
|
||||
obj[sel[i]].value = tmp[1];
|
||||
obj[sel[i]-1].selected = true;
|
||||
obj[sel[i]].selected = false;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < obj.length; i++) {
|
||||
if (obj[i].selected == true) {
|
||||
sel[sel.length] = i;
|
||||
}
|
||||
}
|
||||
for (i in sel) {
|
||||
if (sel[i] != 0 && !obj[sel[i] - 1].selected) {
|
||||
var tmp = new Array(obj[sel[i] - 1].text, obj[sel[i] - 1].value);
|
||||
obj[sel[i] - 1].text = obj[sel[i]].text;
|
||||
obj[sel[i] - 1].value = obj[sel[i]].value;
|
||||
obj[sel[i]].text = tmp[0];
|
||||
obj[sel[i]].value = tmp[1];
|
||||
obj[sel[i] - 1].selected = true;
|
||||
obj[sel[i]].selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function down(name) {
|
||||
var td = document.getElementById(name+'_td');
|
||||
var obj = td.getElementsByTagName('select')[0];
|
||||
if (obj.tagName.toLowerCase() != "select" && obj.length < 2)
|
||||
return false;
|
||||
var sel = new Array();
|
||||
for (i=obj.length-1; i>-1; i--) {
|
||||
if (obj[i].selected == true) {
|
||||
sel[sel.length] = i;
|
||||
}
|
||||
}
|
||||
for (i in sel) {
|
||||
if (sel[i] != obj.length-1 && !obj[sel[i]+1].selected) {
|
||||
var tmp = new Array(obj[sel[i]+1].text, obj[sel[i]+1].value);
|
||||
obj[sel[i]+1].text = obj[sel[i]].text;
|
||||
obj[sel[i]+1].value = obj[sel[i]].value;
|
||||
obj[sel[i]].text = tmp[0];
|
||||
obj[sel[i]].value = tmp[1];
|
||||
obj[sel[i]+1].selected = true;
|
||||
obj[sel[i]].selected = false;
|
||||
}
|
||||
}
|
||||
var td = document.getElementById(name + '_td');
|
||||
var obj = td.getElementsByTagName('select')[0];
|
||||
if (obj.tagName.toLowerCase() != "select" && obj.length < 2)
|
||||
return false;
|
||||
var sel = new Array();
|
||||
for (i = obj.length - 1; i > -1; i--) {
|
||||
if (obj[i].selected == true) {
|
||||
sel[sel.length] = i;
|
||||
}
|
||||
}
|
||||
for (i in sel) {
|
||||
if (sel[i] != obj.length - 1 && !obj[sel[i] + 1].selected) {
|
||||
var tmp = new Array(obj[sel[i] + 1].text, obj[sel[i] + 1].value);
|
||||
obj[sel[i] + 1].text = obj[sel[i]].text;
|
||||
obj[sel[i] + 1].value = obj[sel[i]].value;
|
||||
obj[sel[i]].text = tmp[0];
|
||||
obj[sel[i]].value = tmp[1];
|
||||
obj[sel[i] + 1].selected = true;
|
||||
obj[sel[i]].selected = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function buildSelectHTML(info)
|
||||
{
|
||||
var text;
|
||||
text = "<div align='left'><select";
|
||||
function buildSelectHTML(info) {
|
||||
var text;
|
||||
text = "<div align='left'><select";
|
||||
|
||||
if ( typeof (info['select']['size']) != 'undefined')
|
||||
{
|
||||
text +=" size=\""+ info['select']['size'] +"\"";
|
||||
}
|
||||
if (typeof (info['select']['size']) != 'undefined') {
|
||||
text += " size=\"" + info['select']['size'] + "\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['name']) != 'undefined')
|
||||
{
|
||||
text +=" name=\""+ info['select']['name'] +"\"";
|
||||
}
|
||||
if (typeof (info['select']['name']) != 'undefined') {
|
||||
text += " name=\"" + info['select']['name'] + "\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['style']) != 'undefined')
|
||||
{
|
||||
text +=" style=\""+ info['select']['style'] +"\"";
|
||||
}
|
||||
if (typeof (info['select']['style']) != 'undefined') {
|
||||
text += " style=\"" + info['select']['style'] + "\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['onchange']) != 'undefined')
|
||||
{
|
||||
text +=" onChange=\""+ info['select']['onchange'] +"\"";
|
||||
}
|
||||
if (typeof (info['select']['onchange']) != 'undefined') {
|
||||
text += " onChange=\"" + info['select']['onchange'] + "\"";
|
||||
}
|
||||
|
||||
if ( typeof (info['select']['multiple']) != 'undefined')
|
||||
{
|
||||
text +=" multiple";
|
||||
}
|
||||
text +=">";
|
||||
if (typeof (info['select']['multiple']) != 'undefined') {
|
||||
text += " multiple";
|
||||
}
|
||||
text += ">";
|
||||
|
||||
for(i=0; i<info['options'].length;i++)
|
||||
{
|
||||
option = info['options'][i];
|
||||
text += "<option value=\""+option['value']+"\" ";
|
||||
if ( typeof (option['selected']) != 'undefined' && option['selected']== true)
|
||||
{
|
||||
text += "SELECTED";
|
||||
}
|
||||
text += ">"+option['text']+"</option>";
|
||||
}
|
||||
text += "</select></div>";
|
||||
return text;
|
||||
for (i = 0; i < info['options'].length; i++) {
|
||||
option = info['options'][i];
|
||||
text += "<option value=\"" + option['value'] + "\" ";
|
||||
if (typeof (option['selected']) != 'undefined' && option['selected'] == true) {
|
||||
text += "SELECTED";
|
||||
}
|
||||
text += ">" + option['text'] + "</option>";
|
||||
}
|
||||
text += "</select></div>";
|
||||
return text;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////
|
||||
var fieldCount = 0;
|
||||
function addFieldRow(colName, colLabel) {
|
||||
var tableId = 'search_type';
|
||||
var rowIdName = 'field';
|
||||
var tableId = 'search_type';
|
||||
var rowIdName = 'field';
|
||||
|
||||
var fieldArrayCount;
|
||||
var optionVal;
|
||||
var optionDispVal;
|
||||
var optionsIndex = 0;
|
||||
var fieldArrayCount;
|
||||
var optionVal;
|
||||
var optionDispVal;
|
||||
var optionsIndex = 0;
|
||||
|
||||
fieldCount = fieldCount + 1;
|
||||
document.DedupSetup.num_fields.value = fieldCount;
|
||||
fieldCount = fieldCount + 1;
|
||||
document.DedupSetup.num_fields.value = fieldCount;
|
||||
|
||||
var selElement = document.createElement("select");
|
||||
var selectName = colName + "SearchType";
|
||||
selElement.setAttribute("name", selectName);
|
||||
var selElement = document.createElement("select");
|
||||
var selectName = colName + "SearchType";
|
||||
selElement.setAttribute("name", selectName);
|
||||
|
||||
var i=0;
|
||||
for (theoption in operator_options) {
|
||||
selElement.options[i] = new Option(operator_options[theoption],theoption, false, false);
|
||||
i++;
|
||||
}
|
||||
var i = 0;
|
||||
for (theoption in operator_options) {
|
||||
selElement.options[i] = new Option(operator_options[theoption], theoption, false, false);
|
||||
i++;
|
||||
}
|
||||
|
||||
var aElement = document.createElement("a");
|
||||
aElement.setAttribute("href","javascript:remove_filter('filter_" + colName + "')");
|
||||
aElement.setAttribute("class","listViewTdToolsS1");
|
||||
|
||||
var imgElement = document.createElement("img");
|
||||
imgElement.setAttribute("src", delete_inline_image);
|
||||
imgElement.setAttribute("align","absmiddle");
|
||||
imgElement.setAttribute("alt",lbl_remove);
|
||||
imgElement.setAttribute("border","0");
|
||||
imgElement.setAttribute("height","12");
|
||||
imgElement.setAttribute("width","12");
|
||||
|
||||
aElement.appendChild(imgElement);
|
||||
aElement.appendChild(document.createTextNode(" "));
|
||||
|
||||
var div = document.getElementById('filter_def');
|
||||
var span1 = document.getElementById('filter_'+colName);
|
||||
if (span1 == null || span1=='' || typeof(span1)=='undefined') {
|
||||
span1=document.createElement("span");
|
||||
} else {
|
||||
span1.setAttribute("style","visibility:visible");
|
||||
}
|
||||
|
||||
span1.setAttribute("id",'filter_'+colName);
|
||||
span1.setAttribute("Value",colLabel);
|
||||
span1.setAttribute("ValueId",colName);
|
||||
|
||||
//table as a child of span element.
|
||||
//table with only row only.
|
||||
var table = document.createElement("table");
|
||||
//usage or insertRow is required by IE, ironically this call
|
||||
//produces bad UI when using IE on mac.
|
||||
var row = table.insertRow(table.rows.length );
|
||||
table.setAttribute("width","100%");
|
||||
table.setAttribute("border","0");
|
||||
table.setAttribute("cellpadding","0");
|
||||
var aElement = document.createElement("a");
|
||||
aElement.setAttribute("href", "javascript:remove_filter('filter_" + colName + "')");
|
||||
aElement.setAttribute("class", "listViewTdToolsS1");
|
||||
|
||||
var td1= document.createElement("td");
|
||||
td1.setAttribute("width","2%");
|
||||
|
||||
td1.appendChild(aElement);
|
||||
row.appendChild(td1)
|
||||
var imgElement = document.createElement("img");
|
||||
imgElement.setAttribute("src", delete_inline_image);
|
||||
imgElement.setAttribute("align", "absmiddle");
|
||||
imgElement.setAttribute("alt", lbl_remove);
|
||||
imgElement.setAttribute("border", "0");
|
||||
imgElement.setAttribute("height", "12");
|
||||
imgElement.setAttribute("width", "12");
|
||||
|
||||
var td2= document.createElement("td");
|
||||
td2.setAttribute("width","20%");
|
||||
td2.appendChild(document.createTextNode(colLabel + ': '));
|
||||
row.appendChild(td2)
|
||||
|
||||
var td3= document.createElement("td");
|
||||
td3.setAttribute("width","10%");
|
||||
td3.appendChild(selElement);
|
||||
row.appendChild(td3);
|
||||
aElement.appendChild(imgElement);
|
||||
aElement.appendChild(document.createTextNode(" "));
|
||||
|
||||
var coldata;
|
||||
SUGAR.util.globalEval("coldata=bean_data."+ colName+ ";");
|
||||
|
||||
var edit=document.createElement("input");
|
||||
edit.setAttribute("type","text");
|
||||
edit.setAttribute("name",colName + 'SearchField');
|
||||
edit.setAttribute("id",colName + 'SearchField');
|
||||
edit.setAttribute("value",coldata);
|
||||
|
||||
var div = document.getElementById('filter_def');
|
||||
var span1 = document.getElementById('filter_' + colName);
|
||||
if (span1 == null || span1 == '' || typeof(span1) == 'undefined') {
|
||||
span1 = document.createElement("span");
|
||||
} else {
|
||||
span1.setAttribute("style", "visibility:visible");
|
||||
}
|
||||
|
||||
var td5= document.createElement("td");
|
||||
td5.setAttribute("width","68%");
|
||||
td5.appendChild(edit);
|
||||
row.appendChild(td5);
|
||||
span1.setAttribute("id", 'filter_' + colName);
|
||||
span1.setAttribute("Value", colLabel);
|
||||
span1.setAttribute("ValueId", colName);
|
||||
|
||||
|
||||
//table.appendChild(row);
|
||||
span1.appendChild(table);
|
||||
div.appendChild(span1);
|
||||
//table as a child of span element.
|
||||
//table with only row only.
|
||||
var table = document.createElement("table");
|
||||
//usage or insertRow is required by IE, ironically this call
|
||||
//produces bad UI when using IE on mac.
|
||||
var row = table.insertRow(table.rows.length);
|
||||
table.setAttribute("width", "100%");
|
||||
table.setAttribute("border", "0");
|
||||
table.setAttribute("cellpadding", "0");
|
||||
|
||||
var td1 = document.createElement("td");
|
||||
td1.setAttribute("width", "2%");
|
||||
|
||||
td1.appendChild(aElement);
|
||||
row.appendChild(td1)
|
||||
|
||||
var td2 = document.createElement("td");
|
||||
td2.setAttribute("width", "20%");
|
||||
td2.appendChild(document.createTextNode(colLabel + ': '));
|
||||
row.appendChild(td2)
|
||||
|
||||
var td3 = document.createElement("td");
|
||||
td3.setAttribute("width", "10%");
|
||||
td3.appendChild(selElement);
|
||||
row.appendChild(td3);
|
||||
|
||||
var coldata;
|
||||
SUGAR.util.globalEval("coldata=bean_data." + colName + ";");
|
||||
|
||||
var edit = document.createElement("input");
|
||||
edit.setAttribute("type", "text");
|
||||
edit.setAttribute("name", colName + 'SearchField');
|
||||
edit.setAttribute("id", colName + 'SearchField');
|
||||
edit.setAttribute("value", coldata);
|
||||
|
||||
|
||||
var td5 = document.createElement("td");
|
||||
td5.setAttribute("width", "68%");
|
||||
td5.appendChild(edit);
|
||||
row.appendChild(td5);
|
||||
|
||||
|
||||
//table.appendChild(row);
|
||||
span1.appendChild(table);
|
||||
div.appendChild(span1);
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -37,57 +37,34 @@
|
|||
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
|
||||
*/
|
||||
var lbl_remove=SUGAR.language.get('app_strings','LBL_REMOVE');function remove_filter(spanfieldid){var selspan=document.getElementById(spanfieldid);selspan.setAttribute("style","visibility:hidden");selspan.innerHTML='';var ops=object_refs['field_avail_list'].options;var newoption=new Option(selspan.getAttribute("Value"),selspan.getAttribute("ValueId"),false,true);ops.add(newoption);}
|
||||
function ajax_fetch_sync(url,post_data)
|
||||
{global_xmlhttp=getXMLHTTPinstance();var method='GET';if(typeof(post_data)!='undefined')
|
||||
{method='POST';}
|
||||
try
|
||||
{global_xmlhttp.open(method,url,false);}
|
||||
catch(error)
|
||||
{alert('message:'+error.message+":url:"+url);}
|
||||
if(method=='POST')
|
||||
{global_xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
|
||||
function ajax_fetch_sync(url,post_data){global_xmlhttp=getXMLHTTPinstance();var method='GET';if(typeof(post_data)!='undefined'){method='POST';}
|
||||
try{global_xmlhttp.open(method,url,false);}
|
||||
catch(error){alert('message:'+error.message+":url:"+url);}
|
||||
if(method=='POST'){global_xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');}
|
||||
global_xmlhttp.send(post_data);var ajax_response={"responseText":global_xmlhttp.responseText,"responseXML":global_xmlhttp.responseXML};return ajax_response;}
|
||||
function get_fields_to_dedup(parent_mod)
|
||||
{var rel_map_div_obj=document.getElementById('rel_map');if(parent_mod!='')
|
||||
{var request_id=1;var url=site_url+'/index.php?to_pdf=1&sugar_body_only=1&inline=1&parent_module='+parent_mod+'&module=MigrationMappings&action=GetRelationshipsToMap';var ajax_return_obj=ajax_fetch_sync(url);try{SUGAR.util.globalEval("var responseObj ="+ajax_return_obj['responseText']);}
|
||||
function get_fields_to_dedup(parent_mod){var rel_map_div_obj=document.getElementById('rel_map');if(parent_mod!=''){var request_id=1;var url=site_url+'/index.php?to_pdf=1&sugar_body_only=1&inline=1&parent_module='+parent_mod+'&module=MigrationMappings&action=GetRelationshipsToMap';var ajax_return_obj=ajax_fetch_sync(url);try{SUGAR.util.globalEval("var responseObj ="+ajax_return_obj['responseText']);}
|
||||
catch(e){alert(ajax_return_obj['responseText']);}
|
||||
build_avail_rels_array(responseObj);rel_map_div_obj.innerHTML=responseObj['html_content'];}
|
||||
else
|
||||
{rel_map_div_obj.innerHTML='';}
|
||||
else{rel_map_div_obj.innerHTML='';}
|
||||
return true;}
|
||||
function get_dedup_fields()
|
||||
{var parent_div=document.getElementById('filter_def');var node;var spannode;var value;var valueid;var style;document.DedupSetup.dedup_fields.value='';for(node in parent_div.childNodes){spannode=parent_div.childNodes[node];if(spannode.tagName=='SPAN'){value=spannode.getAttribute('value');valueid=spannode.getAttribute('valueid');style=spannode.getAttribute('style');if(typeof(style)=='undefined'||style==null||style==''||style.lastIndexOf('hidden')==-1){if(document.DedupSetup.dedup_fields.value!=''){document.DedupSetup.dedup_fields.value=document.DedupSetup.dedup_fields.value+'#';}
|
||||
function get_dedup_fields(){var parent_div=document.getElementById('filter_def');var node;var spannode;var value;var valueid;var style;document.DedupSetup.dedup_fields.value='';for(node in parent_div.childNodes){spannode=parent_div.childNodes[node];if(spannode.tagName=='SPAN'){value=spannode.getAttribute('value');valueid=spannode.getAttribute('valueid');style=spannode.getAttribute('style');if(typeof(style)=='undefined'||style==null||style==''||style.lastIndexOf('hidden')==-1){if(document.DedupSetup.dedup_fields.value!=''){document.DedupSetup.dedup_fields.value=document.DedupSetup.dedup_fields.value+'#';}
|
||||
document.DedupSetup.dedup_fields.value=document.DedupSetup.dedup_fields.value+valueid;}}}}
|
||||
var object_refs=new Object();object_refs['field_include_list']=document.DedupSetup['field_include_list'];object_refs['field_avail_list']=document.DedupSetup['field_avail_list'];function setselected(included_name,avail_name)
|
||||
{var included_columns_ref=object_refs[included_name];var avail_columns_ref=object_refs[avail_name];var included_td=document.getElementById(included_name+'_td');var avail_td=document.getElementById(avail_name+'_td');var selected_avail=new Array();var notselected_avail=new Array();var notselected_include=new Array();for(i=0;i<avail_columns_ref.options.length;i++)
|
||||
{if(avail_columns_ref.options[i].selected==true)
|
||||
{selected_avail[selected_avail.length]={text:avail_columns_ref.options[i].text,value:avail_columns_ref.options[i].value};}
|
||||
else
|
||||
{notselected_avail[notselected_avail.length]={text:avail_columns_ref.options[i].text,value:avail_columns_ref.options[i].value};}}
|
||||
var right_select_html_info=new Object();var right_options=new Array();var right_select=new Object();right_select['name']=avail_name+'[]';right_select['id']=avail_name;right_select['multiple']='true';right_select['size']='10';for(i=0;i<notselected_avail.length;i++)
|
||||
{right_options[right_options.length]=notselected_avail[i];}
|
||||
right_select_html_info['options']=right_options;right_select_html_info['select']=right_select;var right_html=buildSelectHTML(right_select_html_info);avail_td.innerHTML=right_html;object_refs[avail_name]=avail_td.getElementsByTagName('select')[0];for(p=0;p<selected_avail.length;p++)
|
||||
{addFieldRow(selected_avail[p].value,selected_avail[p].text)}}
|
||||
var object_refs=new Object();object_refs['field_include_list']=document.DedupSetup['field_include_list'];object_refs['field_avail_list']=document.DedupSetup['field_avail_list'];function setselected(included_name,avail_name){var included_columns_ref=object_refs[included_name];var avail_columns_ref=object_refs[avail_name];var included_td=document.getElementById(included_name+'_td');var avail_td=document.getElementById(avail_name+'_td');var selected_avail=new Array();var notselected_avail=new Array();var notselected_include=new Array();for(i=0;i<avail_columns_ref.options.length;i++){if(avail_columns_ref.options[i].selected==true){selected_avail[selected_avail.length]={text:avail_columns_ref.options[i].text,value:avail_columns_ref.options[i].value};}
|
||||
else{notselected_avail[notselected_avail.length]={text:avail_columns_ref.options[i].text,value:avail_columns_ref.options[i].value};}}
|
||||
var right_select_html_info=new Object();var right_options=new Array();var right_select=new Object();right_select['name']=avail_name+'[]';right_select['id']=avail_name;right_select['multiple']='true';right_select['size']='10';for(i=0;i<notselected_avail.length;i++){right_options[right_options.length]=notselected_avail[i];}
|
||||
right_select_html_info['options']=right_options;right_select_html_info['select']=right_select;var right_html=buildSelectHTML(right_select_html_info);avail_td.innerHTML=right_html;object_refs[avail_name]=avail_td.getElementsByTagName('select')[0];for(p=0;p<selected_avail.length;p++){addFieldRow(selected_avail[p].value,selected_avail[p].text)}}
|
||||
function up(name){var td=document.getElementById(name+'_td');var obj=td.getElementsByTagName('select')[0];obj=(typeof obj=="string")?document.getElementById(obj):obj;if(obj.tagName.toLowerCase()!="select"&&obj.length<2)
|
||||
return false;var sel=new Array();for(i=0;i<obj.length;i++){if(obj[i].selected==true){sel[sel.length]=i;}}
|
||||
for(i in sel){if(sel[i]!=0&&!obj[sel[i]-1].selected){var tmp=new Array(obj[sel[i]-1].text,obj[sel[i]-1].value);obj[sel[i]-1].text=obj[sel[i]].text;obj[sel[i]-1].value=obj[sel[i]].value;obj[sel[i]].text=tmp[0];obj[sel[i]].value=tmp[1];obj[sel[i]-1].selected=true;obj[sel[i]].selected=false;}}}
|
||||
function down(name){var td=document.getElementById(name+'_td');var obj=td.getElementsByTagName('select')[0];if(obj.tagName.toLowerCase()!="select"&&obj.length<2)
|
||||
return false;var sel=new Array();for(i=obj.length-1;i>-1;i--){if(obj[i].selected==true){sel[sel.length]=i;}}
|
||||
for(i in sel){if(sel[i]!=obj.length-1&&!obj[sel[i]+1].selected){var tmp=new Array(obj[sel[i]+1].text,obj[sel[i]+1].value);obj[sel[i]+1].text=obj[sel[i]].text;obj[sel[i]+1].value=obj[sel[i]].value;obj[sel[i]].text=tmp[0];obj[sel[i]].value=tmp[1];obj[sel[i]+1].selected=true;obj[sel[i]].selected=false;}}}
|
||||
function buildSelectHTML(info)
|
||||
{var text;text="<div align='left'><select";if(typeof(info['select']['size'])!='undefined')
|
||||
{text+=" size=\""+info['select']['size']+"\"";}
|
||||
if(typeof(info['select']['name'])!='undefined')
|
||||
{text+=" name=\""+info['select']['name']+"\"";}
|
||||
if(typeof(info['select']['style'])!='undefined')
|
||||
{text+=" style=\""+info['select']['style']+"\"";}
|
||||
if(typeof(info['select']['onchange'])!='undefined')
|
||||
{text+=" onChange=\""+info['select']['onchange']+"\"";}
|
||||
if(typeof(info['select']['multiple'])!='undefined')
|
||||
{text+=" multiple";}
|
||||
text+=">";for(i=0;i<info['options'].length;i++)
|
||||
{option=info['options'][i];text+="<option value=\""+option['value']+"\" ";if(typeof(option['selected'])!='undefined'&&option['selected']==true)
|
||||
{text+="SELECTED";}
|
||||
function buildSelectHTML(info){var text;text="<div align='left'><select";if(typeof(info['select']['size'])!='undefined'){text+=" size=\""+info['select']['size']+"\"";}
|
||||
if(typeof(info['select']['name'])!='undefined'){text+=" name=\""+info['select']['name']+"\"";}
|
||||
if(typeof(info['select']['style'])!='undefined'){text+=" style=\""+info['select']['style']+"\"";}
|
||||
if(typeof(info['select']['onchange'])!='undefined'){text+=" onChange=\""+info['select']['onchange']+"\"";}
|
||||
if(typeof(info['select']['multiple'])!='undefined'){text+=" multiple";}
|
||||
text+=">";for(i=0;i<info['options'].length;i++){option=info['options'][i];text+="<option value=\""+option['value']+"\" ";if(typeof(option['selected'])!='undefined'&&option['selected']==true){text+="SELECTED";}
|
||||
text+=">"+option['text']+"</option>";}
|
||||
text+="</select></div>";return text;}
|
||||
var fieldCount=0;function addFieldRow(colName,colLabel){var tableId='search_type';var rowIdName='field';var fieldArrayCount;var optionVal;var optionDispVal;var optionsIndex=0;fieldCount=fieldCount+1;document.DedupSetup.num_fields.value=fieldCount;var selElement=document.createElement("select");var selectName=colName+"SearchType";selElement.setAttribute("name",selectName);var i=0;for(theoption in operator_options){selElement.options[i]=new Option(operator_options[theoption],theoption,false,false);i++;}
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue