Advertisement
Guest User

Untitled

a guest
Apr 20th, 2016
1,393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 122.09 KB | None | 0 0
  1. var YUIDom=YAHOO.util.Dom,YUIEvent=YAHOO.util.Event,YUISelector=YAHOO.util.Selector,YUIKeyListener=YAHOO.util.KeyListener;if(YAHOO.env.ua.ie==8){YAHOO.lang.JSON.useNativeStringify=false}if(typeof Alfresco=="undefined"||!Alfresco){var Alfresco={}}Alfresco.constants=Alfresco.constants||{};Alfresco.constants.CSRF_POLICY=Alfresco.constants.CSRF_POLICY||{enabled:false};Alfresco.constants.IFRAME_POLICY=Alfresco.constants.IFRAME_POLICY||{sameDomain:"allow",crossDomainUrls:["*"]};Alfresco.template=Alfresco.template||{};Alfresco.component=Alfresco.component||{};Alfresco.dashlet=Alfresco.dashlet||{};Alfresco.module=Alfresco.module||{};Alfresco.util=Alfresco.util||{};Alfresco.logger=Alfresco.logger||{};Alfresco.service=Alfresco.service||{};Alfresco.thirdparty=Alfresco.thirdparty||{};Alfresco.widget=Alfresco.widget||{};Alfresco.admin=Alfresco.admin||{};Alfresco.action=Alfresco.action||{};Alfresco.doclib=Alfresco.doclib||{MODE_SITE:0,MODE_REPOSITORY:1};Alfresco.messages=Alfresco.messages||{global:null,scope:{}};Alfresco.util.isBrowserPluginInstalled=function(a){return navigator.mimeTypes&&navigator.mimeTypes[a]&&navigator.mimeTypes[a].enabledPlugin};Alfresco.util.isSharePointPluginInstalled=function(){var a=Alfresco.util.isBrowserPluginInstalled("application/x-sharepoint-webkit");var b=Alfresco.util.isBrowserPluginInstalled("application/x-sharepoint");if(YAHOO.env.ua.webkit&&a){return true}return b!=undefined};Alfresco.util.validLocationForOnlineEdit=function(a){var b=Alfresco.util.combinePaths(a.tenant?a.tenant:"",a.site?a.site.name:"",a.container?a.container.name:"",a.path,a.file);var c=b.split("/");for(i=0,j=c.length;i<j;i++){if((/[~"#%&*:<>?\/\\{|}]/).test(c[i])){return false}}return true};Alfresco.util.onlineEditUrl=function(b,a){var e=a.tenant?a.tenant:"";var c=b.host+":"+b.port+"/"+Alfresco.util.combinePaths(b.contextPath,e,(a.container&&a.site)?a.site.name:"",a.container?encodeURIComponent(a.container.name):"",encodeURIComponent(a.container?a.path:a.path.substring(a.path.indexOf("/",1))).replace(/%2F/g,"/"),encodeURIComponent(a.file));if(!(/^(http|https):\/\//).test(c)){var d=b.protocol;if(d==null){d=window.location.protocol;d=d.substring(0,d.length-1)}c=d+"://"+c}return c};Alfresco.util.onlineEditUrlAos=function(f,d){if(!Alfresco.util.isValueSet(f)||!Alfresco.util.isValueSet(f.baseUrl)||!Alfresco.util.isValueSet(d.webdavUrl)||(d.webdavUrl.substring(0,8)!="/webdav/")){throw new Error("Alfresco.util.onlineEditUrlAos: Sanity checks failed.")}var g=d.webdavUrl.substring(7);var b=Alfresco.util.combinePaths(f.baseUrl,g);if(encodeURI(b).length>256){var a=d.webdavUrl.lastIndexOf("/");if(a<0){throw new Error("Alfresco.util.onlineEditUrlAos: Missing filename in webdav URL.")}var e=d.webdavUrl.substring(a+1);b=Alfresco.util.combinePaths(f.baseUrl,"_aos_nodeid",d.nodeRef.split("/").pop(),e)}if(encodeURI(b).length>256){var c=d.webdavUrl.lastIndexOf(".");b=Alfresco.util.combinePaths(f.baseUrl,"_aos_nodeid",d.nodeRef.split("/").pop(),"Document"+(c>0?d.webdavUrl.substring(c):""))}return b};Alfresco.util.appendArrayToObject=function(e,a,f){var d=(f!==undefined?f:true);if(YAHOO.lang.isObject(e)&&YAHOO.lang.isArray(a)){for(var b=0,c=a.length;b<c;b++){if(a[b]!==undefined){e[a[b]]=d}}}return e};Alfresco.util.arrayToObject=function(a,f){var e={},d=(f!==undefined?f:true);if(YAHOO.lang.isArray(a)){for(var b=0,c=a.length;b<c;b++){if(a[b]!==undefined){e[a[b]]=d}}}return e};Alfresco.util.deepCopy=function(g,h){if(!g){return g}if(!h){h={}}if(YAHOO.lang.isArray(g)){var f=[];for(var e=0,k=g.length,c;e<k;e++){c=g[e];if(!YAHOO.lang.isFunction(c)||h.copyFunctions==true){f.push(Alfresco.util.deepCopy(c,h))}}return f}if(Alfresco.util.isDate(g)){return new Date(g.getTime())}if(YAHOO.lang.isString(g)||YAHOO.lang.isNumber(g)||YAHOO.lang.isBoolean(g)){return g}if(YAHOO.lang.isObject(g)){if(g.toString()=="[object Object]"){var d={},b;for(var a in g){if(g.hasOwnProperty(a)){b=g[a];if(!YAHOO.lang.isFunction(b)||h.copyFunctions==true){d[a]=Alfresco.util.deepCopy(b,h)}}}return d}else{return g}}return null};Alfresco.util.isDate=function(a){return a.constructor&&a.constructor.toString().indexOf("Date")!=-1};Alfresco.util.objectMatchesPattern=function(c,b){for(var a in b){if(b.hasOwnProperty(a)&&(!b.hasOwnProperty(a)||(c[a]!=b[a]&&b[a]!="*"))){return false}}return true};Alfresco.util.dotNotationToObject=function(h,f){var a={},g=a;if(typeof h==="string"){var c=h.split("."),e,b,d;for(b=0,d=c.length-1;b<d;b++){e=c[b];g[e]={};g=g[e]}g[c[b]]=f!==undefined?f:null}return a};Alfresco.util.findValueByDotNotation=function(g,f,a){var e=a?a:null;if(f&&g){var d=g;var c=f.split(".");for(var b=0;b<c.length;b++){d=d[c[b]];if(typeof d=="undefined"){return e}}return d}return e};Alfresco.util.substituteDotNotation=function(c,b){return YAHOO.lang.substitute(c,{},function a(e,f,d){return Alfresco.util.findValueByDotNotation(b,e)})};Alfresco.util.findInArray=function(b,d,a){var c=Alfresco.util.arrayIndex(b,d,a);return c!==-1?b[c]:null};Alfresco.util.arrayContains=function(a,b){return Alfresco.util.arrayIndex(a,b)!==-1};Alfresco.util.arrayRemove=function(a,c){var b=Alfresco.util.arrayIndex(a,c);while(b!==-1){a.splice(b,1);b=Alfresco.util.arrayIndex(a,c)}return a};Alfresco.util.arrayIndex=function(b,e,a){if(b){for(var c=0,d=b.length;c<d;c++){if(a){if(b[c]&&b[c][a]==e){return c}}else{if(b[c]==e){return c}}}}return -1};Alfresco.util.assertNotEmpty=function(b,a){if(typeof b=="undefined"||!b||b===""){throw new Error(a)}};Alfresco.util.isValueSet=function(a,b){if(YAHOO.lang.isUndefined(a)||YAHOO.lang.isNull(a)){return false}if(YAHOO.lang.isString(a)&&a.length===0&&!!b===false){return false}return true};Alfresco.util.combinePaths=function(){var c="",a,b;for(a=0,b=arguments.length;a<b;a++){if(arguments[a]!==null){c+=arguments[a]+(arguments[a]!=="/"?"/":"")}}c=c.replace(/(^|[^:])\/{2,}/g,"$1/");if(arguments.length>0&&!(typeof arguments[arguments.length-1]==="undefined")&&arguments[arguments.length-1].match(/(.)\/$/)===null){c=c.replace(/(.)\/$/g,"$1")}return c};Alfresco.util.BYTES_KB=1024;Alfresco.util.BYTES_MB=1048576;Alfresco.util.BYTES_GB=1073741824;Alfresco.util.formatFileSize=function(a,b){var b=b||0;if(typeof a=="string"){a=a.replace(/,/gi,"");a=parseInt(a,10)}if(a<Alfresco.util.BYTES_KB){return a+" "+Alfresco.util.message("size.bytes")}else{if(a<Alfresco.util.BYTES_MB){a=(a/Alfresco.util.BYTES_KB).toFixed(b);return a+" "+Alfresco.util.message("size.kilobytes")}else{if(a<Alfresco.util.BYTES_GB){a=(a/Alfresco.util.BYTES_MB).toFixed(b);return a+" "+Alfresco.util.message("size.megabytes")}else{if(isNaN(a)){return"0 "+Alfresco.util.message("size.bytes")}else{a=(a/Alfresco.util.BYTES_GB).toFixed(b);return a+" "+Alfresco.util.message("size.gigabytes")}}}}};Alfresco.util.getFileIcon=function(d,b,k,g){var l={aep:"aep",ai:"ai",aiff:"aiff",asf:"video",asnd:"asnd",asx:"video",au:"audio",avi:"video",avx:"video",bmp:"img",css:"text",divx:"video",doc:"doc",docx:"doc",docm:"doc",dotx:"doc",dotm:"doc",eml:"eml",eps:"eps",fla:"fla",flv:"video",fxp:"fxp",gif:"img",htm:"html",html:"html",indd:"indd",jpeg:"img",jpg:"img",key:"key",mkv:"video",mov:"video",movie:"video",mp3:"mp3",mp4:"video",mpeg:"video",mpeg2:"video",mpv2:"video",msg:"eml",numbers:"numbers",odg:"odg",odp:"odp",ods:"ods",odt:"odt",ogg:"video",ogv:"video",pages:"pages",pdf:"pdf",png:"img",ppj:"ppj",ppt:"ppt",pptx:"ppt",pptm:"ppt",pps:"ppt",ppsx:"ppt",ppsm:"ppt",pot:"ppt",potx:"ppt",potm:"ppt",ppam:"ppt",sldx:"ppt",sldm:"ppt",psd:"psd",qt:"video",rtf:"rtf",snd:"audio",spx:"audio",svg:"img",swf:"swf",tif:"img",tiff:"img",txt:"text",wav:"audio",webm:"video",wmv:"video",xls:"xls",xlsx:"xls",xltx:"xls",xlsm:"xls",xltm:"xls",xlam:"xls",xlsb:"xls",xml:"xml",xvid:"video",zip:"zip"};var c="generic",m=typeof b==="string"?b:"cm:content",a=typeof g==="string"?g:null,f=typeof k==="number"?k:32;var h=Alfresco.util.getFileIcon.types[m];if(h==="file"){var e=d.substring(d.lastIndexOf(".")+1).toLowerCase();if(e in l){c=l[e]}}else{if(typeof h=="undefined"){if(a!==null){h=Alfresco.util.getFileIcon.types[a];if(typeof h=="undefined"){h="file"}}else{h="file"}}}return c+"-"+h+"-"+f+".png"};Alfresco.util.getFileIconByMimetype=function(b,c){var e={"text/css":"css","application/vnd.ms-excel":"xls","image/tiff":"tiff","audio/x-aiff":"aiff","application/vnd.ms-powerpoint":"ppt","application/illustrator":"ai","image/gif":"gif","audio/mpeg":"mp3","message/rfc822":"eml","application/vnd.oasis.opendocument.graphics":"odg","application/x-indesign":"indd","application/rtf":"rtf","audio/x-wav":"wav","application/x-fla":"fla","video/x-ms-wmv":"wmv","application/msword":"doc","video/x-msvideo":"avi","video/mpeg2":"mpeg2","video/x-flv":"flv","application/x-shockwave-flash":"swf","audio/vnd.adobe.soundbooth":"asnd","image/svg+xml":"svg","application/vnd.apple.pages":"pages","text/plain":"txt","video/quicktime":"mov","image/bmp":"bmp","video/x-m4v":"m4v","application/pdf":"pdf","application/vnd.adobe.aftereffects.project":"aep","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"xlsx","text/xml":"xml","application/zip":"zip","video/webm":"webm","image/png":"png","text/html":"html","image/vnd.adobe.photoshop":"psd","video/ogg":"ogv","image/jpeg":"jpg","application/x-zip":"fxp","video/mp4":"mp4","image/x-xbitmap":"xbm","video/x-rad-screenplay":"avx","video/x-sgi-movie":"movie","audio/x-ms-wma":"wma","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"docx","application/vnd.openxmlformats-officedocument.presentationml.presentation":"pptx","application/vnd.oasis.opendocument.presentation":"odp","video/x-ms-asf":"asf","application/vnd.oasis.opendocument.spreadsheet":"ods","application/vnd.oasis.opendocument.text":"odt","application/vnd.apple.keynote":"key","image/vnd.adobe.premiere":"ppj","application/vnd.apple.numbers":"numbers","application/eps":"eps","audio/basic":"au"};var d="generic",a=typeof c==="number"?c:32;if(b in e){d=e[b]}return d+"-file-"+a+".png"};Alfresco.util.getFileIcon.types={"{http://www.alfresco.org/model/content/1.0}cmobject":"file","cm:cmobject":"file","{http://www.alfresco.org/model/content/1.0}content":"file","cm:content":"file","{http://www.alfresco.org/model/content/1.0}thumbnail":"file","cm:thumbnail":"file","{http://www.alfresco.org/model/content/1.0}folder":"folder","cm:folder":"folder","{http://www.alfresco.org/model/content/1.0}category":"category","cm:category":"category","{http://www.alfresco.org/model/content/1.0}person":"user","cm:person":"user","{http://www.alfresco.org/model/content/1.0}authorityContainer":"group","cm:authorityContainer":"group",tag:"tag","{http://www.alfresco.org/model/site/1.0}sites":"site","st:sites":"site","{http://www.alfresco.org/model/site/1.0}site":"site","st:site":"site","{http://www.alfresco.org/model/transfer/1.0}transferGroup":"server-group","trx:transferGroup":"server-group","{http://www.alfresco.org/model/transfer/1.0}transferTarget":"server","trx:transferTarget":"server"};Alfresco.util.getFileExtension=function(b){var a=(new String(b)).match(/^.*\.([^\.]*)$/);if(YAHOO.lang.isArray(a)&&YAHOO.lang.isString(a[1])){return a[1]}return null};Alfresco.util.loadWebscript=function(a){var d=Alfresco.util.deepCopy(a);d.method=d.method||Alfresco.util.Ajax.GET;d.properties=d.properties||{};d.properties.htmlid=d.properties.htmlid||Alfresco.util.generateDomId();Alfresco.util.Ajax.request({method:d.method,url:d.url,dataObj:d.properties,successCallback:{fn:function b(e,f){var c=Alfresco.util.Ajax.sanitizeMarkup(e.serverResponse.responseText);var h=document.createElement("div");h.innerHTML=c[0];if(!YAHOO.util.Selector.query("#"+d.properties.htmlid,h,true)){h.setAttribute("id",d.properties.htmlid)}var g=YAHOO.util.Dom.get(d.target);if(!g){g=document.createElement("div");YAHOO.util.Dom.addClass(g,"hidden");document.body.appendChild(g)}g.appendChild(h);window.setTimeout(c[1],0)},scope:this,obj:a},failureMessage:Alfresco.util.message("message.failure"),scope:this,execScripts:false})};Alfresco.util.getPasswordStrength=function(p,d){var l=YAHOO.lang.merge({username:null,minLength:0,minUpper:0,minLower:0,minNumeric:0,minSymbols:0},d);var b=0,o=/\d/g,m=/\D/g,k=/([!,@,#,$,%,^,&,*,?,_,~])/g,g;if((!p||p.length<d.minLength)&&d.minLength>0){return null}var n=0,f=0,a;for(var e=0;e<p.length;e++){a=p.charAt(e);if(a.toUpperCase()!=a.toLowerCase()){if(a.toUpperCase()==a){n++}if(a.toLowerCase()==a){f++}}}if(l.minUpper>n||l.minLower>f){return null}if(l.minNumeric>(p.match(o)||[]).length){return null}if(l.minSymbols>(p.match(k)||[]).length){return null}if(d.username&&d.username.indexOf(p)!=-1||p.indexOf(d.username)!=-1){b=0}else{b+=10;if(p.length>(d.minLength+2)){b+=10}if(p.length>(d.minLength+4)){b+=10}if(p.length>(d.minLength+6)){b+=20}if(p.match(o)&&p.match(m)){b+=10}if((p.match(o)||[]).length>2){b+=10}if(n>0&&f>0){b+=10;if(n>1&&f>1){b+=10}}g=p.match(k);if(g){b+=10;if((g||[]).length>3){b+=10}}}var h=[{name:"weak",interval:[0,20]},{name:"medium",interval:[21,30]},{name:"strong",interval:[31,50]},{name:"best",interval:[51,110]}];for(var e=0;e<h.length;e++){if(b>=h[e].interval[0]&&b<=h[e].interval[1]){return{name:h[e].name}}}};Alfresco.util.loadWebscript=function(a){var d=Alfresco.util.deepCopy(a);d.method=d.method||Alfresco.util.Ajax.GET;d.properties=d.properties||{};d.properties.htmlid=d.properties.htmlid||Alfresco.util.generateDomId();Alfresco.util.Ajax.request({method:d.method,url:d.url,dataObj:d.properties,successCallback:{fn:function b(e,f){var c=Alfresco.util.Ajax.sanitizeMarkup(e.serverResponse.responseText);var h=document.createElement("div");h.innerHTML=c[0];if(!YAHOO.util.Selector.query("#"+d.properties.htmlid,h,true)){h.setAttribute("id",d.properties.htmlid)}var g=YAHOO.util.Dom.get(d.target);if(!g){g=document.createElement("div");YAHOO.util.Dom.addClass(g,"hidden");document.body.appendChild(g)}g.appendChild(h);window.setTimeout(c[1],0)},scope:this,obj:a},failureMessage:Alfresco.util.message("message.failure"),scope:this,execScripts:false})};Alfresco.util.getScrollPosition=function(){if(YAHOO.env.ua.ie>0){if(document.compatMode&&document.compatMode!="BackCompat"){return[document.documentElement.scrollLeft,document.documentElement.scrollTop]}else{return[document.body.scrollLeft,document.body.scrollTop]}}else{return[window.scrollX,window.scrollY]}};Alfresco.util.formatDate=function(b){if(YAHOO.lang.isString(b)){var a=Alfresco.util.fromISO8601(b);if(a){arguments[0]=a}}try{return Alfresco.thirdparty.dateFormat.apply(this,arguments)}catch(c){return b}};Alfresco.util.fromISO8601=function(a,b){if(b){a=a.split("T")[0]}try{return Alfresco.thirdparty.fromISO8601.apply(this,arguments)}catch(c){return null}};Alfresco.util.parseTime=function(a){var e=new Date();var c=a.toString().match(/^(\d{1,2})(?::?(\d\d))?\s*(a*)([p]?)\.*m?\.*$/i);if(c===null||!c[1]||c[1]>24||(c[1]>12&&(c[3]||c[4]))||(c[2]&&c[2]>59)){return null}var b=false;if(c[4]){b=true}if(c[1]==12&&(c[3]||c[4])){b=!b}e.setHours(parseInt(c[1],10)+(b?12:0));e.setMinutes(parseInt(c[2],10)||0);e.setSeconds(0);return e};Alfresco.util.toISO8601=function(a){try{return Alfresco.thirdparty.toISO8601.apply(this,arguments)}catch(b){return""}};Alfresco.util.fromExplodedJSONDate=function(b){try{var a=YAHOO.lang.substitute("{year 4}-{month 2}-{date 2}T{hours 2}:{minutes 2}:{seconds 2}.{milliseconds 3}Z",b,function(f,g,e){if(f=="month"){++g}g=String(g);var d=parseInt(e,10)||2;while(g.length<d){g="0"+g}return g});return Alfresco.thirdparty.fromISO8601.apply(this,[a,Array.prototype.slice.call(arguments).slice(1)])}catch(c){return null}};Alfresco.util.toExplodedJSONDate=function(a){return({zone:"UTC",year:a.getFullYear(),month:a.getMonth(),date:a.getDate(),hours:a.getHours(),minutes:a.getMinutes(),seconds:a.getSeconds(),milliseconds:a.getMilliseconds()})};Alfresco.util.renderRelativeTime=function(a){YAHOO.util.Dom.getElementsByClassName("relativeTime","span",a,function(){this.innerHTML=Alfresco.util.relativeTime(this.innerHTML)})};Alfresco.util.relativeTime=function(k,l){var c=k;if(YAHOO.lang.isString(k)){k=Alfresco.util.fromISO8601(k)}if(!(k instanceof Date)){return c}if(YAHOO.lang.isUndefined(l)){l=new Date()}else{if(YAHOO.lang.isString(l)){l=Alfresco.util.fromISO8601(l)}}var m=Alfresco.util.message,f=((l-k)/1000),h=Math.floor(f/60),d=function n(){return"<span title='"+Alfresco.util.formatDate(k)+"'>"+m.apply(this,arguments)+"</span>"};if(h<=0){return d("relative.seconds",this,f)}if(h==1){return d("relative.minute",this)}if(h<45){return d("relative.minutes",this,h)}if(h<90){return d("relative.hour",this)}var a=Math.round(h/60);if(h<1440){return d("relative.hours",this,a)}if(h<2880){return d("relative.day",this)}var b=Math.round(h/1440);if(h<43200){return d("relative.days",this,b)}if(h<86400){return d("relative.month",this)}var g=Math.round(h/43200);if(h<525960){return d("relative.months",this,g)}if(h<1051920){return d("relative.year",this)}var e=Math.round(h/525960);return d("relative.years",this,e)};Alfresco.util.relativeDate=function(t,r,e){var m=Alfresco.util.message;if(YAHOO.lang.isString(t)){t=Alfresco.util.fromISO8601(t)}if(YAHOO.lang.isObject(r)){e=r;r=m("date-format.default")}var b=new Date(),s=new Date(b.getTime()),o=Alfresco.thirdparty.dateFormat,c=YAHOO.widget.DateMath,f=Alfresco.thirdparty.dateFormat.masks.isoDate,k=o(t,f),q=o(b,f),a=o(c.add(b,c.DAY,-1),f),l=o(c.add(b,c.DAY,1),f),h="",g={limit:false};e=e||{};e=YAHOO.lang.augmentObject(e,g);s.setHours(0,0,0,0);switch(k){case q:h=m("relative.today");break;case a:h=m("relative.yesterday");break;case l:h=m("relative.tomorrow");break}if(!e.limit&&h===""){var p=c.add(b,c.DAY,-b.getDay()),d=c.add(p,c.DAY,-7),u=c.add(p,c.DAY,+7),n=c.add(p,c.DAY,+7);if(t<s&&t>p){h=m("relative.earlierThisWeek")}else{if(t<p&&t>d){h=m("relative.lastWeek")}else{if(t>s&&t<u){h=m("relative.laterThisWeek")}else{if(t>u&&t<n){h=m("relative.nextWeek")}else{if(e.olderDates&&t<s){h=e.olderDates}else{if(e.futureDates&&t>s){h=e.futureDates}}}}}}}if(h===""){h=o(t,r)}return h};Alfresco.util.pad=function(b,a){b=String(b);a=parseInt(a,10)||2;while(b.length<a){b="0"+b}return b};Alfresco.util.insertAtCursor=function(b,a){if(document.selection){b.focus();document.selection.createRange().text=a}else{if(b.selectionStart||b.selectionStart=="0"){b.value=b.value.substring(0,b.selectionStart)+a+b.value.substring(b.selectionEnd,b.value.length)}else{b.value+=a}}b.focus()};Alfresco.util.selectText=function(d,a,b){if(d.setSelectionRange){d.setSelectionRange(a,b)}else{if(d.createTextRange){var c=d.createTextRange();c.moveStart("character",a);c.moveEnd("character",b-d.value.length);c.select()}else{d.select()}}};Alfresco.util.isVisible=function(b){try{while(b){if(b.tagName){if(b.tagName.toLowerCase()=="body"){return true}}if(YUIDom.getStyle(b,"display")=="none"||YUIDom.getStyle(b,"visibility")=="hidden"){return false}b=b.parentNode}}catch(a){return false}return true};Alfresco.util.decodeHTML=function(a){if(a===null){return""}return a.split("&lt;").join("<").split("&gt;").join(">").split("&amp;").join("&").split("&quot;").join('"')};Alfresco.util.encodeHTML=function(d,b){if(d===null||typeof d=="undefined"){return""}var a=b===true?"":"&nbsp;&nbsp;&nbsp;";if(YAHOO.env.ua.ie>0){d=""+d;return d.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/\n/g,"<br />"+a).replace(/"/g,"&quot;")}var c=arguments.callee;c.text.data=d;return c.div.innerHTML.replace(/\n/g,"<br />"+a).replace(/"/g,"&quot;")};Alfresco.util.encodeHTML.div=document.createElement("div");Alfresco.util.encodeHTML.text=document.createTextNode("");Alfresco.util.encodeHTML.div.appendChild(Alfresco.util.encodeHTML.text);Alfresco.util.encodeURIPath=function(a){return encodeURIComponent(a).replace(/%2F/g,"/")};Alfresco.util.activateLinks=function(b){var a=new RegExp(/((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?\^=%&:;\/~\+#]*[\w\-\@?\^=%&\/~\+#])?)/g);b=b.replace(a,'<a href="$1" target="_blank">$1</a>');return b};Alfresco.util.tweetToHTML=function(b){b=Alfresco.util.activateLinks(b);var a=new RegExp(/(^|[^\w])@([\w]{1,})/g);b=b.replace(a,'$1<a href="http://twitter.com/$2">@$2</a>');a=new RegExp(/#+([\w]{1,})/g);b=b.replace(a,'<a href="http://search.twitter.com/search?q=%23$1">#$1</a>');return b};Alfresco.util.setSelectedIndex=function(d,c){for(var b=0,a=d.options.length;b<a;b++){if(d.options[b].value==c){d.selectedIndex=b;return d.options[b].text}}return null};Alfresco.util.setSelectedClass=function(e,g,d){var c=e.childNodes,f=null;d=d?d:"selected";for(var b=0,a=c.length;b<a;b++){f=c[b];if(!g||f.tagName==g.tagName){YUIDom.removeClass(f,d);if(f===g){YUIDom.addClass(f,d)}}}};Alfresco.util.useAsButton=function(f,b,c,a){YAHOO.util.Event.addListener(f,"click",b,c,a);if(YAHOO.lang.isString(f)){f=YAHOO.util.Dom.get(f)}if(!f.getAttribute("tabindex")){f.setAttribute("tabindex","0")}var e=b,g=c,d=a||f;var h=function(l,k){e.call(d,l,g||k)};if(f.tagName!="A"){new YAHOO.util.KeyListener(f,{keys:[YAHOO.util.KeyListener.KEY.ENTER]},h).enable()}};Alfresco.util.generateDomId=function(b,a){var d,c=a||"alf-id";do{d=c+Alfresco.util.generateDomId._nId++}while(YUIDom.get(d)!==null);Alfresco.util.setDomId(b,d);return d};Alfresco.util.generateDomId._nId=0;Alfresco.util.setDomId=function(b,a){if(b){if(YAHOO.env.ua.ie>0&&YAHOO.env.ua.ie<8){if(b.attributes.id){b.attributes.id.value=a}b.setAttribute("id",a)}else{b.setAttribute("id",a)}}};Alfresco.util.relToTarget=function(d){var c=YUISelector.query("a[rel]",d);for(var a=0,b=c.length;a<b;a++){c[a].setAttribute("target",c[a].getAttribute("rel"))}};Alfresco.util.populateHTML=function(){for(var a=0,c=arguments.length,b=null;a<c;a++){b=YUIDom.get(arguments[a][0]);if(b){b.innerHTML=arguments[a][1]}}};Alfresco.util.hasCssProperty=function(b){if(Alfresco.util.hasCssProperty.div.style.hasOwnProperty(b)){return true}b=b.replace(/^[a-z]/,function(c){return c.toUpperCase()});var a=Alfresco.util.hasCssProperty.vendors.length;while(a--){if(Alfresco.util.hasCssProperty.div.style.hasOwnProperty(vendors[a]+b)){return true}}return false};Alfresco.util.hasCssProperty.div=document.createElement("div");Alfresco.util.hasCssProperty.vendors=["Khtml","O","ms","Moz","Webkit"];Alfresco.util.createYUIButton=function(g,b,a,h,e){var f={type:"button",disabled:false,usearia:true};if(typeof h=="object"){f=YAHOO.lang.merge(f,h)}if((f.type=="menu")&&(typeof f.menu=="string")){f.menu=g.id+"-"+f.menu}var d=e?e:g.id+"-"+b,c=null;if(YUIDom.get(d)!==null){c=new YAHOO.widget.Button(d,f);if(typeof c=="object"){if(typeof a=="function"){if(f.type=="menu"){c.getMenu().subscribe("click",function(l,k,m){k[k.length]=b;a.call(g,l,k,m)},g,true);c.getMenu().subscribe("keydown",function(l,k,m){if(k[0].keyCode==YUIKeyListener.KEY.ENTER){m.fn.call(m.scope,l,k)}},{scope:g,fn:a})}else{if(f.type=="checkbox"){c.on("checkedChange",a,c,g)}else{c.on("click",a,c,g)}}}if(typeof f.htmlName!="undefined"){c.get("element").getElementsByTagName("button")[0].name=f.htmlName}if(typeof f.additionalClass=="string"){YUIDom.addClass(c._button.parentElement.parentElement,f.additionalClass)}}}return c};Alfresco.util.disableYUIButton=function(a){if(a&&a.set&&a.get){a.set("disabled",true);if(a.get("type")=="link"){a.set("href","");if(a._button&&a._button.setAttribute){a._button.setAttribute("onclick","return false;")}a.addStateCSSClasses("disabled");a.removeStateCSSClasses("hover");a.removeStateCSSClasses("active");a.removeStateCSSClasses("focus")}}};Alfresco.util.enableYUIButton=function(a){if(a.set&&a.get){a.set("disabled",false);if(a.get("type")=="link"){if(a._button&&a._button.removeAttribute){a._button.removeAttribute("onclick")}a.removeStateCSSClasses("disabled")}}};Alfresco.util.createTwister=function(p,o,l){var f={panel:null,CLASS_BASE:"alfresco-twister",CLASS_OPEN:"alfresco-twister-open",CLASS_CLOSED:"alfresco-twister-closed"};var d,m,q,c=YAHOO.lang.merge(f,l||{});d=YUIDom.get(p);if(d===null){return false}m=YUIDom.getChildren(p);if(c.panel&&YUIDom.get(c.panel)){q=YUIDom.get(c.panel)}else{q=d.nextSibling;while(q.nodeType!==1&&q!==null){q=q.nextSibling}}if(q===null){return false}if(Alfresco.util.createTwister.collapsed===undefined){var k=new Alfresco.service.Preferences();if(Alfresco.service.Preferences.COLLAPSED_TWISTERS){Alfresco.util.createTwister.collapsed=Alfresco.util.findValueByDotNotation(k.get(),Alfresco.service.Preferences.COLLAPSED_TWISTERS)||""}else{Alfresco.util.createTwister.collapsed=""}}var n=Alfresco.util.arrayToObject(Alfresco.util.createTwister.collapsed.split(",")),h=!!n[o];YUIDom.addClass(d,c.CLASS_BASE);YUIDom.addClass(d,h?c.CLASS_CLOSED:c.CLASS_OPEN);YUIDom.setStyle(q,"display",h?"none":"block");var e=function(z,y){var u=z.type;if(u&&u==="keypress"){var A=z.keyCode;if(A&&A!==YUIKeyListener.KEY.ENTER&&A!==YUIKeyListener.KEY.SPACE){return}}var v=false;if(YUIEvent.getTarget(z)==d){v=true}for(var s=0;s<m.length;s++){if(YUIEvent.getTarget(z)==m[s]){v=true}}if(v){var w=YUIDom.hasClass(y.controller,c.CLASS_OPEN);if(w){YUIDom.replaceClass(y.controller,c.CLASS_OPEN,c.CLASS_CLOSED);if(y.filterName){Alfresco.util.createTwister.collapsed=!Alfresco.util.createTwister.collapsed?y.filterName:Alfresco.util.createTwister.collapsed.concat(",").concat(y.filterName)}}else{YUIDom.replaceClass(y.controller,c.CLASS_CLOSED,c.CLASS_OPEN);if(y.filterName){var x=new RegExp(y.filterName+",|,"+y.filterName+"|"+y.filterName);Alfresco.util.createTwister.collapsed=Alfresco.util.createTwister.collapsed.replace(x,"")}}YUIDom.setStyle(y.panel,"display",w?"none":"block");if(y.filterName){var r=w?"add":"remove",t=new Alfresco.service.Preferences();t[r].call(t,Alfresco.service.Preferences.COLLAPSED_TWISTERS,y.filterName)}z.stopPropagation()}};var b={controller:d,panel:q,filterName:o};var a=function(r){YUIEvent.addListener(r,"click",e,b);YUIEvent.addListener(r,"keypress",e,b)};a(d);for(var g=0;g<m.length;g++){a(m[g])}};Alfresco.util.createYUIPanel=function(e,d,b){var a,g={modal:true,constraintoviewport:true,draggable:true,fixedcenter:YAHOO.env.ua.mobile===null?"contained":false,close:true,visible:false,postmethod:"none",hideaftersubmit:false,fireHideShowEvents:true},f={render:true,type:YAHOO.widget.Dialog};if(typeof d=="object"){g=YAHOO.lang.merge(g,d)}if(typeof b=="object"){f=YAHOO.lang.merge(f,b)}a=new (f.type)(e,g);if(g.zIndex){a._bringToTop=a.bringToTop;a.bringToTop=function(){var h=a.cfg.getProperty("zindex");a._bringToTop();var k=a.cfg.getProperty("zindex");if(k<h){a.cfg.setProperty("zindex",h)}}}if(f.render){a.render(document.body)}if(g.fireHideShowEvents){a.subscribe("show",function(k,h){if(!g.fixedcenter){a.center()}YAHOO.Bubbling.fire("showPanel",{panel:this})});var c=function(k,h){YAHOO.Bubbling.fire("hidePanel",{panel:this})};a.subscribe("hide",c);a.subscribe("destroy",c)}return a};Alfresco.util.createYUIOverlay=function(e,d,a){var b,h={modal:false,draggable:false,close:false,visible:false,iframe:false,fireHideShowEvents:true},g={render:true,type:YAHOO.widget.Overlay};if(typeof d=="object"){h=YAHOO.lang.merge(h,d)}if(h.fixedcenter){h.fixedcenter=YAHOO.env.ua.mobile===null}if(typeof a=="object"){g=YAHOO.lang.merge(g,a)}b=new (g.type)(e,h);var c=(YAHOO.widget.Module.prototype.platform==="mac"&&0<YAHOO.env.ua.gecko);if(c){b.hideEvent.unsubscribe(b.hideMacGeckoScrollbars,b,true);b.showEvent.unsubscribe(b.showMacGeckoScrollbars,b,true);b.hideMacGeckoScrollbars=function(){Dom.replaceClass(this.element,"prevent-scrollbars","hide-scrollbars")},b.showMacGeckoScrollbars=function(){Dom.replaceClass(this.element,"hide-scrollbars","prevent-scrollbars")}}if(g.render){b.render(document.body)}if(h.fireHideShowEvents){b.showEvent.subscribe(function(l,k){YAHOO.Bubbling.fire("showOverlay",{overlay:this})});var f=function(l,k){YAHOO.Bubbling.fire("hideOverlay",{overlay:this})};b.hideEvent.subscribe(f);b.destroyEvent.subscribe(f)}return b};Alfresco.util.createInfoBalloon=function(a,b){b=YAHOO.lang.merge({wrapperClass:"info-balloon",arrowClass:"info-balloon-arrow"},b||{});return Alfresco.util.createBalloon(a,b)},Alfresco.util.createBalloon=function(b,d,c,f){var a=YUIDom.get(b);if(YAHOO.lang.isNull(a)){return null}d=YAHOO.lang.merge({effectType:YAHOO.widget.ContainerEffect.FADE,effectDuration:0.25,html:"",text:"",closeButton:true,wrapperClass:"balloon",arrowClass:"balloon-arrow"},d||{});var e=new Alfresco.widget.Balloon(a,d);if(c){YAHOO.util.Event.addListener(b,c,e.show,e,true)}if(f){YAHOO.util.Event.addListener(b,f,e.hide,e,true)}return e};(function(){var e=YAHOO.util.Dom,k=YAHOO.util.Event;var c=Alfresco.util.encodeHTML,a=(YAHOO.widget.Module.prototype.platform==="mac"&&0<YAHOO.env.ua.gecko);Alfresco.widget.Balloon=function(m,n){this.context=m;var q=new Alfresco.util.createYUIOverlay(Alfresco.util.generateDomId(),{context:[m,"bl","tl",["beforeShow","windowResize","windowScroll","textResize"]],constraintoviewport:true,visible:false,width:n.width||"auto",zIndex:10,effect:{effect:n.effectType,duration:n.effectDuration},fireHideShowEvents:false});var r=document.createElement("div"),p=document.createElement("div");e.addClass(r,n.wrapperClass);e.addClass(p,n.arrowClass);if(n.closeButton){var l=document.createElement("div");l.innerHTML="x";e.addClass(l,"closeButton");k.addListener(l,"click",this.hide,this,true);this.escapeListener=new YUIKeyListener(document,{keys:YUIKeyListener.KEY.ESCAPE},{fn:function(s,t){this.hide()},scope:this,correctScope:true});this.escapeListener.enable();r.appendChild(l)}var o=document.createElement("div");e.addClass(o,"text");o.innerHTML=n.html||c(n.text);r.appendChild(o);r.appendChild(p);q.setBody(r);q.render(e.get("doc3"));this.balloon=q;this.content=o;this.onClose=new YAHOO.util.CustomEvent("close",this);this.onShow=new YAHOO.util.CustomEvent("show",this);this.name="Alfresco.widget.Balloon";this.id=this.balloon.id;Alfresco.util.ComponentManager.register(this);return this};Alfresco.widget.Balloon.prototype={context:null,balloon:null,content:null,hide:function f(){this.balloon.hide();Alfresco.util.ComponentManager.unregister(this);this.onClose.fire()},show:function g(){if(this.content.innerHTML&&this.content.innerHTML.length>0){Alfresco.util.ComponentManager.reregister(this);this.balloon.show();this.balloon.bringToTop();this.hideOthers();this.onShow.fire()}},hideOthers:function b(){var m=Alfresco.util.ComponentManager.find({name:this.name});for(var l=0;l<m.length;l++){if(m[l].id!=this.id){m[l].balloon.hide()}}},html:function d(l){this.content.innerHTML=l;this.balloon.align()},text:function h(l){this.content.innerHTML=c(l);this.balloon.align()}}})();(function(){var d=YAHOO.util.Dom,h=YAHOO.util.Event,f=YAHOO.util.Anim;var c=Alfresco.util.encodeHTML;Alfresco.widget.FullScreen=function(l,m){this.context=d.get(l);if(m){this.params=YAHOO.lang.merge(Alfresco.util.deepCopy(this.params),m)}var n=this;h.addListener(document,"MSFullscreenChange",function(){n.onFullScreenChange()});h.addListener(document,"fullscreenchange",function(){n.onFullScreenChange()});h.addListener(document,"mozfullscreenchange",function(){n.onFullScreenChange()});h.addListener(document,"webkitfullscreenchange",function(){n.onFullScreenChange()});return this};Alfresco.widget.FullScreen.prototype={context:null,isWindowOnly:true,params:{pageContainerId:"Share"},toggleFullScreen:function a(l){if(this.context!=null){if(!document.fullscreen&&!document.mozFullScreen&&!document.webkitFullScreen){this.requestFullScreen(l)}else{this.cancelFullScreen()}}},requestFullScreen:function e(m){if(m!=null){this.isWindowOnly=m}if(this.isWindowOnly){this.toggleFullWindow();return}var l=d.get(this.context);if(l.msRequestFullscreen||l.requestFullscreen||l.mozRequestFullScreen||l.webkitRequestFullScreen){d.addClass(l,"alf-fullscreen");d.addClass(l,"alf-entering-true-fullscreen")}if(l.msRequestFullscreen){l.msRequestFullscreen()}else{if(l.requestFullscreen){l.requestFullscreen()}else{if(l.mozRequestFullScreen){l.mozRequestFullScreen()}else{if(l.webkitRequestFullScreen){if(navigator.userAgent.indexOf("Safari")!=-1&&navigator.userAgent.indexOf("Chrome")==-1){l.webkitRequestFullScreen()}else{l.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)}}else{this.toggleFullWindow()}}}}},cancelFullScreen:function b(){if(this.isWindowOnly){this.toggleFullWindow();return}if(document.msExitFullscreen){document.msExitFullscreen()}else{if(document.exitFullscreen){document.exitFullscreen()}else{if(document.mozCancelFullScreen){document.mozCancelFullScreen()}else{if(document.webkitCancelFullScreen){document.webkitCancelFullScreen()}else{this.toggleFullWindow()}}}}},onFullScreenChange:function g(){if(this.context!=null){var l=d.get(this.context);if(d.hasClass(l,"alf-entering-true-fullscreen")){d.removeClass(l,"alf-entering-true-fullscreen");setTimeout(function(){d.addClass(l,"alf-true-fullscreen")},1000)}else{if(d.hasClass(l,"alf-true-fullscreen")){if(d.hasClass(l,"alf-fullscreen")){d.removeClass(l,"alf-fullscreen");d.removeClass(l,"alf-true-fullscreen");YAHOO.Bubbling.fire("fullScreenExitComplete",{scope:this.context,eventGroup:this.context.id})}}else{if(!d.hasClass(l,"alf-fullscreen")){d.addClass(l,"alf-fullscreen");YAHOO.Bubbling.fire("fullScreenEnterComplete",{scope:this.context,eventGroup:this.context.id})}else{d.removeClass(l,"alf-fullscreen");YAHOO.Bubbling.fire("fullScreenExitComplete",{scope:this.context,eventGroup:this.context.id})}}}}},toggleFullWindow:function k(){if(this.context!=null){var m=d.get(this.params.pageContainerId);var l=d.get(this.context);if(!d.hasClass(m,"alf-fullwindow")){d.addClass(m,"alf-fullwindow");var n=this;this.context.escKeyListener=function(o){if(o.keyCode==27){n.toggleFullWindow()}};h.addListener(document,"keydown",this.context.escKeyListener)}else{d.removeClass(m,"alf-fullwindow");if(this.context.escKeyListener){h.removeListener(document,"keydown",this.context.escKeyListener)}}this.onFullScreenChange()}}}})();(function(){var b=YAHOO.util.Dom;Alfresco.widget.PasswordStrengthMeter=function(d,e){this.context=b.get(d);this.params=YAHOO.lang.merge(Alfresco.util.deepCopy(this.params),e);this._generateMarkup();return this};Alfresco.widget.PasswordStrengthMeter.prototype={context:null,params:{username:null,minLength:0,minUpper:0,minLower:0,minNumeric:0,minSymbols:0},_generateMarkup:function a(){b.addClass(this.context,"passwordStrengthMeter");var f=document.createElement("span");f.appendChild(document.createTextNode(Alfresco.util.message("password-strength-meter.label")));this.context.appendChild(f);var e=document.createElement("ul"),h;for(var g=0;g<4;g++){h=document.createElement("li");b.addClass(h,"passwordStrengthMeterStrength-"+(g+1));h.innerHTML="&nbsp;";e.appendChild(h)}this.context.appendChild(e);var d=document.createElement("div");b.addClass(d,"clear");this.context.appendChild(d)},setStrength:function c(d){d=YAHOO.lang.trim(d);var f=Selector.query("ul",this.context,true);f.setAttribute("class","");var e=Alfresco.util.getPasswordStrength(d,{username:this.params.username,minLength:this.params.minLength,minUpper:this.params.minUpper,minLower:this.params.minLower,minNumeric:this.params.minNumeric,minSymbols:this.params.minSymbols});if(e){b.addClass(f,"passwordStrengthMeterStrength-"+e.name)}}}})();(function(){var c=YAHOO.util.Dom,a=YAHOO.util.Event,b=YAHOO.util.KeyListener;Alfresco.widget.MultiSelectAutoComplete=function(k,l){this.context=c.get(k);this.params=YAHOO.lang.merge(Alfresco.util.deepCopy(this.params),l);this.markupGenerated=false;this.hiddenInput=null;this.itemIds=null;this.newInput=null;this.newInputUsed=false;this.itemContainer=null;this.autoComplete=null;this.queuedPasteEvent=false;if(!this.context||!this.params.itemUrl){throw new Error("Parameter p_context and p_params.itemUrl must be provided.")}this._generateMarkup();return this};Alfresco.widget.MultiSelectAutoComplete.prototype={context:null,params:{value:"",itemUrl:null,itemPath:"data",itemId:"id",itemName:"name",itemTemplate:null,forbiddenItemIds:[],form:null,formInputMode:"multiple",formInputName:"-",onItemInputCreate:null,onItemInputEscape:null,delimiterKeyCodes:[YAHOO.util.KeyListener.KEY.ENTER],pasteDelimiterKeyCodes:[],minQueryLength:1},focus:function(){if(Alfresco.util.isVisible(this.newInput)){this.newInput.focus()}},_generateMarkup:function e(){this.itemIds=[];if(this.markupGenerated){this._generateCurrentItemMarkup();return}c.addClass(this.context,"input");var n=document.createElement("span"),m=document.createElement("div");if(this.params.formInputMode=="single"){this.hiddenInput=document.createElement("input");YUIDom.setAttribute(this.hiddenInput,"type","hidden");YUIDom.setAttribute(this.hiddenInput,"name",this.params.formInputName)}this.newInput=document.createElement("input");YUIDom.setAttribute(this.newInput,"type","text");YUIDom.setAttribute(this.newInput,"tabindex","0");n.appendChild(this.newInput);n.appendChild(m);var q=document.createElement("div");YUIDom.addClass(q,"inlineItemEdit");this.itemContainer=document.createElement("span");q.appendChild(this.itemContainer);q.appendChild(n);this._generateCurrentItemMarkup();this.context.appendChild(q);YUIDom.addClass(n,"inlineItemEditAutoCompleteWrapper");YUIDom.addClass(m,"inlineItemEditAutoComplete");if(this.hiddenInput){YUIDom.setAttribute(this.hiddenInput,"value",this.itemIds.toString());this.context.appendChild(this.hiddenInput)}var l=new YAHOO.util.XHRDataSource();l.connXhrMode="cancelStaleRequests";l.responseType=YAHOO.util.XHRDataSource.TYPE_JSON;l.maxCacheEntries=10;l.responseSchema={resultsList:this.params.itemPath};this.autoComplete=new YAHOO.widget.AutoComplete(this.newInput,m,l);this.autoComplete.questionMark=false;var k=this.params.itemUrl;this.autoComplete.generateRequest=function(r){return YAHOO.lang.substitute(k,{query:r})};this.autoComplete.applyLocalFilter=false;this.autoComplete.queryDelay=0.2;this.autoComplete.animSpeed=0.08;this.autoComplete.minQueryLength=this.params.minQueryLength;this.autoComplete.itemSelectEvent.subscribe(function(s,r){var t=r[2][1][this.params.itemName],u=r[2][1][this.params.itemId];this._applyItem(t,u,{type:"change"});if(YUIDom.isAncestor(this.itemContainer,this.newInput)){YUIDom.insertAfter(this.newInput.parentNode,this.itemContainer)}},this,true);this.autoComplete.dataReturnEvent.subscribe(function(t,r){var s=r[2],u;for(i=0,j=s.length;i<j;i++){u=s[i][this.params.itemId];if(Alfresco.util.arrayContains(this.itemIds,u)||Alfresco.util.arrayContains(this.params.forbiddenItemIds,u)){s.splice(i,1);i--;j--}}},this,true);if(this.params.itemTemplate){this.autoComplete.formatResult=Alfresco.util.bind(function(s,t,r){return YAHOO.lang.substitute(this.params.itemTemplate,s[1],function(u,v){return Alfresco.util.encodeHTML(v)})},this)}var p=this;a.addListener(this.newInput,"keyup",function(w){p.newInputUsed=true;if(this.value.length>0){c.removeClass(p.itemContainer.parentNode,"mandatory");c.removeClass(p.context,"invalid");if(p.queuedPasteEvent){p.queuedPasteEvent=false;var r=this.value,x,u,s=[],v="";for(var t=0;t<r.length;t++){x=r.charAt(t);u=x.charCodeAt(0);if(Alfresco.util.arrayContains(p.params.delimiterKeyCodes,u)||Alfresco.util.arrayContains(p.params.pasteDelimiterKeyCodes,u)){v=YAHOO.lang.trim(v);if(v.length>0){s.push(v)}v=""}else{v+=x}}v=YAHOO.lang.trim(v);if(v.length>0){s.push(v)}this.value="";for(t=0;t<s.length;t++){v=YAHOO.lang.trim(s[t]);p._createItem(v,v,null);YUIDom.insertAfter(p.newInput.parentNode,p.itemContainer)}YAHOO.lang.later(50,p.newInput,function(){this.focus();p._triggerFormValidation({type:"keyup"},p.context)})}}});a.addListener(this.newInput,"paste",function(r){p.queuedPasteEvent=true});a.addListener(this.newInput,"keypress",function(r){if(Alfresco.util.hasKeyCode(r,p.params.delimiterKeyCodes)&&this.value.length>0){a.stopEvent(r);p._createItem(this.value,this.value,{type:"change"});YUIDom.insertAfter(p.newInput.parentNode,p.itemContainer);YAHOO.lang.later(50,p.newInput,function(){this.focus()})}});a.addListener(this.newInput,"keydown",function(t){if(Alfresco.util.hasKeyCode(t,8)&&this.newInput.value.length==0){if(this._editingItemIndex>=0){this.itemIds.splice(this._editingItemIndex,1);YUIDom.insertAfter(this.newInput.parentNode,this.itemContainer);this._hideFormErrorContainer()}else{if(!this._itemPrimedForDelete&&this.itemContainer.children.length>0){this._itemPrimedForDelete=true;var s=YUIDom.getLastChild(this.itemContainer);YUIDom.addClass(s,"inlineItemEditItemPrimed");YUIDom.addClass(s.children[2],"hidden");YUIDom.removeClass(s.children[3],"hidden");this._hideFormErrorContainer(s)}else{if(this.itemIds.length>0){this.itemIds.pop();if(this.hiddenInput){YUIDom.setAttribute(this.hiddenInput,"value",this.itemIds.toString())}var r=YUIDom.getLastChild(this.itemContainer);this.itemContainer.removeChild(r);this._hideFormErrorContainer(r)}this._itemPrimedForDelete=false}}}else{if(this._itemPrimedForDelete==true){this._itemPrimedForDelete=false;if(this.itemContainer.children.length>0){var s=YUIDom.getLastChild(this.itemContainer);YUIDom.removeClass(s,"inlineItemEditItemPrimed");YUIDom.addClass(s.children[3],"hidden");YUIDom.removeClass(s.children[2],"hidden")}}}},this,true);this.autoComplete.textboxBlurEvent.subscribe(function(s,r){this.newInputUsed=true;var t=YAHOO.lang.trim(r[0].getInputEl().value);if(t.length>0){this._createItem(t,t,{type:"blur"})}else{YAHOO.lang.later(50,this,function(){this._triggerFormValidation({type:"blur"},this.context)})}YUIDom.insertAfter(this.newInput.parentNode,this.itemContainer)},this,true);a.addListener(this.newInput,"focus",function(s,r){this._triggerFormValidation({type:"focus"},this.context)},this,true);a.addListener(q,"click",function(r){YAHOO.lang.later(50,this,function(){if(document.activeElement!=this.newInput){this.newInput.select()}});a.stopEvent(r)},this,true);var o=new b(this.newInput,{keys:[b.KEY.ESCAPE]},{fn:function(s,r){a.stopEvent(r[1]);this.newInput.value="";if(this.params.onItemInputEscape&&YAHOO.lang.isFunction(this.params.onItemInputEscape)){this.params.onItemInputEscape.fn.call(this.params.onItemInputEscape.scope)}},scope:this,correctScope:true});o.enable();if(this.params.form){this.params.form.addValidation(this.context,Alfresco.util.bind(this.isValid,this),{},"blur",Alfresco.util.bind(this.getTitle,this),Alfresco.util.bind(this.getValidationConfig,this))}this.markupGenerated=true},_itemIdValidations:{},_validations:[],addValidation:function(k,m,l){this._validations.push({handler:k,args:m,message:l})},_triggerFormValidation:function(k,l){if(this.params.form){this.isValid();this.params.form.validate(k,l.id)}},_hideFormErrorContainer:function(k){this._errorContainer=null;if(this.params.form){if(k){this.params.form.hideErrorContainer(k)}this.params.form.hideErrorContainer(this.context)}},isValid:function(){if(!this.newInputUsed){if(this.params.mandatory&&this.params.value.length==0){c.addClass(this.itemContainer.parentNode,"mandatory")}return true}c.removeClass(this.itemContainer.parentNode,"mandatory");var m=YAHOO.util.Selector.query(".inlineItemEditItem",this.context),l;for(var k=0;k<m.length;k++){l=YAHOO.util.Selector.query("input",m[k],true).value;if(!(this._itemIdValidations[l]||0)==(this._validations||[]).length){if(!c.get(this._errorContainer)){this._errorContainer=m[k]}c.addClass(this.itemContainer.parentNode.parentNode,"suppress-validation");return false}}if(this.itemIds.length==0&&this.params.mandatory){c.removeClass(this.itemContainer.parentNode.parentNode,"suppress-validation");this._errorContainer=this.context;this._errorMessage=Alfresco.util.message("Alfresco.forms.validation.mandatory.message");return false}this._errorMessage=null;this._errorContainer=null;return true},getTitle:function(){return(this._errorMessage?this._errorMessage:(this.params.title||""))},getValidationConfig:function(){return{}},_validateItem:function(q,p,l){var o=true;if(YAHOO.lang.isArray(this._validations)){var m;for(var n=0;n<this._validations.length;n++){m=this._validations[n];var k=m.handler({value:q,type:"hidden"},m.args,{},this.params.form);if(YAHOO.lang.isBoolean(k)&&k){this._itemIdValidations[q]=(this._itemIdValidations[q]||0)+1}else{o=false;this._errorContainer=l;this._errorMessage=m.message;if(YAHOO.lang.isNumber(k)){this._errorMessage=Alfresco.util.message("Alfresco.widget.MultiSelectAutoComplete.pending")}}}}return o},_createItem:function g(l,m,k){this._applyItem(l,m,k);if(YUIDom.isAncestor(this.itemContainer,this)){YUIDom.insertAfter(this.newInput.parentNode,this.itemContainer)}if(this.params.onItemCreate&&YAHOO.lang.isFunction(this.params.onItemCreate)){this.params.onItemCreate.fn.call(this.params.onItemCreate.scope,m)}},_addItem:function d(y,p){var w=Alfresco.util.encodeHTML(y),l=document.createElement("img"),t=document.createElement("span"),r=document.createElement("span"),u=document.createElement("input"),o=document.createElement("img"),n=document.createElement("img");Alfresco.util.generateDomId(t);YUIDom.addClass(t,"inlineItemEditItem");r.innerHTML=w;YUIDom.setAttribute(l,"src",Alfresco.constants.URL_RESCONTEXT+"components/images/warning-16.png");YUIDom.setAttribute(o,"src",Alfresco.constants.URL_RESCONTEXT+"components/images/delete-item-off.png");YUIDom.setAttribute(o,"width",16);YUIDom.setAttribute(n,"src",Alfresco.constants.URL_RESCONTEXT+"components/images/delete-item-on.png");YUIDom.setAttribute(n,"width",16);YUIDom.addClass(n,"hidden");t.appendChild(l);t.appendChild(r);t.appendChild(o);t.appendChild(n);var x=this._validateItem(p,y,t);if(YAHOO.lang.isBoolean(x)){if(x){YUIDom.addClass(l,"hidden")}else{c.addClass(t,"invalid")}}else{if(YAHOO.lang.isNumber(x)){YUIDom.addClass(l,"hidden")}}if(this.params.formInputMode=="multiple"){YUIDom.setAttribute(u,"type","hidden");YUIDom.setAttribute(u,"name",this.params.formInputName);YUIDom.setAttribute(u,"value",p);t.appendChild(u)}if(YUIDom.isAncestor(this.itemContainer,this.newInput)){YUIDom.insertBefore(t,this.newInput.parentNode)}else{this.itemContainer.appendChild(t)}this._editingItemIndex=-1;var s=function k(A){var B=0,z=A;while((z=z.previousSibling)!=null){B++}return B};var m=this;var q=function v(A){var z=Alfresco.util.arrayIndex(m.itemIds,A);if(z!=-1){m.itemIds.splice(z,1)}};a.addListener(o,"click",function(z){q(p);if(this.hiddenInput){YUIDom.setAttribute(m.hiddenInput,"value",m.itemIds.toString())}m.itemContainer.removeChild(t);m._hideFormErrorContainer(t)});a.addListener(r,"click",function(z){YUIDom.insertBefore(m.newInput.parentNode,t);m.itemContainer.removeChild(t);m.newInput.value=y;q(p);m._editingItemIndex=s(t);m._hideFormErrorContainer(t);m.newInput.select();a.stopEvent(z)});return s(t)},_applyItem:function h(m,n,k){var l=this._addItem(m,n);this.newInput.value="";this.itemIds.splice(l,0,n);if(this.hiddenInput){YUIDom.setAttribute(this.hiddenInput,"value",this.itemIds.toString())}this.autoComplete.collapseContainer();if(k){this._triggerFormValidation(k,this.context)}},_generateCurrentItemMarkup:function f(){if(this.itemContainer.hasChildNodes()){while(this.itemContainer.childNodes.length>=1){this.itemContainer.removeChild(this.itemContainer.firstChild)}}this.params.value=this.params.value||[];for(i=0,j=this.params.value.length;i<j;i++){this._addItem(this.params.value[i][this.params.itemName],this.params.value[i][this.params.itemId]);this.itemIds.push(this.params.value[i][this.params.itemId])}}}})();Alfresco.util.createInsituEditor=function(b,d,c){var a=YUIDom.get(b);if(YAHOO.lang.isNull(a)){return false}d=YAHOO.lang.merge({showDelay:600,hideDelay:600,autoDismissDelay:0,container:null,context:a,callback:c,error:null,disabled:false,type:"textBox",nodeRef:null,name:null,value:"",title:null},d||{});if(Alfresco.widget.InsituEditor[d.type]){return(new Alfresco.widget.InsituEditor[d.type](d))}return null};(function(){var a=YAHOO.util.Dom,D=YAHOO.util.Event,t=YAHOO.util.Element,m=YAHOO.util.KeyListener;Alfresco.widget.InsituEditorIcon=function(E,F){this.editor=E;this.params=YAHOO.lang.merge({},F);this.disabled=F.disabled;this.editIcon=document.createElement("span");this.editIcon.title=Alfresco.util.encodeHTML(F.title);a.addClass(this.editIcon,"insitu-edit");if(this.params.container!==null){a.get(this.params.container).appendChild(this.editIcon)}else{this.params.context.parentNode.insertBefore(this.editIcon,this.params.context)}D.on(this.params.context,"mouseover",this.onContextMouseOver,this);D.on(this.params.context,"mouseout",this.onContextMouseOut,this);D.on(this.editIcon,"mouseover",this.onContextMouseOver,this);D.on(this.editIcon,"mouseout",this.onContextMouseOut,this)};Alfresco.widget.InsituEditorIcon.prototype={disabled:null,_fadeOut:function v(E){var F=new YAHOO.util.Anim(E,{opacity:{to:0}},0.2);F.onComplete.subscribe(function(I,G,H){D.removeListener(H.editIcon,"click");a.setStyle(E,"visibility","hidden");a.setStyle(E,"opacity",0)},this);F.animate()},_fadeIn:function l(E){var F=new YAHOO.util.Anim(E,{opacity:{to:1}},0.2);F.onComplete.subscribe(function(I,G,H){a.setStyle(E,"opacity",1);D.removeListener(H.editIcon,"click");D.on(H.editIcon,"click",H.onIconClick,H)},this);a.setStyle(E,"visibility","visible");F.animate()},onContextMouseOver:function B(F,E){if(E.disabled){return}if(E.hideProcId){clearTimeout(E.hideProcId);E.hideProcId=null}E.showProcId=E.doIconShow(F,this)},onContextMouseOut:function b(F,E){if(E.disabled){return}if(E.showProcId){clearTimeout(E.showProcId);E.showProcId=null}if(E.hideProcId){clearTimeout(E.hideProcId);E.hideProcId=null}E.hideProcId=setTimeout(function(){E._fadeOut(E.editIcon)},E.params.hideDelay)},onIconClick:function p(F,E){if(E.disabled){return}Alfresco.logger.debug("onIconClick",F);E.editor.doShow();D.stopEvent(F)},doIconShow:function f(G,E){var F=this;return window.setTimeout(function(){F._fadeIn(F.editIcon);F.hideProcId=F.doHide()},F.params.showDelay)},doHide:function r(){if(this.params.autoDismissDelay<1){return null}var E=this;return window.setTimeout(function(){E._fadeOut(E.editIcon)},E.params.autoDismissDelay)}};Alfresco.widget.InsituEditor={};Alfresco.widget.InsituEditor.base=function(F){this.params=YAHOO.lang.merge({},F);var G=new Alfresco.util.NodeRef(this.params.nodeRef),E=new t(document.createElement("form"),{id:Alfresco.util.generateDomId(),method:"post",action:Alfresco.constants.PROXY_URI+"api/node/"+G.uri+"/formprocessor"});this.elEditForm=E;this.editForm=E.get("element");this.form=new Alfresco.forms.Form(this.editForm);this.form.setAJAXSubmit(true,{successCallback:{fn:this.onPersistSuccess,scope:this},failureCallback:{fn:this.onPersistFailure,scope:this}});this.form.setSubmitAsJSON(true);E.addClass("insitu-edit");E.on("submit",function(H){D.stopEvent(H)});this.editorIcon=new Alfresco.widget.InsituEditorIcon(this,F);this.params.context.parentNode.insertBefore(this.editForm,this.params.context);return this};Alfresco.widget.InsituEditor.base.prototype={params:null,elEditForm:null,editForm:null,form:null,_jsonCall:function s(H,G,E,F){F=F||{};Alfresco.util.Ajax.jsonRequest({method:H,url:G,dataObj:E,successCallback:F.successCallback,successMessage:F.successMessage,failureCallback:F.failureCallback,failureMessage:F.failureMessage,noReloadOnAuthFailure:F.noReloadOnAuthFailure||false})},doShow:function A(){Alfresco.logger.debug("Alfresco.widget.InsituEditor","Abstract implementation 'doShow()' not overridden")},doHide:function k(E){Alfresco.logger.debug("Alfresco.widget.InsituEditor","Abstract implementation 'doHide()' not overridden")},onPersistSuccess:function d(F){var E=true;if(this.params.callback.fn){E=this.params.callback.fn.call(this.params.callback.scope||this,F,this.params.callback.obj)}this.doHide(E)},onPersistFailure:function u(E){if(this.params.error&&this.params.error.fn){this.params.error.fn.call(this.params.error.scope||this,E,this.params.error.obj)}}};Alfresco.widget.InsituEditor.textBox=function(E){Alfresco.widget.InsituEditor.textBox.superclass.constructor.call(this,E);this.balloon=null;this.suppressInputBoxFocus=false;this.contextStyle=null;this.keyListener=null;this.markupGenerated=false;return this};YAHOO.extend(Alfresco.widget.InsituEditor.textBox,Alfresco.widget.InsituEditor.base,{balloon:null,suppressInputBoxFocus:null,contextStyle:null,keyListener:null,markupGenerated:null,doShow:function g(){this._generateMarkup();if(this.contextStyle===null){this.contextStyle=a.getStyle(this.params.context,"display")}a.setStyle(this.params.context,"display","none");a.setStyle(this.editForm,"display","inline");this.keyListener.enable();if(typeof this.params.fnSelect==="function"){this.params.fnSelect(this.inputBox,this.params.value)}else{this.inputBox.select()}},doHide:function z(E){this.balloon.hide();this.keyListener.disable();if(E){a.setStyle(this.editForm,"display","none");a.setStyle(this.params.context,"display",this.contextStyle)}},onPersistFailure:function c(E){Alfresco.widget.InsituEditor.textBox.superclass.onPersistFailure.call(this,E);this.balloon.text(this.params.errorMessage);this.balloon.show()},_generateMarkup:function h(){if(this.markupGenerated){return}var J=new t(document.createElement("input"),{type:"text",name:this.params.name,value:this.params.value}),G=new t(document.createElement("a"),{href:"#",innerHTML:Alfresco.util.message("button.save")}),E=new t(document.createElement("a"),{href:"#",innerHTML:Alfresco.util.message("button.cancel")});this.elEditForm.appendChild(J);this.elEditForm.appendChild(G);this.elEditForm.appendChild(E);J.on("blur",function(K){if(this.balloon){this.suppressInputBoxFocus=true;this.balloon.hide()}this.suppressInputBoxFocus=false},this,true);G.on("click",function(K){this.form._submitInvoked(K)},this,true);E.on("click",function(K){D.stopEvent(K);this.inputBox.value=this.params.value;this.doHide(true);this.form.validate();this.form.hideErrorContainer()},this,true);this.inputBox=J.get("element");this.keyListener=new m(this.inputBox,{keys:[m.KEY.ESCAPE]},{fn:function(L,K){D.stopEvent(K[1]);this.inputBox.value=this.params.value;this.doHide(true)},scope:this,correctScope:true});this.balloon=Alfresco.util.createBalloon(this.inputBox);this.balloon.onClose.subscribe(function(K){try{if(!this.suppressInputBoxFocus){this.inputBox.focus()}}catch(K){}},this,true);var I=this.params.validations;for(var F=0,H=I.length;F<H;F++){this.form.addValidation(this.inputBox,I[F].type,I[F].args,I[F].when,I[F].message)}this.form.addValidation(this.inputBox,Alfresco.forms.validation.length,{max:255,crop:true},"keyup");this.form.init();this.markupGenerated=true}});Alfresco.widget.InsituEditor.tagEditor=function(E){Alfresco.widget.InsituEditor.tagEditor.superclass.constructor.call(this,E);this.balloon=null;this.suppressInputBoxFocus=false;this.contextStyle=null;this.keyListener=null;this.markupGenerated=false;return this};YAHOO.extend(Alfresco.widget.InsituEditor.tagEditor,Alfresco.widget.InsituEditor.base,{balloon:null,suppressInputBoxFocus:null,contextStyle:null,keyListener:null,tagRefs:null,hiddenInput:null,newTagInput:null,currentTags:null,markupGenerated:null,tagAutoComplete:null,_editingTagIndex:-1,_tagPrimedForDelete:false,doShow:function C(){this._generateMarkup();if(this.contextStyle===null){this.contextStyle=a.getStyle(this.params.context,"display")}a.setStyle(this.params.context,"display","none");a.setStyle(this.editForm,"display","inline");this.keyListener.enable();this.inputBox.select()},doHide:function n(E){this.balloon.hide();this.keyListener.disable();if(E){a.setStyle(this.editForm,"display","none");a.setStyle(this.params.context,"display",this.contextStyle)}},onPersistSuccess:function d(F){var E=true;if(this.params.callback.fn){E=this.params.callback.fn.call(this.params.callback.scope||this,F,this.params.callback.obj)}this.doHide(E);window.setTimeout(function(){YAHOO.Bubbling.fire("tagRefresh")},1000)},onPersistFailure:function x(E){Alfresco.widget.InsituEditor.textBox.superclass.onPersistFailure.call(this,E);this.balloon.text(this.params.errorMessage);this.balloon.show()},_addTag:function w(M,N){tag=Alfresco.util.encodeHTML(M);var O=document.createElement("span");YUIDom.addClass(O,"inlineTagEditTag");var L=document.createElement("span");L.innerHTML=tag;var I=document.createElement("img"),K=document.createElement("img");YUIDom.setAttribute(I,"src",Alfresco.constants.URL_RESCONTEXT+"components/images/delete-item-off.png");YUIDom.setAttribute(I,"width",16);YUIDom.setAttribute(K,"src",Alfresco.constants.URL_RESCONTEXT+"components/images/delete-item-on.png");YUIDom.setAttribute(K,"width",16);YUIDom.addClass(K,"hidden");O.appendChild(L);O.appendChild(I);O.appendChild(K);if(YUIDom.isAncestor(this.currentTags,this.newTagInput)){YUIDom.insertBefore(O,this.newTagInput.parentNode)}else{this.currentTags.appendChild(O)}this._editingTagIndex=-1;var J=function F(Q){var R=0,P=Q;while((P=P.previousSibling)!=null){R++}return R};var H=this;var G=function E(Q){var P=Alfresco.util.arrayIndex(H.tagRefs,Q);if(P!=-1){H.tagRefs.splice(P,1)}};D.addListener(I,"click",function(P){G(N);YUIDom.setAttribute(H.hiddenInput,"value",H.tagRefs.toString());H.currentTags.removeChild(O)});D.addListener(L,"click",function(P){YUIDom.insertBefore(H.newTagInput.parentNode,O);H.currentTags.removeChild(O);H.newTagInput.value=M;G(N);H._editingTagIndex=J(O)});return J(O)},_applyTag:function o(F,G){var E=this._addTag(F,G);this.newTagInput.value="";this.tagRefs.splice(E,0,G);YUIDom.setAttribute(this.hiddenInput,"value",this.tagRefs.toString());this.tagAutoComplete.collapseContainer()},_generateCurrentTagMarkup:function e(){if(this.currentTags.hasChildNodes()){while(this.currentTags.childNodes.length>=1){this.currentTags.removeChild(this.currentTags.firstChild)}}if(this.params.value!=undefined){for(i=0,j=this.params.value.length;i<j;i++){this._addTag(this.params.value[i].name,this.params.value[i].nodeRef);this.tagRefs.push(this.params.value[i].nodeRef)}}},_generateMarkup:function y(){this.tagRefs=[];if(this.markupGenerated){this._generateCurrentTagMarkup();return}var H=document.createElement("span"),E=document.createElement("div"),F=new t(document.createElement("a"),{href:window.location.hash,innerHTML:Alfresco.util.message("button.save")}),L=new t(document.createElement("a"),{href:"#",innerHTML:Alfresco.util.message("button.cancel")});this.hiddenInput=document.createElement("input");YUIDom.setAttribute(this.hiddenInput,"type","hidden");YUIDom.setAttribute(this.hiddenInput,"name",this.params.name);this.newTagInput=document.createElement("input");YUIDom.setAttribute(this.newTagInput,"type","text");H.appendChild(this.newTagInput);H.appendChild(E);var J=document.createElement("div");YUIDom.addClass(J,"inlineTagEdit");this.currentTags=document.createElement("span");J.appendChild(this.currentTags);J.appendChild(H);this._generateCurrentTagMarkup();YUIDom.setAttribute(this.hiddenInput,"value",this.tagRefs.toString());this.elEditForm.appendChild(J);YUIDom.addClass(H,"inlineTagEditAutoCompleteWrapper");YUIDom.addClass(E,"inlineTagEditAutoComplete");this.elEditForm.appendChild(this.hiddenInput);this.elEditForm.appendChild(F);this.elEditForm.appendChild(L);var M=new YAHOO.util.XHRDataSource(Alfresco.constants.PROXY_URI+"api/forms/picker/category/workspace/SpacesStore/tag:tag-root/children?selectableType=cm:category&size=100&aspect=cm:taggable&searchTerm=");M.responseType=YAHOO.util.XHRDataSource.TYPE_JSON;M.connXhrMode="cancelStaleRequests";M.responseSchema={resultsList:"data.items",fields:["name","nodeRef"]};this.tagAutoComplete=new YAHOO.widget.AutoComplete(this.newTagInput,E,M);this.tagAutoComplete.generateRequest=function(O){return O};this.tagAutoComplete.queryDelay=0.1;this.tagAutoComplete.animSpeed=0.08;this.tagAutoComplete.itemSelectEvent.subscribe(function(R,O){var P=O[2][0],Q=O[2][1];this._applyTag(P,Q);if(YUIDom.isAncestor(this.currentTags,this.newTagInput)){YUIDom.insertAfter(this.newTagInput.parentNode,this.currentTags)}},this,true);this.tagAutoComplete.dataReturnEvent.subscribe(function(R,P){var Q=P[2];for(G=0,j=Q.length;G<j;G++){var S=Q[G].nodeRef;var O=Alfresco.util.arrayIndex(this.tagRefs,S);if(O!=-1){Q.splice(G,1);G--;j--}}},this,true);var I=this;D.addListener(this.newTagInput,"keypress",function(O){if(O.keyCode==13&&this.value.length>0){D.stopEvent(O);I._createTag(this.value,false,O)}});var I=this;D.addListener(this.newTagInput,"keydown",function(P){if(P.keyCode==8&&this.newTagInput.value.length==0){if(this._editingTagIndex!=-1){this.tagRefs.splice(this._editingTagIndex,1);YUIDom.insertAfter(this.newTagInput.parentNode,this.currentTags)}else{if(!this._tagPrimedForDelete&&this.currentTags.children.length>0){this._tagPrimedForDelete=true;var O=YUIDom.getLastChild(this.currentTags);YUIDom.addClass(O,"inlineTagEditTagPrimed");YUIDom.addClass(O.children[1],"hidden");YUIDom.removeClass(O.children[2],"hidden")}else{if(this.tagRefs.length>0){this.tagRefs.pop();YUIDom.setAttribute(this.hiddenInput,"value",this.tagRefs.toString());this.currentTags.removeChild(YUIDom.getLastChild(this.currentTags))}this._tagPrimedForDelete=false}}}else{if(this._tagPrimedForDelete==true){this._tagPrimedForDelete=false;if(this.currentTags.children.length>0){var O=YUIDom.getLastChild(this.currentTags);YUIDom.removeClass(O,"inlineTagEditTagPrimed");YUIDom.addClass(O.children[2],"hidden");YUIDom.removeClass(O.children[1],"hidden")}}}},this,true);D.addListener(J,"click",function(O){this.newTagInput.select()},this,true);D.addListener(this.newTagInput,"blur",function(O){if(this.balloon){this.suppressInputBoxFocus=true;this.balloon.hide()}this.suppressInputBoxFocus=false},this,true);F.on("click",function(O){if(this.newTagInput.value.length>0){this._createTag(this.newTagInput.value,true,O)}else{this.form._submitInvoked(O)}},this,true);L.on("click",function(O){D.stopEvent(O);this.inputBox.value="";this.doHide(true)},this,true);this.inputBox=this.newTagInput;this.keyListener=new m(this.inputBox,{keys:[m.KEY.ESCAPE]},{fn:function(P,O){D.stopEvent(O[1]);this.inputBox.value="";this.doHide(true)},scope:this,correctScope:true});this.balloon=Alfresco.util.createBalloon(J);this.balloon.onClose.subscribe(function(O){try{if(!this.suppressInputBoxFocus){this.inputBox.focus()}}catch(O){}},this,true);var K=this.params.validations;for(var G=0,N=K.length;G<N;G++){this.form.addValidation(this.inputBox,K[G].type,K[G].args,K[G].when,K[G].message)}this.form.init();this.markupGenerated=true},_createTag:function q(I,H,G){if(G){D.stopEvent(G)}var F={name:I},E={fn:function(K){this._applyTag(I,K.json.nodeRef);if(YUIDom.isAncestor(this.currentTags,this)){YUIDom.insertAfter(this.parentNode,this.currentTags)}if(H){this.form._submitInvoked(G)}},scope:this},J={fn:function(K){},scope:this};Alfresco.util.Ajax.jsonRequest({method:"POST",url:Alfresco.constants.PROXY_URI+"api/tag/workspace/SpacesStore",dataObj:F,successCallback:E,failureCallback:J})}})})();Alfresco.util.findEventClass=function(c,a){if(!c){return null}var d=c.element;var b=(a||"span").toLowerCase();while((d!==null)&&((d.tagName.toLowerCase()!=b)||(d.className.indexOf("yui")===0))){d=d.firstChild}if(d===null){return null}return d.className};Alfresco.util.hasEventInterest=function(d,a){var f=a[1],c="source",e="target",b=false;if(f){if(f.action==="navigate"){f.eventGroup=f.anchor.rel}if(f.eventGroup&&d){c=(typeof f.eventGroup=="string")?f.eventGroup:f.eventGroup.eventGroup;e=(typeof d=="string")?d:d.eventGroup;b=(c==e)}}return b};Alfresco.util.hasRequiredFlashPlayer=function(c,b,a){if(typeof DetectFlashVer=="function"){return DetectFlashVer(c,b,a)}return false};Alfresco.util.addMessages=function(b,a){if(a===undefined){throw new Error("messageScope must be defined")}else{if(a=="global"){throw new Error("messageScope cannot be 'global'")}else{Alfresco.messages.scope[a]=YAHOO.lang.merge(Alfresco.messages.scope[a]||{},b);return true}}return false};Alfresco.util.copyMessages=function(b,a){if(b===undefined){throw new Error("Source must be defined")}else{if(Alfresco.messages.scope[b]===undefined){throw new Error("Source namespace doesn't exist")}else{if(a===undefined){throw new Error("Destination must be defined")}else{if(a=="global"){throw new Error("Destination cannot be 'global'")}else{Alfresco.messages.scope[a]=YAHOO.lang.merge({},Alfresco.messages.scope[b])}}}}};Alfresco.util.message=function(a,b){var f=a;if(typeof a!="string"){throw new Error("Missing or invalid argument: messageId")}var d=Alfresco.messages.global[a];if(typeof d=="string"){f=d}if((typeof b=="string")&&(typeof Alfresco.messages.scope[b]=="object")){var c=Alfresco.messages.scope[b][a];if(typeof c=="string"){f=c}}var e=[];if((arguments.length==3)&&(typeof arguments[2]=="object")){e=arguments[2]}else{e=Array.prototype.slice.call(arguments).slice(2)}if(YAHOO.lang.isArray(e)&&e.length>0){f=f.replace(/''/g,"'")}f=YAHOO.lang.substitute(f,e);return f};Alfresco.util.calI18nParams=function(b){var a=Alfresco.util.message;b.cfg.setProperty("MONTHS_SHORT",a("months.short").split(","));b.cfg.setProperty("MONTHS_LONG",a("months.long").split(","));b.cfg.setProperty("WEEKDAYS_1CHAR",a("days.initial").split(","));b.cfg.setProperty("WEEKDAYS_SHORT",a("days.short").split(","));b.cfg.setProperty("WEEKDAYS_MEDIUM",a("days.medium").split(","));b.cfg.setProperty("WEEKDAYS_LONG",a("days.long").split(","));b.cfg.setProperty("START_WEEKDAY",a("calendar.widget_config.start_weekday"));var c=a("calendar.widget_config.my_label_month_position");if(c.length!==0){b.cfg.setProperty("MY_LABEL_MONTH_POSITION",parseInt(c))}var e=a("calendar.widget_config.my_label_month_suffix");if(e.length!==0){b.cfg.setProperty("MY_LABEL_MONTH_SUFFIX",e)}var d=a("calendar.widget_config.my_label_year_position");if(d.length!==0){b.cfg.setProperty("MY_LABEL_YEAR_POSITION",parseInt(d))}b.cfg.setProperty("MY_LABEL_YEAR_SUFFIX",a("calendar.widget_config.my_label_year_suffix"))};Alfresco.util.caretFix=function(c){if(YAHOO.env.ua.gecko===1.8){if(typeof c=="string"){c=YUIDom.get(c)}var b=YUISelector.query(".yui-u",c);for(var a=0;a<b.length;a++){var d=b[a];YUIDom.addClass(d,"caret-fix")}}};Alfresco.util.undoCaretFix=function(c){if(YAHOO.env.ua.gecko===1.8){if(typeof c=="string"){c=YUIDom.get(c)}var b=YUISelector.query(".caret-fix",c);for(var a=0;a<b.length;a++){var d=b[a];YUIDom.removeClass(d,"caret-fix")}}};Alfresco.util.submitForm=function(d){var b=YAHOO.env.ua;var a=false;if(d!==null){if(b.ie&&(b.ie<9)){a=d.fireEvent("onsubmit")}else{var c=document.createEvent("HTMLEvents");c.initEvent("submit",true,true);a=d.dispatchEvent(c)}if((b.ie||b.webkit)&&a){d.submit()}}};Alfresco.util.parseJSON=function(b,a){try{return YAHOO.lang.JSON.parse(b)}catch(c){if(a){Alfresco.util.PopupManager.displayPrompt({title:"Failure",text:"Can't parse response as json: '"+b+"'"})}}return null};Alfresco.util.uriTemplate=function(a,b,c){if(!(a in Alfresco.constants.URI_TEMPLATES)){return null}return Alfresco.util.renderUriTemplate(Alfresco.constants.URI_TEMPLATES[a],b,c)};Alfresco.util.renderUriTemplate=function(b,d,e){if(b.indexOf("{site}")!==-1){if(d.hasOwnProperty("site")){if(!Alfresco.util.isValueSet(d.site)&&(Alfresco.constants.PAGECONTEXT.length==0)){b=b.replace("/site/{site}","")}else{if(Alfresco.constants.PAGECONTEXT.length>0){b=b.replace("/site/{site}","/context/"+Alfresco.constants.PAGECONTEXT)}}}else{if(Alfresco.constants.SITE.length>0){d.site=Alfresco.constants.SITE}else{if(Alfresco.constants.PAGECONTEXT.length>0){b=b.replace("/site/{site}","/context/"+Alfresco.constants.PAGECONTEXT)}else{b=b.replace("/site/{site}","")}}}}var c=b,a=/^(http|https):\/\//;while(c!==(c=YAHOO.lang.substitute(c,d))){}if(!a.test(c)){c=Alfresco.util.combinePaths(Alfresco.constants.URL_PAGECONTEXT,c)}if(Alfresco.constants.PORTLET){if(c.indexOf(Alfresco.constants.URL_CONTEXT)===0){c=Alfresco.util.combinePaths("/",c.substring(Alfresco.constants.URL_CONTEXT.length))}c=Alfresco.constants.PORTLET_URL.replace("$$scriptUrl$$",encodeURIComponent(decodeURIComponent(c.replace(/%25/g,"%2525").replace(/%26/g,"%252526"))))}if(e&&(c.indexOf(location.protocol+"//")!==0)){if(c.substring(0,1)!=="/"){c="/"+c}c=location.protocol+"//"+location.host+c}return c};Alfresco.util.siteURL=function(a,b,c){return Alfresco.util.uriTemplate("sitepage",YAHOO.lang.merge(b||{},{pageid:a}),c)};Alfresco.util.profileURL=function(a){return Alfresco.util.uriTemplate("userprofilepage",{userid:a})};Alfresco.util.parseURL=function(c){var b=document.createElement("a"),e=function(f){var a=(f.substring(0,1)==="/")?"":"/";return a+f};b.href=c;var d={protocol:b.protocol,hostname:b.hostname,port:b.port,host:b.host,pathname:e(b.pathname),search:b.search,hash:b.hash,queryParams:Alfresco.util.getQueryStringParameters(c),getUrl:function(){return this.getDomain()+this.pathname+Alfresco.util.toQueryString(this.queryParams)+this.hash},getDomain:function(){return this.protocol+"//"+this.host}};return d};Alfresco.util.navigateTo=function(e,f,d){f=f?f.toUpperCase():"GET";if(f=="GET"){window.location.href=e}else{var c=document.createElement("form");c.method=f;c.action=e;if(f=="POST"){var a;for(var b in d){if(d.hasOwnProperty(b)){value=d[b];if(value){a=document.createElement("input");a.setAttribute("name",b);a.setAttribute("type","hidden");a.value=value;c.appendChild(a)}}}}document.body.appendChild(c);c.submit()}};Alfresco.util.siteDashboardLink=function(g,b,f,d){if(!YAHOO.lang.isString(g)||g.length===0){return""}var a=Alfresco.util.encodeHTML(YAHOO.lang.isString(b)&&b.length>0?b:g),c=Alfresco.constants.URI_TEMPLATES.sitedashboardpage,e="";if(d||YAHOO.lang.isUndefined(c)||c.length===0||Alfresco.constants.PORTLET){return"<span>"+a+"</span>"}e=Alfresco.util.uriTemplate("sitedashboardpage",{site:g});return'<a href="'+e+'" '+(f||"")+">"+a+"</a>"};Alfresco.util.userProfileLink=function(f,g,e,c){if(!YAHOO.lang.isString(f)||f.length===0){return""}var a=Alfresco.util.encodeHTML(YAHOO.lang.isString(g)&&g.length>0?g:f),b=Alfresco.constants.URI_TEMPLATES.userprofilepage,d="";if(c||YAHOO.lang.isUndefined(b)||b.length===0||Alfresco.constants.PORTLET){return"<span>"+a+"</span>"}d=Alfresco.util.uriTemplate("userprofilepage",{userid:f});return'<a href="'+d+'" '+(e||"")+">"+a+"</a>"};Alfresco.util.contentURL=function(c,b,a){return Alfresco.constants.PROXY_URI+"api/node/content/"+c.replace(":/","")+"/"+b+(a?"?a=true":"")};Alfresco.util.getQueryStringParameter=function(b,a){var c=this.getQueryStringParameters(a);if(b in c){return c[b]}return null};Alfresco.util.getQueryStringParameters=function(b){var e,g,l,a,d,h,c,k,f;b=b||window.location.href;l=b.indexOf("?");a=l>=0?b.substr(l+1):b;l=a.lastIndexOf("#");a=l>=0?a.substr(0,l):a;d=a.split("&");f={};for(e=0,g=d.length;e<g;e++){h=d[e].split("=");if(h.length>=2){c=h[0];k=decodeURIComponent(h[1]);switch(typeof f[c]){case"undefined":f[c]=k;break;case"string":f[c]=[f[c]].concat(k);break;case"object":f[c]=f[c].concat(k);break}}}return f};Alfresco.util.toQueryString=function(c){var a="?",b,d,e;for(b in c){if(c.hasOwnProperty(b)){d=c[b];if(typeof d=="object"){for(e in d){if(d.hasOwnProperty(e)){a+=encodeURIComponent(b)+"="+encodeURIComponent(d[e])+"&"}}}else{if(typeof d=="string"){a+=encodeURIComponent(b)+"="+encodeURIComponent(d)+"&"}}}}return a.substring(0,a.length-1)};Alfresco.util.getVar=function(b,a){var d=typeof a!="undefined"?a:null;try{if(window.name!==""&&YAHOO.lang.JSON.isValid(window.name)){var g=YAHOO.lang.JSON.parse(window.name),c=g[location.host],f=null;if(typeof c=="object"){f=c[b];if(typeof f!=="undefined"&&f!==null){d=f}}}}catch(h){Alfresco.logger.error("Alfresco.util.getVar()",b,a,h)}return d};Alfresco.util.setVar=function(a,f){var d=true;try{var b={};if(window.name!==""&&YAHOO.lang.JSON.isValid(window.name)){b=YAHOO.lang.JSON.parse(window.name)}if(typeof b[location.host]=="undefined"){b[location.host]={}}b[location.host][a]=f;window.name=YAHOO.lang.JSON.stringify(b)}catch(c){Alfresco.logger.error("Alfresco.util.setVar()",a,f,c);d=false}return d};Alfresco.util.getTags=function(f){var c=null,b=[],e={},d=new RegExp(/([^"^\s]+)\s*|"([^"]+)"\s*/g),a;while(c=d.exec(f)){a=c[1]||c[2];if(e[a]===undefined){e[a]=true;b.push(a)}}return b};Alfresco.util.cleanBubblingObject=function(b){var d={action:true,flagged:true,decrepitate:true,stop:true},c={};for(var a in b){if(b.hasOwnProperty(a)&&d[a]!==true){c[a]=b[a]}}return c};Alfresco.util.bind=function(c,b){if(!YAHOO.lang.isObject(b)){return c}var a=Array.prototype.slice.call(arguments).slice(2);return(function(){return c.apply(b,a.concat(Array.prototype.slice.call(arguments)))})};Alfresco.util.isAutocompleteIgnoreKey=function(a){if((a==9)||(a==13)||(a==16)||(a==17)||(a>=18&&a<=20)||(a==27)||(a>=33&&a<=35)||(a>=36&&a<=40)||(a>=44&&a<=45)||(a==229)){return true}return false};Alfresco.util.hasKeyCode=function(b,c){var a=b.charCode?b.charCode:b.keyCode;if(YAHOO.lang.isArray(c)){return Alfresco.util.arrayContains(c,a)}return c==a};Alfresco.util.YUILoaderHelper=function(){var f=null;var h=[];var e=false;var g=function d(){if(f===null){f=new YAHOO.util.YUILoader({base:Alfresco.constants.URL_RESCONTEXT+"yui/",filter:Alfresco.constants.DEBUG?"DEBUG":{searchExp:"-min\\.js",replaceStr:"-min.js?v="+YAHOO.VERSION},loadOptional:false,skin:{},onSuccess:Alfresco.util.YUILoaderHelper.onLoaderComplete,onFailure:function(k){alert("load failed:"+k)},scope:this});f.addModule({name:"swfplayer",type:"js",path:"swfplayer/swfplayer.js",varName:"SWFPlayer",requires:["uploader"]});f.addModule({name:"columnbrowser",type:"js",path:"columnbrowser/columnbrowser.js",varName:"ColumnBrowser",requires:["json","carousel","paginator"],skinnable:true})}};return({require:function c(m,k,o){g();if(m.length>0){var n=true;for(var l=0;l<m.length;l++){if(YAHOO.env.getVersion(m[l])===null){n=false;break}}if(n&&(k!==null)){YAHOO.lang.later(10,o,k)}else{f.require(m);h.push({required:Alfresco.util.arrayToObject(m),fn:k,scope:(typeof o!="undefined"?o:window)})}}else{if(k!==null){k.call(typeof o!="undefined"?o:window)}}},loadComponents:function a(k){g();if(e||k===true){if(f!==null){f.insert(null,"js")}}},onLoaderComplete:function b(){for(var k=0;k<h.length;k++){if(h[k].fn){h[k].fn.call(h[k].scope)}}h=[];e=true}})}();Alfresco.util.ComponentManager=function(){var e=[];return({register:function d(l){if(l.id!=="null"&&e.hasOwnProperty(l.id)){var k=e[l.id];if(k.name===l.name){if(typeof k.destroy==="function"){k.destroy()}this.unregister(e[l.id])}}e.push(l);e[l.id]=l},unregister:function h(k){for(var l=0;l<e.length;l++){if(e[l]==k){e.splice(l,1);delete e[k.id];break}}},reregister:function c(k){this.unregister(k);this.register(k)},find:function g(q){var p=[];var k,m;for(var o=0,l=e.length;o<l;o++){m=e[o];k=true;for(var n in q){if(q[n]!=m[n]){k=false}}if(k){p.push(m)}}return p},findFirst:function b(k){var l=Alfresco.util.ComponentManager.find({name:k});return(typeof l[0]=="object"?l[0]:null)},get:function a(k){return(e[k]||null)},list:function f(){return e}})}();Alfresco.util.PopupManager=function(){var b=Alfresco.util.encodeHTML;return({zIndex:15,defaultDisplayMessageConfig:{title:null,text:null,spanClass:"message",displayTime:2.5,effect:YAHOO.widget.ContainerEffect.FADE,effectDuration:0.5,visible:false,noEscape:false},displayMessage:function g(h,l){var l=l||document.body;var o=YAHOO.lang.merge(this.defaultDisplayMessageConfig,h);if(o.text===undefined){throw new Error("Property text in userConfig must be set")}var k={modal:false,visible:o.visible,close:false,draggable:false,effect:{effect:o.effect,duration:o.effectDuration},zIndex:(o.zIndex==undefined?0:o.zIndex)+this.zIndex++};if(o.effect===null||YAHOO.env.ua.ie>0){delete k.effect}var m=new YAHOO.widget.Dialog("message",k);m.destroyWithAnimationsStop=function(){if(m._fadingIn||m._fadingOut){if(m._cachedEffects&&m._cachedEffects.length>0){for(var p=0;p<m._cachedEffects.length;p++){var q=m._cachedEffects[p];if(q.animIn){q.animIn.stop()}if(q.animOut){q.animOut.stop()}}}}m.destroy()};var n="<span class='"+o.spanClass+"'>"+(o.noEscape?o.text:b(o.text))+"</span>";m.setBody(n);m.render(l);m.center();if(o.displayTime>0){m.subscribe("show",this._delayPopupHide,{popup:m,displayTime:(o.displayTime*1000)},true)}m.show();return m},_delayPopupHide:function c(){YAHOO.lang.later(this.displayTime,this,function(){this.popup.destroy()})},defaultDisplayPromptConfig:{title:null,text:null,icon:null,close:false,constraintoviewport:true,draggable:true,effect:null,effectDuration:0.5,modal:true,visible:false,noEscape:false,buttons:[{text:null,handler:function(){this.destroy()},isDefault:true}]},displayPrompt:function f(m,n){var n=n||document.body;if(this.defaultDisplayPromptConfig.buttons[0].text===null){this.defaultDisplayPromptConfig.buttons[0].text=Alfresco.util.message("button.ok",this.name)}var o=YAHOO.lang.merge(this.defaultDisplayPromptConfig,m);if(o.text===undefined){throw new Error("Property text in userConfig must be set")}var h=new YAHOO.widget.SimpleDialog("prompt",{close:o.close,constraintoviewport:o.constraintoviewport,draggable:o.draggable,effect:o.effect,modal:o.modal,visible:o.visible,zIndex:o.zIndex+this.zIndex++});if(o.title){h.setHeader(b(o.title))}h.setBody(o.noEscape?o.text:b(o.text));if(o.icon){h.cfg.setProperty("icon",o.icon)}if(o.buttons){h.cfg.queueProperty("buttons",o.buttons)}h.render(n);h.center();if(o.zIndex!==undefined&&o.zIndex>0){var l=o.zIndex+this.zIndex;var k=function(){element=Dom.get("prompt_mask");if(element!==undefined){Dom.setStyle(element,"zIndex",l-1)}Dom.setStyle(h.element,"zIndex",l);h.cfg.setProperty("zIndex",l,true)};h.beforeShowEvent.subscribe(k,h,true)}h.show()},defaultGetUserInputConfig:{title:null,text:null,input:"textarea",value:"",icon:null,close:true,constraintoviewport:true,draggable:true,effect:null,effectDuration:0.5,modal:true,visible:false,initialShow:true,noEscape:true,html:null,callback:null,buttons:[{text:null,handler:null,isDefault:true},{text:null,handler:function(){this.destroy()}}]},getUserInput:function e(l){if(this.defaultGetUserInputConfig.buttons[0].text===null){this.defaultGetUserInputConfig.buttons[0].text=Alfresco.util.message("button.ok",this.name)}if(this.defaultGetUserInputConfig.buttons[1].text===null){this.defaultGetUserInputConfig.buttons[1].text=Alfresco.util.message("button.cancel",this.name)}var p=YAHOO.lang.merge(this.defaultGetUserInputConfig,l);var h=new YAHOO.widget.SimpleDialog("userInput",{close:p.close,constraintoviewport:p.constraintoviewport,draggable:p.draggable,effect:p.effect,modal:p.modal,visible:p.visible,zIndex:this.zIndex++});if(p.title){h.setHeader(b(p.title))}var m=p.html,o=Alfresco.util.generateDomId();if(m===null){m="";if(p.text){m+='<label for="'+o+'">'+(p.noEscape?p.text:b(p.text))+"</label><br/>"}if(p.input=="textarea"){m+='<textarea id="'+o+'" tabindex="0">'+p.value+"</textarea>"}else{if(p.input=="text"){m+='<input id="'+o+'" tabindex="0" type="text" value="'+p.value+'"/>'}}}h.setBody(m);if(p.icon){h.cfg.setProperty("icon",p.icon)}if(p.buttons){if(p.okButtonText){p.buttons[0].text=p.okButtonText}if(typeof l.buttons=="undefined"||typeof l.buttons[0]=="undefined"){p.buttons[0].handler={fn:function(q,t){var r=null;if(YUIDom.get(t.id)){var s=YUIDom.get(t.id);r=YAHOO.lang.trim(s.value||s.text)}this.destroy();if(t.callback.fn){t.callback.fn.call(t.callback.scope||window,r,t.callback.obj)}},obj:{id:o,callback:p.callback}}}h.cfg.queueProperty("buttons",p.buttons)}h.render(document.body);if(h.getButtons().length>0){var n=h.getButtons()[0];YAHOO.util.Event.addListener(o,"keyup",function(q,r){r.set("disabled",YAHOO.lang.trim(this.value||this.text||"").length==0)},n);n.set("disabled",YAHOO.lang.trim(p.value).length==0)}h.center();if(p.initialShow){h.show()}if(p.value!==""){YUIDom.get(o).selectionStart=0;YUIDom.get(o).selectionEnd=p.value.length}var k=new YAHOO.util.KeyListener(document,{keys:YAHOO.util.KeyListener.KEY.ESCAPE},{fn:function(r,q){this.destroy()},scope:h,correctScope:true});k.enable();if(YUIDom.get(o)){YUIDom.get(o).focus()}return h},displayForm:function d(k){var n=k.properties.htmlid||Alfresco.util.generateDomId();k.properties.htmlid=n;var h=this.displayWebscript({title:k.title,url:Alfresco.constants.URL_SERVICECONTEXT+"components/form",properties:YAHOO.lang.merge({submitType:"json",showCaption:false,formUI:true,showCancelButton:true},k.properties)});YAHOO.Bubbling.on("formContentReady",function m(q,o){if(Alfresco.util.hasEventInterest(n+"-form",o)){var p=o[1].buttons.submit;p.set("label",Alfresco.util.message("label.ok"));var r=o[1].buttons.cancel;if(r){r.addListener("click",this.panel.destroy,this.panel,true)}}},{panel:h,config:k});YAHOO.Bubbling.on("beforeFormRuntimeInit",function l(p,o){if(Alfresco.util.hasEventInterest(n+"-form",o)){o[1].runtime.setAJAXSubmit(true,{successCallback:{fn:function q(r){this.panel.destroy();if(this.config.success&&YAHOO.lang.isFunction(this.config.success.fn)){this.config.success.fn.call(this.config.success.scope||{},r,this.config.success.obj)}},scope:this},successMessage:this.config.successMessage,failureCallback:this.config.success,failureMessage:this.config.failureMessage})}},{panel:h,config:k})},displayWebscript:function a(k){k.properties.htmlid=k.properties.htmlid||Alfresco.util.generateDomId();var l=new YAHOO.widget.Dialog(k.properties.htmlid+"-panel",{visible:false,modal:true,constraintoviewport:true,fixedcenter:"contained",postmethod:"none"});Alfresco.util.Ajax.request({method:k.method||Alfresco.util.Ajax.GET,url:k.url,dataObj:k.properties,successCallback:{fn:function h(m,n){if(n.title){l.setHeader(n.title)}l.setBody(m.serverResponse.responseText);l.render(document.body);l.show()},scope:this,obj:k},failureMessage:Alfresco.util.message("message.failure"),scope:this,execScripts:true});return l}})}();Alfresco.util.FilterManager=function(){var b=[];return({register:function a(e,h){var f,g,d;if(typeof h=="string"){h=[h]}for(f=0,g=h.length;f<g;f++){d=h[f];b.push({filterOwner:e,filterId:d});b[d]=e}},getOwner:function c(d){return(b[d]||null)}})}();Alfresco.util.CSRFPolicy=function(){var a=Alfresco.constants.CSRF_POLICY.properties||{};function b(c){return YAHOO.lang.substitute(c,a)}return{isFilterEnabled:function(){return Alfresco.constants.CSRF_POLICY.enabled},getHeader:function(){return b(Alfresco.constants.CSRF_POLICY.header)},getParameter:function(){return b(Alfresco.constants.CSRF_POLICY.parameter)},getCookie:function(){return b(Alfresco.constants.CSRF_POLICY.cookie)},getToken:function(){var c=null;var d=this.getCookie();if(d){c=YAHOO.util.Cookie.get(d);if(c){c=c.replace(/"/g,"")}}return c}}}();Alfresco.util.IFramePolicy=function(){return{isUrlAllowed:function(a){if(a.indexOf(window.location.protocol+"//"+window.location.host)==0){return Alfresco.constants.IFRAME_POLICY.sameDomain=="allow"}var c=Alfresco.constants.IFRAME_POLICY.crossDomainUrls;for(var b=0;b<c.length;b++){if(c[b]=="*"||a.indexOf(c[b])==0){return true}}return false}}}();Alfresco.util.Ajax=function(){return{FORM:"application/x-www-form-urlencoded",JSON:"application/json",GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",defaultRequestConfig:{method:"GET",url:null,dataObj:null,dataStr:null,dataForm:null,requestContentType:null,responseContentType:null,successCallback:null,successMessage:null,failureCallback:null,failureMessage:null,execScripts:false,noReloadOnAuthFailure:false,object:null},request:function(b){var e=YAHOO.lang.merge(this.defaultRequestConfig,b);Alfresco.util.assertNotEmpty(e.url,"Parameter 'url' can NOT be null");Alfresco.util.assertNotEmpty(e.method,"Parameter 'method' can NOT be null");if(e.requestContentType){YAHOO.util.Connect.setDefaultPostHeader(e.requestContentType);YAHOO.util.Connect.setDefaultXhrHeader(e.requestContentType);YAHOO.util.Connect.initHeader("Content-Type",e.requestContentType)}else{YAHOO.util.Connect.setDefaultPostHeader(this.FORM);YAHOO.util.Connect.setDefaultXhrHeader(this.FORM);YAHOO.util.Connect.initHeader("Content-Type",this.FORM)}if(Alfresco.util.CSRFPolicy.isFilterEnabled()){YAHOO.util.Connect.initHeader(Alfresco.util.CSRFPolicy.getHeader(),Alfresco.util.CSRFPolicy.getToken())}if(e.requestContentType===this.JSON){if(e.method.toUpperCase()===this.GET){if(e.dataObj){e.url+=(e.url.indexOf("?")==-1?"?":"&")+this.jsonToParamString(e.dataObj,true)}}else{if(e.method.toUpperCase()!==this.DELETE){e.dataStr=YAHOO.lang.JSON.stringify(e.dataObj||{})}}}else{if(e.dataObj){if(e.method.toUpperCase()===this.GET){e.url+=(e.url.indexOf("?")==-1?"?":"&")+this.jsonToParamString(e.dataObj,true)}else{if(e.method.toUpperCase()!==this.DELETE){e.dataStr=this.jsonToParamString(e.dataObj,true)}}}}if(e.dataForm!==null){YAHOO.util.Connect.setForm(e.dataForm)}var d={success:this._successHandler,failure:this._failureHandler,scope:this,argument:{config:b}};if(YAHOO.env.ua.air!==0){if(e.method.toUpperCase()=="PUT"||e.method.toUpperCase()=="DELETE"){var a=Alfresco.util.getQueryStringParameter("alf_method",e.url);if(a===null){e.url+=(e.url.indexOf("?")==-1?"?":"&")+"alf_method="+e.method;e.method=this.POST}}}if(YAHOO.env.ua.ie>0){e.url+=(e.url.indexOf("?")==-1?"?":"&")+"noCache="+new Date().getTime()}YAHOO.util.Connect.asyncRequest(e.method,e.url,d,e.dataStr)},jsonRequest:function(a){a.requestContentType=this.JSON;a.responseContentType=this.JSON;this.request(a)},jsonGet:function(a){a.method=this.GET;this.jsonRequest(a)},jsonPost:function(a){a.method=this.POST;this.jsonRequest(a)},jsonPut:function(a){a.method=this.PUT;this.jsonRequest(a)},jsonDelete:function(a){a.method=this.DELETE;this.jsonRequest(a)},jsonToParamString:function(c,b){var e="",d=true,a;for(a in c){if(c.hasOwnProperty(a)){if(d){d=false}else{e+="&"}if(b){e+=encodeURIComponent(a)+"="+encodeURIComponent(c[a])}else{e+=a+"="+c[a]}}}return e},_successHandler:function(d){var c=d.argument.config;if(c.execScripts){var b=this.sanitizeMarkup(d.responseText);d.responseText=b[0];var a=b[1];if(YAHOO.lang.trim(a).length>0){window.setTimeout(a,0);YAHOO.lang.later(0,this,this._successHandlerPostExec,d)}else{this._successHandlerPostExec(d)}}else{this._successHandlerPostExec(d)}},sanitizeMarkup:function(c){var a=[];var b=null;var d=/<script[^>]*>([\s\S]*?)<\/script>/gi;while((b=d.exec(c))){a.push(b[1])}a=a.join("\n");return[c.replace(d,""),a]},_successHandlerPostExec:function(e){var a=e.argument.config;if(a.execScripts){Alfresco.util.YUILoaderHelper.loadComponents()}var d=a.successCallback;if(d&&typeof d.fn=="function"){var c=e.getResponseHeader["Content-Type"]||e.getResponseHeader["content-type"]||a.responseContentType;var b=null;if(/^\s*application\/json/.test(c)){b=Alfresco.util.parseJSON(e.responseText)}d.fn.call((typeof d.scope=="object"?d.scope:this),{config:a,json:b,serverResponse:e},d.obj)}if(a.successMessage){Alfresco.util.PopupManager.displayMessage({text:a.successMessage})}},_failureHandler:function(g){var b=g.argument.config;var f=g.getResponseHeader["Content-Type"]||g.getResponseHeader["content-type"]||b.responseContentType;if((g.status==401||(g.status==302&&(/(text\/html)/).test(f)))&&!b.noReloadOnAuthFailure){var e=g.getResponseHeader.Location;if(e){window.location.href=window.location.protocol+"//"+window.location.host+e;return}else{window.location.reload(true);return}}var d=b.failureCallback,c=null;if((d&&typeof d.fn=="function")||(b.failureMessage)){if(d&&typeof d.fn=="function"){var a=true;if(b.failureMessage||b.failureCallback){a=false}if(b.responseContentType==="application/json"){c=Alfresco.util.parseJSON(g.responseText,a)}d.fn.call((typeof d.scope=="object"?d.scope:this),{config:b,json:c,serverResponse:g},d.obj)}if(b.failureMessage){Alfresco.util.PopupManager.displayPrompt({title:Alfresco.util.message("message.failure",this.name),text:b.failureMessage})}}else{if(b.responseContentType=="application/json"){c=Alfresco.util.parseJSON(g.responseText);if(c!=null){Alfresco.util.PopupManager.displayPrompt({title:c.status.name,text:c.message})}}else{if(g.statusText){Alfresco.util.PopupManager.displayPrompt({title:Alfresco.util.message("message.failure",this.name),text:g.statusText})}else{Alfresco.util.PopupManager.displayPrompt({title:Alfresco.util.message("message.failure",this.name),text:"Error sending data to server."})}}}}}}();Alfresco.util.Cursor=function(){return({DRAGGABLE:"dnd-draggable",DRAG:"dnd-drag",DROP_VALID:"dnd-dropValid",DROP_INVALID:"dnd-dropInvalid",setCursorState:function(e,b){var a=[this.DRAGGABLE,this.DRAG,this.DROP_VALID,this.DROP_INVALID];for(var c=0;c<a.length;c++){var d=a[c];if(d===b){YUIDom.addClass(e,b)}else{YUIDom.removeClass(e,d)}}}})}();Alfresco.util.Anim=function(){return({fadeAttributes:{adjustDisplay:true,callback:null,scope:this,period:0.5},fadeIn:function b(f,e){return this._fade(f,true,e)},fadeOut:function a(f,e){return this._fade(f,false,e)},_fade:function d(g,l,k){g=YUIDom.get(g);k=YAHOO.lang.merge(this.fadeAttributes,k?k:{});var e=k.adjustDisplay;var m=YAHOO.env.ua.ie===0;if(m){YUIDom.setStyle(g,"opacity",l?0:1)}if(m){YUIDom.setStyle(g,"visibility","visible")}else{YUIDom.setStyle(g,"visibility",l?"visible":"hidden")}if(e&&YUIDom.getStyle(g,"display")==="none"){YUIDom.setStyle(g,"display","block")}var n=k.callback,o=k.scope,f=g;if(m){var h=new YAHOO.util.Anim(g,{opacity:{to:l?1:0}},k.period);h.onComplete.subscribe(function(p){if(!l&&e){YUIDom.setStyle(f,"display","none")}if(n){n.call(o?o:this)}});h.animate()}else{if(!l&&e){YUIDom.setStyle(f,"display","none")}if(n){n.call(o?o:this)}}},pulseAttributes:{callback:null,inColor:"#ffff80",inDuration:0.2,outDuration:1.2,clearOnComplete:true},pulse:function c(o,n){if(!YAHOO.util.ColorAnim){return}var e=YUIDom.get(o);if(e){var g=/^rgba\((\d+), (\d+), (\d+), (\d+)\)$/i,r=/^transparent$/i,l=YUIDom.getStyle(e,"backgroundColor");if(g.test(l)){var k=g.exec(l);if(k[1]==0&&k[2]==0&&k[3]==0&&k[4]==0){l="#fff"}else{l="rgb("+k[1]+", "+k[2]+", "+k[3]+")"}}else{if(r.test(l)){l="#fff"}}var p=YAHOO.lang.merge(this.pulseAttributes,{outColor:l});if(typeof n=="object"){p=YAHOO.lang.merge(p,n)}var h=new YAHOO.util.ColorAnim(e,{backgroundColor:{to:p.inColor}},p.inDuration);var f=new YAHOO.util.ColorAnim(e,{backgroundColor:{to:p.outColor}},p.outDuration);h.onComplete.subscribe(function m(){f.animate()});f.onComplete.subscribe(function q(){if(p.clearOnComplete){YUIDom.setStyle(e,"backgroundColor","")}if(p.callback&&(typeof p.callback.fn=="function")){p.callback.fn.call(p.callback.scope||this,p.callback.obj)}});h.animate()}}})}();(function(){Alfresco.util.NodeRef=function(b){try{var c=b.replace(":/",""),a=c.split("/");return({nodeRef:b,storeType:a[0],storeId:a[1],id:a[2],uri:c,toString:function(){return b}})}catch(d){d.message="Invalid nodeRef: "+b;throw d}}})();Alfresco.constants=YAHOO.lang.merge(Alfresco.constants||{},{PROP_NAME:"cm:name",PROP_TITLE:"cm:title",PROP_DESCRIPTION:"cm:description",PROP_CREATED:"cm:created",PROP_CREATOR:"cm:creator",PROP_MODIFIER:"cm:modifier",PROP_MODIFIED:"cm:modified",PROP_CATEGORIES:"cm:categories",PROP_TAGGABLE:"cm:taggable",PROP_GOOGLEDOC_URL:"gd:url"});(function(){Alfresco.util.Node=function(f){if(YAHOO.lang.isUndefined(f)||f==null){return null}var e=YAHOO.lang.isString(f)?YAHOO.lang.JSON.parse(f):f,c=YAHOO.lang.isString(f)?f:YAHOO.lang.JSON.stringify(f);var o=new Alfresco.util.NodeRef(e.nodeRef),l=e.properties||{},p=e.aspects||[],k=e.permissions||{},b=null,g=null,d=null,m=null;categoriesObj=null;for(var h in l){if(l.hasOwnProperty(h)){if(h.indexOf("cm:")===0){l[h.substring(3)]=l[h]}l[h.replace(/:/g,"_")]=l[h]}}var r=function n(){if(g===null){g=[];var u=e.properties[Alfresco.constants.PROP_TAGGABLE]||[];for(var s=0,t=u.length;s<t;s++){g.push(u[s].name)}}return g};var q=function a(){if(m===null){m=[];var s=e.properties[Alfresco.constants.PROP_CATEGORIES]||[];for(var t=0,u=s.length;t<u;t++){m.push([s[t].name,s[t].path])}}return m};return({getNode:function(){return e},toJSON:function(){return YAHOO.lang.JSON.stringify(e)},setNodeRef:function(s){this.nodeRef=new Alfresco.util.NodeRef(s)},nodeRef:o,type:e.type,isContainer:e.isContainer,isLink:e.isLink,isLocked:e.isLocked,linkedNode:new Alfresco.util.Node(e.linkedNode),contentURL:e.contentURL,mimetype:e.mimetype,mimetypeDisplayName:e.mimetypeDisplayName,size:e.size,properties:l,hasProperty:function(s){return l.hasOwnProperty(s)},aspects:p,hasAspect:function(s){if(b===null){b=Alfresco.util.arrayToObject(this.aspects)}return b.hasOwnProperty(s)},permissions:k,hasPermission:function(s){return k.user[s]},tags:r(),hasTag:function(s){if(d===null){d=Alfresco.util.arrayToObject(this.tags)}return d.hasOwnProperty(s)},categories:q()})}})();(function(){Alfresco.util.Deferred=function(h,a){var e=false;var f=a;var d={};if(YAHOO.lang.isArray(h)){d=Alfresco.util.arrayToObject(h,false)}else{YAHOO.lang.augmentObject(d,h,true)}var k=function c(){for(var l in d){if(d.hasOwnProperty(l)){if(d[l]!==true){return}}}if(YAHOO.lang.isFunction(f.fn)){e=true;f.fn.call(f.scope||window,f.obj)}};return({fulfil:function g(l){if(!e&&d.hasOwnProperty(l)){d[l]=true;k();return true}return false},expire:function b(){e=true}})}})();if(typeof log4javascript!="undefined"){Alfresco.logger=log4javascript.getDefaultLogger();if(Alfresco.constants.AUTOLOGGING||Alfresco.util.getQueryStringParameter("log")=="on"){Alfresco.logger.info("Alfresco LOGGING enabled.")}else{if(Alfresco.util.getVar("logging",false)){Alfresco.logger.info("Alfresco LOGGING re-enabled.")}else{log4javascript.setEnabled(false)}}Alfresco.logger.getEffectiveAppenders()[0].addEventListener("unload",function(){log4javascript.setEnabled(false);Alfresco.util.setVar("logging",false)});if(window.addEventListener){var sequence=[],logSequence=[17,17,16,16],logSequenceLen=logSequence.length,logSequenceStr=logSequence.toString();document.addEventListener("keydown",function(a){sequence.push(a.keyCode);while(sequence.length>logSequenceLen){sequence.shift()}if(sequence.toString().indexOf(logSequenceStr)>=0){sequence=[];if(log4javascript.isEnabled()){log4javascript.setEnabled(false);Alfresco.logger.getEffectiveAppenders()[0].hide();Alfresco.util.setVar("logging",false)}else{log4javascript.setEnabled(true);Alfresco.logger.getEffectiveAppenders()[0].show();Alfresco.util.setVar("logging",true)}}},true)}}else{Alfresco.logger={trace:function(){},debug:function(){},info:function(){},warn:function(){},error:function(){},fatal:function(){},isDebugEnabled:function(){return false}}}Alfresco.thirdparty.dateFormat=function(){var a=function(){var b=/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloZ]|"[^"]*"|'[^']*'/g,c=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,e=/[^-+\dA-Z]/g,d=function(g,f){g=String(g);f=parseInt(f,10)||2;while(g.length<f){g="0"+g}return g};return function(k,v){if(arguments.length==1&&(typeof k=="string"||k instanceof String)&&!/\d/.test(k)){v=k;k=undefined}if(typeof k=="string"){k=k.replace(".","")}k=k?new Date(k):new Date();if(isNaN(k)){throw"invalid date"}v=String(this.masks[v]||v||this.masks["default"]);var p=k.getDate(),f=k.getDay(),l=k.getMonth(),r=k.getFullYear(),t=k.getHours(),n=k.getMinutes(),u=k.getSeconds(),q=k.getMilliseconds(),g=k.getTimezoneOffset(),h={d:p,dd:d(p),ddd:this.i18n.dayNames[f],dddd:this.i18n.dayNames[f+7],m:l+1,mm:d(l+1),mmm:this.i18n.monthNames[l],mmmm:this.i18n.monthNames[l+12],yy:String(r).slice(2),yyyy:r,h:t%12||12,hh:d(t%12||12),H:t,HH:d(t),M:n,MM:d(n),s:u,ss:d(u),l:d(q,3),L:d(q>99?Math.round(q/10):q),t:t<12?this.TIME_AM.charAt(0):this.TIME_PM.charAt(0),tt:t<12?this.TIME_AM:this.TIME_PM,T:t<12?this.TIME_AM.charAt(0).toUpperCase():this.TIME_PM.charAt(0).toUpperCase(),TT:t<12?this.TIME_AM.toUpperCase():this.TIME_PM.toUpperCase(),Z:(String(k).match(c)||[""]).pop().replace(e,""),o:(g>0?"-":"+")+d(Math.floor(Math.abs(g)/60)*100+Math.abs(g)%60,4)};return v.replace(b,function(m){return(m in h)?h[m]:m.slice(1,m.length-1)})}}();return a.apply(arguments.callee,arguments)};Alfresco.thirdparty.dateFormat.DAY_NAMES=(Alfresco.util.message("days.medium")+","+Alfresco.util.message("days.long")).split(",");Alfresco.thirdparty.dateFormat.MONTH_NAMES=(Alfresco.util.message("months.short")+","+Alfresco.util.message("months.long")).split(",");Alfresco.thirdparty.dateFormat.TIME_AM=Alfresco.util.message("date-format.am");Alfresco.thirdparty.dateFormat.TIME_PM=Alfresco.util.message("date-format.pm");Alfresco.thirdparty.dateFormat.masks={"default":Alfresco.util.message("date-format.default"),defaultDateOnly:Alfresco.util.message("date-format.defaultDateOnly"),shortDate:Alfresco.util.message("date-format.shortDate"),mediumDate:Alfresco.util.message("date-format.mediumDate"),longDate:Alfresco.util.message("date-format.longDate"),fullDate:Alfresco.util.message("date-format.fullDate"),shortTime:Alfresco.util.message("date-format.shortTime"),mediumTime:Alfresco.util.message("date-format.mediumTime"),longTime:Alfresco.util.message("date-format.longTime"),isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoFullDateTime:"yyyy-mm-dd'T'HH:MM:ss.lo"};Alfresco.thirdparty.dateFormat.i18n={dayNames:Alfresco.thirdparty.dateFormat.DAY_NAMES,monthNames:Alfresco.thirdparty.dateFormat.MONTH_NAMES};Alfresco.thirdparty.fromISO8601=function(){var a=function(){var b=/^(?:(\d{4})(?:-(\d{2})(?:-(\d{2}))?)?)?(?:T(\d{2}):(\d{2})(?::(\d{2})(.\d+)?)?((?:[+-](\d{2}):?(\d{2}))|Z)?)?$/;return function(f){var d=b.exec(f);var c=null;if(d){d.shift();if(d[1]){d[1]--}if(d[6]){d[6]*=1000}c=new Date(d[0]||1970,d[1]||0,d[2]||1,d[3]||0,d[4]||0,d[5]||0,d[6]||0);var g=0;var e=d[7]&&d[7].charAt(0);if(e!="Z"){g=((d[8]||0)*60)+(Number(d[9])||0);if(e!="-"){g*=-1}}if(e){g-=c.getTimezoneOffset()}if(g){c.setTime(c.getTime()+g*60000)}}return c}}();return a.apply(arguments.callee,arguments)};Alfresco.thirdparty.toISO8601=function(){var a=function(){var b=function(c){return(c<10)?"0"+c:c};return function(h,n){n=n||{};var g=[];var l=n.zulu?"getUTC":"get";var e="";if(n.selector!="time"){var k=h[l+"FullYear"]();e=["0000".substr((k+"").length)+k,b(h[l+"Month"]()+1),b(h[l+"Date"]())].join("-")}g.push(e);if(n.selector!="date"){var d=[b(h[l+"Hours"]()),b(h[l+"Minutes"]()),b(h[l+"Seconds"]())].join(":");var c=h[l+"Milliseconds"]();if(n.milliseconds===undefined||n.milliseconds){d+="."+(c<100?"0":"")+b(c)}if(n.zulu){d+="Z"}else{if(n.selector!="time"){var m=h.getTimezoneOffset();var f=Math.abs(m);d+=(m>0?"-":"+")+b(Math.floor(f/60))+":"+b(f%60)}}g.push(d)}return g.join("T")}}();return a.apply(arguments.callee,arguments)};Alfresco.service.BaseService=function BaseService_constructor(){return this};Alfresco.service.BaseService.prototype={_jsonCall:function BaseService__jsonCall(d,c,a,b){b=b||{};Alfresco.util.Ajax.jsonRequest({method:d,url:c,dataObj:a,successCallback:b.successCallback,successMessage:b.successMessage,failureCallback:b.failureCallback,failureMessage:b.failureMessage,noReloadOnAuthFailure:b.noReloadOnAuthFailure||false})}};(function(){Alfresco.service.Preferences=function m(){Alfresco.service.Preferences.superclass.constructor.call(this);return this};YAHOO.extend(Alfresco.service.Preferences,Alfresco.service.BaseService,{_prefs:null,_url:function c(){return Alfresco.constants.PROXY_URI+"api/people/"+encodeURIComponent(Alfresco.constants.USERNAME)+"/preferences"},get:function d(){if(this._prefs===null){this._prefs=YAHOO.lang.JSON.parse(Alfresco.constants.USERPREFERENCES)}return this._prefs},request:function f(p,o){this._jsonCall(Alfresco.util.Ajax.GET,this._url()+(p?"?pf="+p:""),null,o)},set:function l(p,r,o){var q=Alfresco.util.dotNotationToObject(p,r);this._jsonCall(Alfresco.util.Ajax.POST,this._url(),q,o)},update:function l(p,o){this._jsonCall(Alfresco.util.Ajax.POST,this._url(),p,o)},add:function a(q,t,p){var u=q,o=t;var s=p?p:{};var r=s.successCallback;s.successCallback={fn:function(x,z){s.successCallback=r;var w=Alfresco.util.dotNotationToObject(u,null);w=YAHOO.lang.merge(w,x.json);var v=Alfresco.util.findValueByDotNotation(w,u);if(typeof v=="string"||v===null){var y=v?v.split(","):[];y.push(o);this.set(q,y.join(","),s)}},scope:this};this.request(q,s)},favouriteDocumentOrFolder:function b(r,q){var p=r.isContainer?"org.alfresco.share.folders.favourites":"org.alfresco.share.documents.favourites";var u="org.alfresco";var o=r.nodeRef;var t=q?q:{};var s=t.successCallback;t.successCallback={fn:function(x,A){t.successCallback=s;var w=Alfresco.util.dotNotationToObject(p,null);w=YAHOO.lang.merge(w,x.json);var v=Alfresco.util.findValueByDotNotation(w,p);if(typeof v=="string"||v===null){var y=v?v.split(","):[];y.push(o);if(r.isContainer){var z={org:{alfresco:{ext:{folders:{favourites:{}}},share:{folders:{favourites:y.join(",")}}}}};z.org.alfresco.ext.folders.favourites[o]={createdAt:new Date()};this.update(z,t)}else{var z={org:{alfresco:{ext:{documents:{favourites:{}}},share:{documents:{favourites:y.join(",")}}}}};z.org.alfresco.ext.documents.favourites[o]={createdAt:new Date()};this.update(z,t)}}},scope:this};this.request(p,t)},unFavouriteDocumentOrFolder:function n(r,q){var p=r.isContainer?"org.alfresco.share.folders.favourites":"org.alfresco.share.documents.favourites";var u="org.alfresco";var o=r.nodeRef;var t=q?q:{};var s=t.successCallback;t.successCallback={fn:function(x,A){t.successCallback=s;var w=Alfresco.util.dotNotationToObject(p,null);w=YAHOO.lang.merge(w,x.json);var v=Alfresco.util.findValueByDotNotation(w,p);if(typeof v=="string"){var y=v?v.split(","):[];y=Alfresco.util.arrayRemove(y,o);if(r.isContainer){var z={org:{alfresco:{ext:{folders:{favourites:{}}},share:{folders:{favourites:y.join(",")}}}}};z.org.alfresco.ext.folders.favourites[o]={createdAt:null};this.update(z,t)}else{var z={org:{alfresco:{ext:{documents:{favourites:{}}},share:{documents:{favourites:y.join(",")}}}}};z.org.alfresco.ext.documents.favourites[o]={createdAt:null};this.update(z,t)}}},scope:this};this.request(p,t)},favouriteSite:function h(q,o){var p={org:{alfresco:{ext:{sites:{favourites:{}}},share:{sites:{favourites:{}}}}}};p.org.alfresco.share.sites.favourites[q]=true;p.org.alfresco.ext.sites.favourites[q]={createdAt:new Date()};this.update(p,o)},unFavouriteSite:function k(q,o){var p={org:{alfresco:{ext:{sites:{favourites:{}}},share:{sites:{favourites:{}}}}}};p.org.alfresco.share.sites.favourites[q]=false;p.org.alfresco.ext.sites.favourites[q]={createdAt:null};this.update(p,o)},remove:function g(q,t,p){var u=q,o=t;var s=p?p:{};var r=s.successCallback;s.successCallback={fn:function(x,z){s.successCallback=r;var w=Alfresco.util.dotNotationToObject(u,null);w=YAHOO.lang.merge(w,x.json);var v=Alfresco.util.findValueByDotNotation(w,u);if(typeof v=="string"){var y=v?v.split(","):[];y=Alfresco.util.arrayRemove(y,o);this.set(q,y.join(","),s)}},scope:this};this.request(q,s)},getDashletId:function e(r,o){var q=(r.options.siteId&&r.options.siteId!="")?"."+r.options.siteId:"",s=(r.options.regionId&&r.options.regionId!="")?"."+r.options.regionId:"",p="org.alfresco.share.";return p+o+".dashlet"+s+q}})})();(function(){Alfresco.service.Ratings=function d(f){if(typeof f==="undefined"||f===null){throw new Error("Mandatory ratingScheme parameter is missing.")}Alfresco.service.Ratings.superclass.constructor.call(this);this._ratingScheme=f;return this};YAHOO.lang.augmentObject(Alfresco.service.Ratings,{LIKES:"likesRatingScheme",FIVE_STAR:"fiveStarRatingScheme"});YAHOO.extend(Alfresco.service.Ratings,Alfresco.service.BaseService,{_ratingScheme:null,_url:function b(f){return Alfresco.constants.PROXY_URI+"api/node/"+f.uri+"/ratings"},request:function c(g,f){this._jsonCall(Alfresco.util.Ajax.GET,this._url(g),null,f)},set:function e(h,g,f){this._jsonCall(Alfresco.util.Ajax.POST,this._url(h),{rating:g,ratingScheme:this._ratingScheme},f)},remove:function a(g,f){this._jsonCall(Alfresco.util.Ajax.DELETE,this._url(g)+"/"+encodeURIComponent(this._ratingScheme),null,f)}})})();(function(){Alfresco.service.QuickShare=function a(){return Alfresco.service.QuickShare.superclass.constructor.call(this)};YAHOO.extend(Alfresco.service.QuickShare,Alfresco.service.BaseService,{_url:function c(e,f){return Alfresco.constants.PROXY_URI+"api/internal/shared/"+e+"/"+f},share:function b(f,e){this._jsonCall(Alfresco.util.Ajax.POST,this._url("share",(f+"").replace(":/","")),{},e)},unshare:function d(f,e){this._jsonCall(Alfresco.util.Ajax.DELETE,this._url("unshare",f),null,e)}})})();Alfresco.util.RichEditorManager=(function(){var a=[];return({addEditor:function(c,b){a[c]=b},getEditor:function(b){if(a[b]){return a[b]}return null}})})();Alfresco.util.RichEditor=function(h,b,d){var l=Alfresco.util.RichEditorManager.getEditor(h);if(l){var k=new l();YAHOO.lang.augmentObject(k,{unsubscribe:function(){},subscribe:function(o,n,m){var p=k.getEditor();if(p.subscribe){p.subscribe(o,n,m,true)}else{if(p[o]){p[o].add(function(){n.apply(m,arguments)})}}YAHOO.Bubbling.on(o,n,m)},on:function(o,n,m){YAHOO.Bubbling.on(o,n,m)}});if(b&&d){if(d.language){var f=Alfresco.constants.TINY_MCE_SUPPORTED_LOCALES.split(","),c="en",a=d.language.substring(0,2).toLowerCase();for(var g=0,e=f.length;g<e;g++){if(f[g]===d.language){c=d.language;break}else{if(f[g]===a){c=a;break}}}d.language=c}d.theme_advanced_resize_horizontal=false;k.init(b,d)}return k}return null};Alfresco.util.RENDERLOOPSIZE=25;(function(){Alfresco.component.Base=function n(q,s,r){this.name=(typeof q=="undefined"||q===null)?"Alfresco.component.Base":q;this.id=(typeof s=="undefined"||s===null)?Alfresco.util.generateDomId():s;this.options=Alfresco.util.deepCopy(this.options);this.widgets={};this.modules={};this.services={};Alfresco.util.ComponentManager.register(this);if(YAHOO.lang.isArray(r)){Alfresco.util.YUILoaderHelper.require(r,this.onComponentsLoaded,this)}else{this.onComponentsLoaded()}return this};Alfresco.component.Base.prototype={options:{},widgets:null,modules:null,services:null,setOptions:function k(q){this.options=YAHOO.lang.merge(this.options,q);return this},setMessages:function g(q){Alfresco.util.addMessages(q,this.name);return this},onComponentsLoaded:function l(){if(this.id!=="null"){YUIEvent.onContentReady(this.id,this.onReadyWrapper,this,true)}},destroy:function o(){var r,q;for(r in this.widgets){if(this.widgets.hasOwnProperty(r)){try{q=this.widgets[r];if(typeof q.destroy=="function"){q.destroy()}}catch(s){}delete this.widgets[r]}}for(r in this.modules){if(this.modules.hasOwnProperty(r)){delete this.modules[r]}}for(r in this.services){if(this.services.hasOwnProperty(r)){delete this.services[r]}}},onReadyWrapper:function m(){if(this.onReady&&this.onReady.call){this.onReady.call(this)}this.createYUIButtons();this.attachLinkClickListeners()},createYUIButtons:function a(){var u=YUISelector.query("button.alfresco-button",this.id),t,w,r,v;for(var s=0,q=u.length;s<q;s++){t=u[s];r=t.getAttribute("name");if(r){w=Alfresco.util.createYUIButton(this,null,function(A,x){var y=A,z=x;return function(){this.invokeAction(y,z,this.widgets[y])}}(r,t.getAttribute("value")),{},u[s]);YAHOO.util.Dom.addClass(w.get("element"),r.substring(1));this.widgets[r.substring(1)]=w}}},attachLinkClickListeners:function b(){var r=function q(w,v){var u=v[1].anchor,t=u.getAttribute("name")||u.name,s=u.getAttribute("rel");if(this.invokeAction(t,s,u)){YUIEvent.preventDefault(v[1])}return true};YAHOO.Bubbling.addDefaultAction(this.id,this.bind(r),true)},invokeAction:function d(t,s,q){var u=t.match(/^\.[\w]+$/)?t.substring(1):null,r=t.match(/^\@[\w]+$/)?t.substring(1):null;if(YAHOO.lang.isFunction(this[u])){this[u].call(this,s,q);return true}else{if(r){this.fire(r,s);return true}}},msg:function h(q){return Alfresco.util.message.call(this,q,this.name,Array.prototype.slice.call(arguments).slice(1))},bind:function p(q){return Alfresco.util.bind(q,this)},fire:function f(q,r){r.eventGroup=this;YAHOO.Bubbling.fire(q,r)},refresh:function e(r){var q=Alfresco.util.combinePaths(Alfresco.constants.URL_SERVICECONTEXT,YAHOO.lang.substitute(r,this.options,function(t,u,s){return typeof u==="boolean"?u.toString():u}));q+=(q.indexOf("?")==-1?"?":"&")+"htmlid="+this.id;Alfresco.util.Ajax.request({url:q,successCallback:{fn:this.onComponentLoaded,obj:this,scope:this},scope:this})},onComponentLoaded:function c(r){var q=Alfresco.util.Ajax.sanitizeMarkup(r.serverResponse.responseText);YAHOO.util.Dom.get(this.id).innerHTML=q[0];Alfresco.util.ComponentManager.unregister(this);window.setTimeout(q[1],0)}}})();(function(){Alfresco.component.BaseFilter=function(g,k,h){Alfresco.component.BaseFilter.superclass.constructor.apply(this,arguments);this.filterName=this.name.substring(this.name.lastIndexOf(".")+1);this.controlsDeactivated=false;this.uniqueEventKey=Alfresco.util.generateDomId(null,"filter");this.SELECTED_CLASS="selected";YAHOO.Bubbling.on("filterChanged",this.onFilterChanged,this);YAHOO.Bubbling.on("deactivateAllControls",this.onDeactivateAllControls,this);YAHOO.Bubbling.on("hideFilter",this.onHideFilter,this);return this};YAHOO.extend(Alfresco.component.BaseFilter,Alfresco.component.Base,{filterName:null,selectedFilter:null,controlsDeactivated:null,uniqueEventKey:null,SELECTED_CLASS:"selected",DISABLED_CLASS:"disabled",setSelectedClass:function d(g){this.SELECTED_CLASS=g},setDisabledClass:function d(g){this.DISABLED_CLASS=g},setFilterIds:function c(g){Alfresco.util.FilterManager.register(this.name,g)},onReady:function b(){var m=this,n=YUISelector.query("h2",this.id);if(YAHOO.lang.isArray(n)){Alfresco.util.createTwister(n[0],this.filterName)}var k=YUISelector.query("li a",this.id);for(var g=0,h=k.length;g<h;g++){YUIDom.addClass(k[g],this.uniqueEventKey)}YAHOO.Bubbling.addDefaultAction(this.uniqueEventKey,function l(t,v){var s=v[1].anchor,p=YAHOO.Bubbling.getOwnerByTagName(s,"span");if((p!==null)&&!m.controlsDeactivated){var o=s.getAttribute("href",2);if(YAHOO.env.ua.ie>0&&YAHOO.env.ua.ie<8){var u=o.length-1;if(u<0||o.lastIndexOf("#")!=u){return false}}else{if(s.getAttribute("href",2).length>1){return false}}var q=p.className,w=s.rel,r={filterOwner:m.name,filterId:q};if(Alfresco.util.isValueSet(w)){r.filterData=w}YAHOO.Bubbling.fire("changeFilter",r);if(typeof m[q]=="function"){m[q].call(m)}v[1].stop=true}return true})},onHideFilter:function(){var k=YUISelector.query("a",this.id);for(var g=0,h=k.length;g<h;g++){YUIDom.addClass(k[g],"hidden")}},onFilterChanged:function f(k,g){var n=Alfresco.util.cleanBubblingObject(g[1]),o=false;if((n!==null)&&(n.filterId!==null)){n.filterOwner=n.filterOwner||Alfresco.util.FilterManager.getOwner(n.filterId);if(n.filterOwner==this.name){if(this.selectedFilter!==null){YUIDom.removeClass(this.selectedFilter,this.SELECTED_CLASS)}var m=YUISelector.query("."+n.filterId,this.id);if(m.length==1){this.selectedFilter=m[0].parentNode;YUIDom.addClass(this.selectedFilter,this.SELECTED_CLASS);o=true}else{if(m.length>1){if(n.filterData.indexOf("]")!==-1||n.filterData.indexOf(",")!==-1){for(var h=0,l=m.length;h<l;h++){if(m[h].firstChild.rel==n.filterData){this.selectedFilter=m[h].parentNode;YUIDom.addClass(this.selectedFilter,this.SELECTED_CLASS);o=true}}}else{m=YUISelector.query('a[rel="'+n.filterData.replace("'","'")+'"]',this.id);if(m.length==1){this.selectedFilter=m[0].parentNode.parentNode;YUIDom.addClass(this.selectedFilter,this.SELECTED_CLASS);o=true}}}}if(!o){this.handleFilterIdNotFound(n)}}else{if(this.selectedFilter!==null){YUIDom.removeClass(this.selectedFilter,this.SELECTED_CLASS)}}}},handleFilterIdNotFound:function a(g){},onDeactivateAllControls:function e(k,g){this.controlsDeactivated=true;var m=YUISelector.query("a."+this.uniqueEventKey,this.id);for(var h=0,l=m.length;h<l;h++){YUIDom.addClass(m[h],this.DISABLED_CLASS)}}})})();(function(){var e=YAHOO.util.Dom;Alfresco.component.FormManager=function h(o,p){Alfresco.component.FormManager.superclass.constructor.call(this,"Alfresco.component.FormManager",o,p);YAHOO.Bubbling.on("formContentReady",this.onFormContentReady,this);YAHOO.Bubbling.on("beforeFormRuntimeInit",this.onBeforeFormRuntimeInit,this);return this};YAHOO.extend(Alfresco.component.FormManager,Alfresco.component.Base,{options:{failureMessageKey:"message.failure",submitButtonMessageKey:"button.save",submitUrl:null,cancelUrl:null,defaultUrl:null},onReady:function l(){},onFormContentReady:function d(q,o){var p=o[1].buttons.submit;p.set("label",this.msg(this.options.submitButtonMessageKey));var r=o[1].buttons.cancel;if(r){r.addListener("click",this.onCancelButtonClick,null,this)}},onBeforeFormRuntimeInit:function g(p,o){o[1].runtime.setAJAXSubmit(true,{successCallback:{fn:this.onFormSubmitSuccess,scope:this},failureCallback:{fn:this.onFormSubmitFailure,scope:this}})},onFormSubmitSuccess:function b(o){this.navigateForward(true)},onFormSubmitFailure:function c(o){var q=null;if(o.json&&o.json.message&&o.json.message.indexOf("Failed to persist field 'prop_cm_name'")!==-1){q=this.msg("message.details.failure.name")}else{if(o.json&&o.json.message&&o.json.message.indexOf("PropertyValueSizeIsMoreMaxLengthException")!==-1){q=this.msg("message.details.failure.more.max.length")}else{if(o.json&&o.json.message&&o.json.message.indexOf("org.alfresco.error.AlfrescoRuntimeException")==0){var p=o.json.message.split(/(?:org.alfresco.error.AlfrescoRuntimeException:\s*\d*\s*)/ig);if(p&&p[1]){q=p[1]}}}}Alfresco.util.PopupManager.displayPrompt({title:this.msg(this.options.failureMessageKey),text:q?q:(o.json&&o.json.message?o.json.message:this.msg("message.details.failure"))})},onCancelButtonClick:function f(p,o){this.navigateForward(false)},pageUsesAjaxState:function k(o){return false},isCromeRedirectToTheSamePage:function m(o){return false},getSiteDefaultUrl:function n(){return null},navigateForward:function a(o){if(o&&this.options.submitUrl){document.location.href=this.options.submitUrl}else{if(!o&&this.options.cancelUrl){document.location.href=this.options.cancelUrl}else{if(document.referrer){if(this.pageUsesAjaxState(document.referrer)){history.go(-1)}else{if(history.state&&history.state.previous_url&&this.isCromeRedirectToTheSamePage(document.referrer)){document.location.href=history.state.previous_url}else{if(document.location.href==document.referrer){if(this.options.defaultUrl){document.location.href=this.options.defaultUrl}else{document.location.href=this.getSiteDefaultUrl()||Alfresco.constants.URL_CONTEXT}}else{document.location.href=document.referrer}}}}else{if(history.length>1){history.go(-1)}else{if(this.options.defaultUrl){document.location.href=this.options.defaultUrl}else{document.location.href=this.getSiteDefaultUrl()||Alfresco.constants.URL_CONTEXT}}}}}}})})();(function(){var f=YAHOO.util.Dom,q=YAHOO.util.Event;Alfresco.util.DataTable=function(s){if(!s.dataSource||!YAHOO.lang.isString(s.dataSource.url)||!s.dataTable.container||!YAHOO.lang.isArray(s.dataTable.columnDefinitions)){throw new Error("Mandatory config parameter is missing or of wrong type!")}s.dataSource.pagingResolver=s.dataSource.pagingResolver||this._defaultPagingResolver;s.dataSource.defaultFilter=s.dataSource.defaultFilter||null;s.dataSource.config=s.dataSource.config||{};s.dataSource.config.connXhrMode=s.dataSource.config.connXhrMode||"cancelStaleRequests";s.dataSource.config.responseType=s.dataSource.config.responseType||YAHOO.util.DataSource.TYPE_JSON;s.dataSource.config.responseSchema=s.dataSource.config.responseSchema||{};if(!YAHOO.lang.isString(s.dataSource.config.responseSchema.resultsList)){s.dataSource.config.responseSchema.resultsList="data"}s.dataSource.config.responseSchema.fields=s.dataSource.config.responseSchema.fields||null;s.dataSource.config.responseSchema.metaFields=YAHOO.lang.merge({paginationRecordOffset:"paging.skipCount",paginationRowsPerPage:"paging.maxItems",totalRecords:"paging.totalItems"},s.dataSource.config.responseSchema.metaFields||{});s.dataTable.config=YAHOO.lang.merge({dynamicData:true,initialLoad:false,MSG_EMPTY:Alfresco.util.message("message.datatable.empty"),MSG_ERROR:Alfresco.util.message("message.datatable.error"),MSG_LOADING:Alfresco.util.message("message.datatable.loading"),className:"alfresco-datatable"},s.dataTable.config||{});if(s.paginator){s.paginator.history=YAHOO.lang.isBoolean(s.paginator.history)?s.paginator.history:true;s.paginator.hide=YAHOO.lang.isBoolean(s.paginator.hide)?s.paginator.hide:true;s.paginator.config=YAHOO.lang.merge({rowsPerPage:10,recordOffset:0,template:Alfresco.util.message("pagination.template"),pageReportTemplate:Alfresco.util.message("pagination.template.page-report"),previousPageLinkLabel:Alfresco.util.message("pagination.previousPageLinkLabel"),nextPageLinkLabel:Alfresco.util.message("pagination.nextPageLinkLabel")},s.paginator.config||{});if(!s.paginator.config.containers){throw new Error("Mandatory paginator config parameter is missing!")}}this.config=s;this.formatters={};this.widgets={};this._init();return this};Alfresco.util.DataTable.prototype={config:null,widgets:null,formatters:null,currentFilter:{},currentSkipCount:null,currentMaxItems:null,currentSortKey:null,currentDir:null,getRecord:function g(s){return this.widgets.dataTable.getRecord(s)},getData:function a(s){return this.getRecord(s).getData()},getDataTable:function n(){return this.widgets.dataTable},findDataByParameter:function d(u,t){var s=this.findRecordByParameter(u,t);if(s!==null){return s.getData()}return null},findRecordByParameter:function l(x,w){var u=this.widgets.dataTable.getRecordSet(),v,t,s;for(t=0,s=u.getLength();t<s;t++){record=u.getRecord(t);if(record.getData(x)===w){return record}}return null},reloadDataTable:function m(){this.loadDataTable()},loadDataTable:function c(w){var v=this,x=this.createUrlParameters(),t=(this.config.dataSource.url+x).indexOf("?")>-1?"&":"?",u=x+(w?t+w:"");this.widgets.dataSource.sendRequest(u,{success:function s(A,z,B){v.lastResultCount=z.results.length;v.widgets.dataTable.onDataReturnSetRows(A,z,B);var y=v.currentFilter;if(!y.filterId){y=v.config.dataSource.defaultFilter}if(y&&y.filterId){YAHOO.Bubbling.fire("filterChanged",y)}},failure:this.widgets.dataTable.onDataReturnSetRows,scope:this.widgets.dataTable,argument:{}})},createUrlParameters:function k(){if(this.widgets.paginator){var t=null;if((this.currentSkipCount||this.currentMaxItems||this.currentSortKey||this.currentDir)&&YAHOO.lang.isFunction(this.config.dataSource.pagingResolver)){t=this.config.dataSource.pagingResolver(this.currentSkipCount,this.currentMaxItems,this.currentSortKey,this.currentDir)}}var s=null;if(this.currentFilter&&YAHOO.lang.isFunction(this.config.dataSource.filterResolver)){s=this.config.dataSource.filterResolver(this.currentFilter)}var u=["?","&"];if(this.config.dataSource.url.indexOf("?")>-1){u=["&","&"]}return(t?u.shift()+t:"")+(s?u.shift()+s:"")},_init:function p(){var N=this,x=YAHOO.util.History;this.widgets.dataSource=new YAHOO.util.DataSource(this.config.dataSource.url,this.config.dataSource.config);this.widgets.dataSource.doBeforeParseData=this.config.dataSource.doBeforeParseData||this.widgets.dataSource.doBeforeParseData;if(this.config.paginator){this.widgets.paginator=new YAHOO.widget.Paginator(this.config.paginator.config);this.config.dataTable.config.paginator=this.widgets.paginator}var K=this.config.dataTable.columnDefinitions;for(var J=0,D=K.length;J<D;J++){if(YAHOO.lang.isFunction(K[J].formatter)){this.formatters[J]=K[J].formatter;K[J].formatter=function(O,P,Q,R){if(Q.width){YAHOO.util.Dom.setStyle(O,"width",Q.width+(YAHOO.lang.isNumber(Q.width)?"px":""));YAHOO.util.Dom.setStyle(O.parentNode,"width",Q.width+(YAHOO.lang.isNumber(Q.width)?"px":""))}N.formatters[Q.getIndex()].call(this,O,P,Q,R)}}}var t=(f.get(this.config.dataTable.container).getAttribute("class")||"").split(/\s/);this.widgets.dataTable=new YAHOO.widget.DataTable(this.config.dataTable.container,K,this.widgets.dataSource,this.config.dataTable.config);this.widgets.dataTable.showTableMessage(this.config.dataTable.config.MSG_LOADING,YAHOO.widget.DataTable.CLASS_LOADING);for(J=0,D=t.length;J<D;J++){f.addClass(this.widgets.dataTable.get("element"),t[J])}this.widgets.dataTable._deleteTrEl=function A(R){var P=this,Q=this.getTrEl(R);var O=new YAHOO.util.ColorAnim(Q,{opacity:{to:0}},0.25);O.onComplete.subscribe(function(){YAHOO.widget.DataTable.prototype._deleteTrEl.call(P,R)});O.animate()};this.widgets.dataTable.subscribe("rowMouseoverEvent",this.widgets.dataTable.onEventHighlightRow);this.widgets.dataTable.subscribe("rowMouseoutEvent",this.widgets.dataTable.onEventUnhighlightRow);var w=function z(){if(N.currentFilter.filterId){N.loadDataTable()}else{if(N.config.dataSource.defaultFilter){N.currentFilter=N.config.dataSource.defaultFilter;N.loadDataTable()}else{if(YAHOO.lang.isString(N.config.dataSource.initialParameters)){N.loadDataTable(N.config.dataSource.initialParameters)}else{N.loadDataTable()}}}};var G=function E(P){if(N.config.paginator&&N.config.paginator.history){var O=N.getPagingState(P.recordOffset,P.rowsPerPage);if(O){x.multiNavigate({paging:O})}}else{N.setPagingState(N.getPagingState(P.recordOffset,P.rowsPerPage));N.loadDataTable()}};if(this.widgets.paginator){this.widgets.paginator.unsubscribe("changeRequest",this.widgets.dataTable.onPaginatorChangeRequest);this.widgets.paginator.subscribe("changeRequest",G,this.widgets.dataTable,true)}this.widgets.dataTable.doBeforeLoadData=function(P,O,R){if(N.config.paginator){var Q=O.meta||{};R.totalRecords=YAHOO.lang.isNumber(Q.totalRecords)?Q.totalRecords:R.totalRecords;R.pagination={rowsPerPage:YAHOO.lang.isNumber(Q.paginationRowsPerPage)?Q.paginationRowsPerPage:N.config.paginator.config.rowsPerPage,recordOffset:YAHOO.lang.isNumber(Q.paginationRecordOffset)?Q.paginationRecordOffset:N.config.paginator.config.recordOffset};if(N.config.paginator.hide){if(R.totalRecords<=R.pagination.rowsPerPage){f.addClass(N.widgets.paginator.get("containers"),"hidden")}else{f.removeClass(N.widgets.paginator.get("containers"),"hidden")}}}return true};var v=function F(O){N.setPagingState(O);if(x.getBookmarkedState("filter")==null||x.getBookmarkedState("filter")==x.getCurrentState("filter")){N.loadDataTable()}};var M=function B(O){N.setFilterState(O);N.loadDataTable()};YAHOO.Bubbling.on("changeFilter",function u(P,O){if(N.config.paginator&&N.config.paginator.history){var Q=O[1]?N.getFilterState(O[1]):null;if(Q){x.multiNavigate({paging:"|",filter:Q})}}else{N.setFilterState(N.getFilterState(O[1]));N.loadDataTable()}},this);if(this.config.paginator){var s=this.config.paginator.config;if(this.config.paginator.history){x.register("paging",x.getBookmarkedState("paging")||this.getPagingState(s.recordOffset,s.rowsPerPage),v);x.register("filter",x.getBookmarkedState("filter")||this.getFilterState(this.config.dataSource.defaultFilter),M);var H=function y(){N.setPagingState(x.getCurrentState("paging"));N.setFilterState(x.getCurrentState("filter"));if(N.widgets.paginator){N.currentSkipCount=N.currentSkipCount||N.config.paginator.config.recordOffset;N.currentMaxItems=N.currentMaxItems||N.config.paginator.config.rowsPerPage}w()};x.onReady(H,{},this);try{var I="";if(YAHOO.env.ua.ie>0&&!f.get("yui-history-iframe")){I+='<iframe id="yui-history-iframe" src="'+Alfresco.constants.URL_RESCONTEXT+'yui/history/assets/blank.html" style="display: none;"></iframe>'}if(!f.get("yui-history-field")){I+='<input id="yui-history-field" type="hidden" />'}if(I.length>0){var C=document.createElement("div");C.innerHTML=I;document.body.appendChild(C)}x.initialize("yui-history-field","yui-history-iframe")}catch(L){Alfresco.logger.error(this.name+": Couldn't initialize HistoryManager.",L);H()}}else{this.currentSkipCount=this.currentSkipCount||s.recordOffset;this.currentMaxItems=this.currentMaxItems||s.rowsPerPage;w()}}else{w()}},_defaultPagingResolver:function h(s,t){return"skipCount="+s+"&maxItems="+t},getPagingState:function o(s,t){return YAHOO.lang.isNumber(s)?(s+(YAHOO.lang.isNumber(t)?"|"+t:"")):""},setPagingState:function e(t){var s=(t&&t.indexOf("|")>0)?t.split("|"):[];this.currentSkipCount=s.length>0?parseInt(s[0]):this.config.paginator.config.recordOffset;this.currentMaxItems=s.length>1?parseInt(s[1]):this.config.paginator.config.rowsPerPage},getFilterState:function b(s){if(s){return s.filterId?(s.filterId+(s.filterData?("|"+s.filterData):"")):""}return""},setFilterState:function r(u){var t={};if(u.indexOf("|")>0){var s=u.split("|");t.filterId=s[0];t.filterData=s.slice(1).join("|")}else{t.filterId=u.length>0?u:undefined}this.currentFilter=t||{}}}})();Alfresco.util.toggleClass=function(a,b){if(YUIDom.hasClass(a,b)){YUIDom.removeClass(a,b)}else{YUIDom.addClass(a,b)}};Alfresco.util.trim=function(b){var a=YAHOO.lang.trim(b);return a?a.replace(/(^[\s\u3000]+|[\s\u3000]+$)/g,""):a};Alfresco.util.generateThumbnailUrl=function(d,f){var a,c=d.isLink?d.linkedNode.nodeRef:d.nodeRef;if(d.properties["cm:lastThumbnailModification"]){var e=d.properties["cm:lastThumbnailModification"];for(var b=0;b<e.length;b++){if(e[b].indexOf(f)!=-1){a=Alfresco.constants.PROXY_URI+"api/node/"+c.uri+"/content/thumbnails/"+f+"?c=queue&ph=true&lastModified="+e[b];break}}}if(YAHOO.lang.isUndefined(a)||YAHOO.lang.isNull(a)){a=Alfresco.constants.PROXY_URI+"api/node/"+c.uri+"/content/thumbnails/"+f+"?c=queue&ph=true&lastModified=1"}return a};Alfresco.util.getCalendarControlConfiguration=function(){var a={strings:{month:Alfresco.util.message("calendar.widget_control_config.label_month"),year:Alfresco.util.message("calendar.widget_control_config.label_year"),submit:Alfresco.util.message("button.ok"),cancel:Alfresco.util.message("button.cancel"),invalidYear:Alfresco.util.message("calendar.widget_control_config.label_invalid_year")},monthFormat:YAHOO.widget.Calendar.SHORT,initialFocus:"year"};return a};Alfresco.util.matchAspect=function(e,d){var c=true;if(d.match&&d.match.length!=null){for(var b=0;b<d.match.length;b++){var a=d.match[b];if(!e.aspects||e.aspects.indexOf(a)==-1){c=false;break}}}else{c=false}return c};Alfresco.util.accepted=function(a){return(a=="aspect")};Alfresco.util.match=function(b,a){if(a.name=="aspect"){return Alfresco.util.matchAspect(b,a)}return false};Alfresco.util.isSuppressed=function(e,g){var f=false;if(g&&g.length!=null){for(var c=0;c<g.length;c++){var b=g[c];var d=b.filter;if(!Alfresco.util.accepted(d.name)){continue}var a=Alfresco.util.match(e,d);if(a==true){f=true;break}}}return f};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement