Add version files and new GIF images for UI components

This commit is contained in:
2025-04-03 06:26:44 +07:00
commit 663c28a2ea
5219 changed files with 772528 additions and 0 deletions

53
themes/js/camupload.js Normal file
View File

@ -0,0 +1,53 @@
window.addEventListener("load", function(){
// [1] GET ALL THE HTML ELEMENTS
var video = document.getElementById("vid-show"),
canvas = document.getElementById("vid-canvas"),
take = document.getElementById("vid-take");
var mediaDevices = navigator.mediaDevices;
// [2] ASK FOR USER PERMISSION TO ACCESS CAMERA
// WILL FAIL IF NO CAMERA IS ATTACHED TO COMPUTER
navigator.mediaDevices.getUserMedia({ video : true })
.then(function(stream) {
// [3] SHOW VIDEO STREAM ON VIDEO TAG
video.srcObject = stream;
video.play();
// [4] WHEN WE CLICK ON "TAKE PHOTO" BUTTON
take.addEventListener("click", function(){
// Create snapshot from video
var draw = document.createElement("canvas");
draw.width = video.videoWidth;
draw.height = video.videoHeight;
var context2D = draw.getContext("2d");
context2D.drawImage(video, 0, 0, video.videoWidth, video.videoHeight);
// Upload to server
draw.toBlob(function(blob){
var data = new FormData();
data.append('upimage', blob);
var xhr = new XMLHttpRequest();
xhr.open('POST', "lib/camupload.php", true);
xhr.onload = function(){
if (xhr.status==403 || xhr.status==404) {
alert("ERROR LOADING 3-UPLOAD.PHP");
} else {
var sp=this.response.split('|');
if(sp[0]=='ok')
{
fn_setImage(sp[1]);
}
else
{
alert(sp[1]);
}
//alert(this.response);
}
};
xhr.send(data);
});
});
})
.catch(function(err) {
document.getElementById("vid-controls").innerHTML = err;
});
});

740
themes/js/initjq.js Normal file
View File

