rwdtinker 1.48 → 1.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. data/Readme.txt +19 -6
  2. data/code/01rwdcore/03helptexthash.rb +11 -28
  3. data/code/01rwdcore/openhelpwindow.rb +10 -24
  4. data/code/01rwdcore/returntomain.rb +10 -0
  5. data/code/superant.com.rwdtinkerbackwindow/controlclient.rb +100 -0
  6. data/code/superant.com.rwdtinkerbackwindow/helptexthashtinkerwin2.rb +37 -0
  7. data/code/superant.com.rwdtinkerbackwindow/installapplet.rb +8 -8
  8. data/code/superant.com.rwdtinkerbackwindow/network.rb +87 -0
  9. data/code/superant.com.rwdtinkerbackwindow/openhelpwindowtinkerwin2.rb +39 -0
  10. data/code/superant.com.rwdtinkerbackwindow/runrwdtinkerbackwindow.rb +1 -1
  11. data/code/superant.com.rwdtinkerbackwindow/viewappletcontents.rb +21 -0
  12. data/configuration/rwdapplicationidentity.cnf +3 -0
  13. data/configuration/rwdtinker.cnf +1 -0
  14. data/configuration/rwdtinkerversion.cnf +1 -1
  15. data/ev/rwd.rb +4 -3
  16. data/extras/zip/ioextras.rb +114 -0
  17. data/extras/zip/stdrubyext.rb +111 -0
  18. data/extras/zip/tempfile_bugfixed.rb +195 -0
  19. data/extras/zip/zip.rb +1376 -0
  20. data/extras/zip/zipfilesystem.rb +558 -0
  21. data/extras/zip/ziprequire.rb +61 -0
  22. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/{50rwdlistzips.rwd → 40rwdlistzips.rwd} +10 -3
  23. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/50rwdlistapplets.rwd +1 -1
  24. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/60editconfiguration.rwd +11 -10
  25. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/75rwdcontrol.rwd +33 -0
  26. data/gui/tinkerbackwindows/superant.com.tinkerbackwindow/80tab1.rwd +1 -1
  27. data/gui/tinkerbackwindows/superant.com.tinkerhelpwindow/1appname.rwd +1 -2
  28. data/init.rb +38 -2
  29. data/rwd_files/HowTo_Tinker.txt +16 -6
  30. data/zips/rwdaschedule-0.93.zip +0 -0
  31. data/zips/rwdcalc-0.4.zip +0 -0
  32. metadata +64 -48
data/Readme.txt CHANGED
@@ -1,14 +1,11 @@
1
1
  = RwdTinker framework for RubyWebDialogs
2
2
 
3
-
4
3
  RwdTinker is a web brower interface to and system for developing programs
5
4
 
6
5
  == Usage
7
6
 
8
-
9
7
  How to Use the Tinker framework Program (rwdtinker)
10
8
 
11
-
12
9
  1. stand alone application
13
10
  2. framework for building applications
14
11
  3. Open brower windows with html documents
@@ -22,13 +19,10 @@ ruby init.rb
22
19
  Then point your web browser to:
23
20
  http://localhost:7705/
24
21
 
25
-
26
22
  == Viewing installed Applets:
27
-
28
23
 
29
24
  Go to "List Scripts" tab
30
25
 
31
-
32
26
  You can get a list of all installed applets by clicking the listfiles button
33
27
 
34
28
  To see the text of a install file
@@ -233,6 +227,25 @@ http://www.erikveen.dds.nl/rubywebdialogs/index.html
233
227
  Thanks, Steven Gibson
234
228
 
235
229
  == Changelog
230
+ version 1.51
231
+ changed return to main
232
+ changed configuration of remote ports
233
+ updated context sensitive help
234
+
235
+ version 1.50
236
+ changed unzip applet to be internal code - no exec to unzip program
237
+ changed order of tabs on back window - list applets now first
238
+ added rwdwcalc applet in to zips directory
239
+ changed width of text fields with help from RubyWebDialogs author
240
+ changed listing of help options, vertical instead of horizontal
241
+
242
+ version 1.49
243
+ added demon function for remote queries
244
+ startup application on first available port
245
+
246
+ version 1.48
247
+ fix in context sensitive help so that applets can use it better
248
+
236
249
  version 1.47
237
250
  change to context sensitive help
238
251
 
@@ -13,36 +13,19 @@ init.rb file to something like:\n
13
13
  RwdTinker.file(RWDFile).serve(8080, '-r' ? '.rwduids' : nil)\n
14
14
  Then you should be able to login at: http://yourhostname:8080",
15
15
 
16
- :applet_viewing => "You can get a list of all installed applets by clicking the 'listfiles button'
17
- To see the text of a install file
18
- Type in the name of the file you want.
19
-
20
- type it without the inf ending
21
- rwdapplet-0.1
22
-
23
- Then click the 'View Installed File' button
24
-
25
- If it finds the file it will open it. It displays the text the search box.
26
-
27
- You can uninstall applets on this screen",
28
-
29
- :applet_installation => " You can download an applet created by someone else\n
30
- put the file in the zips directory\n
31
-
32
- click on the 'list zips' tab\n
33
- click on 'list applets available for installing'\n
34
-
35
- chose the applet you want\n
36
- click on 'install applet'\n
37
- If all goes well the applet should be installed.\n
38
- You will need to restart rwdtinker to see the new screens",
39
- :applet_tinkerbackeditconfiguration => " You can edit the configuration
40
-
41
- Remember to reload the configuration variables if you want your
42
- changes used.",
16
+
43
17
  :documents_rwdtinker => "Documents:
44
18
 
45
19
 
46
20
  when you click on a document name, the document should pop up in a
47
- browser window, or in another browser tab."
21
+ browser window, or in another browser tab.",
22
+ :remote_control => "Remote control gives you a way to determine what applications are running on which ports
23
+
24
+ The name of the application is set in the config file
25
+ You need to click the show remote command choices first - this will show the port and query choices
26
+ Then you can click in 'Run Command' to see if other applications are running.
27
+
28
+ The remote ports daemon will not be running unless you start it.
29
+
30
+ "
48
31
 
@@ -1,36 +1,22 @@
1
1
  # this code is to call the help window
2
2
  def runhelpwindow
3
-
3
+ $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing","applet_tinkerbackeditconfiguration","remote_control"]
4
+
4
5
  if @rwd_window == "main"
5
6
  if @rwd_tab == "documentsrwdtinkerone"
6
7
  $help_topic = "documents_rwdtinker"
7
8
  end
8
- $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing"]
9
+
10
+ end
11
+
12
+ if @rwd_window == "rwdtinkerhelpwindow"
13
+ puts "in help window processing"
14
+ else
9
15
  $previouswindow = @rwd_window
10
16
  $previoustab = @rwd_tab
11
-
12
- end
13
-
14
- if @rwd_window == "tinkerbackwindow"
15
- if @rwd_tab == "filelister"
16
- $help_topic = "applet_viewing"
17
- $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing"]
18
- end
19
- if @rwd_tab == "zipslister"
20
- $help_topic = "applet_installation"
21
- $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing"]
22
- end
23
- if @rwd_tab == "editconfigurationfile"
24
- $help_topic = "applet_tinkerbackeditconfiguration"
25
- $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing"]
26
- end
27
-
28
- $previouswindow = @rwd_window
29
- $previoustab = @rwd_tab
30
- end
31
- if @rwd_window == "rwdtinkerhelpwindow"
32
- $helptopicsarray = $helptopicsarray | ["applet_installation","applet_viewing"]
33
17
  end
18
+
19
+
34
20
  @rwdhelptopic = $help_topic
35
21
  @rwdhelpdataoutput = "#{Helptext[:"#{$help_topic}"]}"
36
22
  @rwdhelpsubchoicesoutput = $helptopicsarray.rwd_method("choosenewhelptopic")
