Add JS files

This commit is contained in:
2025-05-12 15:45:17 +00:00
parent 7ddd15c4fa
commit 967007b0c7
3239 changed files with 1157078 additions and 0 deletions

31
modules/EcmCalls/DoCall.js Executable file
View File

@@ -0,0 +1,31 @@
var EcmCalls_DOCALL = true;
function CALL(number) {
if(!EcmCalls_DOCALL) { EcmCalls_DOCALL = true; return true; }
YAHOO.util.Connect.asyncRequest(
'GET',
'index.php?module=EcmCalls&action=DoCall&to_pdf=1&number='+number,
{
success: function(result) {
if(result.responseText == '') return;
var iframe = document.getElementById('doCallIFrame');
if(!iframe) {
iframe = document.createElement('iframe');
iframe.id = 'doCallIFrame';
iframe.style.display = 'none';
document.body.appendChild(iframe);
}
if(iframe && result.responseText != '') {
//alert('>'+result.responseText+'<');
//document.location = result.responseText;
iframe.src = result.responseText;
}
},
failure: function () {
alert('error');
}
}
);
// if(iframe) iframe.src = 'index.php?module=EcmCalls&action=DoCall&to_pdf=1&number='+number;
}

257
modules/EcmCalls/Hint.js Executable file
View File

@@ -0,0 +1,257 @@
//Ajax Request - Begin
function doRequest(where,post,succes,fail) {
this.succes = function(result) { succes(result.responseText); }
this.fail = function(result) { fail(result.responseText); }
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.succes,failure:this.fail},post);
}
//Ajax Request - End
var lastLockedGuid = '';
function findPos(obj) {
var nleft = 0;
var ntop = 0;
if (obj.offsetParent) {
nleft = obj.offsetLeft
ntop = obj.offsetTop
while (obj = obj.offsetParent) {
nleft += obj.offsetLeft
ntop += obj.offsetTop
}
}
return [nleft,ntop];
}
function showCallHint(ev,guid,id,img,title,call,record,module,id2,chi) {
//lock_unlock_Position();
//if(lastLockedGuid == guid) return;
var div = document.getElementById('hint_div_'+guid);
if(div.lockPosition == true && div.ec_call_record == record) return;
else lock_unlock_Position();
div.ec_call_record = record;
div = ShowAdditionalDetails(title, div, call, module);
div.ec_number = call;
div.ec_record = record;
div.ec_module = module;
div.ec_id = id2;
div.ec_name = title;
div.ec_chi = chi;
if(!div.ec_number) {
document.getElementById("EcmCallsStatusPhoneIcon").style.display = "none";
} else {
document.getElementById("EcmCallsStatusPhoneIcon").style.display = "";
}
if(!div.ec_module || !div.ec_id) {
document.getElementById("EcmCalls_search_img").style.display = "none";
document.getElementById("EcmCalls_view_detail_img").style.display = "none";
} else {
document.getElementById("EcmCalls_view_detail_img").style.display = "";
document.getElementById("EcmCalls_search_img").style.display = "";
}
if(chi && chi != '') {
var chi_span = document.getElementById('EcmCallsCallHintIcon_'+chi);
if(chi_span) {
document.getElementById("EcmCallsStatusPhoneIcon").innerHTML = chi_span.innerHTML;
}
}
if(!div) return;
//if(div.parentNode !== document.body) { div.parentNode_ = div.parentNode; document.body.appendChild(div); }
div.style.display = '';
/* if(typeof(img) != "undefined") {
var position = findPos(img);
div.style.left = position[0]-div.offsetWidth;
div.style .top = position[1];
} else {
*/
ev = ev || window.event;
var x = 0; var y = 0;
if(ev.pageX || ev.pageY) {
x = ev.pageX;
y = ev.pageY;
} else {
x = ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y = ev.clientY + document.body.scrollTop - document.body.clientTop
}
var ws = getWindowVisibleSize();
var sc = getScrollXY();
var container = document.getElementById("EcmCallsAdditionalDetailsContainer");
var ofw = x-sc[0]+div.offsetWidth+5;
if(typeof(img) != "undefined" || ofw > ws[0] ) {
x = x-10-div.offsetWidth;
document.getElementById("EcmCallsAdditionalInfoTopButtons").style.cssFloat = "right";
document.getElementById("EcmCallsAdditionalInfoTopButtons").style.styleFloat = "right";
} else {
x = x+10;
document.getElementById("EcmCallsAdditionalInfoTopButtons").style.cssFloat = "left";
document.getElementById("EcmCallsAdditionalInfoTopButtons").style.styleFloat = "left";
}
var table1 = document.getElementById("EcmCallsAdditionalDetailsHeader");
var table1td = document.getElementById("EcmCallsAdditionalDetailsHeaderTD");
var table1div = document.getElementById("EcmCallsAdditionalDetailsHeaderDIV");
var table2 = document.getElementById("EcmCallsAdditionalDetailsFooter");
var table2td = document.getElementById("EcmCallsAdditionalDetailsFooterTD");
var table2div = document.getElementById("EcmCallsAdditionalDetails_description");
if((y-sc[1]+div.offsetHeight+5) > ws[1]) {
if(table1) container.appendChild(table1);
table1.className = "olFgClass";
// table1td.className = "olFgClass";
// table1div.className = "olFontClass";
table2.className = "olCgClass";
// table2td.className = "olCgClass";
// table2div.className = "olCapFontClass";
y = y + 5 - div.offsetHeight;
} else {
if(table2) container.appendChild(table2);
table2.className = "olFgClass";
// table2td.className = "olFgClass";
// table2div.className = "olFontClass";
table1.className = "olCgClass";
// table1td.className = "olCgClass";
// table1div.className = "olCapFontClass";
y = y - 5;
}
div.style.left = x;
div.style.top = y;
// var tds = div.getElementsByTagName('td');
// for(var i=0; i<tds.length; i++) tds[i].style.backgroundColor = div.style.backgroundColor;
}
function lock_unlock_Position(guid,img) {
if(lastLockedGuid != '') { var tmp = lastLockedGuid; lastLockedGuid = ''; lock_unlock_Position(tmp); }
if(typeof(guid) == "undefined") return;
var div = document.getElementById('EcmCallsAdditionalDetails');
if(div) {
var div_guid = document.getElementById('hint_div_'+guid);
if(div_guid && img) div_guid.imgNote = img;
if(typeof(div_guid.lockPosition) == "undefined") div_guid.lockPosition = false;
div_guid.lockPosition = !div_guid.lockPosition;
if(div_guid.lockPosition) {
if(typeof(div_guid.old_note) == "undefined") {
var ttt = div_guid.getElementsByTagName('textarea');
if(ttt[0])
div_guid.old_note = ttt[0].value;
lastLockedGuid = guid;
}
}
else {
hideCallHint(null,guid); lastLockedGuid = ''; div_guid.ec_call_record = '';
}
}
}
function show_hide_Position(guid,img) {
var div = document.getElementById('EcmCallsAdditionalDetails');
var div_guid = document.getElementById('hint_div_'+guid);
if(div) {
if(div.style.display == "" && div_guid.lockPosition == true) {
div.style.display = "none";
} else if(div.style.display == "none") {
div.style.display = "";
}
if(div_guid) {
if(typeof(div_guid.lockPosition) == "undefined" || div_guid.lockPosition == false) {
lock_unlock_Position(guid, img);
}
}
}
}
function hideCallHint(ev,guid,id,img) {
var div = document.getElementById('EcmCallsAdditionalDetails');
var div_guid = document.getElementById('hint_div_'+guid);
if(div && div_guid && div_guid.lockPosition != true) {
div = ShowAdditionalDetails("");
//if(div.parentNode === document.body) div.parentNode_.appendChild(div);// = div.parentNode; document.body.appendChild(div); }
div.style.display = 'none';
}
}
function saveNote(guid,id) {
var div = document.getElementById('hint_div_'+guid);
var note = div.getElementsByTagName('textarea')[0].value;
var guid = guid;
if(note != div.old_note)
doRequest(
'index.php',
'&to_pdf=1&module=EcmCalls&action=AjaxSave&record='+id+'&note='+note,
function(result) {
lock_unlock_Position();
var div = document.getElementById('hint_div_'+guid);
var cell = div.parentNode_;//.parentNode;
div.old_note = note;
if(note == '') img = "modules/EcmCalls/images/hint_grey.gif"; else img = "modules/EcmCalls/images/hint_black.gif";
if(div.imgNote) div.imgNote.src = img;
//alert(cell);
//cell.getElementsByTagName('img')[0].src = img; var img = '';
},
function(result) {}
);
else lock_unlock_Position();
}
function cancelNote(guid) {
var div = document.getElementById('hint_div_'+guid);
if(div) {
div.getElementsByTagName('textarea')[0].value = div.old_note;
lock_unlock_Position();
}
}
function getWindowVisibleSize() {
var myWidth = 0, myHeight = 0;
if( typeof( window.innerWidth ) == 'number' ) {
//Non-IE
myWidth = window.innerWidth;
myHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
myWidth = document.documentElement.clientWidth;
myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
//IE 4 compatible
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
return [ myWidth, myHeight ];
}
function getScrollXY() {
var scrOfX = 0, scrOfY = 0;
if( typeof( window.pageYOffset ) == 'number' ) {
//Netscape compliant
scrOfY = window.pageYOffset;
scrOfX = window.pageXOffset;
} else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
//DOM compliant
scrOfY = document.body.scrollTop;
scrOfX = document.body.scrollLeft;
} else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
//IE6 standards compliant mode
scrOfY = document.documentElement.scrollTop;
scrOfX = document.documentElement.scrollLeft;
}
return [ scrOfX, scrOfY ];
}

184
modules/EcmCalls/ListView.js Executable file
View File

@@ -0,0 +1,184 @@
// 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 ='<div id="" class="olBgClass" style="background-image: none;"><table class="olBgClass" width="300" border="0" cellpadding="0" style="border:none;" cellspacing="0"><tbody><tr><td><div id="EcmCallsAdditionalDetailsContainer"><table id="EcmCallsAdditionalDetailsHeader" class="olCgClass" width="100%" border="0" cellpadding="2" cellspacing="0"><tbody><tr><td id="EcmCallsAdditionalDetailsHeaderTD" class="olCgClass" width="100%" style="margin-left:2px; padding-left:2px;"><div id="EcmCallsAdditionalDetailsHeaderDIV" class="olCapFontClass">';
divi += '<div style="float: left;" id="EcmCallsAdditionalInfoTopButtons">';
divi += '<img id="EcmCalls_search_img" onClick="EcmCallsSearchRecord();" src="modules/EcmCalls/images/search.gif" border="0" style="cursor:pointer;">';
divi += '<img id="EcmCalls_assign_img" onClick="EcmCallsAssignRecord(this);" style="margin-left: 2px; cursor:pointer;" src="modules/EcmCalls/images/assign.gif" border="0">';
divi += '<img id="EcmCalls_view_detail_img" onClick="EcmCallsViewDetailRecord(this);" style="margin-left: 2px; cursor:pointer;" src="modules/EcmCalls/images/view_detail.gif" border="0">';
divi += '<span id="EcmCallsStatusPhoneIcon" style="margin-left: 2px;"><img src="include/ECM/EcmFormatPhoneNumber/images/additional_details_phone.gif" border="0" style="cursor:pointer;"></span>';
divi += '<img style="margin-left:2px;margin-right: 2px; cursor:pointer;" onClick="lock_unlock_Position();" src="modules/EcmCalls/images/close.gif" border="0" style="cursor:pointer;">';
divi += '</div>';
divi += '<div style="float:left;margin-left:2px;padding-left:2px;" id="EcmCallsAdditionalDetails_title" ></div>';
divi += '</div></td></tr></tbody></table><table id="EcmCallsAdditionalDetailsFooter" class="olFgClass" width="100%" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td id="EcmCallsAdditionalDetailsFooterTD" class="olFgClass" valign="top"><div id="EcmCallsAdditionalDetails_description" class="olFontClass"></div></td></tr></tbody></table></div></td></tr></tbody></table></div>';
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;
}
}

