Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it L'avatar di Spyfil
    Registrato dal
    Dec 2001
    Messaggi
    801

    Recordset Disconnesso di BAOL

    Sto usando lo script di Baol..
    come si fa ad eliminare qualche colonna in print?
    Per esempio voglio eliminare la data di creazione, come si fa?

    ecco il codice
    codice:
    <%
    Const adFilesSubFolder 	= 0
    Const adFiles 		= 1
    Const adSubFolder 	= 2
    
    Class cFolder
    Public Rs
    Public Fso
    Public Sort
    Public Filter
    Public ListType
    Public Path
    Public EnabledSize
    Public Style
    Public ColumnStyle
    Public WebServerFP
    Public ScriptName
    Private LenWebServerFP
    
    Private Sub Class_Initialize()
    	Set fso=CreateObject("Scripting.FileSystemObject")
    	Set Rs= CreateObject("ADODB.Recordset")
    	EnabledSize = False
    	Style = "bgColor='#F2F2F2' width='95%' borderColor='navy' style='font-family:verdana;font-size:11' border='1' cellspacing='1' "
    	ColumnStyle = "bgColor='navy' style='color:white'"
    	WebServerFP = Request.ServerVariables("APPL_PHYSICAL_PATH")
    	LenWebServerFP = Len(WebServerFP)
    	ScriptName = Mid(Request.ServerVariables("SCRIPT_NAME"),InStrRev(Request.ServerVariables("SCRIPT_NAME"),"/"))
    End Sub
    
    Private Sub Initialize()
    	ListType = adFilesSubFolder
    	Sort = Empty
    	Filter = Empty
    	If Rs.State=0 then
    	Rs.fields.append "Name",201,255
    	Rs.fields.append "DateCreated",133,-1
    	Rs.fields.append "DateLastModified",133,-1
    	Rs.fields.append "DateLastAccessed",133,-1
    	if EnabledSize then Rs.fields.append "Size",20,-1
    	Rs.fields.append "IsFolder",11,-1
    	Rs.fields.append "IsHidden",11,-1
    	Rs.Open
    	end if
    End sub
    
    Private Function FpToUrl(pPath)
    	FpToUrl = Replace(Mid(pPath,LenWebServerFP),"\","/")
    End Function
    
    Public Function Print()
    Dim i,f,ParentName
    	ParentName = FpToUrl(fso.GetParentFolderName(Path))
    	'response.Write("Parent Folder")
    	response.Write("<table " & Style &">")
    		response.Write("<tr " & ColumStyle &">")
    		for each f in Rs.Fields
    				Response.Write("<td>" & f.name & "</td>")
    		next
    		response.Write("</tr>")
    		if Not Rs.eof then
    			Rs.MoveFirst
    			While Not Rs.Eof
    				response.Write("<tr>")
    				for each f in Rs.Fields
    					If f.name="Name" then
    						If Rs("IsFolder") then
    							response.Write("<td>" & f.value & "</td>")
    						else
    							response.Write("<td>" & f.value &"</td>")
    						end if
    					else
    						response.Write("<td>" & f.value & "</td>")
    					end if
    				next
    				response.Write("</tr>")
    				Rs.MoveNext
    			Wend
    		End if
    		response.Write("</table>
    ")
    End function
    
    Private Function SetList(Path,TypeFile)
    Dim File,Files
    		Execute "Set Files= Fso.GetFolder(Path)." & TypeFile
    			for each File in Files
    				rs.AddNew
    					rs("Name")=File.Name
    					rs("DateCreated")=File.DateCreated
    					rs("DateLastModified")=File.DateLastModified
    					rs("DateLastAccessed")=File.DateLastAccessed
    					if EnabledSize then rs("Size") = File.Size
    					rs("IsFolder")= (File.Attributes And 16) = 16
    					rs("IsHidden")= (File.attributes And 2) = 2
    				Rs.Update
    			next
    		Set Files= nothing
    end function
    
    Public Function Open()
    	If ListType=adFilesSubFolder or ListType=adSubFolder then SetList Path,"Subfolders"
    	If ListType=adFilesSubFolder or ListType=adFiles  	then SetList Path,"Files"
    	If Not IsEmpty(Sort) then rs.sort = sort
    	If Not IsEmpty(Filter) then rs.filter = filter
    End Function
    
    Public Function SetPath(pPath)
    	Initialize()
    	on error resume next
    		Path = Server.MapPath(pPath)
    		If Err.number<>0 then
    			response.write("Errore:" & err.description):response.end
    		end if
    	on error goto 0
    end function
    
    Public Sub Close()
    	On error resume next
    	Rs.Close
    	On error goto 0
    End Sub
    
    Private Sub Class_Terminate()
    	Close()
    	Set Rs= Nothing
    	Set Fso = Nothing
    End Sub
    
    End Class
    
    Set Folder = new cFolder
    Folder.EnabledSize = True
    If Request.QueryString("Folder")="" then
    	Folder.SetPath("files/")
    else
    	Folder.SetPath(Request.QueryString("Folder"))
    end if
    Folder.Sort = "IsFolder Desc,DateLastModified"
    'Folder.Filter = "Name Like 'a*'"
    Folder.Open()
    Folder.Print()
    Folder.Close()
    Set Folder = Nothing
    
    %>

  2. #2
    Utente di HTML.it L'avatar di Baol74
    Registrato dal
    Jul 2002
    Messaggi
    2,004
    Miiii... ma è uno script che non trovavo più... come hai fatto a trovarlo? dov'era?

  3. #3
    Utente di HTML.it L'avatar di Spyfil
    Registrato dal
    Dec 2001
    Messaggi
    801
    se vuoi te lo passo, ma mi paghi i diritti di ricerca!

  4. #4
    Utente di HTML.it L'avatar di Spyfil
    Registrato dal
    Dec 2001
    Messaggi
    801
    visto che sei qua! e io sto impazzendo e affogando nell'ignoranza..
    sto cercando di aggiungere, oltre a togliere, una colonna con un link ad una nuova pagina!!! Credimi se ti dico che sto diventando matto...

  5. #5
    Utente di HTML.it L'avatar di Baol74
    Registrato dal
    Jul 2002
    Messaggi
    2,004
    Allora, in initialize viene creato il recordset.

    codice:
    Private Sub Initialize()
    	ListType = adFilesSubFolder
    	Sort = Empty
    	Filter = Empty
    	If Rs.State=0 then
    	Rs.fields.append "Name",201,255
    	Rs.fields.append "DateCreated",133,-1
    	Rs.fields.append "DateLastModified",133,-1
    	Rs.fields.append "DateLastAccessed",133,-1
    	if EnabledSize then Rs.fields.append "Size",20,-1
    	Rs.fields.append "IsFolder",11,-1
    	Rs.fields.append "IsHidden",11,-1
    	Rs.Open
    	end if
    End sub
    Nella funzione SetList, popoli il recordset. Quindi se togli un campo in initialize lo devi togliere anche qui. Stessa cosa per aggiungerlo.
    codice:
    Private Function SetList(Path,TypeFile)
    Dim File,Files
    		Execute "Set Files= Fso.GetFolder(Path)." & TypeFile
    			for each File in Files
    				rs.AddNew
    					rs("Name")=File.Name
    					rs("DateCreated")=File.DateCreated
    					rs("DateLastModified")=File.DateLastModified
    					rs("DateLastAccessed")=File.DateLastAccessed
    					if EnabledSize then rs("Size") = File.Size
    					rs("IsFolder")= (File.Attributes And 16) = 16
    					rs("IsHidden")= (File.attributes And 2) = 2
    				Rs.Update
    			next
    		Set Files= nothing
    end function
    La funzione print è il tuo output.
    Io ho messo un output automatico dei campi del recodset, ma puoi personalizzarlo

    Ultima cosa: naturalmente funzionano anche i filtri

  6. #6
    Utente di HTML.it L'avatar di Spyfil
    Registrato dal
    Dec 2001
    Messaggi
    801
    Fino a qua ce l'ho fatta!
    ora devo aggiungere il link!

  7. #7
    Utente di HTML.it L'avatar di Baol74
    Registrato dal
    Jul 2002
    Messaggi
    2,004
    Che link devi aggiungere?
    Come deve essere costruito?

  8. #8
    Utente di HTML.it L'avatar di Spyfil
    Registrato dal
    Dec 2001
    Messaggi
    801
    FATTO TUTTO! Grazie!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.