try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.Publisher=JsonML.BST([""," ",function(){this.resetState();}," ",["div",{"class":"add-panel add-files add-media add-media-new js-add-panel js-FilesPublisher"}," ",["div",{"class":"js-UploadStatus",style:"display:none"}," ",function(){MF.Publisher.UploadStatus.close=this.close;}," "]," ",["div",{"class":"upload-steps js-UploadSteps"}," ",function(){return JsonML.BST(MF.Publisher.UploadQueue).dataBind({},this.index,this.count);}," ",["p",{"class":"submit js-ChooseStep"},["strong","Step 1."]," ",function(){return JsonML.BST(MF.Publisher.Uploader).dataBind({buttonWidth:"111",formUrl:MF.Publisher.uploadUrl,fileTypes:"*.*",fileLabel:"Files",noTransforms:true,queueSize:10,queueMessage:"10 files",fileSize:"1 GB"},this.index,this.count);}," ",["a",{href:"#choose","class":"positive choose",onclick:"return false;"},"Choose ",["span",{"class":"choose-media"},"files"],["span",{"class":"choose-more"},"more"]]," ",["span",{"class":"choose-more"},"or"]," ",["a",{href:"#upload","class":"positive choose-more toggle-target-nohide",onclick:function(){return this.beginUpload;}},"Start upload now"]," "]," "]," ",function(){return JsonML.BST(MF.Publisher.UploadMeter).dataBind({bytesLeft:MF.Publisher.BytesLeft,bytesMax:MF.Publisher.BytesMax,upgradeUrl:MF.Publisher.UpgradeUrl},this.index,this.count);}," "]," "]);(function(){var A;function C(F,E){return{Description:E.description,DisplayAuth:E.previewAuth||E.remasteredAuth||null,DisplayGuid:E.previewID||E.remasteredID||null,FileLength:F.size,MIMEType:E.mimeType,OriginalFileName:F.name,OriginalAuth:E.originalAuth||null,OriginalGuid:E.originalID||null,Title:E.title||F.name};}function D(F,E){A.push(C(F,E));}function B(){if(!A){A=[];}if(!A.length){MF.UnsavedData.markClean("MF.Files.Publisher");MF.Files.Publisher.close();return;}MF.Files.Service.saveFiles(A,{onSuccess:function(E){MF.Publisher.BytesLeft=E.bytesLeft;MF.Publisher.BytesMax=E.bytesMax;MF.Activities.List.display(E.activity);MF.Publisher.UploadStatus.refresh(E);MF.Message.clear(null,MF.Message.Scope.Column);},onFailure:function(G,E,F){MF.Message.showError(null,"Error saving files. Please try again.",MF.Message.Scope.Column);if(MF.isDebug){;}$(".js-FilesPublisher").replaceWith(MF.Files.Publisher.bind());},onComplete:function(){MF.UnsavedData.markClean("MF.Files.Publisher");}});}this.close=function(){MF.UnsavedData.markClean("MF.Files.Publisher");if(MF.Files.cancelUrl){window.location.href=MF.Files.cancelUrl;}else{MF.Publisher.Module.reset.call(this);}return false;};this.resetState=function(){A=[];};this.beginUpload=function(){MF.UnsavedData.markDirty("MF.Files.Publisher","You are still uploading. If you leave this page your upload will be cancelled.");MF.Publisher.Uploader.beginUpload(D,B);return false;};}).call(MF.Files.Publisher);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.List=JsonML.BST(["div",{"class":"js-FileList"}," ",function(){return JsonML.BST(MF.Toolbars.FilterBar).dataBind(MF.Files.List.getSortBarData(this.data),this.index,this.count);}," ",["div",{"class":function(){return this.getNoResultsCss(this.data);},"jbst:visible":function(){return this.data.total===0;}}," ",["p",{"class":"no-content"},"No results match that criteria."]," "]," ",["table",{"class":"data filestable",cellpadding:"0",cellspacing:"0","jbst:visible":function(){return this.data.total!==0;}}," ",["tr"," ",["th",{"class":"meta"},"Type"]," ",["th",{"class":"title",width:"40%"},"File name"]," ",["th",{"class":"meta","jbst:visible":function(){return MF.Files.canDownload;}},"Download"]," ",["th",{"class":"author",width:"15%"},"Added by"]," ",["th",{"class":"meta"},"Size"]," ",["th",{"class":"meta"},"Views"]," ",["th",{"class":"meta"},"Comments"]," ",["th",{"class":"meta",width:"15%"},"Date added"]," "]," ",function(){return JsonML.BST(MF.Files.Item).dataBind(this.data.items,this.index,this.count);}," "]," ",function(){return JsonML.BST(MF.Paging.Pager).dataBind(MF.Paging.Pager.buildData(this.data.start,this.data.count,this.data.total,MF.Files.List.getFiles),this.index,this.count);}," "]);(function(){var C=null;var A=new MF.Toolbars.FilterBarPeopleMenu.Menu(E);var B=new MF.Toolbars.FilterBarMenu.Menu("Sort",[{label:"Recent activity",asc:false},{label:"File name",asc:true},{label:"Added by",asc:true},{label:"Date added",asc:false}],D);var G=false;var F;function E(){MF.Files.List.getFiles(0);}function D(K,H,J){if(J.selectedIdx===H){K.asc=!K.asc;}var I=MF.getQueryParam("start",true,0);MF.Files.Service.getFiles(I,F,null,H,K.asc,A.getSelectedUsers(),{onSuccess:function(L){L=MF.Files.List.bind(L);$("div.js-FileList").replaceWith(L);document.body.scrollIntoView(true);}});return true;}this.getFiles=function(I,H){var J="";if(I!==0){J="?start="+I;}var K=A.getSelectedAsString();if(K.length>0){if(J.length===0){J="?";}else{J+="&";}J+="u="+K;}window.location.href=window.location.pathname+J;};this.getSortBarData=function(H){if(!G){if(H.canAdd){C=new MF.Toolbars.FilterBarButton.Button("Add a new file",MF.Files.uploadUrl);}B.setSelection(H.sortData.colIdx).asc=H.sortData.asc;F=H.count;G=true;}return{items:[C,A,B]};};this.getNoResultsCss=function(H){if(A.getSelectionType()>0){return"";}else{return("files-empty"+(H.canAdd?"":" nopermission"));}};}).call(MF.Files.List);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.Item=JsonML.BST(["tr",{"class":function(){return this.classSelector(this.index);}}," ",["td",{"class":"meta"},["img",{src:function(){return this.iconPicker(this.data.extension);}}]]," ",["td",{"class":"title"},["a",{href:function(){return this.data.contentUrl;}},function(){return(this.data.title.length>0)?this.data.title:this.data.fileName;}]]," ",["td",{"class":"meta","jbst:visible":function(){return MF.Files.canDownload;}},["a",{href:function(){return this.data.downloadUrl;}},["img",{src:"/Images/vicons/standard/download.png",alt:"download"}]]]," ",["td",{"class":"author"},["span",["a",{href:function(){return this.data.authorUrl;}},function(){return this.data.authorName;}]]]," ",["td",{"class":"meta"},function(){return this.data.size;}]," ",["td",{"class":"meta"},function(){return this.data.viewCount;}]," ",["td",{"class":"meta"},function(){return this.data.commentCount;}]," ",["td",{"class":"meta"},function(){return this.data.date.toRelative(MF.ShortDateFormat);}],"\n"]);(function(){this.classSelector=function(A){if(A%2>=1){return"odd";}else{return"";}};this.iconPicker=function(A){switch(A.toLowerCase()){case".jpg":case".jpeg":case".jpe":case".png":case".gif":case".tif":return"/Images/filetypes/img.png";break;case".doc":case".docx":return"/Images/filetypes/doc.png";break;case".asf":case".avi":case".flv":case".mp4":case".mpg":case".mpeg":case".mov":case".rm":case".wmv":return"/Images/filetypes/mov.png";break;case".pdf":return"/Images/filetypes/pdf.png";break;case".ppt":case".pptx":return"/Images/filetypes/ppt.png";break;case".txt":return"/Images/filetypes/txt.png";break;case".xls":case".xlsx":return"/Images/filetypes/xls.png";break;case".zip":return"/Images/filetypes/zip.png";break;case".ged":return"/Images/filetypes/ged.png";break;default:return"/Images/filetypes/generic.png";break;}};}).call(MF.Files.Item);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.Service=new JsonFx.IO.Service("/Features/Files/FilesService.jrpc");MF.Files.Service.getFiles=function(start,count,searchQuery,sortColIdx,sortAscending,userIDs,opt){this.invoke("getFiles",[start,count,searchQuery,sortColIdx,sortAscending,userIDs],opt);};MF.Files.Service.deleteFile=function(contentID,opt){this.invoke("deleteFile",[contentID],opt);};MF.Files.Service.updateMedia=function(files,opt){this.invoke("updateMedia",[files],opt);};MF.Files.Service.saveFiles=function(files,opt){this.invoke("saveFiles",[files],opt);};}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.SingleFile=JsonML.BST([""," ",["div",{"class":"page-title"}," ",["h2",function(){return this.data.title;}]," ",["p",{"class":"filename"}," ",["img",{src:function(){return MF.Files.Item.iconPicker(this.data.extension);}}]," ",function(){return this.data.fileName;}," \u2022 ",function(){return this.data.fileSize;}," "]," "]," ",["div",{"class":"files-content"}," ",["p"," ",function(){return JsonML.raw(this.data.description);}," "]," "]]);(function(){this.deleteFile=function(B,A,C){MF.Files.Service.deleteFile(B,{onSuccess:function(D){C();window.location=D.url;}});};this.editFile=function(B,A){window.location.pathname=MF.Files.EditUrl;};}).call(MF.Files.SingleFile);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.EditList=JsonML.BST(["form",{action:"",method:"post"}," ",["div",{"class":"pvdisplay edit"}," ",function(){return JsonML.BST(MF.Files.EditItemRow).dataBind(MF.splitArray(this.data.items,4),this.index,this.count);}," "]," ",["p",{"class":"submit"}," ",["a",{"class":"positive",onclick:function(){return MF.Files.EditList.dataSave();}},"Save changes"]," or ",["a",{href:function(){return this.data.cancelUrl;}},"cancel"]," "]," "]);(function(){this.dataSave=function(){return function(){var A=$(this).parents("form");var C=MF.Forms.getFormData(A);for(var B in C.Files){C.Files[B].ContentTags=C.Files[B].ContentTags.split(",");if(!C.Files[B].Description){C.Files[B].Description="";}}MF.Files.Service.updateMedia(C.Files,{onSuccess:function(D){window.location.href=D;}});return false;};};}).call(MF.Files.EditList);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.EditItem=JsonML.BST(["div",{"class":"box"}," ",["table",{cellspacing:"0",cellpadding:"0"}," ",["tbody"," ",["tr"," ",["input",{type:"hidden",value:function(){return this.data.contentId;},name:function(){return"Files$"+(this.index+MF.Files.EditItemRow.index*4)+"$ContentID";}}]," ",["td",{"class":"file-name"}," ",["img",{src:function(){return MF.Files.Item.iconPicker(this.data.extension);}}]," ",function(){return this.data.fileName;}]," "]," ",["tr"," ",["td",{"class":"info"}," ",["p",{"class":"title"}," ",["input",{"class":"active",type:"text",value:function(){return this.data.title;},name:function(){return"Files$"+(this.index+MF.Files.EditItemRow.index*4)+"$Title";}}]," "]," ",["p",{"class":"desc"}," ",["textarea",{"class":"js-InlineInstruction",title:"Add a description",name:function(){return"Files$"+(this.index+MF.Files.EditItemRow.index*4)+"$Description";}},function(){return this.data.description;}]," "]," ",["div",{"class":"js-tagSection"}," ",["p",{"class":"tags clearfix js-tagForm"}," ",["label",{"for":""},"Tags:"]," ",["input",{"class":"active js-newTag",type:"text",value:"",name:"",onkeypress:function(){return MF.Files.EditItem.keyDetect();}}]," ",["a",{"class":"positive",onclick:"MF.Files.EditItem.addTag(this);"},"Add"]," "]," ",["p",{"class":"tags-added js-tagList"}," ",function(){return JsonML.BST(MF.Files.EditItemTag).dataBind(this.data.tags,this.index,this.count);}," ",["input",{type:"hidden","class":"js-tags",value:function(){return this.data.tags.join(",");},name:function(){return"Files$"+(this.index+MF.Files.EditItemRow.index*4)+"$ContentTags";}}]," "]," "]," "]," "]," "]," "]," "]);(function(){this.tagExists=function(B,D){var A=false;for(var C=0;C<B.length;C++){A=(B[C]==D);if(A){break;}}return A;};this.addTag=function(D){var B=$(D).parents(".js-tagForm").children(".js-newTag");var A=B.val();var C=B.parents(".js-tagSection").children(".js-tagList");var E=C.children(".js-tags");if(A.length>0){A=A.split(",");for(var F=0;F<A.length;F++){A[F]=A[F].trim();if(!MF.Files.EditItem.tagExists(E.val().split(","),A[F])){C.append(MF.Files.EditItemTag.bind(A[F]));if(E.val()===""){E.val(A[F]);}else{E.val(E.val()+","+A[F]);}}}}B.val("");return false;};this.keyDetect=function(){return function(B){B=B?B:window.event;var A=Number(B.keyCode||B.charCode);switch(A){case 27:this.blur();return false;case 13:MF.Files.EditItem.addTag(this);return false;default:return true;}};};}).call(MF.Files.EditItem);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.EditItemTag=JsonML.BST(["span"," ",function(){return this.data;}," ",["a",{"class":"delete",href:"#removeTag",onclick:function(){return this.removeTag(this.data);}},"Delete tag"]," "]);(function(){this.removeTag=function(A){return function(){var C=$(this);var B=C.parents(".js-tagList").children(".js-tags");var E=B.val().split(",");for(var D=0;D<E.length;D++){if(A===E[D]){E.splice(D,1);break;}}B.val(E.join(","));C.parents("span").remove();return false;};};}).call(MF.Files.EditItemTag);}catch(ex){}try{var MF;if("undefined"===typeof MF){MF={};}if("undefined"===typeof MF.Files){MF.Files={};}MF.Files.EditItemRow=JsonML.BST(["div",{"class":"pvrow clearfix"}," ",function(){return JsonML.BST(MF.Files.EditItem).dataBind(this.data,this.index,this.count);}," "]);}catch(ex){}