//this is a .html file instead of a .js so that FBT will serve the page with substr for all SUBS var prevEditFolder=-1; var prevFolder=-1; var prevFile=[]; function selectFolder(id,att){ var i; if(prevFolder>=0&&prevFolder!=id){ document.getElementById("attachFolder"+prevFolder).style.background=''; } if(prevEditFolder>=0&&prevEditFolder!=id){ document.getElementById("rowFolder"+prevEditFolder).style.display='none'; prevEditFolder=-1; } while(prevFile.length>0){ i=prevFile.shift(); document.getElementById("attachFile"+i).style.background=''; document.getElementById("showAttachFile"+i).style.display='none'; document.getElementById("rowAttach"+i).style.display='none'; } if(prevAttach>=0){ document.getElementById("showAttachFile"+prevAttach).style.background=''; document.getElementById("rowAttach"+prevAttach).style.display='none'; } document.getElementById("attachFolder"+id).style.background='#aaaaaa'; if(att.length>0){ document.getElementById("attachFolderEmpty").style.display="none"; //document.getElementById("attachmentInfoTable").style.borderBottom="1px solid black"; for(i=0;i=0){ document.getElementById("attachFolder"+prevFolder).style.background=''; } while(prevFile.length>0){ i=prevFile.shift(); if(i!=id){ document.getElementById("attachFile"+i).style.background=''; document.getElementById("showAttachFile"+i).style.display='none'; document.getElementById("rowAttach"+i).style.display='none'; } } if(prevAttach>=0){ document.getElementById("showAttachFile"+prevAttach).style.background=''; document.getElementById("rowAttach"+prevAttach).style.display='none'; } document.getElementById("attachFolderEmpty").style.display="none"; document.getElementById("attachFile"+id).style.background='#aaaaaa'; document.getElementById("showAttachFile"+id).style.display=''; document.getElementById("attachmentInfoTable").style.borderBottom="1px solid black"; selectAttach(id); prevFolder=-1; prevFile=[id]; } var prevAttach=-1; function selectAttach(id){ document.getElementById("attachmentInfoTable").style.borderBottom="1px solid black"; if(prevEditFolder>=0){ document.getElementById("rowFolder"+prevEditFolder).style.display='none'; } if(prevAttach>=0){ document.getElementById("showAttachFile"+prevAttach).style.background=''; document.getElementById("rowAttach"+prevAttach).style.display='none'; } document.getElementById("attachFolderEmpty").style.display="none"; document.getElementById("showAttachFile"+id).style.background='#aaaaaa'; if(id!=prevAttach){ //toggle if not selecting another one document.getElementById("rowAttach"+id).style.display=''; prevAttach=id; } else { prevAttach=-1; } prevEditFolder=-1; } function deleteVersion(id,vid,vfile){ var sat; sat=document.getElementById("versionList"+id+"_"+vid); sat.style.opacity=0.4; sat.style.filter='alpha(opacity=40)'; document.getElementById("updatedAttach").style.display='block'; document.getElementById("deleteVersionLink"+id+"_"+vid).style.display='none'; document.getElementById("restoreVersionLink"+id+"_"+vid).style.display='inline'; document.getElementById("swapVersionLink"+id+"_"+vid).style.display='none'; document.entry_form["deletedVersion"+id].value+=" "+vfile; } function attachAdvanced(check,id){ if(check){ var sat=document.getElementById("attachAdvanced"+id); if(sat){ if(check.checked){ sat.style.display=""; }else{ sat.style.display="none"; } } } } function showEditFolderMenu(id){ var editDiv=document.getElementById("attachFolder"+id); var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editDiv&&editFolderDiv){ var x=0; var y=0; var e=editDiv; while(e!=null){ x+=e.offsetLeft; y+=e.offsetTop; e=e.offsetParent; } editFolderDiv.style.left=(x+editDiv.offsetWidth)+'px'; editFolderDiv.style.top=y+'px'; editFolderDiv.style.display=""; editFolderDiv.folderId=id; if(editFolderDiv.hideEvent!=null){ clearTimeout(editFolderDiv.hideEvent); } editFolderDiv.hideEvent=null; } } function hideEditFolderMenu(id){ var editDiv=document.getElementById("attachFolder"+id); var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editDiv&&editFolderDiv){ if(!editFolderDiv.beingUsed){ editFolderDiv.style.display="none"; } } } function hideEditFolder(id){ var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editFolderDiv){ editFolderDiv.hideEvent=setTimeout('hideEditFolderMenu('+id+');',500); } } function createSubFolder(e){ var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editFolderDiv&&editFolderDiv.folderId){ var id=editFolderDiv.folderId; var editDiv=document.getElementById("attachFolder"+id); if(editDiv){ hideEditFolder(id); am.createSubFolder(e,id); } } } function moveFolder(e){ var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editFolderDiv&&editFolderDiv.folderId){ var id=editFolderDiv.folderId; var editDiv=document.getElementById("attachFolder"+id); if(editDiv){ hideEditFolder(id); am.moveFolder(e,id); } } } function deleteFolder(e){ var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editFolderDiv&&editFolderDiv.folderId){ var id=editFolderDiv.folderId; var editDiv=document.getElementById("attachFolder"+id); if(editDiv){ hideEditFolder(id); am.delFolder(e,id); } } } function renameFolder(e){ var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editFolderDiv&&editFolderDiv.folderId){ var id=editFolderDiv.folderId; var editDiv=document.getElementById("attachFolder"+id); if(editDiv){ hideEditFolder(id); am.renameFolder(e,id); } } } function globalFolder(e){ var editFolderDiv=document.getElementById("attachFolderEditMenu"); if(editFolderDiv&&editFolderDiv.folderId){ var id=editFolderDiv.folderId; var editDiv=document.getElementById("attachFolder"+id); if(editDiv){ hideEditFolder(id); am.globalFolder(e,id); } } } function showAttachInFolder(){ var showImg=document.getElementById("showAttachImg"); var hideImg=document.getElementById("hideAttachImg"); if(am&&showImg&&hideImg){ am.showAttachments(); showImg.style.display="none"; hideImg.style.display=""; am.refreshHtml(); } } function hideAttachInFolder(){ var showImg=document.getElementById("showAttachImg"); var hideImg=document.getElementById("hideAttachImg"); if(am&&showImg&&hideImg){ am.hideAttachments(); showImg.style.display=""; hideImg.style.display="none"; am.refreshHtml(); } } function showComment(e,aId){ //alert(aId); if(aId>0){ var attach=am.getAttachment(aId); //alert(attach); if(attach){ fitPopup(e,"\

"+attach.getFilename()+"

\

: "+attach.getComment()+"

\ "); } } } function Folder(fId,fName,fParentId,fGlobal){ this.id=0; this.name=""; this.parentId=0; this.global=false; this.hasBeenCreated=false; this.hasBeenEdited=false; this.hasBeenDeleted=false; this.hasBeenMoved=false; this.getId=function(){return(this.id);} this.getName=function(){return(this.name);} this.getParentId=function(){return(this.parentId);} this.isGlobal=function(){return(this.global);} this.isCreated=function(){return(this.hasBeenCreated);} this.isEdited=function(){return(this.hasBeenEdited);} this.isDeleted=function(){return(this.hasBeenDeleted);} this.isMoved=function(){return(this.hasBeenMoved);} this.setId=function(id){ if(typeof(id)=="number"&&id>0){ this.id=id; } return(this.id); } this.setName=function(name){ if(typeof(name)=="string"&&name!=""){ this.name=name; } return(this.name); } this.setParentId=function(parentId){ if(typeof(parentId)=="number"&&parentId>=0){ this.parentId=parentId; } return(this.parentId); } this.setGlobal=function(state){ if(state){ this.global=true; }else{ this.global=false; } } this.created=function(state){ if(state){ this.hasBeenCreated=true; this.edited(true); }else{ this.hasBeenCreated=false; } } this.edited=function(state){ if(state){ this.hasBeenEdited=true; }else{ this.hasBeenEdited=false; } } this.deleted=function(state){ if(state){ this.hasBeenDeleted=true; this.edited(true); }else{ this.hasBeenDeleted=false; } } this.moved=function(state){ if(state){ this.hasBeenMoved=true; this.edited(true); }else{ this.hasBeenMoved=false; } } this.setId(fId); this.setName(fName); this.setParentId(fParentId); this.setGlobal(fGlobal); } function Attachment(aId,fId,aFilename,aSize,aUrl,aComment,aVersion,aUploadedBy,aDate){ this.id=0; this.folderId=0; this.filename=""; this.size="?"; this.url=""; this.comment=""; this.version=""; this.uploadedBy=""; this.date=""; this.hasBeenEdited=false; this.hasBeenDeleted=false; this.uploadFile=null; this.versionList=[]; this.deletedVersionList=[]; this.getId=function(){return(this.id);} this.getFolderId=function(){return(this.folderId);} this.getFilename=function(){return(this.filename);} this.getSize=function(){return(this.size);} this.getUrl=function(){return(this.url);} this.getComment=function(){return(this.comment);} this.getVersion=function(){return(this.version);} this.getUploadedBy=function(){return(this.uploadedBy);} this.getDate=function(){return(this.date);} this.getUploadFile=function(){return(this.uploadFile);} this.getVersionList=function(){return(this.versionList);} this.getDeletedVersionList=function(){return(this.deletedVersionList);} this.isEdited=function(){return(this.hasBeenEdited);} this.isDeleted=function(){return(this.hasBeenDeleted);} this.setId=function(id){ if(typeof(id)=="number"&&id>0){ this.id=id; } return(this.id); } this.setFolderId=function(folderId){ if(typeof(folderId)=="string"){ folderId=parseInt(folderId); } if(typeof(folderId)=="number"&&folderId>=0){ this.folderId=folderId; } return(this.folderId); } this.setFilename=function(filename){ if(typeof(filename)=="string"&&filename!=""){ this.filename=filename; } return(this.filename); } this.setSize=function(size){ if(typeof(size)=="string"&&size!=""){ this.size=size; } return(this.size); } this.setUrl=function(url){ if(typeof(url)=="string"&&url!=""){ this.url=url; } return(this.url); } this.setComment=function(comment){ if(typeof(comment)=="string"){ this.comment=comment; } return(this.comment); } this.setVersion=function(version){ if(typeof(version)=="string"){ this.version=version; } return(this.version); } this.setUploadedBy=function(uploadedBy){ if(typeof(uploadedBy)=="string"&&uploadedBy!=""){ this.uploadedBy=uploadedBy; } return(this.uploadedBy); } this.setDate=function(date){ if(typeof(date)=="string"&&date!=""){ this.date=date; } return(this.date); } this.setUploadFile=function(file){ if(typeof(file)=="object"){ this.uploadFile=file; } return(this.uploadFile); } this.edited=function(state){ if(state){ this.hasBeenEdited=true; }else{ this.hasBeenEdited=false; } } this.deleted=function(state){ if(state){ this.hasBeenDeleted=true; this.edited(true); }else{ this.hasBeenDeleted=false; } } this.addVersion=function(version){ if(version&&version.getId()>0){ var found=false; for(var i=0;i0){ for(var i=0;i0){ this.id=id; } return(this.id); } this.setAttachmentId=function(attachId){ if(typeof(attachId)=="string"){ attachId=parseInt(attachId); } if(typeof(attachId)=="number"&&attachId>=0){ this.attachId=attachId; } return(this.attachId); } this.setFilename=function(filename){ if(typeof(filename)=="string"&&filename!=""){ this.filename=filename; } return(this.filename); } this.setSize=function(size){ if(typeof(size)=="string"&&size!=""){ this.size=size; } return(this.size); } this.setUrl=function(url){ if(typeof(url)=="string"&&url!=""){ this.url=url; } return(this.url); } this.setComment=function(comment){ if(typeof(comment)=="string"&&comment!=""){ this.comment=comment; } return(this.comment); } this.setVersion=function(version){ if(typeof(version)=="string"&&version!=""){ this.version=version; } return(this.version); } this.setUploadedBy=function(uploadedBy){ if(typeof(uploadedBy)=="string"&&uploadedBy!=""){ this.uploadedBy=uploadedBy; } return(this.uploadedBy); } this.setDate=function(date){ if(typeof(date)=="string"&&date!=""){ this.date=date; } return(this.date); } this.setUploadFile=function(file){ if(typeof(file)=="object"){ this.uploadFile=file; } return(this.uploadFile); } this.edited=function(state){ if(state){ this.hasBeenEdited=true; }else{ this.hasBeenEdited=false; } } this.deleted=function(state){ if(state){ this.hasBeenDeleted=true; }else{ this.hasBeenDeleted=false; } } this.setId(vId); this.setAttachmentId(aId); this.setSize(vSize); this.setUrl(vUrl); this.setComment(vComment); this.setVersion(vVersion); this.setUploadedBy(vUploadedBy); this.setDate(vDate); } function AttachmentManager(div){ if(div){ if(typeof(div)=="string"){ this.container=document.getElementById(div); }else if(div.style){ this.container=div; }else{ this.container=document.getElementById("AttachmentManager"); } }else{ this.container=document.getElementById("AttachmentManager"); } this.folder=new Object(); this.folderRoot=null; this.folderInfo=new Object(); this.folderList=[]; this.folderMap=new Object(); this.folderMaxId=0; this.allowDelete=true; this.attach=new Object(); this.attachInfo=new Object(); this.attachList=[]; this.attachMap=new Object(); this.hideAttach=true; this.hideComment=false; this.hideVersion=false; this.editableAttach=false; this.editableFolder=false; this.editableGlobal=false; this.areAttachmentsEditable=function(){ return(this.editableAttach); } this.areCommentsHidden=function(){ return(this.hideComment); } this.isVersionHidden=function(){ return(this.hideVersion); } this.areFoldersEditable=function(){ return(this.editableFolder); } this.isDeleteAllowed=function(){ return(this.allowDelete); } this.isGlobalEditable=function(){ return(this.editableGlobal); } this.setAllowDelete=function(state){ if(state){ this.allowDelete=true; }else{ this.allowDelete=false; } } this.setAttachmentsEditable=function(state){ if(state){ this.editableAttach=true; }else{ this.editableAttach=false; } } this.setHideComments=function(state){ if(state){ this.hideComment=true; }else{ this.hideComment=false; } } this.setHideVersion=function(state){ if(state){ this.hideVersion=true; }else{ this.hideVersion=false; } } this.setFoldersEditable=function(state){ if(state){ this.editableFolder=true; }else{ this.editableFolder=false; } } this.setGlobalEditable=function(state){ if(state){ this.editableGlobal=true; }else{ this.editableGlobal=false; } } this.hideAttachments=function(){ this.hideAttach=true; } this.showAttachments=function(){ this.hideAttach=false; } this.folderExists=function(folder){ var exists=false; if(folder!=null){ var pId=folder.getParentId(); var id="fi"+pId; var list=this.folderInfo[id]; if(list){ for(var i=0;ithis.folderMaxId)this.folderMaxId=fId; } if(!this.folder["f"+fId]){ this.folderList.push(folder); this.folderMap["fm"+fId]=this.folderList.length; this.folder["f"+fId]=folder; } } } this.deleteFolder=function(fId){ var folder; if(fId>0){ folder=this.getFolder(fId); if(folder){ folder.deleted(true); var pId=folder.getParentId(); var id="fi"+pId; var list=this.folderInfo[id]; if(list){ for(var i=0;i=0){ folder=this.folder["f"+fId]; } return(folder); } this.attachmentExists=function(attach){ var exists=false; if(attach!=null){ var fId=attach.getFolderId(); var id="ai"+fId; var list=this.attachInfo[id]; if(list){ for(var i=0;i0){ attach=this.attach["a"+aId]; } return(attach); } this.moveAttach=function(aId,fId){ var attach=this.getAttachment(aId); if(attach){ if(fId>=0&&attach.getFolderId()!=fId){ this.deleteAttachment(attach.getId()); attach.setFolderId(fId); this.addAttachment(attach); attach.deleted(false); } } } this.getFolderHiddenHtml=function(){ var html=""; for(var i=0;i"; if(folder.isEdited()){ html+="\ \ \ \ "; if(folder.isCreated()){ html+="\ "; } }else{ html+="\ \ \ \ "; } if(folder.isGlobal()){ html+=""; } } return(html); } this.getAttachmentList=function(aList){ var list=""; if(aList&&aList.length>0){ var sep=""; for(var i=0;icom/other/plus_black.gif\" style=\"visibility:hidden;\"> "; var indentHtml=""; for(var i=0;i"+indentHtml+"0)||(!this.hideAttach&&aList&&aList.length>0)){ html+="visible"; }else{ html+="hidden"; } var toggleInner=document.getElementById("toggleFolder"+jId+"_INNER"); html+=";\"> com/other/"+(folder.isGlobal()?"gfolder.gif":"folder.gif")+"\"> "+folder.getName(); if(this.areFoldersEditable()){ html+="
"; } html+="
"; if(fList&&fList.length>0){ for(var i=0;i0){ var display="display:none;"; if(!this.hideAttach){ display=""; } indentHtml+=indentString+indentString; for(var i=0;i"+indentHtml+"com/other/text.gif\" "; if(!this.hideComment){ html+="alt=\""+aList[i].getComment()+" XXX1\" title=\""+aList[i].getComment()+"\" "; } html+="border=0> "+aList[i].getFilename()+"
"; } } html+=""; return(html); } this.getAttachmentHtml=function(){ var showHtml=""; var html="\ "; var colspan=5; enableMailAtt = (typeof enableMailAtt != 'undefined' && enableMailAtt); var mailAttHead = ""; if (enableMailAtt) { mailAttHead = ""+mailAttHead+""; } else { html += ""+mailAttHead+""; } html+="\ \ "; for(var i=0;i"; if(!this.hideVersion){ html+=""; } html+=""; if(!this.hideComment){ html+=""; } if(attach.getUploadFile()!=null){ attach.getUploadFile().style.display="none"; document.getElementById("updatedAttach").appendChild(attach.getUploadFile()); } html+=""; html+=""; html+=""; }else{ html+="\ \ \ \ "; } html+="\ \ "; if (enableMailAtt) { html+=""; } html+="\ "; if (!this.hideVersion){ html+="\ "; } html+="\ \ \ "; var linkHtml="\
com/other/mailAtt.png\" border=0 alt=\"Attach to Notification\" title=\"Attach to Notification\">"; } if(this.hideVersion){ colspan--; html += "
"; if (0) { // not a big fan of this if(!this.hideComment){ html+="\ com/other/comment.gif\" border=0 "; html+="\ alt=\""+attach.getComment()+"\" title=\""+attach.getComment()+"\" \ onclick=\"showComment(event,"+attach.getId()+");\" "; } html+=(attach.getComment().length>0?"":"style=\"visibility:hidden;\"")+">"; } html+="\ com/other/text.gif\" "; if(!this.hideComment){ html+="alt=\""+attach.getComment()+"XXX2\" title=\""+attach.getComment()+"\" "; } var size = ""; if (attach.getSize()!="?") { size = attach.getSize(); } html+="\ border=0>"+attach.getFilename()+""+size+""+attach.getVersion()+""+attach.getUploadedBy()+""+attach.getDate()+"
\ \ \ \
\
\ []\
"; if(this.areAttachmentsEditable()){ linkHtml+="\
\ []\
"; if(this.isDeleteAllowed()){ linkHtml+="\
\ []\
"; } } linkHtml+="\
"; showHtml+="\ \ \ \ "; showHtml+="\ \ "; var vList=attach.getVersionList(); if(vList&&vList.length>0){ showHtml+="\ \ \ \ \ \ "; } showHtml+="\
"+attach.getFilename()+"\
com/other/info.gif\" onclick='fitInfo(event,\"Copy and paste this text into a TextArea field to embed the attached image\");'>
\
\ "; if (!this.hideVersion){ showHtml+="\ "; linkHtml=""; // otherwise shown with size below } if (attach.getSize()!="?") { showHtml+="\ "; } showHtml+="\ \ "; if(!this.hideComment){ showHtml+="\ "; } if(attach.isEdited()){ if(attach.getUploadFile()!=null){ showHtml+="\ "; } showHtml+="\ \ "; } showHtml+="\
:"+linkHtml+attach.getVersion()+"
:"+linkHtml+attach.getSize()+"
:"+attach.getUploadedBy()+"
:"+attach.getDate()+"
:"+attach.getComment()+"
:"+attach.getUploadFile().value+"
 