@ -0,0 +1,740 @@
var thetokenlengthexist=0;
var ajaxcall;//var runajaxfunction;
// ==== event keypress to Tab
$('input, select, textarea').live('keydown',function(e){
if(e.keyCode==13&&$(this).val()!='')
{
var focusable = $('input,a,select,button,textarea').filter(':visible');
focusable.eq(focusable.index(this)+1).focus();
return false;
}
});
function nextfocus(objsrc,objtarget)
{
//alert(objsrc+' '+objtarget);
$("#"+objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
//alert(key);
if(key==13&&$("#"+objsrc).val()!='')
{
//alert(key+' '+objtarget);
if(objtarget)
{
//$("#"+objtarget).attr('disabled',false);
$("#"+objtarget).focus();
}
else
{
e.keyCode=9;
}
}//$("#"+objtarget).focus();}
});
}
function nextfocusnew(objsrc,objtarget)
{
//alert(objsrc);
$(objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$(objsrc).val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
}
// ===== Number Validation
function numberonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; // alert(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=46&&unicode!=13)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
function ipkonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=190&&unicode!=46&&unicode!=110)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
// ===== Char Validation
function charonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Char And Symbol Validation
function charsimbolonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39&&unicode!=43&&unicode!=45)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Address Validation
function addressonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//var mychar=String.fromCharCode(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111)
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111&&unicode!=173&&unicode!=37&&unicode!=46&&unicode!=39&&unicode!=36&&unicode!=35)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
function skonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
if(unicode!=8&&unicode!=9&&unicode!=47&&unicode!=45)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
//else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
// ===== Number and characterValidation
function numbercharonly(e,withuppercase)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
if(withuppercase)
{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
}
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:19 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=45)
{
//if(unicode<48||unicode>57){return false;}
//alert(unicode);
if((unicode>=48&&unicode<=57)||(unicode>=65&&unicode<=90)){}
else{return false;}
}
}
function teleponcharonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=45&&unicode!=95)
{
if(unicode>=48&&unicode<=57){return true;}
else{return false;}
}
}
function ajaxuri(obj,task,divtarget,withmsginfo,runfunction)
{
//alert(task);
if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var x=0;
ajaxcall=$.ajax({
type:'POST',
url:'index.php',
cache:false,
data:'ajax=1&sec=1&option='+obj+'&'+task,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(result){
var sp=result.split('|');
var valresult=result;
if(sp.length>1)
{
category=sp[0];
if(category=='msg'){msgtext=sp[1];valresult=sp[2];bootbox.alert(msgtext);}
}
$('#'+divtarget).show();
//bootbox.alert('test');
$('#'+divtarget).html(valresult);
if(runfunction){runfunction();}
}
});
}
function ajaxuridhtmlx(obj,task)
{
//alert(obj+task);
//if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var ajaxcall=$.ajax({
type:'POST',
url:'index.php',
data:'ajax=1&sec=1&option='+obj+'&'+task,
dataType: 'html',
context: document.body,
global: false,
async:false,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(data){
//$('#divtest').html(data);
}
}).responseText;
return ajaxcall;
}
function fn_dhtmlxsetfocus(form,objform)
{
form.setItemFocus(objform);
}
function fn_dhtmlxloadobject(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxsenddata(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxmessage(dtype,msg)
{
return dhtmlx.message({type:dtype,text:msg,expire:3000});
}
function fn_dhtmlxconfirm(mytitle,mytext)
{
dhtmlx.confirm({
title: mytitle,
type:'confirm',
ok:"Yes",cancel:"No",
text: mytext,
callback: function(result){return result;}
});
}
function fn_dhtmlxtabbarisexist(tabbId)
{
var isTabCreated=false;
myTabbar.forEachCell(function(cell){
var id=cell.getId();
//alert(id+' '+tabbId);
if(id==tabbId){isTabCreated=true;}
});
return isTabCreated;
}
//$.when(ajaxcall).then(function(){alert('test');})
function TokenInput(obj,jurl,objnextfocus)
{
var map={};
var result=[];
//var locateurl=jurl;
//alert(obj);
$("#"+obj+"1").val('');
$("#"+obj).val('');
$('#'+obj).typeahead({
source:function(query,process){
//var locateurl=jurl;
$.ajax({
url:'index.php',
type:'POST',
data:jurl+query,
datatype:'JSON',
async:true,
success:function(data){
label=[];
result=JSON.parse(data);
$.each(result, function (i, item)
{
//if(item=='Record Not Found'){map[item.label]='';label.push('Record Not Found');break;}
map[item.label] = name.value;
label.push(item.label);
});
process(label);
//process(JSON.parse(data));
}
});
},
updater: function(item) {
for(var i=0;i<result.length;i++)
{
if(result[i].label==item)
{
$("#"+obj+"1").val(result[i].id);
thetokenlengthexit=item.length;
$("#"+objnextfocus).focus();
break;
}
}
return item;
//alert(map[item].id);
//var item=JSON.parse(item);
//$('#t1').val(item.label);return item;
//alert("selec"+map[item].id);//return item;
},
highlighter:function(item){
var bld="<i>"+item+"</i>";
return bld;
}
});
}
function fn_diffmonth(dt1,dt2)
{
var months;
months = (dt2.getFullYear() - dt1.getFullYear()) * 12;
months += dt2.getMonth() - dt1.getMonth();
return months;
}
//(function ($, window, delay) {
// var theTimer = 0;
// var theElement = null;
// var theLastPosition = {x:0,y:0};
// $('[data-toggle]')
//.closest('li')
// .on('mouseenter', function (inEvent) {
// if (theElement) theElement.removeClass('open');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mousemove', function (inEvent) {
// if(Math.abs(theLastPosition.x - inEvent.ScreenX) > 4 ||
// Math.abs(theLastPosition.y - inEvent.ScreenY) > 4)
// {
// theLastPosition.x = inEvent.ScreenX;
// theLastPosition.y = inEvent.ScreenY;
// return;
// }
//
// if (theElement.hasClass('open')) return;
// window.clearTimeout(theTimer);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mouseleave', function (inEvent) {$(this).closest('li');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.removeClass('open');
// }, delay);
// });
//})(jQuery, window, 200); // 200 is the delay in milliseconds
//$(document).ready(function(){
//$('ul.dropdown-menu').mouseout(function(){
// $('[data-toggle="dropdown"]').parent().removeClass('open');
//});})
// ==== MOdified 19 September 2013 11:24 Am
$(document).ready(function () {
$('ul.nav').each(function(){
$(this).on("mouseleave",function(){
$('li.dropdown').each(function () {
$(this).removeClass('open');
});
});
});
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
});
// ==== 6 February 2014 14:54 pm
$(function(){
$('.input').live("keypress", function(e){
//$('.nextfocus').keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$this.val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
});
$(function(){
$('.input').live("keyup", function(e){
//$('.nextfocus').keypress(function(e){
this.value=this.value.toUpperCase();
});
});
// ==== Public function
function showmaskingrupiah(valuess)
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
if(valuess)
{
mydivrupiah.style.visibility='visible';
lblrupiah.innerHTML=numberformat(valuess);
}
else
{
mydivrupiah.style.visibility='hidden';
}
}
function hidemaskingrupiah()
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
mydivrupiah.style.visibility='hidden';
}
function roundednumber(valuess,decimalplaces) // ==== created 25 Oktober 2012 7:15 AM
{
var sp=valuess.split('.');
var rtn='0.00';
if(sp.length>1)
{
var dec=sp[1].substring(0,decimalplaces);
if(parseInt(sp[1].substring(decimalplaces,decimalplaces+1))>5&&parseInt(sp[1].substring(decimalplaces,decimalplaces+1))<9)
{
dec=sp[1].substring(decimalplaces,decimalplaces+1);
dec=parseInt(sp[1].substring(0,decimalplaces))+1;
}
if(parseInt(dec)>=90)
{
sp[0]=parseInt(sp[0])+1;dec='00';
}
rtn=sp[0]+'.'+dec;
}
else
{
rtn=valuess;
}
return rtn;
}
function jqajax(params,div_result,withloadergif)
{
if(withloadergif)
{
//$("#"+div_result).html('<img src=/images/loader.gif/>');
}
$.get(params,function(data,status){
var result=data;
if(("#"+div_result).length>0)
{
$("#"+div_result).html(result);
return true;
}
});
}
function plocateurl(com_name,task,criteria,div_target,msg,noprogress)
{
params='ajax=1&option='+com_name+'&task='+task+'&'+criteria;
if(!msg){msg='wait';}
loadObject(params,div_target,msg,noprogress);
}
function ajaxurinewtab(obj_folder,obj_name,task,params)
{
url='?ajax=1&sec=1&dec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//alert(url);
$('#fmpreview').prop('action',url);
$('#fmpreview').submit();
//url='ajax=1&sec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//$('#uri').val(url);
//$('#fmpreview').submit();
}
function loadNewWindow(url,pagewidth,pageheight,scrollbar)
{
document.body.style.cursor='wait';
if(!pagewidth){pagewidth=450;}
if(!pageheight){pageheight=550;}
if(!scrollbar&&scrollbar!=0){scrollbar=1;}
//scrollbar=1;
parentwin=window.open(url,"_blank","top=0,left=0,width="+pagewidth+",height="+pageheight+",toolbar=0,menubar=0,statusbar=0,location=0,scrollbars="+scrollbar);
if(pagewidth=='100%'){parentwin.resizeTo(screen.width-40,pageheight);}
document.body.style.cursor='default';
}
function showdate(objTextBox,dateformat)
{
if(!dateformat){dateformat='dd/mm/yy';}
$('#'+objTextBox).datepicker({dateFormat: dateformat });
}
function closeobj(obj,objvalue)
{
var myobj=document.getElementById(obj);
if(objvalue)
{
var myobjvalue=document.getElementById(objvalue);
myobjvalue.value='';
}
myobj.style.visibility='hidden';
}
function setpos_Popup(objpopup,objtarget)
{
//alert(objpopup);
var x=fn_get_objtext_posX(objtarget);
var y=fn_get_objtext_posY(objtarget);
var objdisplay=document.getElementById(objpopup);
objdisplay.style.visibility='visible';
objdisplay.style.marginTop=parseInt(document.getElementById(objtarget).offsetHeight)+parseInt(y);
objdisplay.style.marginLeft=parseInt(x);
}
function fn_get_objtext_posX(objtext)
{
var pos_x= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_x+= obj.offsetLeft;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.x)
{pos_x+=obj.x;}
return pos_x;
}
function fn_get_objtext_posY(objtext)
{
var pos_y= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_y+=obj.offsetTop;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.y)
{pos_y+=obj.y;}
return pos_y;
}
function fn_numberformat(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)){x1 = x1.replace(rgx, '$1' + '.' + '$2');}
return x1 + x2;
}
function fn_clsnumberformat(values){return values.replace(/,/gi,'');}
function trim(textstring){return textstring.replace(/^\s+|\s+$/g,'');}
function loadautocomplete(objtextbox,url){setAutoComplete(objtextbox, 'results', url);}
function initial()
{
var div_body=document.getElementById('div_body');
var height_tb_header=document.getElementById('tb_header').height;
var height_tb_menu=document.getElementById('tb_menu').height;
var height_tb_title=document.getElementById('tb_title').height;
var height_div_body=document.documentElement.clientHeight-(parseInt(height_tb_header)+parseInt(height_tb_menu)+parseInt(height_tb_title));
div_body.style.height=height_div_body+'px';
}
function validationobject(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
//alert(spobjval[1]);if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function validationobjectwithmsg(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
alert(spobjval[1]);
if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
//bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function findselectedvalue(objcombo,val)
{
jQuery("#"+objcombo).find("option:contains('"+val+"')").each(function()
{
if( jQuery(this).text() == val )
{
jQuery(this).attr("selected","selected");
}
});
}
function elementtouppercase(obj)
{
obj.value=obj.value.toUpperCase();
}
function clearobject(spobject,objfocus)
{
var obj=spobject.split(';');
for(i=0;i<obj.length;i++)
{
var myobj=document.getElementById(obj[i]);
myobj.value='';
}
if(objfocus){$('#'+objfocus).focus();}
}
// === GLobal Event For Element TextBlink css class 26-01-2014 10:89 AM
$('.textblink').each(function(){
var elem = $(this);
setInterval(function(){
if (elem.css('visibility') == 'hidden')
{elem.css('visibility', 'visible');}
else
{elem.css('visibility', 'hidden');}
}, 550);
});
// === GLobal Event For Element UpperCase Element css class 29-01-2014 11:35 AM
//$('.uppercase').live('keyup',function(){alert('t');$(this).val().toUpperCase();});
// === Disabled Backward Page
$(document).keydown(function(e) {
var doPrevent;
if (e.keyCode == 8){
var d = e.srcElement || e.target;
if (d.tagName.toUpperCase() == 'INPUT' || d.tagName.toUpperCase() == 'TEXTAREA')
{
doPrevent = d.readOnly || d.disabled;
}
else
doPrevent = true;
}
else
doPrevent = false;
if (doPrevent)
e.preventDefault();
});
//$('input[type="text"]').change(function() {alert('t');
// $(this).css({'background-color':'white'});
//});

View File

@ -0,0 +1,715 @@
var thetokenlengthexist=0;
var ajaxcall;//var runajaxfunction;
// ==== event keypress to Tab
$('input, select, textarea').live('keydown',function(e){
if(e.keyCode==13&&$(this).val()!='')
{
var focusable = $('input,a,select,button,textarea').filter(':visible');
focusable.eq(focusable.index(this)+1).focus();
return false;
}
});
function nextfocus(objsrc,objtarget)
{
//alert(objsrc+' '+objtarget);
$("#"+objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
//alert(key);
if(key==13&&$("#"+objsrc).val()!='')
{
//alert(key+' '+objtarget);
if(objtarget)
{
//$("#"+objtarget).attr('disabled',false);
$("#"+objtarget).focus();
}
else
{
e.keyCode=9;
}
}//$("#"+objtarget).focus();}
});
}
function nextfocusnew(objsrc,objtarget)
{
//alert(objsrc);
$(objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$(objsrc).val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
}
// ===== Number Validation
function numberonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; // alert(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=46&&unicode!=13)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
function ipkonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=190&&unicode!=46&&unicode!=110)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
// ===== Char Validation
function charonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Char And Symbol Validation
function charsimbolonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39&&unicode!=43&&unicode!=45)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Address Validation
function addressonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//var mychar=String.fromCharCode(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111)
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111&&unicode!=173&&unicode!=37&&unicode!=46&&unicode!=39&&unicode!=36&&unicode!=35)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
function skonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
if(unicode!=8&&unicode!=9&&unicode!=47&&unicode!=45)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
//else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
// ===== Number and characterValidation
function numbercharonly(e,withuppercase)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
if(withuppercase)
{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
}
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:19 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=45)
{
//if(unicode<48||unicode>57){return false;}
//alert(unicode);
if((unicode>=48&&unicode<=57)||(unicode>=65&&unicode<=90)){}
else{return false;}
}
}
function teleponcharonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=45&&unicode!=95)
{
if(unicode>=48&&unicode<=57){return true;}
else{return false;}
}
}
function ajaxuri(obj,task,divtarget,withmsginfo,runfunction)
{
//alert(task);
if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var x=0;
ajaxcall=$.ajax({
type:'POST',
url:'index.php',
cache:false,
data:'ajax=1&sec=1&option='+obj+'&'+task,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(result){
var sp=result.split('|');
var valresult=result;
if(sp.length>1)
{
category=sp[0];
if(category=='msg'){msgtext=sp[1];valresult=sp[2];bootbox.alert(msgtext);}
}
$('#'+divtarget).show();
//bootbox.alert('test');
$('#'+divtarget).html(valresult);
if(runfunction){runfunction();}
}
});
}
function ajaxuridhtmlx(obj,task)
{
//alert(obj+task);
//if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var ajaxcall=$.ajax({
type:'POST',
url:'index.php',
data:'ajax=1&sec=1&option='+obj+'&'+task,
dataType: 'html',
context: document.body,
global: false,
async:false,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(data){
//$('#divtest').html(data);
}
}).responseText;
return ajaxcall;
}
function fn_dhtmlxsetfocus(form,objform)
{
form.setItemFocus(objform);
}
function fn_dhtmlxloadobject(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxsenddata(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxmessage(dtype,msg)
{
return dhtmlx.message({type:dtype,text:msg});
}
function fn_dhtmlxconfirm(mytitle,mytext)
{
dhtmlx.confirm({
title: mytitle,
type:'confirm',
ok:"Yes",cancel:"No",
text: mytext,
callback: function(result){return result;}
});
}
//$.when(ajaxcall).then(function(){alert('test');})
function TokenInput(obj,jurl,objnextfocus)
{
var map={};
var result=[];
//var locateurl=jurl;
//alert(obj);
$("#"+obj+"1").val('');
$("#"+obj).val('');
$('#'+obj).typeahead({
source:function(query,process){
//var locateurl=jurl;
$.ajax({
url:'index.php',
type:'POST',
data:jurl+query,
datatype:'JSON',
async:true,
success:function(data){
label=[];
result=JSON.parse(data);
$.each(result, function (i, item)
{
//if(item=='Record Not Found'){map[item.label]='';label.push('Record Not Found');break;}
map[item.label] = name.value;
label.push(item.label);
});
process(label);
//process(JSON.parse(data));
}
});
},
updater: function(item) {
for(var i=0;i<result.length;i++)
{
if(result[i].label==item)
{
$("#"+obj+"1").val(result[i].id);
thetokenlengthexit=item.length;
$("#"+objnextfocus).focus();
break;
}
}
return item;
//alert(map[item].id);
//var item=JSON.parse(item);
//$('#t1').val(item.label);return item;
//alert("selec"+map[item].id);//return item;
},
highlighter:function(item){
var bld="<i>"+item+"</i>";
return bld;
}
});
}
//(function ($, window, delay) {
// var theTimer = 0;
// var theElement = null;
// var theLastPosition = {x:0,y:0};
// $('[data-toggle]')
//.closest('li')
// .on('mouseenter', function (inEvent) {
// if (theElement) theElement.removeClass('open');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mousemove', function (inEvent) {
// if(Math.abs(theLastPosition.x - inEvent.ScreenX) > 4 ||
// Math.abs(theLastPosition.y - inEvent.ScreenY) > 4)
// {
// theLastPosition.x = inEvent.ScreenX;
// theLastPosition.y = inEvent.ScreenY;
// return;
// }
//
// if (theElement.hasClass('open')) return;
// window.clearTimeout(theTimer);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mouseleave', function (inEvent) {$(this).closest('li');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.removeClass('open');
// }, delay);
// });
//})(jQuery, window, 200); // 200 is the delay in milliseconds
//$(document).ready(function(){
//$('ul.dropdown-menu').mouseout(function(){
// $('[data-toggle="dropdown"]').parent().removeClass('open');
//});})
// ==== MOdified 19 September 2013 11:24 Am
$(document).ready(function () {
$('ul.nav').each(function(){
$(this).on("mouseleave",function(){
$('li.dropdown').each(function () {
$(this).removeClass('open');
});
});
});
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
});
// ==== 6 February 2014 14:54 pm
$(function(){
$('.input').live("keypress", function(e){
//$('.nextfocus').keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$this.val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
});
$(function(){
$('.input').live("keyup", function(e){
//$('.nextfocus').keypress(function(e){
this.value=this.value.toUpperCase();
});
});
// ==== Public function
function showmaskingrupiah(valuess)
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
if(valuess)
{
mydivrupiah.style.visibility='visible';
lblrupiah.innerHTML=numberformat(valuess);
}
else
{
mydivrupiah.style.visibility='hidden';
}
}
function hidemaskingrupiah()
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
mydivrupiah.style.visibility='hidden';
}
function roundednumber(valuess,decimalplaces) // ==== created 25 Oktober 2012 7:15 AM
{
var sp=valuess.split('.');
var rtn='0.00';
if(sp.length>1)
{
var dec=sp[1].substring(0,decimalplaces);
if(parseInt(sp[1].substring(decimalplaces,decimalplaces+1))>5&&parseInt(sp[1].substring(decimalplaces,decimalplaces+1))<9)
{
dec=sp[1].substring(decimalplaces,decimalplaces+1);
dec=parseInt(sp[1].substring(0,decimalplaces))+1;
}
if(parseInt(dec)>=90)
{
sp[0]=parseInt(sp[0])+1;dec='00';
}
rtn=sp[0]+'.'+dec;
}
else
{
rtn=valuess;
}
return rtn;
}
function jqajax(params,div_result,withloadergif)
{
if(withloadergif)
{
//$("#"+div_result).html('<img src=/images/loader.gif/>');
}
$.get(params,function(data,status){
var result=data;
if(("#"+div_result).length>0)
{
$("#"+div_result).html(result);
return true;
}
});
}
function plocateurl(com_name,task,criteria,div_target,msg,noprogress)
{
params='ajax=1&option='+com_name+'&task='+task+'&'+criteria;
if(!msg){msg='wait';}
loadObject(params,div_target,msg,noprogress);
}
function ajaxurinewtab(obj_folder,obj_name,task,params)
{
url='?ajax=1&sec=1&dec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//alert(url);
$('#fmpreview').prop('action',url);
$('#fmpreview').submit();
//url='ajax=1&sec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//$('#uri').val(url);
//$('#fmpreview').submit();
}
function loadNewWindow(url,pagewidth,pageheight,scrollbar)
{
document.body.style.cursor='wait';
if(!pagewidth){pagewidth=450;}
if(!pageheight){pageheight=550;}
if(!scrollbar&&scrollbar!=0){scrollbar=1;}
//scrollbar=1;
parentwin=window.open(url,"_blank","top=0,left=0,width="+pagewidth+",height="+pageheight+",toolbar=0,menubar=0,statusbar=0,location=0,scrollbars="+scrollbar);
if(pagewidth=='100%'){parentwin.resizeTo(screen.width-40,pageheight);}
document.body.style.cursor='default';
}
function showdate(objTextBox,dateformat)
{
if(!dateformat){dateformat='dd/mm/yy';}
$('#'+objTextBox).datepicker({dateFormat: dateformat });
}
function closeobj(obj,objvalue)
{
var myobj=document.getElementById(obj);
if(objvalue)
{
var myobjvalue=document.getElementById(objvalue);
myobjvalue.value='';
}
myobj.style.visibility='hidden';
}
function setpos_Popup(objpopup,objtarget)
{
//alert(objpopup);
var x=fn_get_objtext_posX(objtarget);
var y=fn_get_objtext_posY(objtarget);
var objdisplay=document.getElementById(objpopup);
objdisplay.style.visibility='visible';
objdisplay.style.marginTop=parseInt(document.getElementById(objtarget).offsetHeight)+parseInt(y);
objdisplay.style.marginLeft=parseInt(x);
}
function fn_get_objtext_posX(objtext)
{
var pos_x= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_x+= obj.offsetLeft;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.x)
{pos_x+=obj.x;}
return pos_x;
}
function fn_get_objtext_posY(objtext)
{
var pos_y= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_y+=obj.offsetTop;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.y)
{pos_y+=obj.y;}
return pos_y;
}
function fn_clsnumberformat(values){return values.replace(/,/gi,'');}
function trim(textstring){return textstring.replace(/^\s+|\s+$/g,'');}
function loadautocomplete(objtextbox,url){setAutoComplete(objtextbox, 'results', url);}
function initial()
{
var div_body=document.getElementById('div_body');
var height_tb_header=document.getElementById('tb_header').height;
var height_tb_menu=document.getElementById('tb_menu').height;
var height_tb_title=document.getElementById('tb_title').height;
var height_div_body=document.documentElement.clientHeight-(parseInt(height_tb_header)+parseInt(height_tb_menu)+parseInt(height_tb_title));
div_body.style.height=height_div_body+'px';
}
function validationobject(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
//alert(spobjval[1]);if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function validationobjectwithmsg(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
alert(spobjval[1]);
if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
//bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function findselectedvalue(objcombo,val)
{
jQuery("#"+objcombo).find("option:contains('"+val+"')").each(function()
{
if( jQuery(this).text() == val )
{
jQuery(this).attr("selected","selected");
}
});
}
function elementtouppercase(obj)
{
obj.value=obj.value.toUpperCase();
}
function clearobject(spobject,objfocus)
{
var obj=spobject.split(';');
for(i=0;i<obj.length;i++)
{
var myobj=document.getElementById(obj[i]);
myobj.value='';
}
if(objfocus){$('#'+objfocus).focus();}
}
// === GLobal Event For Element TextBlink css class 26-01-2014 10:89 AM
$('.textblink').each(function(){
var elem = $(this);
setInterval(function(){
if (elem.css('visibility') == 'hidden')
{elem.css('visibility', 'visible');}
else
{elem.css('visibility', 'hidden');}
}, 550);
});
// === GLobal Event For Element UpperCase Element css class 29-01-2014 11:35 AM
//$('.uppercase').live('keyup',function(){alert('t');$(this).val().toUpperCase();});
// === Disabled Backward Page
$(document).keydown(function(e) {
var doPrevent;
if (e.keyCode == 8) {
var d = e.srcElement || e.target;
if (d.tagName.toUpperCase() == 'INPUT' || d.tagName.toUpperCase() == 'TEXTAREA') {
doPrevent = d.readOnly || d.disabled;
}
else
doPrevent = true;
}
else
doPrevent = false;
if (doPrevent)
e.preventDefault();
});
$(document).keypress(function(e){
if(e.keyCode==116){
return false;
}
});
//$('input[type="text"]').change(function() {alert('t');
// $(this).css({'background-color':'white'});
//});

View File

@ -0,0 +1,734 @@
var thetokenlengthexist=0;
var ajaxcall;//var runajaxfunction;
// ==== event keypress to Tab
$('input, select, textarea').live('keydown',function(e){
if(e.keyCode==13&&$(this).val()!='')
{
var focusable = $('input,a,select,button,textarea').filter(':visible');
focusable.eq(focusable.index(this)+1).focus();
return false;
}
});
function nextfocus(objsrc,objtarget)
{
//alert(objsrc+' '+objtarget);
$("#"+objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
//alert(key);
if(key==13&&$("#"+objsrc).val()!='')
{
//alert(key+' '+objtarget);
if(objtarget)
{
//$("#"+objtarget).attr('disabled',false);
$("#"+objtarget).focus();
}
else
{
e.keyCode=9;
}
}//$("#"+objtarget).focus();}
});
}
function nextfocusnew(objsrc,objtarget)
{
//alert(objsrc);
$(objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$(objsrc).val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
}
// ===== Number Validation
function numberonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; // alert(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=46&&unicode!=13)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
function ipkonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=190&&unicode!=46&&unicode!=110)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
// ===== Char Validation
function charonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Char And Symbol Validation
function charsimbolonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39&&unicode!=43&&unicode!=45)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Address Validation
function addressonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//var mychar=String.fromCharCode(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111)
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111&&unicode!=173&&unicode!=37&&unicode!=46&&unicode!=39&&unicode!=36&&unicode!=35)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
function skonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
if(unicode!=8&&unicode!=9&&unicode!=47&&unicode!=45)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
//else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
// ===== Number and characterValidation
function numbercharonly(e,withuppercase)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
if(withuppercase)
{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
}
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:19 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=45)
{
//if(unicode<48||unicode>57){return false;}
//alert(unicode);
if((unicode>=48&&unicode<=57)||(unicode>=65&&unicode<=90)){}
else{return false;}
}
}
function teleponcharonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=45&&unicode!=95)
{
if(unicode>=48&&unicode<=57){return true;}
else{return false;}
}
}
function ajaxuri(obj,task,divtarget,withmsginfo,runfunction)
{
//alert(task);
if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var x=0;
ajaxcall=$.ajax({
type:'POST',
url:'index.php',
cache:false,
data:'ajax=1&sec=1&option='+obj+'&'+task,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(result){
var sp=result.split('|');
var valresult=result;
if(sp.length>1)
{
category=sp[0];
if(category=='msg'){msgtext=sp[1];valresult=sp[2];bootbox.alert(msgtext);}
}
$('#'+divtarget).show();
//bootbox.alert('test');
$('#'+divtarget).html(valresult);
if(runfunction){runfunction();}
}
});
}
function ajaxuridhtmlx(obj,task)
{
//alert(obj+task);
//if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var ajaxcall=$.ajax({
type:'POST',
url:'index.php',
data:'ajax=1&sec=1&option='+obj+'&'+task,
dataType: 'html',
context: document.body,
global: false,
async:false,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(data){
//$('#divtest').html(data);
}
}).responseText;
return ajaxcall;
}
function fn_dhtmlxsetfocus(form,objform)
{
form.setItemFocus(objform);
}
function fn_dhtmlxloadobject(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxsenddata(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxmessage(dtype,msg)
{
return dhtmlx.message({type:dtype,text:msg});
}
function fn_dhtmlxconfirm(mytitle,mytext)
{
dhtmlx.confirm({
title: mytitle,
type:'confirm',
ok:"Yes",cancel:"No",
text: mytext,
callback: function(result){return result;}
});
}
function fn_dhtmlxtabbarisexist(tabbId)
{
var isTabCreated=false;
myTabbar.forEachCell(function(cell){
var id=cell.getId();
//alert(id+' '+tabbId);
if(id==tabbId){isTabCreated=true;}
});
return isTabCreated;
}
//$.when(ajaxcall).then(function(){alert('test');})
function TokenInput(obj,jurl,objnextfocus)
{
var map={};
var result=[];
//var locateurl=jurl;
//alert(obj);
$("#"+obj+"1").val('');
$("#"+obj).val('');
$('#'+obj).typeahead({
source:function(query,process){
//var locateurl=jurl;
$.ajax({
url:'index.php',
type:'POST',
data:jurl+query,
datatype:'JSON',
async:true,
success:function(data){
label=[];
result=JSON.parse(data);
$.each(result, function (i, item)
{
//if(item=='Record Not Found'){map[item.label]='';label.push('Record Not Found');break;}
map[item.label] = name.value;
label.push(item.label);
});
process(label);
//process(JSON.parse(data));
}
});
},
updater: function(item) {
for(var i=0;i<result.length;i++)
{
if(result[i].label==item)
{
$("#"+obj+"1").val(result[i].id);
thetokenlengthexit=item.length;
$("#"+objnextfocus).focus();
break;
}
}
return item;
//alert(map[item].id);
//var item=JSON.parse(item);
//$('#t1').val(item.label);return item;
//alert("selec"+map[item].id);//return item;
},
highlighter:function(item){
var bld="<i>"+item+"</i>";
return bld;
}
});
}
//(function ($, window, delay) {
// var theTimer = 0;
// var theElement = null;
// var theLastPosition = {x:0,y:0};
// $('[data-toggle]')
//.closest('li')
// .on('mouseenter', function (inEvent) {
// if (theElement) theElement.removeClass('open');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mousemove', function (inEvent) {
// if(Math.abs(theLastPosition.x - inEvent.ScreenX) > 4 ||
// Math.abs(theLastPosition.y - inEvent.ScreenY) > 4)
// {
// theLastPosition.x = inEvent.ScreenX;
// theLastPosition.y = inEvent.ScreenY;
// return;
// }
//
// if (theElement.hasClass('open')) return;
// window.clearTimeout(theTimer);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mouseleave', function (inEvent) {$(this).closest('li');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.removeClass('open');
// }, delay);
// });
//})(jQuery, window, 200); // 200 is the delay in milliseconds
//$(document).ready(function(){
//$('ul.dropdown-menu').mouseout(function(){
// $('[data-toggle="dropdown"]').parent().removeClass('open');
//});})
// ==== MOdified 19 September 2013 11:24 Am
$(document).ready(function () {
$('ul.nav').each(function(){
$(this).on("mouseleave",function(){
$('li.dropdown').each(function () {
$(this).removeClass('open');
});
});
});
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
});
// ==== 6 February 2014 14:54 pm
$(function(){
$('.input').live("keypress", function(e){
//$('.nextfocus').keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$this.val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
});
$(function(){
$('.input').live("keyup", function(e){
//$('.nextfocus').keypress(function(e){
this.value=this.value.toUpperCase();
});
});
// ==== Public function
function showmaskingrupiah(valuess)
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
if(valuess)
{
mydivrupiah.style.visibility='visible';
lblrupiah.innerHTML=numberformat(valuess);
}
else
{
mydivrupiah.style.visibility='hidden';
}
}
function hidemaskingrupiah()
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
mydivrupiah.style.visibility='hidden';
}
function roundednumber(valuess,decimalplaces) // ==== created 25 Oktober 2012 7:15 AM
{
var sp=valuess.split('.');
var rtn='0.00';
if(sp.length>1)
{
var dec=sp[1].substring(0,decimalplaces);
if(parseInt(sp[1].substring(decimalplaces,decimalplaces+1))>5&&parseInt(sp[1].substring(decimalplaces,decimalplaces+1))<9)
{
dec=sp[1].substring(decimalplaces,decimalplaces+1);
dec=parseInt(sp[1].substring(0,decimalplaces))+1;
}
if(parseInt(dec)>=90)
{
sp[0]=parseInt(sp[0])+1;dec='00';
}
rtn=sp[0]+'.'+dec;
}
else
{
rtn=valuess;
}
return rtn;
}
function jqajax(params,div_result,withloadergif)
{
if(withloadergif)
{
//$("#"+div_result).html('<img src=/images/loader.gif/>');
}
$.get(params,function(data,status){
var result=data;
if(("#"+div_result).length>0)
{
$("#"+div_result).html(result);
return true;
}
});
}
function plocateurl(com_name,task,criteria,div_target,msg,noprogress)
{
params='ajax=1&option='+com_name+'&task='+task+'&'+criteria;
if(!msg){msg='wait';}
loadObject(params,div_target,msg,noprogress);
}
function ajaxurinewtab(obj_folder,obj_name,task,params)
{
url='?ajax=1&sec=1&dec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//alert(url);
$('#fmpreview').prop('action',url);
$('#fmpreview').submit();
//url='ajax=1&sec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//$('#uri').val(url);
//$('#fmpreview').submit();
}
function loadNewWindow(url,pagewidth,pageheight,scrollbar)
{
document.body.style.cursor='wait';
if(!pagewidth){pagewidth=450;}
if(!pageheight){pageheight=550;}
if(!scrollbar&&scrollbar!=0){scrollbar=1;}
//scrollbar=1;
parentwin=window.open(url,"_blank","top=0,left=0,width="+pagewidth+",height="+pageheight+",toolbar=0,menubar=0,statusbar=0,location=0,scrollbars="+scrollbar);
if(pagewidth=='100%'){parentwin.resizeTo(screen.width-40,pageheight);}
document.body.style.cursor='default';
}
function showdate(objTextBox,dateformat)
{
if(!dateformat){dateformat='dd/mm/yy';}
$('#'+objTextBox).datepicker({dateFormat: dateformat });
}
function closeobj(obj,objvalue)
{
var myobj=document.getElementById(obj);
if(objvalue)
{
var myobjvalue=document.getElementById(objvalue);
myobjvalue.value='';
}
myobj.style.visibility='hidden';
}
function setpos_Popup(objpopup,objtarget)
{
//alert(objpopup);
var x=fn_get_objtext_posX(objtarget);
var y=fn_get_objtext_posY(objtarget);
var objdisplay=document.getElementById(objpopup);
objdisplay.style.visibility='visible';
objdisplay.style.marginTop=parseInt(document.getElementById(objtarget).offsetHeight)+parseInt(y);
objdisplay.style.marginLeft=parseInt(x);
}
function fn_get_objtext_posX(objtext)
{
var pos_x= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_x+= obj.offsetLeft;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.x)
{pos_x+=obj.x;}
return pos_x;
}
function fn_get_objtext_posY(objtext)
{
var pos_y= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_y+=obj.offsetTop;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.y)
{pos_y+=obj.y;}
return pos_y;
}
function fn_numberformat(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)){x1 = x1.replace(rgx, '$1' + '.' + '$2');}
return x1 + x2;
}
function fn_clsnumberformat(values){return values.replace(/,/gi,'');}
function trim(textstring){return textstring.replace(/^\s+|\s+$/g,'');}
function loadautocomplete(objtextbox,url){setAutoComplete(objtextbox, 'results', url);}
function initial()
{
var div_body=document.getElementById('div_body');
var height_tb_header=document.getElementById('tb_header').height;
var height_tb_menu=document.getElementById('tb_menu').height;
var height_tb_title=document.getElementById('tb_title').height;
var height_div_body=document.documentElement.clientHeight-(parseInt(height_tb_header)+parseInt(height_tb_menu)+parseInt(height_tb_title));
div_body.style.height=height_div_body+'px';
}
function validationobject(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
//alert(spobjval[1]);if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function validationobjectwithmsg(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
alert(spobjval[1]);
if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
//bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function findselectedvalue(objcombo,val)
{
jQuery("#"+objcombo).find("option:contains('"+val+"')").each(function()
{
if( jQuery(this).text() == val )
{
jQuery(this).attr("selected","selected");
}
});
}
function elementtouppercase(obj)
{
obj.value=obj.value.toUpperCase();
}
function clearobject(spobject,objfocus)
{
var obj=spobject.split(';');
for(i=0;i<obj.length;i++)
{
var myobj=document.getElementById(obj[i]);
myobj.value='';
}
if(objfocus){$('#'+objfocus).focus();}
}
// === GLobal Event For Element TextBlink css class 26-01-2014 10:89 AM
$('.textblink').each(function(){
var elem = $(this);
setInterval(function(){
if (elem.css('visibility') == 'hidden')
{elem.css('visibility', 'visible');}
else
{elem.css('visibility', 'hidden');}
}, 550);
});
// === GLobal Event For Element UpperCase Element css class 29-01-2014 11:35 AM
//$('.uppercase').live('keyup',function(){alert('t');$(this).val().toUpperCase();});
// === Disabled Backward Page
$(document).keydown(function(e) {
var doPrevent;
if (e.keyCode == 8){
var d = e.srcElement || e.target;
if (d.tagName.toUpperCase() == 'INPUT' || d.tagName.toUpperCase() == 'TEXTAREA')
{
doPrevent = d.readOnly || d.disabled;
}
else
doPrevent = true;
}
else
doPrevent = false;
if (doPrevent)
e.preventDefault();
});
//$('input[type="text"]').change(function() {alert('t');
// $(this).css({'background-color':'white'});
//});

View File

@ -0,0 +1,753 @@
var thetokenlengthexist=0;
var ajaxcall;//var runajaxfunction;
// ==== event keypress to Tab
//$('input, select, textarea').live('keydown',function(e){
// if(e.keyCode==13&&$(this).val()!='')
// {
// var focusable = $('input,a,select,button,textarea').filter(':visible');
// focusable.eq(focusable.index(this)+1).focus();
// return false;
// }
//});
function nextfocus(objsrc,objtarget)
{
//alert(objsrc+' '+objtarget);
$("#"+objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
//alert(key);
if(key==13&&$("#"+objsrc).val()!='')
{
//alert(key+' '+objtarget);
if(objtarget)
{
//$("#"+objtarget).attr('disabled',false);
$("#"+objtarget).focus();
}
else
{
e.keyCode=9;
}
}//$("#"+objtarget).focus();}
});
}
function nextfocusnew(objsrc,objtarget)
{
//alert(objsrc);
$(objsrc).keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$(objsrc).val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
}
// ===== Number Validation
function numberonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; // alert(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=46&&unicode!=13)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
function ipkonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39&&unicode!=190&&unicode!=46&&unicode!=110)
{
if(unicode>=48&&unicode<=57){return true;}
else if((unicode>=96&&unicode<=105)){return true;}
else {return false;}
}
}
// ===== Char Validation
function charonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Char And Symbol Validation
function charsimbolonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//if(withuppercase)
//{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
//alert(unicode);
//}
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=37&&unicode!=39&&unicode!=43&&unicode!=45)
{
//alert(unicode);
if((unicode<65||unicode>90)){return false;}
}
}
// ===== Address Validation
function addressonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
//var mychar=String.fromCharCode(unicode);
//if(unicode!=8&&unicode!=9&&unicode!=46&&unicode!=37&&unicode!=39)
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:21 Am ( Unicode==39 )Free keycode for single Quote
//if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111)
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=32&&unicode!=188&&unicode!=190&&unicode!=191&&unicode!=110&&unicode!=109&&unicode!=111&&unicode!=173&&unicode!=37&&unicode!=46&&unicode!=39&&unicode!=36&&unicode!=35)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
function skonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ; //alert(unicode);
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
if(unicode!=8&&unicode!=9&&unicode!=47&&unicode!=45)
{
if(unicode>=48&&unicode<=57){return true;}
else if(unicode>=65&&unicode<=90){return true;}
//else if(unicode>=96&&unicode<=105){return true;}
else {return false;}
//if(unicode<48||unicode>57){return false;}
//if((unicode<65||unicode>90)){return false;}
}
}
// ===== Number and characterValidation
function numbercharonly(e,withuppercase)
{
var unicode=e.charCode? e.charCode : e.keyCode ;
if(withuppercase)
{
unicode=String.fromCharCode(unicode).toUpperCase().charCodeAt(0);
}
//if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=39) ==> Modified 25-01-2014 09:19 Am ( Unicode==39 )Free keycode for single Quote
//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=37&&unicode!=45)
{
//if(unicode<48||unicode>57){return false;}
//alert(unicode);
if((unicode>=48&&unicode<=57)||(unicode>=65&&unicode<=90)){}
else{return false;}
}
}
function teleponcharonly(e)
{
var unicode=e.charCode? e.charCode : e.keyCode ;//alert(unicode);
if(unicode!=8&&unicode!=9&&unicode!=45&&unicode!=95)
{
if(unicode>=48&&unicode<=57){return true;}
else{return false;}
}
}
function ajaxuri(obj,task,divtarget,withmsginfo,runfunction)
{
//alert(task);
if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var x=0;
ajaxcall=$.ajax({
type:'POST',
url:'index.php',
cache:false,
data:'ajax=1&sec=1&option='+obj+'&'+task,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(result){
var sp=result.split('|');
var valresult=result;
if(sp.length>1)
{
category=sp[0];
if(category=='msg'){msgtext=sp[1];valresult=sp[2];bootbox.alert(msgtext);}
}
$('#'+divtarget).show();
//bootbox.alert('test');
$('#'+divtarget).html(valresult);
if(runfunction){runfunction();}
}
});
}
function ajaxuridhtmlx(obj,task)
{
//alert(obj+task);
//if(withmsginfo){$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />');}
var ajaxcall=$.ajax({
type:'POST',
url:'index.php',
data:'ajax=1&sec=1&option='+obj+'&'+task,
dataType: 'html',
context: document.body,
global: false,
async:false,
beforeSend:function(data){
//$('#'+divtarget).html('t');
//$('#'+divtarget).html('wait <img src="themes/images/loader.gif" />'+x);
},
success:function(data){
//$('#divtest').html(data);
}
}).responseText;
return ajaxcall;
}
function fn_dhtmlxsetfocus(form,objform)
{
form.setItemFocus(objform);
}
function fn_dhtmlxloadobject(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxsenddata(obj,task)
{
//alert("?ajax=1&sec=1&option="+obj+"&"+task);
return "?ajax=1&sec=1&option="+obj+"&"+task;
}
function fn_dhtmlxmessage(dtype,msg)
{
return dhtmlx.message({type:dtype,text:msg,expire:3000});
}
function fn_dhtmlxconfirm(mytitle,mytext)
{
dhtmlx.confirm({
title: mytitle,
type:'confirm',
ok:"Yes",cancel:"No",
text: mytext,
callback: function(result){return result;}
});
}
function fn_dhtmlxtabbarisexist(tabbId)
{
var isTabCreated=false;
myTabbar.forEachCell(function(cell){
var id=cell.getId();
//alert(id+' '+tabbId);
if(id==tabbId){isTabCreated=true;}
});
return isTabCreated;
}
//$.when(ajaxcall).then(function(){alert('test');})
function TokenInput(obj,jurl,objnextfocus)
{
var map={};
var result=[];
//var locateurl=jurl;
//alert(obj);
$("#"+obj+"1").val('');
$("#"+obj).val('');
$('#'+obj).typeahead({
source:function(query,process){
//var locateurl=jurl;
$.ajax({
url:'index.php',
type:'POST',
data:jurl+query,
datatype:'JSON',
async:true,
success:function(data){
label=[];
result=JSON.parse(data);
$.each(result, function (i, item)
{
//if(item=='Record Not Found'){map[item.label]='';label.push('Record Not Found');break;}
map[item.label] = name.value;
label.push(item.label);
});
process(label);
//process(JSON.parse(data));
}
});
},
updater: function(item) {
for(var i=0;i<result.length;i++)
{
if(result[i].label==item)
{
$("#"+obj+"1").val(result[i].id);
thetokenlengthexit=item.length;
$("#"+objnextfocus).focus();
break;
}
}
return item;
//alert(map[item].id);
//var item=JSON.parse(item);
//$('#t1').val(item.label);return item;
//alert("selec"+map[item].id);//return item;
},
highlighter:function(item){
var bld="<i>"+item+"</i>";
return bld;
}
});
}
function fn_diffmonth(dt1,dt2)
{
var months;
months = (dt2.getFullYear() - dt1.getFullYear()) * 12;
months += dt2.getMonth() - dt1.getMonth();
return months;
}
//(function ($, window, delay) {
// var theTimer = 0;
// var theElement = null;
// var theLastPosition = {x:0,y:0};
// $('[data-toggle]')
//.closest('li')
// .on('mouseenter', function (inEvent) {
// if (theElement) theElement.removeClass('open');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mousemove', function (inEvent) {
// if(Math.abs(theLastPosition.x - inEvent.ScreenX) > 4 ||
// Math.abs(theLastPosition.y - inEvent.ScreenY) > 4)
// {
// theLastPosition.x = inEvent.ScreenX;
// theLastPosition.y = inEvent.ScreenY;
// return;
// }
//
// if (theElement.hasClass('open')) return;
// window.clearTimeout(theTimer);
// theTimer = window.setTimeout(function () {
// theElement.addClass('open');
// }, delay);
// })
// .on('mouseleave', function (inEvent) {$(this).closest('li');
// window.clearTimeout(theTimer);
// theElement = $(this);
// theTimer = window.setTimeout(function () {
// theElement.removeClass('open');
// }, delay);
// });
//})(jQuery, window, 200); // 200 is the delay in milliseconds
//$(document).ready(function(){
//$('ul.dropdown-menu').mouseout(function(){
// $('[data-toggle="dropdown"]').parent().removeClass('open');
//});})
// ==== MOdified 19 September 2013 11:24 Am
$(document).ready(function () {
$('ul.nav').each(function(){
$(this).on("mouseleave",function(){
$('li.dropdown').each(function () {
$(this).removeClass('open');
});
});
});
if(typeof String.prototype.trim !== 'function') {
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, '');
}
}
});
// ==== 6 February 2014 14:54 pm
$(function(){
$('.input').live("keypress", function(e){
//$('.nextfocus').keypress(function(e){
var key=(e.keyCode ? e.keyCode : e.which);
if(key==13&&$this.val()!=''){e.keyCode=9;}//$("#"+objtarget).focus();}
});
});
$(function(){
$('.input').live("keyup", function(e){
//$('.nextfocus').keypress(function(e){
this.value=this.value.toUpperCase();
});
});
// ==== Public function
function showmaskingrupiah(valuess)
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
if(valuess)
{
mydivrupiah.style.visibility='visible';
lblrupiah.innerHTML=numberformat(valuess);
}
else
{
mydivrupiah.style.visibility='hidden';
}
}
function hidemaskingrupiah()
{
var mydivrupiah=document.getElementById('div_rupiahs');
var lblrupiah=document.getElementById('lblrupiahs');
lblrupiah.value='0.00';
mydivrupiah.style.visibility='hidden';
}
function roundednumber(valuess,decimalplaces) // ==== created 25 Oktober 2012 7:15 AM
{
var sp=valuess.split('.');
var rtn='0.00';
if(sp.length>1)
{
var dec=sp[1].substring(0,decimalplaces);
if(parseInt(sp[1].substring(decimalplaces,decimalplaces+1))>5&&parseInt(sp[1].substring(decimalplaces,decimalplaces+1))<9)
{
dec=sp[1].substring(decimalplaces,decimalplaces+1);
dec=parseInt(sp[1].substring(0,decimalplaces))+1;
}
if(parseInt(dec)>=90)
{
sp[0]=parseInt(sp[0])+1;dec='00';
}
rtn=sp[0]+'.'+dec;
}
else
{
rtn=valuess;
}
return rtn;
}
function jqajax(params,div_result,withloadergif)
{
if(withloadergif)
{
//$("#"+div_result).html('<img src=/images/loader.gif/>');
}
$.get(params,function(data,status){
var result=data;
if(("#"+div_result).length>0)
{
$("#"+div_result).html(result);
return true;
}
});
}
function plocateurl(com_name,task,criteria,div_target,msg,noprogress)
{
params='ajax=1&option='+com_name+'&task='+task+'&'+criteria;
if(!msg){msg='wait';}
loadObject(params,div_target,msg,noprogress);
}
function ajaxurinewtab(obj_folder,obj_name,task,params)
{
url='?ajax=1&sec=1&dec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//alert(url);
$('#fmpreview').prop('action',url);
$('#fmpreview').submit();
//url='ajax=1&sec=1&option='+obj_folder+'&obj='+obj_name+'&task='+task+'&'+params;
//$('#uri').val(url);
//$('#fmpreview').submit();
}
function loadNewWindow(url,pagewidth,pageheight,scrollbar)
{
document.body.style.cursor='wait';
if(!pagewidth){pagewidth=450;}
if(!pageheight){pageheight=550;}
if(!scrollbar&&scrollbar!=0){scrollbar=1;}
//scrollbar=1;
parentwin=window.open(url,"_blank","top=0,left=0,width="+pagewidth+",height="+pageheight+",toolbar=0,menubar=0,statusbar=0,location=0,scrollbars="+scrollbar);
if(pagewidth=='100%'){parentwin.resizeTo(screen.width-40,pageheight);}
document.body.style.cursor='default';
}
function addDays(startDate,numberOfDays)
{
//alert(startDate);
var returnDate = new Date(
startDate.getFullYear(),
startDate.getMonth(),
startDate.getDate()+numberOfDays,
startDate.getHours(),
startDate.getMinutes(),
startDate.getSeconds());
return returnDate;
}
function showdate(objTextBox,dateformat)
{
if(!dateformat){dateformat='dd/mm/yy';}
$('#'+objTextBox).datepicker({dateFormat: dateformat });
}
function closeobj(obj,objvalue)
{
var myobj=document.getElementById(obj);
if(objvalue)
{
var myobjvalue=document.getElementById(objvalue);
myobjvalue.value='';
}
myobj.style.visibility='hidden';
}
function setpos_Popup(objpopup,objtarget)
{
//alert(objpopup);
var x=fn_get_objtext_posX(objtarget);
var y=fn_get_objtext_posY(objtarget);
var objdisplay=document.getElementById(objpopup);
objdisplay.style.visibility='visible';
objdisplay.style.marginTop=parseInt(document.getElementById(objtarget).offsetHeight)+parseInt(y);
objdisplay.style.marginLeft=parseInt(x);
}
function fn_get_objtext_posX(objtext)
{
var pos_x= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_x+= obj.offsetLeft;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.x)
{pos_x+=obj.x;}
return pos_x;
}
function fn_get_objtext_posY(objtext)
{
var pos_y= 0;
var obj=document.getElementById(objtext);
if(obj.offsetParent)
{
while(1)
{
pos_y+=obj.offsetTop;
if(!obj.offsetParent)break;
obj=obj.offsetParent;
}
}
else if(obj.y)
{pos_y+=obj.y;}
return pos_y;
}
function fn_numberformat(nStr)
{
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)){x1 = x1.replace(rgx, '$1' + '.' + '$2');}
return x1 + x2;
}
function fn_clsnumberformat(values){return values.replace(/,/gi,'');}
function trim(textstring){return textstring.replace(/^\s+|\s+$/g,'');}
function loadautocomplete(objtextbox,url){setAutoComplete(objtextbox, 'results', url);}
function initial()
{
var div_body=document.getElementById('div_body');
var height_tb_header=document.getElementById('tb_header').height;
var height_tb_menu=document.getElementById('tb_menu').height;
var height_tb_title=document.getElementById('tb_title').height;
var height_div_body=document.documentElement.clientHeight-(parseInt(height_tb_header)+parseInt(height_tb_menu)+parseInt(height_tb_title));
div_body.style.height=height_div_body+'px';
}
function validationobject(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
//alert(spobjval[1]);if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function validationobjectwithmsg(spobj)
{
var spobj=spobj.split(';');
//alert('test');
for(i=0;i<spobj.length;i++)
{
//alert(spobj[i]);
spobjval=spobj[i].split(':');
//alert(spobjval[0].value);
if(document.getElementById(spobjval[0]).value=='')
{
alert(spobjval[1]);
if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}
//alert('test');return false;
//document.getElementById(spobjval[0]).focus();
//bootbox.alert(spobjval[1],function(){if(spobjval[2]=='isfocus'){$('#'+spobjval[0]).focus();}});
return false;
}
}
return true;
// var obj=spobj.split(';');
// for(i=0;i<obj.length;i++)
// {
// alert(obj[4]);
// sp=obj[i].split(':');
// objname=sp[0];msg=sp[1];isfocus=sp[2];
// if(myobj.value=='')
// {
// bootbox.alert(msg,function(result){if(isfocus){$("#"+objname).focus();}});return false;
// }
// }
// return true;
}
function findselectedvalue(objcombo,val)
{
jQuery("#"+objcombo).find("option:contains('"+val+"')").each(function()
{
if( jQuery(this).text() == val )
{
jQuery(this).attr("selected","selected");
}
});
}
function elementtouppercase(obj)
{
obj.value=obj.value.toUpperCase();
}
function clearobject(spobject,objfocus)
{
var obj=spobject.split(';');
for(i=0;i<obj.length;i++)
{
var myobj=document.getElementById(obj[i]);
myobj.value='';
}
if(objfocus){$('#'+objfocus).focus();}
}
// === GLobal Event For Element TextBlink css class 26-01-2014 10:89 AM
$('.textblink').each(function(){
var elem = $(this);
setInterval(function(){
if (elem.css('visibility') == 'hidden')
{elem.css('visibility', 'visible');}
else
{elem.css('visibility', 'hidden');}
}, 550);
});
// === GLobal Event For Element UpperCase Element css class 29-01-2014 11:35 AM
//$('.uppercase').live('keyup',function(){alert('t');$(this).val().toUpperCase();});
// === Disabled Backward Page
$(document).keydown(function(e) {
var doPrevent;
if (e.keyCode == 8){
var d = e.srcElement || e.target;
if (d.tagName.toUpperCase() == 'INPUT' || d.tagName.toUpperCase() == 'TEXTAREA')
{
doPrevent = d.readOnly || d.disabled;
}
else
doPrevent = true;
}
else
doPrevent = false;
if (doPrevent)
e.preventDefault();
});
//$('input[type="text"]').change(function() {alert('t');
// $(this).css({'background-color':'white'});
//});

4
themes/js/jquery.js vendored Normal file

File diff suppressed because one or more lines are too long

140
themes/js/tabcontent.js Normal file
View File

@ -0,0 +1,140 @@
/* http://www.menucool.com/tabbed-content Free to use. v2013.7.6 */
(function() {
var g = function(a) {
if (a && a.stopPropagation) a.stopPropagation();
else window.event.cancelBubble = true;
var b = a ? a : window.event;
b.preventDefault && b.preventDefault()
}, d = function(a, c, b) {
if (a.addEventListener) a.addEventListener(c, b, false);
else a.attachEvent && a.attachEvent("on" + c, b)
}, a = function(c, a) {
var b = new RegExp("(^| )" + a + "( |$)");
return b.test(c.className) ? true : false
}, j = function(b, c, d) {
if (!a(b, c))
if (b.className == "") b.className = c;
else if (d) b.className = c + " " + b.className;
else b.className += " " + c
}, h = function(a, b) {
var c = new RegExp("(^| )" + b + "( |$)");
a.className = a.className.replace(c, "$1");
a.className = a.className.replace(/ $/, "")
}, e = function() {
var b = window.location.pathname;
if (b.indexOf("/") != -1) b = b.split("/");
var a = b[b.length - 1] || "root";
if (a.indexOf(".") != -1) a = a.substring(0, a.indexOf("."));
if (a > 20) a = a.substring(a.length - 19);
return a
}, c = "mi" + e(),
b = function(b, a) {
this.g(b, a)
};
b.prototype = {
h: function() {
var b = new RegExp(c + this.a + "=(\\d+)"),
a = document.cookie.match(b);
return a ? a[1] : this.i()
},
i: function() {
for (var b = 0, c = this.b.length; b < c; b++)
if (a(this.b[b].parentNode, "selected")) return b;
return 0
},
j: function(b, d) {
var c = document.getElementById(b.TargetId);
if (!c) return;
this.l(c);
for (var a = 0; a < this.b.length; a++)
if (this.b[a] == b) {
j(b.parentNode, "selected");
d && this.d && this.k(this.a, a)
} else h(this.b[a].parentNode, "selected")
},
k: function(a, b) {
document.cookie = c + a + "=" + b + "; path=/"
},
l: function(b) {
for (var a = 0; a < this.c.length; a++) this.c[a].style.display = this.c[a].id == b.id ? "block" : "none"
},
m: function() {
this.c = [];
for (var c = this, a = 0; a < this.b.length; a++) {
var b = document.getElementById(this.b[a].TargetId);
if (b) {
this.c.push(b);
d(this.b[a], "click", function(b) {
var a = this;
if (a === window) a = window.event.srcElement;
c.j(a, 1);
g(b);
return false
})
}
}
},
g: function(f, h) {
this.a = h;
this.b = [];
for (var e = f.getElementsByTagName("a"), i = /#([^?]+)/, a, b, c = 0; c < e.length; c++) {
b = e[c];
a = b.getAttribute("href");
if (a.indexOf("#") == -1) continue;
else {
var d = a.match(i);
if (d) {
a = d[1];
b.TargetId = a;
this.b.push(b)
} else continue
}
}
var g = f.getAttribute("data-persist") || "";
this.d = g.toLowerCase() == "true" ? 1 : 0;
this.m();
this.n()
},
n: function() {
var a = this.d ? parseInt(this.h()) : this.i();
if (a >= this.b.length) a = 0;
this.j(this.b[a], 0)
}
};
var k = [],
i = function(e) {
var b = false;
function a() {
if (b) return;
b = true;
setTimeout(e, 4)
}
if (document.addEventListener) document.addEventListener("DOMContentLoaded", a, false);
else if (document.attachEvent) {
try {
var f = window.frameElement != null
} catch (g) {}
if (document.documentElement.doScroll && !f) {
function c() {
if (b) return;
try {
document.documentElement.doScroll("left");
a()
} catch (d) {
setTimeout(c, 10)
}
}
c()
}
document.attachEvent("onreadystatechange", function() {
document.readyState === "complete" && a()
})
}
d(window, "load", a)
}, f = function() {
for (var d = document.getElementsByTagName("ul"), c = 0, e = d.length; c < e; c++) a(d[c], "tabs") && k.push(new b(d[c], c))
};
i(f);
return {}
})()