if(!Array.prototype.indexOf){Array.prototype.indexOf=function(C,A){A||(A=0);var B=this.length;if(A<0){A=B+A;}for(;A<B;A++){if(this[A]===C){return A;}}return -1;};}if(!Array.prototype.indexOfMatch){Array.prototype.indexOfMatch=function(C,A){A||(A=0);var B=this.length;if(A<0){A=B+A;}for(;A<B;A++){if(new RegExp(this[A]).test(C)){return A;}}return -1;};}if(!Array.prototype.unique){Array.prototype.unique=function(){var B=[];var A=this.length;for(var D=0;D<A;D++){for(var C=D+1;C<A;C++){if(this[D]===this[C]){C=++D;}}B.push(this[D]);}return B;};}if(!String.prototype.startsWith){String.prototype.startsWith=function(A){return this.indexOf(A)===0;};}if(!String.prototype.endsWith){String.prototype.endsWith=function(A){var B=this.length-A.length;return B>=0&&this.lastIndexOf(A)===B;};}if(!String.prototype.trim){String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"");};}if(!String.prototype.removeLastCharacter){String.prototype.removeLastCharacter=function(A){if(this.endsWith(A)){return this.substring(0,this.length-1);}else{return this;}};}function boldDomain(C,B){if(!C){return B;}var A=B.substring(0,B.indexOf(C));A+="<b>";A+=C;A+="</b>";A+=B.substring(B.indexOf(C)+C.length);return A;}function imgErrorDisplayNone(A){log.warn(A.src+"needs to be hidden because broken");A.onerror="";A.style.display="none";return true;}function imgError(A,C){var B=A.src;A.src="images/icons/brokenPicture.png";A.onerror="";A.title="url ["+B+"] for this picture is broken";if(C){A.width=C;}log.warn("img src changed because original url ["+B+"] was broken");return true;}function imgLoad(C,H,G,B){log.info("imgLoad: Element type ["+C+"] imgLoad "+H+"  "+G+"   "+B);var F=parseInt(C.height,10);var E=parseInt(C.width,10);var D=jQuery(C).data("oryginalHeight");var A=jQuery(C).data("oryginalWidth");if(!D||!A){jQuery(C).data("oryginalHeight",F);jQuery(C).data("oryginalWidth",E);D=F;ow=E;}if(!H){H="width";}if(!G){G=600;}if(H==="width"&&(E>G||B)){C.width=G;C.height=Math.floor(F*G/E);log.warn("Change img width. Saved oryginal values using jQuery data");}else{if(H==="height"&&(F>G||B)){C.height=G;C.width=Math.floor(E*G/F);log.warn("Change img height. Save oryginal values using jQuery data");}else{if(H==="oryginal"){if(D&&A){C.height=D;C.width=A;}else{C.src=C.src+"?rand="+randomString();}log.warn("Restore img dim to oryginal "+A+"x"+D);}}}return true;}function randomString(E){var D="ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz";if(!E){var E=16;}var C="";for(var B=E-1;B>=0;B--){var A=Math.floor(Math.random()*D.length);C+=D.charAt(A);}return C;}function getCurrentTime(){return new Date().getTime();}function getURLParams(D){var A=[];var B=window.location.href.indexOf("?");if(B===-1){return null;}var F=window.location.href.substr(B+1);if(F.indexOf("#")>-1){F=F.substr(0,F.indexOf("#"));}var H=F.split("&");for(var C=0;C<H.length;C++){var G=H[C];var B=G.indexOf("=");if(B===-1||D!=G.substr(0,B)){continue;}var E=H[C].substr(B+1);A.push(decodeURIComponent(E.replace(/\+/g," ")));}return A;}function getURLParam(A){var B=getURLParams(A);if(B!=null&&B.length!=0){return B[0];}return null;}function getUTF8Length(B){var A=0;for(var D=0;D<B.length;D++){var C=B.charCodeAt(D);if(C<128){A++;}else{if((C>127)&&(C<2048)){A=A+2;}else{A=A+3;}}}return A;}function lengthInUtf8Bytes(B){var A=encodeURIComponent(B).match(/%[89ABab]/g);return B.length+(A?A.length:0);}function countBytes(C){var A=encodeURI(C);if(A.indexOf("%")!==-1){var D=A.split("%").length-1;if(D==0){D++;}var B=A.length-(D*3);return D+B;}return A.length;}function splitStringForCookies(J,F){var B=J.length;var G=0;if(B>F){var G=Math.floor(F/2);}var I=0;var H=[];for(var D=G;D<=B;D++){var A=J.substring(I,D);var E=encodeURIComponent(A);E=E.replace(/~/g,"%7E").replace(/\!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29");var C=getUTF8Length(E);if(C>=F||D===B){H.push(E);I=D;}}return H;}function createCookie(C,E,G,F){console.log("Creates cookie with path="+F);var A="";var D="/";if(F){D=F;}if(G){var B=new Date();B.setTime(B.getTime()+(G*24*60*60*1000));A="; expires="+B.toGMTString();}document.cookie=C+"="+E+A+"; path="+D;}function readCookie(B){var D=B+"=";var A=document.cookie.split(";");for(var C=0;C<A.length;C++){var E=A[C];while(E.charAt(0)==" "){E=E.substring(1,E.length);}if(E.indexOf(D)==0){return E.substring(D.length,E.length);}}return null;}function getEECookiesPath(){if(location.pathname.indexOf("/search")!=-1){return location.pathname.replace(/search.*/,"eeservlets/");}else{if(location.pathname.startsWith("/sigmaee")){return"/sigmaee/eeservlets/";}}return"/";}function eraseCookie(A,B){createCookie(A,"",-1,B);}function SigmaUtilities(){this.cache={};this.expando="SigmaUtilities"+this.now();this.uuid=0;this.windowData={};var A=this;this.queueForSlowBrowser={_timer:null,_queue:[],add:function(E,C,F){var B=function(G){A.queueForSlowBrowser._timer=setTimeout(function(){G=A.queueForSlowBrowser.add();if(A.queueForSlowBrowser._queue.length){B(G);}},G||10);};if(E){A.queueForSlowBrowser._queue.push([E,C,F]);if(A.queueForSlowBrowser._queue.length==1){B(F);}return ;}var D=A.queueForSlowBrowser._queue.shift();if(!D){return 0;}D[0].call(D[1]||window);return D[2];},clear:function(){clearTimeout(A.queueForSlowBrowser._timer);A.queueForSlowBrowser._queue=[];}};}SigmaUtilities.prototype.now=function(){return +new Date();};SigmaUtilities.prototype.each=function(C,G,B){var A,D=0,E=C.length;if(B){if(E===undefined){for(A in C){if(G.apply(C[A],B)===false){break;}}}else{for(;D<E;){if(G.apply(C[D++],B)===false){break;}}}}else{if(E===undefined){for(A in C){if(G.call(C[A],A,C[A])===false){break;}}}else{for(var F=C[0];D<E&&G.call(F,D,F)!==false;F=C[++D]){}}}return C;};SigmaUtilities.prototype.isFunction=function(A){return Object.prototype.toString.call(A)==="[object Function]";};SigmaUtilities.prototype.makeArray=function(C){var A=[];if(C!==null){var B=C.length;if(B===null||typeof C==="string"||this.isFunction(C)||C.setInterval){A[0]=C;}else{while(B){A[--B]=C[B];}}}return A;};SigmaUtilities.prototype.map=function(A,F){var B=[];for(var C=0,D=A.length;C<D;C++){var E=F(A[C],C);if(E!==null){B[B.length]=E;}}return B.concat.apply([],B);};SigmaUtilities.prototype.data=function(B,A,C){B=B==window?this.windowData:B;var D=B[this.expando];if(!D){D=B[this.expando]=++this.uuid;}if(A&&!this.cache[D]){this.cache[D]={};}if(C!==undefined){this.cache[D][A]=C;}return A?this.cache[D][A]:D;};SigmaUtilities.prototype.extend=function(){var F=arguments[0]||{},D=1,E=arguments.length,A=false,C;if(typeof F==="boolean"){A=F;F=arguments[1]||{};D=2;}if(typeof F!=="object"&&!this.isFunction(F)){F={};}if(E==D){F=this;--D;}for(;D<E;D++){if((C=arguments[D])!==null){for(var B in C){var G=F[B],H=C[B];if(F===H){continue;}if(A&&H&&typeof H==="object"&&!H.nodeType){F[B]=this.extend(A,G||(H.length!==null?[]:{}),H);}else{if(H!==undefined){F[B]=H;}}}}}return F;};SigmaUtilities.prototype.inArray=function(C,D){for(var A=0,B=D.length;A<B;A++){if(D[A]===C){return A;}}return -1;};SigmaUtilities.prototype.map=function(A,F){var B=[];for(var C=0,D=A.length;C<D;C++){var E=F(A[C],C);if(E!==null){B[B.length]=E;}}return B.concat.apply([],B);};SigmaUtilities.prototype.grep=function(B,F,A){var C=[];for(var D=0,E=B.length;D<E;D++){if(!A!=!F(B[D],D)){C.push(B[D]);}}return C;};function toIntegersAtLease(A){return A<10?"0"+A:A;}Date.prototype.toJSON=function(A){return this.getUTCFullYear()+"-"+toIntegersAtLease(this.getUTCMonth())+"-"+toIntegersAtLease(this.getUTCDate());};SigmaUtilities.prototype.quoteString=function(B){var A=/["\\\x00-\x1f\x7f-\x9f]/g;var C={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};if(A.test(B)){return'"'+B.replace(A,function(D){var E=C[D];if(typeof E==="string"){return E;}E=D.charCodeAt();return"\\u00"+Math.floor(E/16).toString(16)+(E%16).toString(16);})+'"';}return'"'+B+'"';};SigmaUtilities.prototype.toJSON=function(H,F){var E=typeof (H);if(E=="undefined"){return"undefined";}else{if(E=="number"||E=="boolean"){return H+"";}else{if(H===null){return"null";}}}if(E=="string"){return this.quoteString(H);}if(E=="object"&&typeof H.toJSON=="function"){return H.toJSON(F);}if(E!="function"&&typeof (H.length)=="number"){var C=[];for(var D=0;D<H.length;D++){C.push(this.toJSON(H[D],F));}if(F){return"["+C.join(",")+"]";}else{return"["+C.join(", ")+"]";}}if(E=="function"){throw new TypeError("Unable to convert object of type 'function' to json.");}var C=[];for(var A in H){var B;E=typeof (A);if(E=="number"){B='"'+A+'"';}else{if(E=="string"){B=this.quoteString(A);}else{continue;}}var G=this.toJSON(H[A],F);if(typeof (G)!="string"){continue;}if(F){C.push(B+":"+G);}else{C.push(B+": "+G);}}return"{"+C.join(", ")+"}";};SigmaUtilities.prototype.compactJSON=function(A){return this.toJSON(A,true);};SigmaUtilities.prototype.randomString=function(){return randomString();};SigmaUtilities.prototype.isScrollBarExist=function(B,A){Object=document.getElementById(B);switch(A){case"x":Object.scrollLeft=1;if(Object.scrollLeft>0){Object.scrollLeft=0;return true;}else{return false;}break;case"y":Object.scrollTop=1;if(Object.scrollTop>0){Object.scrollTop=0;return true;}else{return false;}break;case"xy":Object.scrollTop=1;Object.scrollLeft=1;if(Object.scrollTop>0&&Object.scrollLeft>0){Object.scrollTop=0;Object.scrollLeft=0;return true;}else{return false;}break;default:Object.scrollTop=1;Object.scrollLeft=1;if(Object.scrollTop>0||Object.scrollLeft>0){Object.scrollTop=0;Object.scrollLeft=0;return true;}else{return false;}break;}};SigmaUtilities.prototype.popUpXHtml=function(H,G,B,I,J){if(!J){J="";}var C=(screen.width-B)/2;var F=(screen.height-I)/2;var D='<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';D+='<html xmlns="http://www.w3.org/1999/xhtml">';D+="<head>";D+="<title>"+G+"</title>";D+='<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';D+=J;D+="</head><body>";D+='<div class="sigma-widget-preview-box">';D+=H;D+="</div>";D+="</body></html>";var E=Math.floor(Math.random()*1001);var A=window.open("","name"+E,"width="+B+",height="+I+",top="+F+",left="+C+"scrollbars=0,resizable=1,location=0,menubar=0,toolbar=0");A.document.open();A.document.write(D);A.document.close();return A;};SigmaUtilities.prototype.isEmpty=function(A){for(var B in A){return false;}return true;};SigmaUtilities.prototype.getBaseUrl=function(){var C=window.location.protocol;var A=window.location.host;var B=window.location.pathname;if(B.startsWith("/sigmaee")){return C+"//"+A+"/sigmaee";}return C+"//"+A;};SigmaUtilities.prototype.echeck=function(G){var A="@";var B=".";var E=G.indexOf(A);var C=G.length;var D=G.indexOf(B);var F="Not valid email ["+G+"]. Please fix it and try again";if(G.indexOf(A)==-1){alert(F);return false;}if(G.indexOf(A)==-1||G.indexOf(A)==0||G.indexOf(A)==C){alert(F);return false;}if(G.indexOf(B)==-1||G.indexOf(B)==0||G.indexOf(B)==C){alert(F);return false;}if(G.indexOf(A,(E+1))!=-1){alert(F);return false;}if(G.substring(E-1,E)==B||G.substring(E+1,E+2)==B){alert(F);return false;}if(G.indexOf(B,(E+2))==-1){alert(F);return false;}if(G.indexOf(" ")!=-1){alert(F);return false;}return true;};var sigmaUtilities=new SigmaUtilities();function isChrome(){var A=/chrome/;return A.test(navigator.userAgent.toLowerCase());}function isOpera(){var A=/opera/;return A.test(navigator.userAgent.toLowerCase());}function isSafari(){var B=/webkit/;var A=B.test(navigator.userAgent.toLowerCase());B=/chrome/;var C=B.test(navigator.userAgent.toLowerCase());return A&&!C;}function isIE8(){var D=navigator.userAgent.toLowerCase();var A=""+(D.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];var C=/msie/;var B=/opera/;return C.test(D)&&!B.test(D)&&A=="8.0";}function isIE7(){var D=navigator.userAgent.toLowerCase();var A=""+(D.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];var C=/msie/;var B=/opera/;return C.test(D)&&!B.test(D)&&A=="7.0";}function isIE(){return isIE7||isIE8();}function Map(A){this.current=undefined;this.size=0;if(A===false){this.disableLinking();}}Map.noop=function(){return this;};Map.illegal=function(){throw new Error("illegal operation for maps without linking");};Map.from=function(C,A){var B=new Map();for(var D in C){if(A||C.hasOwnProperty(D)){B.put(D,C[D]);}}return B;};Map.prototype.disableLinking=function(){this.link=Map.noop;this.unlink=Map.noop;this.disableLinking=Map.noop;this.next=Map.illegal;this.key=Map.illegal;this.value=Map.illegal;this.removeAll=Map.illegal;return this;};Map.prototype.hash=function(A){return(typeof A)+" "+(A instanceof Object?(A.__hash||(A.__hash=++arguments.callee.current)):A.toString());};Map.prototype.hash.current=0;Map.prototype.get=function(A){var B=this[this.hash(A)];return B===undefined?undefined:B.value;};Map.prototype.set=function(A,C){var D=this.hash(A);if(this[D]===undefined){var B={key:A,value:C};this[D]=B;this.link(B);++this.size;}else{this[D].value=C;}return this;};Map.prototype.remove=function(A){var C=this.hash(A);var B=this[C];if(B!==undefined){--this.size;this.unlink(B);delete this[C];}return this;};Map.prototype.removeAll=function(){while(this.size){this.remove(this.key());}return this;};Map.prototype.link=function(A){if(this.size===0){A.prev=A;A.next=A;this.current=A;}else{A.prev=this.current.prev;A.prev.next=A;A.next=this.current;this.current.prev=A;}};Map.prototype.unlink=function(A){if(this.size===0){this.current=undefined;}else{A.prev.next=A.next;A.next.prev=A.prev;if(A===this.current){this.current=A.next;}}};Map.prototype.next=function(){this.current=this.current.next;};Map.prototype.key=function(){return this.current.key;};Map.prototype.value=function(){return this.current.value;};function ActionTracker(){this.servletUrl="track";}ActionTracker.prototype.record=function(A){var B=this;jQuery.ajax({url:B.servletUrl,data:A,success:function(){log.debug("success when recording user action");log.debug(A);},error:function(){log.warn("error when recording user action");log.warn(A);}});};var actionTracker=new ActionTracker();function Observable(){}Observable.prototype.addObserver=function(A){if(!this.observers){this.observers=[];}this.observers.push(A);};Observable.prototype.notifyObservers=function(B){if(!this.observers){return ;}var D=[];var C;for(C=1;C<arguments.length;C++){D.push(arguments[C]);}for(C=0;C<this.observers.length;C++){var A=this.observers[C];if(!A[B]){continue;}A[B].apply(A,D);}};function Services(A,B){this.sigmaBaseURI="";this.searchAPIURL="http://api.sindice.com/v2/search";if(!B){this.debug=false;}else{this.debug=B;}if(!A){this.serverSide=false;}else{this.serverSide=A;}this.pendingRequests=0;this.jsonpTimeout=2*1000;this.consecutiveFailureCounts={sindice:0,sigma:0,okkam:0,yboss:0,alternativeIds:0};this.dieAfterConsecutiveFailures={sindice:1,sigma:10,okkam:-1,yboss:-1,alternativeIds:1};this.dead=false;this.errorMessages={sindice:"The Sindice service used by Sig.ma is currently unavailable. Please check back later.",sigma:"The Sig.ma server is temporarily unavailable. Please check back later.",okkam:"The OKKAM service used by Sig.ma is currently unavailable. Please check back later.",yboss:"The Sig.ma server is temporarily unavailable. Please check back later.",alternativeIds:"The OKKAM alternativeId service is down. Please check back later."};if(this.serverSide){log.info(servicesJava.test());var C={jsonp:function(){},ajax:function(){}};}}Services.prototype=new Observable();Services.prototype.setSearchAPIURL=function(A){this.searchAPIURL=A;log.info("searchAPIURL set to  ["+this.searchAPIURL+"]");};Services.prototype.setSigmaBaseURI=function(A){this.sigmaBaseURI=A;log.info("sigmaBaseURI set to  ["+this.baseURI+"]");};Services.prototype.registerServiceFailure=function(A){this.notifyObservers("ajaxError",A);this.consecutiveFailureCounts[A]++;if(this.dead){return ;}if(this.consecutiveFailureCounts[A]<this.dieAfterConsecutiveFailures[A]){return ;}if(this.dieAfterConsecutiveFailures[A]==-1){return ;}if(this.errorMessages[A]){var B=this.errorMessages[A]+" (Services.registerServiceFailure)";}else{var B="Service error: "+A+" (Services.registerServiceFailure)";}this.notifyObservers("serviceNotAvailable",A,B);this.dead=true;};Services.prototype.registerServiceSuccess=function(A){this.consecutiveFailureCounts[A]=0;};Services.prototype.requestFinished=function(){this.pendingRequests--;if(this.serverSide){log.server("requestFinished with pendingRequests="+this.pendingRequests);}if(this.pendingRequests==0&&!this.dead){this.notifyObservers("allFinished");}};Services.prototype.doRequest=function(C,A,D,F,E){log.info("do Request invoked ");log.info("this.serverSide="+this.serverSide);if(this.dead){log.info("service marked as dead");log.debug("Services.service"+D+" aborted because application has been flagged as dead");F(null);return ;}var B=this;E.success=function(G){log.debug("Services.service"+D+" successful, JSON response:");if(E.resultFilter){G=E.resultFilter(G);}log.debug(G);B.registerServiceSuccess(A);F(G);B.requestFinished();};E.error=function(G,I,H){log.warn("Services.service"+D+" failed!");log.warn("====jqXHR====");log.warn(G);log.warn("====textStatus====");log.warn(I);log.warn("====errorThrown====");log.warn(H);B.registerServiceFailure(A);F(null);B.requestFinished();};this.pendingRequests++;E.data.a="sigma";E.traditional=true;if(C=="jsonp"){E.dataType="jsonp";if(E.timeout===undefined){E.timeout=this.jsonpTimeout;}if(A==="sindice"){E.timeout=20*1000;}log.debug("Services.service"+D+" invoked, data:");log.debug(E.data);log.debug(E.url);log.debug(E.timeout);if(this.serverSide){this.executeServerSide(E,A,D);}else{if(E.url.indexOf("?")!=-1){E.url+="&callback=?";}else{E.url+="?callback=?";}jQuery.jsonp(E);}}else{if(C=="ajax"){E.dataType="json";log.debug("Services.service"+D+" invoked, data:");log.debug(E.data);log.debug(E.url);log.debug(E.timeout);if(this.serverSide){this.executeServerSide(E,A,D);}else{jQuery.ajax(E);}}else{alert("Unknown request type in Services.prototype.doRequest: "+C);}}};Services.prototype.executeServerSide=function(options,service,operation){if(operation=="LabelRequest"){var data={uris:options.data};}else{var data=options.data;}var type=options.type;if(!type){type="get";log.info("no type specified for service ["+service+"]["+operation+"] will use GET");}var url=options.url;if(url.endsWith("?")&&!url.endsWith("callback=?")){url=url.slice(1);}var queryString="";var index=0;for(var name in data){if(data.hasOwnProperty(name)){var value=data[name];if(index!==0){queryString+="&";}if(value&&value.constructor==Array){for(var i=0;i<value.length;i++){if(i!==0){queryString+="&";}log.server("QSVALUE:["+name+"]["+value[i]+"]");queryString+=name+"="+encodeURIComponent(value[i]);}}else{log.server("QSVALUE:["+name+"]["+value+"]");queryString+=name+"="+encodeURIComponent(value);}index++;}}log.server("REQUESTING servicesJava: with url["+url+"]["+queryString+"]");var ret=servicesJava.sendHttpRequest("get",url,queryString);log.server("GOT RESP:"+ret);if(ret==""||ret==null||ret==undefined){ret="[]";}try{var json=eval("("+ret+")");}catch(e){log.server("RETURN FROM servicesJava: ["+ret+"]");var json={error:"Could not do server side eval !!!"};}if(json.error){options.error();}else{options.success(json);}};Services.prototype.addToData=function(B,C){for(var A in C){if(!C.hasOwnProperty(A)){log.server("querySpec was empty or null");return B;}if(C[A]!==undefined){B[A]=C[A];}}return B;};Services.prototype.serviceSindiceRequest=function(D,C,A,E){var B={page:C,count:A,format:"json",a:"sigma"};B=this.addToData(B,D);this.doRequest("jsonp","sindice","SindiceRequest",E,{url:this.searchAPIURL,data:B,resultFilter:function(G){var H=[];for(var F=0;F<G.entries.length;F++){H.push(G.entries[F].link);}return H;}});};Services.prototype.serviceSindiceKeywordRequest=function(C,B,A,D){this.serviceSindiceRequest({q:C,qt:"term"},B,A,D);};Services.prototype.serviceSindiceKeywordRequestSourcesPingedAtDay=function(D,A,C,B,E){this.serviceSindiceRequest({q:D+" timestamp:"+A+"*",qt:"term"},C,B,E);};Services.prototype.serviceSindiceRequestLabelOnly=function(A,D,B,F){var E=A.replace(/"/g,"");var C='* <http://www.w3.org/2000/01/rdf-schema#label> "'+E+'"';this.serviceSindiceAdvancedRequest(C,D,B,F);};Services.prototype.serviceSindiceAdvancedRequest=function(C,B,A,D){this.serviceSindiceRequest({q:C,qt:"advanced"},B,A,D);};Services.prototype.serviceYBOSSRequest=function(C,B,A,D){if(!B){B=0;}if(!A){A=10;}this.doRequest("ajax","yboss","YBOSSRequest",D,{url:this.sigmaBaseURI+"yboss",data:{q:C,start:B,count:A},dataType:"json",resultFilter:function(F){var G=[];for(var E=0;E<F.length;E++){if(!F[E].metadata){continue;}G.push(F[E].url);}return G;}});};Services.prototype.serviceOKKAMAlternativeIdsRequest=function(C,B,A,D){if(!B){B=0;}if(!A){A=10;}this.doRequest("jsonp","alternativeIds","alternativeIds",D,{url:this.sigmaBaseURI+"alternativeIds",data:{uri:C,start:B,count:A},dataType:"json",resultFilter:function(E){if(E.urls&&E.status=="ok"){return E.urls;}else{return[];}}});};Services.prototype.serviceOKKAMRequest=function(A,B){this.doRequest("jsonp","okkam","OKKAMRequest",B,{url:"http://api.sindice.com/okkamS2R/search",dataType:"json",data:{q:A,format:"json"},resultFilter:function(C){if(!C[A]){return null;}if(!C[A][0]){return null;}return C[A][0].id;}});};Services.prototype.serviceOKKAMSameAsRequest=function(A,B){this.doRequest("jsonp","okkam","OKKAMSameAsRequest",B,{url:"http://api.sindice.com/okkamS2R/sameas",dataType:"json",data:{url:A,format:"json"},resultFilter:function(C){return C;}});};Services.prototype.serviceSourceRequestLimited=function(A,B,C){B.limit=10;this.serviceSourceRequest(A,B,C);};Services.prototype.servicePropertyValuesRequest=function(A,B,C,D){C.property=B;this.serviceSourceRequest(A,C,D);};Services.prototype.serviceSourceRequest=function(A,C,D){var B={url:A};B=this.addToData(B,C);this.doRequest("ajax","sigma","SourceRequest",D,{url:this.sigmaBaseURI+"eeservlets/eelookup",data:B,dataType:"json"});};Services.prototype.serviceCreatePermalink=function(B,A){this.doRequest("ajax","sigma","CreatePermalink",A,{url:this.sigmaBaseURI+"create-permalink",type:"POST",contentType:"application/json",data:sigmaUtilities.compactJSON(B),dataType:"json",resultFilter:function(C){return C.id;}});};Services.prototype.signupToNotification=function(B,A){this.doRequest("ajax","sigma","SignupForNotifications",A,{url:this.sigmaBaseURI+"notifications",type:"POST",contentType:"application/json",data:sigmaUtilities.compactJSON(B),dataType:"json"});};Services.prototype.serviceConfigRequest=function(B,A){this.doRequest("jsonp","sindice","ConfigRequest",A,{url:this.sigmaBaseURI+"recipe",data:{id:B}});};Services.prototype.serviceLabelRequest=function(A,B){this.doRequest("ajax","sigma","LabelRequest",B,{url:this.sigmaBaseURI+"label",type:"POST",contentType:"application/json",data:sigmaUtilities.compactJSON(A),dataType:"json"});};Services.prototype.serviceSearchProviderRequest=function(G,D,B,F,C,A,H){var E={searchProvider:G,searchTerms:D,searchType:B,page:F,itemsPerPage:C,domainFilter:A};this.doRequest("ajax","searchProviderServlet",G,H,{url:this.sigmaBaseURI+"eeservlets/eesearch",data:E,dataType:"json"});};Services.prototype.serviceSigmaEEConfigRequest=function(A,B){this.doRequest("ajax","configServlet","configServlet",B,{async:false,type:"GET",url:this.sigmaBaseURI+"eeservlets/eeconfig",data:A,dataType:"json"});};function LabelFetcher(){this.queue=[];this.fetching=0;this.flushing=false;this.batchSize=10;this.parallelRequests=5;}LabelFetcher.prototype.requestLabel=function(A,B){if(!/http:/.test(A)){B(null);return ;}log.info("Queueing label request for: "+A);this.queue.push({uri:A,callback:B});this.processQueue();};LabelFetcher.prototype.flush=function(){log.info("Flushing label queue ("+this.queue.length+" items)");this.flushing=true;this.processQueue();};LabelFetcher.prototype.processQueue=function(){if(this.fetching>=this.parallelRequests){return ;}if(this.queue.length>=this.batchSize){this.sendBatchRequest(this.batchSize);}else{if(this.flushing){if(this.queue.length>0){this.sendBatchRequest(this.queue.length);}this.flushing=false;}}};LabelFetcher.prototype.sendBatchRequest=function(E){log.info("Batch label request for "+this.queue.length+" labels");var F=[];var D=[];for(var A=0;A<E;A++){var C=this.queue.shift();F.push(C.uri);D.push(C);}this.fetching+=1;var B=this;services.serviceLabelRequest(F,function(G){B.processBatchResult(G,D);});};LabelFetcher.prototype.processBatchResult=function(B,D){this.fetching-=1;if(!B){B={error:"batch request failed"};}for(var A=0;A<D.length;A++){var C=D[A].uri;var E=D[A].callback;if(B.error){log.debug("processing label for "+C+": general error: "+B.error);E({error:B.error});}else{if(!B[C]){log.debug("processing label for "+C+": no result for this URI");E({error:"No result"});}else{log.debug("processing label for "+C+": got a response");E(B[C]);}}}this.processQueue();};function ValueModel(B,A){this.property=B;this.label=A.label;this.value=A.value;if(A.uris){this.uris=A.uris;}else{this.uris=[];}if(A.uri){this.uris.push(A.uri);}this.tokens=A.tokens;this.error=null;this.sources=[];if(A.sources){this.sourcesNumbers=A.sources;}else{this.sourcesNumbers=[];}this.highlighted=false;this.rejected=false;this.confirmed=false;this.hidden=false;this.hiddenByDisplayMode=false;this.active=null;this.activeSourceCount=0;if(this.property.entity.alwaysRequestLabels){this.requestLabel();}this.elementID=randomString();}ValueModel.prototype=new Observable();ValueModel.prototype.getWebLink=function(){if(this.uris.length===0){return null;}if(this.uris.length===1){return this.uris[0];}var D={};var B=0;var A=null;for(var C=0;C<this.uris.length;C++){var E=this.uris[C];if(!D[E]){D[E]=0;}D[E]++;if(D[E]>B){B=D[E];A=E;}}return A;};ValueModel.prototype.getSigmaLink=function(){if(this.value&&(!this.uris||this.uris.length===0)){return null;}var B=[];if(this.label){B.push("q="+encodeURIComponent(this.label.replace(/[:,.]/g," ")));}for(var A=0;A<this.uris.length;A++){B.push("id="+encodeURIComponent(this.uris[A]));}if(B.length===0){return null;}return"search?"+B.join("&");};ValueModel.prototype.setAsSingleValue=function(){this.property.setSingleValue(this);};ValueModel.prototype.addSource=function(A){if(this.sources.indexOf(A)!=-1){return ;}this.sources.push(A);this.sourcesNumbers.push(A.getIndex());this.updateActiveSourceCount();};ValueModel.prototype.requestLabel=function(){if(this.label){return false;}if(this.uris.length===0){return false;}this.notifyObservers("loading",true);var A=this;this.property.entity.labelFetcher.requestLabel(this.uris[0],function(B){log.debug(B);A.notifyObservers("loading",false);if(B&&B.error){log.warn("label request returned error: "+B.error);A.error="Failed to fetch label: "+B.error;A.notifyObservers("labelUpdateError",A.error);}else{if(B&&B.label&&B.label_tokens){log.info("label request successful");A.label=B.label;A.tokens=B.label_tokens;A.notifyObservers("labelUpdated",A.label);if(A.property.attemptConsolidation(A)){return ;}}else{A.notifyObservers("labelUpdateError","No label");}}});};ValueModel.prototype.isMatchingValue=function(B){var C=false;for(var A=0;A<this.uris.length;A++){if(B.uris.indexOf(this.uris[A])>=0){C=true;break;}}if(C){return true;}if(this.value&&B.value&&this.value==B.value){return true;}if(this.label&&B.label&&this.label==B.label){return true;}if((this.label&&B.value&&this.label==B.value)||(this.value&&B.label&&this.value==B.label)){return true;}if(this.tokens&&B.tokens&&this.tokens==B.tokens){return true;}if(this.uris.length===0&&!this.value&&!this.label&&B.uris.length===0&&!B.value&&!B.label){return true;}return false;};ValueModel.prototype.merge=function(B,A){this.uris=this.uris.concat(B.uris).unique();if(!this.value&&B.value){this.value=B.value;}if(!this.label&&B.label){this.label=B.label;}if(!this.tokens&&B.tokens){this.tokens=B.tokens;}if(!this.hidden&&B.hidden){this.hide();}this.sources=this.sources.concat(B.sources).unique();this.sourcesNumbers=this.sourcesNumbers.concat(B.sourcesNumbers).unique();if(!A){this.notifyObservers("merged");this.updateHighlightState();this.updateActivityState();this.updateActiveSourceCount();this.notifyObservers("numberOfSourcesChanged",this.sources.length,"from merge");}};ValueModel.prototype.updateHighlightState=function(){var D=false;var C=this.sources;var A=this.sources.length;for(var B=A-1;B>=0;B--){D|=C[B].highlighted;}if(D!=this.highlighted){this.highlighted=D;this.notifyObservers("highlightChanged",this.highlighted);}};ValueModel.prototype.changeHighlightState=function(A){this.notifyObservers("highlightChanged",A);};ValueModel.prototype.updateActivityState=function(){var G=this.active;var L=this.rejected;var I=this.confirmed;var H=false;var B=true;var A=false;var D=false;var J=this.sources;var C=this.sources.length;var F=0;for(F=C-1;F>=0;F--){H=H||J[F].isActive();B=B&&J[F].rejected;A=A||J[F].confirmed;D=D||J[F].solo;}var E=this.property.entity.isInSoloMode();log.info("updateActivityState: \n prop: "+this.property.name+"\n newActivityState: "+H+"\n hidden: "+this.hidden+"\n hiddenByDisplayMode: "+this.hiddenByDisplayMode+"\n this.property.hidden: "+this.property.hidden+"\n soloState: "+D+"\n inSoloMode: "+E+"");H=H&&!this.hidden&&!this.property.hidden&&(!E||D);log.info("updateActivityState: "+H);log.info("this.property.inSingleMode: "+this.property.inSingleMode);if(this.property.inSingleMode===true){var K=false;if(this.property.inSingleMode&&this.property.singleModeValue==this){K=true;}log.info("isSingleValue: "+K);H=H&&K;}this.active=H;this.rejected=B;this.confirmed=A;if(H!==G){this.notifyObservers("activityChanged",this.active);}if(this.hiddenByDisplayMode===true){this.notifyObservers("activityChanged",false);}if(B!=L){this.notifyObservers("rejected",this.rejected);}if(A!=I){this.notifyObservers("confirmed",this.confirmed);}this.updateActiveSourceCount();this.notifyObservers("numberOfSourcesChanged");};ValueModel.prototype.updateActiveSourceCount=function(){var D=0;var B=0;var C=this.sources;var A=this.sources.length;for(D=A-1;D>=0;D--){if(!C[D].rejected){B++;}}if(B!=this.activeSourceCount){this.activeSourceCount=B;this.property.sourceCountChanged(this,B);}};ValueModel.prototype.toString=function(){var A="";if(this.value){A+='"'+this.value+'"';}else{if(this.uris.length>0){A+="<"+this.uris.join("><")+">";}else{A+="[]";}}if(this.label){A+='(label:"'+this.label+'")';}return A;};ValueModel.prototype.hide=function(){this.hidden=true;this.notifyObservers("hidden",true);this.updateActivityState();this.property.updateActivityState(false);};ValueModel.prototype.show=function(){this.hidden=false;this.notifyObservers("hidden",false);};ValueModel.prototype.toJSON=function(){var A={};if(this.value){A.value=this.value;}if(this.tokens){A.tokens=this.tokens;}if(this.label){A.label=this.label;}if(this.error){A.error=this.error;}if(this.uris){A.uris=this.uris;}if(this.sourcesNumbers){A.sources=this.sourcesNumbers;}return A;};function PropertyModel(B,A){this.entity=B;this.name=A;var C=this.name.match(/^is (.*) of$/);if(C){this.inverse=true;this.sortName=C[1];}else{this.inverse=false;this.sortName=this.name;}this.values=[];this.unfetchedValues=[];this.automaticallyFetchValues=false;this.currentUnfetchedValueCount=0;this.sources=[];this.hidden=false;this.weight=0+"z".charCodeAt(0)-this.sortName.toLowerCase().charCodeAt(0)+1;if(this.weight<0||this.weight>27){this.weight=0;}this.originalWeight=this.weight;this.topValue=null;this.topSourceCount=0;this.active=null;this.inSingleMode=false;this.singleModeValue=null;this.displayMode=this.getDefaultPropertyDisplayMode();this.stickToPreviousMode=this.entity.getDefaultPropertyStickyModeForLayout();this.elementID=randomString();}PropertyModel.prototype=new Observable();PropertyModel.prototype.getDefaultPropertyStickyMode=function(){return this.entity.getDefaultPropertyStickyModeForLayout();};PropertyModel.prototype.getDefaultPropertyDisplayMode=function(){if(this.name==="picture"){return"compact";}return this.entity.getDefaultPropertyDisplayModeForLayout();};PropertyModel.prototype.getStickToPreviousMode=function(){return this.stickToPreviousMode;};PropertyModel.prototype.setStickToPreviousMode=function(A){this.stickToPreviousMode=A;this.notifyObservers("stickToPreviousChange",this.stickToPreviousMode);};PropertyModel.prototype.getDisplayMode=function(){return this.displayMode;};PropertyModel.prototype.setDisplayMode=function(A){if(!A){this.displayMode=this.entity.getDefaultPropertyDisplayModeForLayout();}else{this.displayMode=A;}if(A==="compact"){this.inSingleMode=null;this.singleModeValue=null;this.updateActivityState(true);}else{if(A==="list"){this.inSingleMode=null;this.singleModeValue=null;this.updateActivityState(true);}else{if(A==="single"){this.singleModeValue=this.getSingleValue();this.inSingleMode=true;this.updateActivityState(true);}else{if(A==="hidden"){this.hide();}}}}this.notifyObservers("displayModeChanged",this.displayMode);};PropertyModel.prototype.getNumberOfHiddenByDisplayModeValues=function(){var D=0;var A=this.values;var C=A.length;for(var B=0;B<C;B++){if(A[B].hiddenByDisplayMode===true){D++;}}return D;};PropertyModel.prototype.getNumberOfActiveValues=function(){var D=0;var A=this.values;var C=A.length;for(var B=0;B<C;B++){if(A[B].active===true){D++;}}return D;};PropertyModel.prototype.registerUnfetchedValues=function(B,A){log.debug(A+" unfetched values for "+this.name+" from "+B.sourceURI);this.unfetchedValues.push({source:B,count:A});if(this.automaticallyFetchValues){this.fetchValues();}this.updateActivityState(false);};PropertyModel.prototype.countUnfetchedValues=function(){var A=0;for(var B=0;B<this.unfetchedValues.length;B++){if(!this.unfetchedValues[B].source.isActive()){continue;}if(this.entity.isInSoloMode()&&!this.unfetchedValues[B].source.solo){continue;}A+=this.unfetchedValues[B].count;}return A;};PropertyModel.prototype.fetchValues=function(){if(this.unfetchedValues.length===0){return ;}this.automaticallyFetchValues=true;while(this.unfetchedValues.length>0){var A=this.unfetchedValues.shift().source;A.fetchValues(this);}this.updateActivityState(false);};PropertyModel.prototype.setSingleValue=function(A){if(!A){this.inSingleMode=false;this.singleModeValue=null;}else{if(A===true){this.inSingleMode=true;this.singleModeValue=null;}else{this.inSingleMode=true;this.singleModeValue=A;this.notifyObservers("topValueChanged",A);}}};PropertyModel.prototype.getSingleValue=function(){if(this.inSingleMode&&this.singleModeValue!==null){return this.singleModeValue;}else{if(this.inSingleMode!==true&&this.topValue!==null){this.inSingleMode=true;this.singleModeValue=this.topValue;return this.singleModeValue;}else{log.error("There is no value to return from getSingleValue");return null;}}};PropertyModel.prototype.addValue=function(F,G){var E;var H=new ValueModel(this,F);if(!G){log.error("no source specified, this should happen just for debugging");}else{if(G.length){for(E=0;E<F.sources.length;E++){var D=F.sources[E];if(!G[D]){return ;}H.addSource(G[D]);this.addSource(G[D]);}}else{H.addSource(G);this.addSource(G);}}var C=this.values;var B=this.values.length;var A=false;for(E=B-1;E>=0;E--){if(C[E].isMatchingValue(H)){C[E].merge(H,this.entity.disableInitialNotifications);H=C[E];A=true;break;}}if(!A){this.values.push(H);this.notifyObservers("valueAdded",H);if(!this.entity.disableInitialNotifications){H.notifyObservers("numberOfSourcesChanged",H.sources.length,"from addSource");}}if(!this.entity.disableInitialNotifications){H.updateActivityState();this.updateActivityState(false);}return H;};PropertyModel.prototype.moveOnTop=function(){var A=this.entity.getPropertyOnTop().name;log.debug("called moveOnTop on property "+this.name);log.debug("top property name is "+A);this.moveBefore(A);};PropertyModel.prototype.moveBefore=function(A){if(A==this.name){return ;}var B=this.entity.getPropertyAfter(this);this.entity.move(this,A);this.notifyObservers("movedBefore",A,"From property model");};PropertyModel.prototype.addSource=function(A){if(this.sources.indexOf(A)==-1){this.sources.push(A);}};PropertyModel.prototype.getValuesFromSource=function(E){var A=[];var C=this.values;var B=this.values.length;for(var D=B-1;D>=0;D--){if(C[D].sources.indexOf(E)!=-1){A.push(C[D]);}}return A;};PropertyModel.prototype.updateHighlightState=function(){this.notifyObservers("highlightChanged",this.highlighted);};PropertyModel.prototype.changeHighlightState=function(A){this.notifyObservers("highlightChanged",A);};PropertyModel.prototype.hasActiveValues=function(){var B=this.values;var A=this.values.length;for(var C=A-1;C>=0;C--){if(B[C].active===true){return true;}}return false;};PropertyModel.prototype.updateActivityState=function(E){var G=false;var A=this.countUnfetchedValues();var D=this.values;var C=this.values.length;for(var F=C-1;F>=0;F--){var H=D[F];if(E){H.updateActivityState();}}G=this.hasActiveValues()||(A>0);var B=G&&!this.hidden;if(this.active!==B){this.active=G;log.info("changing activity to "+this.active+" for prop ["+this.name+"]");this.notifyObservers("activityChanged",Boolean(this.active));}if(this.entity.propertyNamesToDisplay.length>0){if(this.entity.propertyNamesToDisplay.indexOfMatch(this.name)===-1){this.active=false;this.notifyObservers("activityChanged",this.active);}}if(this.currentUnfetchedValueCount!=A){this.notifyObservers("unfetchedValueCountChanged",A);this.currentUnfetchedValueCount=A;}};PropertyModel.prototype.hide=function(){this.notifyObservers("hidden",true);this.hidden=true;var A=this.values;var C=A.length;for(var B=0;B<C;B++){A[B].hide();}};PropertyModel.prototype.show=function(D){this.notifyObservers("hidden",false);this.hidden=false;if(D===true){var A=this.values;var C=A.length;for(var B=0;B<C;B++){A[B].show();}}this.updateActivityState(true);};PropertyModel.prototype.attemptConsolidation=function(D){var B=this.values;var A=this.values.length;for(var C=A-1;C>=0;C--){if(B[C]==D){continue;}if(D.isMatchingValue(B[C])){D.merge(B[C]);var E=B[C];B.splice(C,1);E.notifyObservers("removedByMerging",D);return true;}}return false;};PropertyModel.prototype.setWeight=function(B){this.weight=B;this.entity.rearrange(this);var A=this.entity.getPropertyAfter(this);if(A){this.notifyObservers("movedBefore",A.name,"From property model 2");}};PropertyModel.prototype.sourceCountChanged=function(E,D){if(E!=this.topValue&&D>this.topSourceCount){this.topValue=E;this.topSourceCount=D;if(this.inSingleMode!==true){this.notifyObservers("topValueChanged",E);}}else{if(E==this.topValue&&(D<this.topSourceCount||D===0)){this.topValue=null;this.topSourceCount=0;var B=this.values;var A=this.values.length;for(var C=A-1;C>=0;C--){if(B[C].activeSourceCount>this.topSourceCount){this.topValue=B[C];this.topSourceCount=D;}}if(!this.inSingleMode){this.notifyObservers("topValueChanged",this.topValue);}}}};function SourceModel(A,B){this.entity=A;this.sourceURI=B.request.url;this.recordURI=B.request.url;this.sourceLabel=B.title;this.domain=B.domain;this.date=B.updated;this.valueCount=B.totalResults;this.queryPhrase=B.request.query;this.queryIdentifier=null;this.searchProvider=B.searchProvider;this.highlighted=false;this.rejected=false;this.confirmed=false;this.solo=false;this.filteredOut=false;this.alternativeUrlsFromOkkam=null;this.alternativeUrlsFromOkkamFetched=0;}SourceModel.prototype=new Observable();SourceModel.prototype.fetchValues=function(C){var B=this;log.debug('SourceModel.fetchValues: Requesting property "'+C.name+'" for <'+this.sourceURI+">");log.debug('    phrase: "'+this.queryPhrase+'", id: '+this.queryIdentifier);var A=this.entity.determineMatchingLookupProviderNames(this.sourceURI);var D={query:this.queryPhrase,id:this.queryIdentifier,lookupProviderNames:A};services.servicePropertyValuesRequest(this.sourceURI,C.name,D,function(G){if(!G){return ;}log.debug(G);var E=G.results.properties[C.name];if(!E){return ;}for(var F=0;F<E.length;F++){C.addValue(E[F],B);}B.entity.labelFetcher.flush();});};SourceModel.prototype.getIndex=function(){return this.entity.sources.indexOf(this)+1;};SourceModel.prototype.eachValue=function(E){for(var C=0;C<this.entity.propertyList.length;C++){var D=this.entity.propertyList[C];var A=D.getValuesFromSource(this);for(var B=0;B<A.length;B++){E(A[B]);}}};SourceModel.prototype.eachPropertyAndValueFromThisSource=function(E){for(var C=0;C<this.entity.propertyList.length;C++){var D=this.entity.propertyList[C];var A=D.getValuesFromSource(this);for(var B=0;B<A.length;B++){if(B===0){E(D);}E(A[B]);}}};SourceModel.prototype.highlightSource=function(A){this.highlighted=A;this.notifyObservers("highlightChanged",A);};SourceModel.prototype.highlightSourcePropertiesAndValues=function(A){this.eachPropertyAndValueFromThisSource(function(B){B.changeHighlightState(A);});};SourceModel.prototype.highlight=function(A){if(this.highlighted==A){return ;}this.highlighted=A;this.notifyObservers("highlightChanged",A);this.eachValue(function(B){B.updateHighlightState();});};SourceModel.prototype.reject=function(A){if(A==this.rejected){return ;}if(this.confirmed===true){this.confirmed=false;}this.rejected=A;this.notifyObservers("rejected",A);this.eachValue(function(B){B.updateActivityState();B.notifyObservers("numberOfSourcesChanged");});this.entity.updateActivityStateOfProperties(false);};SourceModel.prototype.confirm=function(A){if(A==this.confirmed){return ;}if(this.rejected===true){this.rejected=false;}this.confirmed=A;this.notifyObservers("confirmed",A);this.eachValue(function(B){B.updateActivityState();B.notifyObservers("numberOfSourcesChanged");});this.entity.updateActivityStateOfProperties(false);};SourceModel.prototype.isActive=function(){if(!this.confirmed&&!this.rejected&&this.entity.newInformationVisible){return true;}if(this.confirmed&&this.entity.confirmedInformationVisible){return true;}if(this.rejected&&this.entity.rejectedInformationVisible){return true;}return false;};SourceModel.prototype.setSoloState=function(B){var C=this.entity.getSoloedSources();var A=C.indexOf(this);if(B){if(A==-1){C.push(this);this.entity.setSoloMode(C);}}else{if(A!=-1){C.splice(A,1);this.entity.setSoloMode(C);}}};function EntityModel(){this.properties={};this.propertyList=[];this.sources=[];this.newInformationVisible=true;this.confirmedInformationVisible=true;this.rejectedInformationVisible=false;this.confirmedDomains=[];this.rejectedDomains=[];this.soloedSources=[];this.labelFetcher=new LabelFetcher();this.embededMode=false;this.onServerSide=false;this.disableInitialNotifications=false;this.alwaysRequestLabels=false;this.pageLayout="layout1";this.propertyNamesToDisplay=[];this.okkamSuggestions=false;}EntityModel.prototype=new Observable();EntityModel.prototype.registerPropertyNamesToDisplay=function(B){this.propertyNamesToDisplay=B;for(var A=0;A<this.propertyList.length;A++){var C=this.propertyList[A];C.updateActivityState(true);}};EntityModel.prototype.getDefaultPropertyDisplayModeForLayout=function(C){var B;if(!C){B=this.pageLayout;}else{B=C;}var A;switch(B){case"layout1":A="list";break;case"layout2":A="compact";break;case"layout3":A="list";break;default:A="list";}return A;};EntityModel.prototype.getDefaultPropertyStickyModeForLayout=function(C){var A;if(!C){A=this.pageLayout;}else{A=C;}var B="2";switch(A){case"layout1":B="2";break;case"layout2":B="1";break;case"layout3":B="2";break;default:B="2";}log.info("Returning default sticky mode for layout["+A+"]["+B+"]");return B;};EntityModel.prototype.setPageLayout=function(A){if(this.pageLayout===A){return ;}this.pageLayout=A;this.notifyObservers("pageLayoutChanged",this.pageLayout);this.setPropertyDisplayModeOnAllProperties();this.setStickToPreviousPropertyOnAllProperties();};EntityModel.prototype.setPropertyDisplayModeOnAllProperties=function(){for(var A=0;A<this.propertyList.length;A++){var B=this.propertyList[A];B.setDisplayMode(B.getDefaultPropertyDisplayMode());}};EntityModel.prototype.setStickToPreviousPropertyOnAllProperties=function(){for(var A=0;A<this.propertyList.length;A++){var B=this.propertyList[A];B.setStickToPreviousMode(B.getDefaultPropertyStickyMode());}};EntityModel.prototype.setOnServerSide=function(A){this.onServerSide=A;log.info("onServerSide set to  ["+this.onServerSide+"]");};EntityModel.prototype.setEmbededMode=function(A){this.embededMode=A;};EntityModel.prototype.confirmDomain=function(D){if(this.confirmedDomains.indexOf(D)==-1){this.confirmedDomains.push(D);}var C,A=this.sources.length;for(var B=A-1;B>=0;B--){C=this.sources[B];if(C.confirmed===true){continue;}if(C.domain==D){C.confirm(true);}}};EntityModel.prototype.rejectDomain=function(D){if(this.rejectedDomains.indexOf(D)==-1){this.rejectedDomains.push(D);}var C,A=this.sources.length;for(var B=A-1;B>=0;B--){C=this.sources[B];if(C.rejected===true){continue;}if(C.domain==D){C.reject(true);}}};EntityModel.prototype.getNumberOfNewSources=function(){var B=0;for(var A=0;A<this.sources.length;A++){if(!this.sources[A].rejected&&!this.sources[A].confirmed){B++;}}return B;};EntityModel.prototype.getNumberOfApprovedSources=function(){var B=0;for(var A=0;A<this.sources.length;A++){if(!this.sources[A].rejected&&this.sources[A].confirmed){B++;}}return B;};EntityModel.prototype.getNumberOfRejectedSources=function(){var B=0;for(var A=0;A<this.sources.length;A++){if(this.sources[A].rejected&&!this.sources[A].confirmed){B++;}}return B;};EntityModel.prototype.setNewInformationVisible=function(A){this.notifyObservers("setNewInformationVisible",A);if(this.newInformationVisible===A){return ;}this.newInformationVisible=A;this.updateActivityStateOfProperties(true);};EntityModel.prototype.setConfirmedInformationVisible=function(A){this.notifyObservers("setConfirmedInformationVisible",A);if(this.confirmedInformationVisible===A){return ;}this.confirmedInformationVisible=A;this.updateActivityStateOfProperties(true);};EntityModel.prototype.setRejectedInformationVisible=function(A){this.notifyObservers("setRejectedInformationVisible",A);if(this.rejectedInformationVisible===A){return ;}this.rejectedInformationVisible=A;this.updateActivityStateOfProperties(true);};EntityModel.prototype.addProperty=function(A){log.debug("EntityModel.addProperty: "+A);if(this.properties[A]){return this.properties[A];}var B=new PropertyModel(this,A);this.properties[A]=B;this.insertIntoPropertyList(B);this.notifyObservers("propertyAdded",B,this.getPropertyAfter(B));return B;};EntityModel.prototype.getProperties=function(){return this.properties;};EntityModel.prototype.addSource=function(A){if(A.totalResults===0&&(A.yboss||A.is_web_page)){A.totalResults=1;A.properties["web page"]=[{uris:[A.request.url]}];}if(this.hasSource(A.request.url)){return this.getSource(A.request.url);}var B=this.addSourceFromJSON(A);this.addPropertiesFromJSON(A.results.properties,B);this.addSkippedPropertiesFromJSON(A.skipped_properties,B);this.notifyObservers("finishedAddingNewSources");return B;};EntityModel.prototype.hasSource=function(A){return this.getSource(A)!==null;};EntityModel.prototype.getSource=function(C){var A=this.sources.length;for(var B=A-1;B>=0;B--){if(this.sources[B].sourceURI==C){return this.sources[B];}}return null;};EntityModel.prototype.addSourceFromJSON=function(A){var B=new SourceModel(this,A);this.sources.push(B);this.notifyObservers("sourceAdded",B);return B;};EntityModel.prototype.addPropertiesFromJSON=function(D,B){var A=this;sigmaUtilities.each(D,function(E){var F=function(){var J=A.addProperty(E);var I=D[E];var G=I.length;for(var H=G-1;H>=0;H--){J.addValue(I[H],B);}};if(A.onServerSide){F();}else{sigmaUtilities.queueForSlowBrowser.add(F,A);}});var C=function(){A.notifyObservers("finishedAddingProperties");A.labelFetcher.flush();};if(A.onServerSide){C();}else{sigmaUtilities.queueForSlowBrowser.add(C,A);}};EntityModel.prototype.addSkippedPropertiesFromJSON=function(B,E){for(var A in B){if(B.hasOwnProperty(A)){var C=B[A];var D=this.addProperty(A);D.registerUnfetchedValues(E,C);}}};EntityModel.prototype.getProperty=function(A){return this.properties[A];};EntityModel.prototype.getPropertyAfter=function(B){for(var A=0;A<this.propertyList.length-1;A++){if(this.propertyList[A]==B){return this.propertyList[A+1];}}return null;};EntityModel.prototype.getPropertyBefore=function(B){for(var A=1;A<this.propertyList.length;A++){if(this.propertyList[A]==B){return this.propertyList[A-1];}}return null;};EntityModel.prototype.__printPropertiesOrder=function(){var A=[];for(var B=0;B<this.propertyList.length;B++){var C=this.propertyList[B];if(C.active===true){A.push([C.name,C.weight]);}else{A.push([C.name,C.weight,"not active"]);}}log.debug("==================");log.debug(A);};EntityModel.prototype.getPropertyOnTop=function(){var B={weight:-1000};for(var A=0;A<this.propertyList.length;A++){var C=this.propertyList[A];if(C.weight>B.weight&&C.active===true){B=C;}}log.debug("Current property on top is "+B.name);return B;};EntityModel.prototype.move=function(B,A){if(A===null||A===""){B.weight=this.propertyList[this.propertyList.length-1].weight-0.005;}else{if(this.propertyList.indexOf(this.getProperty(A))==-1){return ;}else{if(this.propertyList.indexOf(this.getProperty(A))===0){B.weight=this.propertyList[0].weight+0.005;}else{after=this.getProperty(A);before=this.getPropertyBefore(after);B.weight=(after.weight+before.weight)/2;}}}this.rearrange(B);};EntityModel.prototype.rearrange=function(A){this.propertyList.splice(this.propertyList.indexOf(A),1);this.insertIntoPropertyList(A);};EntityModel.prototype.insertIntoPropertyList=function(D){var B=-1;var A=this.propertyList.length;for(var C=0;C<A;C++){if(this.propertyList[C].weight<=D.weight){B=C;break;}if(this.propertyList[C].weight>D.weight){continue;}if(this.propertyList[C].sortName>D.sortName){B=C;break;}if(this.propertyList[C].sortName<D.sortName){continue;}if(this.propertyList[C].inverse>D.inverse){B=C;break;}}if(B==-1){this.propertyList.push(D);}else{this.propertyList.splice(B,0,D);}log.debug("++++++++ after inserting prop ["+D.name+"] ["+D.weight+"]");this.__printPropertiesOrder();};EntityModel.prototype.updateActivityStateOfProperties=function(A){for(var B=0;B<this.propertyList.length;B++){this.propertyList[B].updateActivityState(A);}};EntityModel.prototype.setSoloMode=function(A){this.soloedSources=A;for(var B=0;B<this.sources.length;B++){var C=this.sources[B];if(C.solo&&(A.indexOf(C)==-1)){C.solo=false;C.notifyObservers("updateSoloStatus",false);}else{if(!C.solo&&(A.indexOf(C)!=-1)){C.solo=true;C.notifyObservers("updateSoloStatus",true);}}}this.updateActivityStateOfProperties(true);log.info("isInSoloMode(): "+this.isInSoloMode());};EntityModel.prototype.isInSoloMode=function(){return this.soloedSources.length!==0;};EntityModel.prototype.getSoloedSources=function(){var A=[];for(var B=0;B<this.soloedSources.length;B++){A.push(this.soloedSources[B]);}return A;};function RecordOrder(){this.record=null;this.fetching=false;this.completed=false;this.failed=false;this.aborted=false;}RecordOrder.prototype.fetch=function(B,C,D){if(this.aborted){log.error("attempted to fetch an aborted order: "+B);return ;}log.info("In RecordOrder.prototype.fetch requesting url ["+B+"]");this.fetching=true;var A=this;services.serviceSourceRequestLimited(B,C,function(E){A.fetching=false;if(A.aborted){log.server("returning from serviceSourceRequestLimited cause order aborted");return ;}if(E){log.info("fetching successful: "+B);A.record=E;A.completed=true;A.record.relevance=A.relevance;}else{log.info("fetching failed: "+B);log.info("see querySpec parameters below");for(var F in C){if(C.hasOwnProperty(F)){log.info(F+":"+C[F]);}}A.failed=true;}D(A);});};RecordOrder.prototype.abort=function(){this.aborted=true;};function RecordStream(){}sigmaUtilities.extend(RecordStream.prototype,Observable.prototype);RecordStream.prototype.init=function(A,B){this.name=B;this.exhausted=false;this.closed=false;this.seen=A?A:[];this.nNext=1;this.orders=[];this.sourceQueue=[];this.sourceQueueState="idle";this.pending=0;this.maxParallelFetches=5;this.update();};RecordStream.prototype.nextRelevance=function(){if(this.sourceQueueState==="exhausted"&&this.sourceQueue.length===0){return 0;}return this.computeRelevance(this.nNext);};RecordStream.prototype.orderRecord=function(B){var A=new RecordOrder();A.relevance=this.computeRelevance(this.nNext);A.callback=B;this.orders.push(A);log.info("ordering from "+this.name+", relevance "+A.relevance);this.nNext++;this.update();return A;};RecordStream.prototype.close=function(){this.closed=true;this.update();};RecordStream.prototype.update=function(){if(this.sourceQueue.length===0&&this.sourceQueueState==="exhausted"){this.exhausted=true;}while(true){if(this.orders.length===0){break;}if(this.closed){var A=this.orders.shift();A.abort();this.failOrder(A);continue;}if(this.orders[0].fetching){break;}if(this.orders[0].completed){var A=this.orders.shift();if(A==null){log.error("!!!!!!! RecordStream.update: order is null");}this.modifyBeforeDelivery(A.record);this.notifyObservers("recordReady",A.record);A.callback(A.record,A.relevance);continue;}if(this.orders[0].failed){this.failOrder(this.orders.shift());continue;}if(!this.exhausted){break;}this.failOrder(this.orders.shift());}for(var C=0;C<this.orders.length;C++){if(this.orders[C].fetching||this.orders[C].completed){continue;}if(this.pending>=this.maxParallelFetches){break;}var B=this.dequeueNextSource();if(B===null){break;}this.fetchOrder(this.orders[C],B);}if(this.sourceQueue.length===0&&this.sourceQueueState==="idle"&&!this.closed){this.fillSourceQueue();}if((this.exhausted||this.closed)&&this.orders.length===0){this.notifyObservers("streamExhausted",this);}};RecordStream.prototype.computeRelevance=function(A){return 0;};RecordStream.prototype.fillSourceQueue=function(){this.sourceQueueState="refilling";var A=this;this.fetchSources(function(C){if(!C||C.length===0){A.sourceQueueState="exhausted";}else{A.sourceQueueState="idle";for(var B=0;B<C.length;B++){A.sourceQueue.push(C[B]);}}A.update();});};RecordStream.prototype.dequeueNextSource=function(){while(this.sourceQueue.length>0){var A=this.sourceQueue.shift();if(this.seen.indexOf(A)!=-1){log.info("skipping "+A);continue;}this.seen.push(A);return A;}return null;};RecordStream.prototype.fetchSources=function(A){A(null);};RecordStream.prototype.fetchOrder=function(A,B){this.pending++;var C=this;A.fetch(B,this.getQuerySpec(B),function(D){C.pending--;C.orderFetched(D);C.update();});};RecordStream.prototype.orderFetched=function(A){};RecordStream.prototype.failOrder=function(A){A.callback(null,A.relevance);};RecordStream.prototype.getQuerySpec=function(A){return this.getQuerySpecBase();};RecordStream.prototype.getQuerySpecBase=function(A){return{};};RecordStream.prototype.modifyBeforeDelivery=function(A){};RecordStream.prototype.determineMatchingLookupProviderNames=function(C){if(!this.sigmaEEConfiguration){log.error("this.sigmaEEConfiguration not available");return null;}var E=function(I){return I.active;};var F=function(J){var I=C.match(J.uriPattern);if(I!==null){J.fitness=I.length;return true;}return false;};var G=function(J,I){if(J.priority>I.priority){return 1;}else{if(J.priority<I.priority){return -1;}else{return I.fitness-J.fitness;}}};var A=this.sigmaEEConfiguration.availableLookupProviders.slice(0);var H=A.filter(E).filter(F);H.sort(G);var B=[];for(var D=0;D<H.length;D++){B.push(H[D].dataProviderName);}log.info("Found following matching lookup providers for ["+C+"]");log.info(B);return B;};function ArrayRecordStream(C,B,A){this.sigmaEEConfiguration=A;this.requests=C;this.hasFetchedSources=false;this.init(B,"List of "+C.length+" sources");}sigmaUtilities.extend(ArrayRecordStream.prototype,RecordStream.prototype);ArrayRecordStream.prototype.computeRelevance=function(A){return 1;};ArrayRecordStream.prototype.fetchSources=function(C){if(this.hasFetchedSources){C(null);return ;}this.hasFetchedSources=true;var B=[];for(var A=0;A<this.requests.length;A++){B.push(this.requests[A].source_uri);}C(B);};ArrayRecordStream.prototype.getQuerySpec=function(B){var D=this.getQuerySpecBase(B);for(var C=0;C<this.requests.length;C++){if(this.requests[C].source_uri==B){D.query=this.requests[C].query_phrase;D.id=this.requests[C].query_identifier;var A=this.determineMatchingLookupProviderNames(B);if(A.length>0){D.lookupProviderNames=A;}return D;}}return null;};ArrayRecordStream.prototype.modifyBeforeDelivery=function(B){for(var A=0;A<this.requests.length;A++){if(this.requests[A].source_uri==B.source_uri){if(this.requests[A].fetched){this.requests[A].fetched(B);}}}};function SindiceKeywordRecordStream(B,A){this.query=B;this.page=1;this.perpage=50;this.init(A,'Sindice keyword search for "'+B+'"');this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceKeywordRecordStream.prototype,RecordStream.prototype);SindiceKeywordRecordStream.prototype.computeRelevance=function(A){return 0.75/Math.pow(A,0.22);};SindiceKeywordRecordStream.prototype.getQuerySpec=function(B){var A=this.getQuerySpecBase(B);A.phrase=this.query;if(this.doUseCaches==false){A.cache="0";}if(this.fetchers!=null){A.fetchers=this.fetchers;}return A;};SindiceKeywordRecordStream.prototype.fetchSources=function(A){log.info("refilling "+this.name+", page "+this.page);services.serviceSindiceKeywordRequest(this.query,this.page,this.perpage,A);this.page++;};SindiceKeywordRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function SindiceLabelRecordStream(B,A){this.query=B;this.page=1;this.perpage=50;this.init(A,'Sindice label search for "'+B+'"');this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceLabelRecordStream.prototype,RecordStream.prototype);SindiceLabelRecordStream.prototype.computeRelevance=function(A){return 0.5/Math.pow(A,0.3);};SindiceLabelRecordStream.prototype.getQuerySpec=function(B){var A=this.getQuerySpecBase(B);A.phrase=this.query;if(this.doUseCaches==false){A.cache="0";}if(this.fetchers!=null){A.fetchers=this.fetchers;}return A;};SindiceLabelRecordStream.prototype.fetchSources=function(A){log.info("refilling "+this.name+", page "+this.page);services.serviceSindiceRequestLabelOnly(this.query,this.page,this.perpage,A);this.page++;};SindiceLabelRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function SindiceIdentifierRecordStream(C,A,B){this.identifier=C;this.phrase=A;this.page=1;this.perpage=50;this.init(B,'Sindice identifier search for "'+C+'"');var D=C;if(D.indexOf("#")!=-1){D=D.substr(0,D.indexOf("#"));}this.sourceQueue.push(D);this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceIdentifierRecordStream.prototype,RecordStream.prototype);SindiceIdentifierRecordStream.prototype.computeRelevance=function(A){return 1/Math.pow(A,0.1);};SindiceIdentifierRecordStream.prototype.fetchSources=function(B){log.info("refilling "+this.name+", page "+this.page);var A="<"+this.identifier+"> * *";services.serviceSindiceAdvancedRequest(A,this.page,this.perpage,B);this.page++;};SindiceIdentifierRecordStream.prototype.getQuerySpec=function(B){var A=this.getQuerySpecBase(B);A.id=this.identifier;A.phrase=this.phrase;if(this.doUseCaches==false){A.cache="0";}if(this.fetchers!=null){A.fetchers=this.fetchers;}return A;};SindiceIdentifierRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function SindiceHomepageRecordStream(D,B,A,C){this.homepage=D;this.phrase=B;this.identifiers=A;this.page=1;this.perpage=50;this.init(C,"Sindice homepage search: <"+this.homepage+">");this.doUseCaches=true;this.fetchers=null;}sigmaUtilities.extend(SindiceHomepageRecordStream.prototype,RecordStream.prototype);SindiceHomepageRecordStream.prototype.computeRelevance=function(A){return 0.9/Math.pow(A,0.15);};SindiceHomepageRecordStream.prototype.fetchSources=function(B){log.info("refilling "+this.name+", page "+this.page);var A="* <http://xmlns.com/foaf/0.1/homepage> <"+this.homepage+">";services.serviceSindiceAdvancedRequest(A,this.page,this.perpage,B);this.page++;};SindiceHomepageRecordStream.prototype.getQuerySpec=function(B){var A=this.getQuerySpecBase(B);A.phrase=this.phrase;A.homepage=this.homepage;if(this.identifiers&&this.identifiers.length>0){A.id=this.identifiers[0];}if(this.doUseCaches==false){A.cache="0";}if(this.fetchers!=null){A.fetchers=this.fetchers;}return A;};SindiceHomepageRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function OKKAMRecordStream(B,A){this.query=B;this.okkamID=null;this.page=1;this.perpage=50;this.init(A,'OKKAM search for "'+B+'"');}sigmaUtilities.extend(OKKAMRecordStream.prototype,RecordStream.prototype);OKKAMRecordStream.prototype.computeRelevance=function(A){return 1/Math.pow(A,0.1);};OKKAMRecordStream.prototype.getQuerySpec=function(B){var A=this.getQuerySpecBase(B);A.phrase=this.query;A.id=this.okkamID;return A;};OKKAMRecordStream.prototype.fetchSources=function(C){if(this.okkamID===false){C(null);return ;}if(this.okkamID===null){log.info("querying for OKKAM ID: "+this.query);var B=this;services.serviceOKKAMRequest(this.query,function(D){if(!D){B.okkamID=false;}else{B.okkamID=D;}B.fetchSources(C);});return ;}log.info("refilling "+this.name+", page "+this.page);var A="<"+this.okkamID+"> * *";services.serviceSindiceAdvancedRequest(A,this.page,this.perpage,C);this.page++;};OKKAMRecordStream.prototype.modifyBeforeDelivery=function(A){A.okkam=true;};OKKAMRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function YahooBOSSRecordStream(B,A){this.query=B;this.offset=0;this.perpage=50;this.init(A,'Yahoo BOSS search for "'+B+'"');}sigmaUtilities.extend(YahooBOSSRecordStream.prototype,RecordStream.prototype);YahooBOSSRecordStream.prototype.computeRelevance=function(A){return 0.64/Math.pow(A,0.26);};YahooBOSSRecordStream.prototype.getQuerySpec=function(B){var A=this.getQuerySpecBase(B);A.phrase=this.query;return A;};YahooBOSSRecordStream.prototype.fetchSources=function(A){log.info("refilling "+this.name+", offset "+this.offset);services.serviceYBOSSRequest(this.query,this.offset,this.perpage,A);this.offset+=this.perpage;};YahooBOSSRecordStream.prototype.modifyBeforeDelivery=function(A){A.yboss=true;};YahooBOSSRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function AlternativeIdsRecordStream(B,A){this.query=B;this.offset=0;this.perpage=10;this.init(A,'AlternativeId search for "'+B+'"');}sigmaUtilities.extend(AlternativeIdsRecordStream.prototype,RecordStream.prototype);AlternativeIdsRecordStream.prototype.computeRelevance=function(A){return 1/Math.pow(A,0.1);};AlternativeIdsRecordStream.prototype.getQuerySpec=function(B){var A=this.getQuerySpecBase(B);A.phrase="";return A;};AlternativeIdsRecordStream.prototype.fetchSources=function(A){log.info("refilling "+this.name+", offset "+this.offset);services.serviceOKKAMAlternativeIdsRequest(this.query,this.offset,this.perpage,A);this.offset+=this.perpage;};AlternativeIdsRecordStream.prototype.modifyBeforeDelivery=function(A){A.okkam=true;};AlternativeIdsRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function SearchProviderRecordStream(E,B,D,C,F,A){this.sigmaEEConfiguration=A;if(!F){this.relevancefunction=function(G){return 0.75/Math.pow(G,0.22);};}else{this.relevancefunction=F;}this.query=E;this.page=1;this.perpage=50;this.searchType=C;this.doUseCaches=true;this.fetchers=null;this.searchProvider=D;this.init(B,"SerchProviderRecordStream ["+this.searchProvider.dataProviderName+'] "'+this.query+'"');}sigmaUtilities.extend(SearchProviderRecordStream.prototype,RecordStream.prototype);SearchProviderRecordStream.prototype.computeRelevance=function(A){return this.relevancefunction(A);};SearchProviderRecordStream.prototype.getQuerySpec=function(B){var C=this.getQuerySpecBase(B);C.query=this.query;if(this.doUseCaches==false){C.cache="0";}if(this.fetchers!=null){C.fetchers=this.fetchers;}var A=this.determineMatchingLookupProviderNames(B);if(A.length>0){C.lookupProviderNames=A;}return C;};SearchProviderRecordStream.prototype.modifyBeforeDelivery=function(A){A.searchProvider=this.searchProvider;};SearchProviderRecordStream.prototype.fetchSources=function(B){log.info("refilling "+this.name+", page "+this.page);var A=function(E){var G=[];if(E!=null){var D=E.results;for(var C=0;C<D.length;C++){var F=D[C];if(F.hasOwnProperty("link")){G.push(F.link);}else{if(F.hasOwnProperty("entity")){G.push(F.entity);}}}}B(G);};services.serviceSearchProviderRequest(this.searchProvider.dataProviderName,this.query,this.searchType,this.page,this.perpage,this.searchProvider.domainFilter,A);this.page++;};SearchProviderRecordStream.prototype.orderFetched=function(A){if(A.failed){A.failed=false;}};function SourceManager(B){this.entity=B;this.query=null;this.queryOriginal=null;this.queryPropertyParameters=null;this.outstandingOrders=0;this.streams=[];this.streamsForCurrentKeyword=[];this.seen=[];this.identifiersSeen=[];this.homepagesSeen=[];this.deliveredCount=0;this.readyOrders=[];var A=[];this.useSindice=true;this.useIdentifierSearch=true;this.useIFPSearch=true;this.useSingleSource=false;this.doFetchFromWeb=true;this.doUseCaches=true;this.fetchers=null;var D=[];var C=this;B.addProperty("identifier").addObserver({valueAdded:function(E){E.addObserver({confirmed:function(G){if(!G){return ;}if(!C.useIdentifierSearch){return ;}for(var F=0;F<E.uris.length;F++){C.addStreamForIdentifier(E.uris[F]);}}});}});B.addProperty("homepage").addObserver({valueAdded:function(E){E.addObserver({confirmed:function(G){if(!G){return ;}if(!C.useIFPSearch){return ;}for(var F=0;F<E.uris.length;F++){C.addStreamForHomepage(E.uris[F]);}}});}});this.sigmaEEConfiguration={};this.populateSigmaEEConfiguration();}sigmaUtilities.extend(SourceManager.prototype,Observable.prototype);var okkamId=null;function onFunctionAvailable(){if(okkamId===null){log.info("wait 100");setTimeout(onFunctionAvailable,100);}}SourceManager.prototype.getListOfSearchProviders=function(){};SourceManager.prototype.determineMatchingLookupProviderNames=function(C){if(!this.sigmaEEConfiguration){log.error("this.sigmaEEConfiguration not available");return null;}var E=function(I){return I.active;};var F=function(J){var I=C.match(J.uriPattern);if(I!==null){J.fitness=I.length;return true;}return false;};var G=function(J,I){if(J.priority>I.priority){return 1;}else{if(J.priority<I.priority){return -1;}else{return I.fitness-J.fitness;}}};var A=this.sigmaEEConfiguration.availableLookupProviders.slice(0);var H=A.filter(E).filter(F);H.sort(G);var B=[];for(var D=0;D<H.length;D++){B.push(H[D].dataProviderName);}log.info("Found following matching lookup providers for ["+C+"]");log.info(B);return B;};SourceManager.prototype.setQuery=function(G){if(this.queryOriginal==G){return ;}this.queryOriginal=G;log.info('setting query to "'+this.queryOriginal+'"; stream count before: '+this.streams.length);this.notifyObservers("queryChanged",this.queryOriginal);if(this.hasPropertyParameters(G)){var D=this.extractPropertiesNames(G);this.entity.registerPropertyNamesToDisplay(D);G=this.extractQuery(G);}else{this.entity.registerPropertyNamesToDisplay([]);}var A=false;var J=this.streamsForCurrentKeyword;this.streamsForCurrentKeyword=[];this.query=G;var H="keyword";if(this.isURI(G)){H="uri";}var C=this.sigmaEEConfiguration.availableSearchProviders;for(var F=0;F<C.length;F++){var K=C[F];if(K.active&&!(this.disableSearchProvider!=undefined&&(sigmaUtilities.inArray(K.dataProviderName,this.disableSearchProvider)!=-1))){var I=1;if(K.priority){I=K.priority;}var E=0;if(K.initialNumberOfSources){E=K.initialNumberOfSources;}var B=(function(M,O,N){return function(P){if(P<=N){return O;}return 0.01;};})(K.dataProviderName,I,E);var L=new SearchProviderRecordStream(this.query,this.seen,K,H,B,this.sigmaEEConfiguration);if(this.doUseCaches==false){L.doUseCaches=false;}if(this.fetchers!=null){L.fetchers=this.fetchers;}this.streams.push(L);this.streamsForCurrentKeyword.push(L);L.addObserver(this);}}for(var F=0;F<J.length;F++){if(this.streams.indexOf(J[F])==-1){continue;}J[F].close();}};SourceManager.prototype.hasOkkamTypeParameter=function(A){res=/okkamtype/.test(A);if(res===true){log.info("Detected okkamtype parameter");}return res;};SourceManager.prototype.hasPropertyParameters=function(A){res=/@/.test(A);if(res===true){log.info("Detected @parameter");}return res;};SourceManager.prototype.extractQuery=function(A){return A.substring(A.indexOf("@")+1).trim();};SourceManager.prototype.removeOkkamType=function(D){var C="okkamtype:";var A=D.indexOf(C);var B=D.substring(0,A);return B.trim();};SourceManager.prototype.getOkkamType=function(D){var C="okkamtype:";var A=D.indexOf(C);var B=D.substring(A+C.length);return B.trim();};SourceManager.prototype.extractPropertiesNames=function(C){C=C.substring(0,C.indexOf("@")).trim();var A=C.split(",");for(var B=0;B<A.length;B++){A[B]=A[B].trim();}return A;};SourceManager.prototype.isURI=function(A){return(/^https?:/).test(A);};SourceManager.prototype.addSingleSource=function(C,F){this.outstandingOrders++;this.notifyObservers("pendingCountUpdated",this.outstandingOrders);var E=this;var B=new RecordOrder();var D={query:this.query!=null?this.query:""};var A=this.determineMatchingLookupProviderNames(C);if(A.length>0){D.lookupProviderNames=A;}if(this.fetchers!=null){D.fetchers=this.fetchers;}if(!this.doFetchFromWeb){D.fetch=0;}if(!this.doUseCaches){D.cache=0;}B.fetch(C,D,function(G){E.outstandingOrders--;E.notifyObservers("pendingCountUpdated",E.outstandingOrders);if(G.failed){if(F){F(null);}return false;}var H=E.entity.addSource(G.record);H.searchProvider="user";if(F){F(H);}});};SourceManager.prototype.orderMoreSources=function(B){if(B===undefined){alert(true);B=1;}else{B=parseInt(B,10);}log.info("ordering "+B+" new sources");if(this.streams.length===0){this.notifyObservers("exhausted");return ;}this.outstandingOrders+=B;this.notifyObservers("pendingCountUpdated",this.outstandingOrders);for(var A=0;A<B;A++){this.orderSource();}};SourceManager.prototype.orderSource=function(){var C=this.getBestOrderableStream();var B=(this.readyOrders.length>0)?this.readyOrders[0].relevance:null;if(B!==null&&(C===null||B>=C.nextRelevance())){var A=this.readyOrders.shift();if(A===null){log.error("!!!!!!! SourceManager.orderSource: order is null");}this.deliver(A.record);return ;}if(C===null){this.outstandingOrders--;if(this.streams.length!==0){this.notifyObservers("pendingCountUpdated",this.outstandingOrders);}log.info("all streams exhausted, dropping one order");return ;}var D=this;C.orderRecord(function(F,G){if(F===null){log.info("order failed");}else{log.info("record fetched; relevance: "+G);var E=0;while(E<D.readyOrders.length&&D.readyOrders[E].relevance>=G){E++;}D.readyOrders.splice(E,0,{record:F,relevance:G});}D.orderSource();});};SourceManager.prototype.getBestOrderableStream=function(){var A=null;var D=0;for(var B=0;B<this.streams.length;B++){var C=this.streams[B].nextRelevance();if(C>D){D=C;A=this.streams[B];}}return A;};SourceManager.prototype.streamExhausted=function(B){var A=this.streams.indexOf(B);if(A===-1){return ;}this.streams.splice(A,1);log.info("stream exhausted: "+B.name+"; stream count: "+this.streams.length);if(this.streams.length===0){this.notifyObservers("pendingCountUpdated",0);this.notifyObservers("exhausted");if(this.deliveredCount===0){this.notifyObservers("noResults",this.query);}return ;}};SourceManager.prototype.deliver=function(A){log.info("delivering "+A.source_uri+", relevance "+A.relevance);source=this.entity.addSource(A);this.outstandingOrders--;this.deliveredCount++;if(this.streams.length!==0){this.notifyObservers("pendingCountUpdated",this.outstandingOrders);}};SourceManager.prototype.fetchSameAsFromOkkam2=function(A){A.alternativeUrlsFromOkkamFetched=1;if(A.sourceURI.startsWith("http://dbpedia.org")||A.sourceURI.startsWith("http://freebase.com")||A.sourceURI.startsWith("http://geonames.org")){log.info("fetchSameAsFromOkkam2 got: dbpedia freebase or geonames ");services.serviceOKKAMSameAsRequest(A.sourceURI,function(B){if(B!=null&&B.length>0){A.alternativeUrlsFromOkkam=B;A.alternativeUrlsFromOkkamFetched=2;A.notifyObservers("urlsFromOkkamAdded2",A.alternativeUrlsFromOkkam);}A.alternativeUrlsFromOkkamFetched=2;});}else{A.alternativeUrlsFromOkkamFetched===2;}};SourceManager.prototype.addStreamForIdentifier=function(A){if(this.identifiersSeen.indexOf(A)!=-1){log.info("skipping identifier: "+A);return ;}this.identifiersSeen.push(A);log.info("adding identifier stream for "+A+"; stream count: "+this.streams.length+1);var B=new SindiceIdentifierRecordStream(A,this.query,this.seen);B.addObserver(this);this.streams.push(B);};SourceManager.prototype.addStreamForHomepage=function(B){if(this.homepagesSeen.indexOf(B)!=-1){log.info("skipping homepage: "+B);return ;}this.homepagesSeen.push(B);log.info("adding homepage stream for "+B+"; stream count: "+this.streams.length+1);var A=new SindiceHomepageRecordStream(B,this.query,this.identifiersSeen,this.seen);A.addObserver(this);this.streams.push(A);};SourceManager.prototype.populateSigmaEEConfiguration=function(){var A=this;services.serviceSigmaEEConfigRequest({op:"getConfiguration"},function(B){A.sigmaEEConfiguration=B;});services.serviceSigmaEEConfigRequest({op:"getDetailedCacheProviderList"},function(B){A.sigmaEEConfiguration.availableCacheProviders=B.cacheProviderList;});services.serviceSigmaEEConfigRequest({op:"getDetailedSearchProviderList"},function(B){A.sigmaEEConfiguration.availableSearchProviders=B.searchProviderList;});services.serviceSigmaEEConfigRequest({op:"getDetailedLookupProviderList"},function(B){A.sigmaEEConfiguration.availableLookupProviders=B.lookupProviderList;});log.info("SigmaEE config set");log.info(this.sigmaEEConfiguration);this.entity.sigmaEEConfiguration=this.sigmaEEConfiguration;this.entity.determineMatchingLookupProviderNames=this.determineMatchingLookupProviderNames;this.entity.notifyObservers("updateConfiguration",this.sigmaEEConfiguration);};function RecipeManager(A,B){this.entity=A;this.sourceManager=B;this.appliedRecipe=null;this.topLabel=null;this.topPicture=null;this.topComment=null;var D=this;var C=function(F,E){if(E&&E.label){D[F]=E.label;}else{D[F]=null;}};A.addProperty("label").addObserver({topValueChanged:function(E){C("topLabel",E);}});A.addProperty("comment").addObserver({topValueChanged:function(E){C("topComment",E);}});A.addProperty("picture").addObserver({topValueChanged:function(E){if(E&&E.uris&&E.uris.length>0){D.topPicture=E.uris[0];}else{D.topPicture=null;}}});}RecipeManager.prototype.getRecipe=function(){var G={recipe_version:"1.2",queries:[],sources:[],hidden_properties:[],property_weights:{},hidden_values:[],single_valued_properties:{},state_visibility:{unrated:false,confirmed:false,rejected:false},pageLayout:this.entity.pageLayout,propertiesWithChangedDisplayMode:[],propertiesWithChangedStickyMode:[]};if(this.sourceManager.queryOriginal){G.queries.push(this.sourceManager.queryOriginal);}if(this.entity.newInformationVisible){G.state_visibility.unrated=true;}if(this.entity.confirmedInformationVisible){G.state_visibility.confirmed=true;}if(this.entity.rejectedInformationVisible){G.state_visibility.rejected=true;}var E;var C=[];for(E=0;E<this.entity.sources.length;E++){var A=this.entity.sources[E];var F={};if(A.sourceURI){F.source_uri=A.sourceURI;}if(A.queryPhrase){F.query_phrase=A.queryPhrase;}if(A.queryIdentifier){F.query_identifier=A.queryIdentifier;}if(A.confirmed){F.confirmed=A.confirmed;}if(A.rejected){F.rejected=A.rejected;}if(A.isFromYBOSS){F.yboss=A.isFromYBOSS;}if(A.isFromOKKAM){F.okkam=A.isFromOKKAM;}G.sources.push(F);C.push(A.sourceURI);}if(this.appliedRecipe&&this.appliedRecipe.sources){for(E=0;E<this.appliedRecipe.sources.length;E++){var B=this.appliedRecipe.sources[E];if(C.indexOf(B.source_uri)!==-1){continue;}G.sources.push(B);C.push(B.source_uri);}}for(E=0;E<this.entity.propertyList.length;E++){var H=this.entity.propertyList[E];if(H.displayMode!==this.entity.getDefaultPropertyDisplayModeForLayout()){G.propertiesWithChangedDisplayMode.push({name:H.name,mode:H.displayMode});}if(H.stickToPreviousMode!==this.entity.getDefaultPropertyStickyModeForLayout()){G.propertiesWithChangedStickyMode.push({name:H.name,mode:H.stickToPreviousMode});}if(H.hidden){G.hidden_properties.push(H.name);}if(H.weight!=H.originalWeight){G.property_weights[H.name]=H.weight;}for(var D=0;D<H.values.length;D++){if(!H.values[D].hidden){continue;}var I=H.values[D].toJSON();I.property=H.name;G.hidden_values.push(I);}if(H.inSingleMode){if(H.singleModeValue===true){G.single_valued_properties[H.name]=true;}else{G.single_valued_properties[H.name]=H.singleModeValue.toJSON();}}}return G;};RecipeManager.prototype.applyRecipe=function(L){this.appliedRecipe=L;var I=L.queries[0];this.sourceManager.setQuery(I);this.entity.setNewInformationVisible(Boolean(L.state_visibility.unrated));this.entity.setConfirmedInformationVisible(Boolean(L.state_visibility.confirmed));this.entity.setRejectedInformationVisible(Boolean(L.state_visibility.rejected));var H=[];for(var C=0;C<L.sources.length;C++){var G=L.sources[C];H.push({source_uri:G.source_uri,query_phrase:G.query_phrase,query_identifier:G.query_identifier,yboss:G.yboss,okkam:G.okkam,fetched:function(O){if(this.yboss){O.yboss=true;}if(this.okkam){O.okkam=true;}}});}var N=new ArrayRecordStream(H,this.sourceManager.seen,this.sourceManager.sigmaEEConfiguration);var E=this;for(var C=0;C<H.length;C++){N.orderRecord(function(O,R){if(O==null){return ;}var Q=E.entity.addSource(O);for(var P=0;P<L.sources.length;P++){if(L.sources[P].source_uri!=Q.sourceURI){continue;}if(L.sources[P].confirmed){Q.confirm(true);}if(L.sources[P].rejected){Q.reject(true);}break;}});}for(var C=0;C<L.hidden_properties.length;C++){this.entity.addProperty(L.hidden_properties[C]).hide();}for(var F in L.property_weights){if(!L.property_weights.hasOwnProperty(F)){continue;}var D=L.property_weights[F];if(isNaN(parseFloat(D))){continue;}var M=this.entity.addProperty(F);}for(var C=0;C<L.hidden_values.length;C++){var A=L.hidden_values[C];var M=this.entity.addProperty(A.property);var K=M.addValue(A);K.hide();}for(var F in L.single_valued_properties){if(!L.single_valued_properties.hasOwnProperty(F)){continue;}var A=L.single_valued_properties[F];var M=this.entity.addProperty(F);var K=M.addValue(A);M.setSingleValue(K);}this.entity.setPageLayout(L.pageLayout);this.entity.setPropertyDisplayModeOnAllProperties();for(var C=0;C<L.propertiesWithChangedDisplayMode.length;C++){var F=L.propertiesWithChangedDisplayMode[C].name;var B=L.propertiesWithChangedDisplayMode[C].mode;var M=this.entity.getProperty(F);if(!M){M=this.entity.addProperty(F);}M.setDisplayMode(B);}this.entity.setStickToPreviousPropertyOnAllProperties();for(var C=0;C<L.propertiesWithChangedStickyMode.length;C++){var F=L.propertiesWithChangedStickyMode[C].name;var J=L.propertiesWithChangedStickyMode[C].mode;var M=this.entity.getProperty(F);if(!M){M=this.entity.addProperty(F);}M.setStickToPreviousMode(J);}};RecipeManager.prototype.getSnapshot=function(){var A={sources:[],values:{}};if(this.topLabel){A.topLabel=this.topLabel;}if(this.topPicture){A.topPicture=this.topPicture;}if(this.topComment){A.topComment=this.topComment;}for(var C=0;C<this.entity.sources.length;C++){var F=this.entity.sources[C];if(!F.isActive()){continue;}A.sources.push({source_uri:F.sourceURI,source_label:F.sourceLabel,domain:F.domain,date:F.date,total_values:F.valueCount,index:F.getIndex()});}var G=[];for(var C=0;C<this.entity.propertyList.length;C++){var E=this.entity.propertyList[C];if(!E.active){continue;}G.push(E);}G.sort(function(I,H){return I.weight-H.weight;});for(var C=0;C<G.length;C++){var E=G[C];if(E.hasActiveValues()){A.values[E.name]={values:[],displayMode:E.getDisplayMode(),stickyMode:E.getStickToPreviousMode(),weight:E.weight};for(var B=0;B<E.values.length;B++){var D=E.values[B];if(!D.active){continue;}A.values[E.name].values.push(D.toJSON());}}}if(this.entity.pageLayout){A.pageLayout=this.entity.pageLayout;}return A;};RecipeManager.prototype.createPermalink=function(F){var E=this.getRecipe();var A=this.getSnapshot();var D=this.sourceManager.queryOriginal;var B="";var C={recipe:E,snapshot:A,queries:[D],email:B};services.serviceCreatePermalink(C,function(G){if(!G||typeof (F)!=="function"){return null;}return F(G,D);});};RecipeManager.prototype.loadPermalink=function(B){log.info("invoke loadPermalink with id:["+B+"]");var A=this;services.serviceConfigRequest(B,function(C){log.info("received config");log.info(C);if(!C){alert('Configuration request for PID "'+B+'" failed');return ;}A.applyRecipe(C);});};function SigmaUIConfig(A){this.rawFlag=false;if(!A){A="ecsse";}this.sigmaContainerId=A;this.sigmaNewSourcesListId=A+"-new-sources-list";this.sigmaApprovedSourcesListId=A+"-approved-sources-list";this.sigmaRejectedSourcesListId=A+"-rejected-sources-list";this.sigmaNewSourcesListIdXPath="#"+A+"-new-sources-list";this.sigmaApprovedSourcesListIdXPath="#"+A+"-approved-sources-list";this.sigmaRejectedSourcesListIdXPath="#"+A+"-rejected-sources-list";this.ecsseProfileListId="";this.ecsseProfileListIdXPath="";this.ecsseSourcesContainerXPath="";this.ecsseProfileContainerXPath="";this.ecsseRightBoxXPath="";this.ecsseContainerIdXPath="";this.ecsseSourcesBoxInnerXPath="";this.embededMode=false;this.inReorderPropertiesMode=false;this.propertiesAndValuesRendering=true;this.sourcesFilteredLock=false;this.valuesFilteredLock=false;this.showHideSourcesNumbers=true;this.customRenderedProperties=["picture","identifier","homepage","web page","email","openID","okkamID"];this.filterButtonLabel="which sources";this.unfilterButtonLabel="remove filter";this.unfilterSoloButtonLabel="unsolo";this.pulsateDuration=400;this.pulsateStyle="pulsateStyle";this.pulsateOption={times:2,pulsateStart:function(){jQuery(this).addClass(this.pulsateStyle);},pulsateStop:function(){jQuery(this).removeClass(this.pulsateStyle);}};this.pictureFunctions={layout1:{single:{loadFunction:function(B){imgLoad(B,"oryginal");imgLoad(B,"width",600);},errorFunction:function(B){imgError(B,40);}},list:{loadFunction:function(B){imgLoad(B,"oryginal");imgLoad(B,"width",600);},errorFunction:function(B){imgError(B,40);}},compact:{loadFunction:function(B){imgLoad(B,"height",100,true);},errorFunction:function(B){imgError(B,40);}},hidden:{loadFunction:function(B){},errorFunction:function(B){}}},layout2:{single:{loadFunction:function(B){imgLoad(B,"oryginal");imgLoad(B,"width",40);},errorFunction:function(B){imgError(B,40);}},list:{loadFunction:function(B){imgLoad(B,"oryginal");imgLoad(B,"width",40);},errorFunction:function(B){imgError(B,40);}},compact:{loadFunction:function(B){imgLoad(B,"height",40,true);},errorFunction:function(B){imgError(B,40);}},hidden:{loadFunction:function(B){},errorFunction:function(B){}}},layout3:{single:{loadFunction:function(B){imgLoad(B,"width",600);},errorFunction:function(B){imgError(B,40);}},list:{loadFunction:function(B){imgLoad(B,"width",600);},errorFunction:function(B){imgError(B,40);}},compact:{loadFunction:function(B){imgLoad(B,"height",40);},errorFunction:function(B){imgError(B,40);}},hidden:{loadFunction:function(B){},errorFunction:function(B){}}}};this.sigmaeeUIlink="sigmaeeUI_link";this.sigmaeeUIhighlight="sigmaeeUI_highlight";this.sigmaeeUIhighlightCorners="ui-corner-bottom";this.sigmaeeUIdynamicHighlightCorners="ui-corner-all";this.viewsClasses={layout1:{list:{entityContainer:"fl clearLeft  bottomSeparator entityNotSticky",propertyContainer:"propertyInline propertyWidth",propertyLabelContainer:"fr propertyTextAlignRight propertyLabelContainerFixedWidth",valuesContainer:"valuesInline",valueContainer:"valueBlock",valueLabelContainer:"fl",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout1-list ui-corner-top ui-corner-br",propertyButtonsContainer:"propertyButtons-layout1-list ui-corner-top"},compact:{entityContainer:"fl clearLeft bottomSeparator entityNotSticky",propertyContainer:"propertyInline propertyWidth ",propertyLabelContainer:"fr propertyTextAlignRight",valuesContainer:"valuesInline",valueContainer:"valueInline",valueLabelContainer:"",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout1-compact  ui-corner-top ui-corner-br",propertyButtonsContainer:"propertyButtons-layout1-compact ui-corner-top"}},layout2:{list:{entityContainer:"fl  smallerFont entitySticky",propertyContainer:"propertyBlock fl",propertyLabelContainer:"fr propertyTextAlignRight",valuesContainer:"fl",valueContainer:"valueBlock",valueLabelContainer:"fl",separatorContainer:"thinSeparatorInline",valueButtonsContainer:"valueButtons-layout2-list rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout2-list rctl rctr rcbr"},compact:{entityContainer:"fl smallerFont entitySticky",propertyContainer:"propertyInline",propertyLabelContainer:"fr propertyTextAlignRight",valuesContainer:"valuesInline",valueContainer:"valueInline",valueLabelContainer:"",separatorContainer:"thinSeparatorInline",valueButtonsContainer:"valueButtons-layout2-compact rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout2-compact rctl rctr rcbr"}},layout3:{list:{entityContainer:"fl clearLeft bottomSeparator entityNotSticky",propertyContainer:"propertyInline propertyWidth",propertyLabelContainer:"fl",valuesContainer:"valuesBlock valuesMargin",valueContainer:"valueBlock",valueLabelContainer:"fl",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout3-list rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout3-list rctl rctr rcbr"},compact:{entityContainer:"fl clearLeft bottomSeparator entityNotSticky",propertyContainer:"propertyInline",propertyLabelContainer:"fl",valuesContainer:"valuesInline",valueContainer:"valueInline",valueLabelContainer:"",separatorContainer:"thinSeparatorBlock",valueButtonsContainer:"valueButtons-layout3-compact rctl rctr rcbr",propertyButtonsContainer:"propertyButtons-layout3-compact rctl rctr rcbr"}}};this.viewsClasses.layout1.hidden=this.viewsClasses.layout1.list;this.viewsClasses.layout2.hidden=this.viewsClasses.layout2.list;this.viewsClasses.layout3.hidden=this.viewsClasses.layout3.list;this.viewsClasses.layout1.single=this.viewsClasses.layout1.list;this.viewsClasses.layout2.single=this.viewsClasses.layout2.compact;this.viewsClasses.layout3.single=this.viewsClasses.layout3.list;this.propertyOrValueSideMargin=2;jQuery.fn.qtip.styles.sigmaTooltip1={width:300,padding:2,background:"#fff",color:"#000",textAlign:"center",border:{width:1,radius:5,color:"#4297D7"},tip:{corner:"bottomRight",size:{x:20,y:15}},name:"blue"};this.websnapr={domain:"http://images.websnapr.com/",key:"w0LZUS56kxN8"};this.websnapr;this.hideHeader=false;this.hideFooter=false;this.hideSearchbar=false;this.hideBottomMessage=false;this.showFakeSearchbar=false;this.disableHoverOverProperties=false;this.disableHoverOverValues=false;this.dragMode=true;this.showNotifications=false;}function SigmaUITemplates(A){if(!A){this.config={};}else{this.config=A;}var C=[],B=0;C[B++]='<div class="fl unrejectSourceButton buttonContainer" >';C[B++]='<a class="unrejectSource action-button ui-state-default action-button-icon-right ui-corner-all" ';C[B++]='href="javascript:void(0);" title="confirm">';C[B++]='<span class="ui-icon ui-icon-check"></span>unreject';C[B++]="</a>";C[B++]="</div>";this.unrejectSourceButtonTemplate=C.join("");C=[];B=0;C[B++]='<div class="fl unapproveButton buttonContainer" >';C[B++]='<a class="unconfirmSource action-button ui-state-default action-button-icon-right ui-corner-all" ';C[B++]='href="javascript:void(0);" title="unconfirm">';C[B++]='<span class="ui-icon ui-icon-check"></span>unapprove';C[B++]="</a>";C[B++]="</div>";this.unapproveButtonTemplate=C.join("");C=[];B=0;C[B++]='<div class="fl dehighlightButton buttonContainer buttonContainerFirst" >';C[B++]='<a class="dehighlightSource action-button ui-state-highlight action-button-icon-right ui-corner-all" ';C[B++]='href="javascript:void(0);" title="highlight values" style="display:none;">';C[B++]='<span class="ui-icon ui-icon-unlocked"></span>'+this.config.unfilterSoloButtonLabel;C[B++]="</a>";C[B++]="</div>";this.dehighlightButtonTemplate=C.join("");C=[];B=0;C[B++]='<div class="fl highlightButton buttonContainer" >';C[B++]='<a class="highlightSource action-button ui-state-default action-button-icon-right ui-corner-all" ';C[B++]='href="javascript:void(0);" title="highlight values">';C[B++]='<span class="ui-icon ui-icon-locked"></span>solo';C[B++]="</a>";C[B++]="</div>";this.highlightButtonTemplate=C.join("");C=[];B=0;C[B++]='<div class="fl approveButton buttonContainer" >';C[B++]='<a class="confirmSource action-button ui-state-default action-button-icon-right ui-corner-all" ';C[B++]='href="javascript:void(0);" title="confirm">';C[B++]='<span class="ui-icon ui-icon-check"></span>approve';C[B++]="</a>";C[B++]="</div>";this.approveButtonTemplate=C.join("");C=[];B=0;C[B++]='<div class="fl confirmSourceFromTheSameDomainButton buttonContainer" >';C[B++]='<a class="confirmSourceFromTheSameDomain action-button ui-state-default action-button-icon-right1 ui-corner-all" ';C[B++]='href="javascript:void(0);" title="confirm all from the same domain">';C[B++]='<span class="ui-icon ui-icon-check"></span>';C[B++]='<span class="ui-icon ui-icon1 ui-icon-check"></span>&nbsp;';C[B++]="</a>";C[B++]="</div>";this.confirmSourceFromTheSameDomainButtonTemplate=C.join("");C=[];B=0;C[B++]='<div class="fl rejectButton buttonContainer" >';C[B++]='<a class="rejectSource action-button ui-state-default action-button-icon-right ui-corner-all" ';C[B++]='href="javascript:void(0);" title="reject">';C[B++]='<span class="ui-icon ui-icon-close"></span>reject';C[B++]="</a>";C[B++]="</div>";this.rejectButtonTemplate=C.join("");C=[];B=0;C[B++]='<div class="fl rejectSourceFromTheSameDomainButton buttonContainer buttonContainerLast" >';C[B++]='<a class="rejectSourceFromTheSameDomain action-button ui-state-default action-button-icon-right1 ui-corner-all" ';C[B++]='href="javascript:void(0);" title="reject all from the same domain">';C[B++]='<span class="ui-icon ui-icon-close"/>';C[B++]='<span class="ui-icon ui-icon1 ui-icon-close"></span>&nbsp;';C[B++]="</a>";C[B++]="</div>";this.rejectSourceFromTheSameDomainButtonTemplate=C.join("");this.rejectPropertyButtonTemplate='<div class="fl buttonContainer buttonContainerLast" ><a class="rejectProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="hide property"><span class="ui-icon ui-icon-close"></span>&nbsp;</a></div>';this.allValuesPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="allValuesProperty action-button ui-state-default action-button-icon-right ui-corner-all" style="display:none;" href="javascript:void(0);" title="all values"><span class="ui-icon ui-icon-arrowthickstop-1-e" ></span>show all</a></div>';this.topValuePropertyButtonTemplate='<div class="fl buttonContainer" ><a class="topValueProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="top value"><span class="ui-icon ui-icon-arrowthickstop-1-e" ></span>show top</a></div>';this.highlightPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="highlightProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-locked"></span>&nbsp;</a></div>';this.dehighlightPropertyButtonTemplate='<div class="fl buttonContainer" ><a style="display:none;" class="dehighlightProperty action-button ui-state-error action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-unlocked"></span>&nbsp;</a></div>';this.singleViewPropertyButtonTemplate='<div class="fl buttonContainer buttonContainerFirst" ><a class="singleViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="show just top value"><span class="ui-icon ui-icon-bullet"></span>&nbsp;</a></div>';this.compactViewPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="compactViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="show values inline"><span class="ui-icon ui-icon-grip-dotted-horizontal"></span>&nbsp;</a></div>';this.listViewPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="listViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="show values as a list"><span class="ui-icon ui-icon-grip-dotted-vertical"></span>&nbsp;</a></div>';this.hideViewPropertyButtonTemplate='<div class="fl buttonContainer" ><a class="hideViewProperty action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="remove property"><span class="ui-icon ui-icon-trash"></span>&nbsp;</a></div>';this.stickToPreviousOne1ButtonTemplate='<div class="fl buttonContainer" ><a class="stickToPreviousOne stickToPreviousOne1 action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="stick to previous property"><span class="ui-icon ui-icon-arrowreturnthick-1-n"></span>&nbsp;</a></div>';this.stickToPreviousOne2ButtonTemplate='<div class="fl buttonContainer" ><a class="stickToPreviousOne stickToPreviousOne2 action-button ui-state-default action-button-icon-right ui-corner-all" style="display:none;" href="javascript:void(0);" title="disable stick to previous property"><span class="ui-icon ui-icon-arrowreturnthick-1-s"></span>&nbsp;</a></div>';this.stickToPreviousOne3ButtonTemplate='<div class="fl buttonContainer" ><a class="stickToPreviousOne stickToPreviousOne3 action-button ui-state-default action-button-icon-right ui-corner-all" style="display:none;" href="javascript:void(0);" title="disable stick to previous property"><span class="ui-icon ui-icon-arrowreturnthick-1-w"></span>&nbsp;</a></div>';this.moreValuesCompactViewButtonTemplate='<div class="fl moreButtonCompactView" ><a class="moreValuesInCompactView smallerFont" "href="javascript:void(0);">show @number@ more ...</a></div>';this.propertyButtonsTemplate='<div class="propertyButtonsContainer">'+this.stickToPreviousOne1ButtonTemplate+this.stickToPreviousOne2ButtonTemplate+this.stickToPreviousOne3ButtonTemplate+this.singleViewPropertyButtonTemplate+this.compactViewPropertyButtonTemplate+this.listViewPropertyButtonTemplate+this.hideViewPropertyButtonTemplate+"</div>";this.rejectValueButtonTemplate='<div class="fl buttonContainer buttonContainerFirst" ><a class="rejectValue action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="hide value"><span class="ui-icon ui-icon-trash" ></span>hide value</a></div>';this.singleValueButtonTemplate='<div class="fl buttonContainer" ><a class="singleValue action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="just this value"><span class="ui-icon ui-icon-bullet"></span>just this value</a></div>';this.highlightValueButtonTemplate='<div class="fl buttonContainer" ><a class="highlightValue action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-locked"></span>'+this.config.filterButtonLabel+"</a></div>";this.dehighlightValueButtonTemplate='<div class="fl buttonContainer" ><a class="dehighlightValue action-button ui-state-error action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources" style="display:none;" ><span class="ui-icon ui-icon-unlocked"></span>'+this.config.unfilterButtonLabel+"</a></div>";this.smallValueSourcesFilterIndicator='<div class="fl smallValueSourcesFilterIndicator" ><div><a class="dehighlightValue small-button ui-state-error small-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources"><span class="ui-icon ui-icon-unlocked"></span>&nbsp;</a></div></div>';this.rejectValueSourcesButtonTemplate='<div class="fl buttonContainer" ><a class="rejectValueSources action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="filter sources" ><span class="ui-icon ui-icon-close"/></span>reject sources</a></div>';this.openDocumentSourceButtonTemplate='<div class="fl buttonContainer" ><a style="display:none;" class="openDocumentSource action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="openDocumentSource" ><span class="ui-icon ui-icon-link"></span>&nbsp;</a></div>';this.valuesButtonsTemplate='<div class="valueButtonsContainer"><div>'+this.rejectValueButtonTemplate+this.singleValueButtonTemplate+'<div class="fl vertical-bar ui-widget-content" style="border-top:none;border-bottom:none;"></div>'+this.highlightValueButtonTemplate+this.dehighlightValueButtonTemplate+this.rejectValueSourcesButtonTemplate+this.openDocumentSourceButtonTemplate+"</div></div>";this.unfetchedValuesButtonTemplate='<div class="unfetchedValuesButton"><a class="unfetchedValuesButton action-button ui-state-default action-button-icon-right ui-corner-all" href="javascript:void(0);" title="fetch more values"><span class="ui-icon ui-icon-arrowthickstop-1-w"></span>show @n@</a></div>';this.soloIndicator='<div id="valueFilterIndicator" class="filtered ui-state-active ui-corner-all" style="display: none;"><div class="indicatorMsg" >Properties and values filtered for <b>source</b>:<span></span></div><div class="indicatorButtonRight" ><a class="removePropertyAndValueFilterBoxButton action-button ui-state-highlight action-button-icon-right ui-corner-all" href="javascript:void(0);"><span class="ui-icon ui-icon-unlocked"/>'+this.config.unfilterSoloButtonLabel+'</a></div><div class="br"></div></div>';this.noResultsIndicator='<div class="noResultsIndicator ui-state-highlight ui-corner-all" style="display: none;"><div class="indicatorBorder"><div class="msg">There was no results for this query</div><div class="noResultsIndicatorButton">X</div></div></div>';this.reorderPropertiesIndicator='<div style="display:none;" class="reorderPropertiesModeIndicator ui-state-active ui-corner-all"><div class="indicatorMsg">You can reorder properties by dragging them up and down. Click "Done" when finished.<br /><input id="inReorderPropertiesModeHideValues" type="checkbox" title="show/hide values when in reorder properties mode" />Hide values.<br /><input id="inReorderPropertiesModeDisableButtons" type="checkbox" title="show/hide values when in reorder properties mode" />Disable buttons.</div><div class="indicatorButtonRight" ><a class="reorderPropertiesOff action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-arrow-4-diag"></span>Done</a></div><div class="br"></div></div>';this.howToLearnIndicator='<span class="big">Show your web data in Sigma, learn <a class="sigmaHelpLink" href="?page=help" >how</a></span><br /><span class="small">Get this sigma <a class="openPermalink">embedded</a>, in <a class="openPermalink">rdf</a> or in <a class="openPermalink">json</a> format.</span>';this.howToLearnIndicatorSindice='<span class="big">This is a view of what seem to be the "main topic",</span><br /><span class="small">use the other tabs to see the full information contained in this document.<br />This view is based on </span><br /><a href="http://sig.ma"><img src="images/icons/sig.ma-about.gif" /></a>';C=[];B=0;C[B++]='<div class="viewsAndLayoutsDialog" title="Layouts and views" >';C[B++]='<div class="optionsText">';C[B++]="Click on image in order to choose a layout.";C[B++]="</div>";C[B++]='<div class="fl layoutImg ui-widget-content ui-corner-all" >';C[B++]='<a href="javascript:void(0);"  title="layout1"><img src="images/layouts/layout-regular.png"/></a>';C[B++]="</div>";C[B++]='<div class="fl layoutImg marginLeft ui-widget-content ui-corner-all">';C[B++]='<a href="javascript:void(0);" title="layout2"><img src="images/layouts/layout-compact.png"  /></a>';C[B++]="</div>";C[B++]='<div class="fl" style="margin:4px;">';C[B++]='<label class="fl" for="hideShowSourcesNumbers">Check/Uncheck to show/hide sources numbers</label>';C[B++]='<input class="fl" id="hideShowSourcesNumbers" type="checkbox" title="show/hide sources reference numbers" />';C[B++]="</div>";C[B++]='<div style="clear:both;"></div>';C[B++]='<div class="fl" style="margin:4px; display:none;">';C[B++]='<label class="fl" for="okkamSugestions">okkam suggestions</label>';C[B++]='<input type="checkbox" id="okkamSugestions"/>';C[B++]="</div>";C[B++]="</div>";this.layoutSwitchDialogTemplate=C.join("");C=[];B=0;C[B++]='<div class="optionsText">';C[B++]="There are 3 ways of showing SIGMA. Permalink, Fresh and Widget.</div>";C[B++]="</div>";C[B++]='<div class="sigmaPermalinkTabs" style="border:none;" >';C[B++]="<ul>";C[B++]="<li>";C[B++]='<a href="#sigmaPermalinksTab-1">Permalink</a>';C[B++]="</li>";C[B++]="<li>";C[B++]='<a href="#sigmaPermalinksTab-2">Fresh</a>';C[B++]="</li>";C[B++]="<li>";C[B++]='<a href="#sigmaPermalinksTab-3">Embedded</a>';C[B++]="</li>";C[B++]="</ul>";C[B++]='<div id="sigmaPermalinksTab-1" class="sigmaPermalinksTabContainer" >';C[B++]='<span class="fl">To comeback to SIGMA as you see it now use <a href="@url@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@url@</textarea>';C[B++]='<span class="fl">To create raw version of this SIGMA use <a href="@urlRaw@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@urlRaw@</textarea>';C[B++]='<span class="fl">To get this SIGMA in RDF use <a class="sourceAsRdf" href="@urlRdf@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@urlRdf@</textarea>';C[B++]='<span class="fl">To get this SIGMA in JSON use <a class="sourceAsJson" href="@urlJson@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@urlJson@</textarea>';C[B++]="</div>";C[B++]='<div id="sigmaPermalinksTab-2" class="sigmaPermalinksTabContainer">';C[B++]='<span class="fl">To make FRESH SIGMA as you see it now use <a href="@freshUrl@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@freshUrl@</textarea>';C[B++]='<span class="fl">To create raw version of FRESH SIGMA use <a href="@freshUrlRaw@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@freshUrlRaw@</textarea>';C[B++]='<span class="fl">To get FRESH SIGMA in RDF use <a class="sourceAsRdf" href="@freshUrlRdf@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@freshUrlRdf@</textarea>';C[B++]='<span class="fl">To get FRESH SIGMA in JSON use <a class="sourceAsJson" href="@freshUrlJson@">link</a>:</span>';C[B++]='<textarea class="widgetUrlCode">@freshUrlJson@</textarea>';C[B++]="</div>";C[B++]='<div id="sigmaPermalinksTab-3" class="sigmaPermalinksTabContainer">';C[B++]="To display sigma widget on your page simply copy lines below and put them in your page html code in place where you want the widget.";C[B++]="<br />";C[B++]="<b>Sigma widget will use information only from approved sources !</b>";C[B++]='<textarea class="widgetCode">';C[B++]='<script src="@path@/js/sigma-widget.js"  type="text/javascript"><\/script>';C[B++]='\n<script type="text/javascript" sigma="true" >';C[B++]="\n       <!--";C[B++]='\n       createSigma("@id@",{width:600,height:400});';C[B++]="\n       // the config object (with dimensions) is optional";C[B++]="\n       //-->";C[B++]="\n<\/script>";C[B++]="</textarea>";C[B++]="<br />";C[B++]='<a class="sigma-widget-preview">Preview</a>';C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]="</div>";this.old_permalinkDialogTemplate=C.join("");C=[];B=0;C[B++]='<div class="optionsText">';C[B++]="There are 3 ways of showing SIGMA:</div>";C[B++]="</div>";C[B++]='<div class="permalinkOptions">';C[B++]='<div class="optionsTextLabel">Permalink based:</div>';C[B++]='<div class="fl">';C[B++]="<div>";C[B++]='<textarea class="widgetUrlCode fl" >@url@</textarea>';C[B++]='<div class="br"></div>';C[B++]="</div>";C[B++]='<div style="margin-top:2px;">';C[B++]='<a class="sourceAsRdf"  href="@urlRdf@"><span>RDF</span></a>';C[B++]='<a class="sourceAsJson" href="@urlJson@"><span>JSON</span></a>';C[B++]='<a class="urlRss" href="@urlRss@"><span>RSS FEED</span></a>';C[B++]='<a class="urlAtom" href="@urlAtom@"><span>ATOM FEED</span></a>';C[B++]='<a class="urlTwitter" title="@url@"><span>TINY URL</span></a>';C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="widgetRDFJSONCode fl" title="Will contain information only from approved sources">';C[B++]="Information only from <b>approved</b> sources.";C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]="</div>";C[B++]='<div class="permalinkOptions">';C[B++]='<div class="optionsTextLabel">Query  based:</div>';C[B++]='<div class="fl">';C[B++]="<div>";C[B++]='<textarea class="fl widgetUrlCode" >@freshUrl@</textarea>';C[B++]='<div class="br"></div>';C[B++]="</div>";C[B++]='<div style="margin-top:2px;">';C[B++]='<a class="sourceAsRdf" href="@freshUrlRdf@"><span>RDF</span></a>';C[B++]='<a class="sourceAsJson" href="@freshUrlJson@"><span>JSON</span></a>';C[B++]='<a class="urlTwitter" title="@freshUrl@"><span>TINY URL</span></a>';C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="widgetRDFJSONCode fl" title="Might contain information from new unapproved sources !" >';C[B++]='Information from new <b style="color:red;">unapproved</b> sources !';C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]="</div>";C[B++]='<div class="permalinkOptions">';C[B++]='<div class="optionsTextLabel">Widget:</div>';C[B++]='<textarea class="widgetCode fl">';C[B++]='<script src="@path@/js/sigma-widget.js"  type="text/javascript"><\/script>';C[B++]='\n<script type="text/javascript" sigma="true" >';C[B++]="\n       <!--";C[B++]='\n       createSigma("@id@",';C[B++]="\n       {width:600,height:400});";C[B++]="\n       // the config object (with dimensions) is optional";C[B++]="\n       //-->";C[B++]="\n<\/script>";C[B++]="</textarea>";C[B++]='<div class="widgetRDFJSONCode fl"><a class="sigma-widget-preview" title=" Click to see the preview of the widget.">Preview</a></div>';C[B++]='<div class="permalinkOptionsDesc">';C[B++]="To display sigma widget on your page simply copy lines below and put them in your page html code in place where you want the widget. ";C[B++]="Sigma widget will use information <b>only from approved</b> sources!";C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]="</div>";C[B++]='<div class="permalinkOptionsSeparator"></div>';C[B++]='<div class="permalinkOptions emailNotifications" style="display:none;">';C[B++]='<div class="optionsText">Permalink [@id@] based sigma alerts:</div>';C[B++]='<div class="optionsTextLabel">Email:</div>';C[B++]='<div class="fl">';C[B++]='<input type="text" class="fl widgetEmailBox pidEmail" style="margin:0 0 0 2px;" value="" />';C[B++]='<div class="fl" style="margin:2px 0 0 4px;">';C[B++]='<a style="padding-top:.3em; padding-bottom: .3em;" class="signupToPidNotifications action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-mail-closed"/>Signup</a>';C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="widgetRDFJSONCode fl" style="margin:2px 0 0 4px;">';C[B++]='<img class="signupToPidNotificationIndicator" style="display:none; width:22px;height:22px;" src="images/icons/ajax-loader.gif" />';C[B++]='<span class="signupToPidNotificationIndicatorMsg" style="display:none;" ></span>';C[B++]='<span class="signupToPidNotificationIndicatorMsgDetail" style="display:none;" ></span>';C[B++]="</div>";C[B++]='<div class="optionsText">Query [@query@] based sigma alerts:</div>';C[B++]='<div class="optionsTextLabel">Email:</div>';C[B++]='<div class="fl">';C[B++]='<input type="text" class="fl widgetEmailBox queryEmail" style="margin:0 0 0 2px;" value="" />';C[B++]='<div class="fl" style="margin:2px 0 0 4px;">';C[B++]='<a style="padding-top:.3em; padding-bottom: .3em;" class="signupToQueryNotifications action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-mail-closed"/>Signup</a>';C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="widgetRDFJSONCode fl" style="margin:2px 0 0 4px;">';C[B++]='<img class="signupToQueryNotificationIndicator" style="display:none; width:22px;height:22px;" src="images/icons/ajax-loader.gif" />';C[B++]='<span class="signupToQueryNotificationIndicatorMsg" style="display:none;" ></span>';C[B++]='<span class="signupToQueryNotificationIndicatorMsgDetail" style="display:none;" ></span>';C[B++]="</div>";C[B++]='<div class="permalinkOptionsDesc">';C[B++]="If you want to know when something change in your sigma provide an email address.";C[B++]="<br />We will send you an email every time when something change in your sigma";C[B++]="<br/>We WILL NOT use your email for any other purpose.";C[B++]="<br/>We WILL NOT give your email to anybody.";C[B++]="<br/>You can always disable this feature by single click at cancellation link attached to every email.</a>.";C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="permalinkOptionsSeparator"></div>';C[B++]='<div class="permalinkOptions">';C[B++]='<div class="optionsText" >To find an info about some more advanced options see <a style="color:#2D8FB4;" class="helpLink" href="" >help</a>.</div>';C[B++]="</div>";this.permalinkDialogTemplate=C.join("");C=[];B=0;C[B++]='<div class="header sidesTopBorder">';C[B++]='<div id="sigma-logo">';C[B++]='<a href="/"><img src="images/icons/sigma-logo-h70.png" alt="Sindice" title="" /></a>';C[B++]="</div>";C[B++]='<div id="menuTop" class="column span-109 last">';C[B++]='<ul id="nav-left-piece" class="_">';C[B++]='<li class="_"><a href="help.html">Help</a></li>';C[B++]='<li class="_"><a href="about.html">About</a></li>';C[B++]='<li class="_" ><a href="http://sindice.com/main/forum" style="padding-right:18px;">Forum</a></li>';C[B++]="</ul>";C[B++]="<br />";C[B++]='<div id="sigmaVersion" style="float:right; margin-right:8px; font-size:11px; color:#A6C9E2; "></div>';C[B++]="</div>";C[B++]='<div class="cut">&nbsp;</div>';C[B++]="</div>";this.headerTemplate=C.join("");C=[];B=0;C[B++]='<div class="sigmaTrashBinDialog" title="Trash bin">';C[B++]='<div class="optionsText">';C[B++]="Click on value or property to restore it.";C[B++]="</div>";C[B++]='<ul class="properties"></ul>';C[B++]="</div>";this.sigmaTrashBinDialogTemplate=C.join("");C=[];B=0;C[B++]='<div id="tabs-simple">';C[B++]="Enable disable any of the current configured providers. ";C[B++]="Click on the cell to enable/disable provider";C[B++]='<div class="sigmaee_simpleConfig"></div>';C[B++]='<div style="clear:both;"></div>';C[B++]='<button class="sigmaee_button sigmaeeCss_smallButton saveSimpleConfig">Save config  modifications</button>';C[B++]='<button class="sigmaee_button sigmaeeCss_smallButton resetConfig ">Restore default config</button>';C[B++]='<button class="sigmaee_button sigmaeeCss_smallButton addNewSparqlEndpoint">Add a sparql endpoint as a provider</button>';C[B++]='<img style="display:none;" class="sigmaee_config_saved" src="images/icons/ajax-loader.gif" />';C[B++]='<div style="clear:both;"></div>';C[B++]="</div>";this.configDialogTemplateTabSimple=C.join("");C=[];B=0;C[B++]='<div id="tabs-advanced" style="display:none;">';C[B++]='<div class="currentSigmaConfig">';C[B++]='<div class="configBox" >';C[B++]="<h2>Cache providers</h2>";C[B++]='<div class="sigmaee_cacheConfig"></div>';C[B++]="</div>";C[B++]='<div class="configBox" >';C[B++]="<h2>Search providers</h2>";C[B++]='<div class="sigmaee_searchConfig"></div>';C[B++]="</div>";C[B++]='<div class="configBox" >';C[B++]="<h2>Lookup providers</h2>";C[B++]='<div class="sigmaee_lookupConfig"></div>';C[B++]="</div>";C[B++]="</div>";C[B++]='<div style="clear:both;"></div>';C[B++]='<button class="sigmaee_button sigmaeeCss_smallButton saveConfig">Save config  modifications</button>';C[B++]='<button class="sigmaee_button sigmaeeCss_smallButton resetConfig">Restore default config</button>';C[B++]='<button class="sigmaee_button sigmaeeCss_smallButton addNewDataProvider">Add new data provider</button>';C[B++]='<a class="sigmaee_button sigmaeeCss_smallButton" href="eeservlets/eeconfig?op=printConfig" target="_blank">Export current config (turtle)</a>';C[B++]='<img style="display:none;" class="sigmaee_config_saved" src="images/icons/ajax-loader.gif" />';C[B++]='<div style="clear:both;"></div>';C[B++]="</div>";this.configDialogTemplateTabAdvanced=C.join("");C=[];B=0;C[B++]='<div class="sigmaConfigDialog" title="Config" style="margin:0 6px;">';C[B++]='<div class="optionsText">';C[B++]="<p>The current sigma ee configuration.</p>";C[B++]="</div>";C[B++]="<div>";C[B++]="<span>You can disable/enable existing providers and add new one.";C[B++]="<br/ >All config modification are kept in cookies and valid only for current session.";C[B++]="Use advanced configuration if you want to export the configuration or save it in you browser";C[B++]="</span>";C[B++]="</div>";C[B++]=this.configDialogTemplateTabSimple;C[B++]=this.configDialogTemplateTabAdvanced;C[B++]='<button class="sigmaee_config simple sigmaeeCss_smallButton">Advanced configuration</button>';C[B++]="</div>";this.configDialogTemplate=C.join("");C=[];B=0;C[B++]='<div id="sigmaOptionsDialog" >';C[B++]='<div id="sigmaOptionsTabs" >';C[B++]="<ul>";C[B++]="<li>";C[B++]='<a href="#sigmaOptionsTab-5">Config</a>';C[B++]="</li>";C[B++]="<li>";C[B++]='<a href="#sigmaOptionsTab-2">Layouts</a>';C[B++]="</li>";C[B++]="<li>";C[B++]='<a href="#sigmaOptionsTab-4">Deleted properties and values</a>';C[B++]="</li>";C[B++]='<li class="optionsTabClose" style="float:right;margin:4px 2px;">';C[B++]='<span class="ui-icon ui-icon-close">&nbsp;</span>';C[B++]="</li>";C[B++]="</ul>";C[B++]='<div id="sigmaOptionsTab-5" class="sigmaOptionsTabContainer" >';C[B++]=this.configDialogTemplate;C[B++]="</div>";C[B++]='<div id="sigmaOptionsTab-2" class="sigmaOptionsTabContainer">';C[B++]=this.layoutSwitchDialogTemplate;C[B++]="</div>";C[B++]='<div id="sigmaOptionsTab-4" class="sigmaOptionsTabContainer">';C[B++]=this.sigmaTrashBinDialogTemplate;C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]="</div>";C[B++]="</div>";this.sigmaOptionsDialogTemplate=C.join("");C=[];B=0;C[B++]='<div class="searchBar">';C[B++]='<div class="searchBarInner">';C[B++]='<form action="search" method="get" style="float:left;padding:0;margin:0;">';C[B++]='<input style="float:left; width:275px; border:1px solid #A1C98B; height:19px;" id="q" onfocus="this.select(); return true;" type="text" name="q" size="45" />';C[B++]="</form>";C[B++]='<div class="topButton" style="float:left;">';C[B++]='<a class="moreSources" ><span>Add More Info</span></a>';C[B++]="</div>";C[B++]='<div class="topButton" style="float:left;">';C[B++]='<a class="newSigma" ><span>Start New</span></a>';C[B++]="</div>";C[B++]='<div class="menuButton" style="float:right;margin-top:0.4em;" >';C[B++]='<a class="permLinkSourcesBoxButton action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-link">&nbsp;</span>Use it</a>';C[B++]="</div>";C[B++]='<div class="menuButton" style="float:right;margin-top:0.4em; position:relative;" >';C[B++]='<a class="sigmaOptions action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-gear"></span>Options</a>';C[B++]='<div style="display:none;" class="sigmaOptionsContainer">';C[B++]="XXXX"+this.sigmaOptionsDialogTemplate+"XXX";C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="menuButton" style="float:right;margin-top:0.4em;" >';C[B++]='<a class="reorderPropertiesOn action-button ui-state-default action-button-icon-right ui-corner-all"><span class="ui-icon ui-icon-arrow-4-diag"></span>Order</a>';C[B++]="</div>";C[B++]='<div style="clear:both;"></div>';C[B++]="</div>";C[B++]="</div>";this.searchTemplate=C.join("");C=[];B=0;C[B++]='<div class="searchBar">';C[B++]='<form action="search" method="get">';C[B++]='<input style="float:left; width:275px; border:2px solid #A1C98B;" id="q" onfocus="this.select(); return true;" type="text" name="q" size="45" />';C[B++]="</form>";C[B++]='<div class="topButton">';C[B++]='<a href="javascript:void(0);"><span>Search</span></a>';C[B++]="</div>";C[B++]='<div style="clear:both"></div>';C[B++]="</div>";this.fakeSearchTemplate=C.join("");C=[];B=0;C[B++]='<div class="fullBorder" >';C[B++]='<div  class="column span-6a">';C[B++]="<p>";C[B++]='<a href="">Home</a> |';C[B++]='<a href="help.html">Help</a> |';C[B++]='<a href="http://sindice.com/main/forum">Forum</a>';C[B++]="</p>";C[B++]="</div>";C[B++]='<div style="text-align: right" class="column span-6 last">';C[B++]='<div class="fl" style="margin-top:10px;">';C[B++]='<a href="http://blog.sindice.com">Blog</a> |';C[B++]='<a href="http://sindice.com/developers/feedback">Contact</a> |';C[B++]="Copyright &copy; 2009 - Powered by ";C[B++]="</div>";C[B++]='<div class="fl" style="margin:9px 4px 0 4px;">';C[B++]='<a href="http://sindice.com/"><img title="Sindice" src="images/logo/sindice.png" alt="sindice logo"/></a> ';C[B++]="</div>";C[B++]='<div class="fl" style="margin:10px 4px 0 0;">';C[B++]='and other services. See <a href="about.html">About</a>.';C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]="</div>";this.footerTemplate=C.join("");C=[];B=0;C[B++]='<div class="sigmaee_coverLight"><!-- --></div>';C[B++]='<div class="sigmaee_coverDark"><!-- --></div>';this.invisibleElementsTemplate=C.join("");C=[];B=0;C[B++]='<div class="ecsseProfileBox">';C[B++]='<div style="display:none;" class="expandToFullView">See all we know about "<span id="fullSigmaView"></span>" with the <a href="" target="_blank">Full Sigma Search</a></div>';C[B++]='<div class="ecsseProfileBoxInner">';C[B++]='<div class="ecsseProfile ecsseWidgetLoading">';C[B++]=C[B++]='<div class="br"></div>';C[B++]='<div style="display:none; margin:8px;" class="sigmaee_sigmaOptionsContainer">';C[B++]=this.sigmaOptionsDialogTemplate;C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]=this.reorderPropertiesIndicator;C[B++]='<div style="display:none;" class="layout1TopLabelContainer layout2TopLabelContainer  entityLabel entityLabelStyle" />';C[B++]='<div style="display:none;" class="layout1TopPictureContainer layout1TopCommentContainer entityPictureAndComment entityPictureAndCommentStyle">';C[B++]='<img style="display:none;" class="entityPicture entityPictureStyle" />';C[B++]='<p style="display:none;" class="entityComment entityCommentStyle"></p>';C[B++]='<div class="br"></div>';C[B++]='<div class="separator" />';C[B++]="</div>";C[B++]=this.noResultsIndicator;C[B++]=this.soloIndicator;C[B++]='<div class="br"></div>';C[B++]='<div class="profileLeft profileLeftInvisible">';C[B++]='<div style="display:none;" class="layout2TopPictureContainer  entityPictureAndComment entityPictureAndCommentStyle">';C[B++]='<img style="display:none;" class="entityPicture entityPictureStyle" />';C[B++]='<div class="br"></div>';C[B++]="</div>";C[B++]="</div>";C[B++]='<div class="profileRight profileRightStyle">';C[B++]="</div>";C[B++]='<div class="br"></div>';C[B++]='<div class="howToLearnMessage"></div>';C[B++]="</div>";C[B++]="</div>";C[B++]="</div>";this.profileBoxTemplate=C.join("");this.sourcesTabsIndicators='<div id="fetchingIndicator" ><a class="action-button ui-state-default action-button-icon-right ui-corner-all">Pending <img src="images/icons/sources-ajax-loader.gif"></a></div><div id="filterIndicator" class="filtered">Sources filtered for <span></span>:<br /><span></span><div style="margin:0.2em;"><a class="removeSourcesFilterBoxButton action-button ui-state-error action-button-icon-right ui-corner-all" href="javascript:void(0);"><span class="ui-icon ui-icon-unlocked"/>'+this.config.unfilterButtonLabel+"</a></div></div>";this.sourcesTabsContent1='<ul id="'+this.config.sigmaNewSourcesListId+'"></ul><div class="fl sigmaPaginationContainer"><div id="sourcesPagination" class="sigmaPagination"></div></div><div class="fr" style="margin-top:2px;"><div class="fr smallSearchBoxButton" style="margin-left:1px;"><button class="approveAllSources">approve all</button></div><div class="fr smallSearchBoxButton" style="margin-left:1px;"><button class="rejectAllSources">reject all</button></div></div><div class="br"></div><div style="margin-top:1px;"><div class="fl"><input type="text" class="ui-widget-content ui-corner-all" id="addNewSourceFromUrlInput" value="http://example.loc/document.rdf" /></div><div class="fr smallSearchBoxButton"><button class="addNewSourceFromUrlButton">add source url</button></div></div><div class="br"></div>';this.sourcesTabsContent2='<ul id="'+this.config.sigmaApprovedSourcesListId+'"></ul><div class="fl sigmaPaginationContainer"><div id="approvedSourcesPagination" class="sigmaPagination"></div></div><div class="br"></div>';this.sourcesTabsContent3='<ul id="'+this.config.sigmaRejectedSourcesListId+'"></ul><div class="fl sigmaPaginationContainer"><div id="bannedSourcesPagination" class="sigmaPagination"></div></div><div class="br"></div>';}function SigmaUIValue(I,H){this.value=I;this.engine=H;this.engine.idToValueRender.set(this.value.elementID,this);this.containerIdXPath="#"+this.value.elementID;this.valuesContainerIdXPath="#"+this.value.property.elementID+"__";this.propertyName=this.value.property.name;this.pictureSrc=null;if(!this.engine.disableInitialNotifications){var C=null;var B=this.engine.config.customRenderedProperties.indexOf(this.value.property.name)!==-1&&this.value.property.name!="picture";this.html=[];this.I=0;var F=this.value.property.displayMode;var G=this.value.property.entity.pageLayout;var D="valueContainer "+this.engine.config.viewsClasses[G][F].valueContainer;var K="valueLabelContainer "+this.engine.config.viewsClasses[G][F].valueLabelContainer;this.html[this.I++]='<div id="'+this.value.elementID+'" class="'+D+'">';this.html[this.I++]='<div class="'+K+'">';if(this.value.property.name==="picture"){var A=this.value.uris[0]?this.value.uris[0]:this.value.value;this.pictureId=sigmaUtilities.randomString();this.pictureSrc=A;this.html[this.I++]='<img id="'+this.pictureId+'" class="imgValue" src="" />';}else{if(B){C=this.value.getWebLink();if(C==null){C=this.value.label?this.value.label:this.value.value;if(C&&!C.startsWith("mailto:")){C="mailto:"+C;}}this.html[this.I++]='<a class="label '+this.engine.config.sigmaeeUIlink+'" href="'+C+'">'+C.substring("mailto:".length).replace(/\[dot\]/gi,".").replace(/\[at\]/gi,"@")+"</a>";}else{this.html[this.I++]='<span class="label" />';}}if(this.engine.config.showHideSourcesNumbers===true){this.html[this.I++]='<span class="sourcesGraphicsIndicator" />';}else{this.html[this.I++]='<span style="display:none;" class="sourcesGraphicsIndicator" />';}this.html[this.I++]="</div>";this.html[this.I++]="</div>";jQuery(this.valuesContainerIdXPath).append(this.html.join(""));if(this.pictureSrc!=null){this.bindPictureFunction();}if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){this.updateLabel();}this.value.requestLabel();this.engine.fixValuesContainerWidth(this.value.property);this.engine.fixHeight();if(B&&C===null){log.warn("there was undefined href for value for property"+this.value.property.name+". Such value will be hidden");this.value.hide();}if(G==="layout2"&&F==="compact"){var E=this.value.property.getNumberOfActiveValues();if(E>=3){this.value.hiddenByDisplayMode=true;this.hiddenByDisplayMode(true);}var J=this.value.property.getNumberOfHiddenByDisplayModeValues();if(J>0){this.updateHiddenByCompactModeNumber(J);}}}}SigmaUIValue.prototype.triggerPictureLoadFunction=function(){var A=this.engine;var C=this.value.property.displayMode;var B=this.value.property.entity.pageLayout;jQuery("#"+this.pictureId).each(function(){log.error("layout][mode"+B+" "+C);A.config.pictureFunctions[B][C].loadFunction(this);});};SigmaUIValue.prototype.bindPictureFunction=function(){var A=this.engine;var C=this.value.property.displayMode;var B=this.value.property.entity.pageLayout;jQuery("#"+this.pictureId).load(function(){log.error("trigger load function for "+this.pictureSrc);A.config.pictureFunctions[B][C].loadFunction(this);}).error(function(){log.error("trigger error function for "+this.pictureSrc);A.config.pictureFunctions[B][C].errorFunction(this);}).attr("src",this.pictureSrc);};SigmaUIValue.prototype.updateHiddenByCompactModeNumber=function(B){log.info("updateHiddenByCompactModeNumber: ["+B+"]");var A=jQuery("#"+this.value.elementID).parent().parent();if(A.find("div.moreButtonCompactView").length===0){A.find("div.valuesContainer").append(this.engine.templates.moreValuesCompactViewButtonTemplate.replace("@number@",B));}else{A.find("div.moreButtonCompactView").replaceWith(this.engine.templates.moreValuesCompactViewButtonTemplate.replace("@number@",B));}};SigmaUIValue.prototype.updateLabel=function(){var A="";var B="";if(this.value.getSigmaLink()){A+='<a class="label '+this.engine.config.sigmaeeUIlink+'" target="blank" href="'+this.value.getSigmaLink()+'">';}else{A+='<span class="label">';}if(this.value.label){B=this.value.label;}else{if(this.value.value){B=this.value.value;}else{if(this.value.getWebLink()){B=this.value.getWebLink();}else{B="[?]";}}}A+=B;if(this.value.getSigmaLink()){A+="</a>";}else{A+="</span>";}jQuery(this.containerIdXPath+" .label").replaceWith(A);if(B==="[?]"){this.value.hide();}};SigmaUIValue.prototype.loading=function(A){log.info("notify value loading observer with: "+A);if(A===true){jQuery(this.containerIdXPath+" img.loading").show();}else{jQuery(this.containerIdXPath+" img.loading").hide();}};SigmaUIValue.prototype.labelUpdated=function(A){this.loading(false);jQuery(this.containerIdXPath).attr("title","label updated with success");if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){log.info("call updateLabel from labelUpdated");this.updateLabel();}};SigmaUIValue.prototype.labelUpdateError=function(A){this.loading(false);jQuery(this.containerIdXPath+" div.valueLabelContainer").attr("title",A);if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){log.info("call updateLabel from labelUpdateErrror");this.updateLabel();}};SigmaUIValue.prototype.highlightChanged=function(A){log.info("highlightChanged ["+A+"]");if(A===true){jQuery(this.containerIdXPath+" div.valueLabelContainer").addClass(this.engine.config.sigmaeeUIhighlight).addClass(this.engine.config.sigmaeeUIhighlightCorners);}else{jQuery(this.containerIdXPath+" div.valueLabelContainer").removeClass(this.engine.config.sigmaeeUIhighlight).removeClass(this.engine.config.sigmaeeUIhighlightCorners);}};SigmaUIValue.prototype.activityChanged=function(A){if(A===true){jQuery(this.containerIdXPath).show();}else{jQuery(this.containerIdXPath).hide();}};SigmaUIValue.prototype.confirmed=function(A){};SigmaUIValue.prototype.rejected=function(A){};SigmaUIValue.prototype.hidden=function(A){log.info("HIDDEN value for property ["+this.value.property.name+"]["+A+"]");if(A===true){jQuery("#"+this.value.elementID).hide();if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"']").length===0){jQuery("div.sigmaTrashBinDialog ul.properties").append('<li class="property" title="'+this.value.property.elementID+'" ><div class="name">'+this.value.property.name+':</div><div class="values"><ul class="values"></ul></div></li>');}if(jQuery("div.sigmaTrashBinDialog ul.values li[title='"+this.value.elementID+"']").length===0){var B=jQuery("#"+this.value.elementID+" div.valueLabelContainer").html();jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"'] ul.values").append('<li class="value" title="'+this.value.elementID+'" >'+B+"</li>");}}else{jQuery("#"+this.value.elementID).show();jQuery("div.sigmaTrashBinDialog ul.values li[title='"+this.value.elementID+"'] ").remove();if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"'] ul li").length===0){jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.value.property.elementID+"']").remove();}}};SigmaUIValue.prototype.hiddenByDisplayMode=function(A){if(A===true){jQuery(this.containerIdXPath).hide();}else{jQuery(this.containerIdXPath).show();}};SigmaUIValue.prototype.numberOfSourcesChanged=function(A,B){html=this.engine.generateSourceNumbersString(this.value);jQuery(this.containerIdXPath+" span.sourcesGraphicsIndicator").html(html);};SigmaUIValue.prototype.merged=function(){if(this.engine.config.customRenderedProperties.indexOf(this.value.property.name)===-1){log.info("call updateLabel from merged");this.updateLabel();}};SigmaUIValue.prototype.removedByMerging=function(A){jQuery(this.containerIdXPath).remove();};function SigmaUIProperty(H,A,G){this.property=H;this.engine=G;this.engine.idToPropertyRender.set(this.property.elementID,this);this.containerIdXPath="#"+this.property.elementID;if(!this.engine.disableInitialNotifications){this.html=[];this.I=0;var C=this.property.displayMode;var D=this.property.entity.pageLayout;var B="entityContainer "+this.engine.config.viewsClasses[D][C].entityContainer;var E="propertyContainer "+this.engine.config.viewsClasses[D][C].propertyContainer;var F="propertyLabelContainer "+this.engine.config.viewsClasses[D][C].propertyLabelContainer;var J="valuesContainer "+this.engine.config.viewsClasses[D][C].valuesContainer;var I="separatorContainer "+this.engine.config.viewsClasses[D][C].separatorContainer;this.html[this.I++]='<div style="display:none;" id="'+this.property.elementID+'" class="'+B+'">';this.html[this.I++]='<div id="'+randomString()+'" class="'+E+'">';this.html[this.I++]='<div class="'+F+'" title="'+this.property.name+'">';this.html[this.I++]='<span class="name fr">'+decodeURIComponent(this.property.name).toLowerCase()+":</span>";if(G.config.dragMode==true){this.html[this.I++]='<span class="dragMeOn fr ui-icon ui-icon-arrow-4-diag"></span>';this.html[this.I++]='<span class="dragMeOff fr"></span>';}this.html[this.I++]="</div>";this.html[this.I++]="</div>";if(G.config.inReorderPropertiesMode===true){this.html[this.I++]='<div id="'+this.property.elementID+'__" class="'+J+'" style="display:none;">';}else{this.html[this.I++]='<div id="'+this.property.elementID+'__" class="'+J+'">';}this.html[this.I++]="</div>";this.html[this.I++]="</div>";if(A){jQuery("#"+A).before(this.html.join(""));}else{jQuery(".profileRight").append(this.html.join(""));}if(this.property.inSingleMode===true){jQuery(this.containerIdXPath+" a.allValuesProperty").show();}else{jQuery(this.containerIdXPath+" a.topValueProperty").show();}}}SigmaUIProperty.prototype.unfetchedValueCountChanged=function(B){if(B>0){var A="";if(jQuery("#"+this.property.elementID+"__ div.valueContainer:visible").length>0){if(B===1){A=" "+B+" more value ";}else{if(B>1&&B<10){A=" "+B+" more values";}else{A=B+" more values";}}}else{if(B===1){A=" "+B+" value ";}else{if(B>1&&B<10){A=" "+B+" values";}else{A=B+" values";}}}jQuery("#"+this.property.elementID+" div.valuesContainer div.unfetchedValuesButton").remove();jQuery("#"+this.property.elementID+" div.valuesContainer").append(this.engine.templates.unfetchedValuesButtonTemplate.replace("@n@",A));}else{jQuery("#"+this.property.elementID+" div.valuesContainer div.unfetchedValuesButton").remove();}};SigmaUIProperty.prototype.highlightChanged=function(A){log.info("property highlightChanged ["+A+"]");if(A===true){jQuery(this.containerIdXPath+" div.propertyLabelContainer").addClass(this.engine.config.sigmaeeUIhighlight).addClass(this.engine.config.sigmaeeUIhighlightCorners).find("span.dragMeOff").hide().end().find("span.dragMeOn").show();}else{jQuery(this.containerIdXPath+" div.propertyLabelContainer").removeClass(this.engine.config.sigmaeeUIhighlight).removeClass(this.engine.config.sigmaeeUIhighlightCorners).find("span.dragMeOn").hide().end().find("span.dragMeOff").show();}};SigmaUIProperty.prototype.valueAdded=function(A){if(!A.rejected){jQuery(this.containerIdXPath).removeClass("rejected");}A.addObserver(new SigmaUIValue(A,this.engine));A.property.notifyObservers("unfetchedValueCountChanged",A.property.countUnfetchedValues());};SigmaUIProperty.prototype.lastValueRejected=function(){jQuery(this.containerIdXPath).addClass("rejected");};SigmaUIProperty.prototype.hidden=function(A){log.info("CALL hidden for property ["+this.property.name+"]["+A+"] ");if(A===true){jQuery("#"+this.property.elementID).hide();if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.property.elementID+"']").length===0){jQuery("div.sigmaTrashBinDialog ul.properties").append('<li class="property" title="'+this.property.elementID+'" ><div class="name">'+this.property.name+':</div><div class="values"><ul class="values"></ul></div></li>');}}else{if(jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.property.elementID+"'] ul.values li").length===0){log.error("removing property from the bin because there is no values ");jQuery("div.sigmaTrashBinDialog ul.properties li[title='"+this.property.elementID+"']").remove();}jQuery("#"+this.property.elementID).show();}};SigmaUIProperty.prototype.movedBefore=function(A,E){var C=this.engine.profile.getProperty(A);if(C){var B=C.elementID;log.debug("notification sent "+this.property.name+" before "+A+"withID: "+B);var D=jQuery("#"+this.property.elementID);D.clone(true).insertBefore("#"+B);D.remove();}};SigmaUIProperty.prototype.activityChanged=function(A){if(A===true){jQuery(this.containerIdXPath).show();}else{jQuery(this.containerIdXPath).hide();}};SigmaUIProperty.prototype.clearPropertyView=function(){var A={};var B;for(var C in this.engine.config.viewsClasses){if(this.engine.config.viewsClasses.hasOwnProperty(C)){var D=this.engine.config.viewsClasses[C];for(var F in D){if(D.hasOwnProperty(F)){var E=D[F];for(B in E){if(E.hasOwnProperty(B)){if(!A[B]){A[B]="";}A[B]+=" "+E[B];}}}}}}for(B in A){if(A.hasOwnProperty(B)){A[B]=A[B].split(" ").unique().join(" ");}}jQuery("#"+this.property.elementID).removeClass(A.entityContainer).find("div.valueButtonsContainer").removeClass(A.valueButtonsContainer).end().find("div.propertyButtonsContainer").removeClass(A.propertyButtonsContainer).end().find("div.propertyContainer").removeClass(A.propertyContainer).find("div.propertyLabelContainer").removeClass(A.propertyLabelContainer).end().end().find("div.valuesContainer").removeClass(A.valuesContainer).find("div.valueContainer").removeClass(A.valueContainer).find("div.valueLabelContainer").removeClass(A.valueLabelContainer);};SigmaUIProperty.prototype.displayModeChanged=function(D){var B=this.engine;var C=this.property.entity.pageLayout;this.clearPropertyView();var A=jQuery("#"+this.property.elementID);A.addClass(B.config.viewsClasses[C][D].entityContainer).find("div.propertyContainer").addClass(B.config.viewsClasses[C][D].propertyContainer).find("div.propertyLabelContainer").addClass(B.config.viewsClasses[C][D].propertyLabelContainer).end().end().find("div.valuesContainer").addClass(B.config.viewsClasses[C][D].valuesContainer).find("div.valueContainer").addClass(B.config.viewsClasses[C][D].valueContainer).find("div.valueLabelContainer").addClass(B.config.viewsClasses[C][D].valueLabelContainer);A.find("div.propertyButtonsContainer").addClass(B.config.viewsClasses[C][D].propertyButtonsContainer).end().find("div.valueButtonsContainer").addClass(B.config.viewsClasses[C][D].valueButtonsContainer);B.fixValuesContainerWidth(this.property);if(this.property.name==="picture"){A.find("div.valueContainer").each(function(){var E=jQuery(this).attr("id");var F=B.idToValueRender.get(E);F.triggerPictureLoadFunction();});}if(C==="layout1"){this.displayModeChangedLayout1(D);}else{if(C==="layout2"){this.displayModeChangedLayout2(D);}else{if(C==="layout3"){this.displayModeChangedLayout3(D);}else{log.error("WRONG LAYOUT ["+C+"]!!!");}}}};SigmaUIProperty.prototype.displayModeChangedLayout1=function(D){var B=this.engine;var A=jQuery("#"+this.property.elementID);var C=this.property.entity.pageLayout;if(D==="compact"){A.find("div.valueContainer").each(function(){valueID=jQuery(this).attr("id");render=B.idToValueRender.get(valueID);if(render.value.hiddenByDisplayMode===true){render.value.hiddenByDisplayMode=false;render.hiddenByDisplayMode(false);}});A.find("div.moreButtonCompactView").remove();}else{if(D==="list"){A.find("div.valueContainer").each(function(){valueID=jQuery(this).attr("id");render=B.idToValueRender.get(valueID);if(render.value.hiddenByDisplayMode===true){render.value.hiddenByDisplayMode=false;render.hiddenByDisplayMode(false);}});A.find("div.moreButtonCompactView").remove();}else{if(D==="single"){A.find("div.valueContainer").each(function(){valueID=jQuery(this).attr("id");render=B.idToValueRender.get(valueID);if(render.value.hiddenByDisplayMode===true){render.value.hiddenByDisplayMode=false;render.hiddenByDisplayMode(false);}});A.find("div.moreButtonCompactView").remove();}else{if(D==="hidden"){A.find("div.moreButtonCompactView").remove();}else{log.debug("displayModeChanged - wrong mode ["+D+"]");}}}}};SigmaUIProperty.prototype.displayModeChangedLayout2=function(G){var E=this.engine;var F=this.property.entity.pageLayout;var B=jQuery("#"+this.property.elementID);var C=0;var D,A;if(G==="compact"){C=0;B.find("div.valueContainer").each(function(){A=jQuery(this).attr("id");D=E.idToValueRender.get(A);if(D.value.active===true){C++;}if(C>3){D.value.hiddenByDisplayMode=true;D.hiddenByDisplayMode(true);}});if(C>3){log.info("there were ["+C+"] values 3 are displayed ["+(C-3)+"] was hidden");D.updateHiddenByCompactModeNumber(C-3);}}else{if(G==="list"){C=0;B.find("div.valueContainer").each(function(){A=jQuery(this).attr("id");D=E.idToValueRender.get(A);if(C>=3){D.value.hiddenByDisplayMode=false;D.hiddenByDisplayMode(false);}C++;});if(C>=3){B.find("div.moreButtonCompactView").remove();}}else{if(G==="single"){B.find("div.valueContainer").each(function(){A=jQuery(this).attr("id");D=E.idToValueRender.get(A);D.value.hiddenByDisplayMode=false;D.value.updateActivityState();});B.find("div.moreButtonCompactView").remove();}else{if(G==="hidden"){B.find("div.moreButtonCompactView").remove();}else{log.debug("displayModeChanged - wrong mode ["+G+"]");}}}}};SigmaUIProperty.prototype.displayModeChangedLayout3=function(D){var B=this.engine;var C=this.property.entity.pageLayout;var A=jQuery("#"+this.property.elementID);};SigmaUIProperty.prototype.stickToPreviousChange=function(A){if(!A){A=this.property.getStickToPreviousMode();}log.debug("stickToPreviousChange to "+A);if(A==1){jQuery("#"+this.property.elementID).removeClass("entityNotSticky").addClass("entitySticky");jQuery("#"+this.property.elementID).find("div.propertyContainer").width("auto");}else{if(A==2){jQuery("#"+this.property.elementID).removeClass("entitySticky").addClass("entityNotSticky");jQuery("#"+this.property.elementID).find("div.propertyContainer").width(140);}else{jQuery("#"+this.property.elementID).removeClass("entitySticky").addClass("entityNotSticky");jQuery("#"+this.property.elementID).find("div.propertyContainer").width("auto");}}this.engine.fixValuesContainerWidth(this.property);};function SigmaUISource(C,H){this.engine=H;this.containerId=randomString();this.engine.idToSourceRender.set(this.containerId,this);this.source=C;this.containerIdXPath="#"+this.containerId;this.source.elementId=this.containerId;this.source.elementIdXPath="#"+this.containerId;var J=this.source.sourceLabel?this.source.sourceLabel:this.source.sourceURI;var D='<li class="source sourceCss" id="'+this.containerId+'"><div class="sourceContainerRel" ><div class="sourceButtons ui-corner-top '+this.engine.config.sigmaeeUIhighlight+'">'+this.engine.templates.dehighlightButtonTemplate+this.engine.templates.highlightButtonTemplate+this.engine.templates.approveButtonTemplate+this.engine.templates.confirmSourceFromTheSameDomainButtonTemplate+this.engine.templates.rejectButtonTemplate+this.engine.templates.rejectSourceFromTheSameDomainButtonTemplate+"</div>";var E='<li class="source confirmed" id="'+this.containerId+'"><div class="sourceContainerRel" ><div class="sourceButtons ui-corner-top '+this.engine.config.sigmaeeUIhighlight+'">'+this.engine.templates.dehighlightButtonTemplate+this.engine.templates.highlightButtonTemplate+this.engine.templates.unapproveButtonTemplate+this.engine.templates.rejectButtonTemplate+"</div>";var B='<li class="source rejected" id="'+this.containerId+'"><div class="sourceContainerRel" ><div class="sourceButtons ui-corner-top '+this.engine.config.sigmaeeUIhighlight+'">'+this.engine.templates.dehighlightButtonTemplate+this.engine.templates.highlightButtonTemplate+this.engine.templates.unrejectSourceButtonTemplate+"</div>";var F='<div class="sourceInfo" ><div class="sourceLabel fl"><b title="'+this.source.getIndex()+'">'+this.source.getIndex()+'</b> <a href="'+this.source.sourceURI+'" class="link '+this.engine.config.sigmaeeUIlink+'">';if(J.length>24){F+=J.substring(0,24)+"...";}else{F+=J;}F+='</a></div><div class="sourceDetails fl">';F+=this.source.valueCount+" facts | "+this.source.date+'</div><div class="br"></div></div><div class="fullURI">';var K=0;if(this.source.searchProvider&&this.source.searchProvider.icon!=undefined&&this.source.searchProvider.icon!=""){if(this.source.searchProvider.icon.indexOf("http://")===0){var A=this.source.searchProvider.icon;}else{var A="images/icons/"+this.source.searchProvider.icon;}F+='<a href="javascript:void(0);"  class="providerLogo" style="background: transparent url(\''+A+'\') no-repeat scroll center left;" title="'+this.source.searchProvider.dataProviderName+'">';K=10;}var G=boldDomain(this.source.domain,this.source.sourceURI);var I=58-K;if(G.length>I){G=G.substring(0,I)+"...";}F+='<small title="'+this.source.sourceURI+'">'+G+'</small> <a class="cachedSource link '+this.engine.config.sigmaeeUIlink+'" href="http://sindice.com/search/page?url='+encodeURIComponent(this.source.sourceURI)+'" target="_blank">(cache)</a>';F+='<span class="altrnativeUrlsFromOkkam"</span>';F+="</div></div></li>";this.newHtml=D+F;this.confirmedHtml=E+F;this.rejectedHtml=B+F;this.engine.opts.itemsNo++;this.engine.renderNNewSources();}SigmaUISource.prototype.addOkkamLogo=function(){if(jQuery(this.containerIdXPath+" .fullURI a.okkam").length==0){jQuery(this.containerIdXPath+" .fullURI small").before('<a href="javascript:void(0);" class="okkam" />');}};SigmaUISource.prototype.urlsFromOkkamAdded2=function(){var A=this.source.alternativeUrlsFromOkkam;if(A!=null){if(this.source.alternativeUrlsFromOkkamFetched===2){jQuery(this.containerIdXPath+" span.altrnativeUrlsFromOkkam").html('<a class="okkamEnd">'+A.length+" more sources via</a>").attr("title",A).show();jQuery(this.containerIdXPath+" span.altrnativeUrlsFromOkkam a.okkamEnd").click();jQuery(this.containerIdXPath+" span.altrnativeUrlsFromOkkam").html('<span class="okkamEnd">'+A.length+" sources via OKKAM fetched</span>").css("text-decoration","line-through").attr("title",A).show();}else{if(this.source.alternativeUrlsFromOkkamFetched===3){jQuery(this.containerIdXPath+" span.altrnativeUrlsFromOkkam").html('<span class="okkamEnd">'+A.length+" sources via OKKAM fetched</span>").css("text-decoration","line-through").attr("title",A).show();}}}};SigmaUISource.prototype.showIndicator=function(A){jQuery("#indicator").toggle(A);};SigmaUISource.prototype.increaseSourcesNoOnTab=function(A){var B=parseInt(jQuery("#"+A).html(),10);jQuery("#"+A).html(B+1);};SigmaUISource.prototype.decreaseSourcesNoOnTab=function(A){var B=parseInt(jQuery("#"+A).html(),10);jQuery("#"+A).html(B-1);};SigmaUISource.prototype.highlightChanged=function(A){if(A){jQuery(this.containerIdXPath).closest("ul").find("li."+this.engine.config.sigmaeeUIhighlight).removeClass(this.engine.config.sigmaeeUIhighlight).removeClass(this.engine.config.sigmaeeUIhighlightCorners).end().find("div.sourceButtons").removeClass(this.engine.config.sigmaeeUIhighlight).hide();jQuery(this.containerIdXPath).addClass(this.engine.config.sigmaeeUIhighlight).addClass(this.engine.config.sigmaeeUIhighlightCorners).find("div.sourceButtons").addClass(this.engine.config.sigmaeeUIhighlight).show().end().find(".cachedSource").show();}else{jQuery(this.containerIdXPath).removeClass(this.engine.config.sigmaeeUIhighlight).removeClass(this.engine.config.sigmaeeUIhighlightCorners).find("div.sourceButtons").hide().end().find(".cachedSource").hide();}};SigmaUISource.prototype.rejected=function(B){var A=this;this.showIndicator(true);this.engine.hideHighlighted();this.engine.removePropertyAndValueFilter();this.source.highlight(false);this.engine.opts.itemsNo=this.engine.profile.getNumberOfNewSources();this.engine.optsApproved.itemsNo=this.engine.profile.getNumberOfApprovedSources();this.engine.optsRejected.itemsNo=this.engine.profile.getNumberOfRejectedSources();this.engine.updatePaginationOnTab1();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.opts)===true){this.engine.updatePaginationOnTab1();}this.engine.updatePaginationOnTab2();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsApproved)===true){this.engine.updatePaginationOnTab2();}this.engine.updatePaginationOnTab3();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsRejected)===true){this.engine.updatePaginationOnTab3();}this.showIndicator(false);};SigmaUISource.prototype.findSourceByIndex=function(A){return jQuery("#ecsse-sources-list-page li div div div b[title='"+A+"']").parent().parent().parent().parent();};SigmaUISource.prototype.confirmed=function(B){var A=this;this.showIndicator(true);this.engine.hideHighlighted();this.engine.removePropertyAndValueFilter();this.source.highlight(false);this.engine.opts.itemsNo=this.engine.profile.getNumberOfNewSources();this.engine.optsApproved.itemsNo=this.engine.profile.getNumberOfApprovedSources();this.engine.optsRejected.itemsNo=this.engine.profile.getNumberOfRejectedSources();this.engine.updatePaginationOnTab1();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.opts)===true){this.engine.updatePaginationOnTab1();}this.engine.updatePaginationOnTab2();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsApproved)===true){this.engine.updatePaginationOnTab2();}this.engine.updatePaginationOnTab3();if(this.engine.checkAreThereAnyItemsOnCurrentPage(this.engine.optsRejected)===true){this.engine.updatePaginationOnTab3();}this.showIndicator(false);};SigmaUISource.prototype.updateSoloStatus=function(){};function SigmaUIEngine(A){this.profile=null;this.config=new SigmaUIConfig(A);this.templates=new SigmaUITemplates(this.config);this.idToSourceRender=new Map();this.idToPropertyRender=new Map();this.idToValueRender=new Map();}SigmaUIEngine.prototype.setRawFlag=function(A){A=new Boolean(A).valueOf();if(this.config.rawFlag===A){return ;}this.config.rawFlag=A;};SigmaUIEngine.prototype.setProfile=function(A){this.profile=A;};SigmaUIEngine.prototype.setEmbededMode=function(A){this.config.embededMode=A;};SigmaUIEngine.prototype._createCacheProviderSelect=function(B,A){var D='<select class="sigmaee_propertySelect">';D+='<option value="----" >----</option>';for(var C=0;C<B.availableCacheProviders.length;C++){var E=B.availableCacheProviders[C].dataProviderName;if(A===E){D+='<option value="'+E+'" selected="selected">'+E+"</option>";}else{D+='<option value="'+E+'" >'+E+"</option>";}}D+="</select>";return D;};SigmaUIEngine.prototype.updateConfiguration=function(A){jQuery(".sigmaee_simpleConfig").html(this._renderSimpleProvidersConfiguration(A));jQuery(".sigmaee_cacheConfig").html(this._renderProvidersConfiguration(A,"CacheProvider"));jQuery(".sigmaee_searchConfig").html(this._renderProvidersConfiguration(A,"SearchProvider"));jQuery(".sigmaee_lookupConfig").html(this._renderProvidersConfiguration(A,"LookupProvider"));};SigmaUIEngine.prototype._renderSimpleProvidersConfigurationPart=function(D,F,C){var B="<b>"+F+':</b><table><tr><th style="width:25%">name</th><th style="width:10%">enabled</th><th>description</th><th style="width:15%">remove</th></tr>';for(var A=0;A<D.length;A++){var E=D[A];B+="<tr "+(E.temporary===true?'class="temporary"':"")+' typeof="ee:'+C+'" about="#'+E.dataProviderName+'"><td>'+E.dataProviderName+'</td><td datatype="xsd:boolean" property="ee:active" class="'+(E.active===true?"sigmaee_enabled":"sigmaee_disabled")+'">'+E.active+"</td><td>"+(E.temporary===true?"added by the user":E.label)+"</td><td>"+(E.temporary===true?'<a href="" class="removeDataProvider">click to remove</a>':"not removable")+"</td>";"</tr>";}return B+"</table>";};SigmaUIEngine.prototype._renderSimpleProvidersConfiguration=function(B){var F=function(H,G){var L=H.temporary===true?true:false,K=G.temporary===true?true:false;if(L&&!K){return 1;}if(!L&&K){return -1;}var J=H.dataProviderName.toLowerCase(),I=G.dataProviderName.toLowerCase();if(J<I){return -1;}if(J>I){return 1;}return 0;};var E=B.availableCacheProviders.slice(0);var D=B.availableSearchProviders.slice(0);var A=B.availableLookupProviders.slice(0);E=E.sort(F);D=D.sort(F);A=A.sort(F);var C=this._renderSimpleProvidersConfigurationPart(D,"Search Providers","SearchProvider")+this._renderSimpleProvidersConfigurationPart(A,"LookupProviders","LookupProvider");return C;};SigmaUIEngine.prototype._generateProviderName=function(){return"provider-"+randomString(3);};SigmaUIEngine.prototype._escapeHtmlEntities=function(B){var A=""+B;return A.replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/"/g,"&quot;");};SigmaUIEngine.prototype._renderProvidersConfiguration=function(D,E){var G;if(E=="CacheProvider"){G=D.availableCacheProviders;}else{if(E=="SearchProvider"){G=D.availableSearchProviders;}else{if(E=="LookupProvider"){G=D.availableLookupProviders;}else{throw"Not supported providerType";}}}var P=function(R,Q){var T=R.dataProviderName.toLowerCase(),S=Q.dataProviderName.toLowerCase();if(T<S){return -1;}if(T>S){return 1;}return 0;};var I=G.slice(0);I=I.sort(P);var H=0;var M;var J='<table class="sigmaeeCss_configTables">';for(var H=0;H<I.length;H++){M=I[H];var C="";if(M.temporary&&M.temporary===true){C="temporary";}J+='<tr class="sigmaee_single_provider"  ><td>';J+='<div style="position:relative;">';J+='<span class="deleteDataProvider sigmaeeCss_configBubble" >X</span>';J+='<span class="deleteDataTemporaryProvider sigmaeeCss_configBubbleDelete" >You can NOT remove predefined provider<br />But you can override parameter values <br>or switch it off using "active" flag.</span>';J+="<h1>"+M.dataProviderName+"</h1>";J+='<table about="#'+M.dataProviderName+'" typeof="ee:'+E+'" style="width:100%; table-layout:fixed;" class="'+C+'"><tr><th style="width:40%;">property</th><th style="width:55%; text-align:left;">value</th></tr><tr style="display:none;"><td rev="ee:dataSource" resource="#catalog"></td></tr>';for(var A in M){if(M.hasOwnProperty(A)){var B=M[A];var L=this._escapeHtmlEntities(M[A]);if(A==="active"){var N=M[A]?"sigmaee_enabled":"sigmaee_disabled";J+='<tr><td style="text-align:right;">'+A+'</td><td class="'+N+'"  property="ee:'+A+'" datatype="xsd:boolean" >'+M[A]+"</td></tr>";}else{if(A==="CacheProvider"){var F=jQuery(this._createCacheProviderSelect(D,M[A]));var O=jQuery("<div>").append(F.clone()).remove().html();var K="";if(M[A]!==""){K=' rel="ee:'+A+'" resource="'+D.baseURI+"#"+M[A]+'"';}J+='<tr><td style="text-align:right;">'+A+'</td><td class="" '+K+">"+O+"</td></tr>";}else{if(A==="dataProviderName"||A==="dataset"){}else{if(A=="temporary"){J+='<tr style="display:none;"   ><td">'+A+'</td><td  property="ee:'+A+'" datatype="xsd:boolean" content="'+M[A]+'">'+M[A]+"</td></tr>";}else{if(A=="priority"){J+='<tr><td style="text-align:right;">'+A+'</td><td class="" ><input type="text" class="sigmaee_propertyFloatInput" property="ee:'+A+'" datatype="xsd:float" content="'+M[A]+'" value="'+M[A]+'" /></td></tr>';}else{if(A=="label"){J+='<tr><td style="text-align:right;">'+A+'</td><td class="" ><input type="text" class="sigmaee_propertyStringInput" property="rdfs:'+A+'" content="'+M[A]+'" value="'+M[A]+'" /></td></tr>';}else{if(A==="sparqlKeywordSearchQuery"||A==="sparqlEntityLookupQuery"){J+='<tr><td  style="text-align:right;">'+A+'</td><td><textarea class="sigmaee_propertyStringInput" property="ee:'+A+'" value="'+L+'" content="'+L+'">'+L+"</textarea></td></tr>";}else{if(A=="dataProviderType"){J+='<tr><td style="text-align:right;">'+A+'</td><td class="" ><input type="text" readonly="readonly" class="sigmaee_propertyStringInput" property="ee:'+A+'" content="'+M[A]+'" value="'+M[A]+'" /></td></tr>';}else{J+='<tr><td style="text-align:right;">'+A+'</td><td class="" ><input type="text" class="sigmaee_propertyStringInput" property="ee:'+A+'" content="'+M[A]+'" value="'+M[A]+'" /></td></tr>';}}}}}}}}}}J+="</div></td></tr></table>";}return J+="</table>";};SigmaUIEngine.prototype.generateSourceNumbersString=function(H){var C=H.sources.length;var G=0;var D=0;for(D=0;D<C;D++){if(H.sources[D].isActive()){G++;}}var F=0;var B=[];var I=0;var A;B[I++]="[";for(D=0;D<C;D++){A=H.sources[D];if(A.isActive()){F++;var E=A.getIndex();if(A.rejected){B[I++]='<span class="rejected">'+E+"</span>";}else{if(A.confirmed){B[I++]='<span class="confirmed">'+E+"</span>";}else{B[I++]='<span class="new">'+E+"</span>";}}if(F!=G){B[I++]=",";}}}if(this.config.disableHoverOverValues==true){B[I++]='&nbsp; <a class="rejectValueSourcesEvaluation" title="'+H.elementID+'" href="" >reject sources</a>';}B[I++]="]";return B.join("");};SigmaUIEngine.prototype.enableOnResize=function(){var A=this;A.onResize(true);jQuery(window).resize(function(){A.onResize();});jQuery("#maincontent").change(function(){A.onResize(true);});};SigmaUIEngine.prototype.hideHighlighted=function(){jQuery("div."+this.config.sigmaeeUIhighlight).removeClass(this.config.sigmaeeUIhighlight);jQuery("div.propertyButtonsContainer").hide();jQuery("div.valueButtonsContainer").hide();};SigmaUIEngine.prototype.coverBorders=function(C,E){var A=jQuery(C).parent().attr("id");var D=jQuery(C).width();var F=jQuery(E).width();var B,J,H;var G,K,I;J=jQuery(C).offset().top;K=jQuery(C).offset().top;if(D>=F){H=jQuery(E).width();B=jQuery(E).offset().left+1;I=jQuery(C).width()-H;G=jQuery(C).offset().left+H;jQuery(C).removeClass("ui-corner-tl");jQuery(E).removeClass("ui-corner-br");}else{H=jQuery(C).width();B=jQuery(C).offset().left+1;I=jQuery(E).width()-H;G=jQuery(C).offset().left+H;H+=2*this.config.propertyOrValueSideMargin;jQuery(C).removeClass("ui-corner-tl ui-corner-tr");}jQuery(".sigmaee_coverLight").data("containerId",A).css({left:B,top:J,width:H}).show();};SigmaUIEngine.prototype.hideCovers=function(){jQuery(".sigmaee_coverLight").hide();jQuery(".sigmaee_coverDark").hide();};SigmaUIEngine.prototype.newPaginationCallback=function(C,A,D){var B=D.visibleListId;if(B==this.config.sigmaNewSourcesListId){this.opts.current_page=C;this.renderNNewSources();}else{if(B==this.config.sigmaApprovedSourcesListId){this.optsApproved.current_page=C;this.renderNApprovedSources();}else{if(B==this.config.sigmaRejectedSourcesListId){this.optsRejected.current_page=C;this.renderNRejectedSources();}else{log.error("Wrong listId");}}}return false;};SigmaUIEngine.prototype.renderNNewSources=function(C,E){var K=this;var F,A,G="",D,H=0,J=0;if(!E){E=this.opts.items_per_page;}if(!C){C=this.opts.current_page;}D=C*E;var I=[];for(F=0;F<this.profile.sources.length;F++){A=this.profile.sources[F];if(!A.confirmed&&!A.rejected&&!A.filteredOut){if(D>H){log.info("--- skipping one source skipped"+H);H++;continue;}else{J++;var B=K.idToSourceRender.get(A.elementId);G+=B.newHtml;I.push(F);}}if(J>=E){break;}}jQuery(this.config.sigmaNewSourcesListIdXPath).empty().append(G);if(sigmaConfig.useOkkam==true){this.appendOkkamLogo(I);}};SigmaUIEngine.prototype.renderNApprovedSources=function(B,D){var J=this;var E,A,F="",C,G=0,I=0;if(!D){D=this.optsApproved.items_per_page;}if(!B){B=this.optsApproved.current_page;}C=B*D;var H=[];for(E=0;E<this.profile.sources.length;E++){A=this.profile.sources[E];if(A.confirmed&&!A.rejected&&!A.filteredOut){if(C>G){G++;continue;}else{I++;render=J.idToSourceRender.get(A.elementId);F+=render.confirmedHtml;H.push(E);}}if(I>=D){break;}}jQuery(this.config.sigmaApprovedSourcesListIdXPath).empty().html(F);if(sigmaConfig.useOkkam==true){this.appendOkkamLogo(H);}};SigmaUIEngine.prototype.renderNRejectedSources=function(B,D){var J=this;var E,A,F="",C,G=0,I=0;if(!D){D=this.optsRejected.items_per_page;}if(!B){B=this.optsRejected.current_page;}C=B*D;var H=[];for(E=0;E<this.profile.sources.length;E++){A=this.profile.sources[E];if(!A.confirmed&&A.rejected&&!A.filteredOut){if(C>G){G++;continue;}else{I++;render=J.idToSourceRender.get(A.elementId);F+=render.rejectedHtml;H.push(E);}}if(I>=D){break;}}jQuery(this.config.sigmaRejectedSourcesListIdXPath).empty().html(F);if(sigmaConfig.useOkkam==true){this.appendOkkamLogo(H);}};SigmaUIEngine.prototype.appendOkkamLogo=function(B){for(i=0;i<B.length;i++){var A=this.profile.sources[B[i]];if(A.isFromOKKAM==true){A.notifyObservers("addOkkamLogo");}if(A.alternativeUrlsFromOkkam!==null){A.notifyObservers("urlsFromOkkamAdded2",A.alternativeUrlsFromOkkam);}}};SigmaUIEngine.prototype.setSigmaContainerId=function(){var B=this.config.sigmaContainerId;this.ecsseContainerId=B;this.ecsseProfileListId=B+"-profile-list-id";this.ecsseProfileListIdXPath="#"+this.ecsseProfileListId;this.ecsseSourcesContainerXPath="#"+B+" div.ecsseSources";this.ecsseProfileContainerXPath="#"+B+" div.ecsseProfile";this.ecsseContainerIdXPath="#"+B;this.ecsseRightBoxXPath="#"+B+" .ecsseRightBox";this.ecsseSourcesBoxInnerXPath="#"+B+" .ecsseSourcesBoxInner";this.hideSourcesBoxButtonXPath="#"+B+" .hideSourcesBoxButton";this.showSourcesBoxButtonXPath="#"+B+" .showSourcesBoxButton";this.removeSourcesFilterBoxButtonXPath="#"+B+" .removeSourcesFilterBoxButton";var A=this;this.opts={items_per_page:7,current_page:0,num_display_entries:3,num_edge_entries:1,link_to:"javascript:void(0);",prev_text:"<-",next_text:"->",ellipse_text:"...",prev_show_always:true,next_show_always:true,callback:function(D,C){A.newPaginationCallback(D,C,this);},invisibleListId:"ecsse-sources-list",visibleListId:A.config.sigmaNewSourcesListId,itemsNo:0};this.optsApproved={items_per_page:7,current_page:0,num_display_entries:3,num_edge_entries:1,link_to:"javascript:void(0);",prev_text:"<-",next_text:"->",ellipse_text:"...",prev_show_always:true,next_show_always:true,callback:function(D,C){A.newPaginationCallback(D,C,this);},invisibleListId:"ecsse-approved-sources-list",visibleListId:A.config.sigmaApprovedSourcesListId,itemsNo:0};this.optsRejected={items_per_page:7,current_page:0,num_display_entries:3,num_edge_entries:1,link_to:"javascript:void(0);",prev_text:"<-",next_text:"->",ellipse_text:"..",prev_show_always:true,next_show_always:true,callback:function(D,C){A.newPaginationCallback(D,C,this);},invisibleListId:"ecsse-banned-sources-list",visibleListId:A.config.sigmaRejectedSourcesListId,itemsNo:0};};SigmaUIEngine.prototype.getSigmaContainerIdXPath=function(A){return this.ecsseContainerIdXPath;};SigmaUIEngine.prototype.dynamicSourceHighlightAndFilter=function(D,B){if(!this.config.sourcesFilteredLock){if(D===true){var A=B.length;for(var C=A-1;C>=0;C--){jQuery("div.fullURI small[title='"+B[C].sourceURI+"']").closest(".source").addClass(this.config.sigmaeeUIhighlight);}}else{jQuery(".source").removeClass(this.config.sigmaeeUIhighlight);}}};SigmaUIEngine.prototype.unfilterSources=function(){var C=this;var D,B;for(var A=0;A<this.profile.sources.length;A++){D=this.profile.sources[A];D.filteredOut=false;}jQuery("#filterIndicator").hide();jQuery(".dehighlightValue").hide();this.config.sourcesFilteredLock=false;this.opts.itemsNo=this.profile.getNumberOfNewSources();this.optsApproved.itemsNo=this.profile.getNumberOfApprovedSources();this.optsRejected.itemsNo=this.profile.getNumberOfRejectedSources();this.updatePaginationOnTab1();this.updatePaginationOnTab2();this.updatePaginationOnTab3();};SigmaUIEngine.prototype.filterSources=function(B,A,G){var E=this;var H,D,C;for(C=0;C<this.profile.sources.length;C++){this.profile.sources[C].filteredOut=true;}for(C=0;C<B.length;C++){H=B[C];H.filteredOut=false;}if(!G){G="undefined";}var F=35;if(G.length>F){G=G.substring(0,F)+" ...";}if(A=="value"){jQuery("#filterIndicator span:eq(0)").html("<b>value</b>");jQuery("#filterIndicator span:eq(1)").html("<b>"+G+"</b>");}if(A=="property"){jQuery("#filterIndicator span:eq(0)").html("<b>property</b>");jQuery("#filterIndicator span:eq(1)").html("<b>"+G+"</b>");}jQuery("#filterIndicator").show();this.opts.current_page=0;this.opts.itemsNo=this.profile.getNumberOfNewSources();this.optsApproved.current_page=0;this.optsApproved.itemsNo=this.profile.getNumberOfApprovedSources();this.optsRejected.current_page=0;this.optsRejected.itemsNo=this.profile.getNumberOfRejectedSources();this.updatePaginationOnTab1();this.updatePaginationOnTab2();this.updatePaginationOnTab3();this.config.sourcesFilteredLock=true;};SigmaUIEngine.prototype.displayNoResultCase=function(A){jQuery("div.noResultsIndicator div.msg").html("There were no results for query:<br />"+A).closest(".noResultsIndicator").show();jQuery(".sigmaee_permLinkSourcesBoxButton").hide();jQuery(".reorderPropertiesOff").hide();};SigmaUIEngine.prototype.calculateNumberOfSourcesFitInRightWindow=function(){var E=jQuery(window).height();var C=40;var H=jQuery("#filterIndicator:visible").height();if(!H){H=0;}var F=0;var B=65;var D=E-C-B-H-F;var A=45;var G=Math.floor((D)/A);if(G<=0){G=1;}return G;};SigmaUIEngine.prototype.checkAreThereAnyItemsOnCurrentPage=function(A){var B=jQuery("#"+A.visibleListId+" li").size();if(B===0){log.info("detected that there is no more sources on page for "+A.visibleListId);if(A.current_page>0){A.current_page--;}return true;}else{log.info("detected that there is ["+B+"]sources on page for "+A.visibleListId);return false;}};SigmaUIEngine.prototype.updatePaginationOnTab1=function(){this.opts.items_per_page=this.calculateNumberOfSourcesFitInRightWindow();jQuery("#sourcesPagination").pagination(this.opts.itemsNo,this.opts);jQuery("#tabs-1-no").html(this.opts.itemsNo);jQuery("span.tabNewSources").effect("pulsateWithStyle",this.config.pulsateOption,this.pulsateDuration);};SigmaUIEngine.prototype.updatePaginationOnTab2=function(){this.optsApproved.items_per_page=this.calculateNumberOfSourcesFitInRightWindow();jQuery("#approvedSourcesPagination").pagination(this.optsApproved.itemsNo,this.optsApproved);jQuery("#tabs-2-no").html(this.optsApproved.itemsNo);jQuery(".tabApprovedSources").effect("pulsateWithStyle",this.config.pulsateOption,this.pulsateDuration);};SigmaUIEngine.prototype.updatePaginationOnTab3=function(){this.optsRejected.items_per_page=this.calculateNumberOfSourcesFitInRightWindow();jQuery("#bannedSourcesPagination").pagination(this.optsRejected.itemsNo,this.optsRejected);jQuery("#tabs-3-no").html(this.optsRejected.itemsNo);jQuery(".tabRejectedSources").effect("pulsateWithStyle",this.config.pulsateOption,this.pulsateDuration);};SigmaUIEngine.prototype.initContainers=function(){jQuery(this.ecsseContainerIdXPath).html(this.templates.profileBoxTemplate);if(this.config.hideBottomMessage==false){if(this.fromSindice==true){jQuery(this.ecsseContainerIdXPath+" div.howToLearnMessage").append(this.templates.howToLearnIndicatorSindice);}else{jQuery(this.ecsseContainerIdXPath+" div.howToLearnMessage").append(this.templates.howToLearnIndicator);}}if(this.config.rawFlag===false){jQuery("body").append(this.templates.invisibleElementsTemplate);if(this.config.hideHeader==false){jQuery("#sigmaVersion").attr("title","Published: "+sigmaPublished+" Revision: "+sigmaRevision).html('<a href="changes.jsp#'+sigmaVersion+'">Version: '+sigmaVersion+"</a>");}jQuery("#sigmaRightBoxContainer .sigmaee_indicatators").html(this.templates.sourcesTabsIndicators);jQuery("#sigmaRightBoxContainer .sigmaee_tabsContent #tabs-1").html(this.templates.sourcesTabsContent1);jQuery("#sigmaRightBoxContainer .sigmaee_tabsContent #tabs-2").html(this.templates.sourcesTabsContent2);jQuery("#sigmaRightBoxContainer .sigmaee_tabsContent #tabs-3").html(this.templates.sourcesTabsContent3);jQuery(".approveAllSources").button({icons:{primary:"ui-icon-arrowthick-1-n"}});jQuery(".rejectAllSources").button({icons:{primary:"ui-icon-arrowthick-1-n"}});jQuery(".addNewSourceFromUrlButton").button({icons:{primary:"ui-icon ui-icon-circle-plus"}});jQuery("#sigmaOptionsTabs").tabs();jQuery(".sigmaee_config").button({icons:{primary:null,secondary:"ui-icon-arrowthick-1-e"}});jQuery(".sigmaee_config").click(function(){if(jQuery(this).hasClass("simple")){jQuery(".sigmaee_config").removeClass("simple").button("option",{label:"Simple Configuration",icons:{primary:"ui-icon-arrowthick-1-w",secondary:null}});jQuery("#tabs-advanced").show();jQuery("#tabs-simple").hide();}else{jQuery(".sigmaee_config").addClass("simple").button("option",{label:"Advanced Configuration",icons:{primary:null,secondary:"ui-icon-arrowthick-1-e"}});jQuery("#tabs-advanced").hide();jQuery("#tabs-simple").show();}});jQuery(this.ecsseContainerIdXPath).append('<div class="permLinkDialog" title="Permament link" />');jQuery("div.permLinkDialog").dialog({autoOpen:false,width:780,modal:true});jQuery("#ecsseRightBoxTabs").tabs();}else{var A=getURLParam("q");this.updateExpandToFullViewLink(A);this.showExpandToFullViewLink();jQuery(".sigmaee_header,.sigmaee_footer, .sigmaee_searchbar,.sigmaee_sources_content").hide();jQuery(".sigmaee_main_content").css({right:0});jQuery(".sigmaee_databag").css({border:"none"});}};SigmaUIEngine.prototype.showExpandToFullViewLink=function(){jQuery(this.ecsseContainerIdXPath+" div.expandToFullView").show();};SigmaUIEngine.prototype.updateExpandToFullViewLink=function(D){var C=document.location.href;var B=C.indexOf("/search");if(B!=-1){C=C.substring(0,B+1);}var A=C+"search?q="+D;jQuery(this.ecsseContainerIdXPath+" div.expandToFullView").find("a").attr("href",A).end().find("span").text(decodeURIComponent(D));};SigmaUIEngine.prototype.setShowHideSourcesNumbersFlag=function(A){jQuery("#hideShowSourcesNumbers").attr("checked",A);if(this.config.showHideSourcesNumbers===A){return ;}this.config.showHideSourcesNumbers=A;if(A){this.config.showHideSourcesNumbers=true;jQuery("span.sourcesGraphicsIndicator").show();}else{this.config.showHideSourcesNumbers=false;jQuery("span.sourcesGraphicsIndicator").hide();}};SigmaUIEngine.prototype.getShowHideSourcesNumbersFlag=function(){return this.config.showHideSourcesNumbers;};SigmaUIEngine.prototype.showRightBox=function(){jQuery(this.ecsseRightBoxXPath).css({display:"block"});};SigmaUIEngine.prototype.setDragAndDropHandle=function(A){jQuery(this.ecsseProfileListIdXPath).sortable("option","handle","."+A);};SigmaUIEngine.prototype.enableDragAndDrop=function(A){log.info("called enableDragAndDrop with handle class ["+A+"]");var B=this;jQuery(".profileRight").sortable({handle:A,cursor:"move",opacity:0.6,update:function(E,G){log.error("this id"+G.item.attr("id")+" name: "+G.item.find("div.propertyLabelContainer:first span.name").html());log.error("before id"+G.item.next().attr("id")+" name: "+G.item.next().find("div.propertyLabelContainer:first span.name").html());var C=G.item.next().find("div.propertyLabelContainer:first span.name").html();if(C){C=C.removeLastCharacter(":");}var D=G.item.find("div.propertyLabelContainer:first span.name").html();D=D.removeLastCharacter(":");var F=B.profile.getProperty(D);B.profile.move(F,C);}});};SigmaUIEngine.prototype.disableDragAndDrop=function(){log.info("disableDragAndDrop");jQuery(".profileRight").sortable("destroy");};SigmaUIEngine.prototype.removePropertyAndValueFilter=function(){if(this.config.valuesFilteredLock===true){this.profile.setSoloMode([]);jQuery(".property .propertyContainer").removeClass("propertyHighlighted");jQuery(".value").removeClass(this.config.sigmaeeUIhighlight);jQuery(".source").removeClass(this.config.sigmaeeUIhighlight);jQuery("#valueFilterIndicator").hide();var A=jQuery("a.dehighlightSource:visible").parent().parent().parent();jQuery("a.dehighlightSource:visible").hide();A.find("a.highlightSource").show();jQuery(".sourceButtons").hide();this.config.valuesFilteredLock=false;}};SigmaUIEngine.prototype.checkThatAnySourcesLeftAndRemoveSourcesFilter=function(){if(this.config.sourcesFilteredLock===true){if(jQuery("#ecsse-sources-list-page li:visible").length===0){log.info("no more sources left removing source filter");this.unfilterSources();}}};SigmaUIEngine.prototype.hideSourceBox=function(){jQuery(this.ecsseRightBoxXPath).hide();};SigmaUIEngine.prototype.showSourceBox=function(){jQuery(this.ecsseRightBoxXPath).show();};SigmaUIEngine.prototype.renderSource=function(A){A.addObserver(new SigmaUISource(A,this));if(A.entity.confirmedDomains.indexOf(A.domain)!=-1){A.confirm(true);}if(A.entity.rejectedDomains.indexOf(A.domain)!=-1){A.reject(true);}if(A.entity.okkamSuggestions==true){A.confirm(true);}};SigmaUIEngine.prototype.renderProperty=function(B,A){B.addObserver(new SigmaUIProperty(B,A,this));};SigmaUIEngine.prototype.getPropertyWidth=function(B){var D=jQuery("#"+B.elementID);var A=D.is(":visible");if(!A){D.show();}var C=jQuery("#"+B.elementID+" div.propertyContainer").width();if(!A){D.hide();}if(C===0){C=140;}return C;};SigmaUIEngine.prototype.calculateProfileRightWidth=function(){var E=4+15;var C=this.calculateProfileBoxWidth();var D=jQuery(".profileLeft").width();var B=jQuery("#fixedbox").width();var A=0;if(D===0&&B===0){A=C-E;}else{if(D===0&&B!==0){A=C-E;}else{if(D!==0&&B!==0){A=C-E-D;}else{if(D!==0&&B===0){A=C-E-D;}}}}return A;};SigmaUIEngine.prototype.calculateProfileBoxWidth=function(){var B=jQuery(window).width();var A=jQuery("#fixedbox").width();log.info("sourcesWindowWidth:"+A);if(A===0){return B-A+6;}else{return B-A;}};SigmaUIEngine.prototype.fixHeight=function(){jQuery("#ecsse").css({height:"auto"});var F=jQuery(window).height();var C=jQuery("#header").height();var A=jQuery("#body").height();var B=jQuery("#search-again-left-piece").height();var E=jQuery("#footer").height();var D=C+A+E;if(D<F){A=F-C-E-B-8;jQuery("#ecsse").css({height:A});}};SigmaUIEngine.prototype.fixWidth=function(){log.info("Fix width called");var C=this;var B=C.calculateProfileBoxWidth();var D=jQuery(".profileLeft").width();var A=C.calculateProfileRightWidth();jQuery("div.profileRight div.valuesContainer").each(function(){var F=jQuery(this).parent().attr("id");var E=C.idToPropertyRender.get(F);C.fixValuesContainerWidth(E.property,A);});};SigmaUIEngine.prototype.fixValuesContainerWidth=function(D,A){var C=this.profile.pageLayout;if(!A){A=this.calculateProfileRightWidth();}var F=this.getPropertyWidth(D);var E="auto";if(D.entity.pageLayout==="layout1"||D.entity.pageLayout==="layout2"){E=A-F-12-8-4;}else{E=A-12-50-8-4;}if(C==="layout1"||C==="layout3"){log.info("fixValuesContainerWidth for property: "+D.name+"["+F+"] to: "+E);jQuery("#"+D.elementID+"__").width(E);}else{log.debug("fixing values width in layout2 for "+D.name);jQuery("#"+D.elementID+"__").width("auto");var B=jQuery("#"+D.elementID+"__").width();log.debug("computedValuesContainerWidth: "+B);log.debug("actualValuesContainerWidth: "+E);if(B>E){log.debug("changing values width for "+D.name+"to: "+E);jQuery("#"+D.elementID+"__").width(E);}}};SigmaUIEngine.prototype.hideShowTopMenu=function(){var C=jQuery("#header").width();var B=jQuery("#header #sigma-logo").width();var A=jQuery("#header #menuTop").width();if((B+8+4+A)>C){jQuery("#menuTop").hide();}else{jQuery("#menuTop").show();}};SigmaUIEngine.prototype.onResize=function(A){log.info("on Resize flag"+A);if(this.config.propertiesAndValuesRendering===false||A===true){var C=jQuery("#fixedboxPanel").offset();if(C){panelLeft=C.left;}else{panelLeft=0;}this.fixWidth();this.fixHeight();this.hideShowTopMenu();var B=this.calculateNumberOfSourcesFitInRightWindow();this.opts.items_per_page=B;this.opts.current_page=0;this.optsApproved.items_per_page=B;this.optsApproved.current_page=0;this.optsRejected.items_per_page=B;this.optsRejected.current_page=0;this.updatePaginationOnTab1();this.updatePaginationOnTab2();this.updatePaginationOnTab3();}};SigmaUIEngine.prototype.buildValuesAndPropertiesPiece=function(){var D=this.profile.properties;this.sI=0;this.sA=[];this.sA[this.sI++]='<ul id="ecsse-profile-list-id">';for(var C=0;C++<D.size;D.next()){var G=D.value();this.addPropertyStart(G);log.info("============"+G.name+"============");var A=G.values;for(j=0;j<A.length;j++){var F=A[j];this.addValue(F);}this.addPropertyEnd(G);}this.sA[this.sI++]="</ul>";var H,E;H=getCurrentTime();var B=this.sA.join("");E=getCurrentTime();H=getCurrentTime();jQuery("#ecsse-profile-list-id").html(B);E=getCurrentTime();H=getCurrentTime();document.getElementById("ecsse-profile-list-id").innerHTML=B;E=getCurrentTime();this.fixWidth();};SigmaUIEngine.prototype.addPropertyStart=function(B){var A="";if(B.active===false){A='style="display:none"';}this.sA[this.sI++]="<li "+A+' class="property" id="'+B.elementID+'"><div class="fl propertyContainer propertyContainerRel propertyCss">';this.sA[this.sI++]='<div class="fr propertyName">'+B.name+"</div>";this.sA[this.sI++]='<div class="br"></div></div><div class="fl valuesContainer"><ul id="'+B.elementID+'__">';};SigmaUIEngine.prototype.addPropertyEnd=function(A){this.sA[this.sI++]='</ul></div><div class="br"></div></li>';};SigmaUIEngine.prototype.addValue=function(C){var A=C.uris[0]?C.uris[0]:C.value;var B="";if(A===undefined&&this.config.customRenderedProperties.indexOf(C.property.name)!==-1){log.warn("there was undefined href for value for property"+C.property.name+". Such value will be hidden");C.hide();B='style="display:none"';}if(C.active===false){B='style="display:none"';}this.sA[this.sI++]="<li "+B+' id="'+C.elementID+'" class="value valueCss"><div class="valueContainerRel">';if(C.property.name==="picture"){log.info("found value in picture property");var D=C.uris[0]?C.uris[0]:C.value;this.sA[this.sI++]='<div class="fl valueLabel">';this.sA[this.sI++]='<img class="imgValue" src="'+D+'"   onerror="javascript:imgError(this);" onload="javascript:imgLoad(this);" />';this.sA[this.sI++]='<span class="sourcesGraphicsIndicator" >';this.sA[this.sI++]=this.generateSourceNumbersString(C);this.sA[this.sI++]="</span>";this.sA[this.sI++]='<a style="display:none;" class="openDocumentSource" href="'+C.getWebLink()+'" title="open source document in new window"></a>';this.sA[this.sI++]="</div>";}else{if(this.config.customRenderedProperties.indexOf(C.property.name)!==-1){A=C.uris[0]?C.uris[0]:C.value;this.sA[this.sI++]='<div class="fl valueLabel">';this.sA[this.sI++]='<a class="label" href="'+A+'">'+A+"</a>";this.sA[this.sI++]='<span class="sourcesGraphicsIndicator" >';this.sA[this.sI++]=this.generateSourceNumbersString(C);this.sA[this.sI++]="</span>";this.sA[this.sI++]='<a style="display:none;" class="openDocumentSource" href="'+C.getWebLink()+'" title="open source document in new window"></a>';this.sA[this.sI++]="</div>";}else{this.sA[this.sI++]='<div class="fl valueLabel">';this.__updateLabel(C);this.sA[this.sI++]='<span class="sourcesGraphicsIndicator" >';this.sA[this.sI++]=this.generateSourceNumbersString(C);this.sA[this.sI++]="</span>";this.sA[this.sI++]='<a style="display:none;" class="openDocumentSource" href="'+C.getWebLink()+'" title="open source document in new window"></a></div>';}}this.sA[this.sI++]='<div class="br"></div></div></li>';};SigmaUIEngine.prototype.__updateLabel=function(A){if(A.uris.length>0){this.sA[this.sI++]='<a class="label" target="blank" href="'+A.getSigmaLink()+'">';}else{this.sA[this.sI++]='<span class="label">';}if(A.label){this.sA[this.sI++]=A.label;}else{if(A.value){this.sA[this.sI++]=A.value;}else{if(A.uris.length>0){this.sA[this.sI++]=decodeURIComponent(A.uris[0]);}else{this.sA[this.sI++]="[?]";}}}if(A.uris.length>0){this.sA[this.sI++]="</a>";}else{this.sA[this.sI++]="</span>";}};SigmaUIEngine.prototype.enableConfigClicks=function(B){var A=this;jQuery(".removeDataProvider").live("click",function(F){F.preventDefault();var E=jQuery(this).closest("tr").find("td:first-child").text();var G=jQuery(".currentSigmaConfig").find("table[about='#"+E+"']").closest("tr.sigmaee_single_provider");G.remove();var D=jQuery(this).closest(".sigmaConfigDialog").find(".saveConfig");D.click();jQuery(this).closest("tr").remove();});jQuery(".sigmaee_button").button();jQuery(".addNewSparqlEndpoint").live("click",function(){var F=A._generateProviderName()+"-Search";var D=A._generateProviderName()+"-Lookup";var E='<div class="addNewsSparqlEndpointForm"><p>Sparql endpoint can be a search and lookup provider at the same time.<br>You might want to use just one functionality or both as you prefere.<br>You might also use two different sparql endpoints one for search and one for lookup.</p><div class="configBox newConfigBox"><table typeof="ee:SearchProvider" about="#'+F+'" style="width:100%"><tr ><th colspan="2">Search Provider</th></tr><tr style="display:none;"><td rev="ee:dataSource" resource="#catalog"></td></tr><tr style="display:none;"><td property="ee:temporary" datatype="xsd:boolean">true</td></tr><tr style="display:none;"><td property="ee:javaClass">ma.sig.providers.search.SparqlEndpointSearchProvider</td></tr><tr><td>name</td><td><input type="text" value="'+F+'"/></td></tr><tr><td>apiUrl</td><td><input class="sigmaee_propertyStringInput"        type="text" property="ee:apiUrl" value="http://sparql.sindice.com/sparql" content="http://sparql.sindice.com/sparql"/></td></tr><tr><td>defaultGraph</td><td><input  class="sigmaee_propertyStringInput" type="text" property="ee:defaultGraph" value="" content="" /></td></tr><tr><td>sparqlKeywordSearchQuery</td><td><textarea  class="sigmaee_propertyStringInput" property="ee:sparqlKeywordSearchQuery" content="PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?entity ?title WHERE { ?entity rdfs:label ?title .?title bif:contains ##keyword## . FILTER isIRI(?entity)}">PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> SELECT DISTINCT ?entity ?title WHERE { ?entity rdfs:label ?title .?title bif:contains ##keyword## . FILTER isIRI(?entity)}</textarea></td></tr><tr><td colspan="2"><button class="sigmaee_button saveNewDataProvider sigmaeeCss_smallButton">Save</button><button class="sigmaee_button cancelNewDataProvider sigmaeeCss_smallButton">Cancel</button><div class="sigmaee_test"><button class="sigmaee_button testNewDataProvider sigmaeeCss_smallButton">Test</button><span>Keyword:</span><input name="keyword" /></div></td></tr></table></div><div class="configBox newConfigBox"><table typeof="ee:LookupProvider" about="#'+D+'" style="width:100%"><tr ><th colspan="2">Lookup Provider</th></tr><tr style="display:none;"><td rev="ee:dataSource" resource="#catalog"></td></tr><tr style="display:none;"><td property="ee:uriPattern" >^http://</td></tr><tr style="display:none;"><td property="ee:temporary" datatype="xsd:boolean">true</td></tr><tr style="display:none;"><td property="ee:javaClass">ma.sig.providers.lookup.SparqlEndpointLookupProvider</td></tr><tr><td>name</td><td><input type="text" value="'+D+'"/></td></tr><tr><td>apiUrl</td>      <td><input type="text" class="sigmaee_propertyStringInput"   property="ee:apiUrl" value="http://sparql.sindice.com/sparql" content="http://sparql.sindice.com/sparql"/></td></tr><tr><td>defaultGraph</td><td><input type="text" class="sigmaee_propertyStringInput"   property="ee:defaultGraph" value="" content="" /></td></tr><tr><td>sparqlEntityLookupQuery</td><td><textarea class="sigmaee_propertyStringInput" property="ee:sparqlEntityLookupQuery" content="DESCRIBE ##uri##">DESCRIBE ##uri##</textarea></td></tr></table><tr><td colspan="2"><button class="sigmaee_button saveNewDataProvider sigmaeeCss_smallButton">Save</button><button class="sigmaee_button cancelNewDataProvider sigmaeeCss_smallButton">Cancel</button><div class="sigmaee_test"><button class="sigmaee_button testNewDataProvider sigmaeeCss_smallButton">Test</button><span>Keyword:</span><input name="keyword" /><span>Uri:</span><input name="uri" /></div></td></tr></div></div><div style="clear:both;"></div>';jQuery(this).closest("#tabs-simple").append(E).find(".sigmaee_button").button();});jQuery(".addNewDataProvider").click(function(){var D='<div class="newConfigBox" ><div class="configBox"><div class="sigmaee_selectProviderName" ><label>Add new lookup provider</label><input type="text" /><span class="errorMsg" /></div></div></div>';jQuery(this).closest(".sigmaConfigDialog").append(D);});jQuery("div.sigmaee_selectProviderName input").live("keyup",function(){var H=jQuery(this);var E=jQuery(this).val();var D=function(){var I='<div class="sigmaee_selectProviderType" ><label>Pick up a provider type</label><select><option value="----">----</option><option value="ee:CacheProvider">CacheProvider</option><option value="ee:SearchProvider">SearchProvider</option><option value="ee:LookupProvider">LookupProvider</option></select></div>';H.css({"background-color":"white"}).parent().find(".errorMsg").text("");var J=H.closest(".configBox").find(".sigmaee_selectProviderType");if(J.size()===0){H.closest(".configBox").append(I);}};var G=function(I){H.css({"background-color":"pink"}).parent().find(".errorMsg").text(I);H.closest(".configBox").find(".sigmaee_selectProviderType").remove();};var F=true;jQuery(".currentSigmaConfig table[about]").each(function(){var I=jQuery(this).attr("about");if(E===I.substring(1)){F=false;return false;}});if(E.length<=3){G("Use longer name");}else{if(F){D();}else{G("name already taken");}}});jQuery("div.sigmaee_providerJavaClass select").live("change",function(){var G=jQuery(this);var F=jQuery(this).closest("div.configBox").find("div.sigmaee_selectProviderType select").val();var D=jQuery(this).val();var E=jQuery(this).closest("div.configBox").find("div.sigmaee_selectProviderName input").val();jQuery.ajax({url:"eeservlets/eeconfig",dataType:"json",data:{op:"getConfigPropertiesForClass",className:D},success:function(N){if(N.status==="ok"&&N.properties){var M='<div class="sigmaee_providerOptions"><table style="width:100%" about="#'+E+'" typeof="'+F+'"><tr style="display:none;"><td rev="ee:dataSource" resource="#catalog"></td></tr><tr style="display:none;"><td property="ee:temporary" datatype="xsd:boolean">true</td></tr><tr style="display:none;"><td property="ee:javaClass">'+D+"</td></tr>";for(var L=0;L<N.properties.length;L++){var O=N.properties[L];var K=O.name;var I=O.defaultValue;if(K==="javaClass"){}else{if(K==="CacheProvider"){var J=jQuery(A._createCacheProviderSelect(B.sigmaEEConfiguration,"----"));var H=jQuery("<div>").append(J.clone()).remove().html();M+='<tr><td style="text-align:right;">'+K+'</td><td class="" >'+H+"</td></tr>";}else{if(K==="active"){M+='<tr><td style="text-align:right;">'+K+'</td><td class="sigmaee_disabled"  property="ee:'+K+'" datatype="xsd:boolean" >false</td></tr>';}else{if(K==="sparqlKeywordSearchQuery"||K==="sparqlEntityLookupQuery"){M+='<tr><td  style="text-align:right;">'+K+'</td><td><textarea class="sigmaee_propertyStringInput" property="ee:'+K+'" value="'+I+'" content="'+I+'">'+I+"</textarea></td></tr>";}else{if(K==="label"){M+='<tr><td  style="text-align:right;">'+K+'</td><td><input class="sigmaee_propertyStringInput" type="text" property="rdfs:'+K+'" value="'+I+'" content="'+I+'"/></td></tr>';}else{M+='<tr><td  style="text-align:right;">'+K+'</td><td><input class="sigmaee_propertyStringInput" type="text" property="ee:'+K+'" value="'+I+'" content="'+I+'"/></td></tr>';}}}}}}M+='<tr><td colspan="2"><button class="sigmaee_button saveNewDataProvider">Save</button><button class="sigmaee_button cancelNewDataProvider">Cancel</button></td></tr>';M+="</table></div>";G.closest("div.configBox").find('span[property="ee:javaClass"]').text(D);G.closest("div.sigmaee_providerJavaClass").parent().find("div.sigmaee_providerOptions").remove().end().append(M).find(".sigmaee_button").button();}else{alert(N.error);}},error:function(H){alert(H);}});});jQuery("select.sigmaee_propertySelect").live("change",function(){var D=jQuery(this).val();if(D!="----"){jQuery(this).parent().attr("resource",B.sigmaEEConfiguration.baseURI+"#"+D).attr("rel","ee:CacheProvider");}else{jQuery(this).parent().removeAttr("resource").removeAttr("rel");}});jQuery("input.sigmaee_propertyFloatInput").live("keyup",function(){var E=jQuery(this).val();var D=parseFloat(E.trim(),10);if(D){jQuery(this).attr("content",D);}});jQuery("input.sigmaee_propertyStringInput,textarea.sigmaee_propertyStringInput").live("keyup",function(D){D.stopPropagation();var E=jQuery(this).val();jQuery(this).attr("content",E.trim());});jQuery("div.sigmaee_selectProviderType select").live("change",function(){var F=jQuery(this);var E=jQuery(this).val();var D='<div class="sigmaee_providerJavaClass"><label>Pick up a provider class</label><select><option value="----">----</option>';if(E==="ee:CacheProvider"){D+='<option value="ma.sig.providers.cache.MemcachedCacheProvider">ma.sig.providers.cache.MemcachedCacheProvider</option><option value="ma.sig.providers.cache.MemoryCacheProvider">ma.sig.providers.cache.MemoryCacheProvider</option>';}else{if(E==="ee:SearchProvider"){D+='<option value="ma.sig.providers.search.SindiceSearchProvider">ma.sig.providers.search.SindiceSearchProvider</option><option value="ma.sig.providers.search.YahooBOSSSearchProvider">ma.sig.providers.search.YahooBOSSSearchProvider</option><option value="ma.sig.providers.search.SparqlEndpointSearchProvider">ma.sig.providers.search.SparqlEndpointSearchProvider</option>';}else{if(E==="ee:LookupProvider"){D+='<option value="ma.sig.providers.lookup.SindiceLookupProvider">ma.sig.providers.lookup.SindiceLookupProvider</option><option value="ma.sig.providers.lookup.WebLookupProvider">ma.sig.providers.lookup.WebLookupProvider</option><option value="ma.sig.providers.lookup.SparqlEndpointLookupProvider">ma.sig.providers.lookup.SparqlEndpointLookupProvider</option>';}}}D+="</select></div>";F.closest("div.sigmaee_selectProviderType").parent().find(".sigmaee_providerJavaClass, .sigmaee_providerOptions").remove().end().append(D);});jQuery(".sigmaee_single_provider").live("mouseenter",function(){if(jQuery(this).find(".temporary").size()===1){jQuery(this).find(".deleteDataProvider").show().end().find("table").css({"background-color":"#ccc"});}else{jQuery(this).find(".deleteDataTemporaryProvider").show().end().find("table").css({"background-color":"#ccc"});}});jQuery(".sigmaee_single_provider").live("mouseleave",function(){if(jQuery(this).find(".temporary").size()===1){jQuery(this).find(".deleteDataProvider").hide().end().find("table").css({"background-color":"#fff"});}else{jQuery(this).find(".deleteDataTemporaryProvider").hide().end().find("table").css({"background-color":"#fff"});}});jQuery(".deleteDataProvider").live("click",function(){var D=jQuery(this).closest(".sigmaConfigDialog").find(".saveConfig");jQuery(this).closest(".sigmaee_single_provider").remove();D.click();});jQuery(".cancelNewDataProvider").live("click",function(){var D=jQuery(this).closest(".newConfigBox");var E=D.parent();D.slideUp("slow").remove();if(E.find(".newConfigBox").size()==0){jQuery(".addNewsSparqlEndpointForm").remove();}});jQuery(".saveNewDataProvider").live("click",function(){var E=jQuery(this).closest(".sigmaConfigDialog").find(".currentSigmaConfig");var F=""+E.html();var D=jQuery(this).closest(".newConfigBox");F+=D.html();A._saveConfigInCookies("sigmaee_config",F,B,function(){D.slideUp("slow").remove();});});jQuery(".testNewDataProvider").live("click",function(){var D="sigmaee_temp_config";var E=jQuery(this).closest(".newConfigBox");var I=E.find("table").attr("typeof");var H=E.find("table").attr("about").substring(1);var F=E.find(".sigmaee_test input[name='keyword']").val();var G=E.find(".sigmaee_test input[name='uri']").val();var J=E.html();A._saveConfigInCookies(D,J,B,function(){if(I==="ee:SearchProvider"){services.serviceSearchProviderRequest(H,F,"keyword",1,50,"",function(K){if(K.status==="ok"){var L="Status: "+K.status+"\nTotal results: "+K.results.length;}else{if(K.status==="error"){var L="Status: "+K.status+"\nError: "+K.error;}}A._eraseConfigCookies(D,10);alert(L);});}else{if(I==="ee:LookupProvider"){services.serviceSourceRequest(G,{lookupProviderNames:H,query:F},function(K){if(K.results.status==="ok"){var L="Status: "+K.results.status+"\nTotal results: "+K.totalResults;}else{if(K.results.status==="error"){var L="Status: "+K.results.status+"\nError: "+K.results.error;}}alert(L);A._eraseConfigCookies(D,10);});}else{A._eraseConfigCookies(D,10);alert("Test is not supported yet for ["+I+"] type");}}});});var C=10;jQuery(".resetConfig").live("click",function(){jQuery(".sigmaee_config_saved").show();A._eraseConfigCookies("sigmaee_config",10);B.populateSigmaEEConfiguration();jQuery(".sigmaee_config_saved").hide();});jQuery(".saveSimpleConfig").live("click",function(){$advancedConfig=jQuery(this).closest(".sigmaConfigDialog").find(".currentSigmaConfig");jQuery(this).closest(".sigmaConfigDialog").find(".sigmaee_simpleConfig table tr").each(function(D){if(D>0){var E=jQuery(this).attr("about");var G=jQuery(this).find("td[property='ee:active']").text();var F=$advancedConfig.find("table[about='"+E+"'] tr td[property='ee:active']");if(G==="true"){F.text(G).removeClass("sigmaee_disabled").addClass("sigmaee_enabled");}else{F.text(G).removeClass("sigmaee_enabled").addClass("sigmaee_disabled");}}});jQuery(this).closest(".sigmaConfigDialog").find(".saveConfig").click();});jQuery(".saveConfig").live("click",function(){var E=jQuery(this);var D=jQuery(this).closest(".sigmaConfigDialog").find(".currentSigmaConfig");var F=""+D.html();A._saveConfigInCookies("sigmaee_config",F,B,function(){});});jQuery(".sigmaee_enabled").live("click",function(){jQuery(this).text("false").removeClass("sigmaee_enabled").addClass("sigmaee_disabled");var D=jQuery(this).closest("table").find(".dataProviderName").text().trim();});jQuery(".sigmaee_disabled").live("click",function(){jQuery(this).text("true").removeClass("sigmaee_disabled").addClass("sigmaee_enabled");var D=jQuery(this).closest("table").find(".dataProviderName").text().trim();});};SigmaUIEngine.prototype._eraseConfigCookies=function(A,D){var C=getEECookiesPath();for(var B=0;B<D;B++){eraseCookie(A+B,C);}};SigmaUIEngine.prototype._saveConfigInCookies=function(A,C,B,G){var D=this;var F=10;jQuery(".sigmaee_config_saved").show();var E=getEECookiesPath();D._eraseConfigCookies(A,F);jQuery.ajax({type:"POST",url:"eeservlets/eeconfig",data:{op:"extractRDFa",html:C},success:function(J){var I=splitStringForCookies(J,3950);if(I.length>F){alert("To big configuration to store in cookies");}for(var H=0;H<I.length;H++){createCookie(A+H,I[H],null,E);}B.populateSigmaEEConfiguration();jQuery(".sigmaee_config_saved").hide();G();},error:function(){D._eraseConfigCookies(A,F);$this.after('<span class="sigmaee_config_saved" style="color:red;">error</span>');B.populateSigmaEEConfiguration();}});};SigmaUIEngine.prototype.enableTrashBinClicks=function(){var A=this;jQuery("li.value").live("click",function(C){C.stopPropagation();var D=jQuery(this).attr("title");var B=A.idToValueRender.get(D);B.value.show();B.value.property.show();return false;});jQuery("li.property").live("click",function(C){C.stopPropagation();var D=jQuery(this).attr("title");var B=A.idToPropertyRender.get(D);B.property.show(true);return false;});};SigmaUIEngine.prototype.enableClickOnSourcesTabs=function(){var A=this;jQuery("#showHideRejected").click(function(){A.profile.setRejectedInformationVisible(jQuery(this).attr("checked"));});jQuery("#showHideApproved").click(function(){A.profile.setConfirmedInformationVisible(jQuery(this).attr("checked"));});jQuery("#showHideSources").click(function(){A.profile.setNewInformationVisible(jQuery(this).attr("checked"));});};SigmaUIEngine.prototype.setNewInformationVisible=function(A){jQuery("#showHideSources").attr("checked",A);};SigmaUIEngine.prototype.setConfirmedInformationVisible=function(A){jQuery("#showHideApproved").attr("checked",A);};SigmaUIEngine.prototype.setRejectedInformationVisible=function(A){jQuery("#showHideRejected").attr("checked",A);};SigmaUIEngine.prototype.enableClickAddMoreSourcesFromUrl=function(A){jQuery(".addNewSourceFromUrlButton").click(function(){var B=jQuery("#addNewSourceFromUrlInput").val();if(B!==""&&B.startsWith("http://")){A.addSingleSource(B,function(C){if(!C){}});}else{alert("Wrong url - correct one should start with http:// ");}return false;});};SigmaUIEngine.prototype.enableClickViewsAndLayouts=function(){jQuery(".viewsAndLayoutsButton").click(function(){jQuery(".viewsAndLayoutsDialog").dialog("open");});};SigmaUIEngine.prototype.getProperty=function(A,B){for(i=0;i<B.length;i++){if(B[i].startsWith(A+":")){return B[i].substring(B[i].indexOf(":")+1);}}return false;};SigmaUIEngine.prototype.enableClickCreatePermalink=function(B){var A=this;jQuery(".sigmaee_permLinkSourcesBoxButton").click(function(){A.createPermalink(B);return false;});jQuery("a.openPermalink").click(function(){if(A.config.rawFlag){jQuery(this).attr("href","http://sig.ma/help.html").attr("target","_blank");return true;}else{A.createPermalink(B);}return false;});jQuery("a.urlTwitter").live("click",function(){A.getShortUrl(jQuery(this).attr("title"));return false;});jQuery("a.sigma-widget-preview").live("click",function(){var E=jQuery("textarea.widgetCode").val();var D=E.substring(E.indexOf("{")+1,E.indexOf("}"));var H=D.trim().split(",");var F=parseInt(A.getProperty("width",H),10);var C=parseInt(A.getProperty("height",H),10);var G='<style type="text/css"> body {margin:0px; padding:0px;}.sigma-widget-preview-box{ position:absolute;left:50%;width:'+F+"px;margin-top:20px;margin-left:-"+Math.floor(F/2)+"px;}</style>";sigmaUtilities.popUpXHtml(E,"Sigma widget preview",F+40,C+40,G);});};SigmaUIEngine.prototype.createPermalink=function(B){var A=this;B.createPermalink(function(R,J){var W=getURLParam("singlesource");var M=window.location.port;if(!M){M="";}else{M=":"+M;}var L=window.location.hostname;var E=window.location.protocol+"//";var P=window.location.pathname;P=P.substring(0,P.lastIndexOf("/"));var Q=E+L+M+P;var F="q="+encodeURIComponent(J);if(W){F+="&singlesource="+encodeURIComponent(W);}var I=Q+"/search?pid="+R;var S=I+"&raw=1";var C=Q+"/entity/"+R+".rdf#this";var H=Q+"/entity/"+R+".json";var K=Q+"/feed/"+R+"/atom_0.3";var U=Q+"/feed/"+R+"/rss_2.0";var V=Q+"/search?"+F;var T=V+"&raw=1";var D=V+"&format=rdf";var G=V+"&format=json";var O=A.templates.permalinkDialogTemplate;O=O.replace(/@url@/g,I);O=O.replace(/@urlRaw@/g,S);O=O.replace(/@urlRdf@/g,C);O=O.replace(/@urlJson@/g,H);O=O.replace(/@urlRss@/g,U);O=O.replace(/@urlAtom@/g,K);O=O.replace(/@freshUrl@/g,V);O=O.replace(/@freshUrlRaw@/g,T);O=O.replace(/@freshUrlRdf@/g,D);O=O.replace(/@freshUrlJson@/g,G);O=O.replace(/@path@/g,Q);O=O.replace(/@id@/g,R);O=O.replace(/@query@/g,J);var N="div.permLinkDialog";jQuery(N).html(O);jQuery(N+" .helpLink").attr("href",Q+"/?page=help");if(A.config.showNotifications==true){jQuery(N+" a.signupToPidNotifications").click(function(){var Z=R;var Y=jQuery(N+" .pidEmail").val();if(!sigmaUtilities.echeck(Y)){return ;}jQuery("img.signupToPidNotificationIndicator").show();var X={action:"addEmailToPidBasedNotifications",id:Z,email:Y};services.signupToNotification(X,function(a){if(a.status=="ok"){jQuery("img.signupToPidNotificationIndicator").attr("src","images/icons/ok.png");jQuery("span.signupToPidNotificationIndicatorMsg").text("Done").show();jQuery("span.signupToPidNotificationIndicatorMsgDetail").text("").hide();}else{jQuery("img.signupToPidNotificationIndicator").attr("src","images/icons/nok.png");jQuery("span.signupToPidNotificationIndicatorMsg").text(a.error).show();jQuery("span.signupToPidNotificationIndicatorMsgDetail").text(a.errorDetail).show();}});});jQuery(N+" a.signupToQueryNotifications").click(function(){var Y=jQuery(N+" .queryEmail").val();if(!sigmaUtilities.echeck(Y)){return ;}jQuery("img.signupToQueryNotificationIndicator").show();var X={action:"addEmailToQueryBasedNotifications",query:J,email:Y};services.signupToNotification(X,function(Z){if(Z.status=="ok"){jQuery("img.signupToQueryNotificationIndicator").attr("src","images/icons/ok.png");jQuery("span.signupToQueryNotificationIndicatorMsg").text("Done").show();jQuery("span.signupToQueryNotificationIndicatorMsgDetail").text("").hide();}else{jQuery("img.signupToQueryNotificationIndicator").attr("src","images/icons/nok.png");jQuery("span.signupToQueryNotificationIndicatorMsg").text(Z.error).show();jQuery("span.signupToQueryNotificationIndicatorMsgDetail").text(Z.errorDetail).show();}});});jQuery(N+" .emailNotifications").show();}jQuery(N+" .sigmaPermalinkTabs").tabs();jQuery(N).dialog("open");jQuery(N).find("span.tooltip.t3").qtip({position:{corner:{target:"topLeft",tooltip:"bottomRight"}},content:'<span class="tolltipText">SIGMA created in such way might contain unapproved information !<span>',style:"sigmaTooltip1"});});};SigmaUIEngine.prototype.getShortUrl=function(A){window.open("http://is.gd/api.php?longurl="+A,"name"+randomString(),"width=350,height=20,top=100,left=100, scrollbars=0,resizable=1,location=0,menubar=0,toolbar=0");};SigmaUIEngine.prototype.enableClickNewSigma=function(){jQuery(".sigmaee_newSigma").click(function(){jQuery(this).parent().parent().find("form").trigger("submit");});};SigmaUIEngine.prototype.enableClickMoreSources=function(A){jQuery(".sigmaee_moreSources").click(function(){var B=jQuery("#q").val();if(B!==""&&B.length>3){A.setQuery(B);}A.orderMoreSources(10);return false;});};SigmaUIEngine.prototype.enableValueButtonsClicks=function(){var A=this;jQuery("a.moreValuesInCompactView").live("click",function(){jQuery(this).closest("div.entityContainer").find("div.valueContainer").each(function(){var C=jQuery(this).attr("id");var B=A.idToValueRender.get(C);if(B.value.hiddenByDisplayMode===true){B.value.hiddenByDisplayMode=false;B.hiddenByDisplayMode(false);}});jQuery(this).remove();});jQuery("a.unfetchedValuesButton").live("click",function(){var C=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(C);B.property.fetchValues();});jQuery("a.rejectValueSources").live("click",function(){var E=jQuery(this).closest("div.valueContainer").attr("id");var C=A.idToValueRender.get(E);for(var B=0;B<C.value.sources.length;B++){var D=C.value.sources[B];D.reject(true);}});jQuery("a.rejectValueSourcesEvaluation").live("click",function(){var E=jQuery(this).attr("title");var C=A.idToValueRender.get(E);for(var B=0;B<C.value.sources.length;B++){var D=C.value.sources[B];D.reject(true);}return false;});jQuery("a.singleValue").live("click",function(C){var D=jQuery(this).closest("div.valueContainer").attr("id");var B=A.idToValueRender.get(D);B.value.setAsSingleValue();B.value.property.updateActivityState(true);jQuery(this).hide();jQuery(this).parent().parent().parent().parent().parent().parent().parent().find("a.topValueProperty").hide().end().find("a.allValuesProperty").show();return false;});jQuery("a.rejectValue").live("click",function(C){var D=jQuery(this).closest("div.valueContainer").attr("id");var B=A.idToValueRender.get(D);B.value.hide();A.unfilterSources();return false;});jQuery("a.highlightValue").live("click",function(C){var E=jQuery(this).closest("div.valueContainer").attr("id");var B=A.idToValueRender.get(E);jQuery("a.dehighlightValue").hide();jQuery("a.dehighlightSource").hide();jQuery("a.highlightSource").show();jQuery("div.lockedIndicator").hide();A.unfilterSources();jQuery(B.containerIdXPath+" a.highlightValue").hide();jQuery(B.containerIdXPath+" a.dehighlightValue").show();jQuery(B.containerIdXPath+" div.lockedIndicator").show();var D=B.value.label?B.value.label:B.value.value;if(!D){D=B.value.uris[0];}A.filterSources(B.value.sources,"value",D);log.info("Going to append small indicator to  "+B.containerIdXPath+" ["+A.smallValueSourcesFilterIndicator+"]");jQuery(B.containerIdXPath+" div.valueContainerRel div.br").remove();jQuery(B.containerIdXPath+" div.valueContainerRel").append(A.smallValueSourcesFilterIndicator);jQuery(B.containerIdXPath+" div.valueContainerRel").append('<div class="br">');return false;});jQuery("a.dehighlightValue").live("click",function(C){var D=jQuery(this).closest("div.valueContainer").attr("id");var B=A.idToValueRender.get(D);B.engine.unfilterSources();jQuery(B.containerIdXPath+" a.dehighlightValue").hide();jQuery("div.lockedIndicator").hide();jQuery(B.containerIdXPath+" a.highlightValue").show();jQuery(B.containerIdXPath+" .smallValueSourcesFilterIndicator").remove();return false;});jQuery("img.sigmaThis").live("click",function(E){var G=jQuery(E.target);var F=jQuery(this).closest("div.valueContainer").attr("id");var D=A.idToValueRender.get(F);var C=""+window.location;C=C.substring(0,C.indexOf("?")+1);var B=D.value.label;if(!B){B=D.value.uris[0];}B=B.replace(/:|;|\\|\(|\)|\[|\]|\{|\}|\^|\$|\*/g," ");C+="q="+encodeURIComponent(B);window.location.href=C;});};var reEscape=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\"].join("|\\")+")","g");SigmaUIEngine.prototype.enableOkkamSuggestions=function(A){this.a.enable();jQuery("#okkamSugestions").attr("checked","checked");};SigmaUIEngine.prototype.enableOkkamClicks=function(A){var B=this;this.a=jQuery("#q").autocomplete({serviceUrl:"http://api.sindice.com/okkamS2R/search",minChars:2,delimiter:/(,|;)\s*/,maxHeight:400,width:500,zIndex:9999,deferRequestBy:0,params:{format:"json"},onSelect:function(D,C){document.location.href="?q="+C.id+"&okkamSuggestion=1";},fnFormatResult:function(F,E,C){var D="("+C.replace(reEscape,"\\$1")+")";return F.replace(new RegExp(D,"gi"),"<strong>$1</strong>");}});this.a.disable();jQuery("#okkamSugestions").change(function(){if(jQuery(this).is(":checked")){B.profile.okkamSugestions=true;B.a.enable();}else{B.profile.okkamSugestions=false;B.a.disable();}});jQuery("a.okkamEnd").live("click",function(G){var I=jQuery(this).closest("li").attr("id");var E=B.idToSourceRender.get(I);var F=E.source.alternativeUrlsFromOkkam;for(var D=0;D<F.length;D++){var C=F[D];A.addSingleSource(C,function(J){J.isFromOKKAM=true;J.confirm(true);J.notifyObservers("addOkkamLogo");});}E.source.alternativeUrlsFromOkkamFetched=3;E.source.notifyObservers("urlsFromOkkamAdded2");var H=G.target;G.stopImmediatePropagation();});};SigmaUIEngine.prototype.enableSourceButtonsClicks=function(){var A=this;jQuery(this.config.sigmaNewSourcesListIdXPath+" a.rejectSource").live("click",function(){var C=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(C);B.source.reject(true);B.source.setSoloState(false);A.config.valuesFilteredLock=false;A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaApprovedSourcesListIdXPath+" a.rejectSource").live("click",function(){var C=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(C);B.source.reject(true);B.source.setSoloState(false);A.config.valuesFilteredLock=false;A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaRejectedSourcesListIdXPath+" a.unrejectSource").live("click",function(){var C=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(C);log.info("unreject source");B.source.reject(false);B.source.setSoloState(false);A.config.valuesFilteredLock=false;A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.confirmSource").live("click",function(){var C=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(C);B.source.confirm(true);B.source.setSoloState(false);A.config.valuesFilteredLock=false;A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaApprovedSourcesListIdXPath+" a.unconfirmSource").live("click",function(){var C=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(C);log.info("unconfirm source");B.source.confirm(false);B.source.setSoloState(false);A.config.valuesFilteredLock=false;A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.confirmSourceFromTheSameDomain").live("click",function(){var D=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(D);var C=B.source.domain;B.engine.profile.confirmDomain(C);B.source.setSoloState(false);A.config.valuesFilteredLock=false;A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.rejectSourceFromTheSameDomain").live("click",function(){var D=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(D);var C=B.source.domain;B.engine.profile.rejectDomain(C);B.source.setSoloState(false);A.config.valuesFilteredLock=false;A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.highlightSource, "+this.config.sigmaApprovedSourcesListIdXPath+" a.highlightSource, "+this.config.sigmaRejectedSourcesListIdXPath+" a.highlightSource").live("click",function(){var C=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(C);jQuery(this).hide();jQuery(B.containerIdXPath+" a.dehighlightSource").show();B.source.setSoloState(true);A.config.valuesFilteredLock=true;jQuery("#valueFilterIndicator span").html("<b>"+B.source.sourceURI+"</b>");jQuery("#valueFilterIndicator").show();return false;});jQuery(this.config.sigmaNewSourcesListIdXPath+" a.dehighlightSource, "+this.config.sigmaApprovedSourcesListIdXPath+" a.dehighlightSource, "+this.config.sigmaRejectedSourcesListIdXPath+" a.dehighlightSource").live("click",function(){var C=jQuery(this).parent().parent().parent().parent().attr("id");var B=A.idToSourceRender.get(C);B.source.setSoloState(false);jQuery(this).hide();jQuery(B.containerIdXPath+" a.highlightSource").show();A.removePropertyAndValueFilter();return false;});jQuery(".rejectAllSources").click(function(){var B,C;jQuery(A.config.sigmaNewSourcesListIdXPath+" li").each(function(){C=jQuery(this).attr("id");B=A.idToSourceRender.get(C);B.source.reject(true);});A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});jQuery(".approveAllSources").click(function(){var B,C;jQuery(A.config.sigmaNewSourcesListIdXPath+" li").each(function(){C=jQuery(this).attr("id");B=A.idToSourceRender.get(C);B.source.confirm(true);});A.checkThatAnySourcesLeftAndRemoveSourcesFilter();return false;});};SigmaUIEngine.prototype.enableOptionsClicks=function(B){var A=this;jQuery(document).ready(function(){jQuery(".sigmaee_sigmaOptions").click(function(){A.toggleOptionsContainer(0,B);return false;});jQuery("li.optionsTabClose").click(function(){jQuery("div.sigmaee_sigmaOptionsContainer").hide("slow");return false;});});};SigmaUIEngine.prototype.toggleOptionsContainer=function(A,C){var B=jQuery("div.sigmaee_sigmaOptionsContainer");if(B.is(":visible")){B.hide("slow");return false;}else{jQuery("#sigmaOptionsTabs").tabs("select",A);B.show("slow");return true;}};SigmaUIEngine.prototype.enableClickReorderPropertiesMode=function(){var A=this;jQuery(document).ready(function(){jQuery(".sigmaee_reorderPropertiesOn").click(function(){if(jQuery(".reorderPropertiesModeIndicator").is(":visible")){jQuery("a.reorderPropertiesOff").click();}else{jQuery(".reorderPropertiesModeButton").hide();jQuery(".reorderPropertiesModeIndicator").show();jQuery("div.propertyContainer").css("cursor","move");}return false;});jQuery(".reorderPropertiesOff").click(function(){A.disableDragAndDrop();A.enableHoverOverProperty();A.enableHoverOverValue();jQuery(".reorderPropertiesModeButton").show();jQuery(".reorderPropertiesModeIndicator").hide();jQuery("div.propertyContainer").css("cursor","pointer");jQuery("#inReorderPropertiesMode").attr("checked",false);A.config.inReorderPropertiesMode=false;jQuery(".entityLabel").show();jQuery(".entityPicture").show();jQuery(".valuesContainer").show();return false;});jQuery("#inReorderPropertiesMode").attr("checked",A.config.inReorderPropertiesMode);jQuery("#inReorderPropertiesModeHideValues").click(function(){var B=jQuery(this).attr("checked");if(B){A.config.inReorderPropertiesMode=true;jQuery(".entityLabel").hide();jQuery(".entityPicture").hide();jQuery(".valuesContainer").hide();}else{A.config.inReorderPropertiesMode=false;jQuery(".entityLabel").show();jQuery(".entityPicture").show();jQuery(".valuesContainer").show();}});jQuery("#inReorderPropertiesModeDisableButtons").click(function(){var B=jQuery(this).attr("checked");if(B){A.disableHoverOverValue();}else{A.enableHoverOverValue();}});});};SigmaUIEngine.prototype.enableLayoutSwitch=function(){var A=this;jQuery("div.layoutImg a").click(function(){var B=jQuery(this).attr("title");A.profile.setPageLayout(B);A.fixWidth();A.fixHeight();jQuery(".viewsAndLayoutsDialog").dialog("close");});};SigmaUIEngine.prototype.enablePropertyButtonsClicks=function(){var A=this;jQuery("a.stickToPreviousOne1").live("click",function(C){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).hide();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne2").show();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne3").hide();var D=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(D);B.property.setStickToPreviousMode(2);}return false;});jQuery("a.stickToPreviousOne2").live("click",function(C){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).hide();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne3").show();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne1").hide();var D=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(D);B.property.setStickToPreviousMode(3);}return false;});jQuery("a.stickToPreviousOne3").live("click",function(C){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).hide();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne1").show();jQuery(this).closest("div.propertyButtonsContainer").find("a.stickToPreviousOne2").hide();var D=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(D);B.property.setStickToPreviousMode(1);}return false;});jQuery("a.singleViewProperty").live("click",function(C){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var D=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(D);B.property.setDisplayMode("single");}return false;});jQuery("a.compactViewProperty").live("click",function(C){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var D=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(D);B.property.setDisplayMode("compact");}return false;});jQuery("a.listViewProperty").live("click",function(C){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var D=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(D);B.property.setDisplayMode("list");}return false;});jQuery("a.hideViewProperty").live("click",function(C){if(jQuery(this).hasClass("ui-state-default")){jQuery(this).parent().parent().find("a").removeClass("ui-state-error");jQuery(this).addClass("ui-state-error");var D=jQuery(this).closest("div.entityContainer").attr("id");var B=A.idToPropertyRender.get(D);A.unfilterSources();B.property.setDisplayMode("hidden");A.hideCovers();}return false;});};SigmaUIEngine.prototype.enableNoResultsClicks=function(){jQuery(".noResultsIndicatorButton").click(function(){jQuery(this).closest("div.noResultsIndicator").hide();});};SigmaUIEngine.prototype.enableShowHideSourcesNumbers=function(){var A=this;if(this.config.rawFlag===false){jQuery(document).ready(function(){var B=A.getShowHideSourcesNumbersFlag();A.setShowHideSourcesNumbersFlag(B);jQuery("#hideShowSourcesNumbers").click(function(){var C=jQuery(this).attr("checked");A.setShowHideSourcesNumbersFlag(C);});});}else{A.setShowHideSourcesNumbersFlag(false);}};SigmaUIEngine.prototype.enableClickRemoveFilterButtons=function(){var A=this;jQuery(".removeSourcesFilterBoxButton").click(function(){A.unfilterSources();});jQuery(".removePropertyAndValueFilterBoxButton").click(function(){A.removePropertyAndValueFilter();});};SigmaUIEngine.prototype.enableHover=function(){if(this.config.rawFlag===false){if(this.config.disableHoverOverProperties==false){this.enableHoverOverProperty();}this.enableHoverOverValue();this.enableHoverOverSource();this.enableHoverOverButtons();}};SigmaUIEngine.prototype.enableHoverOverButtons=function(){jQuery("a.action-button").live("mouseenter",function(){jQuery(this).addClass("ui-state-hover");}).live("mouseleave",function(){jQuery(this).removeClass("ui-state-hover");});};SigmaUIEngine.prototype.enableHoverOverCovers=function(){jQuery(".sigmaee_coverLight").live("mouseover",function(){var A=jQuery(this).data("containerId");jQuery("#"+A).mouseover();}).live("mouseout",function(){jQuery(this).hide();});};SigmaUIEngine.prototype.enableHoverOverValue=function(){var A=this;jQuery("div.profileRight div.valueContainer").live("mouseenter",function(J){A.hideHighlighted();var E=J.currentTarget;log.info("enter on value");var F=jQuery(this).attr("id");var C=A.idToValueRender.get(F);var B=C.value.sources;var G=C.value.property.displayMode;var H=C.value.property.entity.pageLayout;if(A.config.disableHoverOverValues==false){C.value.changeHighlightState(true);if(jQuery(E).find(".valueButtonsContainer").length===0){jQuery(E).append(A.templates.valuesButtonsTemplate);jQuery(E).find("div.valueButtonsContainer").addClass(A.config.viewsClasses[H][G].valueButtonsContainer);}jQuery(E).find(".valueButtonsContainer").addClass(A.config.sigmaeeUIhighlight).show();var I=jQuery(E).find("div.valueButtonsContainer");var D=jQuery(E).find("div.valueLabelContainer");A.coverBorders(D,I);if(C.value.getWebLink()){jQuery(E).find("a.openDocumentSource").attr("href",C.value.getWebLink()).show();}}if(A.config.valuesFilteredLock===false){if(A.config.disableHoverOverValues==false){jQuery(C.containerIdXPath+" a.openDocumentSourceStyleInvisible").removeClass("openDocumentSourceStyleInvisible").addClass("openDocumentSourceStyleVisible");if(jQuery(C.containerIdXPath+" a.dehighlightValue").css("display")=="none"){jQuery(C.containerIdXPath+" a.rejectValue, "+C.containerIdXPath+" a.highlightValue").show();}else{jQuery(C.containerIdXPath+" a.rejectValue").show();}}A.dynamicSourceHighlightAndFilter(true,B);}}).live("mouseleave",function(C){A.hideHighlighted();A.hideCovers();var E=C.currentTarget;jQuery(E).find(".valueButtonsContainer").hide();var D=jQuery(this).attr("id");var B=A.idToValueRender.get(D);log.info("leave value");B.value.changeHighlightState(false);if(A.config.valuesFilteredLock===false){jQuery(this).removeClass(A.config.sigmaeeUIhighlight);jQuery(B.containerIdXPath+" a.openDocumentSourceStyleVisible").removeClass("openDocumentSourceStyleVisible").addClass("openDocumentSourceStyleInvisible");jQuery(B.containerIdXPath+" a.highlightValue, "+B.containerIdXPath+" a.rejectValue").hide();A.dynamicSourceHighlightAndFilter(false);}});jQuery(".valueButtonsContainer").live("mouseover",function(B){if(isIE()){return ;}var C=B.target;B.stopImmediatePropagation();jQuery(C).parent().addClass(A.config.sigmaeeUIhighlight);}).live("mouseout",function(B){if(isIE()){return ;}var C=B.target;B.stopImmediatePropagation();jQuery(C).parent().removeClass(A.config.sigmaeeUIhighlight);});};SigmaUIEngine.prototype.disableHoverOverValue=function(){jQuery("#ecsse-profile-list-id li.value").die("mouseenter").die("mouseleave");};SigmaUIEngine.prototype.enableHoverOverProperty=function(){var A=this;jQuery("div.profileRight div.propertyContainer").live("mouseenter",function(K){A.hideHighlighted();log.info("enter on property");var E=K.currentTarget;K.stopImmediatePropagation();var F=jQuery(this).parent().attr("id");var D=A.idToPropertyRender.get(F);var B=D.property.sources;var H=D.property.displayMode;var I=D.property.entity.pageLayout;D.property.changeHighlightState(true);var M=jQuery(E).find(".propertyLabelContainer").width();var L=jQuery(E).width();if(jQuery(E).find(".propertyButtonsContainer").length===0){jQuery(E).append(A.templates.propertyButtonsTemplate);jQuery(E).find("div.propertyButtonsContainer").addClass(A.config.viewsClasses[I][H].propertyButtonsContainer);}var G=jQuery(E).find("div.propertyButtonsContainer");if(I==="layout3"){G.css({left:0});}else{G.css({left:(L-M-2*A.config.propertyOrValueSideMargin-2)});}G.addClass(A.config.sigmaeeUIhighlight).show().find("a").removeClass("ui-state-error");if(I==="layout2"){var C=D.property.getStickToPreviousMode();if(C==1){G.find("a.stickToPreviousOne1").show();G.find("a.stickToPreviousOne2").hide();G.find("a.stickToPreviousOne3").hide();}else{if(C==2){G.find("a.stickToPreviousOne1").hide();G.find("a.stickToPreviousOne2").show();G.find("a.stickToPreviousOne3").hide();}else{G.find("a.stickToPreviousOne1").hide();G.find("a.stickToPreviousOne2").hide();G.find("a.stickToPreviousOne3").show();}}}else{G.find("a.stickToPreviousOne").hide();}if(H=="list"){G.find("a.listViewProperty").addClass("ui-state-error");}else{if(H=="single"){G.find("a.singleViewProperty").addClass("ui-state-error");}else{if(H=="compact"){G.find("a.compactViewProperty").addClass("ui-state-error");}else{log.error("Not supported display mode ["+H+"]");}}}var J=jQuery(E).find(".propertyLabelContainer");A.coverBorders(J,G);if(A.config.valuesFilteredLock===false){A.dynamicSourceHighlightAndFilter(true,B);}}).live("mouseleave",function(C){A.hideHighlighted();A.hideCovers();var E=C.currentTarget;C.stopImmediatePropagation();jQuery(E).find(".propertyButtonsContainer").hide();if(A.config.valuesFilteredLock===false){A.dynamicSourceHighlightAndFilter(false);}var D=jQuery(this).parent().attr("id");var B=A.idToPropertyRender.get(D);B.property.changeHighlightState(false);});jQuery(".propertyButtonsContainer").live("mouseover",function(B){if(isIE()){return ;}var C=B.target;B.stopImmediatePropagation();jQuery(C).parent().addClass("ui-state-active");}).live("mouseout",function(B){if(isIE()){return ;}var C=B.target;B.stopImmediatePropagation();jQuery(C).parent().removeClass("ui-state-active");});};SigmaUIEngine.prototype.disableHoverOverProperty=function(){jQuery("div.profileRight div.propertyContainer").die("mouseenter").die("mouseleave");};SigmaUIEngine.prototype.enableHoverOverSource=function(){var A=this;jQuery(this.config.sigmaNewSourcesListIdXPath+" li.source, "+this.config.sigmaApprovedSourcesListIdXPath+" li.source, "+this.config.sigmaRejectedSourcesListIdXPath+" li.source").live("mouseenter",function(C){C.stopPropagation();var D=jQuery(this).attr("id");var B=A.idToSourceRender.get(D);if(B.engine.config.valuesFilteredLock===false){B.source.highlightSource(true);B.source.highlightSourcePropertiesAndValues(true);}}).live("mouseleave",function(C){C.stopPropagation();var D=jQuery(this).attr("id");var B=A.idToSourceRender.get(D);if(B.engine.config.valuesFilteredLock===false){B.source.highlightSource(false);B.source.highlightSourcePropertiesAndValues(false);}});};SigmaUIEngine.prototype.disableHoverOverSource=function(){jQuery(this.config.sigmaNewSourcesListIdXPath+" li.source, "+this.config.sigmaAprovedSourcesListIdXPath+" li.source, "+this.config.sigmaRejectedSourcesListIdXPath+" li.source").die("mouseenter").die("mouseleave");};var services=new Services();function ConfigUpdateObserver(A){this.uiEngine=A;}ConfigUpdateObserver.prototype.updateConfiguration=function(A){this.uiEngine.updateConfiguration(A);};function EntityRenderer(A){this.engine=A;}EntityRenderer.prototype.setNewInformationVisible=function(A){this.engine.setNewInformationVisible(A);};EntityRenderer.prototype.setConfirmedInformationVisible=function(A){this.engine.setConfirmedInformationVisible(A);};EntityRenderer.prototype.setRejectedInformationVisible=function(A){this.engine.setRejectedInformationVisible(A);};EntityRenderer.prototype.sourceAdded=function(A){this.engine.renderSource(A);};EntityRenderer.prototype.propertyAdded=function(C,A){var B=false;if(A){B=A.elementID;log.info("CALLED propertyAdded for ["+C.name+"]with insertBefore = ["+A.name+"] with id ["+B+"]");}else{log.info("CALLED propertyAdded for ["+C.name+"]with insertBefore = ["+A+"]");}this.engine.renderProperty(C,B);C.setStickToPreviousMode(C.getStickToPreviousMode());};EntityRenderer.prototype.finishedAddingNewSources=function(){this.engine.updatePaginationOnTab1();log.info("finishedAddingNewSources");};EntityRenderer.prototype.finishedAddingProperties=function(){this.engine.config.propertiesAndValuesRendering=false;this.engine.sourceToFetched--;if(this.engine.sourceToFetched===0){log.info("FINISH ADDING SOURCES AND ALL VALUES");if(this.engine.profile.disableInitialNotifications===true){log.info("finishedAddingProperties when disableInitialNotifications=true");this.engine.buildValuesAndPropertiesPiece();}}this.__moveProperty("picture","top",null);this.__moveProperty("title","after","picture");this.__moveProperty("given name","after","title");this.__moveProperty("family name","after","given name");this.__moveProperty("comment","after","family name");this.__moveProperty("is creator of","after","comment");};EntityRenderer.prototype.__moveProperty=function(B,E,A){var C;if(E==="top"){C=this.engine.profile.getPropertyOnTop();}else{C=this.engine.profile.getProperty(A);if(!C){C=this.engine.profile.getPropertyOnTop();}}if(C){property=this.engine.profile.getProperty(B);if(!property){property=this.engine.profile.addProperty(B);}if(E==="after"){var D=this.engine.profile.getPropertyAfter(C);if(D){property.moveBefore(D.name);}}else{property.moveBefore(C.name);}}};EntityRenderer.prototype.pageLayoutChanged=function(A){log.info("pageLayoutChanged to:"+A);if(A==="layout1"){this.engine.setShowHideSourcesNumbersFlag(true);}else{if(A==="layout2"){this.engine.setShowHideSourcesNumbersFlag(false);}else{if(A==="layout3"){this.engine.setShowHideSourcesNumbersFlag(true);}}}};function TopLabelObserver(A){this.engine=A;jQuery(this.engine.getSigmaContainerIdXPath()+" div.entityLabel").hide();}TopLabelObserver.prototype.propertyAdded=function(A){if(A.name=="label"){A.addObserver(this);}};TopLabelObserver.prototype.topValueChanged=function(A){if(A){jQuery(this.engine.getSigmaContainerIdXPath()+" .entityLabel").show().text(A.label);this.engine.updateExpandToFullViewLink(A.label);jQuery("."+this.engine.profile.pageLayout+"TopLabelContainer").show();}else{jQuery(this.engine.getSigmaContainerIdXPath()+" .entityLabel").hide();}};function TopPictureObserver(A){this.engine=A;jQuery(this.engine.getSigmaContainerIdXPath()+" .entityPicture").hide();}TopPictureObserver.prototype.propertyAdded=function(A){if(A.name=="picture"){A.addObserver(this);}};TopPictureObserver.prototype.topValueChanged=function(B){return ;if(B){var A;if(!B.uris.length){if(B.label){A=B.label;}else{A=B.value;}}else{A=B.uris[0];}jQuery(this.engine.getSigmaContainerIdXPath()+" .entityPicture").replaceWith('<img class="entityPicture entityPictureStyle" src="'+A+'" onerror="javascript:imgErrorDisplayNone(this);" />').show();jQuery("."+this.engine.profile.pageLayout+"TopPictureContainer").show();}else{jQuery(this.engine.getSigmaContainerIdXPath()+" .entityPicture").hide();}};function TopCommentObserver(A){this.engine=A;jQuery(this.engine.getSigmaContainerIdXPath()+" .entityComment").hide();}TopCommentObserver.prototype.propertyAdded=function(A){if(A.name=="comment"){A.addObserver(this);}};TopCommentObserver.prototype.topValueChanged=function(A){return ;if(A){jQuery(this.engine.getSigmaContainerIdXPath()+" .entityComment").show().html(A.label);jQuery("."+this.engine.profile.pageLayout+"TopCommentContainer").show();}else{jQuery(this.engine.getSigmaContainerIdXPath()+" .entityComment").hide();}};function SourcesFetchedObserver(A){this.engine=A;jQuery("#fetchingIndicator").hide();}SourcesFetchedObserver.prototype.exhausted=function(){log.warn("exhausted");};SourcesFetchedObserver.prototype.pendingCountUpdated=function(A){jQuery("#pendingSources").html(A);if(A===0){jQuery("#fetchingIndicator").hide();}else{jQuery("#fetchingIndicator").show();}};SourcesFetchedObserver.prototype.noResults=function(A){this.engine.displayNoResultCase(A);};function initialize(K,G,B,H,F){services.addObserver({serviceNotAvailable:function(N,M){}});B.addObserver({queryChanged:function(M){log.info("Setting query #q to ["+M+"]");jQuery("#q").val(M);}});log.info("initialize with i: ["+H+"]");var C=getURLParam("q");var A=getURLParams("id");var I=getURLParam("pid");var J=getURLParam("singlesource");log.info("There is no json from servlet - going to sigmaget one with ajax");if(I){log.info("found pid in location");F.loadPermalink(I);}else{if(getURLParam("sindice")=="0"){B.useSindice=false;}if(getURLParam("idsearch")=="0"){B.useIdentifierSearch=false;}if(getURLParam("ifpsearch")=="0"){B.useIFPSearch=false;}if(getURLParam("fetchers")){B.fetchers=getURLParam("fetchers");log.info("Setting fetchersString to ["+getURLParam("fetchers")+"]");}if(getURLParam("fetch")=="0"){B.doFetchFromWeb=false;}if(getURLParam("cache")=="0"){B.doUseCaches=false;}if(getURLParam("singlesource")){B.useSingleSource=true;}if(C){log.info("found query in location");B.setQuery(C);}else{if(A!=null&&A.length>0){}}if(A!=null){for(var L=0;L<A.length;L++){B.addSingleSource(A[L],null);}}if(J){B.addSingleSource(J,function(M){if(!M){}else{if(M!=null&&M.valueCount==0&&C!=""){href=sigmaUtilities.getBaseUrl()+"/search?singlesource="+encodeURIComponent(J)+"&q=";if(getURLParam("fetchers")){href+="&fetchers="+getURLParam("fetchers");}if(getURLParam("cache")){href+="&cache="+getURLParam("cache");}if(getURLParam("fetch")){href+="&fetch="+getURLParam("fetch");}if(getURLParam("raw")){href+="&raw="+getURLParam("raw");}if(getURLParam("fromsindice")){href+="&fromsindice="+getURLParam("fromsindice");}window.location.href=href;}else{if(M!=null&&M.valueCount==0&&C==""){}}}});}else{var E=parseInt(B.sigmaEEConfiguration.initialNumberOfSources,10);var D=getURLParam("sources");if(D&&D!==""){E=parseInt(D,10);}K.sourceToFetched=E;B.orderMoreSources(E);}}}var profile;var uiEngine;function startSigma(D){if(isIE7()){alert("Sorry we are currently not able to fully support all browsers. \nWhen using SIGMA on Internet Explorer 7 you might experience some difficulties. \nPlease upgrade to version Internet Explorer 8.\nOur team is working to fix this in near future. Sorry  for any inconvenience.");}var C=getURLParam("raw");profile=new EntityModel();profile.setEmbededMode(sigmaConfig.embededMode);uiEngine=new SigmaUIEngine(sigmaConfig.containerIds[D]);uiEngine.setSigmaContainerId();uiEngine.setRawFlag(C);uiEngine.sourceToFetched=0;uiEngine.setEmbededMode(sigmaConfig.embededMode);uiEngine.setProfile(profile);if(getURLParam("fromsindice")=="1"){uiEngine.fromSindice=true;}if(getURLParam("hideHeader")=="1"){uiEngine.config.hideHeader=true;}if(getURLParam("hideSearchbar")=="1"){uiEngine.config.hideSearchbar=true;}if(getURLParam("hideFooter")=="1"){uiEngine.config.hideFooter=true;}if(getURLParam("hideBottomMessage")=="1"){uiEngine.config.hideBottomMessage=true;}if(getURLParam("showFakeSearchbar")=="1"){uiEngine.config.showFakeSearchbar=true;}if(getURLParam("disableHoverOverProperties")=="1"){uiEngine.config.disableHoverOverProperties=true;}if(getURLParam("disableHoverOverValues")=="1"){uiEngine.config.disableHoverOverValues=true;}if(getURLParam("showHideSourcesNumbers")=="false"){uiEngine.config.showHideSourcesNumbers=false;}if(getURLParam("disableDragMode")=="1"){uiEngine.config.dragMode=false;}if(getURLParam("showNotifications")=="1"){uiEngine.config.showNotifications=true;}uiEngine.initContainers();profile.addObserver(new EntityRenderer(uiEngine));profile.addObserver(new TopLabelObserver(uiEngine));profile.addObserver(new TopPictureObserver(uiEngine));profile.addObserver(new TopCommentObserver(uiEngine));profile.addObserver(new ConfigUpdateObserver(uiEngine));var B=new SourceManager(profile);if(getURLParam("disableSearchProvider")!=null){var A=getURLParam("disableSearchProvider").split(",");B.disableSearchProvider=A;}B.addObserver(new SourcesFetchedObserver(uiEngine));var E=new RecipeManager(profile,B);initialize(uiEngine,profile,B,D,E);uiEngine.enableValueButtonsClicks();uiEngine.enablePropertyButtonsClicks();uiEngine.enableSourceButtonsClicks();uiEngine.enableConfigClicks(B);uiEngine.enableHover();uiEngine.enableTrashBinClicks();uiEngine.enableClickOnSourcesTabs();uiEngine.enableClickRemoveFilterButtons();uiEngine.enableClickReorderPropertiesMode();uiEngine.fixWidth();uiEngine.enableOnResize();uiEngine.enableClickAddMoreSourcesFromUrl(B);uiEngine.enableClickNewSigma();uiEngine.enableClickMoreSources(B);uiEngine.enableLayoutSwitch();uiEngine.enableHoverOverCovers();uiEngine.enableClickViewsAndLayouts();uiEngine.enableShowHideSourcesNumbers();uiEngine.enableOptionsClicks(E);uiEngine.enableClickCreatePermalink(E);uiEngine.enableNoResultsClicks();if(uiEngine.config.dragMode==true){uiEngine.enableDragAndDrop(".dragMeOn");}}jQuery(document).ready(function(){for(var A=0;A<sigmaConfig.containerIds.length;A++){startSigma(A);}});var sigmaLoaded3=true;
