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

View File

@@ -0,0 +1,98 @@
/*********************************************************************************
* SugarCRM is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2010 SugarCRM Inc.
*
* 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
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* 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. If the display of the logo is not reasonably feasible for
* technical reasons, the Appropriate Legal Notices must display the words
* "Powered by SugarCRM".
********************************************************************************/
$(function() {
if (OPT.IamPopup)
$("#header").hide();
$(".loading_panel").css("display", "none");
});
function open_contact_popup(module_name,width,height,initial_filter,close_popup,hide_clear_button,popup_request_data,popup_mode,create,metadata)
{window.document.popup_request_data=popup_request_data;window.document.close_popup=close_popup;URL='index.php?mode=MultiSelect&'
+'module='+module_name
+'&action=ContactAddressPopup';if(initial_filter!='')
{URL+='&query=true'+initial_filter;}
if(hide_clear_button)
{URL+='&hide_clear_button=true';}
windowName='popup_window';windowFeatures='width='+width
+',height='+height
+',resizable=1,scrollbars=1';if(popup_mode==''&&popup_mode=='undefined'){popup_mode='single';}
URL+='&mode='+popup_mode;if(create==''&&create=='undefined'){create='false';}
URL+='&create='+create;if(metadata!=''&&metadata!='undefined'){URL+='&metadata='+metadata;}
win=window.open(URL,windowName,windowFeatures);if(window.focus)
{win.focus();}
return win;}
function set_focus(){document.getElementById('name').focus();}
var p_check_form = check_form;
check_form_ = function(formname) {
console.log('tu?');
if (!p_check_form("EditView"))
return false;
//add mz 2015-04-17
//zapis ajaxowo i obsługa popup
var formData = new FormData($("#EditView")[0]);
console.log(formData);
$(".loading_panel").css("display", "block");
$.ajax({
type: "POST",
url: "index.php?module=Accounts&action=Save&to_pdf=1",
data: formData,
success: function(data) {
console.log(data);
if (OPT.IamPopup) {
if(data==1){
alert("Istnieje już kontrahent o podanym nipie!");
$('.loading_panel').hide();
} else {
parent_id.value = data;
window.close();
}
} else {
if(data==1){
window.location.replace("index.php?module=Accounts&action=ShowDuplicates");
} else {
window.location.replace("index.php?module=Accounts&action=DetailView&record="+data);
}
}
},
processData : false,
contentType : false,
});
return false;
}

View File

