var Lina=new function(){
return {initRequire:["common/lina/utils.js","common/lina/ajax.js","common/lina/base.js"],version:"0.0.1",_rootDir:"",_httpRoot:"",zIndexMax:40000,_resourceLoading:{},_uniqId:1,_resourcesLoaded:{},_exceptionHandlers:[],config:{i18n:{lang:"de",fallbackLanguage:"de",bundle:"lina",fallbackBundle:"common",serverActionPath:"serverSideEmulator/getTranslation.php"},logging:{defaultLogLevel:"debug",debug:null},stage:"dev",systemColors:{ActiveBorder:"ActiveBorder",ActiveCaption:"ActiveCaption",AppWorkspace:"AppWorkspace",Background:"Background",ButtonFace:"ButtonFace",ButtonHighlight:"ButtonHighlight",ButtonShadow:"ButtonShadow",ButtonText:"ButtonText",CaptionText:"CaptionText",GrayText:"GrayText",Highlight:"Highlight",HighlightText:"HighlightText",InactiveBorder:"InactiveBorder",InactiveCaption:"InactiveCaption",InactiveCaptionText:"InactiveCaptionText",InfoBackground:"InfoBackground",InfoText:"InfoText",Menu:"Menu",MenuText:"MenuText",Scrollbar:"Scrollbar",ThreeDDarkShadow:"ThreeDDarkShadow",ThreeDFace:"ThreeDFace",ThreeDHighlight:"ThreeDHighlight",ThreeDLightShadow:"ThreeDLightShadow",ThreeDShadow:"ThreeDShadow",Window:"Window",WindowFrame:"WindowFrame",WindowText:"WindowText",TableHeadBackground:"#BADCEC",TableHeadText:"black",TableRowBackground:"#FFFFFF",TableRowText:"black",TableSelectedRowBackground:"#C63736",TableSelectedRowText:"#FFFFFF",TableRowMouseoverBackground:"#EAF4F9",TableRowMouseoverText:"black",TableSelectedRowMouseoverBackground:"#B13130",TableSelectedRowMouseoverText:"#FFFFFF"},delay:750,window:{delay:750},coreStyleId:"linaCoreStyle",lrm:{}},_globalSubstitutionMapping:null,_load:function(){
Lina._setRootDir();
for(var i=0;i<this.initRequire.length;i++){
var fn=this._makeAbsolute(this.initRequire[i]);
switch(this.pathInfo(fn)["extension"]){
case "js":
Lina.loadJsFileAsScriptTag(fn);
break;
case "css":
Lina.loadCssFileAsLinkTag(fn);
break;
default:
Lina.log("by loading Lina only js oder css can be loaded");
break;
}
this._resourceLoaded(fn);
}
if(document.location.href.indexOf("debug")>0){
if(document.location.href.match(/debug=($|false|null|0)/i)){
Lina.config.logging.debug=false;
}else{
Lina.config.logging.debug=true;
}
}
},setConfig:function(_3){
this.config=Lina.Utils.Object.merge(this.config,_3);
},_fillGSM:function(){
var _4=this.getConfig("systemColors");
this._globalSubstitutionMapping={};
for(var _5 in _4){
this._globalSubstitutionMapping["LinaColor_"+_5]=_4[_5];
}
},_setRootDir:function(){
var _6=document.getElementsByTagName("script");
for(var i=0;i<_6.length;i++){
if(_6[i].src&&_6[i].src.match(/Lina\.js(\?.*)?$/)){
var _8=this.pathInfo(_6[i].src);
_8["dirs"].pop();
if(_6[i].src.indexOf("http")==0){
this._httpRoot=_8["dirs"][0]+"//"+_8["dirs"][2];
this._rootDir=_8["dirs"].join("/")+"/";
}else{
var _9=this.pathInfo(document.location.href);
this._httpRoot=_9["dirs"][0]+"//"+_9["dirs"][2];
if(_6[i].src.indexOf("/")==0){
this._rootDir=this._httpRoot+_8["dirs"].join("/")+"/";
}else{
var _a=_9["dirname"]+_8["dirname"];
_a=_a.replace(/\/[^\/]+\/\.\.\//,"/");
var _b=this.pathInfo(_a);
_b["dirs"].pop();
this._rootDir=_b["dirs"].join("/")+"/";
}
}
break;
}
}
},pathInfo:function(_c){
var _d={};
var _e=_c.split("/");
_d["basename"]=_e.pop();
_d["dirname"]=_e.join("/")+"/";
_d["dirs"]=_e;
_d["extension"]="";
var _f=_d["basename"].split(".");
if(_f.length>1){
_d["extension"]=_f.pop();
}
return _d;
},loadJsFileAsScriptTag:function(_10){
document.write("<script type=\"text/javascript\" src=\""+_10+"\"></script>");
},loadCssFileAsLinkTag:function(_11){
document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\""+_11+"\">");
},_isResourceLoaded:function(_12){
return (typeof this._resourcesLoaded[_12]!="undefined");
},_loadResource:function(_13,_14){
if(this._resourceLoading[_13]){
return;
}
this._resourceLoading[_13]=true;
var pi=this.pathInfo(_13);
var _16=pi["extension"];
if(!this._globalSubstitutionMapping){
this._fillGSM();
}
var _17={};
var _18=_13.split("/");
_18.pop();
_17["__DIR__"]=pi["dirname"];
Lina.Utils.Object.extend(_17,this._globalSubstitutionMapping);
Lina.Utils.Object.extend(_17,_14||{});
switch(_16){
case "css":
var req=new Lina.Ajax.Request(_13,{asynchronous:false,onSuccess:Lina.Utils.Function.bind(Lina._addCSS,this,_17)});
break;
case "js":
new Lina.Ajax.Request(_13,{asynchronous:false});
break;
default:
Lina.log(new Lina.Exception.Fatal(t("Unbekannte type '{0}' bei resource downloading",[_16],"lina")));
break;
}
delete this._resourceLoading[_13];
this._resourceLoaded(_13);
},_addCSS:function(_1a,foo,_1c){
var _1d=_1a.responseText;
var _1e=new Lina.Utils.Template(_1d);
_1d=_1e.evaluate(_1c);
var sId=this.getUniqId();
var _20=Lina.get(sId);
if(_20!=null){
return false;
}
_20=document.createElement("style");
_20.id=sId;
_20.type="text/css";
if(_20.styleSheet){
_20.styleSheet.cssText=_1d;
}else{
var _21=document.createTextNode(_1d);
_20.appendChild(_21);
}
Lina._getHead().appendChild(_20);
if(this.isInDebug()){
return;
}
this._makeSureThatCoreStyleSheetExists();
var _22=this._getStyleSheetsFromIds([this.getConfig("coreStyleId"),sId]);
var _23=_22[this.getConfig("coreStyleId")];
var _24=_22[sId];
try{
var _25=_23.cssRules?_23.cssRules:_23.rules;
var _26=_24.cssRules?_24.cssRules:_24.rules;
for(var i=0;i<_26.length;i++){
if(_23.insertRule){
_23.insertRule(_26[i].cssText,_25.length);
}else{
if(_23.addRule){
if(_26[i].style.cssText!=null&&_26[i].style.cssText!=""){
_23.addRule(_26[i].selectorText,_26[i].style.cssText);
}
if(Lina.Utils.Browser.isIE6&&_26[i].style.filter!=null&&_26[i].style.filter!=""){
Lina.log(t("filter unsupported: {0}",[_26[i].style.filter],"lina"),"fatal");
}
}
}
}
}
catch(e){
throw (e);
}
finally{
Lina._getHead().removeChild(_20);
}
},_makeSureThatCoreStyleSheetExists:function(){
if(!Lina.get(this.getConfig("coreStyleId"))){
var _28=document.createElement("style");
_28.id=this.getConfig("coreStyleId");
_28.type="text/css";
Lina._getHead().appendChild(_28);
}
},_getHead:function(){
return document.getElementsByTagName("head")[0];
},_getCoreStyleSheet:function(){
if(!this._coreStylesheet){
this._makeSureThatCoreStyleSheetExists();
this._coreStylesheet=this._getStyleSheetsFromIds(this.getConfig("coreStyleId"));
}
return this._coreStylesheet;
},_getStyleSheetsFromIds:function(ids){
if(typeof ids=="string"){
ids=[ids];
}
var ret={};
var _2b=0;
for(var i=0;i<document.styleSheets.length;i++){
var _2d="";
if(document.styleSheets[i].ownerNode){
_2d=document.styleSheets[i].ownerNode.id;
}else{
_2d=document.styleSheets[i].id;
}
if(Lina.Utils.Array.in_array(ids,_2d)>-1){
ret[_2d]=document.styleSheets[i];
_2b++;
if(ids.length==_2b){
break;
}
}
}
if(ids.length!=_2b){
Lina.log(new Lina.Exception.Fatal("Nicht alle stylesheets wurden gefunden. Arguments: '"+ids.join(",")+"'"));
}
if(ids.length==1){
for(var id in ret){
return ret[id];
}
}
return ret;
},_makeAbsolute:function(_2f){
var ret="";
if(_2f.indexOf("http")==0){
ret=_2f;
}else{
if(_2f.indexOf("/")==0){
ret=this._httpRoot+_2f;
}else{
ret=this._rootDir+_2f;
}
}
return ret;
},requireOnce:function(_31,_32){
_31=this._makeAbsolute(_31);
if(!this._isResourceLoaded(_31)){
this._loadResource(_31,_32);
var _33=false;
for(key in Lina.config.lrm){
if(Lina.Utils.String.endsWith(_31,key)){
_33=key;
Lina.requireOnce(Lina.config.lrm[key],_32);
}
}
if(_33){
delete Lina.config.lrm[_33];
}
}
},require:function(_34,_35){
_34=this._makeAbsolute(_34);
this._loadResource(_34,_35);
},getMaxZIndex:function(){
return this.zIndexMax++;
},_resourceLoaded:function(fn){
this._resourcesLoaded[fn]=true;
},getUniqId:function(_37){
_37=_37||"id";
return _37+""+this._uniqId++;
},get:function(id){
return document.getElementById(id);
},getConfig:function(_39){
var _3a=_39.split(".");
var _3b="";
var _3c=this.config;
var _3d="";
while(_3a.length>0){
_3d=_3a.shift();
_3b=_3b+_3d;
if(typeof (_3c[_3d])=="undefined"){
this.log(t("Configuration '{0}' does not exist",[_3b]),"fatal");
return null;
}
_3c=_3c[_3d];
}
return _3c;
},translate:function(_3e,_3f,_40,_41,_42){
if(this.getConfig("i18n")&&!_42){
_3e=Lina.I18n.getTranslation(_3e,_41,_40);
}
if(_3f){
var mes=new Lina.Message(_3e,_3f);
_3e=mes.getEvaluated();
}
return _3e;
},extend:function(_44,_45,_46){
var F=function(){
};
F.prototype=_45.prototype;
_44.prototype=new F();
_44.prototype.constructor=_44;
_44.superclass=_45.prototype;
if(_45.prototype.constructor==Object.prototype.constructor){
_45.prototype.constructor=_45;
}
if(_46){
for(var i in _46){
_44.prototype[i]=_46[i];
}
}
},log:function(_49,_4a){
_4a=_4a||this.getConfig("logging.defaultLogLevel");
this.requireOnce("common/lina/exception.js");
if(((typeof Error!="undefined")&&_49 instanceof Error)||((typeof SyntaxError!="undefined")&&_49 instanceof SyntaxError)||((typeof EvalError!="undefined")&&_49 instanceof EvalError)||((typeof TypeError!="undefined")&&_49 instanceof TypeError)||((typeof RangeError!="undefined")&&_49 instanceof RangeError)||((typeof URIError!="undefined")&&_49 instanceof URIError)||((typeof ReferenceError!="undefined")&&_49 instanceof ReferenceError)){
var str=_49.message;
if(typeof _49.fileName!="undefined"){
str+="\n"+"FILE: "+_49.fileName;
}
if(typeof _49.lineNumber!="undefined"){
str+="\n"+"LINE: "+_49.lineNumber;
}
_49=new Lina.Exception.Fatal(str);
}
if(!(_49 instanceof Lina.Exception.Abstract)){
_49=new Lina.Exception[Lina.Utils.String.firstCharToUpperCase(_4a)](_49);
}
if(0==this._exceptionHandlers.length){
this._exceptionHandlers[0]=new Lina.Exception.Handler();
}
for(var i=0;i<this._exceptionHandlers.length;i++){
this._exceptionHandlers[i].log(_49);
}
},isInDebug:function(){
var deb=Lina.getConfig("logging.debug");
if(deb===null){
deb=(Lina.config.stage==="dev");
}
return deb;
}};
};
Lina._load();

