iKnowBase={Version:"@app.version@",locations:{ikbViewer:"/ikbViewer",resource:"/ressurs"},ensures:{facebox:{js:"/ressurs/iknowbase/libs/jquery-plugins/facebox/facebox.js",css:"/ressurs/iknowbase/libs/jquery-plugins/facebox/facebox.css"},ikbPopup:{js:"/ressurs/iknowbase/libs/jquery-plugins/ikbPopup/ikbPopup.js",css:"/ressurs/iknowbase/libs/jquery-plugins/ikbPopup/ikbPopup.css"},form:{js:"/ressurs/iknowbase/libs/jquery-plugins/jquery.form.js"}}};iKnowBase.errorPopup=function(A){jQuery("<div class='ikbErrorPopup' onclick='jQuery(this).slideUp();' />").hide().append(A).prependTo("body").slideDown();iKnowBase.log(A)};iKnowBase.log=function(A){if(window.console&&console.log){console.log(A)}else{if(window.opera&&opera.postError){opera.postError(A)}}};iKnowBase.nvl=function(A,B){if(A!=null){return A}else{return B}};iKnowBase.assert=function(A,B){if(!A){alert("iKnowBase.assert",B)}};iKnowBase.setCookie=function(B,D,A,F,C,E){document.cookie=B+"="+escape(D)+((A)?"; expires="+A.toGMTString():"")+((F)?"; path="+F:"")+((C)?"; domain="+C:"")+((E)?"; secure":"")};iKnowBase.getCookie=function(C){var B=document.cookie;var E=C+"=";var D=B.indexOf("; "+E);if(D==-1){D=B.indexOf(E);if(D!=0){return null}}else{D+=2}var A=document.cookie.indexOf(";",D);if(A==-1){A=B.length}return unescape(B.substring(D+E.length,A))};iKnowBase.deleteCookie=function(A,C,B){if(getCookie(A)){document.cookie=A+"="+((C)?"; path="+C:"")+((B)?"; domain="+B:"")+"; expires=Thu, 01-Jan-70 00:00:01 GMT"}};iKnowBase.toggleClassForClass=function(A,B){var C=document.getElementsByClassName(A);for(i=0;i<C.length;i++){this.toggleClassForElement("toggle",C[i],B)}};iKnowBase.toggleClassForElement=function(D,E,B,A){switch(D){case"toggle":return this.toggleClassForElement("check",E,B)?this.toggleClassForElement("remove",E,B):this.toggleClassForElement("add",E,B);case"swap":E.className=!this.toggleClassForElement("check",E,B)?E.className.replace(A,B):E.className.replace(B,A);break;case"add":if(!this.toggleClassForElement("check",E,B)){E.className+=E.className?" "+B:B}break;case"remove":var C=E.className.match(" "+B)?" "+B:B;E.className=E.className.replace(C,"");break;case"check":return new RegExp("\\b"+B+"\\b").test(E.className)}return E.className!=null?E.className:""};iKnowBase.ensure=function(A,B){jQuery.ensure(A,B)};iKnowBase.withFacebox=function(A){iKnowBase.ensure(iKnowBase.ensures.facebox,A)};iKnowBase.withIkbPopup=function(A){iKnowBase.ensure(iKnowBase.ensures.ikbPopup,A)};iKnowBase.withForm=function(A){iKnowBase.ensure(iKnowBase.ensures.form,A)};iKnowBaseDevelopment={Version:"@app.version@"};iKnowBaseDevelopment.showPortletCacheStatus=function(A,C){var D="ikb.showPortletCacheStatus."+A;var B=iKnowBase.getCookie(D);if(B==null){style="ikbPortletCacheUnknown";status="unknown status"}else{if(B==C){style="ikbPortletCacheCached";status="from cache"}else{style="ikbPortletCacheNotCached";status="not from cache"}}document.write("<div class='"+style+"'>");document.write("<!-- ");document.write("name="+D);document.write("; renderTime="+C);document.write("; cookieTime="+B);document.write(" -->");document.write("Cache");document.write(": delta="+(C-B));document.write("; "+status);document.writeln("</div>");iKnowBase.setCookie(D,C)};jQuery(function(){jQuery(".ikbComponentInformation .ikbHeader").bind("click",function(){jQuery(this).next().toggle()})});(function(){iKnowBase.ContentViewer={};function B(F,C,E){if(F){E=jQuery.extend({_rtarget:F,_ikbController:C,portlet:F},E||{})}var D=(F?location.href.match(/[^\?]*/)[0]:iKnowBase.locations.ikbViewer+C);if(E!=null&&E!="undefined"){D=D+"?"+jQuery.param(E)}return D}function A(F,C,E){F=null;var D=B(F,C,E);iKnowBase.log("Request: "+D);iKnowBase.withIkbPopup(function(){jQuery.ikbPopup({post:D})});return false}jQuery.extend(iKnowBase.ContentViewer,{getUrl:B,deleteDocument:function(D,C,E){return A(E,"/private/document/delete/request",{docid:D,version:(C||0)})},deleteDocumentConfirm:function(D,C,F,E){return A(E,"/private/document/delete/confirm",{docid:D,version:(C||0),mode:F})},changeDocumentType:function(C,D,E){return A(E,"/private/document/changeDocumentType/request",{docid:C,quickLinkGuid:D})},changeDocumentTypeConfirm:function(C,D){return A(portlet,"/private/document/changeDocumentType/confirm",{docid:C,formGuid:D})},copyDocument:function(C,D){return A(portlet,"/private/document/copy/request",{docid:C,quickLinkGuid:D})},copyDocumentConfirm:function(C,D){return A(portlet,"/private/document/copy/confirm",{docid:C,formGuid:D})},selectPersonalAcl:function(E,D,C){return A(E,"/private/personalAcl/popup",{cbFunction:D,cbClosure:C})}})})();iKnowBase.ContentViewer.EditOpenOfficeDocument=function(M,L,C,E,F){if(C==null){C=""}try{var B="";if(M=="INDIRECT"){var D=jQuery.ajax({type:"GET",async:false,url:encodeURI(L),beforeSend:function(N){N.setRequestHeader("x-iknowbase-getcontent-url",L)}});if(D.status!=200){alert("XMLHTTPError: "+D.status+"="+D.statusText+" (url="+L+")");return }L=D.getResponseHeader("x-iknowbase-content-url");B=D.getResponseHeader("x-iknowbase-content-filename")}var G=new ActiveXObject("com.sun.star.ServiceManager");var A=G.createInstance("com.sun.star.reflection.CoreReflection");var I=G.createInstance("com.sun.star.frame.Desktop");var K=new Array();var H=I.loadComponentFromURL(L,"_blank",0,K)}catch(J){alert("Error opening document. Error= "+J.name+"; description="+J.message)}};iKnowBase.ContentViewer.EditMSOfficeDocument=function(J,I,B,E,F){if(!window.ActiveXObject){alert("This function requires support for ActiveXObject (typically Microsoft Internet Explorer)");return }if(B==null){B=""}try{var A="";if(J=="INDIRECT"){var C=jQuery.ajax({type:"GET",async:false,url:encodeURI(I),beforeSend:function(L){L.setRequestHeader("x-iknowbase-getcontent-url",I)}});if(C.status!=200){alert("XMLHTTPError: "+C.status+"="+C.statusText+" (url="+I+")");return }I=C.getResponseHeader("x-iknowbase-content-url");A=C.getResponseHeader("x-iknowbase-content-filename")}if(this.ikbCustomEditWindowsDocument){var G=ikbCustomEditWindowsDocument("PREOPEN",null,I,B,A,F);if(!G){return }}var D=new ActiveXObject("iKnowBase.RemoteDocument");var K=D.OpenDocument("",I,B,E,A);if(K){if(this.ikbCustomEditWindowsDocument){var G=ikbCustomEditWindowsDocument("POSTOPEN-SUCCESS",K,I,B,A,F);if(!G){return }}}else{if(this.ikbCustomEditWindowsDocument){var G=ikbCustomEditWindowsDocument("POSTOPEN-FAILURE",K,I,B,A,F);if(!G){return }}window.open(I,"_blank")}D=null;K=null}catch(H){alert("Error opening document. Error= "+H.name+"; description="+H.message)}};function openOODoc(D,B,E,A,C){iKnowBase.ContentViewer.EditOpenOfficeDocument(D,B,E,A,C)}function ikbEditWindowsDocument(D,B,E,A,C){iKnowBase.ContentViewer.EditMSOfficeDocument(D,B,E,A,C)}function ikbOfficeSetProperty(D,A,B){try{D.CustomDocumentProperties(A).Value=B}catch(C){D.CustomDocumentProperties.Add(A,false,4,B)}}