367
modules/EcmCalls/MyTable.js Executable file
View File

@@ -0,0 +1,367 @@
function keyPressedNumber(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
function isEnterOrTabPressed(e) {
var keynum = keyPressedNumber(e);
if(keynum == 9 || keynum == 13) return true; else return false;
}
function setSelectionRange(obj) {
if(obj && typeof(obj) == "object" && (obj.type == "text" || obj.type == "textarea")) {
if(obj.createTextRange) {
var range = obj.createTextRange();
range.moveStart("character", 0);
range.moveEnd("character", obj.value.lengh-1);
range.select();
} else {
if(obj.setSelectionRange) {
obj.setSelectionRange(0,obj.value.length);
}
}
obj.focus();
}
if(obj && typeof(obj) == "object" && obj.options) { obj.focus(); }
}
function MyTable(name) {
this.myTableName = name;
this.table = document.getElementById(this.myTableName);
this.thead = this.table.tHead;
this.tbody = this.table.tBodies.item(0);
this.cellSelectedClass = 'selectedCell';
this.rowSelectedClass = 'selectedRow';
this.selectedRow;
this.selectedCell;
this.rowCount = function() {
return this.tbody.rows.length;
}
this.colCount = function() {
return this.thead.rows.item(0).cells.length;
};
this.colWidth = function(i) {
return this.thead.rows.item(0).cells.item(i).width;
};
this.moveUpRow = function() {
if(this.selectedRow) this.selectedRow.moveUp();
};
this.moveDownRow = function() {
if(this.selectedRow) this.selectedRow.moveDown();
};
this.insertRow = function(row, newRow) {
if(!row)
if(this.rowCount())
if(typeof(row) == "number")
row = this.tbody.rows.item(row);
else
row = this.tbody.rows.item(this.tbody.rows.length-1);
var row_tmp;
if((newRow) && (row)) row_tmp = newRow; else { row_tmp = this.createRow(); this.fillWithDefaultData(row_tmp); }
if(this.rowCount() > 0 && row.nextSibling)
this.tbody.insertBefore(row_tmp, row.nextSibling);
else
this.tbody.appendChild(row_tmp);
return row_tmp;
};
this.refreshRowIndex = function() {
for(var i=0; i<this.rowCount(); i++) {
this.tbody.rows.item(i).index = i;
if(this.onRefreshRowIndex) this.onRefreshRowIndex(this.tbody.rows.item(i));
}
}
this.onRefreshRowIndex;
this.addRow = function(i,data) {
var row = this.createRow();
if(this.selectedRow) this.selectedRow.deselect();
if(this.selectedCell) this.selectedCell.deselect();
row.myTable = this;
if(i || i===0)
this.tbody.insertBefore(row,this.tbody.rows.item(i));
else
this.tbody.appendChild(row);
this.refreshRowIndex();
this.setRowData(row, data);
for(var i=0; i<this.colCount(); i++) row.cells.item(i).afterCreate();
return row;
}
this.createRow = function(row) {
var row = document.createElement('tr');
row.myTable = this;
row.isnew = false;
row.onclick = function() { this.select(); }
row.select = function() {
if(!this.myTable.selectedRow || this.myTable.selectedRow !== this) {
if(this.myTable.selectedRow) this.myTable.selectedRow.deselect();
this.myTable.selectedRow = this;
this.className = this.myTable.rowSelectedClass;
if(row.onSelect) row.onSelect();
}
}
row.deselect = function() {
if(this.myTable.selectedRow === this) {
this.className = '';
this.myTable.selectedRow = '';
if(row.onDeselect) row.onDeselect();
}
};
row.selectNext = function() {
this.deselect();
if(this.index == this.myTable.rowCount()) { this.nextSibling.select(); return this.nextSibling; }
else {
var row = this.myTable.addRow(); return row;
}
}
row.selectPrevious = function() {
this.deselect();
if(this.previousSibling && this.index > 0) { this.previousSibling.select(); return this.previousSibling; }else return this;
}
row.deleteRow = function(noNew) {
if(this.myTable.selectedCell) this.myTable.selectedCell.deselect();
if(this.myTable.selectedRow) this.myTable.selectedRow.deselect();
if(this.myTable.rowCount() == 1 && !noNew) {
var MyTaBlE = this.myTable;
setTimeout( function() { MyTaBlE.addRow(); } , 1000);
}
this.myTable.tbody.removeChild(this);
this.myTable.refreshRowIndex();
}
row.moveUp = function() {
if(!this.previousSibling) return;
this.myTable.tbody.insertBefore(this,this.previousSibling);
this.myTable.refreshRowIndex();
}
row.moveDown = function() {
if(!this.nextSibling) this.myTable.addRow(row);
this.myTable.tbody.insertBefore(this.nextSibling,this);
this.myTable.refreshRowIndex();
}
row.setData = function(data) {
if(!data || typeof(data) != "object") { return; };
for(var i=0; i<this.myTable.colCount(); i++) {
this.cells.item(i).setData(data);
}
}
row.getData = function() {
var data = new Object();
for(var i=0; i<this.myTable.colCount(); i++) {
if(this.cells.item(i).getData) this.cells.item(i).getData(data,true);
}
return data;
}
for(var i=0; i<this.colCount(); i++) {
var cell = this.createCell(i);
row.appendChild(cell);
}
if(this.onCreateRow) this.onCreateRow(row);
return row;
};
this.onCreateRow; //function(row) {}
this.createCell = function(i) {
var cell = document.createElement('td');
cell.index = i;
cell.myTable = this;
cell.onclick = function() { this.select(); }
cell.select = function() {
if(!this.myTable.selectedCell || this.myTable.selectedCell !== this) {
if(this.myTable.selectedCell) this.myTable.selectedCell.deselect();
this.myTable.selectedCell = this;
if(this.firstChild.focus && !this.noSelect) setSelectionRange(this.firstChild);
if(this.onSelect) this.onSelect();
this.className = this.myTable.cellSelectedClass;
}
}
cell.deselect = function() {
if(this.myTable.selectedCell === this) {
if(cell.onDeselect) cell.onDeselect();
this.className = '';
this.selected = false;
this.myTable.selectedCell = '';
}
};
cell.selectNext = function() {
this.deselect();
if(this.nextSibling) this.nextSibling.select();
else {
if(!this.parentNode.nextSibling) this.myTable.addRow();
this.parentNode.nextSibling.select();
this.parentNode.nextSibling.firstChild.select();
}
}
cell.afterCreate = function() {}
cell.setData = function(data) {}
cell.getData = function(data) {}
if(this.onCreateCell) this.onCreateCell(cell);
return cell;
};
this.onCreateCell; //function(cell) {}
this.setRowData = function(row,data) {
for(var i=0; i<this.colCount(); i++) {
this.setCellData(row,row.cells.item(i),data);
}
}
this.setCellData = function(row,cell,data) {
if(typeof(row) == "number")
if(this.tbody.rows.item(row)) row = this.tbody.rows.item(row);
if(typeof(cell) != "object")
if(typeof(cell) == "number" && typeof(row) == "object") {
if(row.cells.item(cell))
cell = row.cells.item(cell);
else return;
}
else return;
if(this.onSetCellData) this.onSetCellData(row,cell,data);
}
this.onSetCellData; //function(row,cell,data) {}
this.selectRow = function(row) {
if(this.selectedRow === row) return;
if(this.selectedRow) this.deselectRow();
this.selectedRow = row;
this.selectedRow.className = this.rowSelectedClass;
this.setEditNames(this.selectedRow,!this.selectedRow.isnew);
}
this.selectNextRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.nextSibling) this.insertRow();
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.nextSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.selectPreviousRow = function() {
if(!this.selectedRow) return;
if(!this.selectedRow.previousSibling) return;
if(this.selectedRow === this.tbody.rows.item(0)) return;
var cell_id = this.selectedCell.lp;
this.selectRow(this.selectedRow.previousSibling);
this.selectCell(this.selectedRow.cells.item(cell_id));
}
this.refreshNumeration = function() {
for(var i=0; i<this.tbody.rows.length; i++)
this.tbody.rows.item(i).cells.item(0).firstChild.value = i+1;
}
this.KeyPressedNumber = function(e) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
return keynum;
}
this.KeyPressed = function(e, cell, method) {
var keynum;
if(window.event) //IE
keynum = e.keyCode;
else
keynum = e.which;
if((keynum == 9) || (keynum == 13)) {
cell.selectNext();
return false;
}
if(keynum == 40) { var id = cell.index; var row = cell.parentNode.selectNext(); if(row) { row.select(); row.cells.item(id).select(); } }
if(keynum == 38) { var id = cell.index; var row = cell.parentNode.selectPrevious(); if(row) { row.select(); row.cells.item(id).select(); } }
if(e.shiftKey && (method == "decimalNumber" || method == "onlyNumber")) return false;
if(method == "decimalNumber") return this.OnlyNumbers(keynum);
if(method == "onlyNumber") return this.OnlyNumbers(keynum, true);
return true;
}
this.OnlyNumbers = function(e, noQuote) { var keynum = e, keychar, numcheck;
keychar = String.fromCharCode(keynum);
numcheck = /\d/;
return numcheck.test(keychar) || ((!noQuote)?(keynum == 190):false)
|| (keynum == 8) //backspace
|| (keynum == 46) //delete
|| (keynum == 13) //enter || (keynum == 0) //special keys with FF
|| (keynum == 37) //left arrow
|| (keynum == 39) //right arrow
|| (keynum == 188); //,
}
this.row = function(i) { if(this.tbody.rows.item(i)) return this.tbody.rows.item(i); }
this.cells = function(i,j) { if(this.tbody.rows.item(i).cells.item(i)) return this.tbody.rows.item(i).cells.item(i); }
}

