diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/init.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/init.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/init.rb 2004-09-03 12:26:26.000000000 +0200
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/init.rb 2004-11-28 14:41:35.000000000 +0100
@@ -10,6 +10,8 @@
Dir.mkdir(dir) rescue nil
end
+Dir.chdir(File.dirname($0))
+
FromDirs = [".", "./lib", "./rubylib/lib"]
ToDir = Config::CONFIG["sitelibdir"] + "/ev"
diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/install.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/install.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/install.rb 2004-09-03 12:26:26.000000000 +0200
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/install.rb 2004-11-28 14:41:35.000000000 +0100
@@ -10,6 +10,8 @@
Dir.mkdir(dir) rescue nil
end
+Dir.chdir(File.dirname($0))
+
FromDirs = [".", "./lib", "./rubylib/lib"]
ToDir = Config::CONFIG["sitelibdir"] + "/ev"
diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/browser.lib.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/browser.lib.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/browser.lib.rb 2004-11-28 14:41:39.000000000 +0100
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/browser.lib.rb 2004-11-28 14:41:35.000000000 +0100
@@ -0,0 +1,112 @@
+require "ev/ruby"
+require "ev/net"
+
+begin
+ require "win32ole"
+ require "win32/registry"
+rescue LoadError
+ $".push "win32ole.so"
+ $".push "win32/registry.rb"
+end
+
+def windowsbrowser
+ $stderr.puts "Looking for default browser..."
+
+ filetype = nil
+ application = nil
+
+ begin
+ Win32::Registry::HKEY_CLASSES_ROOT.open(´.html´) do |reg|
+ filetype = reg[""]
+ end
+
+ Win32::Registry::HKEY_CLASSES_ROOT.open(filetype + ´\shell\open\command´) do |reg|
+ application = reg[""]
+ end
+ rescue NameError
+ $stderr.puts "Only available for Windows."
+ end
+
+ application
+end
+
+def linuxbrowser
+ application = ""
+
+ application = `which galeon 2> /dev/null`.chomp if application.empty?
+ application = `which mozilla 2> /dev/null`.chomp if application.empty?
+ application = `which firefox 2> /dev/null`.chomp if application.empty?
+ application = `which opera 2> /dev/null`.chomp if application.empty?
+ application = `which konqueror 2> /dev/null`.chomp if application.empty?
+ application = `which htmlview 2> /dev/null`.chomp if application.empty?
+ application = nil if application.empty?
+
+ application
+end
+
+def defaultbrowser
+ res = nil
+ res = windowsbrowser if windows?
+ res = linuxbrowser if linux?
+ res
+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)
+ rescue
+ end
+ end
+ end
+
+ catch :once do
+ HTTPServer.serve([port, io]) do |req, resp|
+ resp << html
+ resp.flush
+
+ throw :once
+ end
+ end
+end
+
+def tab2html(tab)
+ res = ""
+
+ tab = tab.to_html(false)
+
+ res << "<html>\n"
+ res << "<body>\n"
+ res << "<table align=´center´ border=´1´ cellspacing=´0´ cellpadding=´3´>\n"
+ res << "<tbody>\n"
+
+ tab.split(/\r*\n/).each do |line|
+ res << "<tr>\n"
+
+ line.split(/\t/, -1).each do |veld|
+ veld = " " if veld.compress.empty?
+
+ res << "<td>%s</td>\n" % veld
+ end
+
+ res << "</tr>\n"
+ end
+
+ res << "</tbody>\n"
+ res << "</table>\n"
+ res << "</body>\n"
+ res << "</html>\n"
+
+ res
+end
diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/ftools.lib.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/ftools.lib.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/ftools.lib.rb 2004-09-03 12:26:26.000000000 +0200
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/ftools.lib.rb 2004-11-28 14:41:35.000000000 +0100
@@ -54,9 +54,9 @@
end
def self.find(entry=nil, mask=nil)
- entry = @dir if entry.nil?
+ entry = "." if entry.nil?
- entry.gsub!(/[\/\\]*$/, "") unless entry.nil?
+ entry = entry.gsub!(/[\/\\]*$/, "") unless entry.nil?
mask = /^#{mask}$/i if mask.kind_of?(String)
@@ -86,12 +86,29 @@
res
end
+
+ def self.findandchangecontent(entry=nil, mask=nil)
+ Dir.find(entry, mask).each do |file|
+ unless File.directory?(file)
+ data1 = File.open(file){|f| f.read}
+
+ data2 = yield(data1)
+
+ if data2 != data1
+ $stderr.puts "Changing #{file} ..."
+
+ File.open(file, "w"){|f| f.write data2}
+ end
+ end
+ end
+ end
end
class File
def self.rollbackup(file, mode=nil)
backupfile = file + ".RB.BACKUP"
controlfile = file + ".RB.CONTROL"
+ res = nil
File.touch(file) unless File.file?(file)
@@ -117,10 +134,10 @@
if block_given?
if mode.nil?
- yield
+ res = yield
else
File.open(file, mode) do |f|
- yield(f)
+ res = yield(f)
end
end
end
@@ -132,11 +149,9 @@
# Return, like File.open
- if block_given?
- return nil
- else
- return File.open(file, (mode or "r"))
- end
+ res = File.open(file, (mode or "r")) unless block_given?
+
+ res
end
def self.touch(file)
diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/net.lib.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/net.lib.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/net.lib.rb 2004-09-03 12:26:26.000000000 +0200
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/net.lib.rb 2004-11-28 14:41:35.000000000 +0100
@@ -9,6 +9,8 @@
require "md5"
require "thread"
+$proxy = ENV["PROXY"] if $proxy.nil?
+
file = "#{home}/.evnet"
if File.file?(file)
Hash.file(file).each do |k, v|
@@ -530,7 +532,7 @@
data = (@io.read(self["content-length"].to_i) or "")
@vars = RequestPost.new((self["content-type"] == "application/x-www-form-urlencoded") ? data : "")
else
- puts "Unknown request (´#{firstline}´)."
+ $stderr.puts "Unknown request (´#{firstline}´)."
end
end
@@ -569,10 +571,11 @@
@response = "HTTP/1.0 200 OK"
@cookies = {}
@data = ""
+ @syncd = false
end
def flush
- @io.write("#{to_s}\r\n#{@data}")
+ sync
@io.close
end
@@ -589,6 +592,13 @@
res
end
+ def sync
+ @io.write("#{to_s}\r\n") unless @syncd
+ @io.write(@data)
+ @data = ""
+ @syncd = true
+ end
+
def << (s)
@data << s
end
@@ -607,11 +617,11 @@
begin
server = TCPServer.new(remote ? "0.0.0.0" : "localhost", port) if server.nil?
- puts "Just point your browser to http://localhost:#{port}/ ..."
+ $stderr.puts "Just point your browser to http://localhost:#{port}/ ..."
rescue
server = nil
- puts "Port #{port} is in use."
+ $stderr.puts "Port #{port} is in use."
end
if not server.nil?
@@ -636,11 +646,11 @@
if (not remote) or (remote and (auth.nil? or auth.empty? or authenticate(auth, realm, req, resp)))
@@times[com]=Time.new.to_f if not @@times.include?(com)
- #puts "#{Time.new.strftime("%H:%M:%S")}: #{ip}: #{((Time.new.to_f - @@times[com]).to_s + "0"*4)[0..4]}: > #{req.request.to_s.strip}"
+ #$stderr.puts "#{Time.new.strftime("%H:%M:%S")}: #{ip}: #{((Time.new.to_f - @@times[com]).to_s + "0"*4)[0..4]}: > #{req.request.to_s.strip}"
yield(req, resp)
- puts "#{Time.new.strftime("%H:%M:%S")}: #{ip}: #{((Time.new.to_f - @@times[com]).to_s + "0"*4)[0..4]}: < #{req.request.to_s.strip}"
+ $stderr.puts "#{Time.new.strftime("%H:%M:%S")}: #{ip}: #{((Time.new.to_f - @@times[com]).to_s + "0"*4)[0..4]}: < #{req.request.to_s.strip}"
@@times.delete(com)
end
diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/ruby.lib.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/ruby.lib.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/ruby.lib.rb 2004-09-03 12:26:26.000000000 +0200
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/ruby.lib.rb 2004-11-28 14:41:35.000000000 +0100
@@ -234,7 +234,7 @@
self.splitblocks(["´", "´"], [´"´, ´"´], ["#", "\n"]).each do |type, s|
case type
when 0, 1, 2 then res << s
- when 3
+ when 3 then res << "\n"
end
end
@@ -477,7 +477,7 @@
end
def self.file(file)
- res = []
+ res = new
File.open(file) do |f|
f.readlines.uncomment.chomp.each do |line|
@@ -617,7 +617,7 @@
end
def self.file(file)
- res = {}
+ res = new
File.open(file) do |f|
#f.readlines.chomp.each do |line|
@@ -625,7 +625,7 @@
line.chomp!
unless line.empty?
- k, v = line.split(/\s+=\s+/, 2)
+ k, v = line.split(/\s*=\s*/, 2)
res[k] = v
end
end
@@ -663,47 +663,21 @@
end
end
-def evtimeout(seconds, *args)
- if not seconds.nil? and not seconds.zero?
- t = Thread.current
- threads = []
- res = nil
-
- threads[1] = Thread.new(*args) do |*args|
- sleep seconds
- begin
- threads[2].kill
- rescue NameError
- end
- res = false
- t.wakeup
+def evtimeout(seconds)
+ begin
+ timeout(seconds) do
+ yield
end
-
- threads[2] = Thread.new(*args) do |*args|
- yield(*args)
- begin
- threads[1].kill
- rescue NameError
- end
- res = true
- t.wakeup
- end
-
- threads[1].join
- threads[2].join
-
- return res
- else
- yield(*args)
+ rescue TimeoutError
end
end
-def evtimeoutretry(seconds, *args)
+def evtimeoutretry(seconds)
ok = false
while not ok
- evtimeout(seconds, *args) do |*args|
- yield(*args)
+ evtimeout(seconds) do
+ yield
ok = true
end
end
@@ -744,14 +718,28 @@
end
def temp
- (ENV["TEMP"] or "/tmp").gsub(/\\/, "/")
+ (ENV["TMPDIR"] or ENV["TMP"] or ENV["TEMP"] or "/tmp").gsub(/\\/, "/")
end
def stdtmp
$stderr = $stdout = File.new("#{temp}/ruby.#{Process.pid}.log", "a") unless ARGV.include?("--rwd-exit")
end
+$nobm = false
+
+def nobm
+ $nobm = true
+end
+
def bm(label="")
+ if $nobm
+ if block_given?
+ return yield
+ else
+ return nil
+ end
+ end
+
if $bm.nil?
require "ev/bm"
@@ -786,3 +774,34 @@
res
end
+
+def trace
+ res =nil
+
+ set_trace_func lambda { |event, file, line, id, binding, classname|
+ $stderr.printf "%8s %s:%-2d %10s %8s\n", event, file, line, id, classname
+ }
+ if block_given?
+ res = yield
+
+ notrace
+ end
+
+ res
+end
+
+def notrace
+ set_trace_func nil
+end
+
+def lambda_cached(&block)
+ hash = {}
+ lambda do |*args|
+ res = hash[args]
+ if res.nil?
+ res = block.call(*args)
+ hash[args] = res
+ end
+ res
+ end
+end
diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/rwd.lib.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/rwd.lib.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/rwd.lib.rb 2004-09-03 12:26:26.000000000 +0200
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/rwd.lib.rb 2004-11-28 14:41:35.000000000 +0100
@@ -1,5 +1,7 @@
+require "ev/ruby"
require "ev/xml"
require "ev/net"
+require "ev/browser"
require "md5"
require "rbconfig"
@@ -12,16 +14,17 @@
end
$rwd_exit = ARGV.include?("--rwd-exit") # Hack ???
-$rwd_debug = ($rwd_debug or false)
+$rwd_debug = ($rwd_debug or $DEBUG or false)
$rwd_border = ($rwd_border or 0)
$rwd_dir = Dir.pwd
$rwd_files = File.expand_path("rwd_files", Dir.pwd)
+$rwd_html = {}
+
ARGV.delete_if do |arg|
arg =~ /^--rwd-/
end
-
RWDEmptyline = "..."
rcfile = nil
@@ -37,37 +40,18 @@
Format = "\n<!-- %-10s %-10s -->\t"
unless rcfile.nil?
- puts "Reading #{rcfile} ..."
+ $stderr.puts "Reading #{rcfile} ..."
Hash.file(rcfile).each do |k, v|
- ENV[k] = v
- end
-end
-
-unless ENV.include?("RWDBROWSER")
- begin
- puts "Looking for default browser..."
-
- filetype = nil
- application = nil
-
- Win32::Registry::HKEY_CLASSES_ROOT.open(´.html´) do |reg|
- filetype = reg[""]
- end
-
- Win32::Registry::HKEY_CLASSES_ROOT.open(filetype + ´\shell\open\command´) do |reg|
- application = reg[""]
- end
+ #$stderr.puts "Setting #{k} to \"#{v}\" ..."
- ENV["RWDBROWSER"] = application
- rescue NameError
- puts "Not found."
+ ENV[k] = v
end
end
-unless ENV.include?("RWDPORTS")
- ENV["RWDPORTS"] = "7701-7709"
-end
+ENV["RWDBROWSER"] = (ENV["RWDBROWSER"] or defaultbrowser) or puts "No browser found."
+ENV["RWDPORTS"] = (ENV["RWDPORTS"] or "7701-7709")
+ENV["RWDTHEME"] = (ENV["RWDTHEME"] or "DEFAULT")
trap("INT") {puts "Terminating..." ; exit}
@@ -252,10 +236,10 @@
class OpenTag
def prechildren(res, before, after, varshtml, varsstring, switches, help, oneormorefields, firstaction, tabs, tab, pda)
bef = before[-1]
- res.concat Format % ["Before", @subtype] if ($rwd_debug and not bef.nil?)
- res.concat bef if not bef.nil?
+ res << Format % ["Before", @subtype] if ($rwd_debug and not bef.nil?)
+ res << bef if not bef.nil?
- res.concat Format % ["Pre", @subtype] if $rwd_debug
+ res << Format % ["Pre", @subtype] if $rwd_debug
align = AC
align = "align=´#{@args["align"]}´" if @args.include?("align")
@@ -281,144 +265,159 @@
args["nohelpbutton"] = (not help)
- template = $rwd_html_11
- template = $rwd_html_21 if pda
+ template = $rwd_html_1
+ template = $rwd_html_PDA_1 if pda
- res.concat(template(template, args))
- when "p" then res.concat "<p #{align}>"
- when "pre" then res.concat "<pre #{align}>"
- when "big" then res.concat "<p #{align}><big>"
- when "small" then res.concat "<p #{align}><small>"
- when "list" then res.concat "<ul #{align}>"
- when "item" then res.concat "<li #{align}>"
- when "empty" then res.concat "<p><br>"
- when "image" then res.concat "<img src=´#{@args["src"]}´>"
- when "br" then res.concat "<br>"
- when "hr" then res.concat "<hr>"
- when "b" then res.concat "<b>"
- when "i" then res.concat "<i>"
+ res <<(template(template, args))
+ when "p" then res << "<p #{align}>"
+ when "pre" then res << "<pre #{align}>"
+ when "big" then res << "<p #{align}><big>"
+ when "small" then res << "<p #{align}><small>"
+ when "list" then res << "<ul #{align}>"
+ when "item" then res << "<li #{align}>"
+ when "empty" then res << "<p><br>"
+ when "image" then res << "<img src=´#{@args["src"]}´ alt=´#{@args["alt"]}´>"
+ when "br" then res << "<br>"
+ when "hr" then res << "<hr>"
+ when "b" then res << "<b>"
+ when "i" then res << "<i>"
when "a"
if @args.include?("href")
- res.concat "<a href=´#{@args["href"]}´ target=´#{@args["target"] or "_blank"}´>"
+ res << "<a href=´#{@args["href"]}´ target=´#{@args["target"] or "_blank"}´>"
else
- res.concat "<a href=´javascript:document.bodyform.rwd_action.value=\"#{@args["action"]}\";document.bodyform.submit();´>"
+ res << "<a href=´javascript:document.bodyform.rwd_action.value=\"#{@args["action"]}\";document.bodyform.submit();´>"
end
- when "vertical" then res.concat "<table #{AC} border=´#{$rwd_border}´ cellspacing=´#{cellspacing}´ cellpadding=´0´>"
- when "horizontal" then res.concat "<table #{AC} border=´#{$rwd_border}´ cellspacing=´#{cellspacing}´ cellpadding=´0´><tr #{align} #{valign}>"
- when "table" then res.concat "<table #{AC} border=´#{$rwd_border}´ cellspacing=´#{cellspacing}´ cellpadding=´0´>"
- when "row" then res.concat "<tr #{align} #{valign}>"
- when "hidden" then res.concat "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´hidden´>"
+ when "vertical" then res << "<table #{AC} border=´#{$rwd_border}´ cellspacing=´#{cellspacing}´ cellpadding=´0´>"
+ when "horizontal" then res << "<table #{AC} border=´#{$rwd_border}´ cellspacing=´#{cellspacing}´ cellpadding=´0´><tr #{align} #{valign}>"
+ when "table" then res << "<table #{AC} border=´#{$rwd_border}´ cellspacing=´#{cellspacing}´ cellpadding=´0´>"
+ when "row" then res << "<tr #{align} #{valign}>"
+ when "hidden" then res << "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´hidden´>"
when "text"
maxlength = ""
maxlength = "maxlength=´%s´" % @args["maxlength"] if @args.include?("maxlength")
size = ""
size = "size=´%s´" % 10 if pda
- res.concat "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´text´ #{maxlength} #{size}>"
+ res << "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´text´ #{maxlength} #{size}>"
oneormorefields << "true"
when "textarea"
- res.concat "<p #{align}><textarea name=´#{@args["name"]}´ rows=´25´ cols=´80´>#{value2.crlf}</textarea>"
+ res << "<p #{align}><textarea name=´#{@args["name"]}´ rows=´25´ cols=´80´>#{value2.crlf}</textarea>"
oneormorefields << "true"
when "password"
maxlength = ""
maxlength = "maxlength=´%s´" % @args["maxlength"] if @args.include?("maxlength")
size = ""
size = "size=´%s´" % 10 if pda
- res.concat "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´password´ #{maxlength} #{size}>"
+ res << "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´password´ #{maxlength} #{size}>"
oneormorefields << "true"
when "checkbox"
if varshtml[@args["name"]] == "on"
switches[@args["name"]] = true
- res.concat "<p #{align}><input name=´#{@args["name"]}´ checked=´on´ type=´checkbox´>"
+ res << "<p #{align}><input name=´#{@args["name"]}´ checked=´on´ type=´checkbox´>"
else
switches[@args["name"]] = false
- res.concat "<p #{align}><input name=´#{@args["name"]}´ type=´checkbox´>"
+ res << "<p #{align}><input name=´#{@args["name"]}´ type=´checkbox´>"
end
oneormorefields << "true"
when "radio"
if varshtml[@args["name"]] == value1 # ??? 1 or 2?
- res.concat "<p #{align}><input name=´#{@args["name"]}´ checked=´on´ value=´#{value1}´ type=´radio´>"
+ res << "<p #{align}><input name=´#{@args["name"]}´ checked=´on´ value=´#{value1}´ type=´radio´>"
else
- res.concat "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´radio´>"
+ res << "<p #{align}><input name=´#{@args["name"]}´ value=´#{value1}´ type=´radio´>"
end
oneormorefields << "true"
when "select"
- res.concat "<select #{align} name=´#{@args["name"]}´ width=´#{@args["width"]}´>"
+ res << "<select #{align} name=´#{@args["name"]}´ width=´#{@args["width"]}´>"
name = @args["name"]
$select = varshtml[name]
oneormorefields << "true"
when "option"
if $select == @children[0].text
- res.concat "<option selected=´true´>"
+ res << "<option selected=´true´>"
else
- res.concat "<option>"
+ res << "<option>"
end
when "button"
- res.concat "<input type=´submit´ value=´#{@args["caption"]}´ onclick=´document.bodyform.rwd_action.value=\"#{@args["action"]}\";´>"
+ res << "<input type=´submit´ value=´#{@args["caption"]}´ onclick=´document.bodyform.rwd_action.value=\"#{@args["action"]}\";´>"
firstaction << @args["action"] if (firstaction.empty? and @args.include?("action"))
oneormorefields << "true"
when "back"
- res.concat "<input type=´submit´ value=´Back´ onclick=´document.bodyform.rwd_action.value=\"rwd_back\";´>"
+ res << "<input type=´submit´ value=´Back´ onclick=´document.bodyform.rwd_action.value=\"rwd_back\";´>"
firstaction << "rwd_back" if firstaction.empty?
oneormorefields << "true"
when "help"
- res.concat "<input type=´submit´ value=´Help´ onclick=´document.bodyform.rwd_action.value=\"rwd_help\";´>"
+ res << "<input type=´submit´ value=´Help´ onclick=´document.bodyform.rwd_action.value=\"rwd_help\";´>"
firstaction << "rwd_help" if firstaction.empty?
oneormorefields << "true"
when "quit"
- res.concat "<input type=´submit´ value=´Quit´ onclick=´document.bodyform.rwd_action.value=\"rwd_quit\";´>"
+ res << "<input type=´submit´ value=´Quit´ onclick=´document.bodyform.rwd_action.value=\"rwd_quit\";´>"
firstaction << "rwd_quit" if firstaction.empty?
oneormorefields << "true"
when "close"
- res.concat "<input type=´submit´ value=´Close´ onclick=´window.close();´>"
+ res << "<input type=´submit´ value=´Close´ onclick=´window.close();´>"
firstaction << "rwd_quit" if firstaction.empty?
oneormorefields << "true"
when "reset"
- res.concat "<input type=´reset´ value=´Reset´>"
+ res << "<input type=´reset´ value=´Reset´>"
firstaction << "rwd_quit" if firstaction.empty?
oneormorefields << "true"
when "closewindow"
- #res.concat "<script type=´text/javascript´>\n" # ???
- #res.concat "<!--\n"
- #res.concat " window.close();\n"
- #res.concat "//-->\n"
- #res.concat "</script>"
+ #res << "<script type=´text/javascript´>\n" # ???
+ #res << "<!--\n"
+ #res << " window.close();\n"
+ #res << "//-->\n"
+ #res << "</script>"
when "tabs"
- res.concat "<table #{AC} border=´#{$rwd_border}´ cellspacing=´0´ cellpadding=´0´>"
- res.concat " <tr #{AL}>"
- res.concat " <td #{AL} class=´tabs´>"
- res.concat " <table #{AL} border=´#{$rwd_border}´ cellspacing=´0´ cellpadding=´0´>"
- res.concat " <tr #{AL}>"
+ res << "<table #{AC} border=´#{$rwd_border}´ cellspacing=´0´ cellpadding=´0´>"
+ res << " <tr #{AL}>"
+ res << " <td #{AL} class=´tabs´>"
+ res << " <table #{AL} border=´#{$rwd_border}´ cellspacing=´0´ cellpadding=´0´>"
+ res << " <tr #{AL}>"
+ #res << " <td class=´notab´> </td>"
tabs.each do |obj|
name = obj.args["name"]
caption = obj.args["caption"]
- res.concat "<td class=´notab´> </td>" unless obj == tabs[0]
+ res << "<td #{AL} class=´notab´> </td>" unless obj == tabs[0]
if name == tab
- res.concat "<td #{AC} class=´thistab´><tt><b> #{caption} </b></tt></td>"
+ res << "<td #{AC} class=´activetab´><tt> #{caption} </tt></td>"
else
- res.concat "<td #{AC} class=´tab´><a href=´javascript:document.bodyform.rwd_action.value=\"rwd_tab_#{name}\";document.bodyform.submit();´><tt> #{caption} </tt></a></td>"
+ res << "<td #{AC} class=´passivetab´><a href=´javascript:document.bodyform.rwd_action.value=\"rwd_tab_#{name}\";document.bodyform.submit();´><tt> #{caption} </tt></a></td>"
end
end
- res.concat " </tr>"
- res.concat " </table>"
- res.concat " </td>"
- res.concat " </tr>"
+ res << " <td class=´notab´ width=´100%´> </td>"
+ res << " </tr>"
+ res << " </table>"
+ res << " </td>"
+ res << " </tr>"
+ res << " <tr #{align}>"
+ res << " <td #{align} class=´tabblad´>"
when "tab"
- res.concat "<table #{AC} border=´#{$rwd_border}´ cellspacing=´3´ cellpadding=´0´>"
- res.concat " <tr #{AL}>"
- res.concat " <td #{AL} class=´tabblad´>"
+ res << "<table #{AC} border=´#{$rwd_border}´ cellspacing=´3´ cellpadding=´0´>"
+ when "panel"
+ level = (@args["level"] or "normal")
+ res << "<table #{AC} border=´#{$rwd_border}´ cellspacing=´0´ cellpadding=´0´>"
+ res << " <tr #{align}>"
+ res << " <td #{align} class=´panel1´>" if level == "normal"
+ res << " <td #{align} class=´panel1high´>" if level == "high"
+ res << " <td #{align} class=´panel1low´>" if level == "low"
+ res << " <table #{AC} border=´#{$rwd_border}´ cellspacing=´0´ cellpadding=´0´>"
+ res << " <tr #{align}>"
+ res << " <td #{align} class=´panel2´>" if level == "normal"
+ res << " <td #{align} class=´panel2high´>" if level == "high"
+ res << " <td #{align} class=´panel2low´>" if level == "low"
+ res << " <table #{AC} border=´#{$rwd_border}´ cellspacing=´3´ cellpadding=´0´>"
else
puts "<#{@subtype}>"
- res.concat "<#{@subtype}>"
+ res << "<#{@subtype}>"
end
bef = nil
aft = nil
case @subtype
- when "vertical", "window", "helpwindow", "tabs", "tab"
- res.concat Format % ["AftPre", @subtype] if $rwd_debug
+ when "vertical", "window", "helpwindow", "tab", "panel"
+ res << Format % ["AftPre", @subtype] if $rwd_debug
if @args.include?("spacing")
s = "<tr><td> </td></tr>" * (@args["spacing"].to_i)
else
@@ -427,7 +426,7 @@
bef = "#{s}<tr #{align} #{valign}><td #{align}>"
aft = "</td></tr>"
when "horizontal", "row"
- res.concat Format % ["AftPre", @subtype] if $rwd_debug
+ res << Format % ["AftPre", @subtype] if $rwd_debug
bef = "<td #{align}>"
aft = "</td>"
end
@@ -438,16 +437,16 @@
def postchildren(res, before, after, varshtml, varsstring, switches, help, oneormorefields, firstaction, tabs, tab, pda)
case @subtype
- when "vertical", "window", "helpwindow", "tabs", "tab"
- res.concat Format % ["BefPost", @subtype] if $rwd_debug
+ when "vertical", "window", "helpwindow", "tab", "panel"
+ res << Format % ["BefPost", @subtype] if $rwd_debug
if @args.include?("spacing")
- res.concat "<tr><td> </td></tr>" * (@args["spacing"].to_i)
+ res << "<tr><td> </td></tr>" * (@args["spacing"].to_i)
end
when "horizontal", "row"
- res.concat Format % ["BefPost", @subtype] if $rwd_debug
+ res << Format % ["BefPost", @subtype] if $rwd_debug
end
- res.concat Format % ["Post", @subtype] if $rwd_debug
+ res << Format % ["Post", @subtype] if $rwd_debug
case @subtype
when "application"
@@ -456,57 +455,69 @@
args["nohelpbutton"] = (not help)
- template = $rwd_html_12
- template = $rwd_html_22 if pda
+ template = $rwd_html_2
+ template = $rwd_html_PDA_2 if pda
- res.concat(template(template, args))
- when "p" then res.concat "</p>"
- when "pre" then res.concat "</pre>"
- when "big" then res.concat "</big></p>"
- when "small" then res.concat "</small></p>"
- when "list" then res.concat "</ul>"
- when "item" then res.concat "</li>"
- when "empty" then res.concat "</p>"
- when "image" then res.concat ""
- when "br" then res.concat ""
- when "hr" then res.concat ""
- when "b" then res.concat "</b>"
- when "i" then res.concat "</i>"
- when "a" then res.concat "</a>"
- when "vertical" then res.concat "</table>"
- when "horizontal" then res.concat "</tr></table>"
- when "table" then res.concat "</table>"
- when "row" then res.concat "</tr>"
- when "hidden" then res.concat "</p>"
- when "text" then res.concat "</p>"
- when "textarea" then res.concat "</p>"
- when "password" then res.concat "</p>"
- when "checkbox" then res.concat "</p>"
- when "radio" then res.concat "</p>"
+ res <<(template(template, args))
+ when "p" then res << "</p>"
+ when "pre" then res << "</pre>"
+ when "big" then res << "</big></p>"
+ when "small" then res << "</small></p>"
+ when "list" then res << "</ul>"
+ when "item" then res << "</li>"
+ when "empty" then res << "</p>"
+ when "image" then res << ""
+ when "br" then res << ""
+ when "hr" then res << ""
+ when "b" then res << "</b>"
+ when "i" then res << "</i>"
+ when "a" then res << "</a>"
+ when "vertical" then res << "</table>"
+ when "horizontal" then res << "</tr></table>"
+ when "table" then res << "</table>"
+ when "row" then res << "</tr>"
+ when "hidden" then res << "</p>"
+ when "text" then res << "</p>"
+ when "textarea" then res << "</p>"
+ when "password" then res << "</p>"
+ when "checkbox" then res << "</p>"
+ when "radio" then res << "</p>"
when "select"
- res.concat "</select>"
+ res << "</select>"
$select = nil
- when "option" then res.concat "</option>"
- when "button" then res.concat ""
- when "back" then res.concat ""
- when "help" then res.concat ""
- when "quit" then res.concat ""
- when "close" then res.concat ""
- when "reset" then res.concat ""
- when "closewindow" then res.concat ""
- when "tabs" then res.concat "</table>"
- when "tab" then res.concat "</td></tr></table>"
+ when "option" then res << "</option>"
+ when "button" then res << ""
+ when "back" then res << ""
+ when "help" then res << ""
+ when "quit" then res << ""
+ when "close" then res << ""
+ when "reset" then res << ""
+ when "closewindow" then res << ""
+ when "tabs"
+ res << " </td>"
+ res << " </tr>"
+ res << "</table>"
+ when "tab"
+ res << "</table>"
+ when "panel"
+ res << " </table>"
+ res << " </td>"
+ res << " </tr>"
+ res << " </table>"
+ res << " </td>"
+ res << " </tr>"
+ res << "</table>"
else
puts "</#{@subtype}>"
- res.concat "</#{@subtype}>"
+ res << "</#{@subtype}>"
end
before.pop
after.pop
aft = after[-1]
- res.concat Format % ["After", @subtype] if ($rwd_debug and not aft.nil?)
- res.concat aft if not aft.nil?
+ res << Format % ["After", @subtype] if ($rwd_debug and not aft.nil?)
+ res << aft if not aft.nil?
end
def template(html, vars)
@@ -560,8 +571,8 @@
class Text
def prechildren(res, before, after, varshtml, varsstring, switches, help, oneormorefields, firstaction, tabs, tab, pda)
if not @text.scan(/[^ \t\r\n]/).empty?
- res.concat Format % ["Text", ""] if $rwd_debug
- res.concat "#{@text}"
+ res << Format % ["Text", ""] if $rwd_debug
+ res << "#{@text}"
end
end
end
@@ -600,7 +611,7 @@
varsstring = Hash.new
oneormorefields = ""
firstaction = ""
- html = ""
+ html = []
vars.each do |key, value|
if not key.empty?
@@ -638,6 +649,8 @@
windowobject.parsetree("prechildren", "postchildren", html, [""], [""], varshtml, varsstring, switches, (not @helprwd.empty?), oneormorefields, firstaction, tabs, tab, pda)
end
+ html = html.join("") # ???
+
html.gsub!(/%%*[[:alnum:]_\-]+%%*/, "") if not $rwd_debug
html.gsub!(/%%/, "%")
html.gsub!(/\n\n*/, "\n")
@@ -974,7 +987,7 @@
if auth.nil?
@localbrowsing = true
- if ENV.include?("RWDBROWSER") and not ENV["RWDBROWSER"].empty?
+ if ENV.include?("RWDBROWSER") and not ENV["RWDBROWSER"].nil? and not ENV["RWDBROWSER"].empty?
@browserstarted = true
@object.exitbrowser
@@ -1161,7 +1174,7 @@
end
end
-$rwd_html_1 = "
+$rwd_html["DEFAULT"] = "
<!-- Generated by RubyWebDialog. -->
<!-- For more information, please contact Erik Veenstra <rwd@erikveen.dds.nl>. -->
<html>
@@ -1184,27 +1197,65 @@
background : #AAAAAA;
}
- td.tabs {
- border-color : #000000;
- border-width : thin;
- border-style : none none solid none;
+ td.panel1 {
+ border-color : #888888 #EEEEEE #EEEEEE #888888;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
}
- td.tab {
- border-color : #000000;
- border-width : thin;
- border-style : solid solid none solid;
+ td.panel2 {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.panel1high {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
}
- td.thistab {
- border-color : #000000;
- border-width : medium;
+ td.panel2high {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : none none none none;
+ }
+
+ td.panel1low {
+ border-color : #888888 #EEEEEE #EEEEEE #888888;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.panel2low {
+ border-color : #888888 #EEEEEE #EEEEEE #888888;
+ border-width : 1pt;
+ border-style : none none none none;
+ }
+
+ td.tabblad {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : none solid solid solid;
+ }
+
+ td.passivetab {
+ background-color : #BBBBBB;
+ border-color : #DDDDDD #DDDDDD #EEEEEE #DDDDDD;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.activetab {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
border-style : solid solid none solid;
}
td.notab {
- border-width : thin;
- border-style : none;
+ border-color : #EEEEEE #EEEEEE #EEEEEE #EEEEEE;
+ border-width : 1pt;
+ border-style : none none solid none;
}
//-->
@@ -1335,15 +1386,12 @@
<tr align=´center´>
<td align=´center´ bgcolor=´#CCCCCC´>
+ <table align=´center´ border=´0´ cellspacing=´3´ cellpadding=´0´>
+ %BODY%
+ </table>
- <table align=´center´ border=´0´ cellspacing=´3´ cellpadding=´0´>
-
- %BODY%
-
- </table>
-
- <input name=´rwd_action´ value=´$RWD_FIRSTACTION$´ type=´hidden´>
- <input name=´rwd_session´ value=´$RWD_SESSION$´ type=´hidden´>
+ <input name=´rwd_action´ value=´$RWD_FIRSTACTION$´ type=´hidden´>
+ <input name=´rwd_session´ value=´$RWD_SESSION$´ type=´hidden´>
</td>
</tr>
</table>
@@ -1437,7 +1485,172 @@
</html>
"
-$rwd_html_2 = "
+$rwd_html["WINDOWSLOOKALIKE"] = "
+<!-- Generated by RubyWebDialog. -->
+<!-- For more information, please contact Erik Veenstra <rwd@erikveen.dds.nl>. -->
+<html>
+ <head>
+ <title>%TITLE%</title>
+
+ <meta http-equiv=´Content-Type´ content=´text/html; charset=ISO-8859-15´>
+ <meta http-equiv=´Content-Style-Type´ content=´text/css´>
+
+ <link rel=´shortcut icon´ href=´%LOGO%´>
+
+ <style type=´text/css´>
+ <!--
+
+ a {
+ text-decoration : none;
+ }
+
+ a:hover {
+ background : #AAAAAA;
+ }
+
+ td.window {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 3pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.panel1 {
+ border-color : #888888 #EEEEEE #EEEEEE #888888;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.panel2 {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.panel1high {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.panel2high {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : none none none none;
+ }
+
+ td.panel1low {
+ border-color : #888888 #EEEEEE #EEEEEE #888888;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.panel2low {
+ border-color : #888888 #EEEEEE #EEEEEE #888888;
+ border-width : 1pt;
+ border-style : none none none none;
+ }
+
+ td.tabblad {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : none solid solid solid;
+ }
+
+ td.passivetab {
+ background-color : #BBBBBB;
+ border-color : #DDDDDD #DDDDDD #EEEEEE #DDDDDD;
+ border-width : 1pt;
+ border-style : solid solid solid solid;
+ }
+
+ td.activetab {
+ border-color : #EEEEEE #888888 #888888 #EEEEEE;
+ border-width : 1pt;
+ border-style : solid solid none solid;
+ }
+
+ td.notab {
+ border-color : #EEEEEE #EEEEEE #EEEEEE #EEEEEE;
+ border-width : 1pt;
+ border-style : none none solid none;
+ }
+
+ //-->
+ </style>
+
+ <script type=´text/javascript´>
+ <!--
+ function BodyGo() {
+ $RWD_FOCUS$
+ }
+ //-->
+ </script>
+ </head>
+
+ <body bgcolor=´white´ onload=´BodyGo()´ link=´#000000´ vlink=´#000000´ alink=´#000000´>
+ <form name=´bodyform´ action=´/´ method=´post´>
+ <table align=´center´ border=´0´ cellspacing=´0´ cellpadding=´0´ width=´100%´ height=´100%´>
+ <tr align=´center´ valign=´middle´>
+ <td align=´center´>
+
+ <table align=´center´ border=´0´ cellspacing=´0´ cellpadding=´0´>
+
+ <tr align=´center´>
+ <td align=´center´ class=´window´>
+
+ <table align=´center´ border=´0´ cellspacing=´0´ cellpadding=´0´ %WIDTH1%>
+ <tr align=´center´>
+ <td align=´center´ bgcolor=´#444488´>
+
+ <table align=´left´ border=´0´ cellspacing=´1´ cellpadding=´0´>
+ <tr align=´center´>
+ <td align=´border´><img src=´%LOGO%´ width=´14´ height=´14´></td>
+ <td align=´center´><b><small><font color=´#FFFFFF´> %TITLE% </font></small></b></td>
+ </tr>
+ </table>
+
+ <table align=´right´ border=´0´ cellspacing=´1´ cellpadding=´0´>
+ <tr align=´center´>
+ <!-- %HELPBUTTON% --><td align=´center´ bgcolor=´#EEEEEE´><b><small><a href=´javascript:document.bodyform.rwd_action.value=\"rwd_help\";document.bodyform.submit();´> ? </a></small></b></td>
+ <!-- %BACKBUTTONS% --><td align=´center´ bgcolor=´#EEEEEE´><b><small><a href=´javascript:document.bodyform.rwd_action.value=\"rwd_main\";document.bodyform.submit();´> << </a></small></b></td>
+ <!-- %BACKBUTTONS% --><td align=´center´ bgcolor=´#EEEEEE´><b><small><a href=´javascript:document.bodyform.rwd_action.value=\"rwd_back\";document.bodyform.submit();´> < </a></small></b></td>
+ <!-- %CLOSEBUTTON% --><td align=´center´ bgcolor=´#EEEEEE´><b><small><a href=´javascript:document.bodyform.rwd_action.value=\"rwd_quit\";document.bodyform.submit();´> X </a></small></b></td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+
+ <tr align=´center´>
+ <td align=´center´ bgcolor=´white´><img src=´pixel.gif´ height=´1´ width=´%WIDTH2%´></td>
+ </tr>
+
+ <tr align=´center´>
+ <td align=´center´ bgcolor=´#CCCCCC´>
+ <table align=´center´ border=´0´ cellspacing=´3´ cellpadding=´0´>
+ %BODY%
+ </table>
+
+ <input name=´rwd_action´ value=´$RWD_FIRSTACTION$´ type=´hidden´>
+ <input name=´rwd_session´ value=´$RWD_SESSION$´ type=´hidden´>
+ </td>
+ </tr>
+ </table>
+
+ </td>
+ </tr>
+
+ </table>
+
+ </td>
+ </tr>
+ </table>
+ </form>
+ </body>
+</html>
+"
+
+$rwd_html["PDA"] = "
<!-- Generated by RubyWebDialog. -->
<!-- For more information, please contact Erik Veenstra <rwd@erikveen.dds.nl>. -->
<html>
@@ -1493,9 +1706,7 @@
<td align=´center´ bgcolor=´#FFFFFF´>
<table align=´center´ border=´0´ cellspacing=´0´ cellpadding=´0´>
-
%BODY%
-
</table>
<input name=´rwd_action´ value=´$RWD_FIRSTACTION$´ type=´hidden´>
@@ -1531,5 +1742,5 @@
CgD/ACwAAAAAAQABAAAIBAD/BQQAOw==
".unpack("m").shift
-$rwd_html_11, $rwd_html_12 = $rwd_html_1.split(/^\s*%BODY%\s*\r*$/)
-$rwd_html_21, $rwd_html_22 = $rwd_html_2.split(/^\s*%BODY%\s*\r*$/)
+$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*$/)
diff -ur rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/tree.lib.rb rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/tree.lib.rb
--- rubywebdialogs-0.0.11.tar.gz/rubywebdialogs/lib/tree.lib.rb 2004-09-03 12:26:26.000000000 +0200
+++ rubywebdialogs-0.1.0.tar.gz/rubywebdialogs/lib/tree.lib.rb 2004-11-28 14:41:35.000000000 +0100
@@ -313,26 +313,28 @@
def path(pad)
p1 = self
- pad.split(/\//).each do |deel|
- tag, voorkomen = deel.split(/:/)
+ unless pad.nil?
+ pad.split(/\//).each do |deel|
+ tag, voorkomen = deel.split(/:/)
- if (not tag.nil?) and (not p1.nil?)
- voorkomen = 1 if voorkomen.nil?
- voorkomen = voorkomen.to_i
+ if (not tag.nil?) and (not p1.nil?)
+ voorkomen = 1 if voorkomen.nil?
+ voorkomen = voorkomen.to_i
- teller = 0
- p2 = nil
- p1.children.each_index do |i|
- #if p1.children[i].upordown == Down
- unless p1.children[i].subtype.nil?
- if p1.children[i].subtype.noquotes == tag.noquotes
- teller += 1
- p2 = p1.children[i] if teller == voorkomen
+ teller = 0
+ p2 = nil
+ p1.children.each_index do |i|
+ #if p1.children[i].upordown == Down
+ unless p1.children[i].subtype.nil?
+ if p1.children[i].subtype.noquotes == tag.noquotes
+ teller += 1
+ p2 = p1.children[i] if teller == voorkomen
+ end
end
- end
- #end
+ #end
+ end
+ p1 = p2
end
- p1 = p2
end
end