@@ -0,0 +1,10 @@
1
+ # Application RwdAddresses orginally (c) 2004 Steven Gibson under GPL.
2
+ #
3
+ # For more information about see http://www.rubyforge.net/projects/rwdapplications
4
+
5
+ # call the window
6
+ def returntomain
7
+ @rwd_window = "main"
8
+ @rwd_tab = "selectiontab"
9
+ end
10
+
@@ -0,0 +1,100 @@
1
+ #
2
+
3
+ def runcontrolcommand
4
+ require 'socket'
5
+
6
+ # Change this line...
7
+ ip = '127.0.0.1'
8
+ # And this one...
9
+ port = $rwdcontrolport1
10
+ if @a_remoteportinput
11
+ port = @a_remoteportinput.to_i
12
+ end
13
+ # Done!
14
+
15
+
16
+ commandtext = @a_remotecommandinput.to_s
17
+
18
+ remotehostnotfound = true
19
+
20
+ client = UDPSocket::new()
21
+ client.send(commandtext, 0, ip, port)
22
+
23
+
24
+ if (commandtext == "stop")
25
+ begin
26
+ @socket = UDPSocket::new()
27
+ @socket.bind(ip, port)
28
+ # Rescue the "Address in use" error
29
+ rescue Errno::EADDRINUSE
30
+
31
+ databack, info = client.recv(128)
32
+ @remotecommandresult = databack
33
+ @lastremotecommand = "rwdtinker remote:: Port #{port} on host #{ip} ."
34
+ remotehostnotfound = false
35
+
36
+ # Rescue the "Address not available" error
37
+ rescue Errno::EADDRNOTAVAIL
38
+ puts "Network plugin: Address #{host} is not available to bind."
39
+
40
+ # Rescue "permission denied errors
41
+ rescue Errno::EACCES
42
+ puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
43
+
44
+ # Rescue all other errors
45
+ rescue
46
+ puts "Network plugin: An error occured."
47
+
48
+ # Rescue all other errors
49
+ end
50
+ if remotehostnotfound
51
+ @remotecommandresult = "Remote Host not running"
52
+ end
53
+ @socket.close
54
+ end
55
+
56
+ remotehostnotfound = true
57
+ if (commandtext == "query")
58
+ begin
59
+ @socket = UDPSocket::new()
60
+ @socket.bind(ip, port)
61
+ # Rescue the "Address in use" error
62
+ rescue Errno::EADDRINUSE
63
+
64
+
65
+ databack, info = client.recv(128)
66
+ @remotecommandresult = databack
67
+ @lastremotecommand = "rwdtinker remote: Port #{port} on host #{ip} "
68
+ remotehostnotfound = false
69
+
70
+ # Rescue the "Address not available' error
71
+ rescue Errno::EADDRNOTAVAIL
72
+ puts "Network plugin: Address #{host} is not available to bind."
73
+
74
+ # Rescue "permission denied errors
75
+ rescue Errno::EACCES
76
+ puts "Network plugin: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
77
+
78
+ # Rescue all other errors
79
+ rescue
80
+ puts "Network plugin: An error occured."
81
+
82
+ # Rescue all other errors
83
+ end
84
+ @socket.close
85
+ end
86
+ if remotehostnotfound
87
+ @remotecommandresult = "Remote Host not running"
88
+ end
89
+ # Close the socket after use
90
+ client.close()
91
+
92
+ end
93
+
94
+ def showremoteportoptions
95
+
96
+ @remoteportoptions = $rwdcontrolports.rwd_options
97
+ @remotecommandoptions = ["query","stop"].rwd_options
98
+ end
99
+
100
+
@@ -0,0 +1,37 @@
1
+
2
+
3
+ Helptext.update( :tinkerwin2_help => " You can view the list of applets you can install
4
+ by clicking on the list files button
5
+
6
+ You can download an applet created by someone else
7
+
8
+ put the file in the zips directory",
9
+ :applet_viewing => "You can get a list of all installed applets by clicking the 'listfiles button'
10
+ To see the text of a install file
11
+ Type in the name of the file you want.
12
+
13
+ type it without the inf ending
14
+ rwdapplet-0.1
15
+
16
+ Then click the 'View Installed File' button
17
+
18
+ If it finds the file it will open it. It displays the text the search box.
19
+
20
+ You can uninstall applets on this screen",
21
+
22
+ :applet_installation => " You can download an applet created by someone else\n
23
+ put the file in the zips directory\n
24
+
25
+ click on the 'list zips' tab\n
26
+ click on 'list applets available for installing'\n
27
+
28
+ chose the applet you want\n
29
+ click on 'install applet'\n
30
+ If all goes well the applet should be installed.\n
31
+ You will need to restart rwdtinker to see the new screens",
32
+ :applet_tinkerbackeditconfiguration => " You can edit the configuration
33
+
34
+ Remember to reload the configuration variables if you want your
35
+ changes used."
36
+
37
+ )
@@ -1,21 +1,21 @@
1
1
  def installapplet
