// JavaScript Document var EcmCalls_image_assign = document.getElementById('EcmCalls_image_assign'); var EcmCalls_image_search = document.getElementById('EcmCalls_image_search'); function EcmCalls_viewAnMenu(img, number, record, module, id, name) { var anMenu = document.getElementById('anMenu'); if(typeof(anMenu) == "object") { var imgPos = YAHOO.util.Dom.getXY(img); if(imgPos) { anMenuClear(); if(module && module != '') { document.forms.anMenuEdit.an_menu_parent.value = module; document.forms.anMenuEdit.an_menu_old_parent.value = module; } else { document.forms.anMenuEdit.an_menu_old_parent.value = ''; } if(id && id != '') { document.forms.anMenuEdit.an_menu_parent_id.value = id; document.forms.anMenuEdit.an_menu_old_parent_id.value = id; } else { document.forms.anMenuEdit.an_menu_parent_id.value = ''; document.forms.anMenuEdit.an_menu_old_parent_id.value = ''; } if(name && name != '') document.forms.anMenuEdit.an_menu_parent_name.value = name; else document.forms.anMenuEdit.an_menu_parent_name.value = ''; if(record && record != '') document.forms.anMenuEdit.an_menu_ecmcall_record.value = record; else document.forms.anMenuEdit.an_menu_ecmcall_record.value = ''; if(number && number != '') document.forms.anMenuEdit.an_menu_old_parent_phone.value = number; else document.forms.anMenuEdit.an_menu_old_parent_phone.value = ''; document.forms.anMenuEdit.an_menu_new_phone.value = number; //document.forms.anMenuEdit.an_menu_update_all_old_records.checked = true; anMenu.style.display = ''; var left = imgPos[0]+8-anMenu.offsetWidth/2; if((document.body.offsetWidth - imgPos[0] - anMenu.offsetWidth/2 - 25) < 0) left = document.body.offsetWidth - 25 - anMenu.offsetWidth; anMenu.style.left = left; anMenu.style.top = imgPos[1]-12-anMenu.offsetHeight; } } } function EcmCalls_showAssignImage(span, number, record, module, id, name) { if(typeof(span) == "object") { span.parentNode.appendChild(EcmCalls_image_assign); EcmCalls_image_assign.style.display = ''; EcmCalls_image_assign.onclick = function() { EcmCalls_viewAnMenu(this, number, record, module, id, name); }; if(typeof(module) != "undefined" && typeof(id) != "undefined") { span.parentNode.appendChild(EcmCalls_image_search); EcmCalls_image_search.style.display = ''; EcmCalls_image_search.onclick = function() { var url = 'index.php?searchFormTab=advanced_search&module=EcmCalls&action=index&query=true&parent_from_advanced='+module+'&parent_from_id_advanced[]='+id+'&orderBy=CALLDATE&sortOrder=DESC'; if(document.getElementById('call_date_from_ecmcalls_tmp')) url += '&call_date_from_advanced='+document.getElementById('call_date_from_ecmcalls_tmp').value; if(document.getElementById('call_date_to_ecmcalls_tmp')) url += '&call_date_to_advanced='+document.getElementById('call_date_to_ecmcalls_tmp').value; if(document.getElementById('calldate_ecmcalls_tmp')) url += '&calldate_advanced='+document.getElementById('calldate_ecmcalls_tmp').value; window.location = url; }; } else { EcmCalls_image_search.style.display = 'none'; } } } function EcmCalls_hideAssignImage(span, number) { if(typeof(span) == "object") { //EcmCalls_image_assign.style.display = 'none'; //document.body.appendChild(EcmCalls_image_assign); } } function EcmCallsSearchRecord() { var div = document.getElementById("EcmCallsAdditionalDetails"); if(div) { var url = 'index.php?searchFormTab=advanced_search&module=EcmCalls&action=index&query=true&parent_from_advanced='+div.ec_module+'&parent_from_id_advanced[]='+div.ec_id+'&orderBy=CALLDATE&sortOrder=DESC'; if(document.getElementById('call_date_from_ecmcalls_tmp')) url += '&call_date_from_advanced='+document.getElementById('call_date_from_ecmcalls_tmp').value; if(document.getElementById('call_date_to_ecmcalls_tmp')) url += '&call_date_to_advanced='+document.getElementById('call_date_to_ecmcalls_tmp').value; if(document.getElementById('calldate_ecmcalls_tmp')) url += '&calldate_advanced='+document.getElementById('calldate_ecmcalls_tmp').value; window.location = url; } } function EcmCallsAssignRecord(img) { var div = document.getElementById("EcmCallsAdditionalDetails"); if(div) { EcmCalls_viewAnMenu(img, div.ec_number, div.ec_record, div.ec_module, div.ec_id, div.ec_name); } } function EcmCallsViewDetailRecord(img) { var div = document.getElementById("EcmCallsAdditionalDetails"); if(div) { window.location = "index.php?module="+(div.ec_module == "Users" ? "Employees" : div.ec_module)+"&action=DetailView&record="+div.ec_id+"&return_module=EcmCalls&return_action=ListView"; } } function ShowAdditionalDetails(title,obj,call,module) { var div = document.getElementById("EcmCallsAdditionalDetails"); if(!div) { div = document.createElement("div"); div.style.background="#ffffff"; div.style.position="absolute"; div.style.left = '10px'; div.style.top = '10px'; div.id="EcmCallsAdditionalDetails"; var divi ='
'; divi += '
'; divi += ''; divi += ''; divi += ''; divi += ''; divi += ''; divi += '
'; divi += '
'; divi += '
'; div.innerHTML = divi; document.body.appendChild(div); } if(div) { if(call) { document.getElementById("EcmCalls_search_img").style.display = ""; document.getElementById("EcmCalls_assign_img").style.display = ""; } else { document.getElementById("EcmCalls_search_img").style.display = "none"; document.getElementById("EcmCalls_assign_img").style.display = "none"; } var title_tmp = ""; if(typeof(title) == "undefined") title_tmp = call; else title_tmp = title; if(typeof(module) == "undefined" && typeof(call) != "undefined") module = "Others"; if(typeof(module) != "undefined") title_tmp = SUGAR.language.get('EcmCalls','LBL_NUMBER_OWNER_TYPE_'+module.toUpperCase()) + ": " + title_tmp; document.getElementById("EcmCallsAdditionalDetails_title").innerHTML = title_tmp; var ddd = document.getElementById("EcmCallsAdditionalDetails_description"); if(ddd.firstChild) { ddd.firstChild.style.display = 'none'; if(ddd.firstChild.parentNode_) ddd.firstChild.parentNode_.appendChild(ddd.firstChild); else document.body.appendChild(ddd.firstChild); } if(obj) { obj.style.position = 'relative'; obj.style.left = 0; obj.style.top = 0; obj.parentNode_ = obj.parentNode; ddd.appendChild(obj); obj.style.display = ''; obj.parentNode_.appendChild(div); } return div; } }