Add JS files
This commit is contained in:
62
modules/EcmCalendars/Calendar.js
Executable file
62
modules/EcmCalendars/Calendar.js
Executable file
@@ -0,0 +1,62 @@
|
||||
$(document).ready(function () {
|
||||
var int_header_height = 10; //put pixel value height of header here
|
||||
if ($(document).scrollTop() <= int_header_height) {
|
||||
$('#desc').css('position','absolute').css('top','0px');
|
||||
} else {
|
||||
$('#desc').css('position','fixed').css('top','10px');
|
||||
}
|
||||
});
|
||||
|
||||
function setBoxStyle(hour,y_value,cc,id)
|
||||
{
|
||||
var x=findPosX(document.getElementById("table_day"));
|
||||
var y=findPosY(document.getElementById("hour"+hour)); //by id
|
||||
//y=y+y_value+184;
|
||||
y=y+y_value-1;
|
||||
x=x+cc+32;
|
||||
document.getElementById("activity"+id).style.position="absolute";
|
||||
document.getElementById("activity"+id).style.left=x+"px";
|
||||
document.getElementById("activity"+id).style.top=y+"px";
|
||||
}
|
||||
function resizeHours(hour,hour_height)
|
||||
{
|
||||
document.getElementById("hour"+hour).style.height=hour_height+"px";
|
||||
}
|
||||
function getHourPosition(hour,t)
|
||||
{
|
||||
var v;
|
||||
var r=t.rows;
|
||||
for(i=0;i<hour;i++)
|
||||
{
|
||||
v=v+r[i].height;
|
||||
}
|
||||
return v;
|
||||
}
|
||||
function showdescriptionCalendar(title,desc,object,pos)
|
||||
{
|
||||
var div=document.createElement("div");
|
||||
|
||||
desc=desc.replace("<","<");
|
||||
desc=desc.replace(">",">");
|
||||
desc=desc.replace(""",'"');
|
||||
desc=desc.replace("´","'");
|
||||
div.style.display="none";
|
||||
div.style.background="#ffffff";
|
||||
div.style.position="fixed";
|
||||
div.style.bottom = '0%';
|
||||
div.style.padding = '10px';
|
||||
div.id="desc";
|
||||
|
||||
div.innerHTML='<table bgcolor="#cccccc" class="olBgClass" border="0" cellpadding="1" cellspacing="1"><tbody><tr><td><table class="olCgClass" border="0" cellpadding="2" cellspacing="0" width="100%"><tbody><tr><td class="olCgClass" width="100%">'+title+'</td><td align="right"><a href="javascript:hidedescriptionCalendar();" title="Click to Close" onClick="javascript:hidedescription();" class="olCloseFontClass"><img src="themes/Sugar/images/close_inline.gif" border="0"></a></td></tr></tbody></table><table class="olFgClass" border="0" cellpadding="2" cellspacing="0" width="100%"><tbody><tr><td class="olFgClass" valign="top" background="#ffffff">'+desc+'<br></td></tr></tbody></table></td></tr></tbody></table>';
|
||||
|
||||
document.body.appendChild(div);
|
||||
$('#desc').show();
|
||||
}
|
||||
function hidedescriptionCalendar()
|
||||
{
|
||||
if(document.getElementById("desc"))
|
||||
{
|
||||
document.getElementById("desc").style.display="none";
|
||||
document.body.removeChild(document.getElementById("desc"));
|
||||
}
|
||||
}
|
||||
181
modules/EcmCalendars/helper.js
Executable file
181
modules/EcmCalendars/helper.js
Executable file
@@ -0,0 +1,181 @@
|
||||
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){
|
||||
$('#'+tag).html('<img src="themes/default/images/loading.gif" border="0">');
|
||||
$.ajax({
|
||||
type : "POST",
|
||||
url : url,
|
||||
dataType : "html",
|
||||
async : false,
|
||||
success : function(data) {
|
||||
$('#'+tag).html(data);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
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,purchase_price,margin,order_by,sorder)
|
||||
{
|
||||
document.getElementById('price').value=price;
|
||||
document.getElementById('purchase_price').value=purchase_price;
|
||||
document.getElementById('margin').value=margin;
|
||||
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 getPricePricebook()
|
||||
{
|
||||
var purchase_price=document.getElementById('purchase_price').value;
|
||||
var margin_rate=document.getElementById('margin').value;
|
||||
var list_price;
|
||||
|
||||
list_price=parseFloat(purchase_price)/(1-parseFloat(margin_rate)/100);
|
||||
|
||||
if(!isNaN(list_price))document.getElementById('price').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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user