watobo 0.9.8.680 → 0.9.8.686

Sign up to get free protection for your applications and to get access to all the features.
@@ -22,19 +22,20 @@
22
22
  module Watobo
23
23
  def self.load_defaults
24
24
  config_path = File.expand_path(File.join(File.dirname(__FILE__),"..","..", "config"))
25
- puts "* loading defaults from #{config_path}"
25
+ # puts "* loading defaults from #{config_path}"
26
26
  Dir.glob("#{config_path}/*.yml").each do |cf|
27
27
  dummy = File.basename(cf).gsub!(/.yml/,'')
28
28
  cc = dummy.strip.gsub(/[^[a-zA-Z\-_]]/,"").gsub( "-" , "_").split("_").map{ |s| s.downcase.capitalize }.join
29
-
30
- print " - #{cc} ... "
31
- settings = YAML.load_file(cf)
32
- Watobo::Conf.add(cc, settings )
33
- print "OK\n"
29
+ begin
30
+ settings = YAML.load_file(cf)
31
+ Watobo::Conf.add(cc, settings )
32
+ rescue => bang
33
+ puts "[#{self}] Could not load config #{cf}"
34
+ end
34
35
  end
35
36
  end
36
37
 
37
38
  end
38
39
 
39
- puts "=== loading defaults ==="
40
+ #puts "=== loading defaults ==="
40
41
  Watobo.load_defaults
@@ -49,6 +49,8 @@ module Watobo
49
49
  puts "Total: " + project_settings[:active_checks].length.to_s
50
50
 
51
51
  project = Project.new(project_settings)
52
+ @running_projects << project
53
+ project
52
54
 
53
55
  end
54
56
 
@@ -23,6 +23,12 @@ module Watobo
23
23
 
24
24
  @active_checks = []
25
25
  @passive_checks = []
26
+ @running_projects = []
27
+
28
+ def self.running_projects
29
+ @running_projects
30
+ end
31
+
26
32
  def self.active_checks
27
33
  @active_checks
28
34
  end
@@ -32,12 +38,8 @@ module Watobo
32
38
  end
33
39
 
34
40
  def self.init_framework()
35
- puts "* Initializing Framework"
36
41
  init_working_directory
37
42
 
38
- # @settings.update settings
39
-
40
- puts "* loading custom settings ..."
41
43
  Watobo::Conf.each do |cm|
42
44
  cm.update
43
45
  end
@@ -101,8 +103,6 @@ module Watobo
101
103
  end
102
104
 
103
105
  def self.init_working_directory
104
- puts "* init_working_directory ..."
105
-
106
106
  watobo_folder = ".watobo"
107
107
  watobo_folder = Conf::General.watobo_folder if Conf::General.respond_to? :watobo_folder
108
108
 
@@ -121,7 +121,6 @@ module Watobo
121
121
  puts "!!! WATOBO is not tested for this platform (#{RUBY_PLATFORM})!!!"
122
122
  exit
123
123
  end
124
- puts ">> " + Conf::General.working_directory
125
124
  end
126
125
 
127
126
  unless File.exist? Conf::General.working_directory
@@ -37,7 +37,7 @@ module Watobo
37
37
  version = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X, :padding => 0)
38
38
  version.backColor = FXColor::White
39
39
 
40
- version_label = FXLabel.new(version, "Version: #{$version}", nil, :opts => JUSTIFY_CENTER_X|LAYOUT_FILL_X)
40
+ version_label = FXLabel.new(version, "Version: #{Watobo.version}", nil, :opts => JUSTIFY_CENTER_X|LAYOUT_FILL_X)
41
41
  version_label.setFont(FXFont.new(getApp(), "helvetica", 14, FONTWEIGHT_BOLD, FONTSLANT_ITALIC, FONTENCODING_DEFAULT))
42
42
  version_label.backColor = FXColor::White
43
43
  version_label.justify = JUSTIFY_CENTER_X
@@ -21,6 +21,11 @@
21
21
  # .
22
22
  module Watobo
23
23
  module Gui
24
+
25
+ def self.browser_preview(opts)
26
+
27
+ end
28
+
24
29
  class BrowserControl
25
30
  def initialize()
26
31
 
@@ -61,176 +66,7 @@ module Watobo
61
66
  end
62
67
  end
63
68
 
64
- #
65
- # Firefox Controller Class
66
- #
67
- class FFControl_UNUSED < BrowserControl
68
- #@@fft = nil
69
- def initialize()
70
- @jssh = nil
71
- aquireSession()
72
- end
73
-
74
- def ready?()
75
- return false if @jssh == nil
76
- begin
77
- @jssh.cmd(""){ |s| print s }
78
- rescue
79
- @jssh = nil
80
- return false
81
- end
82
-
83
- return true
84
- end
85
-
86
- def navigate(url)
87
- # puts "* Firefox.navigate"
88
- if aquireSession() then
89
- res = ""
90
- @jssh.cmd("tabBrowser.loadURI(\"#{url}\")"){ |l|
91
- print l
92
- res += l
93
- }
94
- if res.split(/\n/).first =~ /Error:/i then
95
- @jssh.cmd("var tab = browser.addTab(\"#{url}\")"){ |s| print s }
96
- @jssh.cmd("var tabBrowser = browser.getBrowserForTab(tab)"){ |s| print s }
97
- end
98
-
99
- end
100
- end
101
-
102
- def getDoc()
103
- begin
104
- aquireSession()
105
-
106
- jssh_cmd = "var doc = tabBrowser.contentDocument;"
107
- @jssh.cmd(jssh_cmd){ |s| print s }
108
-
109
- jssh_cmd = "var body = doc.body;"
110
- @jssh.cmd(jssh_cmd){ |s| print s }
111
- @jssh.cmd("body"){ |s| print s }
112
-
113
- jssh_cmd = "body.innerHTML;"
114
- doc = @jssh.cmd(jssh_cmd)
115
- puts doc
116
- return doc
117
-
118
- rescue => bang
119
- puts bang
120
- return false
121
-
122
- end
123
-
124
- end
125
-
126
- def busy?()
127
- ffcmd = "tabBrowser.webProgress.isLoadingDocument"
128
- res = ""
129
- begin
130
-
131
- if ready?() then
132
-
133
- res = ""
134
- @jssh.cmd(ffcmd) {|s| res += s}
135
-
136
- return true if res =~ /true/
137
- end
138
-
139
- return false
140
-
141
- rescue => bang
142
- puts bang
143
- return false
144
- end
145
- end
146
-
147
- def connect()
148
- aquireSession()
149
- end
150
-
151
- def close()
152
- if ready?
153
- @jssh.cmd("browser.removeTab(tab)"){ |s| print s }
154
- end
155
- end
156
-
157
- private
158
-
159
- def aquireSession()
160
-
161
- if not ready?
162
- @jssh = nil
163
- @jssh = ffconnect("127.0.0.1", "9997")
164
- end
165
-
166
- if @jssh != nil then
167
- @jssh.cmd("var w0 = getWindows()[0]"){ |s| print s }
168
- @jssh.cmd("var browser = w0.getBrowser()"){ |s| print s }
169
- @jssh.cmd("browser"){ |s| print s }
170
-
171
- #jssh.cmd("browser.loadURI(\"http://www.siberas.de\")"){ |s| print s }
172
- else
173
- return false
174
- end
175
- end
176
-
177
- def startFireFox()
178
- puts "startFireFox()"
179
- path_to_firefox = ""
180
- case RUBY_PLATFORM
181
- when /mswin|mingw|bccwin/
182
- puts "* firefox on this platform (#{RUBY_PLATFORM}) not supported, yet!"
183
- when /linux|bsd|solaris|hpux/i
184
- path_to_firefox = `which firefox`.strip
185
- when /darwin/i
186
- path_to_firefox = '/Applications/Firefox.app/Contents/MacOS/firefox'
187
- else
188
- puts "!Unknown OS???"
189
- nil
190
- end
191
- if path_to_firefox != ""
192
- puts "* trying to start firefox (#{path_to_firefox})"
193
- Thread.new { system("#{path_to_firefox} -jssh")}
194
- end
195
- end
196
-
197
- def ffconnect(host, port)
198
- retry_count = 0
199
-
200
- begin
201
- puts "* connecting to firefox jssh extension"
202
- jssh = Net::Telnet.new('Host' => host,
203
- 'Port' => port)
204
- jssh.sync = true
205
-
206
- jssh.waitfor(/>/){ |s| print s }
207
- rescue Errno::ECONNREFUSED
208
- puts "! BrowserControl: Connection Reset"
209
-
210
- if retry_count < 1 then
211
- retry_count += 1
212
- startFireFox()
213
- retry
214
- elsif retry_count < 3 then
215
- retry_count += 1
216
- # startFireFox()
217
- sleep 1.0
218
- retry
219
- else
220
- puts "!!! Seems like JSSH is not installed !!!"
221
- puts "please check the installation instructions!"
222
- raise "JSSH_CONNECT_ERROR"
223
- end
224
- rescue => bang
225
- puts "!!! Could not create FireFoxControl !!!"
226
- puts bang
227
- return false
228
- end
229
-
230
- return jssh
231
- end
232
- end
233
-
69
+
234
70
  #
235
71
  # InternetExplorer Controller Class
236
72
  #
@@ -298,14 +134,14 @@ module Watobo
298
134
  # require 'selenium-webdriver'
299
135
  @rc = createBrowser(browser_type, proxy)
300
136
  rescue => bang
301
- puts "* Could not create selenium driver"
137
+ puts "[#{self}] Could not create selenium driver"
302
138
  end
303
139
  end
304
140
 
305
141
  def createBrowser( browser_type = :firefox, proxy = nil )
306
142
  profile = nil
307
143
  unless proxy.nil?
308
- puts "* create preview with proxy #{proxy}"
144
+ puts "[Preview] create preview with proxy #{proxy}" if $DEBUG
309
145
  profile = Selenium::WebDriver::Firefox::Profile.new
310
146
 
311
147
  driver_proxy = Selenium::WebDriver::Proxy.new(:http => proxy)
@@ -336,11 +336,10 @@ module Watobo
336
336
  end
337
337
 
338
338
 
339
- def initialize(owner, project, chat_orig, chat_new)
339
+ def initialize(owner, chat_orig, chat_new)
340
340
  # Invoke base class initialize function first
341
341
  super(owner, "Chat Differ", :opts => DECOR_ALL,:width=>800, :height=>600)
342
342
  self.icon = ICON_DIFFER
343
- @project = project
344
343
  @chat_orig = chat_orig
345
344
  @chat_new = chat_new
346
345
  @max_line_length = 80
@@ -50,7 +50,7 @@ module Watobo
50
50
  # puts icon.class.to_s
51
51
  node = nil
52
52
  levels = e[:name].split('|')
53
- # puts "Processing: #{e[:name]}"
53
+ puts "Processing: #{e[:name]} > #{e[:data].class}" if $DEBUG
54
54
  levels.each do |l|
55
55
 
56
56
  item = self.findItem(l, node, SEARCH_FORWARD|SEARCH_IGNORECASE)
@@ -177,11 +177,13 @@ module Watobo
177
177
  #LAYOUT_TOP|LAYOUT_RIGHT|TREELIST_SHOWS_LINES|TREELIST_SHOWS_BOXES|TREELIST_ROOT_BOXES|TREELIST_EXTENDEDSELECT
178
178
 
179
179
  self.connect(SEL_COMMAND) do |sender, sel, item|
180
- # puts "Selected Item: #{item}"
181
- # if item.parent
182
- # puts "Member Of: #{item.parent}"
183
- # puts "Has Brothers: #{item.parent.numChildren}"
184
- # end
180
+ if $DEBUG
181
+ puts "Selected Item: #{item}"
182
+ if item.parent
183
+ puts "Member Of: #{item.parent}"
184
+ puts "Has Brothers: #{item.parent.numChildren}"
185
+ end
186
+ end
185
187
  if self.itemLeaf?(item) then
186
188
  toggleState(item)
187
189
  updateParent(item)
@@ -204,6 +206,7 @@ module Watobo
204
206
  uncheckAllChildren(item)
205
207
  :none
206
208
  end
209
+
207
210
  self.setItemData(item, new_state)
208
211
  self.setItemClosedIcon(item, icon)
209
212
  self.setItemOpenIcon(item, icon)
@@ -32,10 +32,9 @@ module Watobo
32
32
 
33
33
  include Responder
34
34
 
35
- def initialize(owner, project, prefs={})
35
+ def initialize(owner, prefs={})
36
36
 
37
- super(owner, "Client Certificates", :opts => DECOR_ALL)
38
- @project = project
37
+ super(owner, "Client Certificates", :opts => DECOR_ALL)
39
38
  FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
40
39
 
41
40
  @password_policy = {
@@ -45,7 +44,7 @@ module Watobo
45
44
  @cert_path = nil
46
45
  @client_certificates = {}
47
46
  @client_certificates = project.getClientCertificates unless project.getClientCertificates.nil?
48
- puts client_certificates.to_yaml
47
+ # puts client_certificates.to_yaml
49
48
 
50
49
  @password_policy.update prefs[:password_policy] if prefs.has_key? :password_policy
51
50
 
@@ -121,7 +120,7 @@ module Watobo
121
120
  @sites_combo.clearItems
122
121
  @sites_combo.appendItem(NO_SELECTION, nil)
123
122
  @site_dt.value = NO_SELECTION
124
- @project.listSites(:in_scope => @scope_only_cb.checked? ){ |site|
123
+ Watobo::Gui.project.listSites(:in_scope => @scope_only_cb.checked? ){ |site|
125
124
  #puts "Site: #{site}"
126
125
  @sites_combo.appendItem(site, site)
127
126
  }
@@ -97,16 +97,16 @@ module Watobo
97
97
  # end
98
98
 
99
99
  if @filter[:unique]
100
- unless Watobo::Gui.active_project.nil?
101
- uniq_hash = Watobo::Gui.active_project.uniqueRequestHash chat.request
100
+ unless Watobo::Gui.project.nil?
101
+ uniq_hash = Watobo::Gui.project.uniqueRequestHash chat.request
102
102
  return false if @uniq_chats.has_key? uniq_hash
103
103
  @uniq_chats[uniq_hash] = nil
104
104
  end
105
105
  end
106
106
 
107
107
  if @filter[:show_scope_only]
108
- unless Watobo::Gui.active_project.nil?
109
- return false unless Watobo::Gui.active_project.siteInScope?(chat.request.site)
108
+ unless Watobo::Gui.project.nil?
109
+ return false unless Watobo::Gui.project.siteInScope?(chat.request.site)
110
110
  end
111
111
  end
112
112
  # puts "* passed scope"