diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/autorequire.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/autorequire.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/autorequire.rb 2005-06-04 14:42:02.184351008 +0200
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/autorequire.rb 2004-12-30 21:05:56.000000000 +0100
@@ -0,0 +1 @@
+require newlocation("ev/rwd")
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/CHANGELOG rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/CHANGELOG
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/CHANGELOG 2005-06-04 14:42:02.185350856 +0200
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/CHANGELOG 2005-06-04 14:33:00.000000000 +0200
@@ -0,0 +1,157 @@
+----------------------------------------------------------------
+
+0.2.0 - 04.06.2005
+
+* Added better browser detection on Cygwin.
+
+* Added mime support for rwd_files/* (hard coded, for now...)
+
+* RWDialog#serve now stops the application when the application
+ is being wrapped by RubyScript2Exe. Fixed a bug concerning
+ the detection of configuration files.
+
+* Added Array#rwd_table.
+
+* Added RWDialog#text.
+
+* Added RWDialog#timeout.
+
+* I changed a lot of small other things which are probably not
+ worth mentioning individually, but enhance the total "feel"
+ of RubyWebDialogs.
+
+----------------------------------------------------------------
+
+0.1.2 - 16.12.2004
+
+* Added refresh to <window>.
+
+* Added width and height to <image>.
+
+* Added the (experimental) progress bar.
+
+* Fixed a bug concerning a frozen string ( ENV["RWDBROWSER"]).
+
+* Fixed the handling of spaces in ENV["RWDBROWSER"] under
+ Cygwin.
+
+----------------------------------------------------------------
+
+0.1.1 - 05.12.2004
+
+* Adding the key/values in the configuration file to ENV is
+ only done if ENV doesn´t already include the key.
+
+* Corrected the handling of %1 in ENV["RWDBROWSER"].
+
+* Corrected the handling of http://localhost:7701 (no final /).
+
+* Renamed the embedded pixel.gif to rwd_pixel.gif.
+
+* Removed the definition of the (western) character set in the
+ templates.
+
+----------------------------------------------------------------
+
+0.1.0 - 28.11.2004
+
+* Added browser detection for Linux.
+
+* Added theme handling.
+
+* Added <panel>.
+
+* Added alt to <image>.
+
+* Changed the layout of tabs.
+
+----------------------------------------------------------------
+
+0.0.11 - 03.09.2004
+
+* Added a different template for PDA´s and the (experimental)
+ detection of PDA´s.
+
+* Added filename handling for download.
+
+----------------------------------------------------------------
+
+0.0.10 - 21.08.2004
+
+* Session-ids are now stored in cookies, in stead of in hidden
+ form fields.
+
+* Added download.
+
+----------------------------------------------------------------
+
+0.0.9 - 15.05.2004
+
+* Default port isn´t 1234 anymore, but one in the range
+ 7701-7709.
+
+* Created RWDReconnect.
+
+* Added gsub(/%port%/, port.to_s) to ENV["RWDBROWSER"].
+
+* Changed the call to Hash#rwd_table.
+
+----------------------------------------------------------------
+
+0.0.8 - 05.05.2004
+
+* Added @rwd_call_after_back.
+
+----------------------------------------------------------------
+
+0.0.7 - 28.04.2004
+
+* Corrected some exception handling regarding the IO with the
+ browser.
+
+* Added maxlength to text and password.
+
+* Added network without authentication.
+
+----------------------------------------------------------------
+
+0.0.6 - 24.04.2004
+
+* Corrected io-handling. Konqueror could kill the application.
+
+* Changed some layout ( window and tabs).
+
+----------------------------------------------------------------
+
+0.0.5 - 23.04.2004
+
+* Replaced the symlink by a copy in install.rb . It didn´t work
+ under Linux.
+
+----------------------------------------------------------------
+
+0.0.4 - 22.04.2004
+
+* Changed the recently added tab-handling.
+
+* Corrected some cursor positioning glitches.
+
+----------------------------------------------------------------
+
+0.0.3 - 21.04.2004
+
+* A minor change in message.
+
+----------------------------------------------------------------
+
+0.0.2 - 20.04.2004
+
+* Added some tab-handling.
+
+----------------------------------------------------------------
+
+0.0.1 - 17.04.2004
+
+* Alpha release
+
+----------------------------------------------------------------
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/init.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/init.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/init.rb 2004-12-17 12:40:16.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/init.rb 2005-06-04 14:41:53.000000000 +0200
@@ -1,37 +1,64 @@
require "rbconfig"
+require "ftools"
-def mkdirrec(dir)
- pdir = File.dirname(dir)
+if __FILE__ == $0
- if not pdir.empty? and not File.directory?(pdir)
- mkdirrec (pdir)
- end
+ Dir.chdir(File.dirname($0))
- Dir.mkdir(dir) rescue nil
-end
+ FromDirs = [".", "./lib", "./rubylib/lib"]
+ ToDir = Config::CONFIG["sitelibdir"] + "/ev"
+
+ File.mkpath(ToDir) if not File.directory?(ToDir)
+
+ FromDirs.each do |fromdir|
+ fromdir = Dir.pwd if fromdir == "."
-Dir.chdir(File.dirname($0))
+ if File.directory?(fromdir)
+ Dir.new(fromdir).each do |file|
+ if file =~ /\.lib\.rb$/
+ fromfile = fromdir + "/" + file
+ tofile = ToDir + "/" + file.sub(/\.lib\.rb/, ".rb")
-FromDirs = [".", "./lib", "./rubylib/lib"]
-ToDir = Config::CONFIG["sitelibdir"] + "/ev"
+ printf "%s -> %s\n", fromfile, tofile
-mkdirrec(ToDir) if not File.directory?(ToDir)
+ File.delete(tofile) if File.file?(tofile)
+
+ File.open(tofile, "w") {|f| f.puts File.new(fromfile).readlines}
+ end
+ end
+ end
+ end
-FromDirs.each do |fromdir|
- fromdir = Dir.pwd if fromdir == "."
+else
- if File.directory?(fromdir)
- Dir.new(fromdir).each do |file|
- if file =~ /\.lib\.rb$/
- fromfile = fromdir + "/" + file
- tofile = ToDir + "/" + file.sub(/\.lib\.rb/, ".rb")
+ FromDirs = [".", "./lib", "./rubylib/lib"]
+ ToDir = "./ev"
- printf "%s -> %s\n", fromfile, tofile
+ File.mkpath(ToDir) if not File.directory?(ToDir)
- File.delete(tofile) if File.file?(tofile)
+ FromDirs.each do |fromdir|
+ fromdir = Dir.pwd if fromdir == "."
- File.open(tofile, "w") {|f| f.puts File.new(fromfile).readlines}
+ if File.directory?(fromdir)
+ Dir.new(fromdir).each do |file|
+ if file =~ /\.lib\.rb$/
+ fromfile = fromdir + "/" + file
+ tofile = ToDir + "/" + file.sub(/\.lib\.rb/, ".rb")
+
+ #printf "%s -> %s\n", fromfile, tofile
+
+ File.delete(tofile) if File.file?(tofile)
+
+ File.open(tofile, "w") {|f| f.puts File.new(fromfile).readlines}
+ end
end
end
end
+
+ oldlocation do
+ file = newlocation("autorequire.rb")
+
+ load file if File.file?(file)
+ end
+
end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/install.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/install.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/install.rb 2004-12-17 12:40:16.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/install.rb 2005-06-04 14:41:53.000000000 +0200
@@ -1,37 +1,64 @@
require "rbconfig"
+require "ftools"
-def mkdirrec(dir)
- pdir = File.dirname(dir)
+if __FILE__ == $0
- if not pdir.empty? and not File.directory?(pdir)
- mkdirrec (pdir)
- end
+ Dir.chdir(File.dirname($0))
- Dir.mkdir(dir) rescue nil
-end
+ FromDirs = [".", "./lib", "./rubylib/lib"]
+ ToDir = Config::CONFIG["sitelibdir"] + "/ev"
+
+ File.mkpath(ToDir) if not File.directory?(ToDir)
+
+ FromDirs.each do |fromdir|
+ fromdir = Dir.pwd if fromdir == "."
-Dir.chdir(File.dirname($0))
+ if File.directory?(fromdir)
+ Dir.new(fromdir).each do |file|
+ if file =~ /\.lib\.rb$/
+ fromfile = fromdir + "/" + file
+ tofile = ToDir + "/" + file.sub(/\.lib\.rb/, ".rb")
-FromDirs = [".", "./lib", "./rubylib/lib"]
-ToDir = Config::CONFIG["sitelibdir"] + "/ev"
+ printf "%s -> %s\n", fromfile, tofile
-mkdirrec(ToDir) if not File.directory?(ToDir)
+ File.delete(tofile) if File.file?(tofile)
+
+ File.open(tofile, "w") {|f| f.puts File.new(fromfile).readlines}
+ end
+ end
+ end
+ end
-FromDirs.each do |fromdir|
- fromdir = Dir.pwd if fromdir == "."
+else
- if File.directory?(fromdir)
- Dir.new(fromdir).each do |file|
- if file =~ /\.lib\.rb$/
- fromfile = fromdir + "/" + file
- tofile = ToDir + "/" + file.sub(/\.lib\.rb/, ".rb")
+ FromDirs = [".", "./lib", "./rubylib/lib"]
+ ToDir = "./ev"
- printf "%s -> %s\n", fromfile, tofile
+ File.mkpath(ToDir) if not File.directory?(ToDir)
- File.delete(tofile) if File.file?(tofile)
+ FromDirs.each do |fromdir|
+ fromdir = Dir.pwd if fromdir == "."
- File.open(tofile, "w") {|f| f.puts File.new(fromfile).readlines}
+ if File.directory?(fromdir)
+ Dir.new(fromdir).each do |file|
+ if file =~ /\.lib\.rb$/
+ fromfile = fromdir + "/" + file
+ tofile = ToDir + "/" + file.sub(/\.lib\.rb/, ".rb")
+
+ #printf "%s -> %s\n", fromfile, tofile
+
+ File.delete(tofile) if File.file?(tofile)
+
+ File.open(tofile, "w") {|f| f.puts File.new(fromfile).readlines}
+ end
end
end
end
+
+ oldlocation do
+ file = newlocation("autorequire.rb")
+
+ load file if File.file?(file)
+ end
+
end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/browser.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/browser.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/browser.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/browser.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -16,20 +16,33 @@
application = nil
begin
- Win32::Registry::HKEY_CLASSES_ROOT.open(´.html´) do |reg|
+ Win32::Registry::HKEY_CLASSES_ROOT.open(".html") do |reg|
filetype = reg[""]
end
- Win32::Registry::HKEY_CLASSES_ROOT.open(filetype + ´\shell\open\command´) do |reg|
+ Win32::Registry::HKEY_CLASSES_ROOT.open(filetype + "\\shell\\open\\command") do |reg|
application = reg[""]
end
rescue NameError
- $stderr.puts "Only available for Windows."
+ $stderr.puts "Only available for Windows and Cygwin."
end
application
end
+def cygwinbrowser
+ browser, *args = windowsbrowser.splitwords
+ browser = browser.gsub(/\\/, "/")
+ #browser = browser
+
+ args.collect!{|a| a.gsub(/\\/, "/")}
+ #args.collect!{|a| "\"%s\"" % [a.gsub(/\\/, "/")]}
+ #args.collect!{|a| "\"%s\"" % [a]}
+
+ res = "\"%s\" %s" % [browser, args.join(" ")]
+ res
+end
+
def linuxbrowser
application = ""
@@ -47,25 +60,26 @@
def defaultbrowser
res = nil
res = windowsbrowser if windows?
+ res = cygwinbrowser if cygwin?
res = linuxbrowser if linux?
res
end
+def showurlinbrowser(url, browser=defaultbrowser)
+ command = "#{browser} \"#{url}\""
+
+ system(command) or $stderr.puts "Starting of the browser failed, or the browser terminated abnormally.\nCommand => #{command}"
+end
+
def showinbrowser(html, browser=defaultbrowser)
port, io = TCPServer.freeport(7701, 7709)
unless browser.nil?
Thread.new do
begin
- #command = "1234 \"http://localhost:#{port}\"" if linux?
- #command = "L:/prog/MozillaFirefox/firefox.exe \"http://localhost:#{port}\"" if cygwin?
- #command = Win32::Registry::HKEY_CLASSES_ROOT.open(´htmlfile\shell\open\command´)[0] + " \"http://localhost:#{port}/\"" if windows?
-
- command = "#{browser} \"http://localhost:#{port}\""
-
Thread.pass
- system(command)
+ showurlinbrowser("http://localhost:#{port}/", browser)
rescue
end
end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/ftools.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/ftools.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/ftools.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/ftools.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -1,22 +1,12 @@
require "ftools"
class Dir
- def self.mkdirrec(dir)
- pdir = File.dirname(dir)
-
- if not pdir.empty? and not File.directory?(pdir)
- Dir.mkdirrec(pdir)
- end
-
- Dir.mkdir(dir) rescue nil
- end
-
def self.copy(from, to)
if File.directory?(from)
pdir = Dir.pwd
todir = File.expand_path(to)
- mkdirrec(todir)
+ File.mkpath(todir)
Dir.chdir(from)
Dir.new(".").each do |e|
@@ -26,7 +16,7 @@
else
todir = File.dirname(File.expand_path(to))
- mkdirrec(todir)
+ File.mkpath(todir)
File.copy(from, to)
end
@@ -38,6 +28,8 @@
end
def self.rm_rf(entry)
+ File.chmod(0755, entry)
+
if File.ftype(entry) == "directory"
pdir = Dir.pwd
@@ -47,16 +39,24 @@
end
Dir.chdir(pdir)
- Dir.delete(entry)
+ begin
+ Dir.delete(entry)
+ rescue => e
+ $stderr.puts e.message
+ end
else
- File.delete(entry)
+ begin
+ File.delete(entry)
+ rescue => e
+ $stderr.puts e.message
+ end
end
end
def self.find(entry=nil, mask=nil)
entry = "." if entry.nil?
- entry = entry.gsub!(/[\/\\]*$/, "") unless entry.nil?
+ entry = entry.gsub(/[\/\\]*$/, "") unless entry.nil?
mask = /^#{mask}$/i if mask.kind_of?(String)
@@ -77,8 +77,8 @@
ensure
Dir.chdir(pdir)
end
- rescue Errno::EACCES => error
- puts error
+ rescue Errno::EACCES => e
+ $stderr.puts e.message
end
else
res += [entry] if mask.nil? or entry =~ mask
@@ -99,7 +99,7 @@
# Rollback
if File.file?(backupfile) and File.file?(controlfile)
- $stdout.puts "Restoring #{file}..."
+ $stderr.puts "Restoring #{file}..."
File.copy(backupfile, file) # Rollback from phase 3
end
@@ -139,7 +139,11 @@
end
def self.touch(file)
- File.open(file, "a"){|f|}
+ if File.exists?(file)
+ File.utime(Time.now, File.mtime(file), file)
+ else
+ File.open(file, "a"){|f|}
+ end
end
def self.which(file)
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/mime.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/mime.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/mime.lib.rb 2005-06-04 14:42:02.188350400 +0200
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/mime.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -0,0 +1,328 @@
+module EVMime
+ MimeType = {}
+
+ MimeType[´123´] = ´application/vnd.lotus-1-2-3´
+ MimeType[´3ds´] = ´image/x-3ds´
+ MimeType[´a´] = ´application/x-unix-archive´
+ MimeType[´abw´] = ´application/x-abiword´
+ MimeType[´ac3´] = ´audio/ac3´
+ MimeType[´afm´] = ´application/x-font-afm´
+ MimeType[´ag´] = ´image/x-applix-graphic´
+ MimeType[´aif´] = ´audio/x-aiff´
+ MimeType[´aifc´] = ´audio/x-aiff´
+ MimeType[´aiff´] = ´audio/x-aiff´
+ MimeType[´ap´] = ´application/x-applix-presents´
+ MimeType[´ape´] = ´application/x-ape´
+ MimeType[´arj´] = ´application/x-arj´
+ MimeType[´as´] = ´application/x-applix-spreadsheet´
+ MimeType[´asc´] = ´text/plain´
+ MimeType[´asf´] = ´video/x-ms-asf´
+ MimeType[´asp´] = ´application/x-asp´
+ MimeType[´asx´] = ´audio/x-ms-asx´
+ MimeType[´au´] = ´audio/x-ulaw´
+ MimeType[´avi´] = ´video/x-msvideo´
+ MimeType[´aw´] = ´application/x-applix-word´
+ MimeType[´bak´] = ´application/x-backup´
+ MimeType[´bcpio´] = ´application/x-bcpio´
+ MimeType[´bdf´] = ´application/x-font-bdf´
+ MimeType[´bib´] = ´text/bib´
+ MimeType[´bin´] = ´application/octet-stream´
+ MimeType[´blend´] = ´application/x-blender´
+ MimeType[´blender´] = ´application/x-blender´
+ MimeType[´bmp´] = ´image/bmp´
+ MimeType[´bz´] = ´application/x-bzip´
+ MimeType[´bz2´] = ´application/x-bzip´
+ MimeType[´c´] = ´text/x-c´
+ MimeType[´c++´] = ´text/x-c++´
+ MimeType[´cc´] = ´text/x-c++´
+ MimeType[´cdf´] = ´application/x-netcdf´
+ MimeType[´cdr´] = ´application/vnd.corel-draw´
+ MimeType[´cgi´] = ´application/x-cgi´
+ MimeType[´cgm´] = ´image/cgm´
+ MimeType[´class´] = ´application/x-java-byte-code´
+ MimeType[´cls´] = ´text/x-tex´
+ MimeType[´cpio´] = ´application/x-cpio´
+ MimeType[´cpp´] = ´text/x-c++´
+ MimeType[´csh´] = ´text/x-csh´
+ MimeType[´css´] = ´text/css´
+ MimeType[´csv´] = ´text/x-comma-separated-values´
+ MimeType[´dat´] = ´video/mpeg´
+ MimeType[´dbf´] = ´application/x-xbase´
+ MimeType[´dc´] = ´application/x-dc-rom´
+ MimeType[´dcl´] = ´text/x-dcl´
+ MimeType[´dcm´] = ´image/x-dcm´
+ MimeType[´deb´] = ´application/x-deb´
+ MimeType[´desktop´] = ´application/x-gnome-app-info´
+ MimeType[´dia´] = ´application/x-dia-diagram´
+ MimeType[´diff´] = ´text/x-patch´
+ MimeType[´djv´] = ´image/vnd.djvu´
+ MimeType[´djvu´] = ´image/vnd.djvu´
+ MimeType[´doc´] = ´application/msword´
+ MimeType[´dsl´] = ´text/x-dsl´
+ MimeType[´dtd´] = ´text/x-dtd´
+ MimeType[´dvi´] = ´application/x-dvi´
+ MimeType[´dwg´] = ´image/vnd.dwg´
+ MimeType[´dxf´] = ´image/vnd.dxf´
+ MimeType[´el´] = ´text/x-emacs-lisp´
+ MimeType[´emf´] = ´image/x-emf´
+ MimeType[´eps´] = ´application/postscript´
+ MimeType[´etheme´] = ´application/x-e-theme´
+ MimeType[´etx´] = ´text/x-setext´
+ MimeType[´exe´] = ´application/x-ms-dos-executable´
+ MimeType[´ez´] = ´application/andrew-inset´
+ MimeType[´f´] = ´text/x-fortran´
+ MimeType[´fig´] = ´image/x-xfig´
+ MimeType[´fits´] = ´image/x-fits´
+ MimeType[´flac´] = ´audio/x-flac´
+ MimeType[´flc´] = ´video/x-flc´
+ MimeType[´fli´] = ´video/x-fli´
+ MimeType[´gb´] = ´application/x-gameboy-rom´
+ MimeType[´gchempaint´] = ´application/x-gchempaint´
+ MimeType[´gcrd´] = ´text/x-vcard´
+ MimeType[´gcrystal´] = ´application/x-gcrystal´
+ MimeType[´gem´] = ´text/x-rubygem´
+ MimeType[´gen´] = ´application/x-genesis-rom´
+ MimeType[´gg´] = ´application/x-sms-rom´
+ MimeType[´gif´] = ´image/gif´
+ MimeType[´glade´] = ´application/x-glade´
+ MimeType[´gnc´] = ´application/x-gnucash´
+ MimeType[´gnucash´] = ´application/x-gnucash´
+ MimeType[´gnumeric´] = ´application/x-gnumeric´
+ MimeType[´gray´] = ´image/x-gray´
+ MimeType[´gtar´] = ´application/x-gtar´
+ MimeType[´gz´] = ´application/x-gzip´
+ MimeType[´h´] = ´text/x-c-header´
+ MimeType[´h++´] = ´text/x-c-header´
+ MimeType[´hdf´] = ´application/x-hdf´
+ MimeType[´hlls´] = ´text/x-hllapiscript´
+ MimeType[´hpp´] = ´text/x-c-header´
+ MimeType[´hs´] = ´text/x-haskell´
+ MimeType[´htm´] = ´text/html´
+ MimeType[´html´] = ´text/html´
+ MimeType[´icb´] = ´image/x-icb´
+ MimeType[´ico´] = ´image/x-ico´
+ MimeType[´ics´] = ´text/calendar´
+ MimeType[´idl´] = ´text/x-idl´
+ MimeType[´ief´] = ´image/ief´
+ MimeType[´iff´] = ´image/x-iff´
+ MimeType[´ilbm´] = ´image/x-ilbm´
+ MimeType[´iso´] = ´application/x-iso-image´
+ MimeType[´it´] = ´audio/x-it´
+ MimeType[´jar´] = ´application/x-java-archive´
+ MimeType[´java´] = ´text/x-java´
+ MimeType[´jpe´] = ´image/jpeg´
+ MimeType[´jpeg´] = ´image/jpeg´
+ MimeType[´jpg´] = ´image/jpeg´
+ MimeType[´jpr´] = ´application/x-jbuilder-project´
+ MimeType[´jpx´] = ´application/x-jbuilder-project´
+ MimeType[´js´] = ´text/x-javascript´
+ MimeType[´kdelnk´] = ´application/x-kde-app-info´
+ MimeType[´kil´] = ´application/x-killustrator´
+ MimeType[´kpr´] = ´application/x-kpresenter´
+ MimeType[´ksp´] = ´application/x-kspread´
+ MimeType[´kwd´] = ´application/x-kword´
+ MimeType[´la´] = ´application/x-shared-library-la´
+ MimeType[´lha´] = ´application/x-lha´
+ MimeType[´lhs´] = ´text/x-literate-haskell´
+ MimeType[´lhz´] = ´application/x-lhz´
+ MimeType[´lo´] = ´application/x-object-file´
+ MimeType[´ltx´] = ´text/x-tex´
+ MimeType[´lwo´] = ´image/x-lwo´
+ MimeType[´lwob´] = ´image/x-lwo´
+ MimeType[´lws´] = ´image/x-lws´
+ MimeType[´lyx´] = ´text/x-lyx´
+ MimeType[´m´] = ´text/x-objc´
+ MimeType[´m3u´] = ´audio/x-mpegurl´
+ MimeType[´m4a´] = ´audio/x-m4a´
+ MimeType[´man´] = ´text/x-troff-man´
+ MimeType[´md´] = ´application/x-genesis-rom´
+ MimeType[´me´] = ´text/x-troff-me´
+ MimeType[´mgp´] = ´application/x-magicpoint´
+ MimeType[´mid´] = ´audio/x-midi´
+ MimeType[´midi´] = ´audio/x-midi´
+ MimeType[´mif´] = ´application/x-mif´
+ MimeType[´miff´] = ´image/x-miff´
+ MimeType[´mm´] = ´text/x-troff-mm´
+ MimeType[´mml´] = ´text/mathml´
+ MimeType[´mod´] = ´audio/x-mod´
+ MimeType[´mov´] = ´video/quicktime´
+ MimeType[´movie´] = ´video/x-sgi-movie´
+ MimeType[´mp1´] = ´audio/mpeg´
+ MimeType[´mp2´] = ´video/mpeg´
+ MimeType[´mp3´] = ´audio/mpeg´
+ MimeType[´mpe´] = ´video/mpeg´
+ MimeType[´mpeg´] = ´video/mpeg´
+ MimeType[´mpg´] = ´video/mpeg´
+ MimeType[´mrp´] = ´application/x-mrproject´
+ MimeType[´mrproject´] = ´application/x-mrproject´
+ MimeType[´ms´] = ´text/x-troff-ms´
+ MimeType[´msx´] = ´application/x-msx-rom´
+ MimeType[´n64´] = ´application/x-n64-rom´
+ MimeType[´nc´] = ´application/x-netcdf´
+ MimeType[´nes´] = ´application/x-nes-rom´
+ MimeType[´nsv´] = ´video/x-nsv´
+ MimeType[´o´] = ´application/x-object-file´
+ MimeType[´oda´] = ´application/oda´
+ MimeType[´ogg´] = ´application/ogg´
+ MimeType[´oleo´] = ´application/x-oleo´
+ MimeType[´p´] = ´text/x-pascal´
+ MimeType[´palm´] = ´image/x-palm´
+ MimeType[´pas´] = ´text/x-pascal´
+ MimeType[´pascal´] = ´text/x-pascal´
+ MimeType[´patch´] = ´text/x-patch´
+ MimeType[´pbm´] = ´image/x-portable-bitmap´
+ MimeType[´pcd´] = ´image/x-photo-cd´
+ MimeType[´pcf´] = ´application/x-font-pcf´
+ MimeType[´pct´] = ´image/x-pict´
+ MimeType[´pcx´] = ´image/x-pcx´
+ MimeType[´pdb´] = ´application/x-palm-database´
+ MimeType[´pdf´] = ´application/pdf´
+ MimeType[´perl´] = ´text/x-perl´
+ MimeType[´pfa´] = ´application/x-font-type1´
+ MimeType[´pfb´] = ´application/x-font-type1´
+ MimeType[´pgm´] = ´image/x-portable-graymap´
+ MimeType[´pgn´] = ´application/x-chess-pgn´
+ MimeType[´pgp´] = ´application/pgp´
+ MimeType[´php´] = ´application/x-php´
+ MimeType[´php3´] = ´application/x-php´
+ MimeType[´php4´] = ´application/x-php´
+ MimeType[´pict´] = ´image/x-pict´
+ MimeType[´pl´] = ´text/x-perl´
+ MimeType[´pls´] = ´audio/x-scpls´
+ MimeType[´pm´] = ´text/x-perl´
+ MimeType[´png´] = ´image/png´
+ MimeType[´pnm´] = ´image/x-portable-anymap´
+ MimeType[´po´] = ´text/x-po´
+ MimeType[´pp´] = ´text/x-pascal´
+ MimeType[´ppm´] = ´image/x-portable-pixmap´
+ MimeType[´pps´] = ´application/vnd.ms-powerpoint´
+ MimeType[´ppt´] = ´application/vnd.ms-powerpoint´
+ MimeType[´ps´] = ´application/postscript´
+ MimeType[´psd´] = ´image/x-psd´
+ MimeType[´psf´] = ´application/x-font-linux-psf´
+ MimeType[´psid´] = ´audio/prs.sid´
+ MimeType[´py´] = ´text/x-python´
+ MimeType[´pyc´] = ´application/x-python-byte-code´
+ MimeType[´qif´] = ´application/qif´
+ MimeType[´qt´] = ´video/quicktime´
+ MimeType[´ra´] = ´audio/x-real-audio´
+ MimeType[´ram´] = ´audio/x-pn-realaudio´
+ MimeType[´rar´] = ´application/x-rar´
+ MimeType[´ras´] = ´image/x-cmu-raster´
+ MimeType[´rb´] = ´text/x-ruby´
+ MimeType[´rba´] = ´text/x-ruby´
+ MimeType[´rbw´] = ´text/x-ruby´
+ MimeType[´rej´] = ´application/x-reject´
+ MimeType[´rgb´] = ´image/x-rgb´
+ MimeType[´rm´] = ´audio/x-real-audio´
+ MimeType[´roff´] = ´text/x-troff´
+ MimeType[´rpm´] = ´application/x-rpm´
+ MimeType[´rtf´] = ´application/rtf´
+ MimeType[´rtx´] = ´text/richtext´
+ MimeType[´ruby´] = ´text/x-ruby´
+ MimeType[´rubyw´] = ´text/x-ruby´
+ MimeType[´rv´] = ´audio/x-real-audio´
+ MimeType[´s´] = ´text/x-asm´
+ MimeType[´s3m´] = ´audio/x-s3m´
+ MimeType[´scm´] = ´text/x-scheme´
+ MimeType[´sda´] = ´application/vnd.stardivision.draw´
+ MimeType[´sdc´] = ´application/vnd.stardivision.calc´
+ MimeType[´sdd´] = ´application/vnd.stardivision.impress´
+ MimeType[´sdp´] = ´application/vnd.stardivision.impress´
+ MimeType[´sds´] = ´application/vnd.stardivision.chart´
+ MimeType[´sdw´] = ´application/vnd.stardivision.writer´
+ MimeType[´sgi´] = ´image/x-sgi´
+ MimeType[´sgl´] = ´application/vnd.stardivision.writer´
+ MimeType[´sgm´] = ´text/sgml´
+ MimeType[´sgml´] = ´text/sgml´
+ MimeType[´sh´] = ´text/x-sh´
+ MimeType[´shar´] = ´application/x-shar´
+ MimeType[´sid´] = ´audio/prs.sid´
+ MimeType[´slk´] = ´text/spreadsheet´
+ MimeType[´smd´] = ´application/vnd.stardivision.mail´
+ MimeType[´smf´] = ´application/vnd.stardivision.math´
+ MimeType[´smi´] = ´application/x-smil´
+ MimeType[´smil´] = ´application/x-smil´
+ MimeType[´sml´] = ´application/x-smil´
+ MimeType[´sms´] = ´application/x-sms-rom´
+ MimeType[´snd´] = ´audio/basic´
+ MimeType[´so´] = ´application/x-shared-library´
+ MimeType[´spd´] = ´application/x-font-speedo´
+ MimeType[´sql´] = ´text/x-sql´
+ MimeType[´src´] = ´application/x-wais-source´
+ MimeType[´stc´] = ´application/vnd.sun.xml.calc.template´
+ MimeType[´std´] = ´application/vnd.sun.xml.draw.template´
+ MimeType[´sti´] = ´application/vnd.sun.xml.impress.template´
+ MimeType[´stm´] = ´audio/x-stm´
+ MimeType[´stw´] = ´application/vnd.sun.xml.writer.template´
+ MimeType[´sty´] = ´text/x-tex´
+ MimeType[´sun´] = ´image/x-sun-raster´
+ MimeType[´sv4cpio´] = ´application/x-sv4cpio´
+ MimeType[´sv4crc´] = ´application/x-sv4crc´
+ MimeType[´svg´] = ´image/svg+xml´
+ MimeType[´svgz´] = ´image/svg+xml´
+ MimeType[´swf´] = ´application/x-shockwave-flash´
+ MimeType[´sxc´] = ´application/vnd.sun.xml.calc´
+ MimeType[´sxd´] = ´application/vnd.sun.xml.draw´
+ MimeType[´sxg´] = ´application/vnd.sun.xml.writer.global´
+ MimeType[´sxi´] = ´application/vnd.sun.xml.impress´
+ MimeType[´sxm´] = ´application/vnd.sun.xml.math´
+ MimeType[´sxw´] = ´application/vnd.sun.xml.writer´
+ MimeType[´sylk´] = ´text/spreadsheet´
+ MimeType[´t´] = ´text/x-troff´
+ MimeType[´tar´] = ´application/x-tar´
+ MimeType[´tcl´] = ´text/x-tcl´
+ MimeType[´tex´] = ´text/x-tex´
+ MimeType[´texi´] = ´text/x-texinfo´
+ MimeType[´texinfo´] = ´text/x-texinfo´
+ MimeType[´tga´] = ´image/x-tga´
+ MimeType[´tgz´] = ´application/x-compressed-tar´
+ MimeType[´theme´] = ´application/x-theme´
+ MimeType[´tif´] = ´image/tiff´
+ MimeType[´tiff´] = ´image/tiff´
+ MimeType[´torrent´] = ´application/x-bittorrent´
+ MimeType[´tr´] = ´text/x-troff´
+ MimeType[´tsv´] = ´text/tab-separated-values´
+ MimeType[´ttc´] = ´application/x-font-ttf´
+ MimeType[´ttf´] = ´application/x-font-ttf´
+ MimeType[´txt´] = ´text/plain´
+ MimeType[´ustar´] = ´application/x-ustar´
+ MimeType[´vcf´] = ´text/x-vcalendar´
+ MimeType[´vcs´] = ´text/x-vcalendar´
+ MimeType[´vi´] = ´text/x-vi´
+ MimeType[´vim´] = ´text/x-vi´
+ MimeType[´viv´] = ´video/vnd.vivo´
+ MimeType[´vivo´] = ´video/vnd.vivo´
+ MimeType[´vob´] = ´video/mpeg´
+ MimeType[´voc´] = ´audio/x-voc´
+ MimeType[´vor´] = ´application/vnd.stardivision.writer´
+ MimeType[´wav´] = ´audio/x-wav´
+ MimeType[´wax´] = ´audio/x-ms-asx´
+ MimeType[´wk1´] = ´application/vnd.lotus-1-2-3´
+ MimeType[´wk3´] = ´application/vnd.lotus-1-2-3´
+ MimeType[´wk4´] = ´application/vnd.lotus-1-2-3´
+ MimeType[´wks´] = ´application/vnd.lotus-1-2-3´
+ MimeType[´wmf´] = ´image/x-wmf´
+ MimeType[´wmv´] = ´video/x-ms-wmv´
+ MimeType[´wrl´] = ´model/vrml´
+ MimeType[´wvx´] = ´video/x-ms-wvx´
+ MimeType[´xac´] = ´application/x-gnucash´
+ MimeType[´xbel´] = ´application/xbel´
+ MimeType[´xbm´] = ´image/x-xbitmap´
+ MimeType[´xcf´] = ´image/x-xcf´
+ MimeType[´xi´] = ´audio/x-xi´
+ MimeType[´xla´] = ´application/vnd.ms-excel´
+ MimeType[´xlc´] = ´application/vnd.ms-excel´
+ MimeType[´xld´] = ´application/vnd.ms-excel´
+ MimeType[´xls´] = ´application/vnd.ms-excel´
+ MimeType[´xlt´] = ´application/vnd.ms-excel´
+ MimeType[´xm´] = ´audio/x-xm´
+ MimeType[´xml´] = ´text/xml´
+ MimeType[´xpm´] = ´image/x-xpixmap´
+ MimeType[´xwd´] = ´image/x-xwindowdump´
+ MimeType[´y´] = ´text/x-yacc´
+ MimeType[´yacc´] = ´text/x-yacc´
+ MimeType[´z´] = ´application/x-compress´
+ MimeType[´zip´] = ´application/zip´
+ MimeType[´zoo´] = ´application/x-zoo´
+end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/net.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/net.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/net.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/net.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -1,5 +1,6 @@
require "ev/ruby"
require "ev/ftools"
+require "ev/mime"
require "net/http"
require "socket"
require "uri"
@@ -13,11 +14,11 @@
if File.file?(file)
Hash.file(file).each do |k, v|
eval "$#{k} = ´#{v}´" unless k=~ /^\#/
- #$proxy_auth = [$proxy_auth].pack("m").chomp if k == "proxy_auth"
end
end
def uri2txt(s)
+ # ??? Werkt niet goed
i = s.index(/%[[:digit:]]{2}/)
while not i.nil?
s = s[0..(i-1)] + s[(i+1)..(i+2)].unpack(´H2´).shift.to_i.chr + s[(i+3)..-1]
@@ -147,6 +148,8 @@
rescue
end
+ @path = "/" if (not @path.nil? and @path.empty? and @protocol == "http")
+
@protocol = "" if @protocol.nil?
@userpass = "" if @userpass.nil?
@host = "" if @host.nil?
@@ -163,7 +166,7 @@
@port = @port.to_i
end
- def + (url2)
+ def +(url2)
url1 = self.to_s
url2 = url2.to_s if url2.kind_of?(self.class)
@@ -174,7 +177,7 @@
protocol = @protocol
userpass = @userpass
host = @host
- port = @port.to_s
+ port = @port
path = @path
vars = varstring
anchor = @anchor
@@ -196,6 +199,33 @@
return res
end
+ def localname
+ protocol = @protocol
+ userpass = @userpass
+ host = @host
+ port = @port
+ path = @path
+ vars = varstring
+ anchor = @anchor
+
+ protocol = nil if @protocol.empty?
+ userpass = nil if @userpass.empty?
+ host = nil if @host.empty?
+ port = nil if @port.zero?
+ path = nil if @path.empty?
+ vars = nil if @vars.empty?
+ anchor = nil if @anchor.empty?
+
+ path = "#{path}." if path =~ /[\/\\]$/
+
+ f = MD5.new(protocol.to_s + userpass.to_s + host.to_s + port.to_s + File.dirname(path.to_s) + vars.to_s).to_s
+ e = File.basename(path.to_s).gsub(/[^\w\.\-]/, "_").gsub(/_+/, "_")
+ res = f + "." + e
+ res.gsub!(/[^\w]+$/, "")
+
+ return res
+ end
+
def varstring
res = []
vars = @vars.dup
@@ -281,36 +311,52 @@
end
end
+ class NoAddressException < StandardError
+ end
+
+ def self.getaddress(host)
+ if not @@hosts.include?(host)
+ @@hosts[host] = ""
+ evtimeout(5) do # ??? Doet ´ut niet?...
+ @@hosts[host] = IPSocket.getaddress(host)
+ end
+ end
+
+ raise NoAddressException, host if @@hosts[host].empty?
+
+ @@hosts[host]
+ end
+
def self.head(uri, form={}, recursive=true)
header = Header.new(nil)
begin
while not uri.nil?
- if $proxy.nil? or $proxy.empty?
- uri = EVURI.new(uri) if uri.kind_of? String
- host = uri.host
- port = uri.port
+ uri = EVURI.new(uri) if uri.kind_of? String
+ host = uri.host
+ port = uri.port
+
+ if $proxy.nil? or $proxy.empty? or host == "localhost"
io = nil
@@mutex.synchronize do
- @@hosts[host] = IPSocket.getaddress(host) if not @@hosts.include?(host)
- io = TCPSocket.new(@@hosts[host], port.zero? ? 80 : port)
+ io = TCPSocket.new(getaddress(host), port.zero? ? 80 : port)
end
io.write("HEAD #{uri.path or ´/´}#{uri.varstring.empty? ? ´´ : ´?´ + uri.varstring} HTTP/1.0\r\nHost: #{host}\r\n\r\n")
else
proxy = EVURI.new($proxy)
- host = proxy.host
- port = proxy.port
-
- io = TCPSocket.new(host, port.zero? ? 8080 : port)
+ io = TCPSocket.new(proxy.host, proxy.port.zero? ? 8080 : proxy.port)
io.write("HEAD #{uri} HTTP/1.0\r\n#{"Proxy-Authorization: Basic "+$proxy_auth+"\r\n" if not $proxy_auth.nil?}\r\n\r\n")
end
io.close_write
- res = io.read
+ res = io.read
+
+ io.close_read
+
header, data = nil, nil
header, data = res.split(/\r*\n\r*\n/, 2) if not res.nil?
header = Header.new(header)
@@ -321,14 +367,23 @@
uri = nil
end
end
- rescue
+ rescue Errno::ECONNRESET, Errno::EHOSTUNREACH => e
+ $stderr.puts e.message
+ sleep 1
+ retry
+ rescue Errno::ECONNREFUSED => e
+ data = nil
+ rescue NoAddressException => e
+ $stderr.puts e.message
header = Header.new(nil)
end
+ GC.start
+
return header
end
- def self.get(uri, form={})
+ def self.get(uri, httpheader={}, form={})
post = Array.new
form.each_pair do |var, value|
post << "#{var.to_html}=#{value.to_html}"
@@ -339,15 +394,14 @@
begin
while not uri.nil?
- if $proxy.nil? or $proxy.empty?
- uri = EVURI.new(uri) if uri.kind_of? String
- host = uri.host
- port = uri.port
+ uri = EVURI.new(uri) if uri.kind_of? String
+ host = uri.host
+ port = uri.port
+ if $proxy.nil? or $proxy.empty? or host == "localhost"
io = nil
@@mutex.synchronize do
- @@hosts[host] = IPSocket.getaddress(host) if not @@hosts.include?(host)
- io = TCPSocket.new(@@hosts[host], port.zero? ? 80 : port)
+ io = TCPSocket.new(getaddress(host), port.zero? ? 80 : port)
end
if post.empty?
@@ -357,10 +411,7 @@
end
else
proxy = EVURI.new($proxy)
- host = proxy.host
- port = proxy.port
-
- io = TCPSocket.new(host, port.zero? ? 8080 : port)
+ io = TCPSocket.new(proxy.host, proxy.port.zero? ? 8080 : proxy.port)
if post.empty?
io.write "GET %s HTTP/1.0\r\n" % uri
@@ -370,22 +421,32 @@
end
io.write "Host: %s\r\n" % host
- io.write "User-Agent: evwget\r\n"
- io.write "Proxy-Authorization: Basic %s\r\n" % $proxy_auth unless $proxy_auth.nil?
+ io.write "User-Agent: xyz\r\n"
+ io.write "Proxy-Authorization: Basic %s\r\n" % $proxy_auth unless $proxy_auth.nil?
#io.write "Accept-Encoding: deflate\r\n"
- #io.write "Connection: close\r\n"
+ #io.write "Accept-Charset: ISO-8859-1\r\n"
+ io.write "Connection: close\r\n"
io.write "Content-Type: application/x-www-form-urlencoded\r\n" unless post.empty?
io.write "Content-Length: %s\r\n" % post.length unless post.empty?
+ httpheader.each do |k, v|
+ $stderr.puts "%s: %s\r\n" % [k, v]
+ io.write "%s: %s\r\n" % [k, v]
+ end
io.write "\r\n"
io.write post unless post.empty?
io.close_write
res = io.read
+
+ io.close_read
+
header, data = nil, nil
header, data = res.split(/\r*\n\r*\n/, 2) if not res.nil?
header = Header.new(header)
+ length = header.header["content-length"]
+ data = "" if length == "0"
if header.header["location"] != uri.to_s
uri = EVURI.new(uri) + header.header["location"]
@@ -397,12 +458,25 @@
data = Chunk.new(data).to_s if not data.nil?
end
+ #if header.header["content-encoding"] == "gzip"
+ #data = "gzip -d".exec(data) if not data.nil?
+ #end
+
data = nil unless header.code == 200
end
- rescue
+ rescue Errno::ECONNRESET, Errno::EHOSTUNREACH => e
+ $stderr.puts e.message
+ sleep 1
+ retry
+ rescue Errno::ECONNREFUSED => e
+ data = nil
+ rescue NoAddressException, Errno::ECONNREFUSED => e
+ $stderr.puts e.message
data = nil
end
+ GC.start
+
return data
end
@@ -422,7 +496,7 @@
file = "#{dir}/#{hash}"
data = nil
- Dir.mkdirrec(dir)
+ File.mkpath(dir)
expire = 356*24*60*60
@@ -447,7 +521,7 @@
class RequestGet < Hash
def initialize(data)
CGI.parse(data).each do |k, v|
- self[k] = v.join(" ")
+ self[k] = v
end
end
end
@@ -455,7 +529,7 @@
class RequestPost < Hash
def initialize(data)
CGI.parse(data).each do |k, v|
- self[k] = v.join(" ")
+ self[k] = v
end
end
end
@@ -493,6 +567,8 @@
attr_reader :request
attr_reader :cookies
attr_reader :vars
+ attr_reader :user
+ attr_writer :user
def initialize(io)
@io = io
@@ -562,6 +638,7 @@
class Response < Hash
attr_writer :response
+ attr_writer :file
attr_reader :cookies
attr_reader :stop
attr_reader :at_stop
@@ -574,10 +651,20 @@
@syncd = false
@stop = false
@at_stop = lambda{}
+ @file = nil
end
def flush
sync
+
+ if @file
+ File.open(@file, "rb") do |f|
+ while data = f.read(10_000)
+ @io.write data
+ end
+ end
+ end
+
@io.close
end
@@ -595,6 +682,21 @@
end
def sync
+ size = (@data or "").length
+
+ if @file
+ ext = @file.scan(/\.[^\.]*$/)
+ ext = ext.shift
+ ext = ext[1..-1] unless ext.nil?
+ mimetype = EVMime::MimeType[ext]
+
+ self["Content-Type"] = mimetype unless mimetype.nil?
+
+ size += File.size(@file) if File.file?(@file)
+ end
+
+ self["Content-Length"] = size
+
@io.write("#{to_s}\r\n") unless @syncd
@io.write(@data)
@data = ""
@@ -605,6 +707,10 @@
@data << s
end
+ def clean
+ @data = ""
+ end
+
def inspect
"(Response: %s)" % [@response, @data].join(", ")
end
@@ -640,7 +746,7 @@
count = 0
at_exit do
- $stderr.puts "Received #{count} requests"
+ #$stderr.puts "Received #{count} requests"
end
serverthread =
@@ -678,7 +784,7 @@
end
if (not remote) or (remote and (auth.nil? or auth.empty? or authenticate(auth, realm, req, resp)))
- $stderr.puts "#{count2}, #{Time.new.strftime("%Y-%m-%d.%H:%M:%S")}, #{ip}, #{req.request.to_s.strip}"
+ $stderr.puts "#{count2} #{Time.new.strftime("%Y-%m-%d %H:%M:%S")} #{ip} #{req.user} #{req.request.to_s.strip}"
begin
yield(req, resp)
@@ -687,6 +793,16 @@
$stderr.puts e.class.to_s + ": " + e.message
$stderr.puts e.backtrace.collect{|s| "\t"+s}.join("\n")
end
+ resp["Content-Type"] = "text/plain"
+ resp.response = "HTTP/1.0 200 ???"
+ resp.clean
+ resp << e.class.to_s + ": " + e.message
+ resp << "\n"
+ resp << "\n"
+ resp << e.backtrace.collect{|s| "\t"+s}.join("\n")
+ resp << "\n"
+ resp << "\n"
+ resp << "(You can use the back button and stop the application properly, if appropriate.)"
end
stop = true if resp.stop?
@@ -738,13 +854,13 @@
ok = (auths.include?(u) and auths[u] == p)
- if ok
-
- else
+ unless ok
resp["WWW-Authenticate"] = "Basic realm=\"#{realm}\""
resp.response = "HTTP/1.0 401 Unauthorized"
end
+ req.user = u
+
return ok
end
end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/ruby.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/ruby.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/ruby.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/ruby.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -18,14 +18,16 @@
tekens31 = ´\w\s\r\n´
-RegExpStringWord = "([#{tekens11}]+)" ; RegExpWord = Regexp.new(RegExpStringWord)
-RegExpStringWord2 = "([#{tekens21}]([#{tekens22}]*[#{tekens23}])?)" ; RegExpWord2 = Regexp.new(RegExpStringWord2)
-RegExpStringText = "([#{tekens31}]+)" ; RegExpText = Regexp.new(RegExpStringText)
-RegExpStringFile = ´(\w[\w\.\-]*)´ ; RegExpFile = Regexp.new(RegExpStringFile)
-RegExpStringEmail = ´([\w\-\.]+@[\w\-\.]+)´ ; RegExpEmail = Regexp.new(RegExpStringEmail)
-RegExpStringURL = ´(\w+:\/\/[\w\.\-]+(:\d*)?\/[\w\.\-\/\#\?\=\%]*)´ ; RegExpURL = Regexp.new(RegExpStringURL)
-RegExpStringPrint = ´([\w \t\r\n\`\~\!\@\#\$\%\^\&\*\(\)\-\+\=\[\]\{\}\;\:\´\"\,\.\/\<\>\?\\\|]+)´ ; RegExpPrint = Regexp.new(RegExpStringPrint)
-RegExpStringDiff = ´(^[\-\+]([^\-\+].*)?)´ ; RegExpDiff = Regexp.new(RegExpStringDiff)
+RegExpStringWord = "([#{tekens11}]+)" ; RegExpWord = Regexp.new(RegExpStringWord)
+RegExpStringWord2 = "([#{tekens21}]([#{tekens22}]*[#{tekens23}])?)" ; RegExpWord2 = Regexp.new(RegExpStringWord2)
+RegExpStringText = "([#{tekens31}]+)" ; RegExpText = Regexp.new(RegExpStringText)
+RegExpStringFile = ´(\w[\w\.\-]*)´ ; RegExpFile = Regexp.new(RegExpStringFile)
+RegExpStringEmail = ´([\w\-\.]+@[\w\-\.]+)´ ; RegExpEmail = Regexp.new(RegExpStringEmail)
+RegExpStringURL = ´(\w+:\/\/[\w\.\-]+(:\d*)?\/[\w\.\-\/\#\?\=\%]*)´ ; RegExpURL = Regexp.new(RegExpStringURL)
+RegExpStringPrint = ´([\w \t\r\n\`\~\!\@\#\$\%\^\&\*\(\)\-\+\=\[\]\{\}\;\:\´\"\,\.\/\<\>\?\\\|]+)´ ; RegExpPrint = Regexp.new(RegExpStringPrint)
+RegExpStringDiff = ´(^[\-\+]([^\-\+].*)?)´ ; RegExpDiff = Regexp.new(RegExpStringDiff)
+RegExpStringHTHLink = ´(`[\w\,]*\ba\b[^`]*`)´ ; RegExpHTHLink = Regexp.new(RegExpStringHTHLink)
+RegExpStringHTHSpecial = ´(`[^`]*`)´ ; RegExpHTHSpecial = Regexp.new(RegExpStringHTHSpecial)
module Enumerable
def deep_dup
@@ -64,6 +66,10 @@
def to_fs
to_f
end
+
+ def to_html(eolconversion=true)
+ self.to_s.to_html(eolconversion)
+ end
end
class Integer
@@ -211,8 +217,8 @@
end
def splitwords(tokens=[])
- tokens = [tokens] unless tokens.kind_of?(Array)
- res = []
+ tokens = [tokens] unless tokens.kind_of?(Array)
+ res = []
self.splitblocks(["´", "´"], [´"´, ´"´]).each do |type, s|
case type
@@ -437,13 +443,14 @@
end
def format(format)
+ format = format.gsub(/\s/, "")
res = []
[format.length, self.length].min.times do |n|
- case format[n].chr
- when "i" then res << self[n].to_i
- when "s" then res << self[n].to_s
- when "x" then res << self[n]
+ case format[n].chr.downcase
+ when "i" then res << self[n].to_i
+ when "s" then res << self[n].to_s
+ else res << self[n]
end
end
@@ -540,6 +547,36 @@
def ids
collect{|e| e.ids}
end
+
+ def rotate
+ raise "Array has to be 2D (An Array of Arrays)." unless self.dup.delete_if{|a| a.kind_of?(Array)}.empty?
+
+ res = []
+
+ self[0].length.times do |x|
+ a = []
+
+ self.length.times do |y|
+ a << self[y][x]
+ end
+
+ res << a
+ end
+
+ res
+ end
+
+ def to_h
+ raise "Array has to be 2D (An Array of Arrays)." unless self.dup.delete_if{|a| a.kind_of?(Array)}.empty?
+
+ res = {}
+
+ self.each do |k, v, *rest|
+ res[k] = v
+ end
+
+ res
+ end
end
class Hash
@@ -699,7 +736,11 @@
end
def linux?
- not windows? and not cygwin?
+ not (target_os.downcase =~ /linux/).nil?
+end
+
+def darwin?
+ not (target_os.downcase =~ /darwin/).nil?
end
def windows?
@@ -727,8 +768,9 @@
end
def stdtmp
- $stderr = $stdout = File.new("#{temp}/ruby.#{Process.pid}.log", "a") unless ARGV.include?("--rwd-exit")
+ $stderr = $stdout = File.new("#{temp}/ruby.#{Process.pid}.log", "a")
end
+stdtmp if defined?(RUBYSCRIPT2EXE) and (RUBYSCRIPT2EXE =~ /rubyw/i)
$nobm = false
@@ -745,7 +787,7 @@
end
end
- label = label.to_s
+ label = label.inspect #unless label.kind_of?(String)
res = nil
$bm_mutex = ($bm_mutex or Mutex.new)
@@ -757,29 +799,41 @@
$bm = {}
at_exit do
- format1 = "%10s %10s %10s %10s %10s %10s %10s"
- format2 = "%10s %10.6f %10.6f %10.6f %10.6f %10.6f %10d"
-
- $stderr.puts format1 % ["LABEL", "USERCPU", "SYSCPU", "CUSERCPU", "CSYSCPU", "ELAPSED", "TIMES"]
- $bm.sort{|a, b| [a[1], a[0]] <=> [b[1], b[0]]}.each do |k, v|
- $stderr.puts format2 % [k, *v]
+ l = $bm.keys.collect{|s| s.length}.max
+ #format1 = "%10s %10s %10s %10s %10s %10s %s"
+ #format2 = "%10.6f %10.6f %10.6f %10.6f %10.6f %10d %s"
+ #$stderr.puts format1 % ["USERCPU", "SYSCPU", "CUSERCPU", "CSYSCPU", "ELAPSED", "COUNT", "LABEL"]
+ #$bm.sort{|a, b| [b[1], b[0]] <=> [a[1], a[0]]}.each do |k, v|
+ #$stderr.puts format2 % (v + [k])
+ #end
+
+ format1 = "%10s %10s %10s %s"
+ format2 = "%10.6f %10.6f %10d %s"
+ $bm.each do |k, v|
+ $bm[k] = [v[0]+v[1], v[4], v[5]]
+ end
+ $stderr.puts format1 % ["CPU", "ELAPSED", "COUNT", "LABEL"]
+ $bm.sort{|a, b| [b[1], b[0]] <=> [a[1], a[0]]}.each do |k, v|
+ $stderr.puts format2 % (v + [k])
end
end
end
$bm[label] = [0.0]*5 + [0] unless $bm.include?(label)
+ $bm[label][5] += 1
end
if block_given?
bm = Benchmark.measure{res = yield}
bma = bm.to_a # [dummy label, user CPU time, system CPU time, childrens user CPU time, childrens system CPU time, elapsed real time]
+ $bm_last = bma
+
$bm_mutex.synchronize do
+ e = $bm[label]
0.upto(4) do |n|
- $bm[label][n] += bma[n+1]
+ e[n] += bma[n+1]
end
-
- $bm[label][5] += 1
end
end
@@ -817,3 +871,19 @@
res
end
end
+
+def ask(options, text=false)
+ i = 0
+ $stderr.puts ""
+ options.each do |s|
+ $stderr.puts " %d %s" % [i+=1, s]
+ end
+ $stderr.puts ""
+ $stderr.print "? "
+ res = $stdin.gets
+ unless res.nil?
+ res = res.strip
+ res = options[res.to_i-1] if text and not res.empty?
+ end
+ res
+end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/rwd.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/rwd.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/rwd.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/rwd.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -15,6 +15,7 @@
end
$rwd_exit = ARGV.include?("--rwd-exit") # Hack ???
+$rwd_exit = true if defined?(REQUIRE2LIB)
$rwd_debug = ($rwd_debug or $DEBUG or false)
$rwd_border = ($rwd_border or 0)
$rwd_dir = Dir.pwd
@@ -27,10 +28,12 @@
RWDEmptyline = "..."
+#module RWD
+
rcfile = nil
-s = ENV["HOME"] ; s = s + "/.rwdrc" if not s.nil? ; rcfile = s if (not s.nil? and rcfile.nil? and File.file?(s))
-s = ENV["USERPROFILE"] ; s = s + "/rwd.cfg" if not s.nil? ; rcfile = s if (not s.nil? and rcfile.nil? and File.file?(s))
-s = ENV["windir"] ; s = s + "/rwd.cfg" if not s.nil? ; rcfile = s if (not s.nil? and rcfile.nil? and File.file?(s))
+s = ENV["HOME"] ; s = File.expand_path(".rwdrc", s) unless s.nil? ; rcfile = s if (not s.nil? and rcfile.nil? and File.file?(s))
+s = ENV["USERPROFILE"] ; s = File.expand_path("rwd.cfg", s) unless s.nil? ; rcfile = s if (not s.nil? and rcfile.nil? and File.file?(s))
+s = ENV["windir"] ; s = File.expand_path("rwd.cfg", s) unless s.nil? ; rcfile = s if (not s.nil? and rcfile.nil? and File.file?(s))
AL = "align=´left´"
AC = "align=´center´"
@@ -51,7 +54,7 @@
ENV["RWDPORTS"] = (ENV["RWDPORTS"] or "7701-7709")
ENV["RWDTHEME"] = (ENV["RWDTHEME"] or "DEFAULT")
-trap("INT") {puts "Terminating..." ; exit}
+#trap("INT") {puts "Terminating..." ; exit}
$SAFE = 2
@@ -93,7 +96,7 @@
a = [emptyline].concat(self)
end
- a.numsort.collect{|s| "<option>#{s.to_html}</option>" }.join("\n")
+ a.numsort.collect{|s| "<option>#{s.to_s.to_html}</option>" }.join("\n")
end
def rwd_method(method)
@@ -109,17 +112,32 @@
return res
end
- def rwd_row(key=nil, value=nil)
+ def rwd_row(key=nil, value=nil, bold=false)
res = ""
res = res + "<row valign=´top´>"
res = res + "<radio name=´#{key.to_html}´ value=´#{value.to_html}´/>" unless key.nil?
- res = res + self.collect{|s| "<p align=´left´>#{s.to_html}</p>"}.join("")
+ res = res + self.collect{|s| "<p align=´#{(s.kind_of?(Numeric) or s =~ /^\d+\.\d+$/) ? "right" : "left"}´>#{"<b>" if bold}#{s.to_s.to_html}#{"</b>" if bold}</p>"}.join("")
res = res + "</row>"
return res
end
+ def rwd_table(headers=nil, highlightrows=[])
+ res = ""
+
+ highlightrows = [highlightrows].flatten
+
+ n = -1
+
+ res = res + "<table>"
+ res = res + headers.rwd_row(nil, nil, true) unless headers.nil?
+ res = res + self.collect{|a| a.rwd_row(nil, nil, highlightrows.include?(n+=1))}.join("")
+ res = res + "</table>"
+
+ return res
+ end
+
def rwd_headers(emptyfield=false)
res = ""
@@ -131,7 +149,7 @@
return res
end
- def rwd_form(prefix, values, twoparts=0, options={})
+ def rwd_form(prefix, values=[], twoparts=0, options={})
res = []
res << "<table>"
@@ -151,7 +169,7 @@
s = ""
s << "<text name=´#{name}´"
- s << " value=´#{values[n].to_html}´" if n < values.length
+ s << " value=´#{values[n].to_s.to_html}´" if n < values.length
s << "/>"
res << s
@@ -266,7 +284,7 @@
template = $rwd_html_1
template = $rwd_html_PDA_1 if pda
- res <<(template(template, args))
+ res << (template(template, args))
when "p" then res << "<p #{align}>"
when "pre" then res << "<pre #{align}>"
when "big" then res << "<p #{align}><big>"
@@ -310,6 +328,7 @@
maxlength = ""
maxlength = "maxlength=´%s´" % @args["maxlength"] if @args.include?("maxlength")
size = ""
+ size = "size=´%s´" % @args["size"] if @args.include?("size")
size = "size=´%s´" % 10 if pda
res << "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´text´ #{maxlength} #{size}>"
oneormorefields << "true"
@@ -340,7 +359,7 @@
end
oneormorefields << "true"
when "select"
- res << "<select #{align} name=´#{@args["name"]}´ width=´#{@args["width"]}´>"
+ res << "<select #{align} name=´#{@args["name"]}´ width=´#{@args["width"]} size=´#{@args["size"]}´>" # ??? Misschien nog iets met ´multiple´?
name = @args["name"]
$select = varshtml[name]
oneormorefields << "true"
@@ -480,7 +499,7 @@
template = $rwd_html_2
template = $rwd_html_PDA_2 if pda
- res <<(template(template, args))
+ res << (template(template, args))
when "p" then res << "</p>"
when "pre" then res << "</pre>"
when "big" then res << "</big></p>"
@@ -555,10 +574,15 @@
end
logo = nil
- logo = File.expand_path(vars["logo"], $rwd_files) if vars.include?("logo")
- logo = nil unless logo.nil? or File.file?(logo)
+ logo = File.expand_path(vars["logo"], $rwd_files) if vars.include?("logo")
+ logo = nil unless logo.nil? or File.file?(logo)
+
+ watermark = nil
+ watermark = File.expand_path(vars["watermark"], $rwd_files) if vars.include?("watermark")
+ watermark = nil unless watermark.nil? or File.file?(watermark)
a["LOGO"] = "" unless not logo.nil?
+ a["WATERMARK"] = "" unless not watermark.nil?
a["HELPBUTTON"] = (not (vars["nohelpbutton"]))
a["BACKBUTTONS"] = (not (vars["nobackbuttons"]))
@@ -619,10 +643,12 @@
tree = XML.new(rwd)
tree.parse(OpenTag, "window") do |type, obj|
+ $rwd_appvars.each{|k, v| obj.args[k] = v}
@@windows[rwd][obj.args["name"]] = obj.to_h
end
tree.parse(OpenTag, "helpwindow") do |type, obj|
+ $rwd_appvars.each{|k, v| obj.args[k] = v}
@@helpwindows[rwd][obj.args["name"]] = obj.to_h
end
end
@@ -638,6 +664,8 @@
firstaction = ""
html = []
+ vars = vars.deep_dup
+
vars.each do |key, value|
if not key.empty?
if value.respond_to? "to_s"
@@ -730,7 +758,7 @@
class RWDDone < RWDWindow
def initialize(exitbrowser)
- super("<window title=´RWD Message´ nobackbuttons noclosebutton><p>Done.</p><horizontal><close/>#{exitbrowser ? "" : "<button caption=´Again´/>"}</horizontal>#{exitbrowser ? "<closewindow/>" : ""}</window>")
+ super("<window title=´RWD Message´ nobackbuttons noclosebutton><p>Done.</p><i>(Some browsers don´t close,<br>because of security reasons.)</i><horizontal><close/>#{exitbrowser ? "" : "<button caption=´Again´/>"}</horizontal>#{exitbrowser ? "<closewindow/>" : ""}</window>")
end
end
@@ -741,6 +769,14 @@
@rwd_history = []
@rwd_ignore_vars = []
@rwd_call_after_back = []
+ @rwd_time = Time.now
+
+ $rwd_appvars = {} if $rwd_appvars.nil?
+ XML.new(xml).parse(OpenTag, "application") do |type, obj|
+ obj.args.deep_dup.each do |k, v|
+ $rwd_appvars[k] = v
+ end
+ end
end
def self.file(rwdfile, *args)
@@ -764,9 +800,14 @@
port = port.to_i
@rwd_server = RWDServer.new(self, port, io, auth, realm)
+
+ self
end
def render(res, path, post, download, downloadfile, pda, sessionid)
+ # Avoid a timeout.
+
+ @rwd_time = Time.now
# Initialize some vars.
@@ -777,7 +818,7 @@
help = false
back = false
tab = ""
- @rwd_msgtype = nil
+ @rwd_msgtype = nil if @rwd_progress_thread.nil?
@rwd_download = nil
@rwd_download_file = nil
@@ -818,6 +859,8 @@
@rwd_action = "rwd_back"
end
+ @rwd_history = [["main", [], "main", ""]] if @rwd_history.empty?
+
if @rwd_action =~ /^rwd_tab_/
@rwd_tab = @rwd_action.sub(/^rwd_tab_/, "")
@rwd_history[-1][3] = @rwd_tab
@@ -839,6 +882,7 @@
@rwd_history = []
when "rwd_quit"
done = true
+ else
end
# History stuff
@@ -882,6 +926,15 @@
a = [@rwd_action, @rwd_args, @rwd_window, @rwd_tab]
@rwd_history.push a if (@rwd_history[-1] != a or not @rwd_msgtype.nil?)
+
+ if @rwd_window == "rwd_back"
+ @rwd_history.pop
+ @rwd_history.pop
+ @rwd_action = (@rwd_history[-1] or [nil, nil, nil])[0]
+ @rwd_args = (@rwd_history[-1] or [nil, nil, nil])[1]
+ @rwd_window = (@rwd_history[-1] or [nil, nil, nil])[2]
+ @rwd_tab = (@rwd_history[-1] or [nil, nil, nil])[3]
+ end
end
end
@@ -910,12 +963,13 @@
download << @rwd_download
downloadfile << @rwd_download_file
else
- if not @rwd_msgtype.nil?
- res << RWDMessage.new(@rwd_msg).render(pda) if @rwd_msgtype == "message"
- res << RWDError.new(@rwd_msg).render(pda) if @rwd_msgtype == "error"
+ if not @rwd_progress_thread.nil?
+ res << RWDProgressBar.new(@rwd_progress_refresh, @rwd_progress_progress).render(pda, @rwd_refresh_action)
else
- if not @rwd_progress_thread.nil?
- res << RWDProgressBar.new(@rwd_progress_refresh, @rwd_progress_progress).render(pda, @rwd_refresh_action)
+ if not @rwd_msgtype.nil?
+ res << RWDMessage.new(@rwd_msg).render(pda) if @rwd_msgtype == "message"
+ res << RWDError.new(@rwd_msg).render(pda) if @rwd_msgtype == "error"
+ res << @rwd_msg if @rwd_msgtype == "text"
else
puts "Window: #{@rwd_window}" if $rwd_debug
puts "Tab: #{@rwd_tab}" if $rwd_debug
@@ -943,6 +997,11 @@
@rwd_msgtype = "error"
end
+ def text(msg)
+ @rwd_msg = "<html><body><pre>#{msg}</pre></body></html>"
+ @rwd_msgtype = "text"
+ end
+
def progressbar(refresh, *progress)
@rwd_progress_refresh = (refresh or 1)
@rwd_progress_progress = []
@@ -983,6 +1042,23 @@
def exitbrowser
@rwd_exitbrowser = true
end
+
+ def timeout(timeout, interval=1)
+ @rwd_timeout = timeout
+
+ unless @rwd_timeout_thread
+ @rwd_timeout_thread =
+ Thread.new do
+ loop do
+ if Time.now - @rwd_time > @rwd_timeout
+ $stderr.puts "Exiting due to timeout (#{@rwd_timeout} seconds)."
+ exit 1
+ end
+ sleep interval
+ end
+ end
+ end
+ end
end
class RWDLogin < RWDialog
@@ -1039,7 +1115,7 @@
end
end
-class Session < Hash
+class RWDSession < Hash
attr_reader :sessionid
attr_reader :lastaccess
attr_reader :authenticated
@@ -1054,9 +1130,7 @@
def touch
@lastaccess = Time.now
end
-end
-class RWDSession < Session
def render(res, path, post, download, downloadfile, pda)
done = self["object"].render(res, path, post, download, downloadfile, pda, @sessionid)
@@ -1092,18 +1166,13 @@
browser = ENV["RWDBROWSER"].dup
url = "http://localhost:%s/" % [port]
- if cygwin?
- browser.gsub!(/\\/, "/")
- browser.gsub!(/ /, "\\ ")
- end
-
re = /[$%]1\b/
command = "%s \"%s\"" % [browser, url]
command = browser.gsub(re, url) if browser =~ re
command.gsub!(/%port%/, port.to_s)
- system(command) or puts "Starting of the browser failed, or the browser terminated abnormally.\nCommand => #{command}"
+ system(command) or $stderr.puts "Starting of the browser failed, or the browser terminated abnormally.\nCommand => #{command}"
#end
puts "The browser has terminated."
@@ -1119,8 +1188,10 @@
HTTPServer.serve(portio, (not auth.nil?)) do |req, resp|
threadlimiter.wait do
-
- vars = req.vars.dup
+ vars = {}
+ req.vars.each do |k, v|
+ vars[k] = v.join("\t")
+ end
pad = (req.request.path or "/")
if auth.kind_of? String
@@ -1151,7 +1222,7 @@
end
if oldsessionid.nil? or oldsessionid.empty?
- if not auth.nil? and not auth.empty? and not session.authenticated and pad != "/rwd_pixel.gif"
+ if not auth.nil? and not auth.empty? and not session.authenticated and pad !~ /^\/rwd_/
# Check authentication
@@ -1289,6 +1360,10 @@
<style type=´text/css´>
<!--
+ body {
+ background : url(%WATERMARK%) white center center no-repeat fixed;
+ }
+
a {
text-decoration : none;
}
@@ -1379,22 +1454,22 @@
<table align=´center´ border=´0´ cellspacing=´0´ cellpadding=´0´>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
@@ -1402,12 +1477,12 @@
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
@@ -1417,11 +1492,11 @@
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´#EEEEEE´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
@@ -1431,7 +1506,7 @@
<td align=´center´ bgcolor=´#EEEEEE´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
<tr align=´center´>
@@ -1520,7 +1595,7 @@
</tr>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´#EEEEEE´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
@@ -1530,11 +1605,11 @@
<td align=´center´ bgcolor=´#EEEEEE´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
@@ -1544,12 +1619,12 @@
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
@@ -1557,22 +1632,22 @@
<td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
<tr align=´center´>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
<td align=´center´ bgcolor=´black´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
- <td align=´center´ bgcolor=´white´><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
+ <td align=´center´ ><img src=´rwd_pixel.gif´ height=´1´ width=´1´></td>
</tr>
</table>
@@ -1601,6 +1676,10 @@
<style type=´text/css´>
<!--
+ body {
+ background : url(%WATERMARK%) white center center no-repeat fixed;
+ }
+
a {
text-decoration : none;
}
@@ -1823,26 +1902,21 @@
"
$rwd_pixel = "
-R0lGODlhAQABAOcAAAAAAAEBAQICAgMDAwQEBAUFBQYGBgcHBwgICAkJCQoK
-CgsLCwwMDA0NDQ4ODg8PDxAQEBERERISEhMTExQUFBUVFRYWFhcXFxgYGBkZ
-GRoaGhsbGxwcHB0dHR4eHh8fHyAgICEhISIiIiMjIyQkJCUlJSYmJicnJygo
-KCkpKSoqKisrKywsLC0tLS4uLi8vLzAwMDExMTIyMjMzMzQ0NDU1NTY2Njc3
-Nzg4ODk5OTo6Ojs7Ozw8PD09PT4+Pj8/P0BAQEFBQUJCQkNDQ0REREVFRUZG
-RkdHR0hISElJSUpKSktLS0xMTE1NTU5OTk9PT1BQUFFRUVJSUlNTU1RUVFVV
-VVZWVldXV1hYWFlZWVpaWltbW1xcXF1dXV5eXl9fX2BgYGFhYWJiYmNjY2Rk
-ZGVlZWZmZmdnZ2hoaGlpaWpqamtra2xsbG1tbW5ubm9vb3BwcHFxcXJycnNz
-c3R0dHV1dXZ2dnd3d3h4eHl5eXp6ent7e3x8fH19fX5+fn9/f4CAgIGBgYKC
-goODg4SEhIWFhYaGhoeHh4iIiImJiYqKiouLi4yMjI2NjY6Ojo+Pj5CQkJGR
-kZKSkpOTk5SUlJWVlZaWlpeXl5iYmJmZmZqampubm5ycnJ2dnZ6enp+fn6Cg
-oKGhoaKioqOjo6SkpKWlpaampqenp6ioqKmpqaqqqqurq6ysrK2tra6urq+v
-r7CwsLGxsbKysrOzs7S0tLW1tba2tre3t7i4uLm5ubq6uru7u7y8vL29vb6+
-vr+/v8DAwMHBwcLCwsPDw8TExMXFxcbGxsfHx8jIyMnJycrKysvLy8zMzM3N
-zc7Ozs/Pz9DQ0NHR0dLS0tPT09TU1NXV1dbW1tfX19jY2NnZ2dra2tvb29zc
-3N3d3d7e3t/f3+Dg4OHh4eLi4uPj4+Tk5OXl5ebm5ufn5+jo6Onp6erq6uvr
-6+zs7O3t7e7u7u/v7/Dw8PHx8fLy8vPz8/T09PX19fb29vf39/j4+Pn5+fr6
-+vv7+/z8/P39/f7+/v///yH+FUNyZWF0ZWQgd2l0aCBUaGUgR0lNUAAh+QQB
-CgD/ACwAAAAAAQABAAAIBAD/BQQAOw==
+R0lGODlhAQABAMIAAAAAAP///+7u7kREiP///////////////yH5BAEKAAMA
+LAAAAAABAAEAAAMCOAkAOw==
".unpack("m").shift
+$rwd_logo = "
+R0lGODlhEAAQAMIAAAAAAP///+7u7kREiP///////////////yH5BAEKAAQA
+LAAAAAAQABAAAANCSErQ/k21QKulrIrNu8heuAGUcJ0BuQVD676DasK0zNKv
+jefB+oo6l6AxBAx7M2HRePQph5xga0RsJqfELPI2DSUAADs=
+".unpack("m").shift
+
+
$rwd_html_1, $rwd_html_2 = $rwd_html[ENV["RWDTHEME"]].split(/^\s*%BODY%\s*\r*$/)
$rwd_html_PDA_1, $rwd_html_PDA_2 = $rwd_html["PDA"].split(/^\s*%BODY%\s*\r*$/)
+
+#end
+#
+#class RWDialog < RWD::RWDialog
+#end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/sgml.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/sgml.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/sgml.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/sgml.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -88,7 +88,7 @@
def prechildren_to_sgml(res)
a = [@subtype]
- @args.each do |k, v|
+ @args.sort.each do |k, v|
if not v.include?("´")
a << "#{k}=´#{v}´"
else
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/tree.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/tree.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/tree.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/tree.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -88,7 +88,7 @@
def inspect
parent, children = @parent, @children
- @parent, @children = parent.id, children.collect{|obj| obj.id}
+ @parent, @children = parent.object_id, children.collect{|obj| obj.object_id}
res = " " * (level-1) + "#{self.class}(#{@subtype}) #{super}"
@@ -96,6 +96,34 @@
res
end
+
+ def previous(klass=[], skip=[])
+ klass = [klass].flatten
+ skip = [skip].flatten
+
+ po = @parent
+ return nil if po.nil?
+
+ ch = po.children
+ return nil if ch.nil?
+
+ n = ch.index(self)
+ return nil if n.nil?
+
+ res = nil
+ if klass.nil?
+ n -= 1
+ res = ch[n]
+ else
+ begin
+ n -= 1
+ res = ch[n]
+ end while (klass.empty? or klass.collect{|k| ch[n-1].kind_of?(k)}.sort.uniq == [true]) \
+ and (skip.empty? or skip.collect{|k| ch[n-1].kind_of?(k)}.sort.uniq == [false])
+ end
+
+ res
+ end
end
class Tree
@@ -138,7 +166,7 @@
end
def self.location(url, form=Hash.new)
- s = HTTPClient.get(url, form)
+ s = HTTPClient.get(url, {}, form)
s = "" if s.nil?
new(s)
end
@@ -155,7 +183,7 @@
tree = nil
- Dir.mkdirrec(dir)
+ File.mkpath(dir)
if File.file?(file)
@@mutex.synchronize do
@@ -227,7 +255,7 @@
end
def markclosed
- ([self].concat @objects).each do |obj|
+ ([self] + @objects).each do |obj|
obj.children.each_index do |i|
co1 = obj.children[i]
co2 = obj.children[i+1]
@@ -238,7 +266,7 @@
end
def deletedummies
- ([self].concat @objects).each do |obj|
+ ([self] + @objects).each do |obj|
obj.children.delete_if do |obj2|
obj2.upordown == Dummy
end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/xml.lib.rb rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/xml.lib.rb
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/lib/xml.lib.rb 2004-12-17 12:40:15.000000000 +0100
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/lib/xml.lib.rb 2005-06-04 14:41:52.000000000 +0200
@@ -1,4 +1,101 @@
require "ev/sgml"
+class SGMLObject
+ def to_x(closetags=true)
+ res = ""
+
+ parsetree("prechildren_to_x", "postchildren_to_x", res, closetags)
+
+ res
+ end
+end
+
+class Text < SGMLObject
+ def prechildren_to_x(res, closetags)
+ res << @text.strip unless @text.strip.empty?
+ end
+end
+
+class Comment < SGMLObject
+ def prechildren_to_x(res, closetags)
+ res << "\n" if not previous([], [Text]).kind_of?(Comment)
+ lines = @text.gsub(/(<!--|-->)/, "").lf.split(/\n/)
+ if lines.length == 1
+ res << " "*(@level-1) + "<!-- " + lines[0].strip + " -->" + "\n"
+ else
+ res << " "*(@level-1) + "<!--" + "\n"
+ res << lines.collect{|s| " "*(@level-1) + s.strip}.delete_if{|s| s.compress.empty?}.join("\n")
+ res << "\n"
+ res << " "*(@level-1) + "-->" + "\n"
+ res << "\n"
+ end
+ end
+end
+
+class Special < SGMLObject
+ def prechildren_to_x(res, closetags)
+ res << " "*(@level-1) + @text.compress + "\n"
+ end
+end
+
+class Instruction < SGMLObject
+ def prechildren_to_x(res, closetags)
+ res << " "*(@level-1) + @text.compress + "\n"
+ end
+end
+
+class OpenTag < Tag
+ def prechildren_to_x(res, closetags)
+ a = [@subtype]
+
+ args = @args.dup
+ args.delete("id")
+ args.delete("name")
+ args = args.sort
+ args.unshift(["id", @args["id"]]) if @args.include?("id")
+ args.unshift(["name", @args["name"]]) if @args.include?("name")
+
+ args.each do |k, v|
+ if not v.include?("´")
+ a << "#{k}=´#{v}´"
+ else
+ if not v.include?(´"´)
+ a << "#{k}=\"#{v}\""
+ else
+ a << "#{k}=´#{v.gsub(/\´/, ´"´)}´"
+ end
+ end
+ end
+
+ if @children.length == 0 or (@children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.compress.empty?)
+ res << " "*(@level-1) + "<#{a.join(" ")}/>" + "\n"
+ else
+ if @children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.lf.split(/\n/).length == 1
+ res << " "*(@level-1) + "<#{a.join(" ")}>"
+ else
+ res << " "*(@level-1) + "<#{a.join(" ")}>" + "\n"
+ end
+ end
+ end
+
+ def postchildren_to_x(res, closetags)
+ if closetags
+ unless @children.length == 0 or (@children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.compress.empty?)
+ res << "\n" if @children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.lf.split(/\n/).length > 1
+ res << " "*(@level-1) unless @children.length == 1 and @children[0].kind_of?(Text) and @children[0].text.lf.split(/\n/).length == 1
+ res << "</#{@subtype}>"
+ res << "\n"
+ end
+ end
+ end
+end
+
class XML < SGML
+ def to_x(closetags=true)
+ res = ""
+
+ parsetree("prechildren_to_x", "postchildren_to_x", res, closetags)
+
+ res
+ end
end
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/SUMMARY rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/SUMMARY
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/SUMMARY 2005-06-04 14:42:02.187350552 +0200
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/SUMMARY 2005-06-04 14:41:52.000000000 +0200
@@ -0,0 +1 @@
+The Web Browser as a Graphical User Interface for Ruby Applications
diff -ur rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/VERSION rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/VERSION
--- rubywebdialogs-0.1.2.tar.gz/rubywebdialogs/VERSION 2005-06-04 14:42:02.186350704 +0200
+++ rubywebdialogs-0.2.0.tar.gz/rubywebdialogs/VERSION 2005-06-04 14:41:52.000000000 +0200
@@ -0,0 +1 @@
+0.2.0