@@ -0,0 +1,318 @@
//addresses
function saveItems() {
document.getElementById('position_list').value = ItemsList(true);
}
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 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;
var FillText;
addEvent(
window,
'load',
function () {
var paramsTable = new paramsMT('itemsTable');
paramsTable.onCreateRow = function (row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function () {
}
row.onSelect = function () {
//for(var i=0; i<this.myTable.colCount(); i++)
//this.cells.item(i).change(!this.newPos);
//this.cells.item(0).change(true);
}
row.onDeselect = function () {
}
}
paramsTable.onCreateCell = function (cell) {
var i = cell.index;
cell.change = function (select) {
};
if (i == 0) {
cell.setData = function (data) {
if (data.position)
cell.firstChild.value = data.position;
if (data.id)
cell.getElementsByTagName('input')[1].value = data.id;
};
cell.getData = function (data) {
data.position = cell.firstChild.value;
data.id = cell.getElementsByTagName('input')[1].value;
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('readonly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type', 'hidden');
edit.setAttribute('readonly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 1) {
cell.setData = function (data) {
if (data.name) {
cell.firstChild.value = data.name;
}
};
cell.getData = function (data) {
data.name = cell.firstChild.value;
}
cell.onDeselect = function () {
ERROR = false;
var data = new Object();
this.getData(data);
if (!ERROR) {
data.name = data.name;
this.setData(data);
}
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 2) {
cell.setData = function (data) {
if (data.street)
cell.getElementsByTagName('input')[0].value = data.street;
};
cell.getData = function (data) {
data.street = cell.firstChild.value;
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 3) {
cell.setData = function (data) {
if (data.city)
cell.firstChild.value = data.city;
};
cell.getData = function (data) {
data.city = cell.firstChild.value;
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 4) {
cell.setData = function (data) {
if (data.postalcode)
cell.firstChild.value = data.postalcode;
};
cell.getData = function (data) {
data.postalcode = cell.firstChild.value;
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 5) {
cell.setData = function (data) {
if (data.country)
cell.firstChild.value = data.country;
};
cell.getData = function (data) {
data.country = cell.firstChild.value;
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 6) {
cell.setData = function (data) {
if (data.phone)
cell.firstChild.value = data.phone;
};
cell.getData = function (data) {
data.phone = cell.firstChild.value;
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 7) {
cell.setData = function (data) {
if (data.fax)
cell.firstChild.value = data.fax;
};
cell.getData = function (data) {
data.fax = cell.firstChild.value;
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 8) {
var img;
cell.style.padding = "auto auto auto auto";
//insert
img = document.createElement('img');
img.setAttribute('alt', MOD['LBL_INSERT_NEW_ROW']);
img.setAttribute('src', 'modules/EcmQuotes/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.myTable.addRow(this.parentNode.parentNode.index + 1);
refreshPositionIndex();
};
//delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt', MOD['LBL_DELETE_ROW']);
img.setAttribute('src', 'modules/EcmQuotes/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.parentNode.deleteRow();
refreshPositionIndex();
};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
cell.appendChild(document.createElement('br'));
//move up
img = document.createElement('img');
img.setAttribute('alt', MOD['LBL_MOVE_ROW_UP']);
img.setAttribute('src', 'modules/EcmQuotes/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.parentNode.moveUp();
refreshPositionIndex();
};
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/EcmQuotes/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.parentNode.moveDown();
refreshPositionIndex();
}
cell.appendChild(img);
}
}
refreshPositionIndex = function () {
for (var i = 0; i < paramsTable.rowCount(); i++) {
var data = paramsTable.row(i).getData();
data.position = i + 1;
paramsTable.row(i).setData(data);
}
}
ItemsList = function (json) {
var data = '';
for (var i = 0; i < paramsTable.rowCount(); i++) {
data = data + '||||' + JSON.stringifyNoSecurity(paramsTable.row(i).getData());
}
return data;
}
if (paramsTable.rowCount() == 0) {
paramsTable.addRow();
refreshPositionIndex();
}
;
paramsTable.onSetCellData = function (row, cell, data) {
if (cell.innerHTML == '')
cell.innerHTML = '&nbsp;';
}
ItemListSave = function (json, el) {
var data = new Object();
var tmp;
for (var i = 0; i < paramsTable.rowCount(); i++) {
data[i.toString()] = paramsTable.row(i).getData();
}
paramsOptions = data;
var r = JSON.stringifyNoSecurity(paramsOptions);
doRequest(
'index.php',
'module=Accounts&action=price_conditionSave&to_pdf=1&paramslist=' + r + '&record=' + document.forms.EditView.record.value,
function (result) {
if (result.indexOf("Saved") >= 0)
alert("Zapisano!");
else
alert("Błąd podczas zapisywania!");
}
);
}
ItemListClear = function (noNew, save) {
if (typeof (save) == "string")
ItemListSave(null, save);
while (paramsTable.rowCount() > 0)
paramsTable.row(0).deleteRow(noNew);
refreshPositionIndex();
}
ItemListFill = function () {
var pl;
pl = document.getElementById('position_list').value;
if (pl && pl != '') {
try {
pl = eval(pl);
for (x in pl) {
var pl_row = pl[x];
if (pl_row.template == '')
continue;
paramsTable.addRow().setData(pl_row);
}
} catch (err) {
pl = null;
}
;
}
refreshPositionIndex();
}
ItemListClear();
ItemListFill();
}
);

248
modules/Accounts/Banks.js Normal file
View File

@@ -0,0 +1,248 @@
//addresses
function saveItems4() {
document.getElementById('position_list4').value = ItemsList4(true);
}
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 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 ItemListSave4;
var ItemListClear4;
var ItemListFill4;
var FillText;
addEvent(
window,
'load',
function () {
var paramsTable4 = new paramsMT('itemsTable4');
paramsTable4.onCreateRow = function (row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function () {
}
row.onSelect = function () {
//for(var i=0; i<this.myTable.colCount(); i++)
//this.cells.item(i).change(!this.newPos);
//this.cells.item(0).change(true);
}
row.onDeselect = function () {
}
}
paramsTable4.onCreateCell = function (cell) {
var i = cell.index;
cell.change = function (select) {
};
if (i == 0) {
cell.setData = function (data) {
if (data.position)
cell.firstChild.value = data.position;
if (data.id)
cell.getElementsByTagName('input')[1].value = data.id;
};
cell.getData = function (data) {
data.position = cell.firstChild.value;
data.id = cell.getElementsByTagName('input')[1].value;
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('readonly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type', 'hidden');
edit.setAttribute('readonly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 1) {
cell.setData = function (data) {
if (data.name) {
cell.firstChild.value = data.name;
}
};
cell.getData = function (data) {
data.name = cell.firstChild.value;
}
cell.onDeselect = function () {
ERROR = false;
var data = new Object();
this.getData(data);
if (!ERROR) {
data.name = data.name;
this.setData(data);
}
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 2) {
cell.setData = function (data) {
if (data.account)
cell.getElementsByTagName('input')[0].value = data.account;
};
cell.getData = function (data) {
data.account = cell.firstChild.value;
}
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
}
if (i == 3) {
var img;
cell.style.padding = "auto auto auto auto";
//insert
img = document.createElement('img');
img.setAttribute('alt', MOD['LBL_INSERT_NEW_ROW']);
img.setAttribute('src', 'modules/EcmQuotes/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.myTable.addRow(this.parentNode.parentNode.index + 1);
refreshPositionIndex4();
};
//delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt', MOD['LBL_DELETE_ROW']);
img.setAttribute('src', 'modules/EcmQuotes/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.parentNode.deleteRow();
refreshPositionIndex4();
};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
cell.appendChild(document.createElement('br'));
//move up
img = document.createElement('img');
img.setAttribute('alt', MOD['LBL_MOVE_ROW_UP']);
img.setAttribute('src', 'modules/EcmQuotes/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.parentNode.moveUp();
refreshPositionIndex4();
};
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/EcmQuotes/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function () {
this.parentNode.parentNode.moveDown();
refreshPositionIndex4();
}
cell.appendChild(img);
}
}
refreshPositionIndex4 = function () {
for (var i = 0; i < paramsTable4.rowCount(); i++) {
var data = paramsTable4.row(i).getData();
data.position = i + 1;
paramsTable4.row(i).setData(data);
}
}
ItemsList4 = function (json) {
var data = '';
for (var i = 0; i < paramsTable4.rowCount(); i++) {
data = data + '||||' + JSON.stringifyNoSecurity(paramsTable4.row(i).getData());
}
return data;
}
if (paramsTable4.rowCount() == 0) {
paramsTable4.addRow();
refreshPositionIndex4();
}
;
paramsTable4.onSetCellData = function (row, cell, data) {
if (cell.innerHTML == '')
cell.innerHTML = '&nbsp;';
}
ItemListSave4 = function (json, el) {
var data = new Object();
var tmp;
for (var i = 0; i < paramsTable4.rowCount(); i++) {
data[i.toString()] = paramsTable4.row(i).getData();
}
paramsOptions = data;
var r = JSON.stringifyNoSecurity(paramsOptions);
doRequest(
'index.php',
'module=Accounts&action=price_conditionSave&to_pdf=1&paramslist=' + r + '&record=' + document.forms.EditView.record.value,
function (result) {
if (result.indexOf("Saved") >= 0)
alert("Zapisano!");
else
alert("Błąd podczas zapisywania!");
}
);
}
ItemListClear4 = function (noNew, save) {
if (typeof (save) == "string")
ItemListSave4(null, save);
while (paramsTable4.rowCount() > 0)
paramsTable4.row(0).deleteRow(noNew);
refreshPositionIndex4();
}
ItemListFill4 = function () {
var pl;
pl = document.getElementById('position_list4').value;
if (pl && pl != '') {
try {
pl = eval(pl);
for (x in pl) {
var pl_row = pl[x];
if (pl_row.template == '')
continue;
paramsTable4.addRow().setData(pl_row);
}
} catch (err) {
pl = null;
}
;
}
refreshPositionIndex4();
}
ItemListClear4();
ItemListFill4();
}
);

View File

@@ -0,0 +1,192 @@
//categories
function saveItems3(){
document.getElementById('position_list3').value = ItemsList3(true);
}
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 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 ItemListSave3;
var ItemListClear3;
var ItemListFil3;
var FillText;
addEvent(
window,
'load',
function() {
var paramsTable3 = new paramsMT('itemsTable3');
paramsTable3.onCreateRow = function(row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function() {}
row.onSelect = function() {
}
row.onDeselect = function() {
}
}
paramsTable3.onCreateCell = function(cell) {
var i = cell.index;
if(i == 0) {
cell.setData = function(data) {
console.log(data);
if(data.ecmaccountcategory_name) {
cell.firstChild.value = data.ecmaccountcategory_name;
cell.getElementsByTagName('input')[1].value = data.ecmaccountcategory_id;
if (data.id)
cell.getElementsByTagName('input')[2].value = data.id;
}
};
cell.getData = function(data) {
data.ecmaccountcategory_name = cell.firstChild.value;
data.ecmaccountcategory_id = cell.getElementsByTagName('input')[1].value;
data.id = cell.getElementsByTagName('input')[2].value;
}
cell.onSelect = function() {
var cn = this.getElementsByTagName('input');
cn[0].name = 'name_p';
cn[0].id = 'name_p';
cn[1].name = 'id_p';
cn[1].id = 'id_p';
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if(!ERROR) {
data.product_group = data.product_group;
this.setData(data);
}
var cn = this.getElementsByTagName('input');
cn[0].name = '';
cn[0].id = '';
cn[1].name = '';
cn[1].id = '';
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_IMG_SEARCH']);
img.setAttribute('src','modules/EcmQuotes/images/search.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
var ecmpopup = open_popup( "EcmAccountCategories", 600, 400, "", true, false, {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"id_p","name":"name_p"}}, "single", true );
setTimeout(function(){ecmpopup.focus();},200);
}
cell.appendChild(img);
}
if(i == 1) {
var img;
cell.style.padding="auto auto auto auto";
//insert
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_INSERT_NEW_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.myTable.addRow(this.parentNode.parentNode.index+1);
refreshPositionIndex();
};
//delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_DELETE_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.deleteRow(); refreshPositionIndex();};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
cell.appendChild(document.createElement('br'));
//move up
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_UP']);
img.setAttribute('src','modules/EcmQuotes/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveUp(); refreshPositionIndex();};
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/EcmQuotes/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveDown();refreshPositionIndex(); }
cell.appendChild(img);
}
}
ItemsList3 = function(json) {
var data = '';
for(var i=0; i<paramsTable3.rowCount(); i++) {
data = data + '||||' + JSON.stringifyNoSecurity(paramsTable3.row(i).getData());
}
return data;
}
if(paramsTable3.rowCount() == 0) {paramsTable3.addRow();};
paramsTable3.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
ItemListFill3 = function() {
var pl;
pl = document.getElementById('position_list3').value;
console.log(pl);
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) { var pl_row = pl[x]; if (pl_row.template=='') continue; paramsTable3.addRow().setData(pl_row); }
} catch(err) { pl = null; };
}
}
ItemListClear3 = function(noNew,save) {
if(typeof(save)=="string") ItemListSave(null,save);
while(paramsTable3.rowCount()>0) paramsTable3.row(0).deleteRow(noNew);
}
ItemListClear3();
ItemListFill3();
}
);

View File

@@ -0,0 +1,224 @@
//addresses
function saveItems2(){
document.getElementById('position_list2').value = ItemsList2(true);
}
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 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 ItemListSave2;
var ItemListClear2;
var ItemListFil2;
var FillText;
addEvent(
window,
'load',
function() {
var paramsTable2 = new paramsMT('itemsTable2');
paramsTable2.onCreateRow = function(row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function() {}
row.onSelect = function() {
}
row.onDeselect = function() {
}
}
paramsTable2.onCreateCell = function(cell) {
var i = cell.index;
cell.change = function(select) {};
if(i == 0) {
cell.setData = function(data) {
console.log(data);
if(data.ecmproductcategory_name) {
cell.firstChild.value = data.ecmproductcategory_name;
cell.getElementsByTagName('input')[1].value = data.ecmproductcategory_id;
if (data.id)
cell.getElementsByTagName('input')[2].value = data.id;
}
};
cell.getData = function(data) {
data.ecmproductcategory_name = cell.firstChild.value;
data.ecmproductcategory_id = cell.getElementsByTagName('input')[1].value;
data.id = cell.getElementsByTagName('input')[2].value;
}
cell.onSelect = function() {
var cn = this.getElementsByTagName('input');
cn[0].name = 'name_p';
cn[0].id = 'name_p';
cn[1].name = 'id_p';
cn[1].id = 'id_p';
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if(!ERROR) {
data.product_group = data.product_group;
this.setData(data);
}
var cn = this.getElementsByTagName('input');
cn[0].name = '';
cn[0].id = '';
cn[1].name = '';
cn[1].id = '';
}
//cell.select = function() { this.selectNext(); }
//cell.selectNext = function() { var row = this.parentNode.selectNext(); row.select(); row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type','hidden');
edit.setAttribute('readonly','readonly');
edit.setAttribute('tabIndex',1);
edit.className = 'inputs';
cell.appendChild(edit);
var img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_IMG_SEARCH']);
img.setAttribute('src','modules/EcmQuotes/images/search.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
var ecmpopup = open_popup( "EcmProductCategories", 600, 400, "", true, false, {"call_back_function":"set_return","form_name":"EditView","field_to_name_array":{"id":"id_p","name":"name_p"}}, "single", true );
setTimeout(function(){ecmpopup.focus();},200);
}
cell.appendChild(img);
}
if(i == 1) {
cell.setData = function(data) {
if (data.discount)
cell.getElementsByTagName('input')[0].value = FormatNumber(data.discount);
};
cell.getData = function(data) {
data.discount = UnformatNumber(cell.firstChild.value);
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if(!ERROR) {
data.discount = data.discount;
this.setData(data);
}
}
cell.onDeselect = function() {
}
var edit = document.createElement('input');
edit.setAttribute('type','text');
edit.setAttribute('tabIndex',1);
edit.setAttribute('onChange','$(this).val(FormatNumber($(this).val(),2));');
edit.className = 'inputs';
edit.value = NumberToUserFormatNumber(0);
cell.appendChild(edit);
}
if(i == 2) {
var img;
cell.style.padding="auto auto auto auto";
//insert
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_INSERT_NEW_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.myTable.addRow(this.parentNode.parentNode.index+1);
refreshPositionIndex();
};
//delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_DELETE_ROW']);
img.setAttribute('src','modules/EcmQuotes/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.deleteRow(); refreshPositionIndex();};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
cell.appendChild(document.createElement('br'));
//move up
img = document.createElement('img');
img.setAttribute('alt',MOD['LBL_MOVE_ROW_UP']);
img.setAttribute('src','modules/EcmQuotes/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveUp(); refreshPositionIndex();};
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/EcmQuotes/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function() { this.parentNode.parentNode.moveDown();refreshPositionIndex(); }
cell.appendChild(img);
}
}
ItemsList2 = function(json) {
var data = '';
for(var i=0; i<paramsTable2.rowCount(); i++) {
data = data + '||||' + JSON.stringifyNoSecurity(paramsTable2.row(i).getData());
}
return data;
}
if(paramsTable2.rowCount() == 0) {paramsTable2.addRow();};
paramsTable2.onSetCellData = function(row,cell,data) {
if(cell.innerHTML == '') cell.innerHTML = '&nbsp;';
}
ItemListFill2 = function() {
var pl;
pl = document.getElementById('position_list2').value;
console.log(pl);
if(pl && pl != '') {
try {
pl = eval(pl);
for(x in pl) { var pl_row = pl[x]; if (pl_row.template=='') continue; paramsTable2.addRow().setData(pl_row); }
} catch(err) { pl = null; };
}
}
ItemListClear2 = function(noNew,save) {
if(typeof(save)=="string") ItemListSave(null,save);
while(paramsTable2.rowCount()>0) paramsTable2.row(0).deleteRow(noNew);
}
ItemListClear2();
ItemListFill2();
}
);

View File

@@ -0,0 +1,322 @@
//addresses
function saveItems55() {
document.getElementById('position_list55').value = ItemsList55(true);
}
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 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 ItemListSave2;
var ItemListClear2;
var ItemListFil2;
var FillText;
addEvent(
window,
'load',
function() {
var paramsTable2 = new paramsMT('itemsTable55');
paramsTable2.onCreateRow = function(row) {
row.newPos = false;
row.noAddNew = true;
row.ondblclick = function() {
}
row.onSelect = function() {
}
row.onDeselect = function() {
}
}
paramsTable2.onCreateCell = function(cell) {
var i = cell.index;
cell.change = function(select) {
};
if (i == 0) {
cell.setData = function(data) {
console.log(data);
if(data.product_group) {
cell.firstChild.value = data.product_group;
cell.getElementsByTagName('input')[1].value = data.cat_id;
if (data.id)
cell.getElementsByTagName('input')[2].value = data.id;
}
};
cell.getData = function(data) {
data.product_group = cell.firstChild.value;
data.cat_id = cell.getElementsByTagName('input')[1].value;
data.id = cell.getElementsByTagName('input')[2].value;
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if (!ERROR) {
this.setData(data);
}
var cn = this.getElementsByTagName('input');
cn[0].name = '';
cn[0].id = '';
cn[1].name = '';
cn[1].id = '';
}
cell.onSelect = function() {
var cn = this.getElementsByTagName('input');
cn[0].name = 'name_mailinggroup';
cn[0].id = 'name_mailinggroup';
cn[1].name = 'id_mailinggroup';
cn[1].id = 'id_mailinggroup';
}
// cell.select = function() { this.selectNext(); }
// cell.selectNext = function() { var row =
// this.parentNode.selectNext(); row.select();
// row.cells.item(i).select(); };
var edit = document.createElement('input');
edit.setAttribute('type', 'text');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type', 'hidden');
edit.setAttribute('readonly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
var edit = document.createElement('input');
edit.setAttribute('type', 'hidden');
edit.setAttribute('readonly', 'readonly');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
cell.appendChild(edit);
var img = document.createElement('img');
img.setAttribute('alt', 'Search');
img.setAttribute('src',
'modules/EcmQuotes/images/search.gif');
img.style.cursor = 'pointer';
if(module_sugar_grp1=='Accounts'){
var formType='Accounts';
}
if(module_sugar_grp1=='Leads'){
var formType='Accounts';
}
if(module_sugar_grp1=='Contacts'){
var formType='Contacts';
}
if(module_sugar_grp1=='ContactLeads'){
var formType='Contacts';
}
img.onclick = function() {
var ecmpopup = open_popup("EcmMailingCategories", 600,
400, "&type_advanced="+formType, true, false, {
"call_back_function" : "set_return",
"form_name" : "EditView",
"field_to_name_array" : {
"id" : "id_mailinggroup",
"name" : "name_mailinggroup"
}
}, "single", true);
setTimeout(function() {
ecmpopup.focus();
}, 200);
}
cell.appendChild(img);
}
if (i == 1) {
cell.setData = function(data) {
if (data.discount!=1){
cell.getElementsByTagName('input')[0].checked = false;
}
};
cell.getData = function(data) {
data.discount = UserFormatNumberToNumber(cell.firstChild.value);
}
cell.onDeselect = function() {
ERROR = false;
var data = new Object();
this.getData(data);
if (!ERROR) {
data.discount = data.discount;
this.setData(data);
}
}
var edit = document.createElement('input');
edit.setAttribute('type', 'checkbox');
edit.setAttribute('tabIndex', 1);
edit.className = 'inputs';
edit.checked = true;
edit.value = 1;
cell.appendChild(edit);
}
if (i == 2) {
var img;
cell.style.padding = "auto auto auto auto";
// insert
img = document.createElement('img');
img.setAttribute('alt','ADD');
img.setAttribute('src',
'modules/EcmQuotes/images/insertrow.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.myTable
.addRow(this.parentNode.parentNode.index + 1);
refreshPositionIndex();
};
// delete
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
img = document.createElement('img');
img.setAttribute('alt', 'DELETE');
img.setAttribute('src',
'modules/EcmQuotes/images/deleterow.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.parentNode.deleteRow();
refreshPositionIndex();
};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
cell.appendChild(document.createElement('br'));
// move up
img = document.createElement('img');
img.setAttribute('alt','UP');
img.setAttribute('src',
'modules/EcmQuotes/images/moverowup.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.parentNode.moveUp();
refreshPositionIndex();
};
cell.appendChild(img);
cell.appendChild(document.createTextNode(" "));
// move down
img = document.createElement('img');
img.setAttribute('alt', 'DOWN');
img.setAttribute('src',
'modules/EcmQuotes/images/moverowdown.gif');
img.style.cursor = 'pointer';
img.onclick = function() {
this.parentNode.parentNode.moveDown();
refreshPositionIndex();
}
cell.appendChild(img);
}
}
ItemsList55 = function(json) {
var data = '';
for (var i = 0; i < paramsTable2.rowCount(); i++) {
var a=0;
var data2=new Object();
$(paramsTable2.row(i)).find("td input").each(function() {
if(a==3){
if($(this).prop("checked")==true){
data2.discount=1;
} else {
data2.discount=0;
}
}
if(a==0){
data2.product_group=$(this).val();
}
if(a==1){
data2.cat_id=$(this).val();
}
if(a==2){
data2.id=$(this).val();
}
a++;
});
data = data
+ '||||'
+ JSON.stringifyNoSecurity(data2);
}
return data;
}
if (paramsTable2.rowCount() == 0) {
paramsTable2.addRow();
}
;
paramsTable2.onSetCellData = function(row, cell, data) {
if (cell.innerHTML == '')
cell.innerHTML = '&nbsp;';
}
ItemListFill2 = function() {
var pl;
pl = document.getElementById('position_list55').value;
console.log(pl);
if (pl && pl != '') {
try {
pl = eval(pl);
for (x in pl) {
var pl_row = pl[x];
if (pl_row.template == '')
continue;
paramsTable2.addRow().setData(pl_row);
}
} catch (err) {
pl = null;
}
;
}
}
ItemListClear2 = function(noNew, save) {
if (typeof (save) == "string")
ItemListSave(null, save);
while (paramsTable2.rowCount() > 0)
paramsTable2.row(0).deleteRow(noNew);
}
ItemListClear2();
ItemListFill2();
});

2308
modules/Accounts/MyTable.js Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,47 @@
$(document).ready(function() {
var MaxInputs = 10; //maximum input boxes allowed
var InputsWrapper = $("#InputsWrapper"); //Input boxes wrapper ID
var AddButton = $("#AddMoreWWWBox"); //Add button ID
var x = InputsWrapper.length; //initlal text box count
var FieldCount=1; //to keep track of text box added
var weblists = $.parseJSON($("input[name='websites_list']").val()); // get and decode json object
$.each(weblists, function(idx, obj) { // add existing elements
FieldCount++; //text box added increment
//add input box
if(idx == 0 ){ // to first element
$( "div input[name='websites[]']" ).first().val(obj.www);
$( "div input[name='websites_id[]']" ).first().val(obj.id);
} else { // rest
$(InputsWrapper).append('<tr><td><input type="hidden" value="'+obj.id+'" name="websites_id[]"><input type="text" size="30" name="websites[]" id="field_'+ FieldCount +'" value="'+obj.www +'"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a></td></tr>');
}
x++; //text box increment
});
$(AddButton).click(function (e) //on add input button click
{
if(x <= MaxInputs) //max input box allowed
{
FieldCount++; //text box added increment
//add input box
$(InputsWrapper).append('<tr><td><input type="hidden" value="" name="websites_id[]"><input type="text" size="30" name="websites[]" id="field_'+ FieldCount +'" value="http://"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a></td>,/tr>');
x++; //text box increment
}
return false;
});
$("body").on("click",".removeclass", function(e){ //user click on remove text
if( x > 1 ) {
$(this).closest('tr').remove();//remove text box
x--; //decrement textbox
}
return false;
})
});

4
modules/Accounts/jquery.min.js vendored Normal file

File diff suppressed because one or more lines are too long

13
modules/Accounts/jquery_ui.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,57 @@
google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {
var a = new Array();
var html = "";
var table = document.getElementById("ChartData");
for (var i = 0, row; row = table.rows[i]; i++) {
a[i] = new Array();
for (var j = 0, col; col = row.cells[j]; j++) {
a[i][j]=row.cells[j].textContent;
if(j>0 && i > 0){
a[i][j] = a[i][j].replace(".", "").replace(".", "");
a[i][j] = parseFloat(a[i][j].replace(",", "."));
}
}
}
// Calculate the width and height of the Array
var w = a.length ? a.length : 0,
h = a[0] instanceof Array ? a[0].length : 0;
// In case it is a zero matrix, no transpose routine needed.
if(h === 0 || w === 0) { t=[]; }
/**
* @var {Number} i Counter
* @var {Number} j Counter
* @var {Array} t Transposed data is stored in this array.
*/
var i, j, t = [];
// Loop through every item in the outer array (height)
for(i=0; i<h-1; i++) {
// Insert a new row (array)
t[i] = [];
// Loop through every item per item in outer array (width)
for(j=0; j<w-1; j++) {
// Save transposed data.
t[i][j] = a[j][i];
}
}
var data = google.visualization.arrayToDataTable(t);
formatter = new google.visualization.NumberFormat({
suffix: ' zł',
fractionDigits: '2',
decimalSymbol: ',',
groupingSymbol: '.',
});
for (i = 1; i < data.getNumberOfColumns(); i++) {
formatter.format(data, i);
}
var options = {
};
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, options);
}

View File

@@ -0,0 +1,29 @@
$(function() {
var availableTags = [
"zachodniopomorskie",
"dolnośląskie",
"kujawsko-pomorskie",
"lubelskie",
"lubuskie",
"łódzkie",
"małopolskie",
"mazowieckie",
"opolskie",
"podkarpackie",
"podlaskie",
"pomorskie",
"śląskie",
"świętokrzyskie",
"warmińsko-mazurskie",
"wielkopolskie"
];
var $searchBox = $( "input[name='register_address_state']");
$searchBox.autocomplete({
source: availableTags
});
var $searchBox2 = $( "input[name='billing_address_state']");
$searchBox2.autocomplete({
source: availableTags
});
});

View File

@@ -0,0 +1,47 @@
$(document).ready(function() {
console.log('ten plik');
$('.loading_panel').hide();
var MaxInputs = 10; //maximum input boxes allowed
var InputsWrapper = $("#InputsWrapper2"); //Input boxes wrapper ID
var AddButton = $("#AddMoreWWWBox2"); //Add button ID
var x = InputsWrapper.length; //initlal text box count
var FieldCount=1; //to keep track of text box added
var weblists = $.parseJSON($("input[name='telephones_list']").val()); // get and decode json object
$.each(weblists, function(idx, obj) { // add existing elements
FieldCount++; //text box added increment
//add input box
if(idx == 0 ){ // to first element
$( "div input[name='telephones[]']" ).first().val(obj.telephone);
$( "div input[name='telephones_id[]']" ).first().val(obj.id);
} else { // rest
$(InputsWrapper).append('<tr><td><input type="hidden" value="'+obj.id+'" name="telephones_id[]"><input type="text" size="30" name="telephones[]" id="field_'+ FieldCount +'" value="'+obj.telephone +'"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a></td></tr>');
}
x++; //text box increment
});
$(AddButton).click(function (e) //on add input button click
{
if(x <= MaxInputs) //max input box allowed
{
FieldCount++; //text box added increment
//add input box
$(InputsWrapper).append('<tr><td><input type="hidden" value="" name="telephones_id[]"><input type="text" size="30" name="telephones[]" id="field_'+ FieldCount +'" value=""/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a></td>,/tr>');
x++; //text box increment
}
return false;
});
$("body").on("click",".removeclass", function(e){ //user click on remove text
if( x > 1 ) {
$(this).closest('tr').remove();//remove text box
x--; //decrement textbox
}
return false;
})
});

View File

@@ -0,0 +1,47 @@
$(document).ready(function() {
$('.loading_panel').hide();
var MaxInputs = 10; //maximum input boxes allowed
var InputsWrapper = $("#InputsWrapper"); //Input boxes wrapper ID
var AddButton = $("#AddMoreWWWBox"); //Add button ID
var x = InputsWrapper.length; //initlal text box count
var FieldCount=1; //to keep track of text box added
var weblists = $.parseJSON($("input[name='websites_list']").val()); // get and decode json object
$.each(weblists, function(idx, obj) { // add existing elements
FieldCount++; //text box added increment
//add input box
if(idx == 0 ){ // to first element
$( "div input[name='websites[]']" ).first().val(obj.www);
$( "div input[name='websites_id[]']" ).first().val(obj.id);
} else { // rest
$(InputsWrapper).append('<tr><td><input type="hidden" value="'+obj.id+'" name="websites_id[]"><input type="text" size="30" name="websites[]" id="field_'+ FieldCount +'" value="'+obj.www +'"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a></td></tr>');
}
x++; //text box increment
});
$(AddButton).click(function (e) //on add input button click
{
if(x <= MaxInputs) //max input box allowed
{
FieldCount++; //text box added increment
//add input box
$(InputsWrapper).append('<tr><td><input type="hidden" value="" name="websites_id[]"><input type="text" size="30" name="websites[]" id="field_'+ FieldCount +'" value="http://"/></td><td><a href="#" class="removeclass"><img class="id-ff-remove" name="0" src="index.php?entryPoint=getImage&amp;themeName=Sugar5&amp;imageName=id-ff-remove.png"></a></td>,/tr>');
x++; //text box increment
}
return false;
});
$("body").on("click",".removeclass", function(e){ //user click on remove text
if( x > 1 ) {
$(this).closest('tr').remove();//remove text box
x--; //decrement textbox
}
return false;
})
});

View File

@@ -0,0 +1,43 @@
$(document)
.ready(
function() {
var mapProp = {
center : new google.maps.LatLng(52.05, 19.45),
zoom : 6,
mapTypeId : google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document
.getElementById("googleMapContainer"), mapProp);
var markers = JSON.parse(b64_to_utf8($('#googleMapMarkers')
.val()));
$.each(markers, function(index, m) {
var marker = new google.maps.Marker({
position : new google.maps.LatLng(m.lat, m.lng),
url : '/',
animation : google.maps.Animation.DROP,
customInfo : m.info,
title : m.title,
map : map
});
google.maps.event.addListener(marker, 'click',
markerClickFunction);
});
function markerClickFunction() {
infowindow = new google.maps.InfoWindow({
content : this.customInfo
});
infowindow.open(map, this);
closeInfoWindow(infowindow);
}
function closeInfoWindow(infoWindow) {
setTimeout(function() {
infoWindow.close();
}, 8000);
}
});
function b64_to_utf8(str) {
return decodeURIComponent(escape(window.atob(str)));
}

View File

@@ -0,0 +1,448 @@
function NumberToUserFormatNumber(number,add) {
if(!number) number = 0;
number = parseFloat(number);
var tmp = number.toFixed(OPT['dec_len']);
var s1 = tmp.substring(0,tmp.length-1-OPT['dec_len']);
var s2 = tmp.substring(tmp.length-OPT['dec_len'],tmp.length);
var tmp = '';
for(var i=s1.length;i>0;i-=3) {
tmp = ((i<=3)?"":OPT['sep_1000'])+s1.substring(i-3,i)+tmp;
}
s1 = tmp;
return (s1+OPT['dec_sep']+s2).toString()+((add)?add:'');
}
function UserFormatNumberToNumber(ufn,add) {
if(add) {
var match = /add/g;
ufn = ufn.replace(match,'');
}
var match = /Err/g;
ufn = ufn.replace(match,'');
if(!ufn) return parseFloat(0);
var pos = ufn.indexOf(OPT['dec_sep']);
var s1='', s2='';
if(pos==-1) { s1 = ufn; s2 = ''; }
else { s1 = ufn.substring(0,pos); s2 = ufn.substring(pos+1,ufn.length); }
/*
if(OPT['sep_1000'] != "")
for(var i=s1.length-4;i>=0;i-=4)
if(s1.charAt(i) != OPT['sep_1000']) { return -1; }
if(s1.charAt(0) == OPT['sep_1000']) return -1;
*/
var pos = -1;
while((pos = s1.indexOf(OPT['sep_1000'])) != -1)
s1 = s1.substring(0,pos)+s1.substring(pos+1,s1.length);
//alert(s1);
return parseFloat(s1+"."+s2);
}
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 paramsMT(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() {
if(this.index < this.myTable.rowCount()-1) { this.deselect(); this.nextSibling.select(); return this.nextSibling; }
else {
if(this.noAddNew) return this;
this.deselect();
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) { if(this.noNewAdd) return; else 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); }
}