2
2
  require 'fileutils'
3
+ require 'extras/zip/zip'
3
4
  nametext = "%s" % [@a_installapplet]
4
5
 
5
6
  begin # exception trapped block
6
7
  fullname = nametext + ".zip"
7
8
  fileName = File.join($zipslocation,fullname)
8
-
9
- commandline = $unzipprogram + fileName
10
- system( commandline+' > temp.output' )
11
-
12
-
13
-
14
- system(commandline)
9
+
10
+ zf = Zip::ZipFile.new(fileName)
11
+ zf.sort.each {
12
+ |entry|
13
+ zf.extract(entry.to_s, entry.to_s)
14
+ }
15
15
  @installapplettext = Message[:applet_installed]
16
16
 
17
17
  rescue
18
- @installapplettext = "Done! - Check applet list - restart rwd to activate the new applet"
18
+ @installapplettext = "unzip error - applet may not be installed correctly"
19
19
  end # exception rescue
20
20
 
21
21
  end
@@ -0,0 +1,87 @@
1
+ #!ruby
2
+ require 'socket' # Network stuff
3
+ require 'timeout' # Timeout functions
4
+
5
+ def network_start
6
+ if RUBY_PLATFORM != "i386-mswin32"
7
+ processone = fork {
8
+ network_demon }
9
+ Process.detach(processone)
10
+
11
+ else
12
+ puts "fork not tried winXP?"
13
+ end
14
+ @viewremotecommandresult = "starting controller on next available port"
15
+ end
16
+
17
+ def network_demon
18
+ # Find configuration variables
19
+ host = "127.0.0.1"
20
+ port = $rwdcontrolports[0].to_i
21
+
22
+ openportfound = false
23
+ until openportfound
24
+
25
+ # Create a socket to listen on and bind it to the host and port
26
+ begin
27
+ @socket = UDPSocket::new()
28
+ @socket.bind(host, port)
29
+ # Rescue the "Address in use" error
30
+ openportfound = true
31
+
32
+ rescue Errno::EADDRINUSE
33
+ puts "controller startup: Port #{port} on host #{host} is already in use."
34
+ port=port+1
35
+ # Rescue the "Address not available' error
36
+ rescue Errno::EADDRNOTAVAIL
37
+ puts "Network plugin: Address #{host} is not available to bind."
38
+ port=port+1
39
+ # Rescue "permission denied errors
40
+ rescue Errno::EACCES
41
+ puts "controller startup: Access denied when binding interface addresses. Did you try to bind a port under 1024 as a regular user?"
42
+ port=port+1
43
+ # Rescue all other errors
44
+ rescue
45
+ puts "Network plugin: An error occured."
46
+ port = port+1
47
+ # Rescue all other errors
48
+ end
49
+
50
+ end
51
+
52
+
53
+ # Get all acceptable hosts
54
+ hosts = ["localhost","vaio-sag"]
55
+ # Do some nice errorchecking
56
+ if(hosts.type != Array)
57
+ puts "Network plugin: No hosts found in networkConfig/acceptHosts. Shutting down plugin."
58
+ return -1 # Return the errorcode for plugin failure
59
+ end
60
+
61
+ # Main loop
62
+ while(true)
63
+ # Get data and client data from the client
64
+ data, info = @socket.recvfrom(256)
65
+
66
+ # Is this an acceptable IP address?
67
+ if(hosts.include?(info[2]) || hosts.include?(info[3]))
68
+ command, parameter = data.split(';')
69
+
70
+ # Command actions
71
+ command.downcase!()
72
+ case command
73
+
74
+ when 'stop'
75
+ @socket.send("hello world",0,info[3],info[1].to_i)
76
+
77
+ when 'query'
78
+ @socket.send("#{$rwdapplicationidentity} on port #{$port}",0,info[3],info[1].to_i)
79
+
80
+
81
+ end # case command
82
+
83
+ end # Access control if
84
+ end # while(true)
85
+
86
+ end # Network::start()
87
+
@@ -0,0 +1,39 @@
1
+ # this code is to call the help window
2
+ def runhelpwindowtinkerwin2
3
+
4
+ # $helptopicsarray = $helptopicsarray | [""]
5
+
6
+ $help_topic = "tinkerwin2_help"
7
+ if @rwd_tab == "rwdzipslister"
8
+ $help_topic = "tinkerwin2_help"
9
+ end
10
+
11
+ if @rwd_tab == "filelister"
12
+ $help_topic = "applet_viewing"
13
+
14
+ end
15
+ if @rwd_tab == "zipslister"
16
+ $help_topic = "applet_installation"
17
+
18
+ end
19
+ if @rwd_tab == "editconfigurationfile"
20
+ $help_topic = "applet_tinkerbackeditconfiguration"
21
+
22
+ end
23
+ if @rwd_tab == "rwdremotecontrol"
24
+ $help_topic = "remote_control"
25
+
26
+ end
27
+
28
+
29
+ if @rwd_window != "rwdtinkerhelpwindow"
30
+ $previouswindow = @rwd_window
31
+ $previoustab = @rwd_tab
32
+ else
33
+ $previouswindow = @rwd_window
34
+ $previoustab = @rwd_tab
35
+ end
36
+ runhelpwindow
37
+ end
38
+
39
+
@@ -7,6 +7,6 @@
7
7
 
8
8
  def runrwdtinkerbackwindow
9
9
  @rwd_window = "tinkerbackwindow"
10
- @rwd_tab = "filelister"
10
+ @rwd_tab = "rwdzipslister"
11
11
  end
12
12
 
@@ -0,0 +1,21 @@
1
+ def viewappletcontents
2
+ require 'fileutils'
3
+ require 'extras/zip/zip'
4
+ nametext = "%s" % [@a_installapplet]
5
+
6
+ begin # exception trapped block
7
+ fullname = nametext + ".zip"
8
+ fileName = File.join($zipslocation,fullname)
9
+ tempfilecontents = " "
10
+ zf = Zip::ZipFile.new(fileName)
11
+ zf.sort.each {
12
+ |entry|
13
+ tempfilecontents = tempfilecontents + entry.to_s + "\n"
14
+ }
15
+ @appletcontentstext = tempfilecontents
16
+
17
+ rescue
18
+ @installapplettext = "unzip error - error opening applet"
19
+ end # exception rescue
20
+
21
+ end
@@ -0,0 +1,3 @@
1
+
2
+ $rwdapplicationidentity = "rwdtinker main application"
3
+
@@ -12,4 +12,5 @@ LocalLangHashFile = LangDir + "/" + "xlocallangfile.rb"
12
12
  $help_topic = "general_help"
13
13
  $helptopicsarray = [ "general_help","network_help"]
14
14
  $prevouswindow ="main"
15
+ $rwdcontrolports =["13713","13714","13715","13716","13717","13718"]
15
16
  $port = 7705
@@ -1,2 +1,2 @@
1
1
 
2
- RwdTinkerVersion = "1.48"
2
+ RwdTinkerVersion = "1.51"
data/ev/rwd.rb CHANGED
@@ -267,7 +267,7 @@ class OpenTag
267
267
  template = $rwd_html_PDA_1 if pda
268
268
 
269
269
  res <<(template(template, args))
270
- when "p" then res << "<p #{align}>"
270
+ when "p" then res << "<p #{align} > "
271
271
  when "pre" then res << "<pre #{align}>"
272
272
  when "big" then res << "<p #{align}><big>"
273
273
  when "small" then res << "<p #{align}><small>"
