var WxClass = function() {
var parent, methods;
klass = function() {
this.initialize.apply(this, arguments);
};
extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
};
if (typeof arguments[0] === 'function') {
parent = arguments[0];
methods = arguments[1];
} else {
methods = arguments[0];
}
if (parent !== undefined) {
extend(klass.prototype, parent.prototype);
klass.prototype.$parent = parent.prototype;
if (parent.prototype.initialize != null) {
klass.prototype.$super = parent.prototype.initialize;
}
}
extend(klass.prototype, methods);
klass.prototype.constructor = klass;
if (!klass.prototype.initialize) klass.prototype.initialize = function(){};
return klass;
};
var WxCookies = WxClass({
Elements : null,
initialize : function () {
this.Elements = new Array();
var Split = document.cookie.split(";");
for (var i=0; i 0) {
var Split1 = Split[i].split(" =");="" (wx.trim(split1[0])="=" key)="" return="" split1[1];="" "";="" });="" wxsystem="WxClass({" sessionid:="" "wxid1743673012719",="" username:="" "",="" applname:="" "rdesk",="" maincontentid:="" null,="" message:="" thisrequest:="" loggedin:="" false,="" xmldoc:="" styles:="" iframe:="" status:="" feiertage:="" messages:="" websocket:="" initialize:="" function(maincontentid)="" this.maincontentid="MainContentID;" this.feiertage="new" array();="" cookies="new" wxcookies();="" (cookies.get("wxapsessionid")="=" "")="" cookies.add("wxapsessionid",="" this.sessionid);="" (this.username="" !="" )="" this.loggedin="true;" this.messages="new" wxmessageswindow();="" this.styles="new" this.message="new" wxlabel("nachricht ");="" this.status="new" wxstatus();="" this.getstatus();="" this.iframe="document.createElement("iframe");" this.iframe.id="WxIFrame" ;="" this.iframe.style.visibility="hidden" this.iframe.style.display="none" document.body.appendchild(this.iframe);="" this.loadstyle("gui="" wxbasisstyles.xml");="" getfeiertag:="" function(datum)="" (this.feiertage[datum]="" this.feiertage[datum];="" allgdatum="####" datum.substring(4,8);="" (this.feiertage[allgdatum]="" this.feiertage[allgdatum];="" null;="" containsmodul:="" function(modulname)="" this.status.containsmodul(modulname);="" getcookies:="" function()="" new="" getstyle:="" function(group,="" element)="" this.styles[group][element];="" isloggedin:="" this.loggedin;="" login:="" function(username,="" password,="" fromip)="" (fromip="=" null)="" fromip="" args="new" args.push("login");="" args.push(username);="" args.push(password);="" args.push(navigator.useragent);="" args.push(this.applname);="" args.push(fromip);="" ret="01: Anmeldung konnte nicht durchgeführt werden" logincommand="new" wxdatasourcecommand(this,="" "applsrvclient");="" xmltable="LoginCommand.loadXMLData(Args);" (xmltable="" (xmltable.getstring("allowed")="=" "yes")="" this.username="XMLTable.getString("UserName");" document.location.reload();="" else="" ret;="" logout:="" this.messages.close();="" (this.websocket)="" this.websocket.close();="" args.push("logout");="" resize:="" (this.xmldoc="" contentdiv="document.getElementById("Content");" window.console.log("docresize:"="" window.innerwidth="" ":"="" window.innerheight);="" contentdiv.style.widht="(window.innerWidth" -="" 30)="" "px";="" contentdiv.style.height="(window.innerHeight" contentdiv.style.border="1px solid green" this.xmldoc.getcontent().content.style.width="window.innerWidth" this.xmldoc.getcontent().content.style.height="window.innerHeight" this.xmldoc.getcontent().resize();="" this.messages.resize();="" load:="" function(filename)="" request="new" wxrequest();="" this.xmldoc="Request.getXML(FileName);" this.xmldoc.getcontent().setbottom(this.message);="" contentelement="document.getElementById(this.MainContentID)" contentelement.appendchild(this.xmldoc.getcontent().content);="" loadstyle:="" stylexmldoc="Request.getXMLData(FileName);" (stylexmldoc="" <="" stylexmldoc.documentelement.childnodes.length;="" subnode="StyleXMLDoc.documentElement.childNodes[i];" (subnode.nodename="=" "stylegroup")="" stylegroup="SubNode.getAttribute("name");" this.styles[stylegroup]="new" j="0;" subnode.childnodes.length;="" j++)="" stylenode="SubNode.childNodes[j];" (stylenode.nodename="=" "style")="" style="StyleNode.getAttribute("name");" this.styles[stylegroup][style]="StyleNode.firstChild.nodeValue;" parsetoxml:="" function(value)="" (window.domparser)="" parser="new" domparser();="" xmldoc="parser.parseFromString(Value," "text="" xml");="" activexobject("microsoft.xmldom");="" xmldoc.async="false;" xmldoc.loadxml(value);="" xmldoc;="" getstatus:="" this.status.clear();="" args.push("status");="" statuscommand="new" (xmltable.getstring("username")="" this.userid="XMLTable.getString("UserID");" moduletable="XMLTable.getTable("Module");" while="" (moduletable.next())="" (moduletable.getrow().getstring("name")="" this.status.addmodul(moduletable.getrow().getstring("name"));="" rightstable="XMLTable.getTable("Rights");" (rightstable.next())="" (rightstable.getrow().getstring("name")="" this.status.addright(rightstable.getrow().getstring("name"));="" this.status.isadmin="XMLTable.getString("IsAdmin");" this.status.displayname="XMLTable.getString("DisplayName");" this.status.clientname="XMLTable.getString("ClientName");" this.status.servertype="XMLTable.getString("ServerType");" this.status.mitarbeiterid="XMLTable.getString("MitarbeiterID");" (this.status.mitarbeiterid="" this.loadfeiertage();="" this.websocket="new" wxwebsocket(this.sessionid);="" loadfeiertage:="" &&=""> 0) {
var Args = new Array();
Args.push("get");
Args.push(this.Status.MitarbeiterID);
var StatusCommand = new WxDataSourceCommand(this, "mitarb");
var XMLTable = StatusCommand.loadXMLData(Args);
var StandorteNode = XMLTable.getTable("Standorte");
for (var i=0; i< StandorteNode.getXML().childNodes.length; i++) {
SubNode = StandorteNode.getXML().childNodes[i];
if (SubNode.nodeName == "Standort") {
var StandortTable = new WxXMLDataTable();
StandortTable.setXML(SubNode);
if (StandortTable.getString("Standard") == "yes") {
this.Status.FeiertagsGruppenID = StandortTable.getString("FeiertagsGruppenID");
}
}
}
}
if (this.Status.FeiertagsGruppenID != null && this.Status.FeiertagsGruppenID > 0) {
var Args = new Array();
Args.push("get");
Args.push(this.Status.FeiertagsGruppenID);
var StatusCommand = new WxDataSourceCommand(this, "feiergrp");
var XMLTable = StatusCommand.loadXMLData(Args);
var FTTable = XMLTable.getTable("Feiertage");
if (FTTable != null) {
for (var i=0; i < FTTable.getXML().childNodes.length; i++) {
if (FTTable.getXML().childNodes[i].nodeName == "Feiertag") {
var FT = new WxXMLDataTable();
FT.setXML(FTTable.getXML().childNodes[i]);
this.Feiertage[FT.getString("Datum")] = {
Beschreibung: FT.getString("Beschreibung"),
Halb: FT.getString("IstHalb")
};
}
}
}
}
}
});
var WxStatus = WxClass({
Module: null,
Rights: null,
initialize: function() {
},
addModul: function(ModulName) {
this.Module.push(ModulName);
},
addRight: function(RightName) {
if(RightName == "admin")
{
this.IsAdmin = "true";
}else
{
for (var m = 0; m < this.Rights.length; m++) {
if(RightName == this.Rights[m]) return;
}
this.Rights.push(RightName);
}
},
containsModul: function(ModulName) {
for (var m = 0; m < this.Module.length; m++) {
if (this.Module[m] == ModulName) {
return true;
}
}
return false;
},
containsRight: function(RightName) {
if(RightName.indexOf("eingeschraenkterBenutzer")<0 && this.IsAdmin == "true")
{
return true;
}
for (var m = 0; m < this.Rights.length; m++) {
if (RightName.indexOf(this.Rights[m]) >-1 ) {
return true;
}
}
return false;
},
getRights: function() {
var rights= "";
for (var m = 0; m < this.Rights.length; m++) {
rights +=this.Rights[m];
}
return rights;
},
clear: function() {
this.Module = new Array();
this.Rights = new Array();
}
});
var WxRequest = WxClass({
getXML: function(FileName, Args) {
if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest();
} else {
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET", FileName + "?Timestamp=" + new Date(), false);
xhttp.send();
xmlDoc = xhttp.responseXML;
return this.build(xmlDoc, Args);
},
getJavascript: function(FileName, Args) {
if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest();
} else {
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET", FileName + "?Timestamp=" + new Date(), false);
xhttp.send();
var Script = xhttp.response;
return Script;
},
getXMLData: function(FileName, Args) {
if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest();
} else {
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("GET", FileName + "?Timestamp=" + new Date(), false);
xhttp.send();
return xhttp.responseXML;
},
getData: function(CommandName, Description) {
if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest();
} else {
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("post", CommandName + "?Timestamp=" + new Date(), false);
xhttp.send(JSON.stringify(Description));
return xhttp.response;
},
getXMLDocument: function(CommandName, Description) {
if (window.XMLHttpRequest) {
xhttp=new XMLHttpRequest();
} else {
xhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xhttp.open("post", CommandName + "?Timestamp=" + new Date(), false);
xhttp.send(JSON.stringify(Description));
return xhttp.responseXML;
},
build: function(LoadedXMLDoc, Args) {
var ret = null;
if (LoadedXMLDoc.documentElement.nodeName == "Application") {
ret = new WxApplication(LoadedXMLDoc.documentElement, Args);
}
return ret;
}
});
var WxApplication = WxClass({
Name: null,
Panel: null,
MoreInits: null,
OpenWindows: null,
DataSources: null,
EventID: 0,
initialize: function(Node, Args) {
this.Name = Node.getAttribute("name");
this.MoreInits = new Array();
this.OpenWindows = new Array();
this.parseXML(Node);
this.Panel = new WxBorderPanel();
this.Panel.Appl = this;
this.Panel.parseXML(Node);
if (Args != null) {
for (var VariableName in Args) {
if (this[VariableName] != null) {
this[VariableName] = Args[VariableName];
}
}
}
for (var ifu = 0; ifu < this.MoreInits.length; ifu++) {
if (this[this.MoreInits[ifu]] != null) {
this[this.MoreInits[ifu]]();
}
}
if (this.init != null) {
this.init();
}
if (this.DataSources != null) {
for (var Key in this.DataSources) {
if (this.DataSources[Key].isAuto()) {
this.DataSources[Key].load();
}
}
}
},
addWindow: function(Name, Title) {
var NewWindow = new WxWindow(Name, Title);
NewWindow.Parent = this;
this.OpenWindows[Name] = NewWindow;
return NewWindow;
},
containsWindow: function(Name) {
if (this.OpenWindows[Name] != null) {
return true;
}
return false;
},
getEventID: function() {
this.EventID++;
return this.EventID;
},
removeWindow: function(Name) {
if (this.OpenWindows[Name] != null) {
this.OpenWindows[Name] = null;
}
},
reloadDataSources: function() {
for (var Key in this.DataSources) {
if (this.DataSources[Key].isAuto()) {
this.DataSources[Key].load();
}
}
},
parseXML: function(ApplicationNode) {
for (var i = 0; i < ApplicationNode.childNodes.length; i++) {
var SubNode = ApplicationNode.childNodes[i];
if (SubNode.nodeName == "Script") {
if (SubNode.getAttribute("modul") != null) {
if (system.Status.containsModul(SubNode.getAttribute("modul")) == false) {
continue;
}
}
var SriptName = SubNode.getAttribute("name");
var ScriptSource = SubNode.getAttribute("src");
var InitFunction = SubNode.getAttribute("init");
if (InitFunction != null && InitFunction != "") {
this.MoreInits.push(InitFunction);
}
var Request = new WxRequest();
var Script = Request.getJavascript(ScriptSource);
var JScript = eval(Script);
for (var k in JScript) {
this[k] = JScript[k];
}
}
if (SubNode.nodeName == "DataSource") {
if (this.DataSources == null) {
this.DataSources = new Array();
}
if (SubNode.getAttribute("modul") != null) {
if (system.Status.containsModul(SubNode.getAttribute("modul")) == false) {
continue;
}
}
var DataSource = new WxDataSource(this, SubNode.getAttribute("name"));
DataSource.parseXML(SubNode);
this.DataSources[SubNode.getAttribute("name")] = DataSource;
found = true;
continue;
}
if (SubNode.nodeName == "Variable") {
this[SubNode.getAttribute("name")] = SubNode.getAttribute("value");
if (SubNode.getAttribute("eval") != null) {
this[SubNode.getAttribute("name")] = eval(SubNode.getAttribute("eval"));
}
}
if (SubNode.nodeName == "Function") {
var FunctionName = SubNode.getAttribute("name");
var FunctionValue = SubNode.childNodes[0].nodeValue;
this[FunctionName] = new Function("Parameters", FunctionValue);
}
}
},
getContent: function() {
return this.Panel;
},
convertJSON: function(Value) {
var JSONData = JSON.stringify(Value);
JSONData = encodeURI(JSONData);
return "\"" + JSONData + "\"";
}
});
var Base64 = {
// private property
_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
// public method for encoding
encode : function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = Base64._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode : function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = this._keyStr.indexOf(input.charAt(i++));
enc2 = this._keyStr.indexOf(input.charAt(i++));
enc3 = this._keyStr.indexOf(input.charAt(i++));
enc4 = this._keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = Base64._utf8_decode(output);
return output;
},
// private method for UTF-8 encoding
_utf8_encode : function (string) {
string = string.replace(/\r\n/g,"\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
},
// private method for UTF-8 decoding
_utf8_decode : function (utftext) {
var string = "";
var i = 0;
var c = c1 = c2 = 0;
while ( i < utftext.length ) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
}
else if((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i+1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
}
else {
c2 = utftext.charCodeAt(i+1);
c3 = utftext.charCodeAt(i+2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
var WxDate = WxClass({
Datum: null,
OnlyDate: false,
TagesNamen: null,
initialize: function(DateString, Format) {
this.TagesNamen = new Array(7);
this.TagesNamen[0]= "Sonntag";
this.TagesNamen[1] = "Montag";
this.TagesNamen[2] = "Dienstag";
this.TagesNamen[3] = "Mittwoch";
this.TagesNamen[4] = "Donnerstag";
this.TagesNamen[5] = "Freitag";
this.TagesNamen[6] = "Samstag";
if (DateString == null) {
this.Datum = new Date();
this.OnlyDate = true;
} else {
if (Format == null) {
this.Datum = new Date(parseFloat(DateString));
} else {
if (Format == "yyyyMMdd") {
if (DateString != null && DateString != "" && DateString != "NaN") {
var Year = DateString.substring(0, 4);
var Month = DateString.substring(4, 6);
var Day = DateString.substring(6, 8);
this.Datum = new Date(Year, Month-1, Day);
this.OnlyDate = true;
}
}
}
}
},
add: function(Adder) {
if (this.Datum) this.Datum.setDate(this.Datum.getDate()+Adder);
},
sub: function(Subber) {
if (this.Datum) this.Datum.setDate(this.Datum.getDate()-Subber);
},
getDayName: function() {
return this.TagesNamen[this.Datum.getDay()];
},
format: function() {
var ret = "";
if (!this.OnlyDate) {
if (this.Datum) {
var day = this.Datum.getDate();
if (day < 10) day = "0" + day;
var month = this.Datum.getMonth() + 1;
if (month < 10) month = "0" + month;
var year = this.Datum.getFullYear();
var hour = this.Datum.getHours();
if (hour < 10) hour = "0" + hour;
var minute = this.Datum.getMinutes();
if (minute < 10) minute = "0" + minute;
var second = this.Datum.getSeconds();
if (second < 10) second = "0" + second;
ret = day + "." + month + "." + year + " " + hour + ":" + minute + ":" + second;
return ret;
} else {
return "";
}
} else {
if (this.Datum) {
var day = this.Datum.getDate();
if (day < 10) day = "0" + day;
var month = this.Datum.getMonth() + 1;
if (month < 10) month = "0" + month;
var year = this.Datum.getFullYear();
ret = day + "." + month + "." + year;
return ret;
} else {
return "";
}
}
},
formatOnlyDate: function() {
var ret = "";
if (this.Datum) {
var day = this.Datum.getDate();
if (day < 10) day = "0" + day;
var month = this.Datum.getMonth() + 1;
if (month < 10) month = "0" + month;
var year = this.Datum.getFullYear();
ret = day + "." + month + "." + year;
return ret;
} else {
return "";
}
},
formatToSave: function() {
var ret = "";
if (this.Datum) {
var day = this.Datum.getDate();
if (day < 10) day = "0" + day;
var month = this.Datum.getMonth() + 1;
if (month < 10) month = "0" + month;
var year = this.Datum.getFullYear();
ret = year + month + day;
return ret;
} else {
return "";
}
}
});
var WxTime = WxClass({
Time: 0,
initialize: function(TimeString) {
if (TimeString != null && TimeString != "") {
var Minus = false;
if (TimeString.indexOf("-") >= 0) Minus = true;
TimeString = TimeString.replace("-", "");
var VonG = TimeString.split(":");
var VonStd = parseInt(VonG[0]);
var VonMin = parseInt(VonG[1]);
VonStd = VonStd * 3600;
VonStd = VonStd + (VonMin * 60);
this.Time = VonStd;
if (Minus) this.Time = this.Time * -1;
}
},
add: function(TimeString) {
if (TimeString != null && TimeString != "") {
var Minus = false;
if (TimeString.indexOf("-") >= 0) {
Minus = true;
TimeString = TimeString.replace("-", "");
}
var VonG = TimeString.split(":");
var VonStd = VonG[0];
var VonMin = VonG[1];
VonStd = VonStd * 3600;
VonStd = VonStd + (VonMin * 60);
if (Minus) {
this.Time = this.Time - VonStd;
} else {
this.Time = this.Time + VonStd;
}
}
},
sub: function(TimeString) {
if (TimeString != null && TimeString != "") {
var Minus = false;
if (TimeString.indexOf("-") >= 0) {
Minus = true;
TimeString = TimeString.replace("-", "");
}
var VonG = TimeString.split(":");
var VonStd = VonG[0];
var VonMin = VonG[1];
VonStd = VonStd * 3600;
VonStd = VonStd + (VonMin * 60);
if (Minus) {
this.Time = this.Time + VonStd;
} else {
this.Time = this.Time - VonStd;
}
}
},
before: function(TimeString) {
var testTime = this.Time;
if (TimeString != null && TimeString != "") {
var Minus = false;
if (TimeString.indexOf("-") >= 0) {
Minus = true;
TimeString = TimeString.replace("-", "");
}
var VonG = TimeString.split(":");
var VonStd = VonG[0];
var VonMin = VonG[1];
VonStd = VonStd * 3600;
VonStd = VonStd + (VonMin * 60);
if (Minus) {
testTime = testTime + VonStd;
} else {
testTime = testTime - VonStd;
}
}
return testTime <=0;
},
div: function(TimeString) {
if (TimeString != null && TimeString != "") {
this.Time = this.Time / TimeString;
}
},
mult: function(TimeString) {
if (TimeString != null && TimeString != "") {
this.Time = this.Time * TimeString;
}
},
init: function() {
this.Time = 0;
},
getHour: function() {
if (this.Time != 0) {
var Diff = this.Time;
var DiffStd = (Diff / 3600>>0);
return DiffStd;
} else {
return 0;
}
},
getMinute: function() {
if (this.Time != 0) {
var Diff = this.Time;
var DiffStd = (Diff / 3600>>0);
var DiffMin = ((Diff-(DiffStd*3600)) / 60>>0);
return DiffMin;
} else {
return 0;
}
},
get: function() {
if (this.Time != 0) {
var Diff = this.Time;
var DiffStd = (Diff / 3600>>0);
var DiffMin = ((Diff-(DiffStd*3600)) / 60>>0);
var Minus = false;
DiffStd = "" + DiffStd;
if (DiffStd.indexOf("-") >= 0) {
Minus = "true";
DiffStd = DiffStd.replace("-", "");
}
DiffMin = "" + DiffMin;
if (DiffMin.indexOf("-") >= 0) {
Minus = "true";
DiffMin = DiffMin.replace("-", "");
}
if (DiffMin.length == 1) DiffMin = "0" + DiffMin;
var MinusRet = "";
if (Minus) MinusRet = "-";
return MinusRet + DiffStd + ":" + DiffMin;
} else {
return "";
}
},
value: function() {
return this.Time;
}
});
var WxCurrency = WxClass({
Currency: new Number("0.00"),
initialize: function(Value) {
if (Value != null) {
if (Value.indexOf(",") >= 0 && Value.indexOf(".") >= 0) {
Value = Value.replace(".", "");
}
Value = Value.replace(",", ".");
this.Currency = new Number(Value);
}
},
add: function(ToAdd) {
ToAdd = "" + ToAdd;
ToAdd = ToAdd.replace(",", ".");
this.Currency = this.Currency + new Number(ToAdd);
},
sub: function(ToSub) {
ToSub = "" + ToSub;
ToSub = ToSub.replace(",", ".");
this.Currency = this.Currency - new Number(ToSub);
},
format: function() {
this.Currency = Math.round (this.Currency * 100) / 100;
return this.Currency.formatCurrency();
},
get: function() {
return this.Currency;
},
toString: function() {
return this.Currency;
}
});
var WxDecimal = WxClass({
Decimal: new Number("0.00"),
initialize: function(Value) {
if (Value != null) {
this.Decimal = new Number(Value);
}
},
add: function(ToAdd) {
ToAdd = "" + ToAdd;
this.Decimal = this.Decimal + new Number(ToAdd);
},
sub: function(ToAdd) {
ToAdd = "" + ToAdd;
this.Decimal = this.Decimal - new Number(ToAdd);
},
format: function(NachkommaStellen) {
var ret = "0.00";
if (this.Decimal != null && this.Decimal != 0.0) {
this.Decimal = Math.round (this.Decimal * 100) / 100;
if (isNaN(this.Decimal)) this.Decimal = new Number("0.00");
ret = "" + this.Decimal;
if (ret.indexOf(".") < 0) ret = ret + ".00";
var split = ret.split(".");
var vk = split[0];
var nk = split[1];
if (nk.length == 1) nk = nk + "0";
ret = vk + "." + nk;
}
ret = ret.replace(".", ",");
return ret;
},
toString: function() {
return "" + this.Decimal;
}
});
var WxSearcher = WxClass({
Search: "",
Split: null,
Verg1: "",
initialize: function(SearchValue) {
this.Search = SearchValue.toLowerCase();
this.Split = this.Search.split(" ");
for (var i=0; i < this.Split.length; i++) {
this.Split[i] = this.Split[i].toLowerCase();
this.Verg1 = this.Verg1 + "1";
}
},
search: function(SearchIn) {
Found = false;
SearchIn = SearchIn.toLowerCase();
var Verg2 = "";
for (var i=0; i < this.Split.length; i++) {
if (SearchIn.indexOf(this.Split[i]) >= 0) {
Verg2 = Verg2 + "1";
} else {
Verg2 = Verg2 + "0";
}
}
if (this.Verg1 == Verg2) {
Found = true;
}
return Found;
}
});
var WxWebSocket = WxClass({
SessionID: null,
WebSocket: null,
initialize: function(SessionID) {
this.SessionID = SessionID;
this.WebSocket = new WebSocket((window.location.protocol === "https:" ? "wss://" : "ws://") + window.location.hostname + ":" + window.location.port + "?SessionID=" + this.SessionID);
this.WebSocket.onopen = this.onOpen;
this.WebSocket.onclose = this.onClose;
this.WebSocket.onmessage = this.onMessage;
this.WebSocket.onerror = this.onError;
},
close: function() {
this.WebSocket.close();
},
onOpen: function(Message) {
console.log("Open WebSocket " + Message);
},
onClose: function(Message) {
console.log("Close WebSocket " + Message);
},
onMessage: function(Message) {
var InMessage = JSON.parse(Message.data);
if (InMessage.Type == "Message") {
system.Messages.addMessage(InMessage);
}
if (InMessage.Type == "Command") {
if (InMessage.Command == "logout") {
system.logout();
document.location.href.reload();
}
}
//alert(InMessage.Title);
},
onError: function(Message) {
console.log("Error WebSocket " + Message);
}
});
var WxXMLNode = WxClass({
XMLNode: null,
MomIndex: -1,
initialize: function(XMLNode) {
this.XMLNode = XMLNode;
},
debug: function() {
return new XMLSerializer().serializeToString(this.XMLNode);
},
findNode: function (Name) {
var ret = null;
var Rest = "";
if (Name.indexOf(".") >= 0) {
Rest = Name.substring(Name.indexOf(".") + 1);
Name = Name.substring(0, Name.indexOf("."));
}
for (var i=0; i < this.XMLNode.childNodes.length; i++) {
if (this.XMLNode.childNodes[i].nodeName == Name) {
ret = new WxXMLNode(this.XMLNode.childNodes[i]);
if (Rest != "") ret = ret.findNode(Rest);
break;
}
}
return ret;
},
next: function() {
var Finder = true;
while(Finder) {
this.MomIndex++;
if (this.MomIndex >= this.XMLNode.childNodes.length) {
return false;
}
if (this.XMLNode.childNodes[this.MomIndex].nodeName == "#text" || this.XMLNode.childNodes[this.MomIndex].nodeName == "#comment") {
continue;
}
return true;
}
return false;
},
setll: function() {
this.MomIndex = -1;
},
getNode: function() {
return new WxXMLNode(this.XMLNode.childNodes[this.MomIndex]);
},
getAttribute: function(AttName) {
return this.getAttribute(AttName);
},
getString: function(FieldName) {
for (var i = 0; i < this.XMLNode.childNodes.length; i++) {
var Node = this.XMLNode.childNodes[i];
if (Node.nodeName == FieldName) {
if (Node.firstChild != null) return Node.firstChild.nodeValue;
else return "";
}
}
return null;
},
size: function() {
return this.XMLNode.childNodes.length;
}
});
var WxDataSource = WxClass({
Appl: null,
Name: null,
Command: null,
Plugin: null,
Auto: true,
Tables: null,
initialize: function(Appl, Name) {
this.Appl = Appl;
this.Name = Name;
this.Tables = new Array();
},
load: function(Args) {
if (this.Command != null) {
var RequestData = this.Command.load(Args)
//alert(RequestData);
if (RequestData.startsWith("{")) {
var jsonData = JSON.parse(RequestData);
if (jsonData.Output != null) {
for (var ti = 0; ti < jsonData.Output.Result.length; ti++) {
var DataTables = jsonData.Output.Result[ti];
for (var k in DataTables) {
var DataTable = new WxDataTable(k);
DataTable.setJSON(DataTables[k]);
this.Tables[k] = DataTable;
}
}
}
} else {
if (RequestData.substring(0, 5) == "= this.Rows.length) return false;
return true;
},
setll: function() {
this.MomRow = -1;
},
setJSON: function(Data) {
this.Fields = Data.Fields;
this.Rows = Data.Rows;
}
});
var WxXMLDataTable = WxClass({
TableName: null,
XMLData: null,
Rows: null,
RowCount: 0,
MomRow: -1,
initialize: function(TableName) {
this.TableName = TableName;
},
getXML: function() {
return this.XMLData;
},
setXML: function(Data) {
this.XMLData = Data;
this.MomRow = -1;
this.RowCount = Data.childNodes.length;
},
next: function() {
this.MomRow++;
if (this.MomRow >= this.RowCount) return false;
return true;
},
getString: function(FieldName) {
for (var i = 0; i < this.XMLData.childNodes.length; i++) {
var Node = this.XMLData.childNodes[i];
if (Node.nodeName == FieldName) {
if (Node.firstChild != null) return Node.firstChild.nodeValue;
else return "";
}
}
return null;
},
getRow: function() {
var Ret = new WxXMLDataTable("");
Ret.setXML(this.XMLData.childNodes[this.MomRow]);
return Ret;
},
getTable: function(TableName) {
for (var i = 0; i < this.XMLData.childNodes.length; i++) {
var Node = this.XMLData.childNodes[i];
if (Node.nodeName == TableName) {
var Ret = new WxXMLDataTable(TableName);
Ret.setXML(Node);
return Ret;
}
}
return null;
},
toString: function() {
if (window.ActiveXObject) { return this.XMLData.xml; }
return new XMLSerializer().serializeToString(this.XMLData);
}
});
var WxQuery = WxClass({
Database: null,
Tables: null,
initialize: function(Database) {
this.Database = Database;
this.Tables = new Array();
},
addTable: function(TableName) {
var Table = new WxTable(TableName);
this.Tables.push(Table);
return Table;
}
});
var WxSelectQuery = WxClass(WxQuery, {
Type: null,
initialize: function(Database, Type) {
this.$super(Database);
this.Type = "Select";
}
});
var WxTable = WxClass({
Table: null,
Fields: null,
Mappings: null,
LastTableName: null,
initialize: function(TableName) {
this.Table = TableName;
this.Fields = new Array();
this.Mappings = new Array();
},
addField: function(FieldName, Type) {
var Field = new WxField(FieldName, Type);
this.Fields.push(Field);
return Field;
},
addMapping: function(FieldName, RefFieldName) {
var Mapping = new WxMapping(FieldName, RefFieldName);
this.Mappings.push(Mapping);
}
});
var WxField = WxClass({
Field: null,
Type: null,
initialize: function(FieldName, Type) {
this.Field = FieldName;
this.Type = Type;
}
});
var WxMapping = WxClass({
Field: null,
Mapping: null,
initialize: function(FieldName, Mapping) {
this.Field = FieldName;
this.Mapping = Mapping;
}
});var WxPanel = WxClass({
Appl: null,
Parent: null,
PanelID : 0,
Content : null,
Info: null,
initialize : function(DivID) {
if (DivID != null && DivID != "") {
this.Content = document.getElementById(DivID);
this.Content.Object = this;
this.Content.style.border = "1px solid red";
} else {
this.Content = document.createElement("div");
this.Content.Object = this;
//this.Content.style.border = "1px solid red";
//if (wxsys != null) {
// wxsys.addPanel(this);
//}
}
},
addEvent : function(type, fn) {
if (type == "blur") alert("blur");
if (type.toLowerCase() == "enter") {
type = "keydown";
fn = "if (event.which == 13 || event.keyCode == 13) {" + fn + "}";
}
EventID = this.Appl.getEventID();
EventName = type + "Event_" + EventID;
var ToCallFunction = new Function("event", fn);
this.Appl[EventName] = ToCallFunction;
var caller = new Function("event", "this.Appl." + EventName + "(event);");
if (this.Content != null) {
this.Content.Appl = this.Appl;
if (this.Content.addEventListener) {
this.Content.addEventListener(type, caller, false);
} else if (this.Content.attachEvent) {
this.Content.attachEvent('on' + type, function() {
return caller.call(this.Content, window.event);
});
}
}
},
fireEvent: function(Element, event, Attributes){
if (document.createEventObject) {
// dispatch for IE
var evt = document.createEventObject();
if (Attributes) {
for (var K in Attributes) {
evt[K] = Attributes[K];
}
}
return Element.fireEvent('on'+event, evt);
} else {
// dispatch for firefox + others
var evt = document.createEvent("HTMLEvents");
evt.initEvent(event, true, true );
if (Attributes) {
for (var K in Attributes) {
evt[K] = Attributes[K];
}
}
return !Element.dispatchEvent(evt);
}
},
setHeight : function(Height) {
this.Content.style.height = Height;
},
setWidth : function(Width) {
this.Content.style.width = Width;
},
setMarginTop : function(MarginTop) {
this.Content.style.marginTop = MarginTop;
},
setMarginBottom : function(MarginBottom) {
this.Content.style.marginBottom = MarginBottom;
},
setMarginLeft : function(MarginLeft) {
this.Content.style.marginLeft = MarginLeft;
},
setMarginRight : function(MarginRight) {
this.Content.style.marginRight = MarginRight;
},
setStyle : function(Style) {
this.Content.style = this.Content.style + ";" + Style;
},
resize : function() {
},
drawTo : function(ElementName) {
var Element = document.getElementById(ElementName);
Element.appendChild(this.Content);
this.resize();
},
parseXML : function(XMLNode) {
},
parseXMLAttributes : function(XMLNode) {
if (XMLNode.getAttribute("id") != null) {
this.id = XMLNode.getAttribute("id");
this.Content.id = this.id;
}
if (XMLNode.getAttribute("style") != null) this.setStyle(XMLNode.getAttribute("style"));
if (XMLNode.getAttribute("height") != null) this.setHeight(XMLNode.getAttribute("height"));
if (XMLNode.getAttribute("width") != null) this.setWidth(XMLNode.getAttribute("width"));
if (XMLNode.getAttribute("marginTop") != null) this.setMarginTop(XMLNode.getAttribute("marginTop"));
if (XMLNode.getAttribute("marginBottom") != null) this.setMarginBottom(XMLNode.getAttribute("marginBottom"));
if (XMLNode.getAttribute("marginLeft") != null) this.setMarginLeft(XMLNode.getAttribute("marginLeft"));
if (XMLNode.getAttribute("marginRight") != null) this.setMarginRight(XMLNode.getAttribute("marginRight"));
if (XMLNode.getAttribute("backgroundColor") != null) this.Content.style.backgroundColor = XMLNode.getAttribute("backgroundColor");
if (XMLNode.getAttribute("fontColor") != null) this.Content.style.color = XMLNode.getAttribute("fontColor");
},
parseXMLEvents : function(XMLNode) {
for (var i = 0; i < XMLNode.childNodes.length; i++) {
var SubNode = XMLNode.childNodes[i];
if (SubNode.nodeName == "Event") {
var EventType = SubNode.getAttribute("type");
var EventValue = SubNode.childNodes[0].nodeValue;
this.addEvent(EventType, EventValue);
}
}
},
getElement : function(FromXMLNode) {
var ret = null;
if (FromXMLNode.getAttribute("modul") != null) {
if (system.Status.containsModul(FromXMLNode.getAttribute("modul")) == false) {
return null;
}
}
if (FromXMLNode.nodeName == "Info") {
if (this.Info == null) {
var Top = 40;
var Right = 35;
if (FromXMLNode.getAttribute("top")) {
Top = FromXMLNode.getAttribute("top");
}
if (FromXMLNode.getAttribute("right")) {
Right = FromXMLNode.getAttribute("right");
}
this.Info = new WxVerticalPanel();
this.InfoSubPanel = new WxVerticalPanel();
this.InfoSubPanel.setMarginTop(5);
this.Info.Content.style.position = "absolute";
this.Info.Content.style.right= Right + "px";
this.Info.Content.style.top = Top + "px";
this.Info.Content.style.width= "280px";
this.InfoSubPanel.Hidden = false;
this.Content.appendChild(this.Info.Content);
var Button = new WxIconButton("", "shell>icons/info32.png", 22);
Button.setWidth(25);
Button.Icon.Info = this.InfoSubPanel;
Button.Icon.style.border = "1px solid transparent";
Button.Icon.onclick = function(e) {
var Target;
if (!e) var e = window.event;
if (e.target) Target = e.target;
if (!Target.Info.Hidden) {
Target.Info.Hidden = true;
Target.Info.Content.style.visibility = "hidden";
Target.Info.Content.style.display = "none";
} else {
Target.Info.Hidden = false;
Target.Info.Content.style.visibility = "visible";
Target.Info.Content.style.display = "block";
}
};
var ButtonPanel = new WxBorderPanel();
ButtonPanel.setRight(Button);
this.Info.add(ButtonPanel);
}
this.Info.add(this.InfoSubPanel);
this.InfoSubPanel.Hidden = false;
this.InfoSubPanel.Content.style.visibility = "visible";
this.InfoSubPanel.Content.style.display = "block";
ret = this.InfoSubPanel;
}
if (FromXMLNode.nodeName == "Label")
ret = new WxLabel("");
if (FromXMLNode.nodeName == "IconLabel")
ret = new WxIconLabel("");
if (FromXMLNode.nodeName == "Image")
ret = new WxImage("");
if (FromXMLNode.nodeName == "Button")
ret = new WxButton("");
if (FromXMLNode.nodeName == "IconButton") {
var Title = "";
if (FromXMLNode.getAttribute("text")) {
Title = FromXMLNode.getAttribute("text");
}
ret = new WxIconButton(Title);
}
if (FromXMLNode.nodeName == "TextField")
ret = new WxTextField("");
if (FromXMLNode.nodeName == "TimeField")
ret = new WxTimeField("");
if (FromXMLNode.nodeName == "TextArea")
ret = new WxTextArea("");
if (FromXMLNode.nodeName == "ComboBox")
ret = new WxComboBox("");
if (FromXMLNode.nodeName == "CheckBox")
ret = new WxCheckBox("");
if (FromXMLNode.nodeName == "PasswordField")
ret = new WxPasswordField("");
if (FromXMLNode.nodeName == "MenuItem")
ret = new WxMenuItem();
if (FromXMLNode.nodeName == "BorderPanel")
ret = new WxBorderPanel();
if (FromXMLNode.nodeName == "LinePanel")
ret = new WxLinePanel();
if (FromXMLNode.nodeName == "TitledPanel")
ret = new WxTitledPanel(FromXMLNode.getAttribute("title"));
if (FromXMLNode.nodeName == "VerticalPanel")
ret = new WxVerticalPanel();
if (FromXMLNode.nodeName == "FormPanel")
ret = new WxFormPanel();
if (FromXMLNode.nodeName == "ButtonPanel")
ret = new WxButtonPanel();
if (FromXMLNode.nodeName == "CollapsePanel")
ret = new WxCollapsePanel("", true);
if (FromXMLNode.nodeName == "IconPanel")
ret = new WxIconPanel(FromXMLNode.getAttribute("title"), FromXMLNode.getAttribute("icon"));
if (FromXMLNode.nodeName == "Page")
ret = new WxPagePanel();
if (FromXMLNode.nodeName == "ButtonView")
ret = new WxButtonView();
if (FromXMLNode.nodeName == "Tree")
ret = new WxTree();
if (FromXMLNode.nodeName == "NavigationView")
ret = new WxNavigationView();
if (FromXMLNode.nodeName == "Table")
ret = new WxTable();
if (FromXMLNode.nodeName == "HeaderMenu")
ret = new WxHeaderMenu(this);
if (FromXMLNode.nodeName == "FileChooser")
ret = new WxFileChooser();
if (FromXMLNode.nodeName == "Folder")
ret = new WxFolderPanel();
if (FromXMLNode.nodeName == "Calendar")
ret = new WxCalendar();
if (FromXMLNode.nodeName == "DatePicker")
ret = new WxDatePicker();
if (FromXMLNode.nodeName == "MonthPicker")
ret = new WxMonthPicker();
if (FromXMLNode.nodeName == "ColorPicker")
ret = new WxColorPicker();
if (FromXMLNode.nodeName == "TablePanel")
ret = new WxTablePanel();
if (FromXMLNode.nodeName == "IFrame")
ret = new WxIFrame();
if (ret != null) {
ret.Appl = this.Appl;
ret.parseXML(FromXMLNode);
ret.parseXMLEvents(FromXMLNode);
ret.parseXMLAttributes(FromXMLNode);
if (FromXMLNode.getAttribute("id") != null && FromXMLNode.getAttribute("id") != "") {
this.Appl[FromXMLNode.getAttribute("id")] = ret;
}
}
return ret;
},
getPosition: function() {
var el = this.Content;
var _x = 0;
var _y = 0;
while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
_x += el.offsetLeft - el.scrollLeft;
_y += el.offsetTop - el.scrollTop;
el = el.offsetParent;
}
return { top: _y, left: _x };
},
getDocHeight: function() {
var D = document;
return Math.max(
D.body.scrollHeight, D.documentElement.scrollHeight,
D.body.offsetHeight, D.documentElement.offsetHeight,
D.body.clientHeight, D.documentElement.clientHeight
);
},
getDocWidth: function() {
var D = document;
return Math.max(
D.body.scrollWidth, D.documentElement.scrollWidth,
D.body.offsetWidth, D.documentElement.offsetWidth,
D.body.clientWidth, D.documentElement.clientWidth
);
}
});
var WxPopUp = WxClass(WxPanel, {
ParentContent: null,
Background: null,
Window: null,
IsOpen: false,
Width: 100,
Height: 200,
initialize : function(ParenContent) {
this.$super();
this.ParentContent = ParenContent;
this.Background = document.createElement("div");
this.Background.Object = this;
this.Background.style.position = "absolute";
this.Background.style.zIndex = "2";
this.Background.style.backgroundColor = "#666666";
this.Background.style.opacity = "0.1";
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Background.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.closeWindow();
}
Event.stopPropagation();
return false;
}
this.Window = document.createElement("div");
this.Window.style.position = "absolute";
this.Window.style.zIndex = "4";
this.Window.style.backgroundColor = "#ffffff";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.Window.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
Event.stopPropagation();
return false;
}
//this.ParentContent.Content.appendChild(this.Background);
//this.ParentContent.Content.appendChild(this.Window);
var Body = document.getElementsByTagName("body")[0];
Body.appendChild(this.Background);
Body.appendChild(this.Window);
},
add: function(Node) {
if (Node != null) {
this.Window.appendChild(Node.Content);
}
},
setWidth: function(Width) {
this.Width = Width;
},
setHeight: function(Height) {
this.Height = Height;
},
showOnParent: function(Side) {
if (Side == null) Side = "";
if (this.ParentContent) {
var Pos = this.ParentContent.getPosition();
Pos.top = Pos.top + this.ParentContent.Content.offsetHeight + 5;
Pos.left = Pos.left + 4;
if (Side == "left") {
Pos.left = Pos.left - this.Width + this.ParentContent.Content.offsetWidth + 4;
}
this.show(Pos.top, Pos.left);
}
},
load: function(ContentXML, Args) {
var Request = new WxRequest();
this.Window.Appl = Request.getXML(ContentXML, Args);
if (this.Window.Appl != null) {
this.Window.Appl.Parent = this.Parent;
this.Window.Appl.Popup = this;
this.Window.appendChild(this.Window.Appl.getContent().Content);
if (this.Window.Appl.afterLoad != null) {
this.Window.Appl.afterLoad();
}
}
},
show: function(Top, Left) {
if (this.IsOpen == true) {
this.closeWindow();
return;
}
this.IsOpen = true;
this.Background.style.left = 0 + "px";
this.Background.style.top = 0 + "px";
this.Background.style.height = this.getDocHeight() + "px";
this.Background.style.width = this.getDocWidth() + "px";
this.Background.style.display = "block";
this.Background.style.visibility = "visible";
this.Window.style.left = (Left-10) + "px";
this.Window.style.top = (Top-5) + "px";
this.Window.style.border = "1px solid black";
this.Window.style.height = this.Height + "px";
this.Window.style.width = this.Width + "px";
this.Window.style.display = "block";
this.Window.style.visibility = "visible";
},
closeWindow: function() {
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.IsOpen = false;
}
});
var WxPopUpMenu = WxClass(WxPanel, {
ParentContent: null,
Background: null,
Window: null,
IsOpen: false,
Width: 200,
Height: 25,
initialize : function(ParenContent) {
this.$super();
this.ParentContent = ParenContent;
this.Background = document.createElement("div");
this.Background.Object = this;
this.Background.style.position = "absolute";
this.Background.style.zIndex = "2";
this.Background.style.backgroundColor = "#666666";
this.Background.style.opacity = "0.1";
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Background.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.closeWindow();
}
Event.stopPropagation();
return false;
}
this.Window = document.createElement("div");
this.Window.Object = this;
this.Window.style.position = "absolute";
this.Window.style.zIndex = "4";
this.Window.style.backgroundColor = "#ffffff";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.Window.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
Event.stopPropagation();
this.Object.closeWindow();
return false;
}
var Body = document.getElementsByTagName("body")[0];
Body.appendChild(this.Background);
Body.appendChild(this.Window);
},
setWidth: function(Width) {
this.Width = Width;
},
setHeight: function(Height) {
this.Height = Height;
},
show: function(Top, Left) {
if (this.IsOpen == true) {
this.closeWindow();
return;
}
this.IsOpen = true;
this.Background.style.left = 0 + "px";
this.Background.style.top = 0 + "px";
this.Background.style.height = this.getDocHeight() + "px";
this.Background.style.width = this.getDocWidth() + "px";
this.Background.style.display = "block";
this.Background.style.visibility = "visible";
this.Window.style.left = (Left-10) + "px";
this.Window.style.top = (Top-5) + "px";
this.Window.style.border = "1px solid black";
this.Window.style.height = this.Heigth + "px";
this.Window.style.width = this.Width + "px";
this.Window.style.display = "block";
this.Window.style.visibility = "visible";
},
closeWindow: function() {
this.IsOpen = false;
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.IsOpen = false;
},
parseXML: function(MenuNode) {
for (var i = 0; i < MenuNode.childNodes.length; i++) {
var SubNode = MenuNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment") {
if (SubNode.nodeName == "MenuItem") {
var doIt = true;
if (SubNode.getAttribute("if") != null) {
doIt = eval(SubNode.getAttribute("if"));
}
if (doIt) {
var Item = this.getElement(SubNode);
this.Window.appendChild(Item.Content);
}
}
}
}
}
});
var WxBorderPanel = WxClass(WxPanel, {
Top : null,
Left : null,
Center : null,
Right : null,
Bottom : null,
initialize : function(DivID) {
this.$super(DivID);
var Table = document.createElement("table");
Table.cellPadding = "0";
Table.cellSpacing = "0";
//Table.border = "1";
Table.style.width = "100%";
Table.style.height = "100%";
TableRowTop = Table.insertRow(-1);
this.Top = TableRowTop.insertCell(-1);
this.Top.colSpan = "3";
this.Top.style.display = "none";
TableRowCenter = Table.insertRow(-1);
this.Left = TableRowCenter.insertCell(-1);
this.Left.style.verticalAlign = "Top";
//this.Left.style.border = "1px solid red";
this.Left.style.display = "none";
this.Center = TableRowCenter.insertCell(-1);
this.Center.style.height = "100%";
this.Center.style.width = "100%";
this.Center.style.verticalAlign = "Top";
//this.Center.style.border = "1px solid blue";
this.Right = TableRowCenter.insertCell(-1);
this.Right.style.verticalAlign = "Top";
this.Right.style.display = "none";
TableRowBottom = Table.insertRow(-1);
this.Bottom = TableRowBottom.insertCell(-1);
this.Bottom.colSpan = "3";
this.Bottom.style.display = "none";
this.Content.appendChild(Table);
},
resize : function() {
//window.console.log("BorderPanelResize:" + this.Content.offsetWidth);
if (this.Content.parentNode != null) {
if (this.Content.parentNode.id == "Content") {
//window.console.log("BorderPanel ParentNode:" + this.Content.parentNode.nodeName + ":" + this.Content.parentNode.id);
//window.console.log("BorderPanel ParentNode:" + this.Content.parentNode.offsetWidth + ":" + this.Content.parentNode.offsetHeight);
//this.Content.style.width = this.Content.parentNode.offsetWidth + "px";
//this.Content.style.height = this.Content.parentNode.offsetHeight + "px";
//this.Content.style.height = window.innerHeight + "px";
}
//this.Content.style.width = this.Content.parentNode.offsetWidth + "px";
//this.Content.style.height = this.Content.parentNode.offsetHeight + "px";
//this.Content.style.width = this.Content.parentNode.offsetWidth + "px";
//this.Content.firstChild.style.width = (this.Content.parentNode.offsetWidth - 2) + "px";
//this.Content.style.height = this.Content.parentNode.offsetHeight + "px";
//this.Content.firstChild.style.height = (this.Content.parentNode.offsetHeight - 2) + "px";
}
if (this.Content.parentNode != null) {
var CenterWidth = this.Content.parentNode.offsetWidth - 8;
if (this.Left.firstChild != null) {
CenterWidth = CenterWidth - this.Left.offsetWidth;
}
if (this.Right.firstChild != null) {
CenterWidth = CenterWidth - this.Right.offsetWidth;
}
if (this.Center.firstChild != null) {
this.Center.firstChild.style.width = CenterWidth;
this.Center.firstChild.style.height = "100%";
}
if (this.Left.firstChild != null) {
this.Left.firstChild.style.height = "100%";
}
}
//if (this.Left.firstChild != null) window.console.log("BorderPanelLeftResize:" + this.Left.offsetWidth);
//if (this.Center.firstChild != null) window.console.log("BorderPanelCenterResize:" + this.Center.offsetWidth);
if (this.Top.firstChild != null)
this.Top.firstChild.Object.resize();
if (this.Left.firstChild != null)
this.Left.firstChild.Object.resize();
if (this.Center.firstChild != null)
this.Center.firstChild.Object.resize();
if (this.Right.firstChild != null)
this.Right.firstChild.Object.resize();
if (this.Bottom.firstChild != null)
this.Bottom.firstChild.Object.resize();
},
setBottom : function(BottomElement) {
this.Bottom.appendChild(BottomElement.Content);
this.Bottom.style.display = "table-cell";
},
setTop : function(TopElement) {
this.Top.appendChild(TopElement.Content);
this.Top.style.display = "table-cell";
},
setLeft : function(LeftElement) {
this.Left.appendChild(LeftElement.Content);
this.Left.style.display = "table-cell";
},
setCenter : function(CenterElement) {
this.Center.appendChild(CenterElement.Content);
},
setCenterElement : function(CenterElement) {
this.Center.appendChild(CenterElement);
},
setRight : function(RightElement) {
this.Right.appendChild(RightElement.Content);
this.Right.style.display = "table-cell";
},
parseXML : function(BorderPanelNode) {
for (var i = 0; i < BorderPanelNode.childNodes.length; i++) {
var SubNode = BorderPanelNode.childNodes[i];
if (SubNode.nodeName != "#text"
&& SubNode.nodeName != "Event"
&& SubNode.nodeName != "Function"
&& SubNode.nodeName != "Variable"
&& SubNode.nodeName != "DataSource"
&& SubNode.nodeName != "#comment") {
if (SubNode.getAttribute("modul") != null) {
if (system.Status.containsModul(SubNode.getAttribute("modul")) == false) {
continue;
}
}
var Region = SubNode.getAttribute("region");
var Panel = null;
if (SubNode.getAttribute("load")) {
alert("load");
} else {
Panel = this.getElement(SubNode);
}
if (Panel != null) {
Panel.Parent = this;
if (Panel != null) {
if (Region == "Top")
this.setTop(Panel);
if (Region == "Bottom")
this.setBottom(Panel);
if (Region == "Left")
this.setLeft(Panel);
if (Region == "Center")
this.setCenter(Panel);
if (Region == "Right")
this.setRight(Panel);
} else {
alert("Node [" + SubNode.nodeName + "] nicht erkannt")
}
}
}
}
this.resize();
}
});
var WxLinePanel = WxClass(WxPanel, {
Table: null,
Row: null,
initialize : function() {
this.$super();
this.Table = document.createElement("table");
this.Table.cellPadding = "0";
this.Table.cellSpacing = "0";
this.Table.style.width = "100%";
this.Table.style.height = "100%";
this.Row = this.Table.insertRow(-1);
this.Content.appendChild(this.Table);
},
resize : function() {
},
parseXML : function(LinePanelNode) {
var Index = 0;
for (var i = 0; i < LinePanelNode.childNodes.length; i++) {
var SubNode = LinePanelNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment") {
if (SubNode.getAttribute("modul") != null) {
if (system.Status.containsModul(SubNode.getAttribute("modul")) == false) {
continue;
}
}
var doIt = true;
if (SubNode.getAttribute("if") != null) {
doIt = eval(SubNode.getAttribute("if"));
alert(doIt);
if (!doIt) continue;
}
var Panel = this.getElement(SubNode);
Panel.Parent = this;
if (Panel != null) {
var Cell = this.Row.insertCell(-1);
Cell.style.verticalAlign = "Top";
if (SubNode.getAttribute("width") != null && SubNode.getAttribute("width") != "") {
Cell.style.width = SubNode.getAttribute("width") + "px";
}
if (Index > 0) Cell.style.paddingLeft = "2px";
Cell.appendChild(Panel.Content);
Index++;
} else {
alert("Node [" + SubNode.nodeName + "] nicht erkannt")
}
}
}
this.resize();
}
});
var WxVerticalPanel = WxClass(WxPanel, {
initialize : function() {
this.$super();
},
add : function(Node) {
if (Node != null) {
this.Content.appendChild(Node.Content);
}
},
clear: function() {
wx.removeAllElementChildren(this.Content);
},
parseXML : function(VerticalPanelNode) {
for (var i = 0; i < VerticalPanelNode.childNodes.length; i++) {
var SubNode = VerticalPanelNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment") {
var ElementNode = this.getElement(SubNode);
if (ElementNode) this.add(ElementNode);
}
}
}
});var WxButtonView = WxClass(WxPanel, {
Top : null,
Bottom : null,
Panels: null,
initialize : function() {
this.$super();
this.Panels = new Array();
this.Content.style.height = "100%";
var Table = document.createElement("table");
Table.cellPadding = "0";
Table.cellSpacing = "0";
Table.style.height = "100%";
Table.style.width = "100%";
Table.style.padding = "3px";
var TableRow1 = Table.insertRow(-1);
this.Top = TableRow1.insertCell(-1);
this.Top.innerHTML = " ";
this.Top.style.verticalAlign = "Top";
this.Top.style.border = "1px solid #666666";
var TableRow2 = Table.insertRow(-1);
this.Bottom = TableRow2.insertCell(-1);
this.Bottom.style.height = "0px";
this.Content.appendChild(Table);
},
addButton : function(Button) {
var Table = document.createElement("table");
Table.cellPadding = "0";
Table.cellSpacing = "0";
Table.style.height = "30px";
Table.style.width = "100%";
Table.style.cursor = "pointer";
var TableRow = Table.insertRow(-1);
var ButtonCell = TableRow.insertCell(-1);
ButtonCell.appendChild(Button.Content);
TableRow.appendChild(ButtonCell);
Table.appendChild(TableRow);
this.Bottom.appendChild(Table);
this.Bottom.style.height = "30px";
},
load : function(LoadFile) {
if (LoadFile != null && LoadFile != "") {
if (LoadFile.startsWith("Panel:")) {
var PanelName = LoadFile.replace("Panel:", "");
wx.removeAllElementChildren(this.Top);
this.Top.appendChild(this.Panels[PanelName].Content);
this.Panels[PanelName].resize();
} else {
var Request = new WxRequest();
var Application = Request.getXML(LoadFile);
Application.Parent = this.Appl;
wx.removeAllElementChildren(this.Top);
this.Top.appendChild(Application.Panel.Content);
Application.Panel.resize();
}
}
},
resize: function() {
if (this.Content.parentNode.offsetWidth > 0) {
this.Content.style.width = (this.Content.parentNode.offsetWidth + 3) + "px";
}
if (this.Content.parentNode.offsetHeight > 0) {
var Height = this.Bottom.offsetHeight + 8;
this.Top.style.height = (this.Content.parentNode.offsetHeight - Height) + "px";
}
for (var Key in this.Panels) {
this.Panels[Key].resize();
}
},
parseXML : function(ButtonViewNode) {
for (var i = 0; i < ButtonViewNode.childNodes.length; i++) {
var SubNode = ButtonViewNode.childNodes[i];
if (SubNode.nodeName == "Button") {
var OID = this.OID;
var Button = new WxSimpleButton(SubNode.getAttribute("text"));
Button.Parent = this;
Button.setHeight("30px");
Button.Content.style.marginTop = "3px";
Button.Content.style.border = "1px solid #666666";
Button.Content.style.backgroundColor = "#f1f1f1";
Button.LoadFile = SubNode.getAttribute("load")
Button.Content.onclick = function(Event) {
this.Object.Parent.load(this.Object.LoadFile);
}
this.addButton(Button);
if (SubNode.childNodes.length > 0) {
Button.LoadFile = "Panel:" + SubNode.getAttribute("name")
var Panel = new WxBorderPanel();
Panel.Parent = this;
Panel.Appl = this.Appl;
Panel.parseXML(SubNode);
Panel.Content.style.width = "100%";
Panel.Content.style.height = "100%";
this.Panels[SubNode.getAttribute("name")] = Panel;
}
if (SubNode.getAttribute("selected") != null) {
if (SubNode.getAttribute("selected") == "true") {
this.load(Button.LoadFile);
}
}
}
}
}
});var WxTitledPanel = WxClass(WxPanel, {
Table: null,
TitleCell : null,
BodyCell : null,
initialize : function(Title) {
this.$super();
this.Content.style.margin = "3px";
this.Content.style.border = "1px solid #666666";
this.Table = document.createElement("table");
this.Table.cellPadding = "0";
this.Table.cellSpacing = "0";
this.Table.style.width = "100%";
//Table.style.height = "100%";
this.TitleCell = document.createElement("td");
this.TitleCell.style.height = "30px";
this.TitleCell.style.backgroundColor = "#666666";
this.TitleCell.style.paddingLeft = "5px";
this.TitleCell.style.color = "#ffffff";
if (Title != null)
this.TitleCell.innerHTML = Title;
this.BodyCell = document.createElement("td");
this.BodyCell.style.verticalAlign = "Top";
this.BodyCell.style.height = "100%";
this.BodyCell.style.padding = "3px";
var TableRow1 = document.createElement("tr");
var TableRow2 = document.createElement("tr");
TableRow1.appendChild(this.TitleCell);
TableRow2.appendChild(this.BodyCell);
this.Table.appendChild(TableRow1);
this.Table.appendChild(TableRow2);
this.Content.appendChild(this.Table);
},
add : function(Node) {
Node.Content.style.height = "100%";
this.BodyCell.appendChild(Node.Content);
},
setVisible : function(Title) {
if (Title != null && Title == "*")
this.Content.style.height = "100px";
},
setTitleFontSize: function(FontSize) {
this.TitleCell.style.fontSize = parseInt(FontSize) + "px";
},
setTitleHeight: function(Height) {
this.TitleCell.style.height = parseInt(Height) + "px";
},
parseXML : function(TitledPanelNode) {
if (TitledPanelNode.getAttribute("fontSize")) {
this.Table.style.fontSize = TitledPanelNode.getAttribute("fontSize") + "px";
}
if (TitledPanelNode.getAttribute("titleHeight")) {
this.TitleCell.style.height = TitledPanelNode.getAttribute("titleHeight") + "px";
}
for (var i = 0; i < TitledPanelNode.childNodes.length; i++) {
var SubNode = TitledPanelNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment") {
var ElementNode = this.getElement(SubNode);
this.add(ElementNode);
}
}
}
});
var WxFormPanel = WxClass(WxPanel, {
Table : null,
FontSize: null,
TitleWidth: 120,
initialize : function() {
this.$super();
this.Table = document.createElement("table");
this.Table.cellPadding = "0";
this.Table.cellSpacing = "0";
this.Table.style.width = "100%";
this.Table.style.heigth = "100px";
this.Content.appendChild(this.Table);
},
add : function(Title, Node) {
var TableRow = this.Table.insertRow(-1);
var TitleCell = TableRow.insertCell(-1);
TitleCell.style.verticalAlign = "Top";
TitleCell.style.width = this.TitleWidth + "px";
if (this.FontSize != null) TitleCell.style.fontSize = this.FontSize;
if (Title != null)
TitleCell.innerHTML = Title + ":";
var BodyCell = TableRow.insertCell(-1);
if (this.FontSize != null) BodyCell.style.fontSize = this.FontSize;
BodyCell.appendChild(Node.Content);
BodyCell.style.paddingBottom = "2px";
//BodyCell.style.border = "1px solid red";
},
setTitleWidth: function(TWidth) {
this.TitleWidth = TWidth;
},
parseXML : function(FormPanelNode) {
if (FormPanelNode.getAttribute("fontSize")) {
this.FontSize = FormPanelNode.getAttribute("fontSize") + "px";
}
if (FormPanelNode.getAttribute("padding") != null) {
this.Content.style.padding = FormPanelNode.getAttribute("padding") + "px";
}
if (FormPanelNode.getAttribute("titleWidth") != null) {
this.TitleWidth = FormPanelNode.getAttribute("titleWidth");
}
for (var i = 0; i < FormPanelNode.childNodes.length; i++) {
var SubNode = FormPanelNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment") {
var ElementNode = this.getElement(SubNode);
if (ElementNode) {
this.add(SubNode.getAttribute("title"), ElementNode);
if (SubNode.getAttribute("id") != null && SubNode.getAttribute("id") != "") {
this[SubNode.getAttribute("id")] = ElementNode;
}
}
}
}
}
});var WxButtonPanel = WxClass(WxPanel, {
TableRow : null,
ButtonWidth : 100,
initialize : function() {
this.$super();
var Table = document.createElement("table");
Table.cellPadding = "0";
Table.cellSpacing = "0";
Table.style.width = "100%";
// Table.style.border="1px dotted #e5e5e5";
this.TableRow = Table.insertRow(-1);
var TableCell = this.TableRow.insertCell(-1);
TableCell.innerHTML = " ";
this.Content.appendChild(Table);
},
addButton : function(Button, Side) {
if (Side == null) Side = "right";
Side = Side.toLowerCase();
if (Side == "right") {
var TableCell = this.TableRow.insertCell(-1);
TableCell.style.width = this.ButtonWidth + "px";
TableCell.appendChild(Button.Content);
} else {
var TableCell = this.TableRow.insertCell(0);
TableCell.style.width = this.ButtonWidth + "px";
TableCell.appendChild(Button.Content);
}
this.TableRow.parentNode.parentNode.style.height = TableCell.style.height;
},
setButtonWidth : function(Width) {
this.ButtonWidth = Width;
},
parseXML : function(ButtonPanelNode) {
for (var i = 0; i < ButtonPanelNode.childNodes.length; i++) {
var SubNode = ButtonPanelNode.childNodes[i];
if (SubNode.nodeName == "Button") {
var Button = this.getElement(SubNode);
if (Button) {
Button.Parent = this;
var Side = "right";
if (SubNode.getAttribute("side") != "") {
Side = SubNode.getAttribute("side");
}
this.addButton(Button, Side);
}
}
if (SubNode.nodeName == "SimpleButton") {
var Button = this.getElement(SubNode);
if (Button) {
Button.Parent = this;
this.addButton(Button);
}
}
if (SubNode.nodeName == "IconButton") {
var Button = this.getElement(SubNode);
if (Button) {
Button.Parent = this;
this.addButton(Button);
}
}
}
}
});var WxFolderPanel = WxClass(WxPanel, {
Header : null,
Folder : null,
InnerFolder : null,
HeaderHeight: 35,
HeaderFontSize: null,
HeaderRow: null,
HeaderFirstCell: null,
HeaderLastCell: null,
Tabs: null,
TabContents: null,
TabWidth: 120,
Orientation: "top",
SelectedTabKey: "",
InnerContentBorder: 0,
initialize : function(Orientation) {
this.$super();
this.Tabs = new Array();
this.TabContents = new Array();
this.Header = document.createElement("table");
this.Header.cellPadding = "0";
this.Header.cellSpacing = "0";
this.Header.style.width = "100%";
this.Header.style.height = this.HeaderHeight + "px";
this.HeaderRow = this.Header.insertRow();
this.HeaderFirstCell = this.HeaderRow.insertCell();
this.HeaderFirstCell.style.height = this.HeaderHeight + "px";
this.HeaderFirstCell.style.width = "3px";
this.HeaderFirstCell.style.backgroundColor = "#e5e5e5";
this.HeaderFirstCell.style.fontSize = "1px";
this.HeaderFirstCell.innerHTML = " ";
this.HeaderLastCell = this.HeaderRow.insertCell(-1);
this.HeaderLastCell.style.backgroundColor = "#e5e5e5";
this.HeaderLastCell.style.height = this.HeaderHeight + "px";
this.HeaderLastCell.style.borderLeft = "1px solid #666666";
this.HeaderLastCell.innerHTML = " "
this.Folder = document.createElement("div");
this.Folder.style.width = "100%";
//this.Folder.style.height = this.HeaderHeight + "px";
this.InnerFolder = document.createElement("div");
//this.InnerFolder.style.height = this.HeaderHeight + "px";
this.InnerFolder.style.border= this.InnerContentBorder + "px solid #ffffff";
this.Folder.appendChild(this.InnerFolder);
},
addTab: function(Key, Title, TabNode, Closeable) {
var TabPanel = new WxBorderPanel();
//TabPanel.Content.style.border = "1px solid red";
TabPanel.Appl = this.Appl;
if (TabNode != null) TabPanel.parseXML(TabNode);
if (Closeable == null) Closeable = false;
this.TabContents[Key] = TabPanel;
var TitleCell = document.createElement("td");
TitleCell.Object = this;
TitleCell.Key = Key;
TitleCell.style.verticalAlign = "Bottom";
TitleCell.style.backgroundColor = "#e5e5e5";
TitleCell.style.height = this.HeaderHeight + "px";
TitleCell.style.width = this.TabWidth + "px";
TitleCell.onmouseover = this.onMouseOver;
TitleCell.onmouseout = this.onMouseOut;
TitleCell.onclick = this.onClick;
var TitleDiv = document.createElement("div");
TitleDiv.style.height = (this.HeaderHeight - 2) + "px";
TitleDiv.style.borderLeft = "1px solid #666666";
TitleDiv.style.borderTop = "1px solid #666666";
TitleDiv.style.borderBottom = "1px solid #666666";
TitleDiv.style.textAlign = "Center";
if (Title != null) {
var TitleTable = document.createElement("Table");
TitleTable.style.width = "100%";
TitleTable.cellSpacing = "0";
TitleTable.cellPadding = "0";
var TitleTableRow = TitleTable.insertRow();
var TitleTableCell1 = TitleTableRow.insertCell();
TitleTableCell1.style.textAlign = "Center";
if (this.HeaderFontSize != null) {
TitleTableCell1.style.fontSize = this.HeaderFontSize + "px";
}
TitleTableCell1.innerHTML = " " + Title;
if (Closeable) {
var TitleTableCell2 = TitleTableRow.insertCell(-1);
TitleTableCell2.Object = this;
TitleTableCell2.Key = Key;
TitleTableCell2.innerHTML = "X";
TitleTableCell2.style.width="20px";
TitleTableCell2.style.textAlign = "Center";
TitleTableCell2.onclick = this.onCloseClick;
}
TitleDiv.appendChild(TitleTable);
}
TitleCell.appendChild(TitleDiv);
this.Tabs[Key] = TitleCell;
this.HeaderRow.insertBefore(TitleCell, this.HeaderLastCell);
},
containsTab: function(Key) {
if (this.Tabs[Key] != null) return true;
return false;
},
loadTo: function(Key, LoadFile, Args) {
var Request = new WxRequest();
var Application = Request.getXML(LoadFile, Args);
Application.Parent = this;
Application.getContent().parentNode = this.InnerFolder;
Application.getContent().resize();
this.TabContents[Key] = Application.getContent();
this.TabContents[Key].resize();
},
setSelectedTab: function(Key) {
var Tab = this.Tabs[Key];
if (Tab != null) {
if (this.SelectedTabKey != "") {
var Cell = this.Tabs[this.SelectedTabKey];
if (Cell != null) {
Cell.OldBackgroundColor = "#e5e5e5";
Cell.style.backgroundColor = "#e5e5e5";
if (this.Orientation == "top") Cell.firstChild.style.borderBottom = "1px solid #666666";
if (this.Orientation == "bottom") Cell.firstChild.style.borderTop = "1px solid #666666";
}
}
this.SelectedTabKey = Key;
var Cell = this.Tabs[this.SelectedTabKey];
if (Cell != null) {
Cell.OldBackgroundColor = "#ffffff";
Cell.style.backgroundColor = "#ffffff";
if (this.Orientation == "top") Cell.firstChild.style.borderBottom = "1px solid #ffffff";
if (this.Orientation == "bottom") Cell.firstChild.style.borderTop = "1px solid #ffffff";
wx.removeAllElementChildren(this.InnerFolder);
this.InnerFolder.appendChild(this.TabContents[Key].Content);
this.TabContents[Key].resize();
}
}
},
resize: function() {
this.Content.style.width = this.Content.parentNode.offsetWidth + "px";
this.Content.style.height = this.Content.parentNode.offsetHeight + "px";
this.Folder.style.height = (this.Content.parentNode.offsetHeight - this.HeaderHeight - 7) + "px";
this.Folder.style.width = (this.Content.parentNode.offsetWidth -2) + "px";
var BW = this.InnerContentBorder * 2;
this.InnerFolder.style.width = (this.Content.parentNode.offsetWidth - BW - 2) + "px";
this.InnerFolder.style.height = (this.Content.parentNode.offsetHeight - this.HeaderHeight - BW - 5) + "px";
for (Tab in this.TabContents) {
this.TabContents[Tab].resize();
}
},
removeTab: function(Key) {
var Tab = this.Tabs[Key];
if (Tab != null) {
var PrevTabKey = "";
for (var i=0; i < this.HeaderRow.cells.length; i++) {
var Cell = this.HeaderRow.cells[i];
if (Cell.Key != null) {
if (Cell.Key == Key) break;
PrevTabKey = Cell.Key;
}
}
var DeletIndex = -1;
for (var i=0; i < this.HeaderRow.cells.length; i++) {
var Cell = this.HeaderRow.cells[i];
if (Cell.Key != null) {
if (Cell.Key == Key) {
DeleteIndex = i;
break;
}
}
}
this.HeaderRow.deleteCell(DeleteIndex);
this.Tabs[Key] = null;
this.TabContents[Key] = null;
this.setSelectedTab(PrevTabKey);
this.fireEvent(this.Content, "tabClosed");
}
},
onMouseOver: function(Event) {
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = "#ffffff";
},
onMouseOut: function(Event) {
this.style.backgroundColor = this.OldBackgroundColor;
},
onClick: function(Event) {
this.Object.setSelectedTab(this.Key);
},
onCloseClick: function(Event) {
this.Object.removeTab(this.Key);
},
parseXML : function(FolderPanelNode) {
var SelectedKey = "";
var Orientation = FolderPanelNode.getAttribute("align");
if (Orientation == null) Orientation = "top";
Orientation = Orientation.toLowerCase();
var TabWidth = FolderPanelNode.getAttribute("tabWidth");
if (TabWidth != null && TabWidth != "") this.TabWidth = TabWidth;
var FontSize = FolderPanelNode.getAttribute("fontSize");
if (FontSize != null && FontSize != "") this.HeaderFontSize = FontSize;
if (FolderPanelNode.getAttribute("ontabclosed") != null && FolderPanelNode.getAttribute("ontabclosed") != "") {
this.addEvent("tabClosed", "this." + FolderPanelNode.getAttribute("ontabclosed") + ";");
}
if (Orientation == "top") {
this.Orientation = "top";
this.Header.style.borderTop = "3px solid #e5e5e5";
this.HeaderFirstCell.style.borderBottom = "1px solid #666666";
this.HeaderLastCell.style.borderBottom = "1px solid #666666";
this.Folder.style.borderLeft = "1px solid #666666";
this.Folder.style.borderRight = "1px solid #666666";
this.Folder.style.borderBottom = "1px solid #666666";
this.Content.appendChild(this.Header);
this.Content.appendChild(this.Folder);
}
if (Orientation == "bottom") {
this.Orientation = "bottom";
this.Header.style.borderBottom = "3px solid #e5e5e5";
this.HeaderFirstCell.style.borderTop = "1px solid #666666";
this.HeaderLastCell.style.borderTop = "1px solid #666666";
this.Folder.style.borderLeft = "1px solid #666666";
this.Folder.style.borderRight = "1px solid #666666";
this.Folder.style.borderTop = "1px solid #666666";
this.Content.appendChild(this.Folder);
this.Content.appendChild(this.Header);
}
var TabHeight = FolderPanelNode.getAttribute("tabHeight");
if (TabHeight != null && TabHeight != "") {
this.HeaderHeight = TabHeight;
this.Header.style.height = this.HeaderHeight + "px";
this.HeaderFirstCell.style.height = this.HeaderHeight + "px";
this.HeaderLastCell.style.height = this.HeaderHeight + "px";
}
for (var i = 0; i < FolderPanelNode.childNodes.length; i++) {
var SubNode = FolderPanelNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment" && SubNode.nodeName != "Event") {
var ElementNode = this.getElement(SubNode);
this.addTab(SubNode.getAttribute("key"), SubNode.getAttribute("title"), SubNode, false);
if (SubNode.getAttribute("selected") == "true") {
SelectedKey = SubNode.getAttribute("key");
}
}
}
if (SelectedKey != "") {
this.setSelectedTab(SelectedKey);
}
}
});var WxNavigationView = WxClass(WxPanel, {
Container : null,
OpenTabs : null,
OpenPath : null,
initialize : function() {
this.$super();
this.OpenTabs = new Array();
this.OpenPath = new Array();
this.Content.style.height = "100%";
this.Content.style.width = "100%";
this.Content.style.paddingTop = "3px";
this.Content.style.marginLeft = "3px";
this.Content.style.marginRight = "3px";
this.Container = document.createElement("div");
this.Container.style.height = "100%";
this.Container.style.border = system.getStyle("NavigationView", "Border");
this.Container.style.backgroundColor = system.getStyle("NavigationView", "Background");
this.Content.appendChild(this.Container);
},
addTab : function(Key, Title, Icon, FileName, Args) {
if (this.OpenTabs[Key] == null) {
var NewTab = new WxNavigationViewTab(this, Key, Title, Icon);
wx.removeAllElementChildren(this.Container);
this.Container.appendChild(NewTab.Content);
NewTab.load(FileName, Args);
this.OpenTabs[Key] = NewTab;
NewTab.resize();
this.OpenPath.push(Key);
} else {
var OldTab = this.OpenTabs[Key];
wx.removeAllElementChildren(this.Container);
this.Container.appendChild(OldTab.Content);
OldTab.resize();
OldTab.TabAppl.reloadDataSources();
this.OpenPath.push(Key);
}
},
removeTab: function(Key) {
if (this.OpenTabs[Key] != null) {
this.OpenTabs[Key] = null;
for(var i = this.OpenTabs.length - 1; i >= 0; i--) {
if(this.OpenTabs[i] === Key) {
this.OpenTabs.splice(i, 1);
}
}
wx.removeAllElementChildren(this.Container);
for(var i = this.OpenPath.length - 1; i >= 0; i--) {
if(this.OpenPath[i] === Key) {
this.OpenPath.splice(i, 1);
}
}
if (this.OpenPath.length > 0) {
var NewKey = this.OpenPath[this.OpenPath.length-1];
var OldTab = this.OpenTabs[NewKey];
this.Container.appendChild(OldTab.Content);
OldTab.resize();
}
}
},
resize : function() {
//alert("NView: " + this.Content.parentNode.offsetWidth);
this.Content.style.height = (this.Content.parentNode.offsetHeight - 8) + "px";
this.Content.style.width = (this.Content.parentNode.offsetWidth - 10) + "px";
//this.Container.style.width = (this.Content.offsetWidth) + "px";
for ( var Key in this.OpenTabs) {
this.OpenTabs[Key].resize();
}
}
});var WxNavigationViewTab = WxClass(WxPanel, {
Parent: null,
HeaderCell : null,
BodyCell : null,
Key: null,
TabAppl: null,
initialize : function(Parent, Key, Title, Icon) {
this.$super();
this.Parent = Parent;
this.Key = Key;
var Table = document.createElement("table");
Table.cellPadding = "0";
Table.cellSpacing = "0";
Table.style.height = "100%";
Table.style.width = "100%";
var TableRow1 = document.createElement("tr");
this.HeaderCell = document.createElement("td");
this.HeaderCell.style.height = "30px";
this.HeaderCell.style.backgroundColor = system.getStyle("NavigationViewTab", "TitleBackground");
this.HeaderCell.style.color = "#ffffff";
this.HeaderCell.style.paddingLeft = "3px";
this.HeaderCell.appendChild(this.buildHeader(Title, Icon));
var TableRow2 = document.createElement("tr");
this.BodyCell = document.createElement("td");
this.BodyCell.innerHTML = " ";
this.BodyCell.style.width = "100%";
TableRow1.appendChild(this.HeaderCell);
TableRow2.appendChild(this.BodyCell);
Table.appendChild(TableRow1);
Table.appendChild(TableRow2);
this.Content.style.height = this.Parent.Content.offsetHeight;
this.Content.appendChild(Table);
},
buildHeader: function(Title, IconName) {
var Table = document.createElement("table");
Table.cellPadding="0";
Table.cellSpacing="0";
Table.style.width="100%";
Table.style.height = "24px";
//Table.border = "1";
if (IconName == null) {
IconName = "gui/icons/job32.png";
}
var Image = document.createElement("img");
Image.src = IconName;
Image.style.width = "22px";
var IconCell = document.createElement("td");
IconCell.style.verticalAlign = "Center";
IconCell.style.textAlign = "Center";
IconCell.style.width = "28px";
IconCell.appendChild(Image);
var TextCell = document.createElement("td");
TextCell.style.color = system.getStyle("NavigationViewTab", "TitleForeground");
TextCell.innerHTML = Title;
var CloseCell = document.createElement("td");
CloseCell.Object = this;
CloseCell.style.cursor = "pointer";
CloseCell.style.width="20px";
CloseCell.style.color = system.getStyle("NavigationViewTab", "TitleForeground");
CloseCell.innerHTML = "X";
CloseCell.onclick = function(Event) {
if (!Event) Event = window.event;
Event.target.Object.close();
};
var TableRow = document.createElement("tr");
TableRow.appendChild(IconCell);
TableRow.appendChild(TextCell);
TableRow.appendChild(CloseCell);
Table.appendChild(TableRow);
return Table;
},
close: function() {
this.Parent.removeTab(this.Key);
},
load : function(LoadFile, Args) {
var Request = new WxRequest();
this.TabAppl = Request.getXML(LoadFile, Args);
this.TabAppl.getContent().setHeight("100%");
wx.removeAllElementChildren(this.BodyCell);
this.BodyCell.appendChild(this.TabAppl.getContent().Content);
},
resize : function() {
//this.Content.style.height = this.Content.parentNode.offsetHeight;
if (this.Content.parentNode != null) {
this.Content.style.width = this.Content.parentNode.offsetWidth -2 + "px";
this.Content.style.height = this.Content.parentNode.offsetHeight + "px";
this.BodyCell.style.width = this.Content.parentNode.offsetWidth -2 + "px";
this.BodyCell.style.height = this.Content.parentNode.offsetHeight - this.HeaderHeight + "px";
this.BodyCell.firstChild.style.width = this.Content.parentNode.offsetWidth -2 + "px";
//this.BodyCell.firstChild.style.height = this.Content.parentNode.offsetHeight - this.HeaderHeight + "px";
if (this.BodyCell.firstChild != null && this.BodyCell.firstChild.Object != null) this.BodyCell.firstChild.Object.resize();
//window.console.log("Content.Parent:" + this.Content.parentNode.offsetWidth);
//window.console.log("Content:" + this.Content.offsetWidth);
//window.console.log("Body.Cell:" + this.BodyCell.offsetWidth);
}
}
});
var WxTablePanel = WxClass(WxPanel, {
Table: null,
ColumnsRow: null,
ColumnWidths : null,
ColumnIcons : null,
ColumnStyles : null,
ColumnsTable: null,
Data: null,
Keys : null,
SelectedIndex: -1,
SelectedCell: -1,
Index: -1,
FontSize: null,
PopupMenu: null,
CellPadding: "2",
IconWidth: "",
initialize : function() {
this.$super();
this.ColumnWidths = new Array();
this.ColumnIcons = new Array();
this.ColumnFormats = new Array();
this.ColumnStyles = new Array();
//document.oncontextmenu = this.onRightClick;
this.ColumnsTable = document.createElement("table");
this.ColumnsTable.cellSpacing = "0";
this.ColumnsTable.cellPadding = "0";
this.ColumnsTable.style.width = "100%";
this.Table = document.createElement("table");
this.Table.cellSpacing = "0";
this.Table.cellPadding = "0";
this.Table.style.width = "100%";
//this.Table.border = "1";
this.Content.style.fontSize = "10px";
this.Data = new Array();
this.Keys = new Array();
this.ColumnsRow = this.ColumnsTable.insertRow(-1);
this.Content.appendChild(this.ColumnsTable)
this.Content.appendChild(this.Table)
this.PopupMenu = new WxPopUpMenu(this);
},
addColumn: function (Icon, Text, Width, Format, Style) {
if (Format == null) Format = "";
if (Style == null) Style = "";
this.ColumnWidths.push(Width);
this.ColumnIcons.push(Icon);
this.ColumnFormats.push(Format);
this.ColumnStyles.push(Style);
var Column = this.ColumnsRow.insertCell(-1);
if (this.FontSize != null) {
Column.style.fontSize = this.FontSize;
}
Column.style.paddingLeft = "2px";
Column.style.paddingRight = "2px";
Column.style.color = system.getStyle("SimpleTable", "ColumnForeground");
Column.style.borderRight = "1px solid " + system.getStyle("SimpleTable", "ColumnBorder");
Column.style.borderBottom = "1px solid " + system.getStyle("SimpleTable", "ColumnBorder");
if (Width != "0") {
this.ColumnsWidth = this.ColumnsWidth + parseInt(Width);
Column.style.width = (parseInt(Width)-1) + "px";
}
if (Style != "") {
if (Style.toLowerCase().indexOf("rightalign") >= 0) {
Column.style.textAlign="Right";
}
}
Column.innerHTML = Text;
},
addRow: function (Row, Key, Styles, WithIcons, WithClickEvent) {
if (Row == null) return;
if (Key == null) Key = new Array();
if (Styles == null) Styles = new Array();
if (WithIcons == null) WithIcons = true;
if (WithClickEvent == null) WithClickEvent = true;
this.Index = this.Index + 1;
var NewIndex = this.Index;
var GesWidth = 0;
var Variable = false;
this.Data.push(Row);
this.Keys.push(Key);
var Cells = this.Table.insertRow(-1);
Cells.style.backgroundColor = "#ffffff";
Cells.Object = this;
Cells.RowIndex = NewIndex;
Cells.onmouseover = this.onMouseOver;
Cells.onmouseout = this.onMouseOut;
if (WithClickEvent) Cells.onclick = this.onMouseClick;
//if (NewIndex % 2 != 0) {
// Cells.style.backgroundColor = system.getStyle("SimpleTable", "SecondRowBackground");
//}
for (var i = 0; i < Row.length; i++) {
if (i < this.ColumnWidths.length) {
var Icon = this.ColumnIcons[i];
var Cell = Cells.insertCell(-1);
Cell.Object = this;
//Cell.style.borderRight = "1px solid black";
//console.log(this.CellPadding);
if (this.CellPadding != null && this.CellPadding != "0") {
Cell.style.paddingLeft = this.CellPadding + "px";
Cell.style.paddingRight = this.CellPadding + "px";
} else {
Cell.style.padding = "0px";
Cell.style.margin = "0px";
}
Cell.style.verticalAlign = "Top";
if (this.ColumnWidths[i] != "0") {
GesWidth = GesWidth + parseInt(this.ColumnWidths[i]);
Cell.style.width = this.ColumnWidths[i] + "px";
} else {
Variable = true;
}
if (Styles[i] != null) {
var CellStyles = Styles[i].split(";");
for (var csy = 0; csy < CellStyles.length; csy++) {
var CellStyle = CellStyles[csy].split(":");
if (CellStyle.length == 2) {
Cell.style[CellStyle[0].trim()] = CellStyle[1].trim();
}
}
}
var ci = i;
Cell.Index = ci;
Cell.onclick = function () {
this.Object.SelectedCell = this.Index;
}
if (this.ColumnStyles[i] != "") {
if (this.ColumnStyles[i].toLowerCase().indexOf("rightalign") >= 0) {
Cell.style.textAlign="Right";
}
}
if (Row[i] == "" && Icon != "") {
Cell.Data = Icon;
if (WithIcons) {
var Image = document.createElement("img");
Image.src = Icon;
Image.style.width = "24px";
if (this.IconWidth != "") Image.style.width = this.IconWidth;
Cell.appendChild(Image);
}
} else {
Cell.Data = Row[i];
if (this.ColumnFormats[i] != "") {
if (this.ColumnFormats[i] == "longdate") {
var LongDate = new WxDate(parseFloat(Row[i]));
//Cell.innerHTML = LongDate.toLocaleFormat("%d.%m.%Y") + " " + LongDate.toLocaleFormat("%H:%M");
Cell.innerHTML = LongDate.format();
}
if (this.ColumnFormats[i] == "date") {
var StringDate = new WxDate(Row[i], "yyyyMMdd");
Cell.innerHTML = StringDate.format();
}
if (this.ColumnFormats[i] == "currency") {
var num = new Number(Row[i]);
Cell.innerHTML = num.formatCurrency() + " €";
}
if (this.ColumnFormats[i] == "check") {
var ColumnIndex = i;
var Check = document.createElement("input");
Check.type="checkbox";
Check.ColumnIndex = ColumnIndex;
Check.onclick = function(Event) {
var Table = this.parentNode.parentNode;
var Checked = "off";
if (this.checked) {
Checked = "on";
}
Table.Checked = Checked;
Table.Object.Data[Table.RowIndex][this.ColumnIndex] = Checked;
}
if (Row[i] != "on" && Row[i] != "off") {
Row[i] = "off";
}
if (Row[i] == "on") {
Check.checked = "true";
}
Cell.style.verticalAlign="Center";
Cell.appendChild(Check)
}
if (this.ColumnFormats[i] == "disabledCheck") {
var ColumnIndex = i;
var DCheck = document.createElement("input");
DCheck.type="checkbox";
DCheck.disabled = true;
DCheck.ColumnIndex = ColumnIndex;
if (Row[i] == "on" || Row[i] == "true" || Row[i] == "yes") {
DCheck.checked = "true";
}
Cell.style.verticalAlign="Center";
Cell.appendChild(DCheck)
}
} else {
if (Row[i] == "") Cell.innerHTML = " ";
else Cell.innerHTML = Row[i];
}
}
}
}
},
getRow: function(Index) {
return this.Data[Index];
},
getRowCount: function() {
return this.Data.length;
},
getSelectedRow: function() {
return this.Data[this.SelectedIndex];
},
getSelectedCell: function() {
return this.SelectedCell;
},
getSelectedKey: function() {
return this.Keys[this.SelectedIndex];
},
clearColumns: function() {
this.ColumnWidths = null;
this.ColumnIcons = null;
this.ColumnFormats = null;
this.ColumnStyles = null;
this.ColumnWidths = new Array();
this.ColumnIcons = new Array();
this.ColumnFormats = new Array();
this.ColumnStyles = new Array();
wx.removeAllElementChildren(this.ColumnsRow);
},
clear: function() {
wx.removeAllElementChildren(this.Table);
this.SelectedIndex = -1;
this.Index = -1;
this.Data = null;
this.Data = new Array();
this.Keys = null;
this.Keys = new Array();
},
onMouseOver: function(Event) {
this.Object.SelectedIndex = this.RowIndex;
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = system.getStyle("All", "HLightBackground");
},
onMouseOut: function(Event) {
this.style.backgroundColor = this.OldBackgroundColor;
},
onRightClick: function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
var Row = Target.parentNode;
Row.Object.SelectedIndex = Row.RowIndex;
Row.OldBackgroundColor = Row.style.backgroundColor;
Row.style.cursor = "pointer";
Row.style.backgroundColor = "#e5e5e5";
if (Target.Object.PopupMenu != null) {
Target.Object.PopupMenu.show(Event.clientY, Event.clientX);
}
}
return false;
},
resize: function() {
//window.console.log("TableResize:" + this.Content.parentNode.offsetWidth + ":" + this.Rows.offsetWidth);
},
setDataSource: function(DataSource) {
this.DataSource = DataSource;
},
setFontSize: function(NewFontSize) {
this.FontSize = NewFontSize + "px";
this.ColumnsTable.style.fontSize = NewFontSize + "px";
this.Table.style.fontSize = NewFontSize + "px";
},
setTableHeaderVisible: function(Visible) {
if (!Visible) {
this.ColumnsTable.style.height = "0px";
this.ColumnsTable.style.visibility = "hidden";
this.ColumnsTable.style.display = "none";
}
},
parseXML: function(SimpleTableNode) {
if (SimpleTableNode.getAttribute("fontSize")) {
this.FontSize = SimpleTableNode.getAttribute("fontSize") + "px";
this.ColumnsTable.style.fontSize = SimpleTableNode.getAttribute("fontSize") + "px";
this.Table.style.fontSize = SimpleTableNode.getAttribute("fontSize") + "px";
}
if (SimpleTableNode.getAttribute("iconWidth")) {
this.IconWidth = SimpleTableNode.getAttribute("iconWidth") + "px";
}
if (SimpleTableNode.getAttribute("cellPadding")) {
this.CellPadding = SimpleTableNode.getAttribute("cellPadding");
}
if (SimpleTableNode.getAttribute("columnsVisible") ||SimpleTableNode.getAttribute("header")) {
if (SimpleTableNode.getAttribute("columnsVisible") == "false" || SimpleTableNode.getAttribute("header") == "false") {
this.ColumnsTable.style.height = "0px";
this.ColumnsTable.style.visibility = "hidden";
this.ColumnsTable.style.display = "none";
}
}
if (SimpleTableNode.getAttribute("onclick") != null && SimpleTableNode.getAttribute("onclick") != "") {
this.addEvent("click", "this." + SimpleTableNode.getAttribute("onclick") + ";");
}
for (var i = 0; i < SimpleTableNode.childNodes.length; i++) {
var SubNode = SimpleTableNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment") {
if (SubNode.nodeName == "Column") {
var Width = SubNode.getAttribute("width");
if (Width == null || Width == "") {
Width = "0";
}
var Icon = SubNode.getAttribute("icon");
if (Icon == null || Icon == "") {
Icon = "";
}
var Format = SubNode.getAttribute("format");
if (Format == null) Format = "";
var Style = SubNode.getAttribute("style");
if (Style == null) Style = "";
this.addColumn(Icon, SubNode.getAttribute("text"), Width, Format, Style);
}
if (SubNode.nodeName == "Menu") {
this.PopupMenu.Appl = this.Appl;
this.PopupMenu.parseXML(SubNode);
}
}
}
}
});
var WxPagePanel = WxClass(WxPanel, {
Page: null,
Padding: 5,
InnerPadding: 20,
InnerContent: null,
initialize: function() {
this.$super();
this.Content.style.position = "absolute"
this.Content.style.backgroundColor = "#666666";
this.Content.style.paddingLeft = this.Padding + "px";
this.Content.style.paddingTop = this.Padding + "px";
this.Content.style.height = "400px";
this.Content.style.width = "400px";
this.Content.style.overflow = "scroll";
this.Page = document.createElement("div");
this.Page.style.backgroundColor = "#ffffff";
this.Page.style.border = "1px solid #000000";
this.Page.style.width = (1420 - (this.InnerPadding*2) - 2) + "px";
this.Page.style.height = "200px";
this.Page.style.paddingLeft = this.InnerPadding + "px";
this.Page.style.paddingRight = this.InnerPadding + "px";
this.Page.style.paddingTop = this.InnerPadding + "px";
this.Page.style.paddingBottom = this.InnerPadding + "px";
this.InnerContent = new WxBorderPanel();
this.InnerContent.Appl = this.Appl;
this.InnerContent.Parent = this;
this.InnerContent.Content.style.width = (880 - 2) + "px";
this.Page.appendChild(this.InnerContent.Content);
this.Content.appendChild(this.Page);
},
resize : function() {
//console.log("Page.resize " + this.Page.offsetWidth + ":" + this.InnerContent.Content.offsetWidth);
//console.log("Page.resize " + this.Parent.offsetHeight + ":" + this.InnerContent.Content.offsetHeight);
if (this.Content.parentNode != null) {
this.Content.style.height = this.Content.parentNode.offsetHeight - 8 + "px";
var CenterHeight = this.Content.parentNode.offsetHeight - (this.Padding * 2) - (this.InnerPadding * 2) - 23;
var CenterHeight1 = this.InnerContent.Content.offsetHeight;
if (CenterHeight1 > CenterHeight) {
CenterHeight = CenterHeight1 + (this.Padding * 2);
}
this.Page.style.height = CenterHeight + "px";
//this.InnerContent.Content.style.width = 920 - (this.InnerPadding) + "px";
}
},
print: function(Titel) {
var PrintFrame = system.IFrame;
var PrintDoc = (PrintFrame.contentWindow || PrintFrame.contentDocument);
if (PrintDoc.document) {
PrintDoc = PrintDoc.document;
}
PrintDoc.write("" + Titel + "");
/*optional stylesheet*/ //mywindow.document.write('');
PrintDoc.write("");
PrintDoc.write(this.Page.innerHTML);
PrintDoc.write("");
PrintDoc.close();
},
parseXML: function(PagePanelNode) {
for (var i=0; i 0) {
this.Content.style.left = (window.innerWidth - 200 - 15) + "px";
this.Content.style.top = (window.innerHeight - this.Content.offsetHeight - 15) + "px";
} else {
this.Content.style.display = "none";
this.Content.style.visibility = "hidden";
}
},
});var WxMessagePanel = WxClass(WxPanel, {
IsOpen: true,
initialize: function(Message) {
this.$super();
var Table = document.createElement("table");
Table.cellPadding = "0";
Table.cellSpacing = "0";
Table.style.width = "100%";
Table.style.fontSize = "11px";
//Table.style.height = "100%";
var TableRow = Table.insertRow(-1);
var TitleCell = TableRow.insertCell(-1);
TitleCell.innerHTML = "" + Message.Title + "";
var CloseCell = TableRow.insertCell(-1);
CloseCell.Object = this;
CloseCell.style.width = "20px";
CloseCell.style.textAlign = "Center";
CloseCell.style.cursor = "pointer";
CloseCell.innerHTML = "X";
CloseCell.onclick = function() {
this.Object.IsOpen = false;
system.Messages.open();
}
var Table1 = document.createElement("table");
Table1.cellPadding = "0";
Table1.cellSpacing = "0";
Table1.style.width = "100%";
Table1.style.fontSize = "9px";
//Table.style.height = "100%";
var Table1Row = Table1.insertRow(-1);
var TextCell = Table1Row.insertCell(-1);
TextCell.innerHTML = Message.Body;
this.Content.style.margin = "2px";
this.Content.style.padding = "2px";
this.Content.style.backgroundColor = "white";
this.Content.appendChild(Table);
this.Content.appendChild(Table1);
if (Message.Process == "yes") {
var TablePK = document.createElement("table");
TablePK.cellPadding = "0";
TablePK.cellSpacing = "0";
TablePK.style.width = "100%";
TablePK.style.marginTop = "2px";
TablePK.style.fontSize = "9px";
var TablePKRow = TablePK.insertRow(-1);
var TablePKCell1 = TablePKRow.insertCell(-1);
TablePKCell1.style.width = "105px";
var TablePKCell2 = TablePKRow.insertCell(-1);
TablePKCell2.innerHTML = " " + Message.Percent + "% von " + Message.Max;
var TableP = document.createElement("table");
TableP.cellPadding = "0";
TableP.cellSpacing = "0";
TableP.style.width = "100px";
TableP.style.height = "9px";
TableP.style.fontSize = "6px";
TableP.style.border = "1px solid black";
var TablePRow = TableP.insertRow(-1);
var Process1Cell = TablePRow.insertCell(-1);
Process1Cell.style.width = Message.Percent + "px";
Process1Cell.style.backgroundColor = "green";
Process1Cell.innerHTML = " ";
if (Message.Percent < 100) {
var Process2Cell = TablePRow.insertCell(-1);
Process2Cell.innerHTML = " ";
}
TablePKCell1.appendChild(TableP);
this.Content.appendChild(TablePK);
}
},
isOpen: function() {
return this.IsOpen;
}
});
var WxPointPanel = WxClass(WxPanel, {
PointCell: null,
TextCell: null,
Description: null,
SubNodeContainer: null,
NodeCount: 0,
TextTableRow: null,
InnerTextCell: null,
ButtonCellWidth: 0,
ButtonCell: null,
ButtonsRow: null,
PointCellWidth: 30,
initialize: function(Point, Text) {
this.$super();
var Table = document.createElement("table");
Table.cellPadding="0";
Table.cellSpacing="0";
Table.style.width="100%";
var TableRow = Table.insertRow(-1);
this.PointCell = TableRow.insertCell(-1);
this.PointCell.Object = this;
this.PointCell.style.verticalAlign = "Top";
this.PointCell.style.width = this.PointCellWidth + "px";
this.PointCell.style.paddingRight = "2px";
this.PointCell.style.textAlign = "Right";
this.PointCell.innerHTML = Point;
this.TextCell = TableRow.insertCell(-1);
this.TextCell.style.height="25px";
this.TextCell.style.verticalAlign = "Top";
this.Description = document.createElement("p");
this.Description.style.margin = "0px";
this.Description.style.padding = "0px";
this.SubNodeContainer = document.createElement("div");
this.TextCell.appendChild(this.createTextTable(Text));
this.TextCell.appendChild(this.Description);
this.TextCell.appendChild(this.SubNodeContainer);
this.Content.appendChild(Table);
},
createTextTable: function(Text) {
var Table = document.createElement("table");
Table.cellPadding="0";
Table.cellSpacing="0";
Table.style.width="100%";
Table.style.height = "24px";
Table.onmouseover = this.onMouseOver;
Table.onmouseout = this.onMouseOut;
this.TextTableRow = Table.insertRow(-1);
this.InnerTextCell = this.TextTableRow.insertCell(-1);
this.InnerTextCell.style.verticalAlign = "Top";
this.InnerTextCell.Object = this;
this.InnerTextCell.style.cursor = "pointer";
this.InnerTextCell.innerHTML = Text;
this.ButtonCell = this.TextTableRow.insertCell(-1);
this.ButtonCell.style.width = this.ButtonCellWidth + "px";
this.ButtonCell.style.textAlign = "right";
var ButtonTable = document.createElement("table");
ButtonTable.cellPadding="0";
ButtonTable.cellSpacing="0";
ButtonTable.style.width = "100%";
ButtonTable.style.height = "24px";
this.ButtonRow = ButtonTable.insertRow(-1);
var LastCell = this.ButtonRow.insertCell(-1);
LastCell.innerHTML = " ";
this.ButtonCell.appendChild(ButtonTable);
return Table;
},
addButton: function(Button) {
var newButton = this.ButtonRow.insertCell(-1);
newButton.style.width = "24px";
newButton.appendChild(Button.Content);
this.ButtonCellWidth = this.ButtonCellWidth + 22;
this.ButtonCell.style.width = this.ButtonCellWidth + "px";
},
add: function(Node) {
this.NodeCount++;
this.SubNodeContainer.appendChild(Node.Content);
},
addColumn: function(Width, Text, FontSize, Format) {
var CIndex = this.ButtonCell.cellIndex;
var NewColumn = this.TextTableRow.insertCell(CIndex);
NewColumn.style.width = Width + "px";
if (FontSize != null) {
NewColumn.style.fontSize = FontSize + "px";
}
if (Format != null) {
if (Format.indexOf("rightAlign") >= 0) {
NewColumn.style.textAlign = "right";
}
if (Format.indexOf("bold") >= 0) {
NewColumn.style.fontWeight = "bold";
}
}
NewColumn.innerHTML = Text;
},
addTitleEvent: function(type, fn) {
EventID = this.Appl.getEventID();
EventName = type + "Event_" + EventID;
var ToCallFunction = new Function("event", fn);
this.Appl[EventName] = ToCallFunction;
var caller = new Function("event", "this.Appl." + EventName + "(event);");
if (this.InnerTextCell != null) {
this.InnerTextCell.Appl = this.Appl;
if (this.InnerTextCell.addEventListener) {
this.InnerTextCell.addEventListener(type, caller, false);
} else if (this.InnerTextCell.attachEvent) {
this.InnerTextCell.attachEvent('on' + type, function() {
return caller.call(this.InnerTextCell, window.event);
});
}
}
},
setButtonCellWidth: function (Width) {
this.ButtonCellWidth = Width;
this.ButtonCell.style.width = this.ButtonCellWidth + "px";
this.ButtonCell.style.textAlign = "right";
},
setPointCellWidth: function (Width) {
this.PointCellWidth = Width;
this.PointCell.style.width = this.PointCellWidth + "px";
},
onMouseOver: function(Event) {
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = system.getStyle("All", "HLightBackground");
},
onMouseOut: function(Event) {
this.style.backgroundColor = this.OldBackgroundColor;
},
setDescription: function(Description) {
this.Description.innerHTML = Description;
},
parseXML: function(PointPanelNode) {
for (var i=0; i 0) {
this.Icon.style.border = this.Border + "px solid #e5e5e5";
} else {
this.Icon.style.border = null;
}
}
if (XMLNode.getAttribute("tooltip")) {
this.Icon.title = XMLNode.getAttribute("tooltip");
}
if (XMLNode.getAttribute("onclick") != null && XMLNode.getAttribute("onclick") != "") {
this.addEvent("click", "this." + XMLNode.getAttribute("onclick") + ";");
}
}
});
var WxButton = WxClass(WxPanel, {
Button: null,
initialize: function(Text) {
this.$super();
this.Button = document.createElement("input");
this.Button.type = "Button";
this.Button.value = Text;
this.Button.style.width = "100px";
this.Content.appendChild(this.Button);
},
isEnabled: function() {
return !this.Button.disabled;
},
setButtonWidth: function(Width) {
this.Button.style.width = Width + "px";
},
setEnabled: function(Enabled) {
this.Button.disabled = !Enabled;
},
setText: function(Text) {
this.Button.value = Text;
},
parseXML: function(XMLNode) {
this.Button.value = XMLNode.getAttribute("text");
if ( XMLNode.getAttribute("width") != "") {
this.Button.style.width = XMLNode.getAttribute("width") + "px";
}
if ( XMLNode.getAttribute("height") != "") {
this.Button.style.height = XMLNode.getAttribute("height") + "px";
}
if (XMLNode.getAttribute("enable") != null) {
if (XMLNode.getAttribute("enable") == "true") this.setEnabled(true);
if (XMLNode.getAttribute("enable") == "false") this.setEnabled(false);
}
if (XMLNode.getAttribute("onclick") != null && XMLNode.getAttribute("onclick") != "") {
this.addEvent("click", "this." + XMLNode.getAttribute("onclick") + ";");
}
}
});
var WxComboBox = WxClass(WxPanel, {
Table: null,
TextField: null,
Button: null,
Enabled: true,
Background: null,
Window: null,
IsOpen: false,
SelectedIndex: -1,
SelectedKey: null,
Index: -1,
DataArray: "",
Data: null,
SearchString: "",
initialize: function(Text) {
this.$super();
this.Data = new Array();
this.TextField = document.createElement("input");
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
this.TextField.disabled = true;
this.Table = document.createElement("table");
this.Table.cellSpacing = "0";
this.Table.cellPadding = "0";
this.Table.style.height = "100%";
this.Table.style.width = "100%";
var Row = this.Table.insertRow();
var FieldCell = Row.insertCell();
FieldCell.appendChild(this.TextField);
var OpenIcon = document.createElement("img");
OpenIcon.src = "gui/icons/oeffner32.png";
OpenIcon.style.width = "20px";
var ButtonCell = Row.insertCell(-1);
ButtonCell.Object = this;
ButtonCell.style.width = "25px";
ButtonCell.style.width = "25px";
ButtonCell.style.textAlign = "center";
ButtonCell.style.cursor = "pointer";
ButtonCell.appendChild(OpenIcon);
ButtonCell.onclick = function() {
this.Object.open();
}
this.Background = document.createElement("div");
this.Background.Object = this;
this.Background.style.position = "absolute";
this.Background.style.zIndex = "2";
this.Background.style.backgroundColor = "#666666";
this.Background.style.opacity = "0.1";
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Background.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.closeWindow();
}
}
this.Window = document.createElement("div");
this.Window.Object = this;
this.Window.style.position = "absolute";
this.Window.style.zIndex = "4";
this.Window.style.backgroundColor = "#ffffff";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.Window.style.overflow = "auto";
this.Window.style.overflowY = "scroll";
this.Content.appendChild(this.Table);
this.Content.appendChild(this.Background);
this.Content.appendChild(this.Window);
//document.getElementsByTagName("body")[0].appendChild(this.Window);
},
add: function(Key, Description) {
this.Data.push({
Key: Key,
Description: Description
});
this.addLine(Key, Description);
},
addLine: function(Key, Description) {
this.Index = this.Index + 1;
var NewIndex = this.Index;
var Table = document.createElement("table");
Table.Object = this;
Table.RowIndex = NewIndex;
Table.Key = Key;
Table.Description = Description;
Table.cellSpacing = "0";
Table.cellPadding = "0";
Table.style.width = "100%";
Table.onmouseover = this.onMouseOver;
Table.onmouseout = this.onMouseOut;
Table.onclick = this.onClick;
var Row = Table.insertRow();
var Cell = Row.insertCell();
Cell.innerHTML = Description;
this.Window.appendChild(Table);
},
addSearchString: function(Str) {
this.SearchString = this.SearchString + Str.toLowerCase();
this.reload();
},
clear: function() {
wx.removeAllElementChildren(this.Window);
this.Data = new Array();
this.SearchString = "";
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
noerror: function() {
this.TextField.style.border = "1px solid #666666";
},
open: function() {
if (!this.Enabled) return;
if (this.IsOpen == true) {
this.closeWindow();
return;
}
this.IsOpen = true;
var rect = this.Content.getBoundingClientRect();
this.Background.style.left = 0 - rect.left + "px";
this.Background.style.top = 0 - rect.top + "px";
this.Background.style.height = this.getDocHeight() + (rect.top/2) + "px";
this.Background.style.width = this.getDocWidth() + (rect.left/2) + "px";
this.Background.style.display = "block";
this.Background.style.visibility = "visible";
this.Window.style.zIndex = "2";
this.Window.style.left = rect.Left + "px";
this.Window.style.top = rect.Top + 22 + "px";
this.Window.style.border = "1px solid black";
this.Window.style.height = "100px";
this.Window.style.width = rect.right - rect.left + "px";
this.Window.style.display = "block";
this.Window.style.visibility = "visible";
this.Window.onkeypress = function(Event) {
var Event = Event || window.event;
var Key = Event.keyCode || Event.which;
var Done = false;
if (Key == 8) {
console.log("backspace");
if (this.Object.SearchString.length >= 1) {
this.Object.SearchString = this.Object.SearchString.substring(0, this.Object.SearchString.length-1);
this.Object.reload();
Done = true;
}
}
if (Key == 46) {
this.Object.SearchString = "";
this.Object.reload();
Done = true;
}
if (!Done) {
this.Object.addSearchString(String.fromCharCode(Key));
}
Event.preventDefault();
}
this.Window.scrollTop = 0;
this.Window.focus();
this.Window.tabIndex = -1;
},
onMouseOver: function(Event) {
this.Object.SelectedIndex = this.RowIndex;
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = "#e5e5e5";
},
onMouseOut: function(Event) {
this.style.backgroundColor = this.OldBackgroundColor;
},
onClick: function() {
this.Object.SelectedIndex = this.RowIndex;
this.Object.TextField.value = this.Description;
this.Object.SelectedKey = this.Key;
this.Object.closeWindow();
this.Object.fireEvent(this.Object.Content, "selected");
},
closeWindow: function() {
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.IsOpen = false;
},
getSelectedKey: function() {
return this.SelectedKey;
},
getSelectedText: function() {
return this.TextField.value;
},
setSelectedKey: function(Key) {
for (var i = 0; i < this.Window.childNodes.length; i++) {
var Element = this.Window.childNodes[i];
if (Element.Key == Key) {
Element.Object.SelectedIndex = Element.RowIndex;
Element.Object.TextField.value = Element.Description;
Element.Object.SelectedKey = Element.Key;
return true;
}
}
return false;
},
setSelectedIndex: function(Index) {
for (var i = 0; i < this.Window.childNodes.length; i++) {
var Element = this.Window.childNodes[i];
if (Element.RowIndex == Index) {
Element.Object.SelectedIndex = Element.RowIndex;
Element.Object.TextField.value = Element.Description;
Element.Object.SelectedKey = Element.Key;
break;
}
}
},
setEnabled: function(Enabled) {
this.Enabled = Enabled;
},
setEditable: function(Editable) {
if (Editable) this.TextField.disabled = false;
},
setArrayData: function(Ar) {
var Default = "";
for (K in Ar) {
if (K == "Default") {
Default = Ar[K];
} else {
this.add(K, Ar[K])
}
}
if (Default != "") {
this.setSelectedKey(Default);
}
},
reload: function() {
wx.removeAllElementChildren(this.Window);
console.log(this.SearchString);
for (var i=0; i < this.Data.length; i++) {
if (this.SearchString != "") {
if (this.Data[i].Description.toLowerCase().indexOf(this.SearchString) >= 0) {
this.addLine(this.Data[i].Key, this.Data[i].Description);
}
} else {
this.addLine(this.Data[i].Key, this.Data[i].Description);
}
}
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("editable") == "true") {
this.setEditable(true);
}
for (var i = 0; i < XMLNode.childNodes.length; i++) {
var SubNode = XMLNode.childNodes[i];
if (SubNode.nodeName == "Entry") {
var Key = SubNode.getAttribute("key");
var Value = SubNode.childNodes[0].nodeValue;
if (Key != null && Key != "") this.add(Key, Value);
if (SubNode.getAttribute("selected") == "true") {
this.SelectedKey = Key;
this.TextField.value = Value;
}
}
if (SubNode.nodeName == "Button") {
}
}
}
});
var WxSimpleButton = WxClass(WxPanel, {
IconCell: null,
TextCell: null,
Enable: true,
initialize: function(Text) {
this.$super();
if (Text != null) {
var Table = document.createElement("table");
Table.cellPadding="0";
Table.cellSpacing="0";
Table.style.height="30px";
Table.style.width="100%";
var TableRow = Table.insertRow(-1);
this.IconCell = TableRow.insertCell(-1);
this.IconCell.id = this.Content.id;
this.IconCell.Object = this;
this.IconCell.style.width = "30px";
this.TextCell = TableRow.insertCell(-1);
this.TextCell.id = this.Content.id;
this.TextCell.Object = this;
this.TextCell.style.verticalAlign = "middle";
this.TextCell.innerHTML = Text;
this.Content.appendChild(Table);
this.Content.Enable = true;
}
this.Content.onmouseover = function(Event) {
if (this.Enable) {
this.OldBackground = this.style.backgroundColor;
this.style.backgroundColor = "#e5e5e5";
this.style.cursor = "pointer";
}
}
this.Content.onmouseout = function(Event) {
if (this.Enable) this.style.backgroundColor = this.OldBackground;
}
},
setCenterElement: function(Element) {
this.Content.appendChild(Element);
this.Content.Enable = true;
},
setEnable: function(Enable) {
if (Enable == true) {
this.Content.Enable = true;
this.Enable = true;
} else {
this.Content.Enable = false;
this.Enable = false;
}
if (this.Content.OldBackground != null) this.Content.style.backgroundColor = this.Content.OldBackground;
},
isEnable: function() {
return this.Content.Enable;
},
parseXML: function(XMLNode) {
this.Content.innerHTML = XMLNode.getAttribute("text");
if (XMLNode.getAttribute("onclick") != null && XMLNode.getAttribute("onclick") != "") {
this.addEvent("click", "this." + XMLNode.getAttribute("onclick") + ";");
}
}
});
var WxTextField = WxClass(WxPanel, {
TextField: null,
initialize: function(Text) {
this.$super();
this.TextField = document.createElement("input");
this.TextField.type = "text";
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
this.Content.appendChild(this.TextField);
},
getText: function() {
return this.TextField.value;
},
focus: function() {
this.TextField.focus();
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
noerror: function() {
this.TextField.style.border = "1px solid #666666";
},
setText: function(Value) {
this.TextField.value = Value;
},
setEnabled: function(Enabled) {
this.TextField.disabled = !Enabled;
},
setLength: function(Length) {
if (Length.indexOf(",") >= 0) {
var Nachkomma = Length.substring(Length.indexOf(",")+1);
Length = Length.substring(0, Length.indexOf(","));
var PL = "";
var VK = parseInt(Length) - parseInt(Nachkomma);
for (var i = 0; i < VK; i++) {
PL = PL + "_";
}
PL = PL + ",";
var VK = parseInt(Length) - parseInt(Nachkomma);
for (var i = 0; i < Nachkomma; i++) {
PL = PL + "_";
}
this.TextField.placeholder = PL;
}
this.TextField.maxLength = Length;
},
setFormat: function(Format) {
if (Format.toLowerCase() == "numeric") {
this.TextField.onkeypress = function validate(Event) {
var Event = Event || window.event;
var Key = Event.keyCode || Event.which;
var Correct = false;
if (Key >= 48 && Key <= 58) Correct = true; // Zahlen
if (Key >= 37 && Key <= 40) Correct = true; // Pfeile
if (Key == 8 || Key == 9 || Key == 46) Correct = true; // Back, entfernen
if (Key == 99 || Key == 118 || Key == 120) Correct = true; // Copy, Paste, Cut
if (!Correct) Event.preventDefault();
}
}
if (Format.toLowerCase() == "numericwithnegatic") {
this.TextField.onkeypress = function validate(Event) {
var Event = Event || window.event;
var Key = Event.keyCode || Event.which;
var Correct = false;
if (Key >= 48 && Key <= 58) Correct = true; // Zahlen
if (Key >= 37 && Key <= 40) Correct = true; // Pfeile
if (Key == 8 || Key == 9 || Key == 46) Correct = true; // Back, entfernen
if (Key == 99 || Key == 118 || Key == 120) Correct = true; // Copy, Paste, Cut
if (Key == 44) Correct = true; // Komma
if (Key == 45) Correct = true; // Minus
if (!Correct) Event.preventDefault();
}
}
if (Format.toLowerCase() == "numericwithkomma") {
this.TextField.onkeypress = function validate(Event) {
var Event = Event || window.event;
var Key = Event.keyCode || Event.which;
var Correct = false;
if (Key >= 48 && Key <= 58) Correct = true; // Zahlen
if (Key >= 37 && Key <= 40) Correct = true; // Pfeile
if (Key == 8 || Key == 9 || Key == 46) Correct = true; // Back
if (Key == 99 || Key == 118 || Key == 120) Correct = true; // Copy, Paste, Cut
if (Key == 44) Correct = true; // Komma
if (!Correct) Event.preventDefault();
}
}
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("length") != null) {
var Length = XMLNode.getAttribute("length");
this.setLength(Length)
}
if (XMLNode.getAttribute("enable") != null) {
if (XMLNode.getAttribute("enable") == "true") this.setEnabled(true);
if (XMLNode.getAttribute("enable") == "false") this.setEnabled(false);
}
if (XMLNode.getAttribute("format") != null) {
this.setFormat(XMLNode.getAttribute("format"));
}
if (XMLNode.getAttribute("onenter") != null && XMLNode.getAttribute("onenter") != "") {
this.addEvent("enter", "this." + XMLNode.getAttribute("onenter") + ";");
}
if (XMLNode.getAttribute("onkeydown") != null && XMLNode.getAttribute("onkeydown") != "") {
this.addEvent("keydown", "this." + XMLNode.getAttribute("onkeydown") + ";");
}
}
});
var WxTimeField = WxClass(WxPanel, {
TimeField: null,
Type: "day",
initialize: function(Text) {
this.$super();
this.TimeField = document.createElement("input");
this.TimeField.Time = this;
this.TimeField.type = "Text";
this.TimeField.maxLength = "8";
this.TimeField.placeholder = "___:__";
this.TimeField.style.width = "100%";
this.TimeField.style.border = "1px solid #666666";
this.TimeField.onkeypress = function validate(Event) {
var Event = Event || window.event;
var Key = Event.keyCode || Event.which;
var Correct = false;
if (Key >= 48 && Key <= 58) Correct = true; // Zahlen
if (Key >= 37 && Key <= 40) Correct = true; // Pfeile
if (Key == 8 || Key == 9 || Key == 46) Correct = true; // Back
if (Key == 99 || Key == 118 || Key == 120) Correct = true; // Copy, Paste, Cut
if (Key == 58) Correct = true; // Doppenpunkt
if (Key == 45) Correct = true; // Minus
if (!Correct) Event.preventDefault();
}
this.Content.appendChild(this.TimeField);
this.TimeField.onblur = function(Event) {
this.Time.testTime();
}
},
getTime: function() {
return this.TimeField.value;
},
focus: function() {
this.TimeField.focus();
},
error: function(Text) {
this.TimeField.style.border = "1px solid red";
this.TimeField.focus();
},
noerror: function() {
this.TimeField.style.border = "1px solid #666666";
},
setTime: function(Value) {
this.TimeField.value = Value;
},
setType: function(Type) {
Type = Type.toLowerCase();
if (Type == "day" || Type == "hour" || Type == "all") {
this.Type = Type;
}
if (this.Type == "all") {
this.TimeField.maxLength = "8";
this.TimeField.placeholder = "_____:__";
}
if (this.Type == "dayhour") {
this.TimeField.maxLength = "5";
this.TimeField.placeholder = "__:__";
}
if (this.Type == "hour") {
this.TimeField.maxLength = "6";
this.TimeField.placeholder = "___:__";
}
},
setEnabled: function(Enabled) {
this.TimeField.disabled = !Enabled;
},
formatTime: function ()
{
if (this.Type == "dayhour") {
var Time = this.getTime();
if (Time.indexOf(":") < 0) {
if (Time.length == 3 ) {
Time = "0" + Time.substring(0, 1) + ":" + Time.substring(1, 3);
}
if (Time.length == 4 ) {
Time = Time.substring(0, 2) + ":" + Time.substring(2, 4);
}
if (Time.indexOf(":") < 0) {
Time = Time + ":00";
}
setTime(Time);
}
}
},
testTime: function() {
var Time = this.getTime();
if (Time.length <= 0) {
Time = "00:00";
}
if (Time.indexOf(":") < 0 && !Time.startsWith("-")) {
if (Time.length == 1 ) {
Time = "0" + Time + ":00" ;
}
if (Time.length == 2 ) {
Time = Time.substring(0, 2) + ":00" ;
}
if (Time.length == 3 ) {
Time = "0" + Time.substring(0,1) + ":" + Time.substring(1, 3);
}
if (Time.length == 4 ) {
Time = Time.substring(0, 2) + ":" + Time.substring(2,4);
}
}else{
if (Time.startsWith("-") ) {
if (Time.length == 2 ) {
Time = Time.substring(0,1)+ "0" +Time.substring(1,2) + ":00" ;
}
if (Time.length == 3 ) {
Time = Time.substring(0, 3) + ":00" ;
}
if (Time.length == 4 ) {
Time = Time.substring(0,2) + ":" + Time.substring(2, 4);
}
if (Time.length == 5 ) {
Time = "-"+Time.substring(0, 3) + ":" + Time.substring(3,5);
}
}
}
var Error = false;
var Split = Time.split(":");
var Hours = Split[0];
var Minutes = Split[1];
if (this.Type == "day") {
if (Hours > 23) {
this.error("Stunden falsch!");
Error=true;
}
}
if (!Error) {
if (Minutes > 59) {
this.error("Minuten falsch!");
Error=true;
}
}
var SHours = "" + Hours;
var SMinutes = "" + Minutes;
if (SHours.length == 1) SHours = "0" + SHours;
if (SMinutes.length == 1) SMinutes = "0" + SMinutes;
this.setTime(SHours + ":" + SMinutes);
return !Error;
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("enable") != null) {
if (XMLNode.getAttribute("enable") == "true") this.setEnabled(true);
if (XMLNode.getAttribute("enable") == "false") this.setEnabled(false);
}
if (XMLNode.getAttribute("type") != null) {
this.setType(XMLNode.getAttribute("type"))
}
if (XMLNode.getAttribute("onenter") != null && XMLNode.getAttribute("onenter") != "") {
this.addEvent("enter", "this." + XMLNode.getAttribute("onenter") + ";");
}
if (XMLNode.getAttribute("onkeydown") != null && XMLNode.getAttribute("onkeydown") != "") {
this.addEvent("keydown", "this." + XMLNode.getAttribute("onkeydown") + ";");
}
}
});
var WxTextArea = WxClass(WxPanel, {
TextField: null,
initialize: function(Text) {
this.$super();
this.TextField = document.createElement("textarea");
this.TextField.type = "Text";
this.TextField.rows = "5";
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
this.Content.appendChild(this.TextField);
},
getText: function() {
return this.TextField.value;
},
focus: function() {
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
setText: function(Value) {
this.TextField.value = Value;
},
setEnabled: function(Enabled) {
this.TextField.disabled = !Enabled;
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("enable") != null) {
if (XMLNode.getAttribute("enable") == "true") this.setEnabled(true);
if (XMLNode.getAttribute("enable") == "false") this.setEnabled(false);
}
if (XMLNode.getAttribute("rows") != null) {
this.TextField.rows = XMLNode.getAttribute("rows");
}
if (XMLNode.getAttribute("onenter") != null && XMLNode.getAttribute("onenter") != "") {
this.addEvent("enter", "this." + XMLNode.getAttribute("onenter") + ";");
}
if (XMLNode.getAttribute("onkeydown") != null && XMLNode.getAttribute("onkeydown") != "") {
this.addEvent("keydown", "this." + XMLNode.getAttribute("onkeydown") + ";");
}
}
});
var WxPasswordField = WxClass(WxPanel, {
TextField: null,
initialize: function(Text) {
this.$super();
this.TextField = document.createElement("input");
this.TextField.type = "Password";
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
this.Content.appendChild(this.TextField);
},
getText: function() {
return this.TextField.value;
},
focus: function() {
this.TextField.focus();
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
noerror: function() {
this.TextField.style.border = "1px solid #666666";
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("onenter") != null && XMLNode.getAttribute("onenter") != "") {
this.addEvent("enter", "this." + XMLNode.getAttribute("onenter") + ";");
}
if (XMLNode.getAttribute("onkeydown") != null && XMLNode.getAttribute("onkeydown") != "") {
this.addEvent("keydown", "this." + XMLNode.getAttribute("onkeydown") + ";");
}
}
});
var WxCheckBox = WxClass(WxPanel, {
TextField: null,
TextCell: null,
initialize: function(Text) {
this.$super();
this.TextField = document.createElement("input");
this.TextField.type = "checkbox";
this.TextField.style.border = "1px solid #666666";
this.TextField.style.marginLeft = "0px";
var Table = document.createElement("table");
Table.style.width = "100%";
Table.cellPadding = "0";
Table.cellSpacing = "0";
var Row = Table.insertRow(-1);
var Cell1 = Row.insertCell(-1);
this.TextCell = Row.insertCell(-1);
Cell1.style.width = "20px";
Cell1.style.textAlign = "Left";
Cell1.appendChild(this.TextField);
this.TextCell.innerHtml = Text;
this.Content.appendChild(Table);
},
getSelected: function() {
return this.TextField.checked;
},
focus: function() {
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
setSelected: function(Value) {
this.TextField.checked = Value;
},
setEnabled: function(Enabled) {
this.TextField.disabled = !Enabled;
},
setVisible: function(Visible) {
if (Visible == false) {
this.Content.style.visibility = "hidden";
this.Content.style.display = "none";
this.Content.style.width = "0px";
}
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("selected") != null) {
if (XMLNode.getAttribute("selected") == "true") this.setSelected(true);
if (XMLNode.getAttribute("selected") == "false") this.setSelected(false);
}
if (XMLNode.getAttribute("enable") != null) {
if (XMLNode.getAttribute("enable") == "true") this.setEnabled(true);
if (XMLNode.getAttribute("enable") == "false") this.setEnabled(false);
}
if (XMLNode.getAttribute("fontSize") != null) {
this.TextCell.style.fontSize = XMLNode.getAttribute("fontSize") + "px";
}
if (XMLNode.getAttribute("text") != null) {
this.TextCell.innerHTML = XMLNode.getAttribute("text");
}
if (XMLNode.getAttribute("onclick") != null && XMLNode.getAttribute("onclick") != "") {
this.addEvent("click", "this." + XMLNode.getAttribute("onclick") + ";");
}
}
});
var WxTable = WxClass(WxPanel, {
HeaderHeight: 25,
ColumnsWidth: 0,
ColumnsVariable: false,
ColumnsTable: null,
ColumnWidths : null,
ColumnIcons : null,
ColumnEditable: null,
ColumnsDiv: null,
Columns: null,
ColumFormats: null,
ColumStyles: null,
Rows : null,
Keys : null,
SelectedIndex: -1,
SelectedCellIndex: -1,
Index: -1,
DataSource: null,
DataSourceData: null,
DataSourceFieldNames: null,
DataSourceKeyNames: null,
FontSize: 0,
PopupMenu: null,
initialize : function() {
this.$super();
this.DataSourceFieldNames = new Array();
this.DataSourceKeyNames = new Array();
//document.oncontextmenu = this.onRightClick;
this.Content.style.height = "100%";
this.ColumnWidths = new Array();
this.ColumnIcons = new Array();
this.ColumnStyles = new Array();
this.ColumnEditable = new Array();
this.ColumnsDiv = document.createElement("div");
this.ColumnsDiv.style.height = this.HeaderHeight + "px";
this.ColumnsDiv.style.backgroundColor = system.getStyle("SimpleTable", "ColumnBackground");
this.ColumnsDiv.style.borderBottom = "1px solid " + system.getStyle("SimpleTable", "ColumnBorder");
this.ColumnsDiv.style.paddingRight = "16px";
this.ColumnsTable = document.createElement("table");
this.ColumnsTable.cellSpacing = "0";
this.ColumnsTable.cellPadding = "0";
this.ColumnsTable.style.height = "100%";
this.ColumnsTable.style.width = "100%";
this.Columns = document.createElement("tr");
this.ColumnsTable.appendChild(this.Columns);
this.ColumnsDiv.appendChild(this.ColumnsTable);
this.Rows = document.createElement("div");
this.Rows.style.width = "100%";
this.Rows.style.height = "25px";
//this.Rows.style.border= "1px solid " + system.getStyle("SimpleTable", "Border");
//this.Rows.style.border= "1px solid red";
this.Rows.style.overflow = "auto";
this.Rows.style.overflowY = "scroll";
this.Rows.style.backgroundColor = system.getStyle("SimpleTable", "Background");
this.Content.appendChild(this.ColumnsDiv);
this.Content.appendChild(this.Rows);
this.Data = new Array();
this.Keys = new Array();
this.ColumnFormats = new Array();
this.PopupMenu = new WxPopUpMenu(this);
},
addKey: function(FieldName) {
this.DataSourceKeyNames.push(FieldName);
},
addEmptyRow: function(Text) {
if (!Text) Text = "Keine Daten zur Anzeige vorhanden";
if (this.Rows.childNodes.length == 0) {
var Empty = document.createElement("div");
Empty.style.width = "100%";
Empty.style.textAlign = "Center";
if (this.FontSize > 0) Empty.style.fontSize = this.FontSize;
Empty.innerHTML = "" + Text + "";
this.Rows.appendChild(Empty);
}
},
addEvent : function(type, fn) {
if (type.toLowerCase() == "click") type = "tableclick";
EventID = this.Appl.getEventID();
EventName = type + "Event_" + EventID;
var ToCallFunction = new Function("event", fn);
this.Appl[EventName] = ToCallFunction;
var caller = new Function("event", "this.Appl." + EventName + "(event);");
if (this.Content != null) {
this.Content.Appl = this.Appl;
if (this.Content.addEventListener) {
this.Content.addEventListener(type, caller, false);
} else if (this.Content.attachEvent) {
this.Content.attachEvent('on' + type, function() {
return caller.call(this.Content, window.event);
});
}
}
},
addColumn: function (Icon, Text, Width, Format, Style, Editable) {
if (Format == null) Format = "";
if (Style == null) Style = "";
if (Editable == null) Editable = "";
this.ColumnWidths.push(Width);
this.ColumnIcons.push(Icon);
this.ColumnFormats.push(Format);
this.ColumnStyles.push(Style);
this.ColumnEditable.push(Editable);
var Column = document.createElement("td");
Column.style.paddingLeft = "2px";
Column.style.paddingRight = "2px";
Column.style.color = system.getStyle("SimpleTable", "ColumnForeground");
Column.style.borderRight = "1px solid " + system.getStyle("SimpleTable", "ColumnBorder");
if (this.FontSize > 0) {
Column.style.fontSize = this.FontSize;
}
if (Width != "0") {
this.ColumnsWidth = this.ColumnsWidth + parseInt(Width);
Column.style.width = (parseInt(Width)-1) + "px";
} else {
this.ColumnsVariable = true;
}
if (Style != "") {
if (Style.toLowerCase().indexOf("rightalign") >= 0) {
Column.style.textAlign="Right";
}
}
Column.innerHTML = Text;
if (this.ColumnsVariable == false) {
this.Content.style.width = this.ColumnsWidth + "px";
this.ColumnsTable.style.width = this.ColumnsWidth + "px";
this.Rows.style.width = this.ColumnsWidth + "px";
//this.Content.style.overflow = "scrollx";
this.Content.style.overflowY = "hidden";
this.Content.style.overflowX = "scroll";
} else {
this.ColumnsTable.style.width = "100%";
this.Rows.style.width = "100%";
this.Content.style.width = "100%";
this.Content.style.overflow = "auto";
this.Content.style.overflowX = "";
this.Content.style.overflowY = "";
}
this.Columns.appendChild(Column);
},
clearColumns: function() {
this.ColumnWidths = new Array();
this.ColumnIcons = new Array();
this.ColumnFormats = new Array();
this.ColumnEditable = new Array();
wx.removeAllElementChildren(this.Columns);
},
addRow: function (Row, Key, Styles, WithIcons, WithClickEvent) {
if (Key == null) Key = new Array();
if (Styles == null) Styles = new Array();
if (WithIcons == null) WithIcons = true;
if (WithClickEvent == null) WithClickEvent = true;
this.Index = this.Index + 1;
var NewIndex = this.Index;
var GesWidth = 0;
var Variable = false;
this.Data.push(Row);
this.Keys.push(Key);
var Table = document.createElement("table");
Table.Object = this;
Table.RowIndex = NewIndex;
Table.cellSpacing = "0";
Table.cellPadding = "0";
Table.style.width = "100%";
Table.onmouseover = this.onMouseOver;
Table.onmouseout = this.onMouseOut;
if (WithClickEvent) Table.onclick = this.onMouseClick;
if(NewIndex % 2 != 0) {
Table.style.backgroundColor = system.getStyle("SimpleTable", "SecondRowBackground");
}
var Cells = Table.insertRow(-1);
for (var i = 0; i < Row.length; i++) {
if (i < this.ColumnWidths.length) {
var Icon = this.ColumnIcons[i];
var Cell = Cells.insertCell(-1);
Cell.Object = this;
Cell.style.paddingLeft = "3px";
Cell.style.verticalAlign = "Top";
if (this.FontSize > 0) {
Cell.style.fontSize = this.FontSize;
}
if (Styles[i] != null) {
var CellStyles = Styles[i].split(";");
for (var csy = 0; csy < CellStyles.length; csy++) {
var CellStyle = CellStyles[csy].split(":");
if (CellStyle.length == 2) {
Cell.style[CellStyle[0].trim()] = CellStyle[1].trim();
}
}
}
var ci = i;
Cell.CellIndex = ci;
Cell.onclick = function () {
this.Object.SelectedCell = this.CellIndex;
}
if (this.ColumnStyles[i] != "") {
if (this.ColumnStyles[i].toLowerCase().indexOf("rightalign") >= 0) {
Cell.style.textAlign="Right";
}
}
if (Row[i] == "" && Icon != "") {
Cell.Data = Icon;
if (WithIcons) {
var Image = document.createElement("img");
Image.src = Icon;
Image.style.width = "24px";
Cell.appendChild(Image);
}
} else {
Cell.Data = Row[i];
if (this.ColumnFormats[i] != "") {
if (this.ColumnFormats[i] == "longdate") {
var LongDate = new WxDate(parseFloat(Row[i]));
Cell.innerHTML = LongDate.format();
}
if (this.ColumnFormats[i] == "date") {
var StringDate = new WxDate(Row[i], "yyyyMMdd");
Cell.innerHTML = StringDate.format();
}
if (this.ColumnFormats[i] == "currency") {
var num = new Number(Row[i]);
Cell.innerHTML = num.formatCurrency() + " €";
}
if (this.ColumnFormats[i] == "check") {
var ColumnIndex = i;
var Check = document.createElement("input");
Check.type="checkbox";
Check.ColumnIndex = ColumnIndex;
Check.onclick = function(Event) {
var Table = this.parentNode.parentNode.parentNode.parentNode;
var Checked = "off";
if (this.checked) {
Checked = "on";
}
Table.Checked = Checked;
Table.Object.Data[Table.RowIndex][this.ColumnIndex] = Checked;
}
if (Row[i] != "on" && Row[i] != "off") {
Row[i] = "off";
}
if (Row[i] == "on") {
Check.checked = "true";
}
Cell.style.verticalAlign="Center";
Cell.appendChild(Check);
}
if (this.ColumnFormats[i] == "editable") {
var EditSplit = this.ColumnEditable[i].split(":");
var EditFormat = EditSplit[0];
var EditLength = EditSplit[1];
var EditableIndex = i;
var Field = new WxTextField();
if (EditFormat != "") Field.setFormat(EditFormat);
if (EditLength != "") Field.setLength(EditLength);
Field.Content.ColumnIndex = EditableIndex;
Field.Content.style.margin = "2px";
Field.Content.style.fontSize = "10px";
Field.setText(Row[i]);
Field.Content.onkeyup = function(Event) {
var Table = this.parentNode.parentNode.parentNode.parentNode;
Table.Object.Data[Table.RowIndex][this.ColumnIndex] = this.firstChild.value;
}
Cell.appendChild(Field.Content);
}
if (this.ColumnFormats[i] == "disabledCheck") {
var ColumnIndex = i;
var Check = document.createElement("input");
Check.type="checkbox";
Check.disabled = true;
Check.ColumnIndex = ColumnIndex;
if (Row[i] == "on" || Row[i] == "true" || Row[i] == "yes") {
Check.checked = "true";
}
Cell.style.verticalAlign="Center";
Cell.appendChild(Check)
}
} else {
Cell.innerHTML = Row[i];
}
}
if (this.ColumnWidths[i] != "0") {
GesWidth = GesWidth + parseInt(this.ColumnWidths[i]);
Cell.style.width = this.ColumnWidths[i] + "px";
} else {
Variable = true;
}
}
}
if (!Variable) {
Table.style.width = GesWidth + "px";
}
this.Rows.appendChild(Table);
},
getRow: function(Index) {
return this.Data[Index];
},
getCellElement: function(Row, Cell) {
var Ret = null;
var TableRow = this.Rows.childNodes[Row].firstChild.firstChild;
if (TableRow != null) {
ret = TableRow.childNodes[Cell].firstChild;
}
return ret;
},
getRowCount: function() {
return this.Data.length;
},
getSelectedIndex: function() {
return this.SelectedIndex;
},
getSelectedRow: function() {
return this.Data[this.SelectedIndex];
},
getSelectedCell: function() {
return this.SelectedCell;
},
getSelectedKey: function() {
return this.Keys[this.SelectedIndex];
},
clear: function() {
wx.removeAllElementChildren(this.Rows);
this.SelectedIndex = -1;
this.Index = -1;
this.Data = null;
this.Data = new Array();
this.Keys = null;
this.Keys = new Array();
},
onMouseClick: function(Event) {
this.Object.SelectedIndex = this.RowIndex;
this.Object.Event = Event;
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = system.getStyle("All", "HLightBackground");
this.Object.fireEvent(this.Object.Content, "tableclick");
},
onMouseOver: function(Event) {
this.Object.SelectedIndex = this.RowIndex;
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = system.getStyle("All", "HLightBackground");
},
onMouseOut: function(Event) {
this.style.backgroundColor = this.OldBackgroundColor;
},
onRightClick: function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
var Table = Target.parentNode.parentNode.parentNode;
var Row = Target.parentNode;
Table.Object.SelectedIndex = Table.RowIndex;
Row.OldBackgroundColor = Row.style.backgroundColor;
Row.style.cursor = "pointer";
Row.style.backgroundColor = "#e5e5e5";
if (Target.Object.PopupMenu != null) {
Target.Object.PopupMenu.show(Event.clientY, Event.clientX);
}
}
return false;
},
resize: function() {
//window.console.log("TableResize: [" + this.id + "]" + this.Content.parentNode.offsetWidth + ":" + this.Rows.offsetWidth);
//window.console.log("SimpleTableResize:" + this.Content.parentNode.offsetHeight + ":" + this.Rows.offsetHeight);
if (this.ColumnsVariable == false) {
this.Content.style.width = this.Content.parentNode.offsetWidth + "px";
this.Content.style.height = this.Content.parentNode.offsetHeight + "px";
this.ColumnsDiv.style.width = (this.ColumnsWidth + 18) + "px";
this.Rows.style.width = (this.ColumnsWidth + 18) + "px";
//this.Rows.style.height = (this.Content.parentNode.offsetHeight - this.HeaderHeight - 3 - 38) + "px";
this.Rows.style.height = (this.Content.parentNode.offsetHeight - this.HeaderHeight - 3 - 15) + "px";
} else {
this.Content.style.width = this.Content.parentNode.offsetWidth + "px";
this.Content.style.height = this.Content.parentNode.offsetHeight + "px";
this.ColumnsDiv.style.width = (this.Content.parentNode.offsetWidth - 16) + "px";
this.Rows.style.width = (this.Content.parentNode.offsetWidth) + "px";
this.Rows.style.height = (this.Content.parentNode.offsetHeight - this.HeaderHeight - 3) + "px";
}
},
setDataSource: function(DataSource) {
this.DataSource = DataSource;
},
setCellData: function(Row, Cell, Value) {
this.Data[Row][Cell] = Value;
var TableRow = this.Rows.childNodes[Row].firstChild.firstChild;
if (TableRow != null) {
TableRow.childNodes[Cell].innerHTML = Value;
}
},
load: function() {
if (this.DataSourceTableName != null) {
var DataTable = this.DataSource.getTable(this.DataSourceTableName);
while (DataTable.next()) {
var Row = new Array();
var Keys = null;
for (var i=0; i < this.DataSourceFieldNames.length; i++) {
if (this.DataSourceFieldNames[i] == "") {
Row.push("");
}
if (this.DataSourceFieldNames[i] != "") {
Row.push(DataTable.getString(this.DataSourceFieldNames[i]));
}
}
if (this.DataSourceKeyNames.length > 0) {
Keys = new Array();
for (var k=0; k < this.DataSourceKeyNames.length; k++) {
Keys[this.DataSourceKeyNames[k]] = DataTable.getString(this.DataSourceKeyNames[k]);
}
}
this.addRow(Row, Keys);
}
}
},
parseXML: function(SimpleTableNode) {
if (SimpleTableNode.getAttribute("table")) {
this.DataSourceTableName = SimpleTableNode.getAttribute("table");
}
if (SimpleTableNode.getAttribute("scroll") == "false") {
this.Content.style.overflow = "inherit";
this.Content.style.overflowX = "";
this.Content.style.overflowY = "";
}
if (SimpleTableNode.getAttribute("fontSize") != "") {
this.FontSize = parseInt(SimpleTableNode.getAttribute("fontSize"));
}
if (SimpleTableNode.getAttribute("onclick") != null && SimpleTableNode.getAttribute("onclick") != "") {
this.addEvent("click", "this." + SimpleTableNode.getAttribute("onclick") + ";");
}
for (var i = 0; i < SimpleTableNode.childNodes.length; i++) {
var SubNode = SimpleTableNode.childNodes[i];
if (SubNode.nodeName != "#text" && SubNode.nodeName != "#comment") {
if (SubNode.nodeName == "Column") {
var Width = SubNode.getAttribute("width");
if (Width == null || Width == "") {
Width = "0";
}
var Icon = SubNode.getAttribute("icon");
if (Icon == null || Icon == "") {
Icon = "";
}
var Format = SubNode.getAttribute("format");
if (Format == null) Format = "";
var Style = SubNode.getAttribute("style");
if (Style == null) Style = "";
if (SubNode.getAttribute("data") != null) {
this.DataSourceFieldNames.push(SubNode.getAttribute("data"));
} else {
this.DataSourceFieldNames.push("");
}
var Editable = SubNode.getAttribute("editable");
if (Editable == null) Editable = "";
if (Format == "editable") {
var EditFormat = SubNode.getAttribute("editFormat");
var EditLength = SubNode.getAttribute("editLength");
if (EditFormat == null) Editformat = "";
if (EditLength == null) EditLength = "";
Editable = EditFormat + ":" + EditLength;
}
this.addColumn(Icon, SubNode.getAttribute("text"), Width, Format, Style, Editable);
}
if (SubNode.nodeName == "Key") {
this.addKey(SubNode.getAttribute("data"));
}
}
if (SubNode.nodeName == "Menu") {
this.PopupMenu.Appl = this.Appl;
this.PopupMenu.parseXML(SubNode);
}
}
this.addEmptyRow();
}
});
var WxTree = WxClass(WxPanel, {
Container: null,
initialize : function() {
this.$super();
//this.Content.style.paddingTop = "3px";
//this.Content.style.marginLeft = "3px";
//this.Content.style.marginRight = "3px";
this.Container = document.createElement("div");
this.Container.style.height = "30px";
this.Container.style.overflow = "auto";
this.Content.appendChild(this.Container);
},
addNode: function(Node) {
// alert(Node.Content);
this.Container.appendChild(Node.Content);
},
clear: function() {
wx.removeAllElementChildren(this.Container);
},
resize: function() {
if (this.Content.parentNode.offsetHeight > 0) {
this.Content.style.width = (this.Content.parentNode.offsetWidth) + "px";
this.Content.style.height = (this.Content.parentNode.offsetHeight) + "px";
this.Container.style.width = (this.Content.parentNode.offsetWidth) + "px";
this.Container.style.height = (this.Content.parentNode.offsetHeight) + "px";
}
//this.Content.style.height = "100%";
},
parseXML : function(TreeNode) {
for (var i = 0; i < TreeNode.childNodes.length; i++) {
var SubNode = TreeNode.childNodes[i];
if (SubNode.nodeName == "Node") {
var Node = new WxTreeNode(SubNode.getAttribute("text"), SubNode.getAttribute("icon"));
Node.Appl = this.Appl;
Node.parseXML(SubNode);
Node.parseXMLEvents(SubNode);
this.addNode(Node);
}
}
}
});
var WxTreeNode = WxClass(WxPanel, {
OpenerCell: null,
OpenerCellIcon: null,
TextCell: null,
SubNodeContainer: null,
IsClosed: true,
NodeCount: 0,
TextTableRow: null,
InnerTextCell: null,
ButtonCellWidth: 0,
ButtonCell: null,
ButtonsRow: null,
Keys: null,
initialize: function(Text, Icon) {
this.$super();
this.Keys = new Array();
var Table = document.createElement("table");
Table.cellPadding="0";
Table.cellSpacing="0";
Table.style.width="100%";
var TableRow = Table.insertRow(-1);
this.OpenerCell = TableRow.insertCell(-1);
this.OpenerCellIcon = document.createElement("img");
this.OpenerCellIcon.Object = this;
this.OpenerCellIcon.src = "gui/icons/Empty.gif";
this.OpenerCell.Object = this;
this.OpenerCell.style.verticalAlign = "Top";
this.OpenerCell.style.width = "15px";
this.OpenerCell.style.textAlign = "Center";
this.OpenerCell.style.paddingTop = "8px";
this.OpenerCell.style.cursor = "pointer";
this.OpenerCell.appendChild(this.OpenerCellIcon);
this.OpenerCell.onclick = function(Event) {
if (!Event) Event = window.event;
Event.target.Object.openNode();
};
this.TextCell = TableRow.insertCell(-1);
this.TextCell.style.height="25px";
this.SubNodeContainer = document.createElement("div");
this.SubNodeContainer.style.visibility = "hidden";
this.SubNodeContainer.style.display = "none";
this.TextCell.appendChild(this.createTextTable(Text, Icon));
this.TextCell.appendChild(this.SubNodeContainer);
this.Content.appendChild(Table);
},
createTextTable: function(Text, IconName) {
var Table = document.createElement("table");
Table.cellPadding="0";
Table.cellSpacing="0";
Table.style.width="100%";
Table.style.height = "24px";
Table.onmouseover = this.onMouseOver;
Table.onmouseout = this.onMouseOut;
this.TextTableRow = Table.insertRow(-1);
var IconCell = this.TextTableRow.insertCell(-1);
IconCell.Object = this;
IconCell.style.cursor = "pointer";
IconCell.style.paddingTop = "2px";
IconCell.style.verticalAlign = "Top";
IconCell.style.textAlign = "Center";
IconCell.style.width = "25px";
if (IconName != null) {
var Icon = document.createElement("img");
Icon.src = IconName;
Icon.style.width = "19px";
IconCell.appendChild(Icon);
}
this.InnerTextCell = this.TextTableRow.insertCell(-1);
this.InnerTextCell.Object = this;
this.InnerTextCell.style.cursor = "pointer";
this.InnerTextCell.innerHTML = Text;
this.ButtonCell = this.TextTableRow.insertCell(-1);
this.ButtonCell.style.width = this.ButtonCellWidth + "px";
this.ButtonCell.style.textAlign = "right";
var ButtonTable = document.createElement("table");
ButtonTable.cellPadding="0";
ButtonTable.cellSpacing="0";
ButtonTable.style.width = "100%";
ButtonTable.style.height = "24px";
this.ButtonRow = ButtonTable.insertRow(-1);
var LastCell = this.ButtonRow.insertCell(-1);
LastCell.innerHTML = " ";
this.ButtonCell.appendChild(ButtonTable);
return Table;
},
addButton: function(Button) {
var newButton = this.ButtonRow.insertCell(-1);
newButton.style.width = "24px";
newButton.appendChild(Button.Content);
this.ButtonCellWidth = this.ButtonCellWidth + 22;
this.ButtonCell.style.width = this.ButtonCellWidth + "px";
},
addNode: function(Node) {
this.NodeCount++;
this.OpenerCellIcon.src = "gui/icons/Plus.gif";
this.SubNodeContainer.appendChild(Node.Content);
},
addColumn: function(Width, Text, FontSize, Format) {
var CIndex = this.ButtonCell.cellIndex;
var NewColumn = this.TextTableRow.insertCell(CIndex);
NewColumn.style.width = Width + "px";
if (FontSize != null) {
NewColumn.style.fontSize = FontSize + "px";
}
if (Format != null) {
if (Format.indexOf("rightAlign") >= 0) {
NewColumn.style.textAlign = "right";
}
if (Format.indexOf("bold") >= 0) {
NewColumn.style.fontWeight = "bold";
}
}
NewColumn.innerHTML = Text;
},
addTitleEvent: function(type, fn) {
EventID = this.Appl.getEventID();
EventName = type + "Event_" + EventID;
var ToCallFunction = new Function("event", fn);
this.Appl[EventName] = ToCallFunction;
var caller = new Function("event", "this.Appl." + EventName + "(event);");
if (this.InnerTextCell != null) {
this.InnerTextCell.Appl = this.Appl;
if (this.InnerTextCell.addEventListener) {
this.InnerTextCell.addEventListener(type, caller, false);
} else if (this.InnerTextCell.attachEvent) {
this.InnerTextCell.attachEvent('on' + type, function() {
return caller.call(this.InnerTextCell, window.event);
});
}
}
},
getKey: function(KeyName) {
return this.Keys[KeyName];
},
setButtonCellWidth: function (Width) {
this.ButtonCellWidth = Width;
this.ButtonCell.style.width = this.ButtonCellWidth + "px";
this.ButtonCell.style.textAlign = "right";
},
setKey: function(KeyName, KeyValue) {
this.Keys[KeyName] = KeyValue;
},
setFontSize: function(FontSize) {
this.InnerTextCell.style.fontSize = FontSize + "px";
},
onMouseOver: function(Event) {
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = system.getStyle("All", "HLightBackground");
},
onMouseOut: function(Event) {
this.style.backgroundColor = this.OldBackgroundColor;
},
openNode: function() {
if (this.NodeCount > 0) {
if (this.IsClosed) {
var newHeight = this.NodeCount * this.Content.offsetHeight;
this.IsClosed = false;
this.SubNodeContainer.style.visibility = "visible";
this.SubNodeContainer.style.display = "block";
//this.Content.style.height = newHeight + this.Content.offsetHeight + "px";
//this.SubNodeContainer.style.height = newHeight + "px";
this.OpenerCellIcon.src = "gui/icons/Minus.gif";
this.fireEvent(this.Content, "expanded");
} else {
this.IsClosed = true;
this.SubNodeContainer.style.visibility = "hidden";
this.SubNodeContainer.style.display = "none";
//this.Content.style.height = "22px";
//this.SubNodeContainer.style.height = "0px";
this.OpenerCellIcon.src = "gui/icons/Plus.gif";
this.fireEvent(this.Content, "collapsed");
}
}
},
parseXML: function(TreeNodeNode) {
for (var i=0; i");
ButtonTextCell.innerHTML = ButtonText;
Row1.appendChild(IconCell);
Row2.appendChild(ButtonTextCell);
CellTable.appendChild(Row1);
CellTable.appendChild(Row2);
CellPanel.setCenterElement(CellTable);
Cell.appendChild(CellPanel.Content)
if (Type == "Popup") {
this.PopupCounter++;
var PopupWidth = 200;
var PopupHeight = 200;
if (ButtonNode.getAttribute("popupWidth") != null) {
PopupWidth = ButtonNode.getAttribute("popupWidth");
}
if (ButtonNode.getAttribute("popupHeight") != null) {
PopupHeight = ButtonNode.getAttribute("popupHeight");
}
var Popup = document.createElement("div");
Popup.visible = false;
Popup.style.position = "absolute";
Popup.style.width = PopupWidth + "px";
Popup.style.height = PopupHeight + "px";
Popup.style.top = "10px";
Popup.style.left = "10px";
//Popup.style.border = "1px solid black";
Popup.style.backgroundColor = "white";
Popup.style.visibility = "hidden";
Popup.style.zIndex = "4";
CellTable.Appl = this.Appl;
CellTable.Popup = Popup;
CellTable.HeaderMenu = this;
CellTable.onclick = function(Event) {
if (this.Popup.visible) {
Event.stopPropagation();
return;
}
this.Popup.visible = true;
var Pos = this.getPosition();
var Background = document.createElement("div");
Background.Parent = this;
Background.Popup = this.Popup;
Background.HeaderMenu = this.HeaderMenu;
Background.style.position = "absolute";
Background.style.zIndex = "2";
Background.style.backgroundColor = "#666666";
Background.style.opacity = "0.1";
Background.style.left = 0 + "px";
Background.style.top = 0 + "px";
Background.style.height = this.Appl.Panel.getDocHeight() + "px";
Background.style.width = this.Appl.Panel.getDocWidth() + "px";
Background.onclick = function(Event) {
this.Popup.style.visibility = "hidden";
this.Popup.visible = false;
this.style.visibility = "hidden";
Event.stopPropagation();
this.Parent.removeBackground(this);
this.HeaderMenu.fireEvent(this.Popup, "popupClosed", null);
return false;
}
this.appendChild(Background);
this.Popup.style.top = (Pos.top + 66) + "px";
this.Popup.style.left = Pos.left + "px";
this.Popup.style.visibility = "visible";
}
CellTable.removeBackground = function(Element) {
if (this.childNodes.length >= 1) {
for (var i=0; i < this.childNodes.length; i++) {
if (this.childNodes[i] == Element) {
this.childNodes[i] = null;
}
}
}
}
CellTable.getPosition = function() {
var el = this;
var _x = 0;
var _y = 0;
while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
_x += el.offsetLeft - el.scrollLeft;
_y += el.offsetTop - el.scrollTop;
el = el.offsetParent;
}
return { top: _y, left: _x };
}
var PopupPanel = new WxBorderPanel();
PopupPanel.Appl = this.Appl;
PopupPanel.Parent = this.ParentPanel;
Popup.Panel = PopupPanel;
PopupPanel.parseXML(ButtonNode);
this.Popups["Popup_" + this.PopupCounter] = Popup;
ButtonTextCell.Popup = "Popup_" + this.PopupCounter;
Popup.appendChild(PopupPanel.Content);
ButtonTextCell.appendChild(Popup);
}
BodyCell.appendChild(Cell);
},
clear: function() {
wx.removeAllElementChildren(this.GroupRow);
this.LastCell = document.createElement("td");
this.LastCell.innerHTML = " ";
this.GroupRow.appendChild(this.LastCell);
},
resize: function() {
for (var Key in this.Popups) {
this.Popups[Key].Panel.resize();
}
},
parseXML: function(HeaderMenuNode) {
for (var i = 0; i < HeaderMenuNode.childNodes.length; i++) {
var SubNode = HeaderMenuNode.childNodes[i];
if (SubNode.nodeName != "#text"
&& SubNode.nodeName != "#comment") {
var doIt = true;
if (SubNode.getAttribute("if") != null) {
doIt = eval(SubNode.getAttribute("if"));
}
if (doIt) this.addGroup(SubNode);
}
}
}
});
var WxFileChooser = WxClass(WxPanel, {
TextField: null,
Button: null,
FileChooser: null,
Enabled: true,
initialize: function(Text) {
this.$super();
this.FileChooser = document.createElement("input");
this.FileChooser.Object = this;
this.FileChooser.type = "File";
this.FileChooser.onchange = function() {
this.Object.select();
}
this.TextField = document.createElement("input");
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
this.TextField.disabled = true;
var Table = document.createElement("table");
Table.cellSpacing = "0";
Table.cellPadding = "0";
Table.style.height = "100%";
Table.style.width = "100%";
var Row = Table.insertRow();
var FieldCell = Row.insertCell();
FieldCell.appendChild(this.TextField);
var OpenIcon = document.createElement("img");
OpenIcon.src = "gui/icons/ordner32.png";
OpenIcon.style.width = "20px";
var ButtonCell = Row.insertCell(-1);
ButtonCell.Object = this;
ButtonCell.style.width = "25px";
ButtonCell.style.width = "25px";
ButtonCell.style.textAlign = "center";
ButtonCell.style.cursor = "pointer";
ButtonCell.appendChild(OpenIcon);
ButtonCell.onclick = function() {
this.Object.open();
}
this.Content.appendChild(Table);
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
noerror: function() {
this.TextField.style.border = "1px solid #666666";
},
open: function() {
if (this.Enabled) this.FileChooser.click();
},
setEnabled: function(Enable) {
if (!Enable) {
this.Enabled = false;
} else {
this.Enabled = true;
}
},
setText: function(Text) {
this.TextField.value = Text;
},
select: function() {
this.TextField.value = this.FileChooser.files[0].name;
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("enable") != null && XMLNode.getAttribute("enable") == "false") {
this.setEnabled(false);
}
}
});
var WxMenuItem = WxClass(WxPanel, {
Text: null,
Icon: null,
IconCell: null,
TextCell: null,
initialize: function() {
this.$super();
var Table = document.createElement("table");
Table.Object = this;
Table.cellPadding = "0";
Table.cellSpacing = "0";
Table.style.width = "100%";
Table.style.cursor = "Pointer";
Table.onmouseover = this.onMouseOver;
Table.onmouseout = this.onMouseOut;
var Row = Table.insertRow();
this.IconCell = Row.insertCell();
this.IconCell.style.backgroundColor = "#f1f1f1";
this.IconCell.style.width = "28px";
this.IconCell.style.textAlign = "Center";
var Cell1 = Row.insertCell();
Cell1.style.width = "5px";
this.TextCell = Row.insertCell(-1);
this.TextCell.style.height = "28px";
this.Content.appendChild(Table);
},
onMouseOver: function(Event) {
this.OldBackgroundColor = this.style.backgroundColor;
this.style.cursor = "pointer";
this.style.backgroundColor = "#e5e5e5";
},
onMouseOut: function(Event) {
this.style.backgroundColor = this.OldBackgroundColor;
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("text") != null) this.TextCell.innerHTML = XMLNode.getAttribute("text");
if (XMLNode.getAttribute("icon") != null) {
var IconImage = document.createElement("img");
IconImage.src = XMLNode.getAttribute("icon");
IconImage.style.width = "19px";
this.IconCell.appendChild(IconImage);
}
}
});
var WxCalendar = WxClass(WxPanel, {
HeaderTable: null,
BodyTable: null,
ToDay: null,
FirstDay: null,
CellWidth: 160,
SelectedDay: null,
TagesEintraege: null,
initialize: function() {
this.$super();
this.ToDay = new Date();
this.FirstDay = new Date();
//this.Content.style.padding = "5px";
this.Content.style.position = "absolute"
this.Content.style.backgroundColor = "#ffffff";
this.Content.style.overflow = "scroll";
//this.buildHeader();
this.build();
},
addEntry: function(Object, EintragsID, Datum, Von, Bis, Titel, Hintergrund, Schrift, ToolTip) {
if (Hintergrund == null) Hintergrund = "#ffffff";
if (Schrift == null) Schrift = "#000000";
if (ToolTip == null) ToolTip = "";
var TagesEintrag = this.TagesEintraege[Datum];
if (TagesEintrag != null) {
var Row = TagesEintrag.insertRow(-1);
var Cell = Row.insertCell(-1);
Cell.Object = Object;
Cell.Datum = Datum;
Cell.EintragsID = EintragsID;
var InnerCell = document.createElement("div")
InnerCell.style.fontSize = "10px";
InnerCell.style.backgroundColor = Hintergrund;
InnerCell.style.color = Schrift;
InnerCell.style.border = "1px solid " + Schrift;
InnerCell.style.marginTop = "1px";
InnerCell.style.padding = "1px";
InnerCell.innerHTML = Von + "-" + Bis + " " + Titel;
InnerCell.title = ToolTip;
Cell.appendChild(InnerCell);
Cell.onclick = function(Event) {
if (Object.entryClick instanceof Function) {
Object.SelectedDatum = this.Datum;
Object.SelectedEintragsID = this.EintragsID;
Object.entryClick();
}
Event.stopPropagation();
return false;
}
} else {
alert("Null");
}
},
clearEntrys: function() {
for (Datum in this.TagesEintraege) {
var Eintrag = this.TagesEintraege[Datum];
if (Eintrag.hasChildNodes()) {
while (Eintrag.childNodes.length >= 1) {
Eintrag.removeChild(Eintrag.firstChild);
}
}
}
},
buildHeader: function() {
if (this.HeaderTable != null) wx.removeAllElementChildren(this.BodyTable);
this.HeaderTable = document.createElement("table");
this.HeaderTable.cellSpacing = "0";
this.HeaderTable.cellSpacing = "0";
this.HeaderTable.style.width = "100%";
this.HeaderTable.style.height = "50px";
var HeaderRow = this.HeaderTable.insertRow();
var HeaderCell1 = HeaderRow.insertCell();
HeaderCell1.innerHTML = "Kalender";
HeaderCell1.style.verticalAlign = "Top";
var HeaderCellPrev = HeaderRow.insertCell(-1);
HeaderCellPrev.Calendar = this;
HeaderCellPrev.style.cursor = "pointer";
HeaderCellPrev.style.textAlign = "Center";
HeaderCellPrev.style.width = "36px";
HeaderCellPrev.style.verticalAlign = "Top";
var HeaderPrevImage = document.createElement("img");
HeaderPrevImage.src = "gui/icons/pfeillinks32.png";
HeaderCellPrev.appendChild(HeaderPrevImage);
HeaderCellPrev.onclick = function(Event) {
this.Calendar.onPrevClick();
}
var HeaderCellNext = HeaderRow.insertCell(-1);
HeaderCellNext.Calendar = this;
HeaderCellNext.style.cursor = "pointer";
HeaderCellNext.style.textAlign = "Center";
HeaderCellNext.style.width = "36px";
HeaderCellNext.style.verticalAlign = "Top";
var HeaderNextImage = document.createElement("img");
HeaderNextImage.src = "gui/icons/pfeilrechts32.png";
HeaderCellNext.appendChild(HeaderNextImage);
HeaderCellNext.onclick = function(Event) {
this.Calendar.onNextClick();
}
this.Content.appendChild(this.HeaderTable);
},
build: function() {
if (this.BodyTable != null) {
wx.removeAllElementChildren(this.BodyTable);
this.BodyTable = null;
}
this.BodyTable = document.createElement("table");
this.BodyTable.cellSpacing = "0";
this.BodyTable.cellSpacing = "0";
//this.BodyTable.style.width = "100%";
this.BodyTable.style.width = (this.CellWidth * 7) + 35 + "px";
//this.BodyTable.style.borderLeft = "1px solid #666666";
this.BodyTable.style.borderRight = "1px solid #666666";
//this.BodyTable.style.borderTop = "1px solid #666666";
this.buildMonthView();
this.Content.appendChild(this.BodyTable);
},
buildMonthView: function() {
this.TagesEintraege = new Array();
var Days = new Array("Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag");
HeaderRow = this.BodyTable.insertRow();
WeekCell = HeaderRow.insertCell();
WeekCell.innerHTML = "Wo.";
WeekCell.style.backgroundColor = "#999999";
WeekCell.style.color = "#ffffff";
WeekCell.style.width = "25px";
WeekCell.style.borderBottom = "1px solid #666666";
WeekCell.style.marginLeft = "5px";
for (var i=0; i < Days.length; i++) {
var DayCell = HeaderRow.insertCell(-1);
DayCell.innerHTML = Days[i];
DayCell.style.backgroundColor = "#999999";
DayCell.style.color = "#ffffff";
DayCell.style.borderLeft = "1px solid #666666";
DayCell.style.borderBottom = "1px solid #666666";
DayCell.style.marginLeft = "5px";
DayCell.style.width = this.CellWidth + "px";
}
var now = this.FirstDay.getDate();
var month = this.FirstDay.getMonth();
var year = this.FirstDay.getFullYear();
this.FirstDay.setDate(1);
var prevMonth = this.FirstDay;
prevMonth = this.FirstDay;
prevMonth.setDate(0);
var momDay = 0;
if (prevMonth.getDay() == 0)
momDay = prevMonth.getDate() - 6;
else
momDay = prevMonth.getDate() - (prevMonth.getDay() - 1);
this.FirstDay.setDate(momDay);
var dayCounter = 0;
var oldMonth = true;
var newMonth = false;
var fullIt = true;
var TableRow = this.BodyTable.insertRow();
var WeekCell = TableRow.insertCell();
WeekCell.style.backgroundColor = "#999999";
WeekCell.style.color = "#ffffff";
WeekCell.style.borderBottom = "1px solid #666666";
WeekCell.style.verticalAlign = "top";
WeekCell.style.textAlign = "Center";
WeekCell.innerHTML = this.FirstDay.getWeek();
while (fullIt) {
dayCounter++;
if (this.FirstDay.getDate() == 1) {
oldMonth = false;
}
var tDay = "" + this.FirstDay.getDate();
if (tDay.length == 1) tDay = "0" + tDay;
var tMonth = "" + (this.FirstDay.getMonth() + 1);
if (tMonth.length == 1) tMonth = "0" + tMonth;
var tDatum = "" + this.FirstDay.getFullYear() + "" + tMonth + "" + tDay;
var TableCell = TableRow.insertCell(-1);
TableCell.Calendar = this;
TableCell.style.verticalAlign = "Top";
TableCell.style.height = "100px";
TableCell.Day = this.FirstDay.getDate();
TableCell.Month = this.FirstDay.getMonth() + 1;
TableCell.Year = this.FirstDay.getFullYear();
TableCell.FuerDatum = tDatum;
TableCell.style.borderLeft = "1px solid #666666";
TableCell.style.borderBottom = "1px solid #666666";
TableCell.style.textAlign = "Center";
TableCell.style.cursor = "Pointer";
TableCell.highlightBackgroundColor = "orange";
TableCell.momDay = false;
TableCell.hatTermine = "N";
TableCell.onclick = function(Event) {
this.Calendar.SelectedDay = this.FuerDatum;
}
var InnerTable = document.createElement("table");
InnerTable.cellSpacing = "0";
InnerTable.cellSpacing = "0";
InnerTable.style.width = "100%";
var InnerTableRow = InnerTable.insertRow(-1);
var InnerTableCell1 = InnerTableRow.insertCell(-1);
InnerTableCell1.style.width = "20px";
InnerTableCell1.style.fontSize = "9px";
InnerTableCell1.innerHTML = this.FirstDay.getDate() + "." + (this.FirstDay.getMonth()+1) + ".";
var InnerTableCell2 = InnerTableRow.insertCell(-1);
InnerTableCell2.style.fontSize = "10px";
TableCell.appendChild(InnerTable);
//TableCell.onclick = this.onClick;
//TableCell.onmouseover = this.onMouseOver;
//TableCell.onmouseout = this.onMouseOut;
if (oldMonth || newMonth) {
InnerTableCell1.style.color = "#999999";
TableCell.style.backgroundColor = "#e5e5e5";
}
var tDay = "" + this.FirstDay.getDate();
if (tDay.length == 1) tDay = "0" + tDay;
var tMonth = "" + (this.FirstDay.getMonth() + 1);
if (tMonth.length == 1) tMonth = "0" + tMonth;
var TagesBeschreibung = " ";
var tDatum = "" + this.FirstDay.getFullYear() + "" + tMonth + "" + tDay;
if (system.getFeiertag(tDatum)!= null) {
InnerTableCell1.style.color = "orange";
TableCell.style.backgroundColor = "yellow";
TagesBeschreibung = system.getFeiertag(tDatum).Beschreibung;
}
if (this.FirstDay.getDate() == this.ToDay.getDate() && this.FirstDay.getMonth() == this.ToDay.getMonth() && this.FirstDay.getFullYear() == this.ToDay.getFullYear()) {
TableCell.momDay = true;
TableCell.style.backgroundColor = "#666666";
InnerTableCell1.style.color = "#ffffff";
InnerTableCell2.style.color = "#ffffff";
}
InnerTableCell2.innerHTML = TagesBeschreibung;
var EintraegeTable = document.createElement("table");
EintraegeTable.cellSpacing = "0";
EintraegeTable.cellSpacing = "0";
EintraegeTable.style.width = "100%";
this.TagesEintraege[tDatum] = EintraegeTable;
TableCell.appendChild(EintraegeTable);
/*if (this.eingestellteTermine.contains(tDatum) == true) {
TableCell.hatTermine = "Y";
TableCell.style.backgroundColor = "blue";
TableCell.style.color = "#ffffff";
}*/
if (dayCounter == 7 || dayCounter == 14 || dayCounter == 21 || dayCounter == 28 || dayCounter == 35) {
TableRow = this.BodyTable.insertRow();
var WeekCell = TableRow.insertCell();
WeekCell.style.backgroundColor = "#999999";
WeekCell.style.color = "#ffffff";
WeekCell.style.borderBottom = "1px solid #666666";
WeekCell.style.verticalAlign = "top";
WeekCell.style.textAlign = "Center";
WeekCell.innerHTML = this.FirstDay.getWeek();
}
momDay++;
this.FirstDay.setDate(momDay);
if (this.FirstDay.getDate() == 1) {
this.FirstDay.setDate(1);
momDay = 1;
if (!oldMonth)
newMonth = true;
}
if (dayCounter == 42) {
break;
}
}
this.FirstDay.setMonth(month);
this.FirstDay.setFullYear(year);
},
resize: function() {
this.Content.style.width = this.Content.parentNode.offsetWidth + "px";
this.Content.style.height = this.Content.parentNode.offsetHeight - 2 + "px";
},
getSelectedDay: function() {
return this.SelectedDay;
},
addMonth: function(Adder) {
var m = this.FirstDay.getMonth() + Adder;
this.FirstDay.setMonth(m);
this.build();
},
subMonth: function(Subber) {
var m = this.FirstDay.getMonth() - Subber;
this.FirstDay.setMonth(m);
this.build();
},
addYear: function(Adder) {
var y = this.FirstDay.getFullYear() + Adder;
this.FirstDay.setFullYear(y);
},
subYear: function(Subber) {
var y = this.FirstDay.getFullYear() - Subber;
this.FirstDay.setFullYear(y);
},
onPrevClick: function() {
var m = this.FirstDay.getMonth() - 1 - 1;
this.FirstDay.setMonth(m);
this.build();
},
onNextClick: function() {
var m = this.FirstDay.getMonth() - 1 + 1;
this.FirstDay.setMonth(m);
this.build();
},
setTitle: function(Title) {
},
parseXML: function(XMLNode) {
}
});
var WxDatePicker = WxClass(WxPanel, {
Table: null,
TextField: null,
Button: null,
Background: null,
Window: null,
IsOpen: false,
SelectedDate: null,
WithYear: true,
CalendarTable: null,
FootTable: null,
ToDay: null,
FirstDay: null,
Enabled: true,
initialize: function(Text) {
this.$super();
//if (WithYear != null && WithYear = "false") {
//
//}
this.TextField = document.createElement("input");
this.TextField.Calendar = this;
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
this.TextField.maxLength = "10";
this.TextField.onkeypress = function validate(Event) {
var Event = Event || window.event;
var Key = Event.keyCode || Event.which;
var Correct = false;
if (Key >= 48 && Key <= 58) Correct = true; // Zahlen
if (Key >= 37 && Key <= 40) Correct = true; // Pfeile
if (Key == 46 || Key == 8 || Key == 9) Correct = true; // Punkt, Back
if (!Correct) Event.preventDefault();
}
this.TextField.onblur = function(Event) {
var Event = Event || window.event;
this.Calendar.testDate();
/*if (document.createEvent) {
this.Calendar.Content.dispatchEvent(Event);
} else {
this.Calendar.Content.fireEvent("on" + Event.eventType, Event);
}*/
}
//this.TextField.disabled = true;
this.Table = document.createElement("table");
this.Table.cellSpacing = "0";
this.Table.cellPadding = "0";
this.Table.style.height = "100%";
this.Table.style.width = "100%";
var Row = this.Table.insertRow();
var FieldCell = Row.insertCell();
FieldCell.appendChild(this.TextField);
var OpenIcon = document.createElement("img");
OpenIcon.src = "gui/icons/calendar/tagesansicht32.png";
OpenIcon.style.width = "20px";
var ButtonCell = Row.insertCell(-1);
ButtonCell.Object = this;
ButtonCell.style.width = "25px";
ButtonCell.style.width = "25px";
ButtonCell.style.textAlign = "center";
ButtonCell.style.cursor = "pointer";
ButtonCell.appendChild(OpenIcon);
ButtonCell.onclick = function() {
this.Object.open();
}
this.Background = document.createElement("div");
this.Background.Object = this;
this.Background.style.position = "absolute";
this.Background.style.zIndex = "2";
this.Background.style.backgroundColor = "#666666";
this.Background.style.opacity = "0.1";
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Background.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.closeWindow();
}
}
this.Window = document.createElement("div");
this.Window.style.position = "absolute";
this.Window.style.zIndex = "4";
this.Window.style.backgroundColor = "#ffffff";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.ToDay = new Date();
this.FirstDay = new Date();
this.Content.appendChild(this.Table);
this.Content.appendChild(this.Background);
this.Content.appendChild(this.Window);
//document.getElementsByTagName("body")[0].appendChild(this.Window);
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
noerror: function(Text) {
this.TextField.style.border = "1px solid #666666";
},
focus: function() {
this.TextField.focus();
},
testDate: function() {
this.noerror();
var Heute = new Date();
var Text = this.TextField.value;
if (Text != "") {
if (Text.indexOf(".") < 0 && Text.length == 1) {
Text = Text.substring(0, 1) + "." + (Heute.getMonth()+1) + "." + Heute.getFullYear();
}
if (Text.indexOf(".") < 0 && Text.length == 2) {
Text = Text.substring(0, 2) + "." + (Heute.getMonth()+1) + "." + Heute.getFullYear();
}
if (Text.indexOf(".") < 0 && Text.length == 4) {
Text = Text.substring(0, 2) + "." + Text.substring(2,4) + "." + Heute.getFullYear();
}
if (Text.indexOf(".") < 0 && Text.length == 8) {
Text = Text.substring(0, 2) + "." + Text.substring(2,4) + "." + Text.substring(4,8);
}
var TextSplit = Text.split(".");
if (TextSplit.length == 2) {
TextSplit.push(Heute.getFullYear());
}
var Korrekt = true;
var TestDate = new Date(TextSplit[2], (TextSplit[1]-1), TextSplit[0]);
if (TestDate.getDate() != TextSplit[0]) Korrekt = false;
if (TestDate.getMonth() != (TextSplit[1]-1)) Korrekt = false;
if (TestDate.getFullYear() != TextSplit[2]) Korrekt = false;
var tDay = "" + TextSplit[0];
var tMonth = "" + TextSplit[1];
var tYear = "" + TextSplit[2];
if (tDay.length <= 1) tDay = "0" + tDay;
if (tMonth.length <= 1) tMonth = "0" + tMonth;
this.TextField.value = tDay + "." + tMonth + "." + tYear;
if (!Korrekt) {
this.error("Falsches Datum");
} else {
this.FirstDay = new Date(tYear, (tMonth-1), tDay);
this.SelectedDate = new Date(tYear, (tMonth-1), tDay);
}
return Korrekt;
} else {
return true;
}
},
build: function() {
if (this.CalendarTable != null) {
wx.removeAllElementChildren(this.CalendarTable);
this.CalendarTable = null;
}
if (this.FootTable != null) {
wx.removeAllElementChildren(this.FootTable);
this.FootTable = null;
}
this.CalendarTable = document.createElement("table");
this.CalendarTable.cellSpacing = "0";
this.CalendarTable.cellSpacing = "0";
this.CalendarTable.style.width = "100%";
var Days = new Array("Mo", "Di", "Mi", "Do", "Fr", "Sa", "So");
HeaderRow = this.CalendarTable.insertRow();
for (var i=0; i < Days.length; i++) {
var DayCell = HeaderRow.insertCell(-1);
DayCell.innerHTML = Days[i];
DayCell.style.backgroundColor = "#999999";
DayCell.style.color = "#ffffff";
if (i > 0) DayCell.style.borderLeft = "1px solid #666666";
DayCell.style.borderBottom = "1px solid #666666";
DayCell.style.marginLeft = "5px";
DayCell.style.textAlign = "Center";
}
var now = this.FirstDay.getDate();
var month = this.FirstDay.getMonth();
var year = this.FirstDay.getFullYear();
this.FirstDay.setDate(1);
var prevMonth = this.FirstDay;
prevMonth = this.FirstDay;
prevMonth.setDate(0);
var momDay = 0;
if (prevMonth.getDay() == 0)
momDay = prevMonth.getDate() - 6;
else
momDay = prevMonth.getDate() - (prevMonth.getDay() - 1);
this.FirstDay.setDate(momDay);
var dayCounter = 0;
var oldMonth = true;
var newMonth = false;
var fullIt = true;
var TableRow = this.CalendarTable.insertRow(-1);
while (fullIt) {
dayCounter++;
if (this.FirstDay.getDate() == 1) {
oldMonth = false;
}
var tDay = "" + this.FirstDay.getDate();
if (tDay.length == 1) tDay = "0" + tDay;
var tMonth = "" + (this.FirstDay.getMonth() + 1);
if (tMonth.length == 1) tMonth = "0" + tMonth;
var tDatum = "" + this.FirstDay.getFullYear() + "" + tMonth + "" + tDay;
var TableCell = TableRow.insertCell(-1);
TableCell.Calendar = this;
TableCell.CellDate = new Date(this.FirstDay);
TableCell.style.verticalAlign = "Top";
TableCell.style.height = "20px";
if (this.FirstDay.getDay() != 1) TableCell.style.borderLeft = "1px solid #666666";
TableCell.style.borderBottom = "1px solid #666666";
TableCell.style.textAlign = "Center";
TableCell.style.cursor = "Pointer";
TableCell.momDay = false;
TableCell.hatTermine = "N";
TableCell.innerHTML = this.FirstDay.getDate();
if (system.getFeiertag(tDatum)!= null) {
TableCell.style.color = "orange";
TableCell.style.backgroundColor = "yellow";
}
TableCell.onmouseover = function(Event) {
this.OldBackground = this.style.backgroundColor;
this.OldForeground = this.style.color
this.style.backgroundColor = "#e5e5e5";
this.style.color = "#000000";
}
TableCell.onmouseout = function(Event) {
this.style.backgroundColor = this.OldBackground;
this.style.color = this.OldForeground;
}
TableCell.onclick = function(Event) {
this.Calendar.setDate(this.CellDate);
}
if (oldMonth || newMonth) {
TableCell.style.color = "#666666";
TableCell.style.backgroundColor = "#f1f1f1";
}
if (this.FirstDay.getDate() == this.ToDay.getDate() && this.FirstDay.getMonth() == this.ToDay.getMonth() && this.FirstDay.getFullYear() == this.ToDay.getFullYear()) {
TableCell.momDay = true;
TableCell.style.backgroundColor = "#666666";
TableCell.style.color = "#ffffff";
}
/*if (this.eingestellteTermine.contains(tDatum) == true) {
TableCell.hatTermine = "Y";
TableCell.style.backgroundColor = "blue";
TableCell.style.color = "#ffffff";
}*/
if (dayCounter == 7 || dayCounter == 14 || dayCounter == 21 || dayCounter == 28 || dayCounter == 35) {
TableRow = this.CalendarTable.insertRow(-1);
}
momDay++;
this.FirstDay.setDate(momDay);
if (this.FirstDay.getDate() == 1) {
this.FirstDay.setDate(1);
momDay = 1;
if (!oldMonth)
newMonth = true;
}
if (dayCounter == 42) {
break;
}
}
this.FootTable = document.createElement("table");
this.FootTable.cellSpacing = "0";
this.FootTable.cellSpacing = "0";
this.FootTable.style.width = "100%";
var FootRow = this.FootTable.insertRow();
if (this.WithYear) var FootLeft1 = FootRow.insertCell(-1);
var FootLeft2 = FootRow.insertCell(-1);
var FootCenter = FootRow.insertCell(-1);
var FootRight1 = FootRow.insertCell(-1);
if (this.WithYear) var FootRight2 = FootRow.insertCell(-1);
if (this.WithYear) {
var FootLeft1Image = document.createElement("img");
FootLeft1Image.src = "gui/icons/pfeillinks32.png";
FootLeft1Image.style.width = "22px";
FootLeft1.appendChild(FootLeft1Image);
FootLeft1.Calendar = this;
FootLeft1.style.width = "25px";
FootLeft1.style.cursor = "pointer";
FootLeft1.onclick = function(Event) {
this.Calendar.onPrevYearClick();
}
}
var FootLeft2Image = document.createElement("img");
FootLeft2Image.src = "gui/icons/pfeillinks32.png";
FootLeft2Image.style.width = "22px";
FootLeft2.appendChild(FootLeft2Image);
FootLeft2.Calendar = this;
FootLeft2.style.width = "25px";
FootLeft2.style.cursor = "pointer";
FootLeft2.onclick = function(Event) {
this.Calendar.onPrevClick();
}
var Monate = new Array("Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
FootCenter.style.textAlign = "Center";
FootCenter.innerHTML = Monate[month] + " " + year;
var FootRight1Image = document.createElement("img");
FootRight1Image.src = "gui/icons/pfeilrechts32.png";
FootRight1Image.style.width = "22px";
FootRight1.appendChild(FootRight1Image);
FootRight1.Calendar = this;
FootRight1.style.width = "25px";
FootRight1.style.cursor = "pointer";
FootRight1.onclick = function(Event) {
this.Calendar.onNextClick();
}
if (this.WithYear) {
var FootRight2Image = document.createElement("img");
FootRight2Image.src = "gui/icons/pfeilrechts32.png";
FootRight2Image.style.width = "22px";
FootRight2.appendChild(FootRight2Image);
FootRight2.Calendar = this;
FootRight2.style.width = "25px";
FootRight2.style.cursor = "pointer";
FootRight2.onclick = function(Event) {
this.Calendar.onNextYearClick();
}
}
this.FirstDay.setMonth(month);
this.FirstDay.setFullYear(year);
this.Window.appendChild(this.CalendarTable);
this.Window.appendChild(this.FootTable);
},
onPrevClick: function() {
var m = this.FirstDay.getMonth() - 1;
this.FirstDay.setMonth(m);
this.build();
},
onNextClick: function() {
var m = this.FirstDay.getMonth() + 1;
this.FirstDay.setMonth(m);
this.build();
},
onPrevYearClick: function() {
var y = this.FirstDay.getFullYear() - 1;
this.FirstDay.setFullYear(y);
this.build();
},
onNextYearClick: function() {
var y = this.FirstDay.getFullYear() + 1;
this.FirstDay.setYear(y);
this.build();
},
open: function() {
if (this.Enabled) {
if (this.IsOpen == true) {
this.closeWindow();
return;
}
this.IsOpen = true;
this.build();
var rect = this.Content.getBoundingClientRect();
this.Background.style.left = 0 - rect.left + "px";
this.Background.style.top = 0 - rect.top + "px";
this.Background.style.height = this.getDocHeight() + (rect.top/2) + "px";
this.Background.style.width = this.getDocWidth() + (rect.left/2) + "px";
this.Background.style.display = "block";
this.Background.style.visibility = "visible";
var WindowWidth = rect.right - rect.left;
if (WindowWidth < 250) WindowWidth = 250;
this.Window.style.zIndex = "2";
this.Window.style.left = rect.Left + "px";
this.Window.style.top = rect.Top + 22 + "px";
this.Window.style.border = "1px solid black";
this.Window.style.height = "200px";
this.Window.style.width = WindowWidth + "px";
this.Window.style.display = "block";
this.Window.style.visibility = "visible";
this.Window.scrollTop = 0;
}
},
closeWindow: function() {
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.IsOpen = false;
},
getDate: function() {
return this.SelectedDate;
},
getDateString: function() {
if (this.TextField.value != "") {
var TextSplit = this.TextField.value.split(".");
return TextSplit[2] + TextSplit[1] + TextSplit[0];
} else {
return "";
}
},
setSelectedDate: function(DateString)
{
this.SelectedDate = new Date( DateString.substring(0, 4),DateString.substring(4, 6)-1 ,DateString.substring(6, 8) );
},
setDateString: function(DateString) {
if (DateString != null && DateString.length == 8) {
this.TextField.value = DateString.substring(6, 8) + "." + DateString.substring(4, 6) + "." + DateString.substring(0, 4);
}
},
setDate: function(CellDate) {
this.SelectedDate = CellDate;
this.format();
this.closeWindow();
},
setEnabled: function(Enabled) {
this.Enabled = Enabled;
this.TextField.disabled = !Enabled;
},
format: function() {
if (this.SelectedDate != null) {
var day = this.SelectedDate.getDate();
if (day < 10) day = "0" + day;
var month = this.SelectedDate.getMonth() + 1;
if (month < 10) month = "0" + month;
var year = this.SelectedDate.getFullYear();
this.TextField.value = day + "." + month + "." + year;
}
},
parseXML: function(XMLNode) {
if (XMLNode.getAttribute("withYear")) {
if (XMLNode.getAttribute("withYear") == "false") {
this.WithYear = false;
}
}
if (XMLNode.getAttribute("today")) {
if (XMLNode.getAttribute("today") == "true") {
this.setDate(new Date());
}
}
if (XMLNode.getAttribute("textfieldActive") != null) {
if (XMLNode.getAttribute("textfieldActive") == "true") this.TextField.disabled = false;
if (XMLNode.getAttribute("textfieldActive") == "false")this.TextField.disabled = true;
}
if (XMLNode.getAttribute("enable") != null) {
if (XMLNode.getAttribute("enable") == "true") this.setEnabled(true);
if (XMLNode.getAttribute("enable") == "false") this.setEnabled(false);
}
}
});
var WxMonthPicker = WxClass(WxPanel, {
Table: null,
TextField: null,
Button: null,
Background: null,
Window: null,
IsOpen: false,
CalendarTable: null,
FootTable: null,
Monate: null,
Monat: null,
Jahr: null,
MomMonat: null,
MomJahr: null,
initialize: function(Text) {
this.$super();
this.Monate = new Array();
this.Monate["01"] = "Januar";
this.Monate["02"] = "Februar";
this.Monate["03"] = "März";
this.Monate["04"] = "April";
this.Monate["05"] = "Mai";
this.Monate["06"] = "Juni";
this.Monate["07"] = "Juli";
this.Monate["08"] = "August";
this.Monate["09"] = "September";
this.Monate["10"] = "Oktober";
this.Monate["11"] = "November";
this.Monate["12"] = "Dezember";
this.TextField = document.createElement("input");
this.TextField.disabled = true;
this.TextField.Calendar = this;
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
var SelectedDate = new Date();
this.Monat = SelectedDate.getMonth() + 1;
this.Jahr = SelectedDate.getFullYear();
this.MomJahr = SelectedDate.getFullYear();
if (this.Monat < 10) {
this.Monat = "0" + this.Monat;
}
this.MomMonat = this.Monat;
this.setText();
this.Table = document.createElement("table");
this.Table.cellSpacing = "0";
this.Table.cellPadding = "0";
this.Table.style.height = "100%";
this.Table.style.width = "100%";
var Row = this.Table.insertRow(-1);
var FieldCell = Row.insertCell(-1);
FieldCell.appendChild(this.TextField);
var OpenIcon = document.createElement("img");
OpenIcon.src = "gui/icons/calendar/monatsansicht32.png";
OpenIcon.style.width = "20px";
var LeftIcon = document.createElement("img");
LeftIcon.src = "gui/icons/pfeillinks32.png";
LeftIcon.style.width = "10px";
var RightIcon = document.createElement("img");
RightIcon.src = "gui/icons/pfeilrechts32.png";
RightIcon.style.width = "10px";
var LeftButtonCell = Row.insertCell(-1);
LeftButtonCell.Object = this;
LeftButtonCell.style.width = "9px";
LeftButtonCell.style.textAlign = "center";
LeftButtonCell.style.cursor = "pointer";
LeftButtonCell.appendChild(LeftIcon);
LeftButtonCell.onclick = function() {
this.Object.Monat = parseInt(this.Object.Monat) - 1;
if (parseInt(this.Object.Monat) <= 0) {
this.Object.Jahr = parseInt(this.Object.Jahr) - 1;
this.Object.Monat = "" + 12;
}
if (parseInt(this.Object.Monat) < 10) this.Object.Monat = "0" + this.Object.Monat;
else this.Object.Monat = "" + this.Object.Monat;
this.Object.setText();
this.Object.fireEvent(this.Object.Content, "selected");
}
var RightButtonCell = Row.insertCell(-1);
RightButtonCell.Object = this;
RightButtonCell.style.width = "9px";
RightButtonCell.style.textAlign = "center";
RightButtonCell.style.cursor = "pointer";
RightButtonCell.appendChild(RightIcon);
RightButtonCell.onclick = function() {
this.Object.Monat = parseInt(this.Object.Monat) + 1;
if (parseInt(this.Object.Monat) >= 13) {
this.Object.Jahr = parseInt(this.Object.Jahr) + 1;
this.Object.Monat = 1;
}
if (parseInt(this.Object.Monat) < 10) this.Object.Monat = "0" + this.Object.Monat;
else this.Object.Monat = "" + this.Object.Monat;
this.Object.setText();
this.Object.fireEvent(this.Object.Content, "selected");
}
var ButtonCell = Row.insertCell(-1);
ButtonCell.Object = this;
ButtonCell.style.width = "25px";
ButtonCell.style.width = "25px";
ButtonCell.style.textAlign = "center";
ButtonCell.style.cursor = "pointer";
ButtonCell.appendChild(OpenIcon);
ButtonCell.onclick = function() {
this.Object.open();
}
this.Background = document.createElement("div");
this.Background.Object = this;
this.Background.style.position = "absolute";
this.Background.style.zIndex = "2";
this.Background.style.backgroundColor = "#666666";
this.Background.style.opacity = "0.1";
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Background.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.closeWindow();
}
}
this.Window = document.createElement("div");
this.Window.style.position = "absolute";
this.Window.style.zIndex = "4";
this.Window.style.backgroundColor = "#ffffff";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.Content.appendChild(this.Table);
this.Content.appendChild(this.Background);
this.Content.appendChild(this.Window);
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
noerror: function(Text) {
this.TextField.style.border = "1px solid #666666";
},
focus: function() {
this.TextField.focus();
},
build: function() {
if (this.CalendarTable != null) {
wx.removeAllElementChildren(this.CalendarTable);
this.CalendarTable = null;
}
if (this.FootTable != null) {
wx.removeAllElementChildren(this.FootTable);
this.FootTable = null;
}
this.CalendarTable = document.createElement("table");
this.CalendarTable.cellSpacing = "0";
this.CalendarTable.cellSpacing = "0";
this.CalendarTable.style.width = "100%";
var Monate = new Array("nix", "Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember");
for (var i=0; i < Monate.length; i++) {
if (i == 0) continue;
var TableRow = this.CalendarTable.insertRow(-1);
var month = "" + i;
if (i < 10) month = "0" + i;
var TableCell = TableRow.insertCell(-1);
TableCell.Calendar = this;
TableCell.Month = this.Jahr + month;
TableCell.style.verticalAlign = "Top";
TableCell.style.height = "20px";
TableCell.style.textAlign = "Center";
TableCell.style.cursor = "Pointer";
TableCell.innerHTML = Monate[i];
if (this.MomMonat == month && this.Jahr == this.MomJahr) {
TableCell.style.backgroundColor = "#666666";
TableCell.style.color = "#ffffff";
} else {
if (this.Monat == month) {
TableCell.style.backgroundColor = "#e5e5e5";
TableCell.style.color = "#000000";
}
}
TableCell.onmouseover = function(Event) {
this.OldBackground = this.style.backgroundColor;
this.OldForeground = this.style.color
this.style.backgroundColor = "#e5e5e5";
this.style.color = "#000000";
}
TableCell.onmouseout = function(Event) {
this.style.backgroundColor = this.OldBackground;
this.style.color = this.OldForeground;
}
TableCell.onclick = function(Event) {
this.Calendar.setDateString(this.Month);
this.Calendar.closeWindow();
this.Calendar.fireEvent(this.Calendar.Content, "selected");
}
}
this.FootTable = document.createElement("table");
this.FootTable.cellSpacing = "0";
this.FootTable.cellSpacing = "0";
this.FootTable.style.width = "100%";
this.FootTable.style.borderTop = "1px solid #666666";
var FootRow = this.FootTable.insertRow();
if (this.WithYear) var FootLeft1 = FootRow.insertCell(-1);
var FootLeft2 = FootRow.insertCell(-1);
var FootCenter = FootRow.insertCell(-1);
var FootRight1 = FootRow.insertCell(-1);
if (this.WithYear) var FootRight2 = FootRow.insertCell(-1);
var FootLeft2Image = document.createElement("img");
FootLeft2Image.src = "gui/icons/pfeillinks32.png";
FootLeft2Image.style.width = "22px";
FootLeft2.appendChild(FootLeft2Image);
FootLeft2.Calendar = this;
FootLeft2.style.width = "25px";
FootLeft2.style.cursor = "pointer";
FootLeft2.onclick = function(Event) {
this.Calendar.onPrevYearClick();
}
FootCenter.style.textAlign = "Center";
FootCenter.innerHTML = this.Monate[this.Monat] + " " + this.Jahr;
var FootRight1Image = document.createElement("img");
FootRight1Image.src = "gui/icons/pfeilrechts32.png";
FootRight1Image.style.width = "22px";
FootRight1.appendChild(FootRight1Image);
FootRight1.Calendar = this;
FootRight1.style.width = "25px";
FootRight1.style.cursor = "pointer";
FootRight1.onclick = function(Event) {
this.Calendar.onNextYearClick();
}
this.Window.appendChild(this.CalendarTable);
this.Window.appendChild(this.FootTable);
},
onPrevYearClick: function() {
this.Jahr = parseInt(this.Jahr) - 1;
this.build();
},
onNextYearClick: function() {
this.Jahr = parseInt(this.Jahr) + 1;
this.build();
},
open: function() {
if (this.IsOpen == true) {
this.closeWindow();
return;
}
this.IsOpen = true;
this.build();
var rect = this.Content.getBoundingClientRect();
this.Background.style.left = 0 - rect.left + "px";
this.Background.style.top = 0 - rect.top + "px";
this.Background.style.height = this.getDocHeight() + (rect.top/2) + "px";
this.Background.style.width = this.getDocWidth() + (rect.left/2) + "px";
this.Background.style.display = "block";
this.Background.style.visibility = "visible";
var WindowWidth = rect.right - rect.left;
if (WindowWidth < 250) WindowWidth = 250;
this.Window.style.zIndex = "2";
this.Window.style.left = rect.Left + "px";
this.Window.style.top = rect.Top + 22 + "px";
this.Window.style.border = "1px solid black";
this.Window.style.height = "310px";
this.Window.style.width = WindowWidth + "px";
this.Window.style.display = "block";
this.Window.style.visibility = "visible";
this.Window.scrollTop = 0;
},
closeWindow: function() {
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.IsOpen = false;
},
getDate: function() {
return this.Monat + "." + this.Jahr;
},
getDateString: function() {
return "" + this.Jahr + "" + this.Monat;
},
setText: function() {
this.TextField.value = this.Monate[this.Monat] + " " + this.Jahr;
},
setDateString: function(DateString) {
if (DateString != null && DateString.length == 6) {
this.Monat = DateString.substring(4, 6);
this.Jahr = DateString.substring(0, 4);
this.TextField.value = this.Monate[this.Monat] + " " + this.Jahr;
}
},
parseXML: function(XMLNode) {
}
});
var WxColorPicker = WxClass(WxPanel, {
Table: null,
TextField: null,
Button: null,
Background: null,
Window: null,
IsOpen: false,
SelectedIndex: 0,
SelectedKey: null,
Index: -1,
initialize: function(Text) {
this.$super();
this.TextField = document.createElement("input");
this.TextField.style.width = "100%";
this.TextField.style.border = "1px solid #666666";
//this.TextField.disabled = true;
this.Table = document.createElement("table");
this.Table.cellSpacing = "0";
this.Table.cellPadding = "0";
this.Table.style.height = "100%";
this.Table.style.width = "100%";
var Row = this.Table.insertRow();
var FieldCell = Row.insertCell();
FieldCell.appendChild(this.TextField);
var OpenIcon = document.createElement("img");
OpenIcon.src = "gui/icons/oeffner32.png";
OpenIcon.style.width = "20px";
var ButtonCell = Row.insertCell(-1);
ButtonCell.Object = this;
ButtonCell.style.width = "25px";
ButtonCell.style.width = "25px";
ButtonCell.style.textAlign = "center";
ButtonCell.style.cursor = "pointer";
ButtonCell.appendChild(OpenIcon);
ButtonCell.onclick = function() {
this.Object.open();
}
this.Background = document.createElement("div");
this.Background.Object = this;
this.Background.style.position = "absolute";
this.Background.style.zIndex = "2";
this.Background.style.backgroundColor = "#666666";
this.Background.style.opacity = "0.1";
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Background.onclick = function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.closeWindow();
}
}
this.Window = document.createElement("div");
this.Window.style.position = "absolute";
this.Window.style.zIndex = "4";
this.Window.style.backgroundColor = "#ffffff";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
//this.Window.style.overflow = "scroll";
//this.Window.style.overflowY = "scroll";
this.buildColor();
this.Content.appendChild(this.Table);
this.Content.appendChild(this.Background);
this.Content.appendChild(this.Window);
//document.getElementsByTagName("body")[0].appendChild(this.Window);
},
getColorCode: function(d) {
if (d == 256) d = 255;
max = 255;
if (d > max) return "null";
if (d <= -1) return "null";
var z = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F");
var x = "";
if (d == 0) return "00";
var i = 1, v = d, r = 0;
while (v > 15) {
v = Math.floor(v / 16);
i++;
}
v = d;
for (j=i; j >= 1; j--) {
x = x + z[Math.floor(v / Math.pow(16,j-1))];
v = v - (Math.floor(v / Math.pow(16,j-1)) * Math.pow(16,j-1));
}
if (d <= 15) x = "0" + x;
return x;
},
getColor: function (red, green, blue) {
return "#" + this.getColorCode(red) + this.getColorCode(green) + this.getColorCode(blue);
},
buildColor: function() {
this.Index = this.Index + 1;
var NewIndex = this.Index;
var Table = document.createElement("table");
Table.cellSpacing = "0";
Table.cellPadding = "0";
Table.style.width = "100%";
var Row = Table.insertRow(-1);
this.addColorCell(Row, 0, 0, 0);
this.addColorCell(Row, 32, 32, 32);
this.addColorCell(Row, 64, 64, 64);
this.addColorCell(Row, 96, 96, 96);
this.addColorCell(Row, 128, 128, 128);
this.addColorCell(Row, 160, 160, 160);
this.addColorCell(Row, 192, 192, 192);
this.addColorCell(Row, 224, 224, 224);
for (var r = 0; r < 8; r++) {
var rc = (r+1)*32;
var Row = Table.insertRow();
for (var i = 0; i < 8; i++) {
var ic = (i+1)*32;
this.addColorCell(Row, rc, rc, ic);
}
}
var Row = Table.insertRow(-1);
for (var i = 0; i < 8; i++) {
var ic = (i+1)*32;
this.addColorCell(Row, 0, ic, ic);
}
for (var r = 0; r < 8; r++) {
var rc = (r+1)*32;
var Row = Table.insertRow();
for (var i = 0; i < 8; i++) {
var ic = (i+1)*32;
this.addColorCell(Row, rc, ic, 0);
}
}
this.Window.appendChild(Table);
},
addColorCell: function(Row, Red, Green, Blue) {
var Cell = Row.insertCell();
Cell.Object = this;
Cell.ColorCode = this.getColor(Red, Green, Blue);
Cell.style.height = "8";
Cell.style.backgroundColor = Cell.ColorCode;
Cell.onclick = function() {
this.Object.setSelectedColor(this.ColorCode);
}
},
error: function(Text) {
this.TextField.style.border = "1px solid red";
this.TextField.focus();
},
open: function() {
if (this.IsOpen == true) {
this.closeWindow();
return;
}
this.IsOpen = true;
var rect = this.Content.getBoundingClientRect();
this.Background.style.left = 0 - rect.left + "px";
this.Background.style.top = 0 - rect.top + "px";
this.Background.style.height = this.getDocHeight() + (rect.top/2) + "px";
this.Background.style.width = this.getDocWidth() + (rect.left/2) + "px";
this.Background.style.display = "block";
this.Background.style.visibility = "visible";
this.Window.style.zIndex = "2";
this.Window.style.left = rect.Left + "px";
this.Window.style.top = rect.Top + 22 + "px";
this.Window.style.border = "1px solid black";
this.Window.style.height = "144px";
this.Window.style.width = rect.right - rect.left + "px";
this.Window.style.display = "block";
this.Window.style.visibility = "visible";
this.Window.scrollTop = 0;
},
closeWindow: function() {
this.Background.style.display = "none";
this.Background.style.visibility = "hidden";
this.Window.style.display = "none";
this.Window.style.visibility = "hidden";
this.IsOpen = false;
},
getSelectedColor: function() {
return this.TextField.value;
},
setSelectedColor: function(Color) {
this.TextField.style.backgroundColor = Color;
this.TextField.value = Color;
if (this.IsOpen == true) {
this.closeWindow();
}
},
parseXML: function(XMLNode) {
}
});
var WxIFrame = WxClass(WxPanel, {
IFrame: null,
initialize: function() {
this.$super();
this.IFrame = document.createElement("iframe");
this.IFrame.style.height="100%";
this.IFrame.style.width="100%";
this.Content.appendChild(this.IFrame);
},
setSource: function(Source) {
this.IFrame.src = Source;
},
parseXML: function(XMLNode) {
}
});
var WxProgressBar = WxClass(WxPanel, {
Table: null,
InactiveColor: "white",
ActiveColor: "green",
initialize: function(Text) {
this.$super();
this.Table = document.createElement("table");
this.Table.cellPadding = "0";
this.Table.cellSpacing = "0";
this.Table.style.width = "100px";
this.Table.style.height = "9px";
this.Table.style.fontSize = "6px";
this.Table.style.border = "1px solid black";
this.Table.style.marginTop = "3px";
this.Content.appendChild(this.Table);
//this.Content.style.marginTop = "3px";
//this.Content.style.marginBottom = "3px";
},
setInactiveColor: function(Color) {
this.InactiveColor = Color;
},
setActiveColor: function(Color) {
this.ActiveColor = Color;
},
setPercent: function(Percent) {
wx.removeAllElementChildren(this.Table);
var TablePRow = this.Table.insertRow(-1);
if (Percent > 0) {
var Process1Cell = TablePRow.insertCell(-1);
Process1Cell.style.width = Percent + "px";
Process1Cell.style.backgroundColor = this.ActiveColor;
Process1Cell.innerHTML = " ";
}
if (Percent < 100) {
var Process2Cell = TablePRow.insertCell(-1);
Process2Cell.style.backgroundColor = this.InactiveColor;
Process2Cell.innerHTML = " ";
}
},
parseXML: function(XMLNode) {
}
});
var WxWindow = WxClass({
Parent: null,
Name: null,
Content : null,
Header : null,
IconImage: null,
WindowContent : null,
Appl: null,
Width: 0,
Height: 0,
ContentXML: null,
Args: null,
initialize : function(Name, Title) {
this.Name = Name;
this.Content = document.createElement("div");
this.Content.style.position = "absolute";
this.Content.style.left = "10px";
this.Content.style.top = "10px";
this.Content.style.width = "100px";
this.Content.style.height = "100px";
// this.Content.style.visibility = "hidden";
this.Content.style.zIndex = "0";
this.Content.style.border = system.getStyle("Window", "Border");
this.Content.style.backgroundColor = system.getStyle("Window", "ContentBackground");
this.Content.style.visibility = "hidden";
this.Header = document.createElement("div");
this.Header.style.backgroundColor = system.getStyle("Window", "TitleBackground");
this.Header.style.height = "30px";
this.WindowContent = document.createElement("div");
this.WindowContent.style.border = "5px solid " + system.getStyle("Window", "ContentBackground");
var Table = document.createElement("table");
var TableRow = document.createElement("tr");
Table.cellPadding = "0";
Table.cellSpacing = "0";
Table.style.width = "100%";
Table.style.height = "100%";
var Cell1 = TableRow.insertCell();
Cell1.style.width = "5px";
this.Icon = TableRow.insertCell();
this.Icon.style.width = "25px"
this.IconImage = document.createElement("img");
this.IconImage.src = "gui/icons/job32.png";
this.IconImage.style.width = "22px";
this.Icon.appendChild(this.IconImage);
this.Title = TableRow.insertCell();
this.Title.innerHTML = Title;
this.Title.style.color = system.getStyle("Window", "TitleForeground");
this.Title.onmousedown = this.startWindowMove;
this.Title.onmouseup = this.stopWindowMove;
this.Title.onmouseout = this.stopWindowMove;
this.Title.Object = this;
var TableColumnClose = TableRow.insertCell();
TableColumnClose.innerHTML = "X";
TableColumnClose.Object = this;
TableColumnClose.style.width = "20px";
TableColumnClose.style.cursor = "pointer";
TableColumnClose.style.color = system.getStyle("Window", "TitleForeground");
TableColumnClose.onclick = this.onCloseClick;
TableRow.appendChild(this.Icon);
TableRow.appendChild(this.Title);
TableRow.appendChild(TableColumnClose);
Table.appendChild(TableRow);
this.Header.appendChild(Table);
this.Content.appendChild(this.Header);
this.Content.appendChild(this.WindowContent);
// wx.Body.appendChild(this.Element);
document.getElementsByTagName("body")[0].appendChild(this.Content);
},
load: function(ContentXML, Args) {
this.ContentXML = ContentXML;
this.Args = Args;
var Request = new WxRequest();
this.Appl = Request.getXML(ContentXML, this.Args);
if (this.Appl != null) {
this.Appl.Parent = this.Parent;
this.Appl.Window = this;
this.WindowContent.appendChild(this.Appl.getContent().Content);
if (this.Appl.afterLoad != null) {
this.Appl.afterLoad();
}
}
},
centerOnScreen: function() {
if (this.Width > 0 && this.Height > 0) {
Left = (this.getDocWidth()-this.Width)/2;
Top = (this.getDocHeight()-this.Height)/2;
Top = Top-20;
this.Content.style.left = Left + "px";
this.Content.style.top = Top + "px";
}
},
moveFromCenter: function(plusX,plusY) {
if (this.Width > 0 && this.Height > 0) {
Left = (this.getDocWidth()-this.Width)/2;
Top = (this.getDocHeight()-this.Height)/2;
Top = Top-20;
Left = Left +plusX;
Top = Top+plusY;
this.Content.style.left = Left + "px";
this.Content.style.top = Top + "px";
}
},
moveToXY: function(X,Y) {
if (this.Width > 0 && this.Height > 0) {
this.Content.style.left = X + "px";
this.Content.style.top = Y + "px";
}
},
close : function() {
this.Content.style.visibility = "hidden";
var last;
while (last = this.Content.lastChild) this.Content.removeChild(last);
this.Content.parentNode.removeChild(this.Content);
this.Parent.removeWindow(this.Name);
},
getPosition: function() {
var el = this.Content;
var _x = 0;
var _y = 0;
while( el && !isNaN( el.offsetLeft ) && !isNaN( el.offsetTop ) ) {
_x += el.offsetLeft - el.scrollLeft;
_y += el.offsetTop - el.scrollTop;
el = el.offsetParent;
}
return { top: _y, left: _x };
},
getDocHeight: function() {
var D = document;
return Math.max(
D.body.scrollHeight, D.documentElement.scrollHeight,
D.body.offsetHeight, D.documentElement.offsetHeight,
D.body.clientHeight, D.documentElement.clientHeight
);
},
getDocWidth: function() {
var D = document;
return Math.max(
D.body.scrollWidth, D.documentElement.scrollWidth,
D.body.offsetWidth, D.documentElement.offsetWidth,
D.body.clientWidth, D.documentElement.clientWidth
);
},
show : function(top, left) {
if (this.Appl.beforeShow != null) {
this.Appl.beforeShow();
}
if (top != null && left != null) {
this.Content.style.left = left + "px";
this.Content.style.top = top + "px";
}
if (this.Appl != null) {
this.Appl.getContent().resize();
}
this.Content.style.visibility = "visible";
if (this.Appl.afterShow != null) {
this.Appl.afterShow();
}
},
setIcon: function(IconName) {
this.IconImage.src = IconName;
},
setDimension: function(width, height) {
this.Width = width;
this.Height = height;
this.Content.style.width = width + "px";
this.Content.style.height = height + "px";
this.WindowContent.style.height = (height - parseInt(this.Header.style.height)) - 10 + "px";
},
startWindowMove : function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target != null) {
Target.Object.offsetx = Event.clientX;
Target.Object.offsety = Event.clientY;
Target.Object.tempx = parseInt(Target.Object.Content.style.left);
Target.Object.tempy = parseInt(Target.Object.Content.style.top);
Target.Object.windowmoving = true;
Target.Object.Header.onmousemove = Target.Object.doWindowMove;
}
},
doWindowMove : function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
if (Target.Object.windowmoving) {
Target.Object.Content.style.left = Target.Object.tempx
+ Event.clientX - Target.Object.offsetx + "px";
Target.Object.Content.style.top = Target.Object.tempy
+ Event.clientY - Target.Object.offsety + "px";
}
}
},
stopWindowMove : function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.windowmoving = false;
Target.Object.Content.onmousemove = null;
}
},
onCloseClick : function(Event) {
Event = Event || window.event;
Target = Event.target || Event.srcElement;
if (Target.Object != null) {
Target.Object.close();
}
},
reload : function() {
},
parseXML : function(XMLNode) {
}
});
var wx = function (a, b) {
return wx.dispatch(a, b);
};
wx.removeAllChildren = function(ElementName) {
Element = document.getElementById(ElementName);
wx.removeAllElementChildren(Element);
};
wx.removeAllElementChildren = function(Element) {
if (Element != null) {
if (Element.hasChildNodes()) {
while (Element.childNodes.length >= 1) {
Element.removeChild(Element.firstChild);
}
}
}
};
String.prototype.startsWith = function(str) {
return (this.match("^" + str) == str);
};
String.prototype.endsWith = function(str) {
return (this.match(str + "$") == str);
};
Number.prototype.formatCurrency = function() {
var s = ".";
var c = ","
var n = 2;
var x = 3;
var re = '\\d(?=(\\d{' + (x || 3) + '})+' + (n > 0 ? '\\D' : '$') + ')',
num = this.toFixed(Math.max(0, ~~n));
return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ','));
};
wx.trim = function(str, chars) {
return wx.ltrim(wx.rtrim(str, chars), chars);
};
wx.ltrim = function(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
};
wx.rtrim = function(str, chars) {
chars = chars || "\\s";
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
};
wx.encode_utf8 = function(s) {
alert(s);
return encodeURIComponent( s );
};
Date.prototype.getWeek = function() {
var d = new Date(Date.UTC(this.getFullYear(), this.getMonth(), this.getDate()));
var dayNum = d.getUTCDay() || 7;
d.setUTCDate(d.getUTCDate() + 4 - dayNum);
var yearStart = new Date(Date.UTC(d.getUTCFullYear(),0,1));
return Math.ceil((((d - yearStart) / 86400000) + 1)/7)
};
wx.inArray = function(a, obj) {
var i = a.length;
while (i--) {
if (a[i] === obj) {
return true;
}
}
return false;
};