\
\
\ com/other/plus_black.gif\" onclick=\"toggleInnerSection('versionAttach"+id+"');\">\ :\
\ "; for(var j=0;j\
\ []\
"; if(this.areAttachmentsEditable()&&this.isDeleteAllowed()){ linkHtml+="\
\ []\
"; } linkHtml+="\ \ \
"; showHtml+="\

\
\ "; if (!this.hideVersion) { showHtml+="\ "; linkHtml=""; } if (vList[j].getSize()!="?") { showHtml+="\ "; linkHtml=""; } showHtml+="\ \ "; if(!this.hideComment){ showHtml+="\ "; } showHtml+="\
:"+linkHtml+vList[j].getVersion()+"
:"+linkHtml+vList[j].getSize()+"
:"+linkHtml+vList[j].getUploadedBy()+"
:"+vList[j].getDate()+"
:"+vList[j].getComment()+"
\
\
\ \ \ "; } showHtml+="\ \ "; } } html+=""; return(html+showHtml); } this.getFolderEditHtml=function(){ var html="\
\
\
\
"; if(this.isDeleteAllowed()){ html+="\
"; } if(this.isGlobalEditable()){ html+="\
"; } html+="
"; return(html); } this.getFolderMoveHtml=function(folderRoot,folder,selectName,indent,moveAttach,id){ if(!folderRoot){folderRoot=this.folderRoot;} var fId=folderRoot.getId(); var fList=this.folderInfo["fi"+fId]; var html=""; var indentString=""; if(indent==0&&selectName!=""){ html+="" )+ ( this.hideVersion?"": ":" )+"\ :\ Move To:"+this.getFolderMoveHtml(this.folderRoot,folder,"moveto",0,true)+"\ \
\ \ "); } } } this.editAttachSave=function(id,form){ if(id&&id>0){ var attach=this.attachList[id-1]; if(attach&&form){ var testAttach=new Attachment(attach.getId(),form["moveto"].options[form["moveto"].selectedIndex].value,attach.getFilename()); if(attach.getFolderId()==testAttach.getFolderId()||!this.attachmentExists(testAttach)){ attach.edited(true); if(form["comment"]) attach.setComment(form["comment"].value); if(form["version"]) attach.setVersion(form["version"].value); if(form["updateAttach"+id]&&form["updateAttach"+id].value!=""){attach.setUploadFile(form["updateAttach"+id]);} am.moveAttach(attach.getId(),form["moveto"].options[form["moveto"].selectedIndex].value); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); }else{ alert("Unable to move attachment. An attachment with filename "+attach.getFilename()+" already exists."); } } } cal_hide(); } this.deleteAttach=function(e,id){ if(id&&id>0){ var attach=this.attachList[id-1]; if(attach){ fitPopup(e,"\
\

"+attach.getFilename()+"

\
\

Are you sure you want to delete this attachment?

\
\

\ \ \

\
\ "); } }else{ fitPopup(e,"You have selected an unknown attachment id."); } } this.deleteAttachSave=function(id,form){ if(id&&id>0){ var attach=this.attachList[id-1]; if(attach){ attach.edited(true); am.deleteAttachment(attach.getId()); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); } } cal_hide(); } this.createSubFolder=function(e,id){ if(id&&id>0){ var folder=this.folderList[id-1]; if(folder){ fitPopup(e,"\
\

"+folder.getName()+"

\
\

Name of sub folder to be created:

\
" + ((this.isGlobalEditable()) ? "\

Check the checkbox to make the folder a global folder: \

" : "") +"\
\

\
\ "); if(document.forms[document.forms.length-1].subfolder){ document.forms[document.forms.length-1].subfolder.focus(); } } } } this.createSubFolderSave=function(id,form){ if(id&&id>=0){ var folder=this.folderList[id-1]; if(folder&&form&&form["subfolder"].value!=""){ var name=form["subfolder"].value; if(name&&name.length>0){ this.folderMaxId+=1; var subFolder=new Folder(this.folderMaxId,name,folder.getId()); if(!this.folderExists(subFolder)){ subFolder.created(true); if(form["global"] && form["global"].checked){ subFolder.setGlobal(true); } am.addFolder(subFolder); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); }else{ alert("Unable to create folder. A folder named "+name+" already exists."); return; } }else{ alert("The folder must be given a name."); return; } } } cal_hide(); } this.moveFolder=function(e,id){ if(id&&id>1){ var folder=this.folderList[id-1]; if(folder){ fitPopup(e,"\
\

"+folder.getName()+"

\
\

Move To: "+this.getFolderMoveHtml(this.folderRoot,folder,"moveFolderList",0,false)+"

\
\

\ \

\
\ "); } }else{ fitPopup(e,"\ You are not allowed to move the "+this.folderRoot.getName()+" folder."); } } this.moveFolderSave=function(id,form){ if(id&&id>0){ var folder=this.folderList[id-1]; if(folder){ var newParentId=parseInt(form["moveFolderList"].options[form["moveFolderList"].selectedIndex].value); if(newParentId>=0&&newParentId!=folder.getParentId()){ var testFolder=new Folder(folder.getId(),folder.getName(),newParentId); if(!this.folderExists(testFolder)){ this.deleteFolder(folder.getId()); folder.setParentId(newParentId); this.addFolder(folder); folder.moved(true); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); }else{ alert("Unable to move folder. A folder with the name "+folder.getName()+" already exists."); return; } } } } cal_hide(); } this.delFolder=function(e,id){ if(id&&id>1){ var folder=this.folderList[id-1]; if(folder){ fitPopup(e,"\
\

"+folder.getName()+"

\
\

Are you sure you want to delete this folder?

\
\

\ \ \

\
\ "); } }else{ fitPopup(e,"\ You are not allowed to delete the "+this.folderRoot.getName()+" folder."); } } this.delFolderSave=function(id,form){ if(id&&id>0){ var folder=this.folderList[id-1]; if(folder){ folder.edited(true); am.deleteFolder(folder.getId()); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); } } cal_hide(); } this.renameFolder=function(e,id){ if(id&&id>1){ var folder=this.folderList[id-1]; if(folder){ fitPopup(e,"\
\

"+folder.getName()+"

\
\

Type in the new name for the "+folder.getName()+" folder: \

\
\

\ \

\
\ "); if(document.forms[document.forms.length-1].newname){ document.forms[document.forms.length-1].newname.focus(); document.forms[document.forms.length-1].newname.select(); } } }else{ fitPopup(e,"\ You are not allowed to rename the "+this.folderRoot.getName()+" folder."); } } this.renameFolderSave=function(id,form){ if(id&&id>1){ var folder=this.folderList[id-1]; if(folder&&form&&form["newname"].value!=""){ folder.edited(true); folder.setName(form["newname"].value); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); } } cal_hide(); } this.globalFolder=function(e,id){ if(id&&id>1){ var folder=this.folderList[id-1]; if(folder){ fitPopup(e,"\
\

"+folder.getName()+"

\
" + ((this.isGlobalEditable()) ? "\

Check the checkbox to make the folder a global folder: \

" : "") + "\
\

\ \

\
\ "); } }else{ fitPopup(e,"\ You are not allowed to change the global status of the "+this.folderRoot.getName()+" folder."); } } this.globalFolderSave=function(id,form){ if(id&&id>1){ var folder=this.folderList[id-1]; if(folder&&form&&form["global"]){ if(folder.isGlobal()){ if(!form["global"].checked){ folder.setGlobal(false); folder.edited(true); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); } }else{ if(form["global"].checked){ folder.setGlobal(true); folder.edited(true); document.getElementById("updatedAttach").style.display='block'; am.refreshHtml(); } } } } cal_hide(); } this.refreshHtml=function(){ var display="none"; if(document.getElementById("updatedAttach")){ display=document.getElementById("updatedAttach").style.display; } var html="\ \ \ \
\ \
\ com/other/text.gif\" style=\"float:right;"+(this.hideAttach?"":"display:none;")+"\" onclick=\"showAttachInFolder();\" title=\"\">com/other/folder.gif\" style=\"float:right;"+(this.hideAttach?"display:none;":"")+"\" onclick=\"hideAttachInFolder();\" title=\"\">
"; if(this.areFoldersEditable()){html+=this.getFolderEditHtml();} if(this.folderRoot){ html+=this.getFolderHiddenHtml()+this.getFolderHtml(this.folderRoot,0); } html+="
"+this.getAttachmentHtml()+"
"; if(this.areFoldersEditable()&&document.createElement){ var form=document.createElement("form"); if(form){ form.innerHTML=this.getFolderMoveHtml(this.folderRoot,this.folderRoot,"tempFolderList",0,true); for(var i=1;i<=promptMax;i+=1){ if(document.entry_form&&document.entry_form["uploadfolderBackground"+i]){ var uf=document.entry_form["uploadfolderBackground"+i]; uf.options.length=0; for(var j=0;j0){ var el=document.getElementById("attachFolder"+prevFolder); if(!el){ prevFolder=-1; el=document.getElementById("attachFolder1"); } if(el){ el.onclick(); }else{ prevFolder=-1; } } } }