@@ -308,9 +308,10 @@ class OpenTag
308
308
  when "hidden" then res << "<p #{align}><input name='#{@args["name"]}' value='#{value1}' type='hidden'>"
309
309
  when "text"
310
310
  maxlength = ""
311
- maxlength = "maxlength='%s'" % @args["maxlength"] if @args.include?("maxlength")
311
+ maxlength = "maxlength='%s'" % @args["maxlength"] if @args.include?("maxlength")
312
312
  size = ""
313
- size = "size='%s'" % 10 if pda
313
+ size = "size='%s'" % @args["size"] if @args.include?("size")
314
+ size = "size='%s'" % 10 if pda
314
315
  res << "<p #{align}><input name='#{@args["name"]}' value='#{value1}' type='text' #{maxlength} #{size}>"
315
316
  oneormorefields << "true"
316
317
  when "textarea"
@@ -0,0 +1,114 @@
1
+ module IOExtras
2
+ module FakeIO
3
+ def kind_of?(object)
4
+ object == IO || super
5
+ end
6
+ end
7
+
8
+ # Implements many of the convenience methods of IO
9
+ # such as gets, getc, readline and readlines
10
+ # depends on: input_finished?, produce_input and read
11
+ module AbstractInputStream
12
+ include Enumerable
13
+ include FakeIO
14
+
15
+ def initialize
16
+ super
17
+ @lineno = 0
18
+ @outputBuffer = ""
19
+ end
20
+
21
+ attr_accessor :lineno
22
+
23
+ def readlines(aSepString = $/)
24
+ retVal = []
25
+ each_line(aSepString) { |line| retVal << line }
26
+ return retVal
27
+ end
28
+
29
+ def gets(aSepString=$/)
30
+ @lineno = @lineno.next
31
+ return read if aSepString == nil
32
+ aSepString="#{$/}#{$/}" if aSepString == ""
33
+
34
+ bufferIndex=0
35
+ while ((matchIndex = @outputBuffer.index(aSepString, bufferIndex)) == nil)
36
+ bufferIndex=@outputBuffer.length
37
+ if input_finished?
38
+ return @outputBuffer.empty? ? nil : flush
39
+ end
40
+ @outputBuffer << produce_input
41
+ end
42
+ sepIndex=matchIndex + aSepString.length
43
+ return @outputBuffer.slice!(0...sepIndex)
44
+ end
45
+
46
+ def flush
47
+ retVal=@outputBuffer
48
+ @outputBuffer=""
49
+ return retVal
50
+ end
51
+
52
+ def readline(aSepString = $/)
53
+ retVal = gets(aSepString)
54
+ raise EOFError if retVal == nil
55
+ return retVal
56
+ end
57
+
58
+ def each_line(aSepString = $/)
59
+ while true
60
+ yield readline(aSepString)
61
+ end
62
+ rescue EOFError
63
+ end
64
+
65
+ alias_method :each, :each_line
66
+ end
67
+
68
+
69
+ #relies on <<
70
+ module AbstractOutputStream
71
+ include FakeIO
72
+
73
+ def write(data)
74
+ self << data
75
+ data.to_s.length
76
+ end
77
+
78
+
79
+ def print(*params)
80
+ self << params.to_s << $\.to_s
81
+ end
82
+
83
+ def printf(aFormatString, *params)
84
+ self << sprintf(aFormatString, *params)
85
+ end
86
+
87
+ def putc(anObject)
88
+ self << case anObject
89
+ when Fixnum then anObject.chr
90
+ when String then anObject
91
+ else raise TypeError, "putc: Only Fixnum and String supported"
92
+ end
93
+ anObject
94
+ end
95
+
96
+ def puts(*params)
97
+ params << "\n" if params.empty?
98
+ params.flatten.each {
99
+ |element|
100
+ val = element.to_s
101
+ self << val
102
+ self << "\n" unless val[-1,1] == "\n"
103
+ }
104
+ end
105
+
106
+ end
107
+
108
+ end # IOExtras namespace module
109
+
110
+
111
+
112
+ # Copyright (C) 2002-2004 Thomas Sondergaard
113
+ # rubyzip is free software; you can redistribute it and/or
114
+ # modify it under the terms of the ruby license.