% ' Version 4.001 ' Revised 19th Sept 07 On Error Resume Next ' Security check if session("admin") = "" then %> <% response.End() end if dim Path, SubFolder dim SelectedFileName, EditorSource, EditorSourceObject dim ActionCopyFile, ActionDeleteFile, ActionRenameFile dim ActionRenameFolder, ActionDeleteFolder, ActionCreateFolder dim NewFileName, OldFileName dim NewFolderName, CreateFolderName dim i Path = trim(request("Path")) if Path = "undefined" then Path = "images" SubFolder = trim(request("SubFolder")) if SubFolder <> "" then if Path = "" then Path = Path & SubFolder else Path = Path & "\" & SubFolder end if end if SelectedFileName = trim(request("SelectedFileName")) EditorSource = trim(request("EditorSource")) ' editor, filename, filepath, nothing EditorSourceObject = trim(request("EditorSourceObject")) ' object id to return filename or filepath to if EditorSourceObject = "" then EditorSourceObject = "none" ActionCopyFile = trim(request("ActionCopyFile")) if ActionCopyFile = "" then ActionCopyFile = false else ActionCopyFile = true end if ActionDeleteFile = trim(request("ActionDeleteFile")) if ActionDeleteFile = "" then ActionDeleteFile = false else ActionDeleteFile = true end if ActionRenameFile = trim(request("ActionRenameFile")) if ActionRenameFile = "" then ActionRenameFile = false else ActionRenameFile = true end if NewFileName = trim(request("NewFileName")) OldFileName = trim(request("OldFileName")) ActionDeleteFolder = trim(request("ActionDeleteFolder")) if ActionDeleteFolder = "" then ActionDeleteFolder = false else ActionDeleteFolder = true end if ActionCreateFolder = trim(request("ActionCreateFolder")) if ActionCreateFolder = "" then ActionCreateFolder = false else ActionCreateFolder = true end if CreateFolderName = trim(request("CreateFolderName")) ActionRenameFolder = trim(request("ActionRenameFolder")) if ActionRenameFolder = "" then ActionRenameFolder = false else ActionRenameFolder = true end if NewFolderName = trim(request("NewFolderName")) ' Actions dim ActionFS set ActionFS = CreateObject("Scripting.FileSystemObject") ' Files ' Rename File if ActionRenameFile then if ActionFS.FileExists(EditorRootFolderPath & Path & "\" & NewFileName) then call FMPageMessage("File with that name already exists", "Warning") else if ActionFS.FileExists(EditorRootFolderPath & Path & "\" & OldFileName) then ActionFS.MoveFile(EditorRootFolderPath & Path & "\" & OldFileName), (EditorRootFolderPath & Path & "\" & NewFileName) if err.number = 0 then call FMPageMessage("Renamed " & OldFileName & " to " & NewFileName & " successfully", "Success") else call FMPageMessage("Error renaming " & OldFileName & ". Please try again", "Warning") end if end if end if ' Copy File if ActionCopyFile then if ActionFS.FileExists(EditorRootFolderPath & Path & "\" & OldFileName) then ActionFS.CopyFile(EditorRootFolderPath & Path & "\" & OldFileName), (EditorRootFolderPath & Path & "\" & "1111_" & OldFileName) if err.number = 0 then call FMPageMessage("Copied " & OldFileName & " successfully", "Success") else call FMPageMessage("Error copying " & OldFileName & ". Please try again", "Warning") end if end if ' Delete File if ActionDeleteFile then if ActionFS.FileExists(EditorRootFolderPath & Path & "\" & OldFileName) then ActionFS.DeleteFile(EditorRootFolderPath & Path & "\" & OldFileName) if err.number = 0 then call FMPageMessage("Deleted " & OldFileName & " successfully", "Success") else call FMPageMessage("Error deleting " & OldFileName & ". Please try again", "Warning") end if end if ' Folders ' Rename Folder if ActionRenameFolder then ' Get existing folder path and new folder path dim TempRenameFolderNewPath TempRenameFolderNewPath = StrReverse(Path) if instr(TempRenameFolderNewPath,"\") > 0 then TempRenameFolderNewPath = mid(TempRenameFolderNewPath,instr(TempRenameFolderNewPath,"\")+1,len(TempRenameFolderNewPath)) else TempRenameFolderNewPath = "" end if TempRenameFolderNewPath = StrReverse(TempRenameFolderNewPath) if TempRenameFolderNewPath <> "" then TempRenameFolderNewPath = TempRenameFolderNewPath & "\" if ActionFS.FolderExists(EditorRootFolderPath & TempRenameFolderNewPath & NewFolderName) then call FMPageMessage("Folder with that name already exists", "Warning") else ' Rename if ActionFS.FolderExists(EditorRootFolderPath & Path) then ActionFS.MoveFolder(EditorRootFolderPath & Path), (EditorRootFolderPath & TempRenameFolderNewPath & NewFolderName) if err.number = 0 then call FMPageMessage("Renamed folder successfully", "Success") Path = TempRenameFolderNewPath & NewFolderName else call FMPageMessage("Error renaming folder. Please try again", "Warning") end if end if end if ' Delete Folder if ActionDeleteFolder then ' Get existing folder path and new folder path dim TempDeleteFolderNewPath TempDeleteFolderNewPath = StrReverse(Path) if instr(TempDeleteFolderNewPath,"\") > 0 then TempDeleteFolderNewPath = mid(TempDeleteFolderNewPath,instr(TempDeleteFolderNewPath,"\")+1,len(TempDeleteFolderNewPath)) else TempDeleteFolderNewPath = "" end if TempDeleteFolderNewPath = StrReverse(TempDeleteFolderNewPath) ' Delete if ActionFS.FolderExists(EditorRootFolderPath & Path) then ActionFS.DeleteFolder(EditorRootFolderPath & Path) if err.number = 0 then call FMPageMessage("Deleted folder successfully", "Success") Path = TempDeleteFolderNewPath else call FMPageMessage("Error deleting folder. Please try again", "Warning") end if end if ' Create Folder if ActionCreateFolder then if CreateFolderName <> "" then ActionFS.CreateFolder(EditorRootFolderPath & Path & "\" & CreateFolderName) if err.number = 0 then call FMPageMessage("Created " & CreateFolderName & " successfully", "Success") Path = Path & "\" & CreateFolderName else call FMPageMessage("Error creating folder. Please try again", "Warning") end if end if set ActionFS = nothing ' Page Setup dim TotalFiles dim StartNumber, EndNumber, CurrentNumber, PageMaxNumber, NumberNext, NumberPrevious dim FileList, SubFolderList, TempFileName, TempFileSize, TempFileType, TempLastUpdated, TempShowFile, TempFileTitle, TempThumb dim View, TopFolders, TopFoldersArray dim FS, FSFolder View = trim(request("View")) if View = "" then View = session("FileManagerView") if View = "" then View = "details" session("FileManagerView") = View set FS = CreateObject("Scripting.FileSystemObject") set FSFolder = FS.GetFolder(EditorRootFolderPath & Path) ' Page Navigation TotalFiles = FSFolder.Files.count StartNumber = trim(request("StartNumber")) EndNumber = trim(request("EndNumber")) ' Defaults CurrentNumber = 1 PageMaxNumber = 50 if View <> "thumbs" then PageMaxNumber = 300 if StartNumber = "" or isNumeric(StartNumber) = false then StartNumber = 1 StartNumber = CInt(StartNumber) if EndNumber = "" or isNumeric(EndNumber) = false then EndNumber = PageMaxNumber EndNumber = CInt(EndNumber) NumberNext = "Next" NumberPrevious = "Prev" if EndNumber >= TotalFiles then NumberNext = "" if StartNumber = 1 then NumberPrevious = "" ' Top Folder drop-down TopFoldersArray = split(FileManagerFolderList,",") dim TempTopFoldersName, TempTopFoldersValue for i = 0 to UBound(TopFoldersArray) TempTopFoldersName = TopFoldersArray(i) TempTopFoldersValue = TopFoldersArray(i) if TempTopFoldersName = "" then TempTopFoldersName = "Root" TopFolders = TopFolders & "" & vbcrlf next TopFolders = "" & vbcrlf ' Up Folder SubFolderList = "
|
<%=SubFolderList%>
<%=FileList%>
|