Add JS files
This commit is contained in:
52
modules/EcmDocs/ListFunctions.js
Executable file
52
modules/EcmDocs/ListFunctions.js
Executable file
@@ -0,0 +1,52 @@
|
||||
// JavaScript Document
|
||||
function moveDiv(obj, mvTop, mvLeft) {
|
||||
obj.style.position = "absolute";
|
||||
obj.style.top = mvTop;
|
||||
obj.style.left = mvLeft;
|
||||
}
|
||||
function findPosX(obj)
|
||||
{
|
||||
var curleft = 0;
|
||||
if(obj.offsetParent)
|
||||
while(1)
|
||||
{
|
||||
curleft += obj.offsetLeft;
|
||||
if(!obj.offsetParent)
|
||||
break;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
else if(obj.x)
|
||||
curleft += obj.x;
|
||||
return curleft;
|
||||
}
|
||||
|
||||
function findPosY(obj)
|
||||
{
|
||||
var curtop = 0;
|
||||
if(obj.offsetParent)
|
||||
while(1)
|
||||
{
|
||||
curtop += obj.offsetTop;
|
||||
if(!obj.offsetParent)
|
||||
break;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
else if(obj.y)
|
||||
curtop += obj.y;
|
||||
return curtop;
|
||||
}
|
||||
function showdescription(id,title,desc,minus)
|
||||
{
|
||||
if(!minus)minus=0;
|
||||
var sum=17-minus;
|
||||
document.getElementById("opis").style.display="inline";
|
||||
document.getElementById("opis-title").innerHTML=title;
|
||||
document.getElementById("opis-desc").innerHTML=desc;
|
||||
posy=findPosY(document.getElementById("link-"+id))+sum;
|
||||
posx=findPosX(document.getElementById("link-"+id))-80;
|
||||
moveDiv(document.getElementById("opis"),posy,posx);
|
||||
}
|
||||
function hidedescription()
|
||||
{
|
||||
document.getElementById("opis").style.display="none";
|
||||
}
|
||||
164
modules/EcmDocs/formloader.js
Executable file
164
modules/EcmDocs/formloader.js
Executable 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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
164
modules/EcmDocs/helper.js
Executable file
164
modules/EcmDocs/helper.js
Executable file
@@ -0,0 +1,164 @@
|
||||
function showdescription(id,title,desc,minus,object)
|
||||
{
|
||||
if(!minus)minus=0;
|
||||
var sum=17-minus;
|
||||
document.getElementById("desc").style.display="inline";
|
||||
document.getElementById("desc-title").innerHTML=title;
|
||||
document.getElementById("desc-desc").innerHTML=desc;
|
||||
posy=findPosY(object)+sum;
|
||||
posx=findPosX(object);
|
||||
moveDiv(document.getElementById("desc"),posy,posx);
|
||||
}
|
||||
function hidedescription()
|
||||
{
|
||||
document.getElementById("desc").style.display="none";
|
||||
}
|
||||
function mintajaxget(url,tag)
|
||||
{
|
||||
var req=mint.Request();
|
||||
req.Set('timeout',10000000);
|
||||
req.Set('retryNum',0);
|
||||
req.OnLoading=function(){$(tag).innerHTML='<img src="themes/default/images/loading.gif" border="0">';}
|
||||
req.OnSuccess = function(){if($(tag).type=='text'){if(this.responseText!="")$(tag).value=this.responseText;}else{if(this.responseText!="")$(tag).innerHTML=this.responseText;}}
|
||||
req.Send(url,tag);
|
||||
|
||||
}
|
||||
function mintajaxpost(url,tag,form)
|
||||
{
|
||||
var req=mint.Request();
|
||||
req.OnSuccess=function(){$(tag).innerHTML=this.responseText;}
|
||||
req.OnLoading=function(){$(tag).innerHTML='<img src="themes/default/images/loading.gif" border="0">';}
|
||||
req.SendForm(form);
|
||||
}
|
||||
function moveDiv(obj, mvTop, mvLeft) {
|
||||
obj.style.position = "absolute";
|
||||
obj.style.top = mvTop;
|
||||
obj.style.left = mvLeft;
|
||||
}
|
||||
function getPos(inputElement) {
|
||||
var coords = new Object();
|
||||
coords.x = 0;
|
||||
coords.y = 0;
|
||||
try {
|
||||
targetElement = inputElement;
|
||||
if(targetElement.x && targetElement.y) {
|
||||
coords.x = targetElement.x;
|
||||
coords.y = targetElement.y;
|
||||
} else {
|
||||
if(targetElement.offsetParent) {
|
||||
coords.x += targetElement.offsetLeft;
|
||||
coords.y += targetElement.offsetTop;
|
||||
while(targetElement = targetElement.offsetParent) {
|
||||
coords.x += targetElement.offsetLeft;
|
||||
coords.y += targetElement.offsetTop;
|
||||
}
|
||||
} else {
|
||||
//alert("Could not find any reference for coordinate positioning.");
|
||||
}
|
||||
}
|
||||
return coords;
|
||||
} catch(error) {
|
||||
//alert(error.msg);
|
||||
return coords;
|
||||
}
|
||||
}
|
||||
|
||||
function findPosX(obj)
|
||||
{
|
||||
var curleft = 0;
|
||||
if(obj.offsetParent)
|
||||
while(1)
|
||||
{
|
||||
curleft += obj.offsetLeft;
|
||||
if(!obj.offsetParent)
|
||||
break;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
else if(obj.x)
|
||||
curleft += obj.x;
|
||||
return curleft;
|
||||
//return getPos(obj).x;
|
||||
}
|
||||
|
||||
function findPosY(obj)
|
||||
{
|
||||
var curtop = 0;
|
||||
if(obj.offsetParent)
|
||||
while(1)
|
||||
{
|
||||
curtop += obj.offsetTop;
|
||||
if(!obj.offsetParent)
|
||||
break;
|
||||
obj = obj.offsetParent;
|
||||
}
|
||||
else if(obj.y)
|
||||
curtop += obj.y;
|
||||
return curtop;
|
||||
//return getPos(obj).y;
|
||||
}
|
||||
function showdiv(id,div,minusy,minusx)
|
||||
{
|
||||
document.getElementById(div).style.display="inline";
|
||||
posy=findPosY(document.getElementById(id))-minusy;
|
||||
posx=findPosX(document.getElementById(id))-minusx;
|
||||
moveDiv(document.getElementById(div),posy,posx);
|
||||
}
|
||||
function hidediv(div)
|
||||
{
|
||||
document.getElementById(div).style.display="none";
|
||||
}
|
||||
function showprice(id,price,order_by,sorder)
|
||||
{
|
||||
document.getElementById('price').value=price;
|
||||
document.getElementById('product_id').value=id;
|
||||
document.getElementById('order_by').value=order_by;
|
||||
document.getElementById('sorder').value=sorder;
|
||||
document.getElementById('price-block').style.display="block";
|
||||
}
|
||||
function getPrice(id,type)
|
||||
{
|
||||
var purchase_price=document.getElementById('purchase_price_'+id).value;
|
||||
var margin_rate=document.getElementById('margin_rate_'+id).value;
|
||||
var list_price;
|
||||
|
||||
list_price=parseFloat(purchase_price)/(1-parseFloat(margin_rate)/100);
|
||||
|
||||
if(!isNaN(list_price))document.getElementById('list_price_'+id).value=roundNumber(list_price,2);
|
||||
|
||||
}
|
||||
function CurrencyFormatted(amount)
|
||||
{
|
||||
var i = parseFloat(amount);
|
||||
if(isNaN(i)) { i = 0.00; }
|
||||
var minus = '';
|
||||
if(i < 0) { minus = '-'; }
|
||||
i = Math.abs(i);
|
||||
i = parseInt((i + .005) * 100);
|
||||
i = i / 100;
|
||||
s = new String(i);
|
||||
if(s.indexOf('.') < 0) { s += '.00'; }
|
||||
if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
|
||||
s = minus + s;
|
||||
return s;
|
||||
}
|
||||
function roundN(rnum,rlength)
|
||||
{
|
||||
var newnumber = Math.round(rnum*Math.pow(10,rlength))/Math.pow(10,rlength);
|
||||
return newnumber;
|
||||
}
|
||||
function roundNumber(num, dec)
|
||||
{
|
||||
if(!isNaN(num))return CurrencyFormatted(roundN(parseFloat(num),dec));
|
||||
else return "";
|
||||
}
|
||||
function ShowHideBlock(id)
|
||||
{
|
||||
if(document.getElementById(id).style.display=="block")
|
||||
{
|
||||
document.getElementById(id).style.display="none"
|
||||
}
|
||||
else
|
||||
{
|
||||
document.getElementById(id).style.display="block"
|
||||
}
|
||||
}
|
||||
2
modules/EcmDocs/mintajax.js
Executable file
2
modules/EcmDocs/mintajax.js
Executable file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user