function FolderTree(cH,opts){var selectedFolder=false,aZ=false,tree=$(cH),observers={},O={};O={tpl:new Template('#{name}')};Object.extend(O,opts||{});var name,eventName;for(eventName in O){if(!(eventName.startsWith('on')||eventName.include('/on')))continue;name=eventName.substring(2).toLowerCase();observers[eventName]=O[eventName].bind(this);if(/^(?:click|mouseover|hover|contextmenu)$/.test(name)){tree.observe(name,observers[eventName]);}else{tree.observe('tree:'+name,observers[eventName]);}}tree.observe('click',function(event){if(event.findElement('.toggle')){showHideNode(Event.findElement(event,'li'));}else if(event.findElement('a.link')){if(event.which&&event.which>1)return;var node=Event.findElement(event,'li');cp(node);tree.fire('tree:nodeselected',{data:node.nsData,event:event});if(event.stopped){node.addClassName('tree_open').removeClassName('tree_closed');}else{showHideNode(node);}}return event.stop();});this.initTree=function(gX,fD){aZ=gX;tree.addClassName('tree_root');cp();tree.update();tree.fire('tree:populatenode');if(fD&&fD.selectNode&&this.selectNode(fD.selectNode))return;if(fD&&fD.noPopulate)return;this.eh();};this.eh=function(){if(tree.firstChild)return;cT(aZ,tree);};this.aY=function(id){var node=w(id);if(!node)return;return node.hasClassName('tree_closed');};this.isOpen=function(id){var node=w(id);if(!node)return;return node.hasClassName('tree_open');};this.showHideNode=function(id){var node=w(id);if(!node)return;showHideNode(node);};this.cp=cp;this.selectedFolderId=function(){return selectedFolder?selectedFolder.nsData.id:false;};this.aZ=function(){return aZ;};this.updateNode=function(update){var node=w(update.id);if(!node)return;P(node,update);};this.P=function(eH,node){if(O.containerOnly&& !node.container)return;var B=w(eH);if(B&&B.tagName=='LI'){var parent=B;B=parent.down('ul');}if(!B)return;P(B,node);};this.removeNode=function(id){var node=w(id);if(!node)return;if(selectedFolder&&node==selectedFolder)cp();node.remove();tree.fire('tree:removenode',{id:id});};this.refreshNode=function(id){var node=w(id);if(!node)return;var list=node.getElementsByTagName('UL')[0];if(!list)return;var fD={};if(selectedFolder&&selectedFolder.ancestors().any(function(Q){return list==Q})){fD.selectNode=selectedFolder.nsData.id;cp();}list.remove();cT(node.nsData.id,node,fD);};this.populateNode=function(dir,fD){var node=w(dir.id);if(!node)return;if(!(fD&&fD.force)&&dir.pages>1&& !(dir.container==1&&dir.page==1&& !dir.orderBy&& !dir.orderDirection&& !dir.node.last().container)){if(node.hasClassName('tree_open')){return cT(dir.id,node);}else{return;}}populateNode(node,dir);};this.selectNode=function(dir){if(this.selectedFolderId()==dir.id)return;var node=w(dir.id);if(node)return selectNode(node);cp();if(dir.path&&dir.path.reverse().any(function(elem){node=w(elem.id);if(!node)return false;cT(dir.id,node,{selectNode:dir.id,pathTo:elem.id});return true;}))return true;return false;};function w(id){if(aZ==id)return tree;return $(gn(id));};function gn(id){return cH+'-'+id;};function P(B,node){var li,ha=gn(node.id);if(B.id==ha){li=B;li.childElements().reject(function(e){return e.tagName=='UL'}).invoke('remove');$w(li.className).each(function(name){if(name=='tree_open'||name=='tree_closed')return;li.removeClassName(name);});}else{li=new Element('li',{id:ha,className:'tree_closed'});B.insert(li);}if(node.floor)li.addClassName('floor');li.nsData=node;li.showHideNode=showHideNode;li.insert({top:O.tpl.evaluate(node)});tree.fire('tree:addnode',{li:li,node:node});if(node.open&&li.hasClassName('tree_closed'))showHideNode(li);return li;};function showHideNode(node){if(!node)node=this;if(node.nsData.floor){cp(node);}else if(node.hasClassName('tree_closed')){node.addClassName('tree_open').removeClassName('tree_closed');var ul=node.getElementsByTagName('UL')[0];if(!ul)cT(node.nsData.id,node);}else{node.addClassName('tree_closed').removeClassName('tree_open');}};function cp(node){if(selectedFolder)selectedFolder.down('a').removeClassName('selected');selectedFolder=node&&node!=tree?node:false;if(!selectedFolder)return;node.down('a').addClassName('selected');};function cT(da,B,fD){var pathTo=fD&&fD.pathTo?fD.pathTo:null;var containerOnly=fD&&fD.containerOnly?fD.containerOnly:(O.containerOnly||null);new Ajax.Request('/Pages/ListDir'+(da.startsWith('/')?'':'/')+da,{onlyLatestOfClass:'folderTree-'+cH,parameters:{noPage:1,noStats:1,textContent:0,containerOnly:containerOnly,pathTo:pathTo,columns:(O.columns||null)},onSuccess:function(transport){var dir=transport.responseText.evalJSON(true);makeUrisAbsolute(dir);if(!dir.node||dir.error)return;dir.path.each(function(elem,i){if(!elem.node|| !B)return;makeUrisAbsolute(elem);var ul=populateNode(B,elem);var hm=dir.path[i+1].id;B=ul.childElements().find(function(bQ){return bQ.nsData.id==hm});});if(B)populateNode(B,dir);if(fD&&fD.selectNode&& !selectedFolder){var node=w(fD.selectNode);if(node)selectNode(node);};}});};function makeUrisAbsolute(dir){for(var i=0,len=dir.node.length;i0)return hp[0];var li=B;B=new Element('ul');li.insert(B);}tree.fire('tree:data',{'data':data,'B':B});data.node.each(function(node){if(O&&O.containerOnly&& !node.container)return;P(B,node);});return B;};function selectNode(node){cp(node);var parent=node.up('.FolderTree ul');while(parent&&parent.id!=cH){var li=parent.parentNode;li.removeClassName('tree_closed').addClassName('tree_open');li.down('a').select('img').invoke('removeClassName','tree_closed').invoke('addClassName','tree_open');parent=li.up('.FolderTree ul');}var viewport=$(cH).parentNode;dw(viewport,node,{paddingLeft:80,paddingTop:40});return true;}}; function gh(){var gf;var fi;var ft;var fh;var fn=false;var uploadStatus=false;var bM=false;var cx=new Object;var appletWaiting=false;this.load=function(fD){if(!fD)fD={};fi=fD;if(fn)return fi.onSuccess(af());if(!fh)gV(fi);Action.Dialog('/Pages/Dialog/AppletHelp/EnablingJava.htm',{width:450,minHeight:200,afterEffectShow:function(){Applet.hb();}});};this.hide=function(){bM=false;$('info_upload_applet').style.height='0px';var applet=af();if(!applet)return;if(BrowserDetect.ap=='Opera'){applet.style.visibility='hidden';}else{applet.style.height='0px';}if(!U['upload'])infoHeaderButtonDown('upload',true);av();};this.show=function(){if(uploadStatus)return;bM=true;$('info_upload_applet').style.height='140px';var applet=af();if(applet){applet.style.height='140px';applet.style.visibility='visible';}if(U['upload'])infoHeaderButtonDown('upload',true);av('upload');return false;};this.fw=function(fD){uploadStatus={ew:bM};Applet.hide();$('info_header_link_upload').update(Locale[fD.download?'downloadStatus':'uploadStatus']);if($('info_header_upload').tip)$('info_header_upload').tip.update(Locale[fD.download?'downloadStatusTip':'uploadStatusTip']);$('info_upload_progress').show();if(U['upload'])infoHeaderButtonDown('upload',true);av('upload');};this.fR=function(){if(!uploadStatus)return;$('info_upload_progress').hide();$('info_header_link_upload').update(Locale.dragDropUpload);if($('info_header_upload').tip)$('info_header_upload').tip.update(Locale.uploadOpenTip);var ew=uploadStatus.ew;uploadStatus=false;if(ew){Applet.show();}else{if(!U['upload'])infoHeaderButtonDown('upload',true);}};this.fy=function(){var applet=af();if(!applet)return;try{var fy=new String(applet.getOpenedFiles()).evalJSON();return fy.map(function(fileName){return fileName.replace(/.*\\/,'').replace(/.*\//,'');});}catch(fl){}};this.hb=function(){fn=db();if(fn===true){Action.cj();fi.onSuccess(af());return clearTimeout(gf);}else if(fn===false){fi.onFailure();return clearTimeout(gf);}else if(fn==='wait'&&appletWaiting===false){fi.onFailure();appletWaiting=true;}return gf=setTimeout("Applet.hb()",100);};this.isActive=db;this.af=af;this.bK=function(){return navigator.javaEnabled();};function af(){if(!fh)return;return document.getElementById('upload_applet');};function gV(fD){if(fh===true)return false;clearTimeout(ft);bM=fD.hidden?false:true;var height=fD.hidden&&BrowserDetect.ap!='Opera'?0:140;if(BrowserDetect.OS=='cy'){h='';h=h+'';h=h+'';h=h+'';h=h+'';}else{h='';h=h+Locale.javaRequired+'
'+Locale.getJava+'';}h=h+'';if(BrowserDetect.OS=='cy'){h=h+'';}else{h=h+'
';}$('info_upload_applet').show().setStyle({height:height}).innerHTML=h;fh=true;return true;};function db(){var applet=af();if(!applet)return null;try{var active=applet.isActive();if(active){var perm=applet.permDenied();return!perm;}else{return null}}catch(e){if(window.navigator.javaEnabled()){if(BrowserDetect.ap==='Opera'||BrowserDetect.ap==='Firefox')return null;return hasTimePassed('waiting',8000)?"wait":null;}return false;};return null;};function hasTimePassed(aF,needed){var di=cx[aF];if(di){var hv=new Date();var ms=hv.getTime()-di.getTime();if(mseV)eV=width;if(height>ez)ez=height;var Node=cwd.node[id-1];if(cwd.listView=='Thumbs'){var bgImage;if(Node.thumb)bgImage='style="background-image:url('+Node.thumb+'); background-position:center;"';H=H+'
\
\
\
\
'+Node.name+'
\
';}else{H=H+'
\
\ \
\
'+Node.name+'
\
';}});var aN=document.createElement('DIV');aN.className='drag_container';aN.innerHTML=H;aN.style.height=ez+'px';aN.style.width=eV+'px';document.body.appendChild(aN);return aN;};function dW(){if(aT)return;var tree=$('OrganiseTree');var eJ=bv(tree);var A=eJ.left;var du=tree.getWidth()+A;var co=eJ.top;var dS=tree.getHeight()+co;var i=0;aT=new Array;tree.descendants().each(function(element){if(element.tagName!='LI'||element.nsData.container!=1)return;var aQ=Position.positionedOffset(element);var aD=element.getHeight()+aQ[1];if(!((aQ[1]>=co&&aQ[1]<=dS)||(aD>=co&&aD<=dS)))return;var cz=element.getWidth()+aQ[0];if(!((aQ[0]>=A&&aQ[0]<=du)||(cz>=A&&cz<=du)||(aQ[0]<=A&&cz>=du)))return;aT[i]=element;i++;});aT.reverse();}}; function ej(){var targets=new Array;var l=false;var D=false;var G=false;var fL=false;var dG='';var fs=false;var fr=false;var aV=false;var hy=false;this.Play=function(){ar(this,'Play',arguments)};this.View=function(){ar(this,'View',arguments)};this.Open=function(){ar(this,'Open',arguments)};this.DownloadMulti=function(){ar(this,'DownloadMulti',arguments)};this.Delete=function(){ar(this,'Delete',arguments)};this.Rename=function(){ar(this,'Rename',arguments)};this.MoveCopy=function(){ar(this,'MoveCopy',arguments)};this.newFolder=function(){ar(this,'newFolder',arguments)};this.Recycle=function(){ar(this,'Recycle',arguments)};this.cj=cj;this.bN=bN;this.setSizes=setSizes;this.API=C;this.close=function(eO){cj(eO);};Event.observe(window,'resize',setSizes);this.sizeDialog=function(){D=false;G=false;setSizes();};Event.observe(document,'keydown',function(event){var unallowedKeys={191:'/',220:'\\',188:'<',190:'>',50:'@',51:'#',52:'$',53:'%',54:'^',55:'&',56:'*',57:'(',48:')',186:':'},el=event.element();if(event.shiftKey&&el.tagName==='INPUT'&&el.hasAttribute('unallowedKeys')&&event.keyCode in unallowedKeys){var unallowed='';$H(unallowedKeys).each(function(x){unallowed+=x.value});new Tip(el,{position:'top',tip_content:new Template(Locale['unallowedKeysTip']).evaluate({'unallowed':unallowed}),loadShown:true,destroy:true});}if(event.keyCode!=46&&event.keyCode!=113)return;if(l)return;if(!Selection.aA)return;var fI=Menu.actionsFor({targets:Selection.selectedIds()}).pluck('id');if(event.keyCode==46){if(event.shiftKey!==true&&fI.include('recycle'))Action.Recycle();else if(fI.include('erase'))Action.Delete();}if(event.keyCode==113&&fI.include('rename'))Action.Rename();});this.cV=function(event){var nodeId=event.element().nodeId||event.element().up('.node').readAttribute('nodeId');var actions=Menu.buildActions(Menu.actionsFor({targets:[nodeId]}),[nodeId]);var action=actions.find(function(a){return a.dflt});if(action)eval(action.code);};function ar(obj,action,bT){fC(bT);var eC='do'+action;return obj[eC](bT[2]);};function fC(bT){var id=bT[0];var name=bT[1];targets=new Array;if(id){targets[0]={id:id,name:name};}else{targets=Selection.aW();}};this.doView=function(){var params={orderBy:cwd.orderBy,orderDirection:cwd.orderDirection,page:cwd.page,fileClass:['Image','Video'],id:targets.collect(function(t){return t.id})};if(targets.length==1&&targets[0].id!=cwd.id){params.id=cwd.id;params.startId=targets[0].id;}var url='/Pages/MediaPlayer?'+Object.toQueryString(params);var height=window.screen.height-(25*window.screen.height/100);if(height>1024)height=1024;var width=height*(4/3);popupWindow('View',height,width,false,url);};this.doPlay=function(){var height=204,len=targets.length;var params={orderBy:cwd.orderBy,orderDirection:cwd.orderDirection,page:cwd.page,fileClass:'Audio',id:targets.collect(function(t){return t.id})};if(len==1&&targets[0].id!=cwd.id){params.id=cwd.id;params.startId=targets[0].id;}var url='/Pages/MediaPlayer?'+Object.toQueryString(params);if(len>1&&len<=8)height=60*targets.length+24;popupWindow('Play',height,400,false,url);};this.doOpen=function(){Applet.load({hidden:true,onSuccess:function(applet){if(applet)applet.editFile(rootURL+'O/'+targets[0].id);},onFailure:function(){Action.Dialog('/Pages/Dialog/AppletHelp/FailedToLoadJava.htm',{width:450});}});return false;};this.detailsTreeInit=function(fD){if(fD.loadingMessage)fD.loadingMessage.show();var sharing=new FolderTree($(fD.elem),{tpl:new Template('#{name}#{desc}
'),onAddNode:function(x){var li=x.memo.li,cR={targets:[li],menu:'sharing',require:true},span=li.down('span.s-actions');if(li.nsData.thumb){var thumb=li.nsData.thumb.replace('/94/94/0/','/31/31/1/');li.down('span.s-avatar').setStyle({backgroundImage:'url('+thumb+')'});}Menu.buildActions(Menu.actionsFor(cR),cR.targets).each(function(action){span.insert(new Element('a',{className:'action'}).update(action.label).observe('click',function(event){event.stop();eval(action.code);}));});if(fD.emptyMessage)fD.emptyMessage.hide();if(fD.nonEmptyMessage)fD.nonEmptyMessage.show();$(fD.elem).show();},onData:function(data){if(fD.loadingMessage)fD.loadingMessage.hide();if(!$(fD.elem).firstChild){if(fD.nonEmptyMessage)fD.nonEmptyMessage.hide();if(fD.emptyMessage)fD.emptyMessage.show();}},onRemoveNode:function(id){if(!$(fD.elem).firstChild){if(fD.nonEmptyMessage)fD.nonEmptyMessage.hide();if(fD.emptyMessage)fD.emptyMessage.show();}if($('shared-with-title-shared')&& !$('shared-list').firstChild){$('shared-with-title-shared').hide();fD.nonEmptyMessage.hide();fD.emptyMessage.hide();$('shared-list').hide();}}});if(fD.data){sharing.initTree(fD.nsId,{noPopulate:true});sharing.populateNode(fD.data);}else{sharing.initTree(fD.nsId);}Listing.addListener(sharing);Selection.onChange(function(){Listing.removeListener(sharing);});return sharing;};this.AutocompleterInit=function(fD){if(fD.idIn)fD.input.observe('change',function(e){fD.idIn.value=''});fD.input.observe('focus',function(){fD.input.clear();});new Ajax.Autocompleter(fD.input,fD.choices,'/Pages/AutoComplete?validate=1',{paramName:'recipient',updateElement:function(selection){var children=selection.descendants();if(!children[0])return;var value=children[0].innerHTML;if(children[1])var value=value+' <'+children[1].innerHTML+'>';fD.input.setValue(value);if(selection.id&&fD.idIn)fD.idIn.value=selection.id;if(fD.afterUpdateElement)fD.afterUpdateElement();},onSuccess:fD.onSuccess});};this.quickCreateInit=function(fD){var input=fD.input;Action.AutocompleterInit({input:input,choices:fD.choices,idIn:fD.idIn,afterUpdateElement:fD.afterUpdateElement,onSuccess:fD.onSuccess});fD.form.observe('submit',function(e){var form=this;if(fD.onSubmit)fD.onSubmit(form);Action.Create(e,{form:form,loadMessage:fD.loadMessage});});};this.doDownloadMulti=function(){Applet.load({hidden:true,onSuccess:function(applet){Menu.hide();var ids=L(targets).join(',');if(applet.downloadMultipleFiles(ids)==0)Upload.start({advanced:true,download:true});},onFailure:function(){Action.Dialog('/Pages/Dialog/AppletHelp/FailedToLoadJava.htm',{width:450});}});};this.DialogAction=function(fD){var Address=fD.page;if(!fD.width)fD.width=400;if(typeof(fD.target)!='undefined'){fC([fD.target]);for(var i=0,len=targets.length;i1?fD.confirm.message.plural:fD.confirm.message.singular:fD.confirm.message;var temp=new Template(message);if(fD.confirm.title)$('Delete_title').update(fD.confirm.title).show();SetMessage(temp.evaluate({items:targets.length,name:targets[0].name,noun:noun}),0,'message_Delete');bN('Delete',{width:370,onComplete:function(){var x=$('delete_node_text');x.select();x.focus();},onClose:function(){$("popup_Delete_form").stopObserving("submit");}});$('popup_Delete_form').observe('submit',function(event){event.stop();fD.confirm=false;fD.ak='Delete';fD.onSuccess=function(){cj(true);$('popup_Delete_form').stopObserving('submit');};Action.doDelete(fD);return false;});return false;}var loadMessage=fD&&fD.loadMessage?fD.loadMessage:Locale['actionsPopupDelete'];C({type:'Delete',ak:fD?fD.ak:'',loadMessage:loadMessage,parameters:{id:fD.id?fD.id:L(targets)},onSuccess:fD?fD.onSuccess:''});};this.doRename=function(aS){var en=$('rename_input'),eW=new Element('span').insert(targets[0].name.stripTags());if(!aS){SetMessage(Locale['actionsMessageRename'],0,'message_Rename');en.value=eW.innerHTML;bN('Rename',{width:370,onComplete:function(){en.select();en.focus();}});return;}var bb=en.value;if(!bb)return SetMessage(Locale['actionsMessageRenameNoName'],1,'message_Rename');if(targets[0].name==bb)return cj();C({type:'Update',ak:'Rename',loadMessage:Locale['actionsPopupRename'],parameters:{id:targets[0].id,name:bb},onSuccess:function(){cj()}});};this.doRecycle=function(bT){var t=new Template(Locale['actionsMessagesRecycleSingle']);var selected=Selection.selectedIds().first()-1,noun=cwd.node[selected].noun;this.Update(targets.pluck('id'),{parameters:{recycle:true},loadMessage:Locale['actionsPopupRecycle'],confirm:{icon:'/Assets/Default/Images/Icons/Large/RecycleBin.gif',message:{plural:{description:Locale['actionsMessagesRecycleMultiple']},singular:{description:t.evaluate({'name':targets[0].name,'noun':noun})}}}});};this.Update=function(id,fD){if(id&&typeof id==='string'){fD.parameters.id=id.split(',');}else if(id&&typeof id==='object'){fD.parameters.id=id;}else{fD.parameters.id=Selection.aW().pluck('id');}if(typeof fD.confirm==='object'){if(fD.confirm.icon)$('Confirm_icon').src=fD.confirm.icon?fD.confirm.icon:'/Assets/Default/Images/Icons/Large/NotFound.gif';var mesg=fD.parameters.id.length>1?fD.confirm.message.plural.description:fD.confirm.message.singular.description;SetMessage(mesg,false,'message_Confirm');$('popup_Confirm_form').observe('submit',function(event){event.stop();fD.confirm=true;fD.ak='Confirm';fD.onSuccess=function(){cj(true);$('popup_Confirm_form').stopObserving('submit');};Action.Update(id,fD);});bN('Confirm',{width:fD.confirm.width?fD.confirm.width:370,onComplete:function(){var x=$('popupConfirm_text');x.select();x.focus();},onClose:function(){$("popup_Confirm_form").stopObserving("submit");}});}else{fD.type=fD.type?fD.type:'Update';C(fD);}};this.Create=function(event,fD){event.stop();if(!fD)fD={};if(!fD.form)fD.form=this;C({type:'Create',parameters:fD.form.serialize(),ak:fD?fD.ak:'',loadMessage:fD.loadMessage,onSuccess:function(response){fD.form.reset();$('BodyContainer').focus();}});};this.hx=function(fD){var temp=new Template(Locale['actionsMessageConflict']);SetMessage(temp.evaluate(fD.conflictDst),0,'message_Conflict');temp=new Template(Locale['actionsMessageConflictFile']);var hA=fD.conflictDst.icon?' ':'';$('ConflictDstFile').update(hA+temp.evaluate(fD.conflictDst));if(fD.conflictSrc){var fx=fD.conflictDst.icon?' ':'';$('ConflictSrcFile').update(fx+temp.evaluate(fD.conflictSrc));}[$('ConflictSrcIntro'),$('ConflictSrcRow')].invoke(fD.conflictSrc?'show':'hide');var rename=$('Conflict_rename_text');fD.onRename?rename.show():rename.hide();hy=fD;bN('Conflict',{width:405,onClose:fD.onCancel});};this.conflictResponse=function(response){aV=false;cj(true);hy['on'+response]({doForAll:$('ConflictDoForAll').checked?1:0});};this.doMoveCopy=function(fD){var action=fD.action;var messageKey=fD.available?fD.available.join(''):action;var destination=fD.destination;if(!action){var aF='actionsMessage'+messageKey+(targets.length>1?'Multiple':'Single');var temp=new Template(Locale[aF]);SetMessage(temp.evaluate({items:targets.length,name:targets[0].name}),0,'message_MoveCopy');fD.available.include('Move')?$('button_MoveCopy_Move_text').show():$('button_MoveCopy_Move_text').hide();fD.available.include('Copy')?$('button_MoveCopy_Copy_text').show():$('button_MoveCopy_Copy_text').hide();CopyMoveTree.eh();bN('MoveCopy',{width:300});return;}if(!destination)return fO({'fP':'MoveCopy',message:Locale['actionsMessage'+messageKey+'NoFolder']});var param;if(fD.hu){param=fL;param.conflictAction=fD.hu;param.doForAll=fD.doForAll;}else{fL=false;param={source:L(targets),destination:destination};}var dK=l;if(l.id!='popup_MoveCopy'&&l.id!='popup_Conflict')dK=$('BodyContainer');Loading.show({obj:dK,label:Locale['actionsPopup'+action]});new Ajax.Request('/Pages/API?action='+action,{onlyLatestOfClass:'fileActions',parameters:param,onSuccess:function(transport){var ao=transport.responseText.evalJSON(true);if(ao.Status=='OK'){fM(destination,ao.moved);cj();}else{if(ao.Message=='RESUME_REQUIRED'){fL=ao.resumeData;if(ao.moved)fM(destination,ao.moved);Action.hx({conflictSrc:ao.conflictSrc,conflictDst:ao.conflictDst,onReplace:function(fD){Action.doMoveCopy({action:action,destination:destination,hu:"overwrite",doForAll:fD.doForAll});},onSkip:function(fD){Action.doMoveCopy({action:action,destination:destination,hu:"keep",doForAll:fD.doForAll});}});}else{fO({'fP':'MoveCopy','message':ao.Message,'error':ao.Code});}}},onFailure:function(response){fO({'fP':'MoveCopy','message':d(response,{j:Locale.requestError})});},onComplete:function(){Loading.hide();}});};function fM(destination,targets){if(cwd.id==destination)refreshDir();CopyMoveTree.refreshNode(destination);navTree.refreshNode(destination);targets.each(function(node){Listing.removeNode(node);});};this.donewFolder=function(aS){if(!aS){SetMessage(Locale['actionsMessageNewFolder'],0,'message_NewFolder');bN('NewFolder',{width:370,onComplete:function(){$('newFolder_input').select();$('newFolder_input').focus();}});return;}var Folder=$('newFolder_input').value;if(!Folder)return SetMessage(Locale['actionsMessageNewFolderNoName'],1,'message_NewFolder');C({type:'Create',ak:'NewFolder',loadMessage:Locale['actionsPopupNewFolder'],parameters:{parent:targets[0].id,name:Folder},onSuccess:function(){cj()}});};this.Dialog=function(Address,cr){if(!cr)cr={};var aj=(Address.split('?'))[0]==(dG.split('?'))[0];var eZ=aj&&cr.restore;var popped=false;if(!l||l.id!='popup_Dialog'){if(!eZ)$('DialogContent').innerHTML='';aj=false;popped=true;bN('Dialog',{width:cr.width||null,height:cr.height||null,onComplete:function(){if(!$('DialogContent').innerHTML.empty())return;Loading.show({obj:$('popup_Dialog'),bx:$('DialogContent'),label:cr.loadMessage});new Tips('#DialogContent *[title]',{position:'top'});},afterEffectShow:cr.afterEffectShow||null,onClose:cr.onClose||null});}else if(!eZ){var popup=$('popup_Dialog');if(cr.width)popup.style.width=cr.width+'px';Loading.show({obj:popup,bx:$('DialogContent'),label:cr.loadMessage});if(aV)aV();aV=cr.onClose;}D=cr.minHeight?cr.minHeight:false;G=cr.maxHeight?cr.maxHeight:false;if(eZ){if(cr.onComplete)cr.onComplete();return;}var bp;if(cr.form)bp=Form.serialize(cr.form);dG=Address;new Ajax.Updater({success:'DialogContent'},Address,{onlyLatestOfClass:'dialog',evalScripts:true,parameters:bp,onComplete:function(response){if(!aj){setSizes();var images=$('DialogContent').select('img');images.invoke('observe','load',function(event){if(images.any(function(i){return!i.complete}))return;setSizes();});}Loading.hide();if(response.request.success()){if(cr.onComplete)cr.onComplete();new Tips('#DialogContent *[title]',{position:'top'});}else{fO({'message':d(response,{j:Locale.requestError})});}if(cr.afterEffectShow&&popped!==true)cr.afterEffectShow();}});return false;};function r(fD){fD.width=fD.width||'350';SetMessage(fD.message,0,'message_Info');$('Info_detail').innerHTML=fD.fq||'';if(fD.title){$('Info_title').show().innerHTML=fD.title;}else{$('Info_title').hide();}bN('Info',fD);};this.r=r;function C(Request){if(Request.loadMessage)Loading.show({obj:l.id==('popup_'+Request.ak)?l:$('BodyContainer'),label:Request.loadMessage});new Ajax.Request('/Pages/API?action='+Request.type,{onlyLatestOfClass:'fileActions',parameters:Request.parameters,onSuccess:function(transport){var ao=transport.responseText.evalJSON(true),fD={};Loading.hide();if(ao.Status=='OK'){Listing.update(ao);if(Request.onSuccess)Request.onSuccess(ao);}else{fD.message=ao.Message;fD.error=ao.Code||1;fO(fD);}},onFailure:function(response){var fD={};fD.error='CONNECTION_TIMEOUT';fD.message=d(response,{j:Locale.requestError});fO(fD);}});};this.fO=fO;function fO(fD){var fD=fD||{},fP=fD.fP;if(fD.error&&(fD.error==='ACCOUNT_SUSPENDED'||fD.error==='CONNECTION_TIMEOUT')){if(fD.error==='ACCOUNT_SUSPENDED'){return Action.DialogAction({page:'/Pages/Dialog/AccountSuspended.htm',width:425,maxHeight:200});}if(fD.error==='CONNECTION_TIMEOUT'){fD.onClose=refreshDir;}return r(fD);}if(fP&&l.id==('popup_'+fP)){SetMessage(fD.message,1,'message_'+fP);}else{r(fD);}};function bN(bf,cr){cj(true);Listing.nodeTipsEnabled=false;var cc='popup_'+bf;var aN=$(cc);if(cr.width)aN.style.width=cr.width+'px';D=cr.minHeight?cr.minHeight:false;G=cr.maxHeight?cr.maxHeight:false;l=aN;setSizes();if(BrowserDetect.ap=='Firefox'){aN.style.visibility='hidden';aN.show();aN.hide();aN.style.visibility='visible';}fs=new Effect.Fade('BodyContainer',{duration:0.5,to:0.3});fr=new Effect.Appear(cc,{duration:0.5,afterFinish:function(){if(cr.onComplete)cr.onComplete();if(cr.afterEffectShow)cr.afterEffectShow();}});if(cr.onClose)aV=cr.onClose;return false;};function setSizes(){var height=0;var popup=l;if(!popup)return;var gp=popup.select("div.dBody .content");$('DialogContent').setStyle({'height':'auto'});gp.invoke('setStyle',{'height':'auto'});var aI=windowSize();var height=popup.getHeight();var minHeight=D||100;if(height(aI.height-50))height=aI.height-50;if(G&&height>G)height=G;gp.invoke('setStyle',{'height':(height-51)+'px'});var y=((aI.height-popup.getHeight())/2);var x=((aI.width-popup.getWidth())/2);if(y<10)y=10;if(x<10)x=10;popup.style.top=y+'px';popup.style.left=x+'px';};function cj(eO){if(!l)return;if(aV){aV();aV=false;}if(fr)fr.cancel();if(fs)fs.cancel();if(eO){l.hide();$('BodyContainer').setOpacity(1.0);Listing.setSizes();l.select("div.dBody .content").invoke('setStyle',{'height':'auto'});}else{new Effect.Fade(l,{duration:0.5,afterFinish:function(el){Listing.setSizes();el.element.select("div.dBody .content").invoke('setStyle',{'height':'auto'});}});new Effect.Appear('BodyContainer',{duration:0.5})}Listing.nodeTipsEnabled=true;Loading.hide(true);D=false;G=false;l=false;if(window.focus)window.focus();};function L(aJ){var ba=new Array;for(var i=0,len=aJ.length;i=50){if(cv&&U['tree']&&Opened!='tree')infoHeaderButtonDown('tree',true);$('OrganiseTree').style.height=aD+'px';}};function uploadAppletCallback(es,aw,fe,ff,bH,fileIds){if(es==0){var fD={to:{id:fe.substring(1,fe.length-1),name:bH},fileIds:fileIds};if(aw==507)fD.goTo='Splash:QuotaExceeded';Upload.finish(fD);}else if(es==1){if(aw!=0){if(aw== -2&&BrowserDetect.ap=='Explorer'&&BrowserDetect.OS=='cy'){Action.Dialog('/Pages/HelpUploadUAC',{width:450});}else{Action.r({'message':Locale.actionsMessageOpenFail,fq:'Error Code: '+aw});}}}else if(es==2){refreshDir();}else if(es==3){var fD={};if(aw!=0){if(aw==402)fD.goTo='Splash:MultiDownloadUpsell';fD.error=Locale.requestError+' ('+aw+')';}if(fileIds&&fileIds[0].fileFailed.length>0)fD.fileFailed=fileIds[0].fileFailed;Upload.finish(fD);}else{alert("unrecognised callback from applet: "+es);}} ; function dO(){var by=new Object;var listViews=new Array;var dA=new Array;var eQ=null,nodeTipsEnabled=true;Event.observe(window,'resize',setSizes);document.observe('ns:update',function(e){eval("Listing.update("+e.memo+")");});this.ad=ad;this.P=P;this.setSizes=setSizes;this.ds=ds;this.addListener=function(fQ){dA.push(fQ);};this.removeListener=function(remove){dA.each(function(fQ,index){if(fQ==remove)dA.splice(index,1);});};this.update=function(data){var list=this;if(data.updated)data.updated.each(function(update){list.updateNode(update);});if(data.added)data.added.each(function(add){list.appendNode(add);});if(data.deleted)data.deleted.each(function(erase){list.removeNode(erase);});if(data.info)data.info.each(function(info){list.addInfo(info);});if(typeof(data.content)!='undefined')cwd.content=data.content;};this.hideContent=function(){this.update({content:null});this.build('List');};this.removeNode=function(id){var node=this.nodes().detect(function(node){return node.data.id==id});if(node){node.elements.invoke('setStyle',{display:'none'});cwd.node[node.index-1]=null;cwd.items--;Selection.removeNode(node.index);eQ=null;}dv().invoke('removeNode',id);};this.appendNode=function(node){var hi=node.added_to?node.added_to:[cwd.id];hi.each(function(at){if(at==cwd.id){var content=$('Content');if(content){content.remove();cwd.content=null;$('BodyTag').insert(new Element('div',{className:'clear'}));}var index=cwd.node.length;cwd.node[index]=node;Listing.P(index+1,node);cwd.items++;Selection.update();}dv().invoke('P',at,node);});};this.updateNode=function(update){if(update.id==cwd.id){goToOrRefresh(update.uri,{invisible:true});}else{var node=this.nodes().detect(function(node){return node.data.id==update.id});if(node){cwd.node[node.index-1]=update;node.elements.invoke('remove');P(node.index,update);Selection.update();}}dv().invoke('updateNode',update);};this.clear=function(hg){if($('BodyTag'))$('BodyTag').remove();if($('node_ctrl'))$('node_ctrl').remove();if($('Content'))$('Content').remove();if($('footerbar'))$('footerbar').remove();if(!hg){$('alert').addClassName('hide').update();}else{$('alert').select('.dynamic').invoke('remove');}eQ=null;};this.nodes=function(){if(eQ)return eQ;eQ=new Array;for(var i=0,len=cwd.node.length;i1){var filters=$('view_filters').removeClassName('hide');var menu=$('view_filters_menu').update();cwd.filters.each(function(filter){var a=new Element('a',{className:filter.name,href:'#'+filter.uri}).update(filter.text).observe('click',function(event){trackEvent('File Filters',event.type,filter.name,'#'+filter.uri);});if(filter.selected)a.addClassName('selected');menu.insert(a);});$('view_filters').setStyle({'width':menu.getWidth()+'px'});var text=filters.down("div.label");var icon=filters.down("div.icon");var selected=cwd.filters.find(function(filter){return filter.selected});if(selected){filters.addClassName('click');icon.writeAttribute('class','icon '+selected.name);text.update(selected.text);}else{filters.removeClassName('click');icon.writeAttribute('class','icon nofilters');text.update(Locale['fileFiltersButton']);}}else{$('view_filters').addClassName('hide');}dL();if(!cwd.content||cwd.content.blank()){eP();$('BodyTag').insert('
');}if(cwd.pages>1||cwd.listMore){if(!$('footerbar')){var footer=new Element('div',{id:'footerbar'});$('body').insert(footer);}var table=new Element('table',{id:'pagination',width:'100%',cellpadding:'0',cellspacing:'0',border:'0',className:'pagination'});var gJ=new Element('tbody');var tr=new Element('tr');var gK=new Element('td',{width:'30px'});if(cwd.page==1){gK.innerHTML='';}else{gK.innerHTML='';}var dx,gd;if(cwd.page!==cwd.pages){if(cwd.page===1){dx=1;}else{dx=(cwd.perPage*(cwd.page-1))+1;}gd=cwd.perPage*cwd.page;}else{dx=cwd.perPage*(cwd.pages-1)+1;gd=(cwd.perPage*(cwd.pages-1))+cwd.node.length;}var gR=new Element('td',{id:'page-content',align:'center'}).update(Locale['Displaying']+' '+dx+' '+Locale['to']+' '+gd+' '+Locale['of']+' '+cwd.items+' '+cwd.childNoun);var gs=new Element('td',{width:'30px',align:'right'});if(!cwd.listMore&&cwd.page==cwd.pages){gs.innerHTML='';}else{gs.innerHTML='';}tr.insert(gK).insert(gR).insert(gs);gJ.insert(tr);table.insert(gJ);$('footerbar').insert(table);new Tips('#footerbar *[title]',{position:'bottom',destroy:true});}if(cwd.parent&&cwd.parent!=0){toolBarEnable('Up',Locale['altUp']);}else{toolBarDisable('Up');}setSizes();new Tips('#BodyContainer *[title]',{position:'top'});};function ad(event){var dy=$('details_header_scroll');if(!dy)return;var eJ=$('BodyContainer').scrollLeft;if(eJ>0){dy.style.marginLeft='-'+eJ+'px';}else{dy.style.marginLeft='0px';}};function setSizes(size){var aD=document.viewport.getHeight()-1;var infoHeight=aD;if($('header'))infoHeight=infoHeight-$('header').getHeight();$('info_left').setStyle({'height':infoHeight+'px'});$('info_right').setStyle({'height':infoHeight+'px'});['header','header_navigation','details_header','footerbar','alert'].each(function(hk){var elem=$(hk);if(elem&& !elem.empty()){var elH=elem.getHeight();aD-=elH;}});if(aD<25)aD=25;$('BodyContainer').setStyle({height:aD+'px'});var as=$('BodyTag');if(as){as.setStyle({height:'auto'});$('BodyContent').setStyle({height:'100%'});var content=$('BodyContent');if(cwd.listView!='Thumbs'&&as.getHeight()';if(i==0){td+='';td+='';td+='
';if(Node.overlays){var x=Node.overlays[0];var title=Locale['overlays'][x]['title']?Locale['overlays'][x]['title']:null;td+='
';}td+='
';}td+='
'+(Node[col.param]||'')+'
';td+='';node[i]=td;});}else{var overlay='';if(Node.overlays){overlay+='
';Node.overlays.each(function(x){var title=Locale['overlays'][x]['title']?Locale['overlays'][x]['title']:null;overlay+='
';});overlay+='
';}var thumb=Node.thumb;if(thumb&&thumb.substring(0,4)!='http'){thumb=document.location.protocol+'//'+document.location.host+Node.thumb;}var node='
'+overlay+'
'+Node.name+'
';}return node;};function P(nodeId,Node){if(cwd.listView!='Thumbs'){$('BodyTag').removeClassName('empty');var aN=dY(nodeId,Node);cwd.columns.each(function(col,i){var fZ='node_'+(nodeId+1)+(i==0?'':'_'+col.param);var before=$(fZ);if(before){before.insert({before:aN[i]});}else{var hl=$('details_column_'+col.name);hl.insert(aN[i]);}});}else{aN=dY(nodeId,Node);var before=$('node_'+(nodeId+1));if(before){before.insert({before:aN});}else{$('BodyTag').down('div.clear').insert({before:aN});}}$('node_'+nodeId).nodeId=nodeId;if(Selection.bS(nodeId))Selection.aU(nodeId);eQ=null;};function dL(){eQ=null;var bC=$('BodyContainer');var BodyContent=new Element('div',{id:'BodyContent'});var bE=new Element('div',{id:'BodyTag'});bC.update().removeClassName('selection');if($('details_header'))$('details_header').remove();if($('footerbar'))$('footerbar').remove();if(!cwd.error&&cwd.columns){cwd.columns.each(function(col){if(by[col.name]){col.width=by[col.name];}});}BodyContent.observe('mousedown',Selection.bl);bC.observe('scroll',ad);bE.observe('mousedown',function(event){if(event.findElement('a.icon_context'))return event.stop();if(event.element().hasClassName('icon_select')){event.stop();Selection.fF(event);}else if(event.element().nodeId||event.element().up('div.node')){Selection.cM(event);}}).observe('mouseup',function(event){if(event.element().nodeId||event.element().up('div.node')){Selection.dm(event);}}).observe('dblclick',function(event){if(event.element().hasClassName('icon_select'))event.stop();else if(event.element().nodeId||event.element().up('div.node')){Action.cV(event);}}).observe('click',function(event){if(event.findElement('a.icon_context')){Menu.show(event);if(!event.findElement('.icon_frame_selected'))Selection.cM(event);}});if(cwd.content){BodyContent.insert(new Element('div',{id:'Content'}).update(cwd.content));if(!$('info_tasks').visible())infoHeaderButtonDown('tasks');}if(cwd.listView!='Thumbs'){bE.addClassName('empty');var dC=document.createElement('DIV');dC.id='details_header';document.body.appendChild(dC);var bF=document.createElement('DIV');bF.id='details_header_scroll';dC.appendChild(bF);if(cwd.columns){var bw=0;cwd.columns.each(function(col,i){bw+=(col.width+7);var dF=new Element('div',{id:'details_column_'+col.name,className:'details_column'});dF.style.width=col.width+'px';if(i==0)dF.addClassName('first');if(i==(cwd.columns.length-1))dF.addClassName('last');bE.appendChild(dF);var aG=document.createElement('DIV');aG.id='details_header_'+col.name;aG.ay=col.name;aG.className='details_header_column';aG.style.width=col.width+'px';if(col.orderBy){aG.onmouseover=function(){this.className='details_header_column_ro'};aG.onmouseout=function(){this.className='details_header_column'};aG.onmousedown=function(){orderBy(col.orderBy);};}var cu=document.createElement('DIV');cu.className='details_header_spacer';var Img=document.createElement('IMG');Img.src='/Assets/Default/Images/Spacer.gif';cu.appendChild(Img);Event.observe(cu,'mousedown',eg);Event.observe(cu,'dblclick',dM);aG.appendChild(cu);var bb=document.createElement('DIV');bb.className='details_header_text';var Text=document.createTextNode(col.label);bb.appendChild(Text);if(cwd.orderBy==col.orderBy&&cwd.orderDirection){var Img=document.createElement('IMG');Img.src='/Assets/Default/Images/OrderBy'+cwd.orderDirection+'.gif';bb.appendChild(Img);}aG.appendChild(bb);bF.appendChild(aG);});}bE.style.width=bw+'px';}BodyContent.appendChild(bE);BodyContent.insert('
');bC.appendChild(BodyContent);document.body.appendChild(bC);};function eg(event){Event.stop(event);document.body.style.cursor='e-resize';var obj=Event.element(event).parentNode;var column=obj.ay;obj.onMouseMove=ei;obj.onEnd=eK;obj.A=parseInt(obj.style.width);obj.dD=[$('details_column_'+column),$('BodyTag')];obj.dD.each(function(o){o.A=parseInt(o.style.width);});dT.dL(event,obj);};function ei(event,ct,cZ){var ea=Event.pointerX(event)-ct;var cz=this.A+ea;if(cz<50){ea+=(50-cz);cz=50;}by[this.ay]=cz;this.style.width=cz+'px';this.dD.each(function(o){var width=(o.A+ea);o.style.width=width+'px';});Listing.ad();};function hozScrollCheck(){if($('BodyContent').getWidth()<$('BodyTag').getWidth()){aD=$('BodyContent').getHeight()-20;$('BodyContent').setStyle({height:aD+'px'});}};function eK(event){document.body.style.cursor='';hozScrollCheck();};function dM(event){Event.stop(event);var ay=Event.element(event).parentNode.ay;var column=$('details_column_'+ay);var minWidth=50;var maxWidth=0;column.immediateDescendants().each(function(row){var cK=0;row.immediateDescendants().each(function(eN){var eG=eN.immediateDescendants();if(eG[0]){cK+=eG[0].getWidth();}else{cK+=(eN.getWidth()+6);}});if(cK>maxWidth)maxWidth=cK;});maxWidth+=10;if(maxWidthbU&&size<=aD){bU=size;bG=choices[size];}}bG=bG.replace(/INSERT_RANDOM_NUMBER_HERE/g,Math.random());bk.innerHTML=bG;});};function ds(nodeId){var node=$('node_'+nodeId);if(!node)return;var viewport=$('BodyContainer');var fD={paddingTop:node.getHeight()+10};if(cwd.listView=='Thumbs')fD.paddingLeft=node.getWidth()+10;dw(viewport,node,fD);};function dv(){return dA;}}(function(){Event.observe(document,'mouseover',mouseover);function mouseover(event){if(!Listing||Listing.nodeTipsEnabled===false)return false;var node=event.findElement('.node');if(typeof node==='object'){node.observe('mousedown',mouseout);node.observe('mouseout',mouseout);node.observe('mousemove',mousemove);window.document.observe('mousewheel',hB).observe('DOMMouseScroll',hB);return timeoutID=window.setTimeout(function(){popped(node)},1000);}else{return false;}};function hB(event){$$('.nodeTip').invoke('hide');};function mousemove(event){var self=this;Event.stop(event);window.clearTimeout(timeoutID);return timeoutID=window.setTimeout(function(){popped(event,self)},1000);};function mouseout(event){try{this.tipAjax.respondToReadyState=Prototype.emptyFunction;this.tipAjax.transport.abort()}catch(e){}unobserve(this);return window.clearTimeout(timeoutID);};function unobserve(node){node.stopObserving('mousedown',mouseout);node.stopObserving('mouseout',mouseout);node.stopObserving('mousemove',mousemove);};function popped(event,node){if(typeof node!=='object')return;var tipId='node_'+(node.nodeId)+'_tip',nodeId=node.nodeId-1,options={};if(!cwd.node[nodeId])return;options={id:tipId,position:'bottom',classExtra:'nodeTip nodeDetails '+cwd.listView,showDelay:500,hideDelay:0,loadShown:true,destroy:true};unobserve(node);var selection=Selection.aW(),gC=selection.length;if(gC>1){if(node.hasClassName('node_details_selected')||node.down().hasClassName('icon_frame_selected')){var temp=new Template(Locale['YouHaveSelected']);options.tip_content='

'+temp.evaluate({'item':gC,'childNoun':cwd.childNoun})+'

';return new Tip(node,options);}}var tipContent=cwd.node[nodeId].tipContent;if(tipContent){if(tipContent!=='NOAJAX'){options.tip_content=tipContent;new Tip(node,options);}}else{node.tipAjax=new Ajax.Request('/Pages/Tooltip',{onlyLatestOfClass:'nodeTip',parameters:{node:cwd.node[nodeId].id,container:cwd.id},onSuccess:function(ajax){if(ajax.responseText){cwd.node[nodeId].tipContent=ajax.responseText;}},onComplete:function(){tipContent=cwd.node[nodeId].tipContent;if(tipContent){options.tip_content=tipContent;new Tip(node,options);}else{cwd.node[nodeId].tipContent='NOAJAX';}}});}}})(); ; function dN(){var bx;var timer;var v;Event.observe(window,'resize',dq);this.show=function(cr){v=cr;Loading.hide();$('LoadingLabel').innerHTML=v.label||Locale['loading'];dq();if(v.eE){timer=setTimeout(show,v.eE);return;}show();};this.hide=function(ey){if(timer)clearTimeout(timer);$('Loading').hide();if(bx){if(!ey){bx.setOpacity(1);Listing.nodeTipsEnabled=true;}bx=false;}};function show(){Listing.nodeTipsEnabled=false;$('Loading').show();bx=v.bx||v.obj;bx.setOpacity(0.25);};function dq(){var aN=$('Loading');var aQ=Position.positionedOffset(v.obj);var x=v.x||aQ[0]+(v.obj.getWidth()/2)-(aN.getWidth()/2);var y=v.y||aQ[1]+(v.obj.getHeight()/2)-(aN.getHeight()/2);aN.style.left=x+'px';aN.style.top=y+'px';}}; function ef(){var ce={play:{code:"Action.Play('#{target}')",icon:'Play',mult:true,fB:['Audio'],not:['view'],dflt:true},view:{code:"Action.View('#{target}')",icon:'View',mult:true,fB:['Video','Image'],not:['play'],dflt:true},open:{code:"Action.Open('#{target}')",icon:'Open',dflt:true},download:{code:"window.location.href='#{uri}?dl=1'",icon:'Download',dflt:true},downloadMulti:{code:"Action.DownloadMulti('#{target}')",mult:true,icon:'Download',not:['download']},listDir:{code:"window.location.hash = '#{uri}'",icon:'OpenFolder',dflt:true},link:{code:"Action.DialogAction({page: '/Pages/Link?container=' + cwd.id + '&', target:'#{target}'})",icon:'Link.png',mult:true,tasks:0,context:0,tree:0,sharing:true},link_facebook:{code:"popupWindow('link_facebook', 450, 600, false, '/Pages/Link?site=facebook&container=' + cwd.id + '&id=#{targets}')",icon:"Facebook.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},link_twitter:{code:"popupWindow('link_twitter', 600, 800, true, '/Pages/Link?site=twitter&container=' + cwd.id + '&id=#{targets}')",icon:"Twitter.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},link_myspace:{code:"popupWindow('link_myspace', 450, 600, false, '/Pages/Link?site=myspace&container=' + cwd.id + '&id=#{targets}')",icon:"Myspace.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},link_linkedin:{code:"popupWindow('link_linkedin', 450, 600, false, '/Pages/Link?site=linkedin&container=' + cwd.id + '&id=#{targets}')",icon:"Linkedin.gif",mult:true,tasks:0,context:0,tree:0,sharing:true},share:{code:"Action.DialogAction({ page: '/Pages/Share?', width: 475, minHeight: 330, target: '#{target}' })",icon:'Share.gif',mult:true,tasks:0,context:0,tree:0},embed:{code:"Action.DialogAction({ page: '/Pages/Embed?', target: '#{target}'})",icon:'Embed.gif',mult:true,fB:['Image','Audio','Video'],tasks:0,context:0,tree:0},erase:{code:"Action.Delete('#{target}', '#{name}')",icon:'Delete',mult:true},dropLink:{code:"Action.Delete('#{target}', '#{name}', { loadMessage: Locale['actionsPopupDropLink'], confirm: { title:Locale['actionsPopupDropLinkTitle'] , message:Locale['actionsPopupDropLinkConfirm'] } })",icon:'Delete.gif',sharing:1},recycle:{code:"Action.Recycle('#{target}', '#{name}')",icon:'Delete',mult:true},restore:{code:"Action.Update('#{target}', {parameters: {updateType:'restore'}, loadMessage:Locale['actionsPopupRestore']})",icon:'RestoreBin',mult:true},empty:{code:"Action.Update('#{target}', {parameters: {updateType: 'empty'}, loadMessage:Locale['actionsPopupEmptyBin'], confirm: {icon:'/Assets/Default/Images/Icons/Large/RecycleBin.gif', message:{singular:{description:Locale['actionsConfirmEmptyRecycle']}}}})",icon:'Empty',mult:true},rename:{code:"Action.Rename('#{target}', '#{name}')",icon:'Rename'},move:{code:"Action.MoveCopy('#{target}', '#{name}', { available: ['Move'] })",icon:'Move.gif',mult:true,not:['moveCopy']},copy:{code:"Action.MoveCopy('#{target}', '#{name}', { available: ['Copy'] })",icon:'Copy.gif',mult:true,not:['moveCopy']},moveCopy:{code:"Action.MoveCopy('#{target}', '#{name}', { available: ['Move','Copy'] })",icon:'Move',mult:true},newFolder:{code:"Action.newFolder('#{target}')",icon:'NewFolder'},listVersions:{code:"Action.DialogAction({page:'/Pages/VersionDialog?', target: '#{target}', width: 480})",icon:'FileVersions'}};this.mouseOut=function(event){$('popup_menu').tid=setTimeout(hide,20);};this.contextMenu=function(event){var target=Event.element(event);if(target.tagName=='INPUT'||target.tagName=='TEXTAREA')return;return show(event);};Event.observe(document,'contextmenu',this.contextMenu);Event.observe(window,'resize',hide);Event.observe(document,'click',hide);this.hide=hide;this.show=show;this.actionsFor=actionsFor;this.buildActions=buildActions;this.cb=cb;function hide(event){Listing.nodeTipsEnabled=true;if(event&&(event.type==='click'&& !Event.isLeftClick(event))&&(Object.isElement(event.originalTarget)&&event.originalTarget.up('.node')))return false;$('popup_menu').style.visibility='hidden';};function show(event){event=event||window.event;var element=Event.element(event);if(dT.eu())return true;Event.stop(event);var be=$('popup_menu');clearTimeout(be.tid);if(element.hasClassName('icon_context')){var o=element.viewportOffset();var x=o.left;var y=o.top;}else{var x=Event.pointerX(event)-10;var y=Event.pointerY(event)-10;}if(element.up('div.node'))element=element.up('div.node');else{var i=0;while(element&& !element.nodeId&& !element.nsData&&i<5){element=element.parentNode;i++;}}var cR={targets:[],menu:'context'};var menu;if(element&&element.nsData){cR.targets.push(element);cR.menu='tree';}else if(element&&element.nodeId){if(Selection.bS(element.readAttribute('nodeId'))){cR.targets=Selection.selectedIds();}else{cR.targets.push(element.readAttribute('nodeId'));}}var actions=buildActions(actionsFor(cR),cR.targets);cb(actions,x,y,event);};function cb(M,x,y,event){if(M.length==0)return true;var be=$('popup_menu'),PopContent=$('popup_menu_content'),bt=false,bgHost=document.location.protocol+'//'+document.location.host+'/Assets/Default/Images/Icons/Small/';PopContent.update('');M.each(function(a){var attr={},el;if(a.dflt& !bt){attr.className='selected';bt=true;}if(a.href)attr.href=a.href;el=new Element('a',attr).insert({'top':'
'}).insert(a.label);if(!a.href)el.observe("click",function(event){event.stop();return eval(a.code);});PopContent.insert(el);});if(event.type=='contextmenu'){x--;y--;}else{var o=event.element().viewportOffset();x=o.left;y=o.top;}var aI=windowSize();if((x+be.getWidth())>aI.width){x=x-((x+be.getWidth())-aI.width)-30;}if((y+be.getHeight())>aI.height){y=y-((y+be.getHeight())-aI.height)-20;}var nodeTip=Ajax.currentRequests['nodeTip'];if(nodeTip){nodeTip.transport.onreadystatechange=Prototype.emptyFunction;nodeTip.transport.abort();Ajax.activeRequestCount--;};Listing.nodeTipsEnabled=false;be.style.top=y+'px';be.style.left=x+'px';be.style.visibility='visible';};function populateActions(actions){if(!actions)return[];actions.each(function(action){if(!action.id)return;if(ce[action.id])Object.extend(action,ce[action.id]);var text=Locale['menuItems'][action.id];if(!text)return;['alt','label'].each(function(aF){if(action[aF])return;action[aF]=text[aF];});});return actions;};function actionsFor(cR){var targets=cR.targets,dZ=0,M=new Array;if(targets)dZ=targets.length;if(dZ==1){var target=targets[0];var node=typeof(target)!='object'?cwd.node[targets[0]-1]:(target.nsData||target);var fo=node.actions.clone();M=populateActions(fo);}else if(dZ>1){M=populateActions(cwd.actions).reject(function(action){if(!action.mult)return true;if(action.fB&& !targets.any(function(target){if(action.fB.include(cwd.node[target-1].fClass))return true;}))return true;}).concat(populateActions(cwd.node[targets[0]-1].actions).reject(function(action){if(!action.mult)return true;if(!targets.all(function(target){if(populateActions(cwd.node[target-1].actions).any(function(cf){if(cf.id==action.id)return true;}))return true;}))return true;}));}else{M=populateActions(cwd.actions);}if(!M)return[];var cQ=new Array;M.each(function(fH){if(!cQ.find(function(action){if(action.id==fH.id)return true;})){cQ.push(fH);}});return cQ.reject(function(action){if(action.fB){var valid=action.fB.any(function(n){return cwd.node.any(function(x){return x&&n===x.fClass;});});if(!valid)return true;}if(cR.menu&&action[cR.menu]==0)return true;if((cR.require||['tasks','details'].any(function(m){return action[m]}))&&(!cR.menu|| !action[cR.menu]))return true;if(dZ&&action.not&&action.not.any(function(not){if(M.pluck('id').include(not))return true;}))return true;});};function buildActions(actions,targets){var target,name,itemDesc,fJ,uri;var bR=targets.length;if(bR==0){target=fJ=cwd.id;name=cwd.name;itemDesc=cwd.noun;uri=cwd.uri;}else if(bR==1){var node=typeof(targets[0])!='object'?cwd.node[targets[0]-1]:(targets[0].nsData||targets[0]);target=node.id;name=node.name;itemDesc=node.noun;fJ=target;uri=node.uri;}else{target=null;itemDesc=cwd.childNoun;var ids=new Array;for(var i=0;i1){if(src[aF].plural)dz[aF]=src[aF].plural;}else if(bR==0){if(src[aF].container)dz[aF]=src[aF].container;}});['code','label','alt','href'].each(function(aF){if(dz[aF]){var temp=new Template(dz[aF]);dz[aF]=temp.evaluate(vars);}});actions[i]=dz;}return actions;}} ; function dB(){var selected=new Array;var selection=null;var checkBox=false;var dV=false;var ab=0;var T=0;var aO=false;var bo=null;var bY=null;var onChangeCode=null;var cY=null;this.cM=function(event){event=event||window.event;Event.stop(event);var nodeId=parseInt(event.element().nodeId||event.element().up('.node').readAttribute('nodeId'));if(!Event.isLeftClick(event)&&selected[nodeId])return false;if(aO&& !cwd.node[nodeId-1].container){dT.K(false);aO(cwd.node[nodeId-1]);aO=false;return true;}if(!event.findElement('a.icon_context')){if(Event.isLeftClick(event))dT.dL(event);if(selected[nodeId]){dV=nodeId;return true;}}return dR(nodeId,{range:event.shiftKey,multiple:cmdKey(event)});};this.dm=function(event){event=event||window.event;var nodeId=event.element().nodeId||event.element().up('.node').readAttribute('nodeId');if(dV!=nodeId&&Event.element(event).id!='check_box_'+checkBox)return true;dR(nodeId,{range:event.shiftKey,multiple:cmdKey(event)});return true;};Event.observe(document,'keydown',function(event){switch(event.keyCode){case Event.KEY_UP:case Event.KEY_DOWN:case Event.KEY_LEFT:case Event.KEY_RIGHT:var elem=event.element();if(elem.tagName=='INPUT'||elem.tagName=='TEXTAREA'||elem.tagName=='SELECT')return;Event.stop(event);var aF=event.keyCode;if(cwd.listView!='Thumbs'&&(aF==Event.KEY_LEFT||aF==Event.KEY_RIGHT))return;var last=T?T:ab;var next;if(cwd.listView=='Thumbs'){var gl=$('node_'+last);if(!gl)return;var dj=gl.positionedOffset();var nodes=aF==Event.KEY_UP||aF==Event.KEY_LEFT?Listing.nodes().reverse():Listing.nodes();var node=nodes.find(function(node){if(node.index==last)return;var pos=node.elements[0].positionedOffset();if((aF==Event.KEY_UP||aF==Event.KEY_DOWN)&&pos.left!=dj.left)return;if((aF==Event.KEY_LEFT||aF==Event.KEY_RIGHT)&&pos.top!=dj.top)return;if(aF==Event.KEY_DOWN&&pos.top<=dj.top)return;if(aF==Event.KEY_UP&&pos.top>=dj.top)return;if(aF==Event.KEY_RIGHT&&pos.left<=dj.left)return;if(aF==Event.KEY_LEFT&&pos.left>=dj.left)return;return true;});if(node)next=node.index;}else{next=aF==Event.KEY_UP?last-1:last+1;}if(!next)return;dR(next,{range:event.shiftKey,multiple:cmdKey(event)});Listing.ds(next);break;}});Event.observe($('BodyContainer'),'mousedown',lasso);$('BodyContainer').focus();this.fF=function(event){event=event||window.event;var nodeId=event.element().nodeId||event.element().up('.node').readAttribute('nodeId');if(!Event.isLeftClick(event)){if(!selected[nodeId])dR(nodeId,{range:event.shiftKey,multiple:cmdKey(event)});return;}checkBox=nodeId;};this.aA=function(){for(i=0;icW.height){if(cW.width<=(ct-cO.left))return event.stop();}Event.observe(document,'mousemove',mousemove);Event.observe(document,'mouseup',mouseup);event.stop();document.body.focus();var nodes=Listing.nodes(),position=[],size=0,length=0,lasso=$('lasso')?$('lasso'):new Element('div',{'id':'lasso','style':'display:none'});container.insert(lasso.setOpacity(0.2));lasso.setStyle({'width':'0px','height':'0px'});length=nodes.length;if(length>0&&nodes[0].elements[0]){size=nodes[0].elements[0].getDimensions();if(cwd.listView!=='Thumbs'){var n1=nodes[0].elements.last().nodeOffset();size.width=n1.left-container.nodeOffset().left+size.width;}while(length--){var n=nodes[length].elements[0];if(!position[n.nodeId]){position[n.nodeId]={};position[n.nodeId].left=n.nodeOffset().left-container.nodeOffset().left;position[n.nodeId].top=n.nodeOffset().top-container.nodeOffset().top;}}}function mousemove(event){var top=cZ,left=ct,width=Event.pointerX(event)-ct,height=Event.pointerY(event)-cZ;if(width<0){width= -width;left=Event.pointerX(event);}if(height<0){height= -height;top=Event.pointerY(event);}top=top-cO.top+cS.top;left=left-cO.left+cS.left;lasso.setStyle({'width':width+'px','height':height+'px','left':left+'px','top':top+'px'}).show();length=nodes.length;if(length>0){while(length--){var n=nodes[length].elements.first();if(n){var leftIn=left<(position[n.nodeId].left+size.width),rightIn=(left+width)>position[n.nodeId].left,topIn=top<(position[n.nodeId].top+size.height),bottomIn=(top+height)>position[n.nodeId].top;if(leftIn&&rightIn&&topIn&&bottomIn){if(selected[n.nodeId]!==true){Selection.aU(n.nodeId);selected[n.nodeId]=true;}}else{if(selected[n.nodeId]!==false){Selection.ax(n.nodeId);selected[n.nodeId]=false;}}}}}};function mouseup(event){Listing.nodeTipsEnabled=true;lasso.hide();update();Event.stopObserving(document,'mousemove',mousemove);Event.stopObserving(document,'mouseup',mouseup);}};function dR(nodeId,fD){if(!cwd.node[nodeId-1])return;if(fD.range&ab>0){if(!fD.multiple)bl();var cw=0;var dU=0;if(T>0){if(T>ab){cw=ab;dU=T;}else{cw=T;dU=ab;}for(i=cw;i<=dU;i++){if(cwd.node[i-1]){ax(i);selected[i]=false;}}}if(nodeId>ab){cw=ab;dU=nodeId;}else{cw=nodeId;dU=ab;}for(i=cw;i<=dU;i++){if(cwd.node[i-1]){aU(i);selected[i]=true;}}T=nodeId;}else if(fD.multiple||(checkBox==nodeId)){if(selected[nodeId]){ax(nodeId);selected[nodeId]=false;ab=0;}else{aU(nodeId);selected[nodeId]=true;ab=nodeId;}T=0;}else{bl();selected[nodeId]=true;ab=nodeId;T=0;aU(nodeId);}fG();if(!fD.delayUpdate)update();return true;};function update(cl){if(cwd.error){$('info_details').update();clearTasks();return;}var dP=new Array;cwd.node.each(function(node,i){if(!node)return;var nodeId=i+1;if(selected[nodeId])return dP.push(nodeId);});if(!cl)cl= !selection||dP.toString()!=selection.toString();if(cl){executeDelayed();if(onChangeCode)onChangeCode();selection=dP;Action.close(true);}er(cl);eo();};function executeDelayed(eY,eE){if(bo)clearTimeout(bo);bY=eY;bo=eY?setTimeout("Selection.ga()",eE):null;};function er(cl){var name,desc,dZ,info;var details=$("info_details");var items=selection.length;if(cl){details.update();$('info_right_text').update();}if(items>=1){var node=cwd.node[selection[0]-1];name=node[cwd.columns[0].param];desc=node.desc;info=node.details}else{info=cwd.details;}if(info&&cl){var content=typeof(info)=='object'?Jemplate.process(info.temp,info.vars):info;cY=typeof(info)=='object'?info.vars:null;if(items>1){var gp=new Element('div').update(content.stripScripts()).select('.all_nodes');if(gp.length>0){gp.each(function(node){details.insert(node)});content.evalScripts();}}else{details.insert(content.stripScripts());content.evalScripts();}}new Tips('#info_details *[title]',{position:'left'});};function eo(){var M=Menu.buildActions(Menu.actionsFor({targets:selection,menu:'tasks'}),selection);if(M.length==0){$("info_tasks").update(Locale['noTasks']);}else{$("info_tasks").update('');M.each(function(action){var attr={title:action.alt},el,a;if(action.href)attr.href=action.href;a=new Element('a',attr).insert(new Element('img',{src:'/Assets/Default/Images/x.gif','class':'icon tasks '+action.icon,width:'22',height:'17'})).insert(action.label);el=new Element('div').insert(a);if(!attr.href){a.observe('click',function(event){event.stop();return eval(action.code);});}$("info_tasks").insert(el);});}new Tips('#info_left a[title]',{position:'right'});av();};function bl(){for(i=0;i0,bottom:(this.offset.bottom-this.tip.getHeight())>0}},position:function(el){if(!this.canFit[this.options.position]){switch(this.options.position){case 'top':this.options.position='bottom';break;case 'bottom':this.options.position='top';break;}}var style=this.gy[this.options.position];el.addClassName(this.options.position);el.setStyle(style);},build:function(){if($(this.id)){this.tip=$(this.id);this.target=this.el;}else{this.tip=new Element('div',{id:this.id,className:this.options.classTip}).hide();if(this.options.classExtra)this.tip.addClassName(this.options.classExtra);this.tip.update(new Element('div',{id:this.id+'_content',className:this.options.classContent}).update(this.tip_content));this.target=$(this.options.target)||this.el;if(this.options.hideOthers)this.observe(this.tip);$('body').insert(this.tip);if(this.options.size.height){this.tip.setStyle({height:this.options.size.height+'px'});}if(this.options.size.width&&this.tip.getWidth()>this.options.size.width){this.tip.setStyle({width:this.options.size.width+'px'});}}},observe:function(el){el.observe("tip:close",this.boundMouseout);el.observe('mouseenter',this.boundMouseover);el.observe('mouseleave',this.boundMouseout);el.observe('tip:show',this.boundMouseover);},unobserve:function(){this.el.stopObserving('tip:close');this.el.stopObserving('mouseenter',this.boundMouseover);this.el.stopObserving('mouseleave',this.boundMouseout);this.el.stopObserving('tip:show');},gQ:function(){$$('.'+this.options.classTip+'.shown:not(#'+this.id+')').each(function(el){el.fire('tip:close');});},mouseover:function(event){Event.stop(event);this.over(event);},mouseout:function(event){Event.stop(event);this.out(event);},click:function(event){this.el.fire('tip:close');},over:function(event){Event.observe(document,'click',this.boundClick);Event.observe(document,'contextmenu',this.boundClick);event.stop();window.clearTimeout(this.hd);if(this.shown!=true){if(this.el.hasClassName(this.options.ignoreTipClass))return;if(this.options.hideOthers)this.gQ();var self=this;if(!this.target)this.build();this.ht(this.target);this.position(this.tip);if(this.tip){this.he=window.setTimeout(function(){self.shown=true;self.tip.show();self.tip.addClassName('shown');},this.options.showDelay);}}},out:function(event){Event.stopObserving(document,'click',this.boundClick);Event.stopObserving(document,'contextmenu',this.boundClick);event.stop();window.clearTimeout(this.he);var self=this;if(this.tip){this.hd=window.setTimeout(function(){self.shown=false;self.tip.hide();self.tip.removeClassName('shown');if(self.options.destroy)self.destroy(self);},this.options.hideDelay);}},destroy:function(el){el.unobserve();if($(el.id))el.tip.remove();}}); ; function gi(){var aR=0;var cs=false;var progress=false;var bA=false;var button=$('tb_upload');var advanced=false;var conflicts=false;var images=null;var download=false;var gE=$('simple_upload_target');if(gE)gE.observe('load',function(event){var error=cD(true);if(error&&cs)Upload.finish({error:error});});this.open=function(fD){if(Upload.fS()){if(fD&&fD.advanced=='dragdrop'&&bA.id=='simple_upload_progress'){Action.close();return true;}return;}download=false;if(!fD)fD={};return fD.advanced?this.gx(fD):this.gM(fD);};this.gM=function(fD){aR=0;conflicts=false;if(button.hasClassName('disabled')&& !fD.reopen)return;g.fb(button);fX({pane:'gP'});return true;};this.gx=function(fD){Applet.load({hidden:fD.advanced?true:false,onSuccess:function(applet){if(fD.advanced==='dragdrop')return Applet.show();if(applet)applet.openChooseFile();},onFailure:function(){Action.Dialog('/Pages/Dialog/AppletHelp/FailedToLoadJava.htm',{width:450});Applet.hide();}});return true;};this.addFile=function(){var dJ=$("file_"+aR);if(dJ){var gO=dJ.value;if($('simple_upload_form').getInputs('file').any(function(input){return(input==dJ||input.value!=gO)?false:true;})){alert(Locale['uploadAlreadyAdded']);dJ.remove();}else{dJ.stopObserving('change').removeClassName('add_file').addClassName('list_file').hide();var fileName=gO.replace(/.*\\/,'').replace(/.*\//,'');var del=new Element('img',{src:'/Assets/Default/Images/Icons/Tiny/Delete.gif',className:'delete'});del.observe('click',Upload.gN);var li=new Element('li',{id:'display_upload_'+aR}).insert(''+fileName+'').insert(del);li.aR=aR;$('simple_upload_files').insert({top:li});$('simple_upload_must_choose_file').hide();}}aR++;input=new Element('input',{'id':'file_'+aR,name:'file_'+aR,type:'file',className:'add_file'}).setStyle({opacity:0}).observe('change',Upload.addFile);$('add_file').insert({bottom:input})};this.gN=function(){var img=this;var li=img.up();var dJ=$('file_'+li.aR);li.remove();dJ.remove()};this.start=function(fD){if(!fD)fD={};advanced=fD.advanced;download=fD.download;cs=fY();progress=false;images=null;var started=advanced?Upload.gj(fD):Upload.gB(fD);if(!started){cs=false;return;}g.fb(button);if(advanced!='dragdrop'){Applet.hide();fX({pane:'progress'});}else{Action.close();Upload.gm();aX();setTimeout("Upload.status()",1000);}};this.gB=function(fD){if(conflicts)return Upload.hz(fD);var form=$('simple_upload_form');var ho=form.getInputs('file');if(!ho.any(function(dJ){return dJ.value})){$('simple_upload_must_choose_file').addClassName('error').show();return;}var param={to:cwd.id};ho.each(function(dJ){if(!dJ.value)return;param[dJ.name]=dJ.value;});new Ajax.Request('/Pages/Upload?checkFiles=1',{method:'post',parameters:param,onSuccess:function(transport){var aK=transport.responseText.evalJSON();conflicts=aK.conflicts;if(aK.error)return Upload.finish(aK);return Upload.start(fD);},onFailure:function(response){Upload.finish({error:d(response,{j:Locale.requestError})})}});return;};this.hz=function(fD){if(fD.doForAll){conflicts.findAll(function(c){return!c.hu}).each(function(c){c.hu=fD.doForAll});}else{var hf=conflicts.find(function(c){return!c.hu});if(hf){cs=false;Action.hx({conflictDst:hf.data,onReplace:function(hy){hf.hu='overwrite';if(hy.doForAll)fD.doForAll='overwrite';Upload.start(fD);},onSkip:function(hy){hf.hu='skip';if(hy.doForAll)fD.doForAll='skip';Upload.start(fD);},onRename:function(hy){hf.hu='rename';if(hy.doForAll)fD.doForAll='rename';Upload.start(fD);},onCancel:function(){Upload.cancel();}});return false;}}conflicts.findAll(function(c){return c.hu=='skip'}).each(function(c){$("file_"+c.index).remove();});var form=$('simple_upload_form');var ho=form.getInputs('file');if(!ho.any(function(dJ){return dJ.value}))return;var action=form.action+cs+'&to='+cwd.id;conflicts.findAll(function(c){return c.hu=='overwrite'}).each(function(c){action=action+'&overwrite_'+c.index+'=1';});conflicts=false;form.action=action;form.submit();return true;};this.advancedConflicts=function(fD){conflicts=[fD];Action.hx({conflictDst:fD,onReplace:function(hy){if(bA.id=='simple_upload_progress')fX({pane:'progress'});conflicts=false;Applet.af().conflictResponse(hy.doForAll?2:1);},onSkip:function(hy){if(bA.id=='simple_upload_progress')fX({pane:'progress'});conflicts=false;Applet.af().conflictResponse(hy.doForAll?6:5);},onRename:function(hy){if(bA.id=='simple_upload_progress')fX({pane:'progress'});conflicts=false;Applet.af().conflictResponse(hy.doForAll?4:3);},onCancel:function(){if(!conflicts)return;Upload.cancel();}});};this.gj=function(fD){conflicts=false;return true;};this.finish=function(fD){cs=false;var isAction=(bA.id=='simple_upload_progress'&& !conflicts);if(!isAction)Applet.fR();g.fU(button);if(fD.goTo){if(isAction)Action.close();return listDirectory(fD.goTo);}if(fD.error){var msg;if('ACCOUNT_SUSPENDED'==fD.error){msg='accountSuspended';}else if(download){msg='downloadFailed';}else{msg='uploadFailed';}fD.message=Locale[msg]+':

'+fD.error;Action.fO(fD);return;}if(isAction)Action.close();Listing.removeInfo($('info_upload_complete'));Listing.removeInfo($('info_download_complete'));if(download){addDownloadCompleteInfo(fD);}else if(fD.to&&fD.to.id==cwd.id){refreshDir({onComplete:function(){addUploadCompleteInfo(fD);}});}else if(fD.to){addUploadCompleteInfo(fD);}};addUploadCompleteInfo=function(fD){if(!fD.fileIds|| !fD.fileIds.size())return;var Z=fD.fileIds.size();trackEvent("Uploads","Upload","",Z);var selected=fD.to&&fD.to.id==cwd.id?Selection.gD(fD.fileIds):[];if(clientProductName)Listing.removeInfo($('info_install_client'));Listing.addInfo(Jemplate.process('FileManager/Info/UploadComplete.htm',{uploadedFiles:Z,selectedFiles:selected.size(),uploadedTo:fD.to,cwd:cwd,fileName:selected&&selected[0]?selected[0].data.name:'',clientProductName:clientProductName,siteName:siteName}));};addDownloadCompleteInfo=function(fD){console.log(fD);if(fD.fileFailed){var failed='',msg='';fD.fileFailed.each(function(x,i){failed+='
  • '+x+'
  • ';});msg+='

    '+Locale['downloadPartialFailed'].title+'

    ';msg+='

    '+Locale['downloadPartialFailed'].message+'

    ';msg+='
      '+failed+'
    ';return Action.r({'message':msg,'width':500});}if(clientProductName)Listing.removeInfo($('info_install_client'));Listing.addInfo(Jemplate.process('FileManager/Info/DownloadComplete.htm'));};this.cancel=function(){Upload.finish({});advanced?Applet.af().stopTransfers():$('simple_upload_target').src='/Pages/Upload?page=Hidden';};this.setScaling=function(scaling){if(!advanced)return;Upload.setScalingLabel(scaling);try{Applet.af().setScaling(scaling);}catch(e){};};this.gm=function(){if(cs){bA=$('info_upload_progress');Applet.fw({download:download});aX(progress);}else{g.fU(button);}};this.status=function(){if(!cs)return;if(advanced){var status;var applet;try{applet=Applet.af();var gH=new String(download?applet.getJSONDownloadStatus():applet.getJSONUploadStatus());var aK=gH.evalJSON();status=aK[0];}catch(e){};if(!download){try{if(images==null)images=applet.includesImages();if(images)status.scaling=applet.getScaling();}catch(e){};}aX(status);setTimeout("Upload.status()",1000);return;}var cP=cD();if(!cs)return;if(cP)return Upload.finish({error:cP});new Ajax.Request('/__upload_status',{method:'get',parameters:{client_up_sess:cs,rand:Math.random()},onSuccess:function(transport){var aK=transport.responseText.evalJSON();aX(aK);},onComplete:function(transport){if(!cs)return;setTimeout("Upload.status()",1000);}});};this.fS=function(){return cs?true:false;};this.fp=function(){return download;};function fX(fD){var page=download?'DownloadProgress':'SimpleStart';Action.Dialog('/Pages/Upload/'+page,{width:470,onComplete:function(){switch(fD.pane){case 'gP':var form=$('simple_upload_form');if(!form)return;Upload.addFile();form.observe('submit',Upload.start);break;case 'progress':var gP=$("simple_upload_choose");if(gP)gP.hide();bA=$('simple_upload_progress').show();aX();setTimeout("Upload.status()",1000);break;}Action.sizeDialog();},onClose:function(){if(conflicts)return;Upload.gm();},restore:fD.pane=='progress'?true:false});};function aX(fD){if(!fD)fD={done:0};var msg;if(fD.done){msg=fD.done==fD.total?Locale[download?'compingDownload':'compingUpload']:Locale['uploadProgress'];}else{msg= !advanced&&progress.total?Locale[download?'compingDownload':'compingUpload']:Locale[download?'startDownload':'startUpload'];}progress=fD;var progressBar=bA.down('.upload_progress_bar');var statusText=bA.down('.upload_progress_text');fD.displayDone=al(fD.done);if(fD.total){fD.displayTotal=al(fD.total);fD.fj=Math.round((fD.done/fD.total)*100);if(fD.fj>100)fD.fj=100;}else{fD.fj=0;}progressBar.setStyle({width:fD.fj+'%'});var speed=fD.done/(fD.nowtime-fD.starttime);if(speed)fD.displaySpeed=al(speed,{gc:'bits'});var temp=new Template(msg);var text=temp.evaluate(fD);if(fD.done!=fD.total&&fD.current&&fD.fileDone&&fD.fileTotal){fD.fileRemaining=fD.fileTotal-fD.fileDone;fD.displayCurrent=fD.current.truncate(20);temp=new Template(Locale[download?'downloadProgressFiles':'uploadProgressFiles']);statusText.update(temp.evaluate(fD)).insert(new Element('span').update(text)).addClassName('detailed');}else{statusText.removeClassName('detailed').update(text);}if(typeof(fD.scaling)!='undefined'){var eF=bA.down('.scale_images');if(!eF)return;var scaling=eF.show().down('input');scaling.checked=fD.scaling;Upload.setScalingLabel(scaling.checked);}if(bA.id=='simple_upload_progress')Action.sizeDialog();};this.setScalingLabel=function(scalingCheck){if(scalingCheck){$('scalingLabel').show();$('notScalingLabel').hide();}else{$('scalingLabel').hide();$('notScalingLabel').show();}};function cD(complete){var error;var iframe=frames['simple_upload_target'];try{if(iframe&&iframe.document){var dh=iframe.document.getElementById('uploadEndJS');if(dh){if(dh.innerHTML){var js=dh.innerHTML;dh.innerHTML='';eval(js);}}else if(complete){error=iframe.document.title;}}}catch(fl){error=Locale.connectError;};return error;};function fY(){var hw=Math.random()+"";return hw.replace(/[^\d]/,"");}} ; function aH(number,X){X=(!X?2:X);return Math.round(number*Math.pow(10,X))/Math.pow(10,X);};function al(size,fD){var gc=fD&&fD.gc?fD.gc:'bytes';if(gc=='bits')size=size*8;if(size<500)return aH(size)+' '+Locale[gc];size=aH(size/1024);if(size<500)return size+' '+Locale['kilo'+gc];size=aH(size/1024);if(size<1024)return size+' '+Locale['mega'+gc];size=aH(size/1024);return size+' '+Locale['giga'+gc];};function windowSize(){var bs=0,bg=0;if(navigator.vendor&&navigator.vendor.indexOf('Apple')> -1&&self.innerHeight){bs=self.innerWidth;bg=self.innerHeight;}else if(!window.opera&&document.documentElement&&document.documentElement.clientHeight){bs=document.documentElement.clientWidth;bg=document.documentElement.clientHeight;}else if(document.body){bs=document.body.clientWidth;bg=document.body.clientHeight;}return{width:bs,height:bg};};function bv(elem,eL){if(typeof(elem.pageYOffset)=='number'){if(eL&&eL.left)elem.pageXOffset=eL.left;if(eL&&eL.top)elem.pageYOffset=eL.top;return{left:elem.pageXOffset,top:elem.pageYOffset};}else{if(eL&&eL.left)elem.scrollLeft=eL.left;if(eL&&eL.top)elem.scrollTop=eL.top;return{left:elem.scrollLeft,top:elem.scrollTop};}};function dw(viewport,element,fD){var eJ=bv(viewport);var bB=new Array(eJ.left,eJ.left+viewport.getWidth(),eJ.top,eJ.top+viewport.getHeight());if(fD&&fD.paddingLeft)bB[1]-=fD.paddingLeft;if(fD&&fD.paddingTop)bB[3]-=fD.paddingTop;var ck=element.positionedOffset();var fT=new Object;if(ck.leftbB[1])fT.left=eJ.left+(ck.left-bB[1]);if(ck.topbB[3])fT.top=eJ.top+(ck.top-bB[3]);return bv(viewport,fT);};function getSID(){var sid=$('body').readAttribute('sid');if(sid)return sid;return false;};var cy=new Array;function popupWindow(bf,aD,cz,bz,Address){var Window;if(aD){aD=',height='+aD;}if(cz){cz=',width='+cz;}if(bz){bz=',scrollbars=yes';}else{bz=',scrollbars=no';}if(!Address){Address='/Pages/'+bf;}Address+=(Address.include('?')?'&':'?')+'_brand_id='+brandId;bf=bf.gsub('-','_');if(cy[bf]&& !cy[bf].closed&&cy[bf].location){Window=cy[bf];Window.location.href=Address;}else{Window=window.open(Address,bf,'resizable=yes,status=yes'+aD+cz+bz);if(!Window.opener)Window.opener=self;}if(window.focus)Window.focus();return;};function SetMessage(Message,Error,Element){Element=Element||"message";var bX=document.getElementById(Element);if(Error){bX.style.color='red';}else{bX.style.color='';}bX.innerHTML=Message;bX.style.display='block';};function fa(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i=600;return eq?message.eM:message.j+' ('+response.status+')';};function setTZOffsetCookie(){var date=new Date();var tz_offset=date.getTimezoneOffset();document.cookie="tz_offset="+tz_offset;};if(typeof(console)==='undefined'){console={'log':function(){},'profile':function(){},'profileEnd':function(){}};} ; var cwd={},clickUser,clickAuth,cC=0;var gA=Prototype.ScriptFragment;Prototype.ScriptFragment=']*>(('+gA+'|[\\S\\s])*?)<\/script>';Ajax.currentRequests={};Ajax.Responders.register({onCreate:function(request){cC++;if(request.options.onlyLatestOfClass&&Ajax.currentRequests[request.options.onlyLatestOfClass]){try{var gS=Ajax.currentRequests[request.options.onlyLatestOfClass];gS.respondToReadyState=Prototype.emptyFunction;gS.transport.abort();}catch(e){}}Ajax.currentRequests[request.options.onlyLatestOfClass]=request;request.success=function(){var status=this.getStatus();if(status){return status>=200&&status<300;}else{return request.responseText;}};request.url+=(request.url.include('?')?'&':'?')+'_brand_id='+brandId;},onComplete:function(request){cC--;if(request.options.onlyLatestOfClass){Ajax.currentRequests[request.options.onlyLatestOfClass]=null;}}});Event.observe(document,'selectstart',function(event){var element=Event.element(event);if(element.tagName!='INPUT'&&element.tagName!='TEXTAREA')Event.stop(event);});Event.observe(window,'dragdrop',function(event){Event.stop(event);alert(Locale['dragDropWindow']);});window.onbeforeunload=function(){var fz=Upload?Upload.fS():false;var fy=Applet?Applet.fy():0;var gG=new Array;if(fz)gG.push(Locale[Upload.fp()?'downloadWarn':'uploadWarn']);if(fy&&fy.size()){var gk=[Locale.openFilesWarn,''];fy.each(function(fileName){gk.push('\t'+fileName);});gG.push(gk.join('\n'));};if(gG.size()<1)return;var returnValue=gG.join('\n\n');return returnValue;};var Listing,Selection,Menu,Loading,dT,Action,Upload,Applet,navTree;function startHumyo(cU,cA){clickUser=cU;clickAuth=cA;$('JSRequired').remove();if(!getUriFrom(window))window.location.hash='/home';Listing=new dO;Selection=new dB;Menu=new ef;Loading=new dN;dT=new eA;Action=new ej;Upload=new gi;Applet=new gh;if($('OrganiseTree')){navTree=new FolderTree('OrganiseTreeList',{onNodeSelected:function(x){window.location.hash=x.memo.data.uri;Event.stop(x.memo.event);},onData:function(x){if(x.memo.B.id=='OrganiseTreeList')$('info_header_link_tree').update(x.memo.data.name);CopyMoveTree.populateNode(x.memo.data);},onContextMenu:function(event){var node=Event.findElement(event,'li');navTree.cp(node);},containerOnly:true,columns:''});Listing.addListener(navTree);Listing.addListener(CopyMoveTree);}var gL=$('search_query');gL.value=Locale.searchTip;gL.observe('focus',function(event){if(gL.value==Locale.searchTip)gL.value='';});if(!((BrowserDetect.ap=='Explorer'&&BrowserDetect.version>=7)||(BrowserDetect.ap=='Firefox'&&BrowserDetect.version>=1.5)||(BrowserDetect.ap=='Safari'&&BrowserDetect.version>=3)||(BrowserDetect.ap=='Opera'&&BrowserDetect.version>=9)||(BrowserDetect.ap=='Chrome'))||(BrowserDetect.OS=='Mac'&&BrowserDetect.ap=='Firefox')){$('BrowserUnsupported').show();if(BrowserDetect.ap=='Explorer'&&BrowserDetect.version==6){$('ie6issues').show();}else if(BrowserDetect.ap=='Firefox'&&BrowserDetect.OS=='Mac'){$('firefoxmacissues').show();$$('#firefoxlogo, #ielogo').invoke('hide');};return;}setTZOffsetCookie();document.fire('humyo:started');};function listDirectory(dir,v){if(!dir)return;if(!v)v={};if(!dir.startsWith('/'))dir='/'+dir;var hg=(cwd.uri||0)==dir;if(!hg|| !v.invisible){Listing.clear(hg);var cN=v.cN||1500;var dr=v.dr||Locale['loading'];var dI=$('body').getHeight()/2;Loading.show({obj:$('BodyContainer'),y:dI,eE:cN,label:dr});}var J=v.cgiParams||new Object;J._session_id=getSID()||'';if(clickUser)J.clickUser=clickUser;if(clickAuth)J.clickAuth=clickAuth;['orderBy','orderDirection','listView','page'].each(function(aF){if(v[aF]){J[aF]=v[aF];}else if(hg){J[aF]=cwd[aF];}});new Ajax.Request('/Pages/ListDir'+dir,{onlyLatestOfClass:'listDir',parameters:J,onFailure:function(response){Loading.hide();var msg=d(response,{j:Locale.listDirError});$('BodyContainer').innerHTML='

    '+msg+'

    ';},onSuccess:function(transport){var responseText=transport.responseText;if(!responseText)return;cwd=responseText.evalJSON(true);for(var i=0,len=cwd.node.length;icwd.pages)page=1;listDirectory(cwd.uri,{page:page});};function refreshDir(fD){if(!fD)fD={};var current=getUriFrom(window);if(fD.fK&&decodeURIComponent(fD.fK)!=decodeURIComponent(current))return;if(!fD.gD)fD.gD=Selection.selectedIds().map(function(i){return cwd.node[i-1].id});var eJ=bv($('BodyContainer'));if(!fD.onComplete)fD.onComplete=function(){bv($('BodyContainer'),eJ);};listDirectory(current,fD);};function goToOrRefresh(dir,fD){if(!dir.startsWith('/'))dir='/'+dir;var hash=getUriFrom(window);if(decodeURIComponent(hash)===decodeURIComponent(dir))refreshDir(fD);return window.location.hash=dir;};function upDir(){if(cwd.parent&&cwd.parent!=0)window.location.hash=cwd.parent;};function orderBy(ed){var direction;if(cwd.orderBy){direction='Asc';if(cwd.orderBy==ed&&cwd.orderDirection=='Asc'){direction='Desc';}}else{direction='Desc';if(cwd.orderBy==ed&&cwd.orderDirection=='Desc'){direction='Asc';}}listDirectory(cwd.uri,{orderBy:ed,orderDirection:direction,page:1,gD:Selection.selectedIds().map(function(i){return cwd.node[i-1].id})});};function goSearch(form){if(!cwd.searchId)return;var cgiParams=form?form.serialize(true):{};var searchId=(cgiParams.id||cwd.searchId);if(!cgiParams.q){var q=$('search_query');if(q&&q.value!=''&&q.value!=Locale.searchTip)cgiParams.q=q.value;}if(!cgiParams.q||cgiParams.q.blank())return;listDirectory(searchId,{cgiParams:cgiParams,dr:Locale.searching});};function ec(data){var HTML='';if(data.path){var start=data.filters&&eT(data)==cwd.path[0].id?1:0;for(var index=start,len=data.path.length;index'+node.name+'';if(index!=len-1)HTML=HTML+' / ';}}$('address').innerHTML=HTML;};function ignoreEvent(event){event=event||window.event;var target=Event.element(event);if(target.tagName=='INPUT'||target.tagName=='TEXTAREA')return;event.cancelBubble=true;if(event.stopPropagation)event.stopPropagation();return false;};function clearTasks(){$("info_tasks").update(Locale['noTasks']);av();};function nothingHappening(){return cC==0?true:false;};function trackEvent(fc,action,label,value){try{pageTracker._trackEvent(fc,action,label,value);}catch(e){};} ; (function(){function showAuthPopup(){alert(Locale.sessionTimeoutWarn);};function notifyAndReload(){showAuthPopup();window.location='/login?redirect='+encodeURI(window.location);};var ajaxAuth={onCreate:function(req,response){var terminateAjax=function(){Ajax.Request.Events._each(function(it){req.options['on'+it]=function(){};});req.options.onFailure=function(){};};['403','300','301','302','303','304','305','307']._each(function(k){var old=req.options['on'+k];if(old){req.options['on'+k]=function(response){terminateAjax();notifyAndReload();return old(response);};}else{req.options['on'+k]=function(response){terminateAjax();return notifyAndReload();};}});}};Ajax.Responders.register(ajaxAuth);return;})(); ;