|
From: <rc...@us...> - 2016-10-18 05:14:02
|
Revision: 7648
http://sourceforge.net/p/web-erp/reponame/7648
Author: rchacon
Date: 2016-10-18 05:13:59 +0000 (Tue, 18 Oct 2016)
Log Message:
-----------
Add comments and format.
Modified Paths:
--------------
trunk/css/default/default.css
trunk/javascripts/MiscFunctions.js
Modified: trunk/css/default/default.css
===================================================================
--- trunk/css/default/default.css 2016-10-17 05:56:20 UTC (rev 7647)
+++ trunk/css/default/default.css 2016-10-18 05:13:59 UTC (rev 7648)
@@ -11,7 +11,7 @@
width:16px;
}
-body{
+body {
background-color:#ccd;
font-family:Arial, Verdana, Helvetica, sans-serif;
font-size:10pt;
@@ -19,60 +19,70 @@
padding:0;
}
-a{
+a {
color:blue;
text-decoration:none;
}
-a:hover{
+
+a:hover {
color:blue;
text-decoration:underline;
}
-img{
+img {
border:none;
vertical-align:middle;
}
-p.good{
+p.bad {
+ color:red;
font-weight:bold;
+}
+
+p.good {
color:green;
-}
-p.bad{
font-weight:bold;
- color:red;
}
-table{
+
+table {
margin:0 auto;
width:auto;
max-width:90%;
padding-bottom:5px;
}
-table.selection{
+
+table.selection {
padding-bottom:5px;
}
+
th {
background-color:#B06161;
color:white;
font-weight:normal;
}
+
th.ascending {
cursor: s-resize;
}
+
th.descending {
cursor: n-resize;
}
+
th:after {
content: "";
float: right;
margin-top: 7px;
visibility: hidden;
}
+
th.ascending:after {
border-width: 0 4px 4px;
border-style: solid;
border-color: #000 transparent;
visibility: visible;
}
+
th.descending:after {
border-bottom: none;
border-left: 4px solid transparent;
@@ -80,67 +90,91 @@
border-top: 4px solid #000;
visibility: visible;
}
+
td {
text-align:left;
}
-td.select{
+
+td.select {
background-color:#eee;
}
-div.centre{
+
+td a img {
+ height:16px;
+ width:16px;
+ /* Icon for a link inside a table element. */
+}
+
+div.centre {
margin:0 auto;
text-align:center;
padding:5px;
}
-input{
+
+input {
font-family:Arial, Verdana, Helvetica, sans-serif;
}
-input.number{
+
+input.number {
text-align:right;
}
-input.image{
+
+input.image {
border-width:0px;
background-color:transparent;
}
+
input:required, select:required, textarea:required {
background-color:lightyellow;
}
-input:hover{
+
+input:hover {
}
-select{
+
+select {
font-family:Arial, Verdana, Helvetica, sans-serif;
}
-textarea{
+
+textarea {
font-family:Arial, Verdana, Helvetica, sans-serif;
}
-textarea:hover{
+
+textarea:hover {
}
-.EvenTableRows{
+
+.EvenTableRows {
background-color:#CCCCCC;
}
-.OddTableRows{
+
+.OddTableRows {
background-color:#EEEEEE;
}
-div.error{
+
+div.error {
background-color:#fddbdb;
color:red;
border:1px solid red;
}
-div.warn{
+
+div.warn {
background-color:#f5dbfd;
color:maroon;
border:1px solid maroon;
}
-div.success{
+
+div.success {
background-color:#b9ecb4;
color:darkgreen;
border:1px solid darkgreen;
}
-div.info{
+
+div.info {
background-color:#c7ccf6;
color:navy;
border:1px solid navy;
}
-DIV.page_help_text{
+
+DIV.page_help_text {
background:lightgrey url(images/help.png) top left no-repeat;
BORDER:#a52a2a 1px solid;
padding-top:2px;
@@ -157,7 +191,8 @@
color:black;
TEXT-ALIGN:center;
}
-DIV.system_check{
+
+DIV.system_check {
BORDER:#a52a2a 1px solid;
PADDING-LEFT:3px;
Z-INDEX:1;
@@ -180,21 +215,24 @@
background:white;
box-shadow: 3px 3px 4px #000; /* shadow on modern browsers */
}
-.dpTD{
+
+.dpTD {
border:0;
width:20px;
background-color:#EEEEEE;
text-align:right;
cursor:pointer;
}
-.dpDayHighlight{
+
+.dpDayHighlight {
border:0;
width:20px;
background-color:yellow;
text-align:right;
cursor:pointer;
}
-.dpTDHover{
+
+.dpTDHover {
border:0;
width:20px;
background-color:#CCCCCC;
@@ -203,42 +241,48 @@
}
/* Table type is used for UI tables type 1 */
-.table1{
+.table1 {
width:90%;
background:#eee;
border:0px 0px 2px 2px #222 solid;
margin:0 auto;
}
+
/* Table type is used for UI tables type 2 */
-/*.table2{
+/*.table2 {
width:90%;
background:#eee;
border:0px 0px 2px 2px #222 solid;
margin:0 auto;
-}*/
+}
-.tableheader{
+*/
+
+.tableheader {
font-weight:normal;
background-color:#800000;
color:white;
}
-.notavailable{
+
+.notavailable {
font-weight:lighter;
font-style:italic;
color:#555555;
}
-.label{
+
+.label {
font-weight:bold;
font-style:normal;
font-size:120%;
color:black;
background-color:#cccccc;
}
-.table_index{
+
+.table_index {
background-color:#F1FFDD;
}
-.header{
+.header {
background-image:url("");
background-repeat:no-repeat;
background-attachment:fixed;
@@ -246,52 +290,58 @@
margin:0px;
padding:0px;
}
+
input.inputerror, input.error, select.error, select.selecterror, label.error {
color:red;
border: 2px solid red;
}
-textarea.texterror{
+textarea.texterror {
background-color:#fddbdb;
}
-.OsRow{
+.OsRow {
background-color:#234567;
color:white;
}
/*** CANVAS ***/
-#CanvasDiv{
+#CanvasDiv {
background:#588BB6;
}
/*** HEADER ***/
-#HeaderDiv{
+#HeaderDiv {
color:white;
/*background:#588BB6;*/
/*overflow:hidden;*/
}
-#HeaderDiv a{
+
+#HeaderDiv a {
color:white;
}
-#HeaderDiv a:hover{
+
+#HeaderDiv a:hover {
text-decoration:underline;
}
-#HeaderWrapDiv{
+
+#HeaderWrapDiv {
}
/*** HEADER - APP INFO ***/
-#AppInfoDiv{
+#AppInfoDiv {
float:left;
padding:0;
}
-#AppInfoCompanyDiv,#AppInfoUserDiv{
+
+#AppInfoCompanyDiv,#AppInfoUserDiv {
display:table-cell;
}
-#AppInfoModuleDiv{
+
+#AppInfoModuleDiv {
font-weight:bold;
font-size:120%;
padding:3px;
@@ -299,13 +349,15 @@
/*** HEADER - QUICK MENU ***/
-#QuickMenuDiv{
+#QuickMenuDiv {
float:right;
margin-top:2px;
}
-#QuickMenuDiv ul{
+
+#QuickMenuDiv ul {
}
-#QuickMenuDiv li{
+
+#QuickMenuDiv li {
display:inline;
border-left:thin ridge #588BB6;
padding:14px 12px;
@@ -313,10 +365,11 @@
/*** BODY ***/
-#BodyDiv{
+#BodyDiv {
clear:both;
}
-#BodyWrapDiv{
+
+#BodyWrapDiv {
background:#CCCCCC;
/*border:thin solid #ccc;*/
clear:both;
@@ -324,86 +377,101 @@
/*** BODY - MAIN MENU ***/
-#MainMenuDiv{
+#MainMenuDiv {
float:left;
width:11%;
border:thin solid #000;
text-align:center;
white-space:nowrap;
}
-#MainMenuDiv ul{
+
+#MainMenuDiv ul {
margin:0;
padding:0;
}
-#MainMenuDiv li{
+
+#MainMenuDiv li {
list-style:none;
}
-#MainMenuDiv li a{
+#MainMenuDiv li a {
color:black;
}
-#MainMenuDiv li a:hover{
+
+#MainMenuDiv li a:hover {
color:black;
text-decoration:underline;
}
-.main_menu_unselected{
+
+.main_menu_unselected {
background:#8EDE8D;
padding:2px;
}
-.main_menu_unselected:hover{
+
+.main_menu_unselected:hover {
background:white;
}
-.main_menu_selected{
+
+.main_menu_selected {
background-color:white;
padding:2px;
}
/*** BODY - SUB MENU ***/
-#SubMenuDiv{
+#SubMenuDiv {
display:table;
float:right;
overflow:hidden;
width:88.5%;
}
-#SubMenuDiv ul{
+
+#SubMenuDiv ul {
margin:0;
padding:0;
background:#fff;
border:thin solid black;
margin-left:3px;
}
-#SubMenuDiv li{
+
+#SubMenuDiv li {
list-style:none;
}
-#SubMenuDiv a{
+
+#SubMenuDiv a {
color:blue;
}
-#SubMenuDiv a:hover{
+
+#SubMenuDiv a:hover {
color:blue;
text-decoration:underline;
}
+
#TransactionsDiv,
#InquiriesDiv,
-#MaintenanceDiv{
+#MaintenanceDiv {
display:table-cell;
}
-.menu_group_headers{
+
+.menu_group_headers {
text-align:center;
color:black;
background:#eee;
border-bottom:thin solid black;
}
-.menu_group_item{
+
+.menu_group_item {
background-color:white;
padding:2px;
}
-.menu_group_item p{
+
+.menu_group_item p {
color:#00f; /* This is the color for bullets, I like it to be the same as the anchor color, but it's up to you */
text-indent:-12px; /* this makes the bullet to appear as the li tag previously used */
margin:0 0 0 12px; /* One thing that I didn´t like of the li was that it had no left margin applied */
}
-#InquiriesDiv div{ /* header for standard reports/forms, custom reports */
+
+#InquiriesDiv div { /* header for standard reports/forms, custom reports */
border-top:thin solid black;
border-bottom:thin solid black;
background:#eee;
@@ -413,47 +481,57 @@
/*** FOOTER ***/
-#FooterDiv{
+#FooterDiv {
clear:both;
overflow:hidden;
color:#CCCCCC;
padding:3px 2px;
}
-#FooterWrapDiv{
+#FooterWrapDiv {
+
}
-#FooterLogoDiv{
+
+#FooterLogoDiv {
background:white;
border-radius:7px;
float:left;
padding:3px;
}
-#FooterVersionDiv{
+
+#FooterVersionDiv {
float:left;
margin-left:10px;
margin-top:15px;
}
-#FooterTimeDiv{
+
+#FooterTimeDiv {
float:right;
margin-top:15px;
}
+
#Report {
/* Division id for reports. */}
+
#Report table {
/* Body of a report formatted with table tag. */
}
+
.centre {
text-align:center;
/* Class selector to horizontal align a text (centre) in an element. */
}
+
.number {
text-align:right;
/* Class selector to horizontal align a number (right) in an element. */
}
+
.text {
text-align:left;
/* Class selector to horizontal align a text (left) in an element. */
}
+
.page_title_text {
color:black;
font-weight:bold;
@@ -461,6 +539,7 @@
text-align:center;
/* Class selector for page title. */
}
+
/* END Style for all. ********************************************************/
@@ -477,3 +556,5 @@
@media only screen and (min-device-width:1024px) {
/* Style for new browser in a device with a rendering width greater than 1024px. */
}
+
+
Modified: trunk/javascripts/MiscFunctions.js
===================================================================
--- trunk/javascripts/MiscFunctions.js 2016-10-17 05:56:20 UTC (rev 7647)
+++ trunk/javascripts/MiscFunctions.js 2016-10-18 05:13:59 UTC (rev 7648)
@@ -1,39 +1,39 @@
/* $Id: MiscFunctions.js 7645 2016-10-17 05:34:08Z rchacon $ */
/* Miscellaneous JavaScript functions. */
-function defaultControl(c){
+function defaultControl(c) {
c.select();
c.focus();
}
-function ReloadForm(fB){
+function ReloadForm(fB) {
fB.click();
}
-function rTN(event){
- if (window.event) k=window.event.keyCode;
- else if (event) k=event.which;
+function rTN(event) {
+ if(window.event) k=window.event.keyCode;
+ else if(event) k=event.which;
else return true;
kC=String.fromCharCode(k);
- if (k==13) return false;
- if ((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) return true;
- else if ((("0123456789.,- ").indexOf(kC)>-1)) return true;
+ if(k==13) return false;
+ if((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) return true;
+ else if((("0123456789.,- ").indexOf(kC)>-1)) return true;
else return false;
}
-function rTI(event){
- if (window.event) k=window.event.keyCode;
- else if (event) k=event.which;
+function rTI(event) {
+ if(window.event) k=window.event.keyCode;
+ else if(event) k=event.which;
else return true;
kC=String.fromCharCode(k);
- if ((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) return true;
- else if ((("0123456789-").indexOf(kC)>-1)) return true;
+ if((k==null) || (k==0) || (k==8) || (k==9) || (k==13) || (k==27)) return true;
+ else if((("0123456789-").indexOf(kC)>-1)) return true;
else return false;
}
-function rLocaleNumber(){
+function rLocaleNumber() {
var Lang = document.getElementById('Lang').value;
- switch(Lang){
+ switch(Lang) {
case 'US':
var patt = /(?:^(-)?([1-9]{1}\d{0,2}(?:,?\d{3})*(?:\.\d{1,})?)$)|(?:^(-)?(0?\.\d{1,})$)|(?:^0$)/;
break;
@@ -51,26 +51,23 @@
break;
default:
alert('something is wrong with your language setting');
-
-
}
- if(patt.test(this.value)){
+ if(patt.test(this.value)) {
this.setCustomValidity('');
return true;
-
- }else{
+ } else {
this.setCustomValidity('The number format is wrong');
return false;
};
}
-function assignComboToInput(c,i){
+function assignComboToInput(c, i) {
i.value=c.value;
}
-function inArray(v,tA,m){
- for (i=0;i<tA.length;i++) {
- if (v.value==tA[i].value) {
+function inArray(v, tA, m) {
+ for(i=0;i<tA.length;i++) {
+ if(v.value==tA[i].value) {
return true;
}
}
@@ -78,8 +75,8 @@
return false;
}
-function isDate(dS,dF){
- switch (dF) {
+function isDate(dS, dF) {
+ switch(dF) {
case "d/m/Y":
case "d.m.Y":
case "m/d/Y":
@@ -91,15 +88,15 @@
break;
}
- if (mA==null){
+ if(mA==null) {
alert("Please enter the date in the format "+dF);
return false;
}
- if (dF=="d/m/Y"||dF=="d.m.Y"){
+ if(dF=="d/m/Y"||dF=="d.m.Y") {
d=mA[1];
m=mA[3];
y=mA[5];
- }else if(dF=='m/d/Y'){
+ }else if(dF=='m/d/Y') {
m=mA[1];
d=mA[3];
y=mA[5];
@@ -109,21 +106,21 @@
y=mA[1];
}
- if (m<1 || m>12){
+ if(m<1 || m>12) {
alert("Month must be between 1 and 12");
return false;
}
- if (d<1 || d>31){
+ if(d<1 || d>31) {
alert("Day must be between 1 and 31");
return false;
}
- if ((m==4 || m==6 || m==9 || m==11) && d==31){
+ if((m==4 || m==6 || m==9 || m==11) && d==31) {
alert("Month "+m+" doesn`t have 31 days");
return false;
}
- if (m==2){
+ if(m==2) {
var isleap=(y%4==0);
- if (d>29 || (d==29 && !isleap)){
+ if(d>29 || (d==29 && !isleap)) {
alert("February "+y+" doesn`t have "+d+" days");
return false;
}
@@ -131,88 +128,93 @@
return true;
}
-function eitherOr(o,t){
- if (o.value!='') t.value='';
- else if (o.value=='NaN') o.value='';
+function eitherOr(o, t) {
+ if(o.value!='') t.value='';
+ else if(o.value=='NaN') o.value='';
}
/*Renier & Louis (in...@ti...) 25.02.2007
Copyright 2004-2007 Tillcor International
*/
-days=new Array('Su','Mo','Tu','We','Th','Fr','Sa');
-months=new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
+days=new Array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa');
+months=new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
dateDivID="calendar";
-function Calendar(md,dF){
- iF=document.getElementsByName(md).item(0);
- pB=iF;
- x=pB.offsetLeft;
- y=pB.offsetTop+pB.offsetHeight;
- var p=pB;
- while (p.offsetParent){
- p=p.offsetParent;
- x+=p.offsetLeft;
- y+=p.offsetTop;
+
+function Calendar(md, dF) {
+ // dF: Date format. Formats: "d/m/Y", "d.m.Y", "m/d/Y", "Y-m-d", "Y/m/d".
+ iF = document.getElementsByName(md).item(0);
+ pB = iF;
+ x = pB.offsetLeft;
+ y = pB.offsetTop+pB.offsetHeight;
+ var p = pB;
+ while(p.offsetParent) {
+ p = p.offsetParent;
+ x += p.offsetLeft;
+ y += p.offsetTop;
}
- dt=convertDate(iF.value,dF);
- nN=document.createElement("div");
- nN.setAttribute("id",dateDivID);
- nN.setAttribute("style","visibility:hidden;");
+ dt = convertDate(iF.value, dF);
+ nN = document.createElement("div");
+ nN.setAttribute("id", dateDivID);
+ nN.setAttribute("style", "visibility:hidden;");
document.body.appendChild(nN);
- cD=document.getElementById(dateDivID);
- cD.style.position="absolute";
- cD.style.left=x+"px";
- cD.style.top=y+"px";
- cD.style.visibility=(cD.style.visibility=="visible" ? "hidden" : "visible");
- cD.style.display=(cD.style.display=="block" ? "none" : "block");
- cD.style.zIndex=10000;
- drawCalendar(md,dt.getFullYear(),dt.getMonth(),dt.getDate(),dF);
+ cD = document.getElementById(dateDivID);
+ cD.style.position = "absolute";
+ cD.style.left = x + "px";
+ cD.style.top = y + "px";
+ cD.style.visibility = (cD.style.visibility == "visible" ? "hidden" : "visible");
+ cD.style.display = (cD.style.display == "block" ? "none" : "block");
+ cD.style.zIndex = 10000;
+ drawCalendar(md, dt.getFullYear(), dt.getMonth(), dt.getDate(), dF);
}
-function drawCalendar(md,y,m,d,dF){
- var tD=new Date();
- if ((m>=0) && (y>0)) tD=new Date(y,m,1);
- else{
- d=tD.getDate();
+function drawCalendar(md, y, m, d, dF) {
+ // y: Year. Number.
+ // m: Month. Number.
+ // d: Day. Number.
+ // dF: Date format. Formats: "d/m/Y", "d.m.Y", "m/d/Y", "Y-m-d", "Y/m/d".
+ var tD = new Date();
+ if((m>=0) && (y>0)) tD = new Date(y, m, 1);
+ else {
+ d = tD.getDate();
tD.setDate(1);
}
- TR="<tr>";
- xTR="</tr>";
- TD="<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver='this.className=\"dpTDHover\";'";
- xTD="</td>";
- html="<table class='dpTbl'>"+TR+"<th colspan=\"3\">"+months[tD.getMonth()]+" "+tD.getFullYear()+"</th>"+"<td colspan=\"2\">"+
- getButtonCode(md,tD,-1,"<",dF)+xTD+"<td colspan=\"2\">"+getButtonCode(md,tD,1,">",dF)+xTD+xTR+TR;
- for(i=0;i<days.length;i++) html+="<th>"+days[i]+"</th>";
- html+=xTR+TR;
- for (i=0;i<tD.getDay();i++) html+=TD+" "+xTD;
- do{
- dN=tD.getDate();
- TD_onclick=" onclick=\"postDate('"+md+"','"+formatDate(tD,dF)+"');\">";
- if (dN==d) html+="<td"+TD_onclick+"<div class='dpDayHighlight'>"+dN+"</div>"+xTD;
- else html+=TD+TD_onclick+dN+xTD;
- if (tD.getDay()==6) html+=xTR+TR;
- tD.setDate(tD.getDate()+1);
- } while (tD.getDate()>1)
- if (tD.getDay()>0) for (i=6;i>tD.getDay();i--) html+=TD+" "+xTD;
- html+="</table>";
- document.getElementById(dateDivID).innerHTML=html;
+ TR = "<tr>";
+ xTR = "</tr>";
+ TD = "<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver='this.className=\"dpTDHover\";'";
+ xTD = "</td>";
+ html = "<table class='dpTbl'>" + TR + "<th colspan=\"3\">" + months[tD.getMonth()] + " " + tD.getFullYear() + "</th>" + "<td colspan=\"2\">" + getButtonCode(md, tD, -1, "<", dF) + xTD + "<td colspan=\"2\">" + getButtonCode(md, tD, 1, ">", dF) + xTD + xTR + TR;
+ for(i = 0; i < days.length; i++) html += "<th>" + days[i] + "</th>";
+ html += xTR + TR;
+ for(i = 0; i < tD.getDay(); i++) html += TD + " " + xTD;
+ do {
+ dN = tD.getDate();
+ TD_onclick = " onclick=\"postDate('" + md + "','" + formatDate(tD, dF) + "');\">";
+ if(dN == d) html += "<td" + TD_onclick + "<div class='dpDayHighlight'>" + dN + "</div>" + xTD;
+ else html += TD + TD_onclick + dN + xTD;
+ if(tD.getDay() == 6) html += xTR + TR;
+ tD.setDate(tD.getDate() + 1);
+ } while(tD.getDate() > 1)
+ if(tD.getDay() > 0) for(i = 6; i > tD.getDay(); i--) html += TD + " " + xTD;
+ html += "</table>";
+ document.getElementById(dateDivID).innerHTML = html;
}
-function getButtonCode(mD,dV,a,lb,dF){
- nM=(dV.getMonth()+a)%12;
- nY=dV.getFullYear()+parseInt((dV.getMonth()+a)/12,10);
-if (nM<0){
- nM+=12;
- nY+=-1;
+function getButtonCode(mD, dV, a, lb, dF) {
+ nM = (dV.getMonth()+a)%12;
+ nY = dV.getFullYear() + parseInt((dV.getMonth()+a)/12, 10);
+if(nM < 0) {
+ nM += 12;
+ nY += -1;
}
return "<button onClick='drawCalendar(\""+mD+"\","+nY+","+nM+","+1+",\""+dF+"\");'>"+lb+"</button>";
}
-function formatDate(dV,dF){
+function formatDate(dV, dF) {
ds=String(dV.getDate());
ms=String(dV.getMonth()+1);
- d=("0"+dV.getDate()).substring(ds.length-1,ds.length+1);
- m=("0"+(dV.getMonth()+1)).substring(ms.length-1,ms.length+1);
+ d=("0"+dV.getDate()).substring(ds.length-1, ds.length+1);
+ m=("0"+(dV.getMonth()+1)).substring(ms.length-1, ms.length+1);
y=dV.getFullYear();
- switch (dF) {
+ switch(dF) {
case "d/m/Y":
return d+"/"+m+"/"+y;
case "d.m.Y":
@@ -226,64 +228,64 @@
}
}
-function convertDate(dS,dF){
+function convertDate(dS, dF) {
// Converts a date in DefaultDateFormat into a javascript date-object.
// dS: Date to convert.
// dF: Date format. Formats: "d/m/Y", "d.m.Y", "m/d/Y", "Y-m-d", "Y/m/d".
- var y,m,d;
- switch(dF){
- case "d/m/Y":
- dA=dS.split("/");
- d=parseInt(dA[0],10);
- m=parseInt(dA[1],10)-1;
- y=parseInt(dA[2],10);
- break;
- case "d.m.Y":
- dA=dS.split(".");
- d=parseInt(dA[0],10);
- m=parseInt(dA[1],10)-1;
- y=parseInt(dA[2],10);
- break;
- case "m/d/Y":
- dA=dS.split("/");
- m=parseInt(dA[0],10);
- d=parseInt(dA[1],10)-1;
- y=parseInt(dA[2],10);
- break;
- case "Y-m-d":
- dA=dS.split("-");
- y=parseInt(dA[0],10);
- m=parseInt(dA[1],10)-1;
- d=parseInt(dA[2],10);
- break;
- case "Y/m/d":
- dA=dS.split("/");
- y=parseInt(dA[0],10);
- m=parseInt(dA[1],10)-1;
- d=parseInt(dA[2],10);
- break;
- default:
- alert("Unknown date format "+dF);
+ var y, m, d;
+ switch(dF) {
+ case "d/m/Y":
+ dA = dS.split("/");
+ d = parseInt(dA[0], 10);
+ m = parseInt(dA[1], 10)-1;
+ y = parseInt(dA[2], 10);
+ break;
+ case "d.m.Y":
+ dA = dS.split(".");
+ d = parseInt(dA[0], 10);
+ m = parseInt(dA[1], 10)-1;
+ y = parseInt(dA[2], 10);
+ break;
+ case "m/d/Y":
+ dA = dS.split("/");
+ m = parseInt(dA[0], 10);
+ d = parseInt(dA[1], 10)-1;
+ y = parseInt(dA[2], 10);
+ break;
+ case "Y-m-d":
+ dA = dS.split("-");
+ y = parseInt(dA[0], 10);
+ m = parseInt(dA[1], 10)-1;
+ d = parseInt(dA[2], 10);
+ break;
+ case "Y/m/d":
+ dA = dS.split("/");
+ y = parseInt(dA[0], 10);
+ m = parseInt(dA[1], 10)-1;
+ d = parseInt(dA[2], 10);
+ break;
+ default:
+ alert("Unknown date format " + dF);
return false;
}
-return new Date(y,m,d);
+return new Date(y, m, d);
}
-function postDate(mydate,dS){
-var iF=document.getElementsByName(mydate).item(0);
-iF.value=dS;
-var cD=document.getElementById(dateDivID);
-cD.style.visibility="hidden";
-cD.style.display="none";
+function postDate(mydate, dS) {
+var iF = document.getElementsByName(mydate).item(0);
+iF.value = dS;
+var cD = document.getElementById(dateDivID);
+cD.style.visibility = "hidden";
+cD.style.display = "none";
iF.focus();
}
-function clickDate(){
- Calendar(this.name,this.alt);
+function clickDate() {
+ Calendar(this.name, this.alt);
}
-function changeDate(){
- isDate(this.value,this.alt);
+function changeDate() {
+ isDate(this.value, this.alt);
}
function SortSelect() {
@@ -293,10 +295,10 @@
parentElem=selElem.parentNode;
table=parentElem.parentNode;
row = table.rows[0];
- for (var j = 0, col; col = row.cells[j]; j++) {
- if (row.cells[j].innerHTML==columnText) {
+ for(var j = 0, col; col = row.cells[j]; j++) {
+ if(row.cells[j].innerHTML==columnText) {
columnNumber=j;
- if (selElem.className=="ascending") {
+ if(selElem.className=="ascending") {
selElem.className='descending';
direction="a";
} else {
@@ -305,10 +307,10 @@
}
}
}
- for (var i = 1, row; row = table.rows[i]; i++) {
+ for(var i = 1, row; row = table.rows[i]; i++) {
var rowArray = new Array();
- for (var j = 0, col; col = row.cells[j]; j++) {
- if (row.cells[j].tagName == 'TD' ) {
+ for(var j = 0, col; col = row.cells[j]; j++) {
+ if(row.cells[j].tagName == 'TD' ) {
rowArray[j]=row.cells[j].innerHTML;
columnClass=row.cells[columnNumber].className;
}
@@ -317,10 +319,10 @@
}
tmpArray.sort(
function(a,b) {
- if (direction=="a") {
- if (columnClass=="number") {
+ if(direction=="a") {
+ if(columnClass=="number") {
return parseFloat(a[columnNumber].replace(/[,.]/g, '')) - parseFloat(b[columnNumber].replace(/[,.]/g, ''));
- } else if (columnClass=="date") {
+ } else if(columnClass=="date") {
da=new Date(a[columnNumber]);
db=new Date(b[columnNumber]);
return da>db;
@@ -328,9 +330,9 @@
return a[columnNumber].localeCompare(b[columnNumber])
}
} else {
- if (columnClass=="number") {
+ if(columnClass=="number") {
return parseFloat(b[columnNumber].replace(/[,.]/g, '')) - parseFloat(a[columnNumber].replace(/[,.]/g, ''));
- } else if (columnClass=="date") {
+ } else if(columnClass=="date") {
da=new Date(a[columnNumber]);
db=new Date(b[columnNumber]);
return da<=db;
@@ -340,11 +342,11 @@
}
}
);
- for (var i = 0, row; row = table.rows[i+1]; i++) {
+ for(var i = 0, row; row = table.rows[i+1]; i++) {
var rowArray = new Array();
rowArray=tmpArray[i];
- for (var j = 0, col; col = row.cells[j]; j++) {
- if (row.cells[j].tagName == 'TD' ) {
+ for(var j = 0, col; col = row.cells[j]; j++) {
+ if(row.cells[j].tagName == 'TD' ) {
row.cells[j].innerHTML=rowArray[j];
}
}
@@ -352,29 +354,29 @@
return;
}
-function initial(){
- if (document.getElementsByTagName){
+function initial() {
+ if(document.getElementsByTagName) {
var as=document.getElementsByTagName("a");
- for (i=0;i<as.length;i++){
+ for(i=0;i<as.length;i++) {
var a=as[i];
- if (a.getAttribute("href") &&
+ if(a.getAttribute("href") &&
a.getAttribute("rel")=="external")
a.target="_blank";
}
}
var ds=document.getElementsByTagName("input");
- for (i=0;i<ds.length;i++){
- if (ds[i].className=="date"){
+ for(i=0;i<ds.length;i++) {
+ if(ds[i].className=="date") {
ds[i].onclick=clickDate;
ds[i].onchange=changeDate;
}
if(ds[i].getAttribute("data-type") == 'no-illegal-chars') ds[i].pattern="(?!^ +$)[^?\'\u0022+.&\\\\><]*";
- if (ds[i].className=="number") ds[i].onkeypress=rTN;
- if (ds[i].className=="integer") ds[i].onkeypress=rTI;
- if (ds[i].className=="number"){
+ if(ds[i].className=="number") ds[i].onkeypress=rTN;
+ if(ds[i].className=="integer") ds[i].onkeypress=rTI;
+ if(ds[i].className=="number") {
ds[i].origonchange=ds[i].onchange;
ds[i].newonchange=rLocaleNumber;
- ds[i].onchange=function(){
+ ds[i].onchange=function() {
if(this.origonchange)
this.origonchange();
this.newonchange();
@@ -382,13 +384,13 @@
}
}
var ds=document.getElementsByTagName("th");
- for (i=0;i<ds.length;i++){
- if (ds[i].className=="ascending") ds[i].onclick=SortSelect;
+ for(i=0;i<ds.length;i++) {
+ if(ds[i].className=="ascending") ds[i].onclick=SortSelect;
}
}
-function AddAmount(t,Target,d) {
- if (t.checked) {
+function AddAmount(t, Target, d) {
+ if(t.checked) {
document.getElementById(Target).value=Number(t.value);
if(d) document.getElementById(d).required="required";
} else {
|