186
modules/EcmCalls/Settings.js Executable file
View File

@@ -0,0 +1,186 @@
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function changeValidateRequired(formname,name,required) {
for(var i=0; i<validate[formname].length; i++)
if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
//function set_focus() { document.getElementById('name').focus(); }
function my_popup(module, field_array, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 600, 400, "", true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
var tbody_;
var ItemListSave;
var ItemListClear;
var ItemListFil;
addEvent(
window,
'load',
function() {
var phonesTable = new MyTable('phonesTable');
phonesTable.onRefreshRowIndex = function(row) {
var data = new Object();
data['index'] = (row.index+1).toString();
row.cells.item(0).setData(data);
}
phonesTable.onCreateRow = function(row) {
row.newPos = false;
row.ondblclick = function() {}
row.onSelect = function() {
for(var i=0; i<this.myTable.colCount(); i++)
this.cells.item(i).change(!this.newPos);
}
row.onDeselect = function() {
for(var i=0; i<this.myTable.colCount(); i++)
this.cells.item(i).change(false);
}
}
phonesTable.onCreateCell = function(cell) {
var i = cell.index;
cell.change = function(select) {};
if(i == 0) {
cell.setData = function(data) {
if(data.index) cell.firstChild.value = data.index;
};
cell.getData = function(data) {
data.index = cell.firstChild.value;
}
cell.select = function() { this.selectNext(); }
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('readOnly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if(i == 1) {
cell.change = function(select) {}
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.phone = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.phone) cn[0].value = data.phone;
}
var edit = '<input type="text" onFocus="this.parentNode.select();" tabindex="1" class="inputs" style="height:16px;" autocomplete="off" onKeyDown="return this.parentNode.myTable.KeyPressed(event,this.parentNode);">';
cell.innerHTML = edit;
}
if(i == 2) {
cell.change = function(select) {}
cell.selectNext = function() { this.nextSibling.selectNext(); }
cell.getData = function(data) {
var cn = this.getElementsByTagName('input');
data.note = cn[0].value;
}
cell.setData = function(data) {
var cn = this.getElementsByTagName('input');
if(data.note) cn[0].value = data.note;
}
var edit = '<input type="text" onFocus="this.parentNode.select();" tabindex="1" class="inputs" style="height:16px;" autocomplete="off" onKeyDown="return this.parentNode.myTable.KeyPressed(event,this.parentNode);">';
cell.innerHTML = edit;
}
if(i == 3) {
var img;
//insert
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_INSERT_NEW_ROW']);
img.setAttribute('src','modules/EcmCalls/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.myTable.addRow(this.parentNode.parentNode.index+1);
};
//delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_DELETE_ROW']);
img.setAttribute('src','modules/EcmCalls/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.deleteRow(); };
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
//move up
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_UP']);
img.setAttribute('src','modules/EcmCalls/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveUp(); };
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
//move down
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_DOWN']);
img.setAttribute('src','modules/EcmCalls/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveDown(); }
cell.appendChild(img);
}
}
phonesTable.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
ItemListSave = function(json) {
var data = new Object();
var tmp;
for(var i=0; i<phonesTable.rowCount(); i++) {
var tmp_data = phonesTable.row(i).getData();
if(tmp_data['phone'] != '' && tmp_data['note'] != '') data[i.toString()] = tmp_data;
}
var r = json ? JSON.stringifyNoSecurity(data) : data;
document.getElementById('phone_list').value = r;
}
ItemListClear = function(noNew) {
while(phonesTable.rowCount()>0) phonesTable.row(0).deleteRow(noNew);
}
ItemListFill = function() {
var pl = document.getElementById('phone_list').value;
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) if(typeof(pl[x]) == "object") { var pl_row = pl[x]; phonesTable.addRow().setData(pl_row); }
} catch(err) { pl = null; };
}
if(phonesTable.rowCount() == 0) phonesTable.addRow();
}
ItemListFill();
}
);

104
modules/EcmCalls/SubPanel.js Executable file
View File

@@ -0,0 +1,104 @@
//my standard functions - begin
function doRequest(where,post,success,fail) {
this.Display = function(result) { success(result.responseText); }
this.Fail = function(result){ if(typeof(fail) != "undefined") { if(typeof(fail) == "string") alert(fail); else fail(result.responseText); } }
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
//my standard functions - end
var EcmCallsPage = 0;
var EcmCallsRowLook = new Object()
var EcmCallsColors = new Object();
function loadEcmCalls(page) {
var b = findSubpanel('subpanel_ecmcalls');
if(b) {
doRequest(
'index.php',
'module=EcmCalls&action=SubPanel&to_pdf=1&page='+page+'&searchModule='+document.forms.DetailView.module.value+'&searchRecord='+document.forms.DetailView.record.value,
function(result) {
b.slotCount = 0;
var arr = eval(result);
if(arr[0]) {
arr = arr[0];
EcmCallsColors = arr['colors'];
for(x in arr['positions']) addEcmCall(b,arr['positions'][x]);
}
b.slotCount = 0;
}
);
}
}
function addEcmCall(body_,ecmcall) {
var tr = document.createElement('tr');
tr.height = "20";
tr.scope = "row";
tr.onmouseover = function() { setPointer(this, '', 'over', EcmCallsColors['even_bg'], EcmCallsColors['hilite_bg'] , ''); }
tr.onmouseout = function() { setPointer(this, '', 'out', EcmCallsColors['even_bg'], EcmCallsColors['hilite_bg'] , ''); }
for(x in EcmCallsRowLook) {
var td = document.createElement('td');
td.className = ((body_.slotCount%2) ? 'oddListRowS1' : 'evenListRowS1');
td.bgcolor = EcmCallsColors['odd_bg'];
td.valign = "top";
td.noWrap = "noWrap";
var span = document.createElement('span');
span.sugar = "slot"+(body_.slotCount++)+"b";
span.innerHTML = ecmcall[x];
td.appendChild(span);
tr.appendChild(td);
}
body_.appendChild(tr);
var tr = document.createElement('tr');
var td = document.createElement('td');
td.colSpan = 20;
td.className = 'listViewHRS1';
tr.appendChild(td);
body_.appendChild(tr);
}
function findSubpanel(name) {
var div = document.getElementById(name);
if(div) {
var table = div.getElementsByTagName('table');
if(table && table[0]) {
var body_ = table[0].getElementsByTagName('tbody');
if(body_) {
return body_[0];
}
}
}
return null;
}
addEvent(
window,
'load',
function(result) {
/*
var tmp = document.getElementById('EcmCallsSubPanelDefs');
var spd = eval(tmp.value);
if(spd && spd[0]) spd = spd[0];
EcmCallsRowLook = spd;
*/
showSubPanel('ecmcalls','/index.php?module=EcmCalls&spModule='+document.forms.DetailView.module.value+'&record='+document.forms.DetailView.record.value+'&'+document.forms.DetailView.module.value+'_CELL_offset=0&to_pdf=true&action=SubPanelViewerMy&subpanel=ecmcalls&EcmCalls_CELL_offset=0&EcmCalls_CELL_ORDER_BY=&sort_order=desc&to_pdf=true',true);
//loadEcmCalls();
}
);

View File

@@ -0,0 +1 @@
// JavaScript Document

164
modules/EcmCalls/formloader.js Executable file
View File

@@ -0,0 +1,164 @@
function doRequest(where,post,doFunction,error) {
this.Display = function(result) { doFunction(result.responseText); }
this.Fail = function(result){ if(error) alert(error);}
YAHOO.util.Connect.asyncRequest('POST',where,{success:this.Display,failure:this.Fail},post);
}
function changeValidateRequired(formname,name,required) {
for(var i=0; i<validate[formname].length; i++)
if(validate[formname][i][0] == name) { validate[formname][i][2] = required; break; }
}
function my_popup(module, field_array, call_back_function, form_name) {
if(!call_back_function) call_back_function = "set_return";
if(!form_name) form_name = "EditView";
return open_popup(module, 600, 400, "", true, false, {"call_back_function":call_back_function,"form_name":form_name,"field_to_name_array":field_array});
}
function addEvent(object,eventName,do_function) {
if(typeof(object) == "string") object = document.getElementById(object);
if(!object) { alert('No object in function addEvent!'); return; }
if(object.addEventListener) {
object.addEventListener(eventName, do_function, false);
} else {
object.attachEvent('on'+eventName, do_function);
}
}
function FormLoader() {
this.module;
this.createModule;
this.fieldName;
this.buttonName = 'FormLoaderButton';
this.load = function(module,createModule,fieldName) {
this.module = module;
this.createModule = createModule;
this.fieldName = fieldName;
}
this.createButton = function() {
var b = document.createElement('input');
b.type = 'button';
b.className = 'button';
b.name = this.buttonName;
b.value = 'Create';
b.FL = this;
b.onclick = function() {
if(this.FL.createModule == '') return;
if(this.FL.onButtonClick) var data = this.FL.onButtonClick();
window.open("index.php?module="+this.FL.module+"&action=formloader&to_pdf=1&loaderAction=ViewForm&loaderFieldName="+this.FL.fieldName+"&createModule="+this.FL.createModule+(data?data:''),"Create10"+this.FL.module,"resizable=yes,scrollbars=no,status=no,height=540,width=700").focus();
}
return b;
}
this.setEditDblClick = function(edit) { edit.FL=this; edit.ondblclick=this.editDblClick; }
this.editDblClick = function() {
if(this.FL.createModule == '') return;
if(this.FL.onEditDblClick) var data = this.FL.onEditDblClick();
window.open("index.php?module="+this.FL.module+"&action=formloader&to_pdf=1&loaderAction=ViewForm&loaderFieldName="+this.FL.fieldName+"&createModule="+this.FL.createModule+(data?data:''),"Create10"+this.FL.module,"resizable=yes,scrollbars=no,status=no,height=540,width=700").focus();
}
this.responseData = function(data) {
if(this.onResponseData) this.onResponseData(data);
}
this.onResponseData;
this.addPostData = function() {
if(this.onAddPostData)
return this.onAddPostData();
else
return '';
}
this.onAddPostData;
this.onButtonClick;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long