[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Reading only files within a dir

Tristan Knowles

7/16/2005 4:01:00 PM

I am trying to create two html drop downs in a ruby
script. The first to select a /var/log directory, and
the second to view a specific file within that
directory.

I'm just unsure of how to pass a post variable back
into the ruby script, or whether there is another way
to do this?

My current code is like this:

========
# List dir names
puts "<tr><td colspan=\"2\"><form action=\"\"
name=\"select_dir\" id=\"select_dir\" method\"post\">"
puts "<select name=\"select_dir\">"
Dir.entries(Log_Location).each do |logdir|
puts "<option>#{logdir}</option>"
end
puts "</select>\n<input type=\"submit\"
name=\"Submit_Dir\" id=\"Submit_Dir\" value=\"Change
Directory\">"
puts "</form></td></tr>"

# List File names
puts "<tr><td colspan=\"2\"><form action=\"\"
name=\"select_log\" id=\"select_log\" method=\post\">"
puts "<select name=\"select_log\">"
logfiles = Dir.foreach(Log_Dir) do |logfile|
puts "<option>#{logfile}</option>"
end
puts "</select>\n<input type=\"submit\"
name=\"Submit_Log\" id=\"Submit_Log\" value=\"Select
Log\">"
puts "</form></td></tr>"
========

So, i need to pass the post variable from the select
box for the dir to the select box below, and from
there onto my script below to actually view the
contents (already have the last part working, using a
normal variable).

Also, is there any different between Dir.entries and
Dir.foreach? Isn't Dir.foreach the same as
Dir.entries("/dir").each?


Thanks.
Tristan



___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos...


2 Answers

Tristan Knowles

7/16/2005 4:05:00 PM

0

Sorry, terrible subject description, I was thinking of
something different and then realised what my main
problem actually was, but forgot to change the subject :P.





___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger...


Tristan Knowles

7/16/2005 5:48:00 PM

0

Ahh. So this one needs CGI.

I will have a play with cgi then and see how things
go.






___________________________________________________________
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger...