Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Small administrator addition to Proeder's Mod
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

PPSSWeb
Junior Member

312 Posts

Posted - 26 April 2007 :  17:15:04  Show Profile  Reply with Quote
This small code modification works with the administrator myfiles page for Proeder's File Attachment MOD. It places a separator between user folders in the file list, each the user folder's size and links to jump directly to a particular user's folder from the top of the page (and back).

I have a number of users who upload files and need them referenced by me (the admin). This formatting addition made it easier for me to locate a users files in the long list. Also it allows me to see how much disk space each user is utilizing.

The following highlighted (red) code gets inserted at the end portion of the ScanFolders function in myfiles.asp starting at around line #433:
		if AdminAllowed then 		

'#################display current folder and disk usage################
Dim FolderList, dFolderList
'#################End display current folder and disk usage############


Set fc = f.SubFolders

For Each Folder in fc

SubFolderName = "/" & Folder.Name

if LCase(Mid(SubFolderName,1,5)) <> "/_vti" then

'#################display current folder and disk usage################
If Folder.Size > 0 then
If FolderList = "" Then
FolderList = "<CENTER><B>USER FOLDERS: <a href='#" & Ucase(Folder.Name) & "'>" & Ucase(Folder.Name) & "</a>"
dFolderList = "<form name=""UserFolders""><select name=""menu"" size=""1"" onChange=""location=document.UserFolders.menu.options[document.UserFolders.menu.selectedIndex].value;""><option value=''>User Folders</option>"
dFolderList = dFolderList + "<option value='#" & UCase(Folder.Name) & "'>" & Ucase(Folder.Name) & "</option>"
Else
FolderList = FolderList + " | <a href='#" & Ucase(Folder.Name) & "'>" & Ucase(Folder.Name) & "</a>"
dFolderList = dFolderList + "<option value='#" & UCase(Folder.Name) & "'>" & Ucase(Folder.Name) & "</option>"
End If
Response.Write "<tr><td bgcolor=""" & STRFORUMCELLCOLOR & """ colspan=""2""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><B>#160;<A NAME='" & UCase(Folder.Name) & "'>" & UCase(Folder.Name)& "</A></B> - Disk Usage = " & Round(Folder.Size/1048576,2) & " MB</font></td><td bgcolor=""" & STRFORUMCELLCOLOR & """><a href='#TOP'><img src=""../img/forums images/icon_go_up.gif"" width=""15"" height=""15"" border=""0"" alt=""Go to Top of Page"" title=""Go to Top of Page"" align=""right""></a></td></tr>"
End If
'#################End display current folder and disk usage############


response.write "<BLOCKQUOTE>"
Call ScanFolders(PathSpec & "/" & Folder.Name)
response.write "</BLOCKQUOTE>"

end if
Next
end if

'#################display current folder and disk usage################
Response.Write FolderList + "</B></CENTER><p>"
Response.Write dFolderList + "</select></form>"
'#################End display current folder and disk usage############

End Function


I hope someone else finds this useful as well.
As always, if someone finds an error in this snippet, please let me know.


Edit: This updated code is to replace any prior version. The code outputs both a list (FolderList) and drop down menu (dFolderList). If you prefer one over the other, simply remove the references to the one you do not want and keep the other, or leave them and have both choices functional.<

Edited by - PPSSWeb on 02 May 2007 17:05:04

modifichicci
Average Member

Italy
787 Posts

Posted - 27 April 2007 :  16:20:33  Show Profile  Visit modifichicci's Homepage  Reply with Quote
Nice adding, i was thinking if it's possible to have member list in a selectbox instead of a long list?
If a forum has many members it could be very very useful..<

Ernia e Laparocele
Forum di Ernia e Laparocele
Acces - MySql Migration Tutorial
Adamantine forum
Go to Top of Page

PPSSWeb
Junior Member

312 Posts

Posted - 27 April 2007 :  16:52:31  Show Profile  Reply with Quote
I tried that, but didn't like how the drop down stayed selected at the last username when returning to the top of the page using the icon in the separator bar or at the bottom of the page. Since I only allow administrators, moderators and select users the ability to upload, the normal text list works well for me.

This should generate the same list as a drop down for you:

Edit: This code has been included in the updated version in the first post of this topic.
<

Edited by - PPSSWeb on 02 May 2007 17:06:17
Go to Top of Page

thermal_seeker
Junior Member

United Kingdom
430 Posts

Posted - 27 April 2007 :  18:14:36  Show Profile  Reply with Quote
thats really nice PPSS..

how do I get rid of the "USER FOLDERS: _VTI_CNF" list??



Dave

<

No good at coding, but I can plough a field !!
Go to Top of Page

PPSSWeb
Junior Member

312 Posts

Posted - 30 April 2007 :  10:35:55  Show Profile  Reply with Quote
This line in the code section above should eliminate those listings.

if LCase(Mid(SubFolderName,1,5)) <> "/_vti" then


Make sure you didn't loose that line when adding the new sections in red.

<
Go to Top of Page

thermal_seeker
Junior Member

United Kingdom
430 Posts

Posted - 02 May 2007 :  01:24:37  Show Profile  Reply with Quote
just rechecked and I didn't loose that line....??


			'#################display current folder and disk usage################	 
				Dim FolderList		  
		'#################End display current folder and disk usage############  
		
			Set fc = f.SubFolders
	
			For Each Folder in fc
			
				SubFolderName = "/" & Folder.Name
				
'#################display current folder and disk usage###############
If Folder.Size > 0 then 
If FolderList = "" Then
FolderList = "<CENTER><B>USER FOLDERS: <a href='#" & Ucase(Folder.Name) & "'>" & Ucase(Folder.Name) & "</a>"
Else	
FolderList = FolderList + " | <a href='#" & Ucase(Folder.Name) & "'>" & Ucase(Folder.Name) & "</a>"
End If			
End If	
'#################End display current folder and disk usage#############
				
				if LCase(Mid(SubFolderName,1,5)) <> "/_vti" then
				
'#################display current folder and disk usage################	
	If Folder.Size > 0 then  
	Response.Write "<tr><td bgcolor=""" & STRFORUMCELLCOLOR & """ colspan=""2""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strForumFontColor & """><B><A NAME='" & UCase(Folder.Name) & "'>" & UCase(Folder.Name)& "</A></B> - Disk Usage = " & Round(Folder.Size/1048576,2) & " MB</font></td><td bgcolor=""" & STRFORUMCELLCOLOR & """><a href='#TOP'><img src=""../forum/images/icon_go_up.gif"" width=""15"" height=""15"" border=""0"" alt=""Go to Top of Page"" title=""Go to Top of Page"" align=""right""></a></td></tr>" 	 
	End If			     
'#################End display current folder and disk usage############							
			
					response.write "<BLOCKQUOTE>"
						Call ScanFolders(PathSpec & "/" & Folder.Name)
					response.write "</BLOCKQUOTE>"
					
				end if
			Next
		end if
'#################display current folder and disk usage################	
		Response.Write FolderList + "</B></CENTER><p>" 
'#################End display current folder and disk usage############
		
End Function

	
<

No good at coding, but I can plough a field !!

Edited by - thermal_seeker on 02 May 2007 13:36:12
Go to Top of Page

PPSSWeb
Junior Member

312 Posts

Posted - 02 May 2007 :  09:35:32  Show Profile  Reply with Quote
quote:
Originally posted by thermal_seeker

just rechecked and I didn't loose that line....??



Weird, I just checked your code against mine and it is identical and unless I comment out that line I can not get it to display any _vti directory. I even pasted your code into my myfiles.asp page and it still works properly.

Did these items show in your file list before the insertion of this code? If you comment out my code addition, do they go away?

Can you email the image posted above? I can not get to it due to the firewall settings at work. Perhaps that will give me a clue.

P.S. - You might want to use the [ scrollcode ][ /scrollcode ] tags on the code in your post above to keep it from stretching the screen so much. <

Edited by - PPSSWeb on 02 May 2007 09:39:40
Go to Top of Page

PPSSWeb
Junior Member

312 Posts

Posted - 02 May 2007 :  14:14:10  Show Profile  Reply with Quote
Got your email.

Try changing:
if LCase(Mid(SubFolderName,1,5)) <> "/_vti" then


To:
if LCase(Mid(SubFolderName,1,5)) <> "/_vti" and LCase(Mid(SubFolderName,1,9)) <> "/_vti_cnf" then


<
Go to Top of Page

thermal_seeker
Junior Member

United Kingdom
430 Posts

Posted - 02 May 2007 :  15:03:26  Show Profile  Reply with Quote
I have replied..

and BTW thank you for the scrollcode tip

Dave<

No good at coding, but I can plough a field !!
Go to Top of Page

PPSSWeb
Junior Member

312 Posts

Posted - 02 May 2007 :  17:07:56  Show Profile  Reply with Quote
I have updated the code in the first post to reflect the fix for the _vti_cnf error that thermal_seeker found.

It now also outputs both a text list (FolderList) and drop down menu (dFolderList). If you prefer one over the other, simply remove the references to the one you do not want and keep the other, or leave them and have both choices functional.

thermal_seeker,
Thanks again for finding and helping me work out that bug.<

Edited by - PPSSWeb on 02 May 2007 17:10:18
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07