watobo 0.9.19 → 0.9.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. data/CHANGELOG.md +104 -0
  2. data/bin/nfq_server.rb +8 -20
  3. data/bin/watobo_gui.rb +8 -20
  4. data/config/forwarding_proxy.yml +2 -2
  5. data/lib/watobo.rb +12 -22
  6. data/lib/watobo/adapters.rb +12 -24
  7. data/lib/watobo/adapters/data_store.rb +76 -66
  8. data/lib/watobo/adapters/file/file_store.rb +295 -307
  9. data/lib/watobo/adapters/session_store.rb +13 -25
  10. data/lib/watobo/ca.rb +9 -21
  11. data/lib/watobo/config.rb +205 -217
  12. data/lib/watobo/constants.rb +8 -20
  13. data/lib/watobo/core.rb +11 -23
  14. data/lib/watobo/core/active_check.rb +11 -21
  15. data/lib/watobo/core/active_checks.rb +57 -69
  16. data/lib/watobo/core/ca.rb +388 -398
  17. data/lib/watobo/core/cert_store.rb +42 -54
  18. data/lib/watobo/core/chat.rb +100 -112
  19. data/lib/watobo/core/chats.rb +271 -275
  20. data/lib/watobo/core/client_cert_store.rb +33 -45
  21. data/lib/watobo/core/conversation.rb +56 -68
  22. data/lib/watobo/core/cookie.rb +31 -43
  23. data/lib/watobo/core/finding.rb +74 -86
  24. data/lib/watobo/core/findings.rb +113 -125
  25. data/lib/watobo/core/forwarding_proxy.rb +44 -35
  26. data/lib/watobo/core/fuzz_gen.rb +8 -20
  27. data/lib/watobo/core/intercept_carver.rb +176 -188
  28. data/lib/watobo/core/intercept_filter.rb +243 -255
  29. data/lib/watobo/core/interceptor.rb +106 -118
  30. data/lib/watobo/core/min_class.rb +12 -24
  31. data/lib/watobo/core/netfilter_queue.rb +178 -190
  32. data/lib/watobo/core/ott_cache.rb +152 -148
  33. data/lib/watobo/core/parameter.rb +53 -58
  34. data/lib/watobo/core/passive_check.rb +8 -20
  35. data/lib/watobo/core/passive_checks.rb +56 -68
  36. data/lib/watobo/core/passive_scanner.rb +54 -66
  37. data/lib/watobo/core/plugin.rb +19 -31
  38. data/lib/watobo/core/project.rb +8 -20
  39. data/lib/watobo/core/proxy.rb +51 -63
  40. data/lib/watobo/core/request.rb +128 -120
  41. data/lib/watobo/core/response.rb +59 -61
  42. data/lib/watobo/core/scanner.rb +8 -20
  43. data/lib/watobo/core/scanner3.rb +413 -425
  44. data/lib/watobo/core/scope.rb +91 -103
  45. data/lib/watobo/core/session.rb +109 -87
  46. data/lib/watobo/core/sid_cache.rb +106 -118
  47. data/lib/watobo/core/subscriber.rb +33 -45
  48. data/lib/watobo/defaults.rb +29 -41
  49. data/lib/watobo/external/diff/lcs.rb +8 -20
  50. data/lib/watobo/external/diff/lcs/array.rb +8 -20
  51. data/lib/watobo/external/diff/lcs/block.rb +8 -20
  52. data/lib/watobo/external/diff/lcs/callbacks.rb +8 -20
  53. data/lib/watobo/external/diff/lcs/change.rb +8 -20
  54. data/lib/watobo/external/diff/lcs/hunk.rb +8 -20
  55. data/lib/watobo/external/diff/lcs/ldiff.rb +8 -20
  56. data/lib/watobo/external/diff/lcs/string.rb +8 -20
  57. data/lib/watobo/externals.rb +14 -26
  58. data/lib/watobo/framework.rb +12 -24
  59. data/lib/watobo/framework/create_project.rb +68 -80
  60. data/lib/watobo/framework/init.rb +8 -20
  61. data/lib/watobo/framework/init_modules.rb +8 -20
  62. data/lib/watobo/framework/license_text.rb +36 -48
  63. data/lib/watobo/framework/load_chat.rb +21 -33
  64. data/lib/watobo/gui.rb +121 -133
  65. data/lib/watobo/gui/about_watobo.rb +8 -20
  66. data/lib/watobo/gui/browser_preview.rb +8 -20
  67. data/lib/watobo/gui/certificate_dialog.rb +8 -20
  68. data/lib/watobo/gui/chat_diff.rb +11 -21
  69. data/lib/watobo/gui/chatviewer_frame.rb +10 -22
  70. data/lib/watobo/gui/checkboxtree.rb +8 -20
  71. data/lib/watobo/gui/checks_policy_frame.rb +8 -20
  72. data/lib/watobo/gui/client_cert_dialog.rb +10 -21
  73. data/lib/watobo/gui/confirm_scan_dialog.rb +8 -20
  74. data/lib/watobo/gui/conversation_table.rb +54 -44
  75. data/lib/watobo/gui/conversation_table_ctrl.rb +215 -227
  76. data/lib/watobo/gui/conversation_table_ctrl2.rb +385 -393
  77. data/lib/watobo/gui/csrf_token_dialog.rb +11 -25
  78. data/lib/watobo/gui/custom_viewer.rb +357 -369
  79. data/lib/watobo/gui/dashboard.rb +8 -20
  80. data/lib/watobo/gui/define_scope_frame.rb +8 -20
  81. data/lib/watobo/gui/differ_frame.rb +223 -235
  82. data/lib/watobo/gui/edit_comment.rb +8 -20
  83. data/lib/watobo/gui/edit_scope_dialog.rb +8 -20
  84. data/lib/watobo/gui/export_dialog.rb +114 -0
  85. data/lib/watobo/gui/finding_info.rb +9 -21
  86. data/lib/watobo/gui/findings_tree.rb +8 -20
  87. data/lib/watobo/gui/full_scan_dialog.rb +8 -20
  88. data/lib/watobo/gui/fuzzer_gui.rb +8 -20
  89. data/lib/watobo/gui/goto_url_dialog.rb +78 -90
  90. data/lib/watobo/gui/hex_viewer.rb +25 -27
  91. data/lib/watobo/gui/html_viewer.rb +295 -307
  92. data/lib/watobo/gui/intercept_filter_dialog.rb +196 -208
  93. data/lib/watobo/gui/interceptor_gui.rb +1046 -1041
  94. data/lib/watobo/gui/interceptor_settings_dialog.rb +8 -20
  95. data/lib/watobo/gui/list_box.rb +109 -121
  96. data/lib/watobo/gui/log_file_viewer.rb +40 -52
  97. data/lib/watobo/gui/log_viewer.rb +87 -99
  98. data/lib/watobo/gui/login_wizzard.rb +8 -20
  99. data/lib/watobo/gui/main_window.rb +34 -33
  100. data/lib/watobo/gui/manual_request_editor.rb +25 -35
  101. data/lib/watobo/gui/master_pw_dialog.rb +8 -20
  102. data/lib/watobo/gui/mixins/gui_settings.rb +37 -49
  103. data/lib/watobo/gui/page_tree.rb +225 -237
  104. data/lib/watobo/gui/password_policy_dialog.rb +8 -20
  105. data/lib/watobo/gui/plugin_board.rb +8 -20
  106. data/lib/watobo/gui/preferences_dialog.rb +8 -20
  107. data/lib/watobo/gui/progress_window.rb +8 -20
  108. data/lib/watobo/gui/project_wizzard.rb +8 -20
  109. data/lib/watobo/gui/proxy_dialog.rb +117 -85
  110. data/lib/watobo/gui/quick_scan_dialog.rb +8 -20
  111. data/lib/watobo/gui/request_builder_frame.rb +125 -122
  112. data/lib/watobo/gui/request_editor.rb +53 -28
  113. data/lib/watobo/gui/rewrite_filters_dialog.rb +402 -414
  114. data/lib/watobo/gui/rewrite_rules_dialog.rb +380 -392
  115. data/lib/watobo/gui/save_chat_dialog.rb +148 -160
  116. data/lib/watobo/gui/scanner_settings_dialog.rb +8 -20
  117. data/lib/watobo/gui/select_chat_dialog.rb +8 -20
  118. data/lib/watobo/gui/session_management_dialog.rb +8 -20
  119. data/lib/watobo/gui/sites_tree.rb +118 -22
  120. data/lib/watobo/gui/status_bar.rb +8 -20
  121. data/lib/watobo/gui/table_editor.rb +76 -53
  122. data/lib/watobo/gui/tagless_viewer.rb +10 -21
  123. data/lib/watobo/gui/templates/plugin.rb +8 -20
  124. data/lib/watobo/gui/templates/plugin2.rb +99 -111
  125. data/lib/watobo/gui/templates/plugin_base.rb +152 -164
  126. data/lib/watobo/gui/text_viewer.rb +8 -20
  127. data/lib/watobo/gui/transcoder_window.rb +15 -22
  128. data/lib/watobo/gui/utils/gui_utils.rb +8 -20
  129. data/lib/watobo/gui/utils/init_icons.rb +94 -106
  130. data/lib/watobo/gui/utils/load_icons.rb +41 -53
  131. data/lib/watobo/gui/utils/load_plugins.rb +118 -130
  132. data/lib/watobo/gui/utils/master_password.rb +76 -88
  133. data/lib/watobo/gui/utils/save_default_settings.rb +121 -133
  134. data/lib/watobo/gui/utils/save_project_settings.rb +8 -20
  135. data/lib/watobo/gui/utils/save_proxy_settings.rb +53 -21
  136. data/lib/watobo/gui/utils/save_scanner_settings.rb +26 -38
  137. data/lib/watobo/gui/utils/session_history.rb +120 -132
  138. data/lib/watobo/gui/workspace_dialog.rb +8 -20
  139. data/lib/watobo/gui/www_auth_dialog.rb +8 -20
  140. data/lib/watobo/gui/xml_viewer_frame.rb +8 -20
  141. data/lib/watobo/http.rb +12 -23
  142. data/lib/watobo/http/cookies/cookies.rb +63 -70
  143. data/lib/watobo/http/data/data.rb +56 -64
  144. data/lib/watobo/http/data/json.rb +51 -0
  145. data/lib/watobo/http/url/url.rb +46 -58
  146. data/lib/watobo/http/xml/xml.rb +129 -141
  147. data/lib/watobo/interceptor.rb +11 -23
  148. data/lib/watobo/interceptor/proxy.rb +624 -625
  149. data/lib/watobo/interceptor/transparent.rb +22 -34
  150. data/lib/watobo/mixins.rb +18 -30
  151. data/lib/watobo/mixins/check_info.rb +35 -47
  152. data/lib/watobo/mixins/httpparser.rb +42 -35
  153. data/lib/watobo/mixins/request_parser.rb +8 -20
  154. data/lib/watobo/mixins/shapers.rb +484 -477
  155. data/lib/watobo/mixins/transcoders.rb +8 -20
  156. data/lib/watobo/parser.rb +9 -21
  157. data/lib/watobo/parser/html.rb +91 -103
  158. data/lib/watobo/sockets.rb +11 -23
  159. data/lib/watobo/sockets/agent.rb +836 -848
  160. data/lib/watobo/sockets/client_socket.rb +283 -277
  161. data/lib/watobo/sockets/connection.rb +409 -421
  162. data/lib/watobo/sockets/http_socket.rb +16 -23
  163. data/lib/watobo/sockets/ntlm_auth.rb +137 -149
  164. data/lib/watobo/utils.rb +18 -30
  165. data/lib/watobo/utils/check_regex.rb +8 -20
  166. data/lib/watobo/utils/copy_object.rb +8 -20
  167. data/lib/watobo/utils/crypto.rb +8 -20
  168. data/lib/watobo/utils/expand_range.rb +31 -43
  169. data/lib/watobo/utils/export_xml.rb +108 -0
  170. data/lib/watobo/utils/file_management.rb +8 -20
  171. data/lib/watobo/utils/hexprint.rb +17 -29
  172. data/lib/watobo/utils/load_chat.rb +8 -20
  173. data/lib/watobo/utils/load_icon.rb +8 -20
  174. data/lib/watobo/{external/ntlm → utils}/ntlm.rb +874 -796
  175. data/lib/watobo/utils/print_debug.rb +20 -32
  176. data/lib/watobo/utils/response_builder.rb +98 -110
  177. data/lib/watobo/utils/response_hash.rb +9 -20
  178. data/lib/watobo/utils/secure_eval.rb +10 -22
  179. data/lib/watobo/utils/strings.rb +18 -30
  180. data/lib/watobo/utils/text2request.rb +12 -20
  181. data/lib/watobo/utils/url.rb +31 -43
  182. data/lib/watobo/utils/utf16.rb +22 -0
  183. data/modules/active/Apache/mod_status.rb +9 -0
  184. data/modules/active/Apache/multiview.rb +161 -0
  185. data/modules/active/Flash/crossdomain.rb +9 -0
  186. data/modules/active/directories/dirwalker.rb +8 -20
  187. data/modules/active/discovery/fileextensions.rb +10 -22
  188. data/modules/active/discovery/http_methods.rb +8 -20
  189. data/modules/active/domino/domino_db.rb +8 -20
  190. data/modules/active/dotNET/custom_errors.rb +110 -122
  191. data/modules/active/dotNET/dotnet_files.rb +98 -110
  192. data/modules/active/fileinclusion/lfi_simple.rb +8 -20
  193. data/modules/active/jboss/jboss_basic.rb +8 -20
  194. data/modules/active/sap/business_objects.rb +63 -0
  195. data/modules/active/sap/its_commands.rb +8 -20
  196. data/modules/active/sap/its_service_parameter.rb +8 -20
  197. data/modules/active/sap/its_services.rb +8 -20
  198. data/modules/active/sap/its_xss.rb +8 -20
  199. data/modules/active/shell_shock/shell_shock.rb +149 -0
  200. data/modules/active/siebel/siebel_apps.rb +168 -180
  201. data/modules/active/sqlinjection/sql_boolean.rb +9 -21
  202. data/modules/active/sqlinjection/sqli_error.rb +10 -22
  203. data/modules/active/sqlinjection/sqli_timing.rb +228 -240
  204. data/modules/active/struts2/default_handler_ognl.rb +114 -126
  205. data/modules/active/struts2/include_params_ognl.rb +113 -125
  206. data/modules/active/xml/xml_xxe.rb +122 -127
  207. data/modules/active/xss/xss_ng.rb +223 -234
  208. data/modules/active/xss/xss_simple.rb +8 -20
  209. data/modules/passive/ajax.rb +76 -84
  210. data/modules/passive/autocomplete.rb +64 -76
  211. data/modules/passive/cookie_options.rb +8 -20
  212. data/modules/passive/cookie_xss.rb +9 -21
  213. data/modules/passive/detect_code.rb +9 -21
  214. data/modules/passive/detect_fileupload.rb +11 -22
  215. data/modules/passive/detect_infrastructure.rb +23 -35
  216. data/modules/passive/detect_one_time_tokens.rb +8 -20
  217. data/modules/passive/dirindexing.rb +9 -21
  218. data/modules/passive/disclosure_domino.rb +66 -79
  219. data/modules/passive/disclosure_emails.rb +9 -21
  220. data/modules/passive/disclosure_ipaddr.rb +15 -23
  221. data/modules/passive/filename_as_parameter.rb +8 -20
  222. data/modules/passive/form_spotter.rb +15 -21
  223. data/modules/passive/hidden_fields.rb +64 -70
  224. data/modules/passive/hotspots.rb +13 -22
  225. data/modules/passive/in_script_parameter.rb +15 -24
  226. data/modules/passive/multiple_server_headers.rb +8 -20
  227. data/modules/passive/possible_login.rb +12 -23
  228. data/modules/passive/redirect_url.rb +10 -22
  229. data/modules/passive/redirectionz.rb +9 -21
  230. data/modules/passive/sap-headers.rb +64 -76
  231. data/modules/passive/xss_dom.rb +10 -21
  232. data/plugins/catalog/catalog.rb +17 -23
  233. data/plugins/crawler/crawler.rb +12 -24
  234. data/plugins/crawler/gui.rb +13 -25
  235. data/plugins/crawler/gui/auth_frame.rb +278 -290
  236. data/plugins/crawler/gui/crawler_gui.rb +302 -320
  237. data/plugins/crawler/gui/general_settings_frame.rb +104 -116
  238. data/plugins/crawler/gui/hooks_frame.rb +88 -100
  239. data/plugins/crawler/gui/scope_frame.rb +58 -70
  240. data/plugins/crawler/gui/settings_tabbook.rb +46 -58
  241. data/plugins/crawler/gui/status_frame.rb +67 -78
  242. data/plugins/crawler/lib/bags.rb +26 -38
  243. data/plugins/crawler/lib/constants.rb +19 -31
  244. data/plugins/crawler/lib/engine.rb +505 -508
  245. data/plugins/crawler/lib/grabber.rb +77 -87
  246. data/plugins/crawler/lib/status.rb +82 -0
  247. data/plugins/crawler/lib/uri_mp.rb +20 -32
  248. data/plugins/filefinder/dbs/siebel_paths.txt +1118 -0
  249. data/plugins/filefinder/dbs/subs-big.lst +31986 -0
  250. data/plugins/filefinder/filefinder.rb +13 -23
  251. data/plugins/sqlmap/bin/test.rb +86 -98
  252. data/plugins/sqlmap/gui.rb +12 -24
  253. data/plugins/sqlmap/gui/main.rb +226 -238
  254. data/plugins/sqlmap/gui/options_frame.rb +105 -117
  255. data/plugins/sqlmap/lib/sqlmap_ctrl.rb +103 -115
  256. data/plugins/sqlmap/sqlmap.rb +10 -22
  257. data/plugins/sslchecker/cli/sslchecker_cli.rb +8 -20
  258. data/plugins/sslchecker/gui/cipher_table.rb +252 -264
  259. data/plugins/sslchecker/gui/gui.rb +267 -276
  260. data/plugins/sslchecker/gui/sslchecker.rb +12 -24
  261. data/plugins/sslchecker/lib/check.rb +172 -80
  262. data/plugins/wshell/gui/main.rb +115 -127
  263. data/plugins/wshell/lib/core.rb +85 -97
  264. data/plugins/wshell/wshell.rb +19 -31
  265. metadata +14 -6
  266. data/.yardopts +0 -24
@@ -1,230 +1,218 @@
1
- # .
1
+ #.
2
2
  # conversation_table_ctrl.rb
3
- #
4
- # Copyright 2013 by siberas, http://www.siberas.de
5
- #
6
- # This file is part of WATOBO (Web Application Tool Box)
7
- # http://watobo.sourceforge.com
8
- #
9
- # WATOBO is free software; you can redistribute it and/or modify
10
- # it under the terms of the GNU General Public License as published by
11
- # the Free Software Foundation version 2 of the License.
12
- #
13
- # WATOBO is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU General Public License
19
- # along with WATOBO; if not, write to the Free Software
20
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
- # .
22
- # @private
23
- module Watobo#:nodoc: all
24
- module Gui
25
- class ConversationTableCtrl < FXVerticalFrame
26
-
27
- include Watobo::Constants
28
- include Watobo::Gui::Icons
29
- def table=(table)
30
- @table = table
31
- @table.subscribe(:table_changed) { update_info }
32
- end
33
-
34
- def initialize(owner, opts)
35
- super(owner, opts )
36
- @table = nil
37
- @tabBook = FXTabBook.new(self, nil, 0, :opts => LAYOUT_FILL_X|LAYOUT_RIGHT, :padding => 0)
38
-
39
- docfilter_tab = FXTabItem.new(@tabBook, "Doc Filter", nil)
40
-
41
- docfilter_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
42
-
43
- @foption_nopix = FXCheckButton.new(docfilter_frame, "excl. pics", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
44
- @foption_nopix.setCheck(true)
45
- @foption_nodocs = FXCheckButton.new(docfilter_frame, "excl. docs", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
46
- @foption_nodocs.setCheck(true)
47
- @foption_nojs = FXCheckButton.new(docfilter_frame, "excl. javascript", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
48
- @foption_nojs.setCheck(true)
49
- @foption_nocss = FXCheckButton.new(docfilter_frame, "excl. style sheets", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
50
- @foption_nocss.setCheck(true)
51
-
52
- search_tab = FXTabItem.new(@tabBook, "Text Filter", nil)
53
-
54
- search_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
55
-
56
- FXButton.new(search_frame, "Clear", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) { clear_text_filter }
57
-
58
- @text_filter = FXTextField.new(search_frame, 20, nil, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
59
- # filterOptionsFrame =FXHorizontalFrame.new(fbox, LAYOUT_FILL_X)
60
- @foption_url = FXCheckButton.new(search_frame, "URL", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
61
- @foption_url.setCheck(true)
62
- @foption_url.connect(SEL_COMMAND){ update_text_filter }
63
- @foption_req = FXCheckButton.new(search_frame, "Full Request", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
64
- @foption_req .connect(SEL_COMMAND){ update_text_filter }
65
- @foption_res = FXCheckButton.new(search_frame, "Full Response", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
66
- @foption_res.connect(SEL_COMMAND){ update_text_filter }
67
-
68
- options_tab = FXTabItem.new(@tabBook, "Options", nil)
69
- options_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
70
- @table_option_autoscroll = FXCheckButton.new(options_frame, "autoscroll", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
71
- @table_option_autoscroll.setCheck(true)
72
-
73
- @table_option_unique = FXCheckButton.new(options_frame, "unique chats", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
74
- @table_option_unique.setCheck(false)
75
-
76
- @table_option_scope = FXCheckButton.new(options_frame, "scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
77
- @table_option_scope.setCheck(false)
78
-
79
- @table_option_hidetested_cb = FXCheckButton.new(options_frame, "hide tested", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
80
- @table_option_hidetested_cb.setCheck(false)
81
-
82
- @table_option_ok_only = FXCheckButton.new(options_frame, "200 only (Response)", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
83
- @table_option_ok_only.setCheck(false)
84
-
85
- @table_option_text_only = FXCheckButton.new(options_frame, "text content-type only (Response)", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
86
- @table_option_text_only.setCheck(false)
87
-
88
-
89
- @table_option_autoscroll.connect(SEL_COMMAND) {
90
- @table.autoscroll = @table_option_autoscroll.checked? unless @table.nil?
91
- }
92
-
93
- #applyFilterButton = FXButton.new(conversation_frame, "Apply", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
94
- button_frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X, :padding => 0)
95
- FXButton.new(button_frame, "Apply", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) { apply_filter }
96
- #FXButton.new(docfilter_button_frame, "Clear", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND, method(:onClear))
97
-
98
- @text_filter.connect(SEL_COMMAND){
99
- apply_filter
100
- }
3
+ #.
4
+ # Copyright 2014 by siberas, http://www.siberas.de
5
+ # This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
6
+ # WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
7
+ # WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
8
+ # You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
101
9
 
102
- FXButton.new(button_frame, "", ICON_BTN_UP, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) {
103
- @table.scrollUp() unless @table.nil?
104
- }
105
-
106
- FXButton.new(button_frame, "", ICON_BTN_DOWN, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) {
107
- @table.scrollDown() unless @table.nil?
108
- }
109
-
110
- @info_txt = FXLabel.new( button_frame, "0/0", :opts => LAYOUT_RIGHT)
111
-
112
- @tabBook.connect(SEL_LEFTBUTTONRELEASE){
113
- x = getApp.activeWindow.x + self.x + self.parent.x + self.parent.parent.x + self.parent.parent.parent.x
114
- y = getApp.activeWindow.y + self.y + self.parent.y + self.parent.parent.y + self.parent.parent.parent.y + self.parent.parent.parent.parent.y
115
- FXMenuPane.new(self) do |menu_pane|
116
- frame = FXVerticalFrame.new(menu_pane, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
117
- 10.times do |i|
118
- FXLabel.new(frame, "Label #{i}")
119
- end
120
- menu_pane.create
121
- #menu_pane.popup(nil, x, y, 200, 200)
122
- menu_pane.popup(nil, x, y)
123
- app.runModalWhileShown(menu_pane)
124
- puts "done!"
125
- end
126
- }
127
- end
128
-
129
- def subscribe(event, &callback)
130
- (@event_dispatcher_listeners[event] ||= []) << callback
131
- end
132
-
133
- def filter_settings
134
- doctype_filter = []
135
- doctype_filter.concat(Watobo::Conf::Gui.fext_img) if @foption_nopix.checked?
136
- doctype_filter.concat(Watobo::Conf::Gui.fext_docs) if @foption_nodocs.checked?
137
- doctype_filter.concat(Watobo::Conf::Gui.fext_javascript) if @foption_nojs.checked?
138
- doctype_filter.concat(Watobo::Conf::Gui.fext_style) if @foption_nocss.checked?
139
-
140
- text = @text_filter.enabled? ? @text_filter.text : ""
141
-
142
- fs = {
143
- :show_scope_only => @table_option_scope.checked?,
144
- :text => text,
145
- :url => @foption_url.checked?,
146
- :request => @foption_req.checked?,
147
- :response => @foption_res.checked?,
148
- :hide_tested => @table_option_hidetested_cb.checked?,
149
- :doc_filter => doctype_filter,
150
- :unique => @table_option_unique.checked?,
151
- :ok_only => @table_option_ok_only.checked?,
152
- :text_only => @table_option_text_only.checked?
153
- }
154
- fs
155
- end
156
-
157
- private
158
-
159
- def update_info
160
- if @table.respond_to? :num_total
161
- @info_txt.text = "#{@table.num_visible}/#{@table.num_total}"
162
- end
163
- end
164
-
165
- def clearEvents(event)
166
- @event_dispatcher_listener[event].clear
167
- end
168
-
169
- def notify(event, *args)
170
- if @event_dispatcher_listeners[event]
171
- @event_dispatcher_listeners[event].each do |m|
172
- m.call(*args) if m.respond_to? :call
173
- end
174
- end
175
- end
176
-
177
- def clear_text_filter
178
- @text_filter.text = ''
179
- apply_filter
180
- end
181
-
182
- def apply_filter
183
- unless @table.nil?
184
- getApp().beginWaitCursor do
185
- @table.apply_filter(filter_settings)
186
- update_info
187
- end
188
- end
189
- end
190
-
191
- def update_text_filter
192
- if @foption_url.checked? or @foption_req.checked? or @foption_res.checked?
193
- @text_filter.enable
194
- else
195
- @text_filter.disable
196
- end
197
- end
198
-
199
- def filter_settings
200
- doctype_filter = []
201
- doctype_filter.concat(Watobo::Conf::Gui.fext_img) if @foption_nopix.checked?
202
- doctype_filter.concat(Watobo::Conf::Gui.fext_docs) if @foption_nodocs.checked?
203
- doctype_filter.concat(Watobo::Conf::Gui.fext_javascript) if @foption_nojs.checked?
204
- doctype_filter.concat(Watobo::Conf::Gui.fext_style) if @foption_nocss.checked?
205
-
206
- text = @text_filter.enabled? ? @text_filter.text : ""
207
- unless text.empty?
208
- begin
209
- "test for valid regex".match(/#{text}/)
210
- rescue => bang
211
- text = Regexp.quote(@text_filter.text)
212
- end
213
- end
214
-
215
- fs = {
216
- :show_scope_only => @table_option_scope.checked?,
217
- :text => text,
218
- :url => @foption_url.checked?,
219
- :request => @foption_req.checked?,
220
- :response => @foption_res.checked?,
221
- :hide_tested => @table_option_hidetested_cb.checked?,
222
- :doc_filter => doctype_filter,
223
- :unique => @table_option_unique.checked?
224
- }
225
- fs
226
- end
227
-
228
- end
229
- end
10
+ # @private
11
+ module Watobo#:nodoc: all
12
+ module Gui
13
+ class ConversationTableCtrl < FXVerticalFrame
14
+
15
+ include Watobo::Constants
16
+ include Watobo::Gui::Icons
17
+ def table=(table)
18
+ @table = table
19
+ @table.subscribe(:table_changed) { update_info }
20
+ end
21
+
22
+ def initialize(owner, opts)
23
+ super(owner, opts )
24
+ @table = nil
25
+ @tabBook = FXTabBook.new(self, nil, 0, :opts => LAYOUT_FILL_X|LAYOUT_RIGHT, :padding => 0)
26
+
27
+ docfilter_tab = FXTabItem.new(@tabBook, "Doc Filter", nil)
28
+
29
+ docfilter_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
30
+
31
+ @foption_nopix = FXCheckButton.new(docfilter_frame, "excl. pics", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
32
+ @foption_nopix.setCheck(true)
33
+ @foption_nodocs = FXCheckButton.new(docfilter_frame, "excl. docs", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
34
+ @foption_nodocs.setCheck(true)
35
+ @foption_nojs = FXCheckButton.new(docfilter_frame, "excl. javascript", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
36
+ @foption_nojs.setCheck(true)
37
+ @foption_nocss = FXCheckButton.new(docfilter_frame, "excl. style sheets", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
38
+ @foption_nocss.setCheck(true)
39
+
40
+ search_tab = FXTabItem.new(@tabBook, "Text Filter", nil)
41
+
42
+ search_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
43
+
44
+ FXButton.new(search_frame, "Clear", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) { clear_text_filter }
45
+
46
+ @text_filter = FXTextField.new(search_frame, 20, nil, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
47
+ # filterOptionsFrame =FXHorizontalFrame.new(fbox, LAYOUT_FILL_X)
48
+ @foption_url = FXCheckButton.new(search_frame, "URL", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
49
+ @foption_url.setCheck(true)
50
+ @foption_url.connect(SEL_COMMAND){ update_text_filter }
51
+ @foption_req = FXCheckButton.new(search_frame, "Full Request", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
52
+ @foption_req .connect(SEL_COMMAND){ update_text_filter }
53
+ @foption_res = FXCheckButton.new(search_frame, "Full Response", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
54
+ @foption_res.connect(SEL_COMMAND){ update_text_filter }
55
+
56
+ options_tab = FXTabItem.new(@tabBook, "Options", nil)
57
+ options_frame = FXHorizontalFrame.new(@tabBook, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED)
58
+ @table_option_autoscroll = FXCheckButton.new(options_frame, "autoscroll", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
59
+ @table_option_autoscroll.setCheck(true)
60
+
61
+ @table_option_unique = FXCheckButton.new(options_frame, "unique chats", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
62
+ @table_option_unique.setCheck(false)
63
+
64
+ @table_option_scope = FXCheckButton.new(options_frame, "scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
65
+ @table_option_scope.setCheck(false)
66
+
67
+ @table_option_hidetested_cb = FXCheckButton.new(options_frame, "hide tested", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
68
+ @table_option_hidetested_cb.setCheck(false)
69
+
70
+ @table_option_ok_only = FXCheckButton.new(options_frame, "200 only (Response)", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
71
+ @table_option_ok_only.setCheck(false)
72
+
73
+ @table_option_text_only = FXCheckButton.new(options_frame, "text content-type only (Response)", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
74
+ @table_option_text_only.setCheck(false)
75
+
76
+
77
+ @table_option_autoscroll.connect(SEL_COMMAND) {
78
+ @table.autoscroll = @table_option_autoscroll.checked? unless @table.nil?
79
+ }
80
+
81
+ #applyFilterButton = FXButton.new(conversation_frame, "Apply", nil, nil, 0, FRAME_RAISED|FRAME_THICK)
82
+ button_frame = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X, :padding => 0)
83
+ FXButton.new(button_frame, "Apply", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) { apply_filter }
84
+ #FXButton.new(docfilter_button_frame, "Clear", nil, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND, method(:onClear))
85
+
86
+ @text_filter.connect(SEL_COMMAND){
87
+ apply_filter
88
+ }
89
+
90
+ FXButton.new(button_frame, "", ICON_BTN_UP, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) {
91
+ @table.scrollUp() unless @table.nil?
92
+ }
93
+
94
+ FXButton.new(button_frame, "", ICON_BTN_DOWN, nil, 0, FRAME_RAISED|FRAME_THICK).connect(SEL_COMMAND) {
95
+ @table.scrollDown() unless @table.nil?
96
+ }
97
+
98
+ @info_txt = FXLabel.new( button_frame, "0/0", :opts => LAYOUT_RIGHT)
99
+
100
+ @tabBook.connect(SEL_LEFTBUTTONRELEASE){
101
+ x = getApp.activeWindow.x + self.x + self.parent.x + self.parent.parent.x + self.parent.parent.parent.x
102
+ y = getApp.activeWindow.y + self.y + self.parent.y + self.parent.parent.y + self.parent.parent.parent.y + self.parent.parent.parent.parent.y
103
+ FXMenuPane.new(self) do |menu_pane|
104
+ frame = FXVerticalFrame.new(menu_pane, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y)
105
+ 10.times do |i|
106
+ FXLabel.new(frame, "Label #{i}")
107
+ end
108
+ menu_pane.create
109
+ #menu_pane.popup(nil, x, y, 200, 200)
110
+ menu_pane.popup(nil, x, y)
111
+ app.runModalWhileShown(menu_pane)
112
+ puts "done!"
113
+ end
114
+ }
115
+ end
116
+
117
+ def subscribe(event, &callback)
118
+ (@event_dispatcher_listeners[event] ||= []) << callback
119
+ end
120
+
121
+ def filter_settings
122
+ doctype_filter = []
123
+ doctype_filter.concat(Watobo::Conf::Gui.fext_img) if @foption_nopix.checked?
124
+ doctype_filter.concat(Watobo::Conf::Gui.fext_docs) if @foption_nodocs.checked?
125
+ doctype_filter.concat(Watobo::Conf::Gui.fext_javascript) if @foption_nojs.checked?
126
+ doctype_filter.concat(Watobo::Conf::Gui.fext_style) if @foption_nocss.checked?
127
+
128
+ text = @text_filter.enabled? ? @text_filter.text : ""
129
+
130
+ fs = {
131
+ :show_scope_only => @table_option_scope.checked?,
132
+ :text => text,
133
+ :url => @foption_url.checked?,
134
+ :request => @foption_req.checked?,
135
+ :response => @foption_res.checked?,
136
+ :hide_tested => @table_option_hidetested_cb.checked?,
137
+ :doc_filter => doctype_filter,
138
+ :unique => @table_option_unique.checked?,
139
+ :ok_only => @table_option_ok_only.checked?,
140
+ :text_only => @table_option_text_only.checked?
141
+ }
142
+ fs
143
+ end
144
+
145
+ private
146
+
147
+ def update_info
148
+ if @table.respond_to? :num_total
149
+ @info_txt.text = "#{@table.num_visible}/#{@table.num_total}"
150
+ end
151
+ end
152
+
153
+ def clearEvents(event)
154
+ @event_dispatcher_listener[event].clear
155
+ end
156
+
157
+ def notify(event, *args)
158
+ if @event_dispatcher_listeners[event]
159
+ @event_dispatcher_listeners[event].each do |m|
160
+ m.call(*args) if m.respond_to? :call
161
+ end
162
+ end
163
+ end
164
+
165
+ def clear_text_filter
166
+ @text_filter.text = ''
167
+ apply_filter
168
+ end
169
+
170
+ def apply_filter
171
+ unless @table.nil?
172
+ getApp().beginWaitCursor do
173
+ @table.apply_filter(filter_settings)
174
+ update_info
175
+ end
176
+ end
177
+ end
178
+
179
+ def update_text_filter
180
+ if @foption_url.checked? or @foption_req.checked? or @foption_res.checked?
181
+ @text_filter.enable
182
+ else
183
+ @text_filter.disable
184
+ end
185
+ end
186
+
187
+ def filter_settings
188
+ doctype_filter = []
189
+ doctype_filter.concat(Watobo::Conf::Gui.fext_img) if @foption_nopix.checked?
190
+ doctype_filter.concat(Watobo::Conf::Gui.fext_docs) if @foption_nodocs.checked?
191
+ doctype_filter.concat(Watobo::Conf::Gui.fext_javascript) if @foption_nojs.checked?
192
+ doctype_filter.concat(Watobo::Conf::Gui.fext_style) if @foption_nocss.checked?
193
+
194
+ text = @text_filter.enabled? ? @text_filter.text : ""
195
+ unless text.empty?
196
+ begin
197
+ "test for valid regex".match(/#{text}/)
198
+ rescue => bang
199
+ text = Regexp.quote(@text_filter.text)
200
+ end
201
+ end
202
+
203
+ fs = {
204
+ :show_scope_only => @table_option_scope.checked?,
205
+ :text => text,
206
+ :url => @foption_url.checked?,
207
+ :request => @foption_req.checked?,
208
+ :response => @foption_res.checked?,
209
+ :hide_tested => @table_option_hidetested_cb.checked?,
210
+ :doc_filter => doctype_filter,
211
+ :unique => @table_option_unique.checked?
212
+ }
213
+ fs
214
+ end
215
+
216
+ end
217
+ end
230
218
  end
@@ -1,176 +1,164 @@
1
- # .
1
+ #.
2
2
  # conversation_table_ctrl2.rb
3
- #
4
- # Copyright 2013 by siberas, http://www.siberas.de
5
- #
6
- # This file is part of WATOBO (Web Application Tool Box)
7
- # http://watobo.sourceforge.com
8
- #
9
- # WATOBO is free software; you can redistribute it and/or modify
10
- # it under the terms of the GNU General Public License as published by
11
- # the Free Software Foundation version 2 of the License.
12
- #
13
- # WATOBO is distributed in the hope that it will be useful,
14
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- # GNU General Public License for more details.
17
- #
18
- # You should have received a copy of the GNU General Public License
19
- # along with WATOBO; if not, write to the Free Software
20
- # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
- # .
22
- # @private
23
- module Watobo#:nodoc: all
24
- module Gui
25
-
26
- # class ConversationFilterFrame < FXVerticalFrame
27
- class ConversationFilterDialog < FXDialogBox
28
-
29
- include Responder
30
-
31
-
32
- def filter_settings
33
- fs = {
34
- :scope_only => @table_option_scope.checked?,
35
- :hide_tested => @table_option_hidetested_cb.checked?,
36
- :unique => @table_option_unique.checked?
37
- }
38
-
39
- pattern = @text_filter.text
40
- unless pattern.empty?
41
- begin
42
- "test for valid regex".match(/#{pattern}/)
43
- rescue => bang
44
- pattern = Regexp.quote(@text_filter.text)
45
- end
46
-
47
-
48
- end
49
- fs[:url_pattern] = @foption_url.checked? ? pattern : ''
50
- fs[:request_pattern] = @foption_req.checked? ? pattern : ''
51
- fs[:response_pattern] = @foption_res.checked? ? pattern : ''
52
-
53
- mime_types = []
54
- mime_types << "html" if @mime_html.checked?
55
- mime_types << "css" if @mime_css.checked?
56
- mime_types << "flash" if @mime_flash.checked?
57
- mime_types << "script" if @mime_script.checked?
58
- mime_types << "xml" if @mime_xml.checked?
59
- fs[:mime_types] = mime_types
60
-
61
- status_codes = []
62
- status_codes << "^2" if @status_2.checked?
63
- status_codes << "^3" if @status_3.checked?
64
- status_codes << "^4" if @status_4.checked?
65
- status_codes << "^5" if @status_5.checked?
66
- fs[:status_codes] = status_codes
67
-
68
- hidden_extension_patterns = []
69
- hidden_extension_patterns.concat @hide_ex.text.split(",").map{|e| e.strip }
70
- # hidden_extension_patterns.concat @hide_images_ex.text.split(",").map{|e| e.strip } if @hide_images.checked?
71
- fs[:hidden_extension_patterns] = hidden_extension_patterns
72
- fs[:hidden_extensions] = @hide_ex_cb.checked?
73
-
74
- show_extension_patterns = []
75
- show_extension_patterns.concat @show_only_ex.text.split(",").map{|e| e.strip }
76
- fs[:show_extensions] = @show_extensions_cb.checked?
77
- fs[:show_extension_patterns] = show_extension_patterns
78
-
79
-
80
- fs
81
- end
82
-
83
-
84
- def initialize(owner, filter)
85
- super(owner, "Filter Settings", :opts => DECOR_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
86
-
87
- main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED )
88
- FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
89
- matrix = FXMatrix.new(main, 5, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
90
- f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
91
- generell_gb = FXGroupBox.new(f, "Generell", FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
92
- generell_frame = FXVerticalFrame.new(generell_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
93
- @table_option_unique = FXCheckButton.new(generell_frame, "unique chats", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
94
- state = filter.has_key?(:unique) ? filter[:unique] : false
95
- @table_option_unique.setCheck(state)
96
-
97
- @table_option_scope = FXCheckButton.new(generell_frame, "scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
98
-
99
- state = filter.has_key?(:scope_only) ? filter[:scope_only] : false
100
- @table_option_scope.setCheck(state)
3
+ #.
4
+ # Copyright 2014 by siberas, http://www.siberas.de
5
+ # This file is part of WATOBO (Web Application Tool Box) http://watobo.sourceforge.com
6
+ # WATOBO is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2 of the License.
7
+ # WATOBO is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
8
+ # You should have received a copy of the GNU General Public License along with WATOBO; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
101
9
 
102
- @table_option_hidetested_cb = FXCheckButton.new(generell_frame, "hide tested", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
103
- state = filter.has_key?(:hide_tested) ? filter[:hide_tested] : false
104
- @table_option_hidetested_cb.setCheck(state)
105
-
106
- f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
107
- mime_types_gb = FXGroupBox.new(f, "MIME Types", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
108
- mime_types_frame = FXVerticalFrame.new(mime_types_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
109
-
110
-
111
-
112
- @mime_html = FXCheckButton.new(mime_types_frame, "HTML", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
113
- state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("html") : false
114
- @mime_html.setCheck(state)
115
-
116
- @mime_css = FXCheckButton.new(mime_types_frame, "CSS", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
117
- state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("css") : false
118
- @mime_css.setCheck(state)
119
-
120
- @mime_xml = FXCheckButton.new(mime_types_frame, "XML", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
121
- state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("xml") : false
122
- @mime_xml.setCheck(state)
123
-
124
- @mime_script = FXCheckButton.new(mime_types_frame, "Script", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
125
- state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("script") : false
126
- @mime_script.setCheck(state)
127
-
128
- @mime_flash = FXCheckButton.new(mime_types_frame, "Flash", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
129
- state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("flash") : false
130
- @mime_flash.setCheck(state)
131
-
132
- f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
133
- status_codes_gb = FXGroupBox.new(f, "Status Codes", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
134
- status_codes_frame = FXVerticalFrame.new(status_codes_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
135
- @status_2 = FXCheckButton.new(status_codes_frame, "2xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
136
- state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^2") : false
137
- @status_2.setCheck(state)
138
-
139
- @status_3 = FXCheckButton.new(status_codes_frame, "3xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
140
- state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^3") : false
141
- @status_3.setCheck(state)
142
- @status_4 = FXCheckButton.new(status_codes_frame, "4xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
143
- state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^4") : false
144
- @status_4.setCheck(state)
145
- @status_5 = FXCheckButton.new(status_codes_frame, "5xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
146
- state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^5") : false
147
- @status_5.setCheck(state)
148
-
149
-
150
- f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
151
- extension_gb = FXGroupBox.new(f, "Extensions", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
152
- extension_frame = FXVerticalFrame.new(extension_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
153
- extension_matrix = FXMatrix.new(extension_frame, 2, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
154
- @show_extensions_cb = FXCheckButton.new(extension_matrix, "Show only: ", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
155
- state = filter.has_key?(:show_extensions) ? filter[:show_extensions] : false
156
- @show_extensions_cb.setCheck(state)
157
- @show_only_ex = FXTextField.new(extension_matrix, 25, nil, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
158
- @show_only_ex.text = filter.has_key?(:show_extension_patterns) ? filter[:show_extension_patterns].join(", ") : "jsp, php, asp, aspx"
159
-
160
- @hide_ex_cb = FXCheckButton.new(extension_matrix, "Hide: ", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
161
- state = filter.has_key?(:hidden_extensions) ? filter[:hidden_extensions] : false
162
- # @show_extensions_cb.setCheck(state)
163
- @hide_ex_cb.setCheck(state)
164
- f = FXVerticalFrame.new(extension_matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_SUNKEN, :padding => 0)
165
- @hide_ex = FXText.new(f, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
166
- @hide_ex.text = filter.has_key?(:hidden_extension_patterns) ? filter[:hidden_extension_patterns].join(", ") : "ppt, doc, xls, pptx, docx, xlsx, pdf, jpg, jpeg, ico, png, css, gif, js"
167
-
168
- # PATTERN
169
- f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
170
- pattern_gb = FXGroupBox.new(f, "Pattern", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
171
- pattern_frame = FXVerticalFrame.new(pattern_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
172
-
173
-
10
+ # @private
11
+ module Watobo#:nodoc: all
12
+ module Gui
13
+
14
+ # class ConversationFilterFrame < FXVerticalFrame
15
+ class ConversationFilterDialog < FXDialogBox
16
+
17
+ include Responder
18
+
19
+
20
+ def filter_settings
21
+ fs = {
22
+ :scope_only => @table_option_scope.checked?,
23
+ :hide_tested => @table_option_hidetested_cb.checked?,
24
+ :unique => @table_option_unique.checked?
25
+ }
26
+
27
+ pattern = @text_filter.text
28
+ unless pattern.empty?
29
+ begin
30
+ "test for valid regex".match(/#{pattern}/)
31
+ rescue => bang
32
+ pattern = Regexp.quote(@text_filter.text)
33
+ end
34
+
35
+
36
+ end
37
+ fs[:url_pattern] = @foption_url.checked? ? pattern : ''
38
+ fs[:request_pattern] = @foption_req.checked? ? pattern : ''
39
+ fs[:response_pattern] = @foption_res.checked? ? pattern : ''
40
+
41
+ mime_types = []
42
+ mime_types << "html" if @mime_html.checked?
43
+ mime_types << "css" if @mime_css.checked?
44
+ mime_types << "flash" if @mime_flash.checked?
45
+ mime_types << "script" if @mime_script.checked?
46
+ mime_types << "xml" if @mime_xml.checked?
47
+ fs[:mime_types] = mime_types
48
+
49
+ status_codes = []
50
+ status_codes << "^2" if @status_2.checked?
51
+ status_codes << "^3" if @status_3.checked?
52
+ status_codes << "^4" if @status_4.checked?
53
+ status_codes << "^5" if @status_5.checked?
54
+ fs[:status_codes] = status_codes
55
+
56
+ hidden_extension_patterns = []
57
+ hidden_extension_patterns.concat @hide_ex.text.split(",").map{|e| e.strip }
58
+ # hidden_extension_patterns.concat @hide_images_ex.text.split(",").map{|e| e.strip } if @hide_images.checked?
59
+ fs[:hidden_extension_patterns] = hidden_extension_patterns
60
+ fs[:hidden_extensions] = @hide_ex_cb.checked?
61
+
62
+ show_extension_patterns = []
63
+ show_extension_patterns.concat @show_only_ex.text.split(",").map{|e| e.strip }
64
+ fs[:show_extensions] = @show_extensions_cb.checked?
65
+ fs[:show_extension_patterns] = show_extension_patterns
66
+
67
+
68
+ fs
69
+ end
70
+
71
+
72
+ def initialize(owner, filter)
73
+ super(owner, "Filter Settings", :opts => DECOR_NONE|LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
74
+
75
+ main = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_RAISED )
76
+ FXMAPFUNC(SEL_COMMAND, ID_ACCEPT, :onAccept)
77
+ matrix = FXMatrix.new(main, 5, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
78
+ f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
79
+ generell_gb = FXGroupBox.new(f, "Generell", FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
80
+ generell_frame = FXVerticalFrame.new(generell_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
81
+ @table_option_unique = FXCheckButton.new(generell_frame, "unique chats", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
82
+ state = filter.has_key?(:unique) ? filter[:unique] : false
83
+ @table_option_unique.setCheck(state)
84
+
85
+ @table_option_scope = FXCheckButton.new(generell_frame, "scope only", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
86
+
87
+ state = filter.has_key?(:scope_only) ? filter[:scope_only] : false
88
+ @table_option_scope.setCheck(state)
89
+
90
+ @table_option_hidetested_cb = FXCheckButton.new(generell_frame, "hide tested", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
91
+ state = filter.has_key?(:hide_tested) ? filter[:hide_tested] : false
92
+ @table_option_hidetested_cb.setCheck(state)
93
+
94
+ f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
95
+ mime_types_gb = FXGroupBox.new(f, "MIME Types", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
96
+ mime_types_frame = FXVerticalFrame.new(mime_types_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
97
+
98
+
99
+
100
+ @mime_html = FXCheckButton.new(mime_types_frame, "HTML", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
101
+ state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("html") : false
102
+ @mime_html.setCheck(state)
103
+
104
+ @mime_css = FXCheckButton.new(mime_types_frame, "CSS", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
105
+ state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("css") : false
106
+ @mime_css.setCheck(state)
107
+
108
+ @mime_xml = FXCheckButton.new(mime_types_frame, "XML", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
109
+ state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("xml") : false
110
+ @mime_xml.setCheck(state)
111
+
112
+ @mime_script = FXCheckButton.new(mime_types_frame, "Script", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
113
+ state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("script") : false
114
+ @mime_script.setCheck(state)
115
+
116
+ @mime_flash = FXCheckButton.new(mime_types_frame, "Flash", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
117
+ state = filter.has_key?(:mime_types) ? filter[:mime_types].include?("flash") : false
118
+ @mime_flash.setCheck(state)
119
+
120
+ f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
121
+ status_codes_gb = FXGroupBox.new(f, "Status Codes", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
122
+ status_codes_frame = FXVerticalFrame.new(status_codes_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
123
+ @status_2 = FXCheckButton.new(status_codes_frame, "2xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
124
+ state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^2") : false
125
+ @status_2.setCheck(state)
126
+
127
+ @status_3 = FXCheckButton.new(status_codes_frame, "3xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
128
+ state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^3") : false
129
+ @status_3.setCheck(state)
130
+ @status_4 = FXCheckButton.new(status_codes_frame, "4xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
131
+ state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^4") : false
132
+ @status_4.setCheck(state)
133
+ @status_5 = FXCheckButton.new(status_codes_frame, "5xx", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
134
+ state = filter.has_key?(:status_codes) ? filter[:status_codes].include?("^5") : false
135
+ @status_5.setCheck(state)
136
+
137
+
138
+ f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
139
+ extension_gb = FXGroupBox.new(f, "Extensions", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
140
+ extension_frame = FXVerticalFrame.new(extension_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
141
+ extension_matrix = FXMatrix.new(extension_frame, 2, :opts => MATRIX_BY_COLUMNS|LAYOUT_FILL_X|LAYOUT_FILL_Y)
142
+ @show_extensions_cb = FXCheckButton.new(extension_matrix, "Show only: ", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
143
+ state = filter.has_key?(:show_extensions) ? filter[:show_extensions] : false
144
+ @show_extensions_cb.setCheck(state)
145
+ @show_only_ex = FXTextField.new(extension_matrix, 25, nil, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
146
+ @show_only_ex.text = filter.has_key?(:show_extension_patterns) ? filter[:show_extension_patterns].join(", ") : "jsp, php, asp, aspx"
147
+
148
+ @hide_ex_cb = FXCheckButton.new(extension_matrix, "Hide: ", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
149
+ state = filter.has_key?(:hidden_extensions) ? filter[:hidden_extensions] : false
150
+ # @show_extensions_cb.setCheck(state)
151
+ @hide_ex_cb.setCheck(state)
152
+ f = FXVerticalFrame.new(extension_matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|FRAME_THICK|FRAME_SUNKEN, :padding => 0)
153
+ @hide_ex = FXText.new(f, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_WORDWRAP)
154
+ @hide_ex.text = filter.has_key?(:hidden_extension_patterns) ? filter[:hidden_extension_patterns].join(", ") : "ppt, doc, xls, pptx, docx, xlsx, pdf, jpg, jpeg, ico, png, css, gif, js"
155
+
156
+ # PATTERN
157
+ f = FXVerticalFrame.new(matrix, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
158
+ pattern_gb = FXGroupBox.new(f, "Pattern", LAYOUT_SIDE_RIGHT|FRAME_GROOVE|LAYOUT_FILL_X|LAYOUT_FILL_Y, 0, 0, 0, 0)
159
+ pattern_frame = FXVerticalFrame.new(pattern_gb, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y, :padding => 0)
160
+
161
+
174
162
  @text_filter = FXTextField.new(pattern_frame, 40, nil, 0, FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X)
175
163
  @text_filter.setFocus()
176
164
  @text_filter.setDefault()
@@ -180,108 +168,108 @@ module Watobo#:nodoc: all
180
168
  @accept_btn.setDefault()
181
169
  # self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
182
170
  true
183
- }
184
-
185
- [ :url_pattern, :request_pattern, :response_pattern ].each do |k|
186
- if filter.has_key? k
187
- @text_filter.text = filter[k] unless filter[k].empty?
188
- end
189
- end
190
- # filterOptionsFrame =FXHorizontalFrame.new(fbox, LAYOUT_FILL_X)
191
- @foption_url = FXCheckButton.new(pattern_frame, "&URL", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
192
- state = ( filter.has_key?(:url_pattern) and not filter[:url_pattern].empty? )
193
- @foption_url.setCheck(state)
194
- # @foption_url.connect(SEL_COMMAND){ update_text_filter }
195
- @foption_req = FXCheckButton.new(pattern_frame, "Re&quest", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
196
- state = ( filter.has_key?(:request_pattern) and not filter[:request_pattern].empty? )
197
- @foption_req.setCheck state
198
- # @foption_req .connect(SEL_COMMAND){ update_text_filter }
199
- @foption_res = FXCheckButton.new(pattern_frame, "Res&ponse", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
200
- state = ( filter.has_key?(:response_pattern) and not filter[:response_pattern].empty? )
201
- @foption_res.setCheck state
202
- # @foption_res.connect(SEL_COMMAND){ update_text_filter }
203
-
204
- buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X)
205
- @accept_btn = FXButton.new(buttons, "&Apply", nil, self, ID_ACCEPT,
206
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
207
- @accept_btn.enable
208
- # Cancel
209
- FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
210
- FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
211
-
212
- end
213
-
214
- private
215
-
216
- def onAccept(sender, sel, item)
217
- getApp().stopModal(self, 1)
218
- self.hide()
219
- return 1
220
-
221
- end
222
- end
223
-
224
-
225
-
226
-
227
- class ConversationTableCtrl2 < FXVerticalFrame
228
-
229
- include Watobo::Constants
230
- include Watobo::Gui::Icons
231
-
232
- attr :filter
233
-
234
- def table=(table)
235
- @table = table
236
- # @table.subscribe(:table_changed) { update_info }
237
- end
238
-
239
- def update_text
171
+ }
172
+
173
+ [ :url_pattern, :request_pattern, :response_pattern ].each do |k|
174
+ if filter.has_key? k
175
+ @text_filter.text = filter[k] unless filter[k].empty?
176
+ end
177
+ end
178
+ # filterOptionsFrame =FXHorizontalFrame.new(fbox, LAYOUT_FILL_X)
179
+ @foption_url = FXCheckButton.new(pattern_frame, "&URL", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
180
+ state = ( filter.has_key?(:url_pattern) and not filter[:url_pattern].empty? )
181
+ @foption_url.setCheck(state)
182
+ # @foption_url.connect(SEL_COMMAND){ update_text_filter }
183
+ @foption_req = FXCheckButton.new(pattern_frame, "Re&quest", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
184
+ state = ( filter.has_key?(:request_pattern) and not filter[:request_pattern].empty? )
185
+ @foption_req.setCheck state
186
+ # @foption_req .connect(SEL_COMMAND){ update_text_filter }
187
+ @foption_res = FXCheckButton.new(pattern_frame, "Res&ponse", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
188
+ state = ( filter.has_key?(:response_pattern) and not filter[:response_pattern].empty? )
189
+ @foption_res.setCheck state
190
+ # @foption_res.connect(SEL_COMMAND){ update_text_filter }
191
+
192
+ buttons = FXHorizontalFrame.new(main, :opts => LAYOUT_FILL_X)
193
+ @accept_btn = FXButton.new(buttons, "&Apply", nil, self, ID_ACCEPT,
194
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
195
+ @accept_btn.enable
196
+ # Cancel
197
+ FXButton.new(buttons, "&Cancel", nil, self, ID_CANCEL,
198
+ FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT|LAYOUT_CENTER_Y)
199
+
200
+ end
201
+
202
+ private
203
+
204
+ def onAccept(sender, sel, item)
205
+ getApp().stopModal(self, 1)
206
+ self.hide()
207
+ return 1
208
+
209
+ end
210
+ end
211
+
212
+
213
+
214
+
215
+ class ConversationTableCtrl2 < FXVerticalFrame
216
+
217
+ include Watobo::Constants
218
+ include Watobo::Gui::Icons
219
+
220
+ attr :filter
221
+
222
+ def table=(table)
223
+ @table = table
224
+ # @table.subscribe(:table_changed) { update_info }
225
+ end
226
+
227
+ def update_text
240
228
  @filter_info.text = filter_text
241
229
  @filter_info.appendText " "
242
- @filter_info.appendStyledText("click to change", 1)
243
-
244
- end
245
-
246
- def text=(t)
230
+ @filter_info.appendStyledText("click to change", 1)
231
+
232
+ end
233
+
234
+ def text=(t)
247
235
  @filter_info.text = t
248
236
  @filter_info.appendText " "
249
- @filter_info.appendStyledText("click to change", 1)
250
- end
251
-
252
- def default_filter
253
- fs = {
254
- :scope_only => false ,
255
- :hide_tested => false,
256
- :unique => false
257
- }
258
-
259
- fs[:url_pattern] = ''
260
- fs[:request_pattern] = ''
261
- fs[:response_pattern] = ''
262
- fs[:mime_types] = []
263
- fs[:status_codes] = []
264
- fs[:hidden_extension_patterns] = %w( ppt doc xls pptx docx xlsx pdf jpg jpeg ico png css gif js)
265
- fs[:hidden_extensions] = true
266
- fs[:show_extensions] = false
267
- fs[:show_extension_patterns] = %w(jsp php asp aspx)
268
- fs
269
-
270
- end
271
-
272
- def initialize(owner, opts)
273
- super(owner, opts)
274
- @table = nil
275
- @filter = default_filter
276
-
277
- f = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|FRAME_RAISED )
278
-
279
- info_frame = FXHorizontalFrame.new(f, :opts => LAYOUT_FILL_X|FRAME_LINE )
280
- # @filter_info = FXButton.new(f,"Filter: ", :opts => LAYOUT_FILL_X|FRAME_LINE|FRAME_NORMAL|JUSTIFY_LEFT)
281
- @filter_info = FXText.new(info_frame, :opts => LAYOUT_FILL_X|TEXT_WORDWRAP )
282
- @filter_info.setFont(FXFont.new(getApp(), "helvetica", 9, FONTWEIGHT_BOLD, FONTENCODING_DEFAULT))
283
- @filter_info.backColor = @filter_info.parent.backColor
284
- @filter_info.editable = false
237
+ @filter_info.appendStyledText("click to change", 1)
238
+ end
239
+
240
+ def default_filter
241
+ fs = {
242
+ :scope_only => false ,
243
+ :hide_tested => false,
244
+ :unique => false
245
+ }
246
+
247
+ fs[:url_pattern] = ''
248
+ fs[:request_pattern] = ''
249
+ fs[:response_pattern] = ''
250
+ fs[:mime_types] = []
251
+ fs[:status_codes] = []
252
+ fs[:hidden_extension_patterns] = %w( ppt doc xls pptx docx xlsx pdf jpg jpeg ico png css gif js)
253
+ fs[:hidden_extensions] = true
254
+ fs[:show_extensions] = false
255
+ fs[:show_extension_patterns] = %w(jsp php asp aspx)
256
+ fs
257
+
258
+ end
259
+
260
+ def initialize(owner, opts)
261
+ super(owner, opts)
262
+ @table = nil
263
+ @filter = default_filter
264
+
265
+ f = FXHorizontalFrame.new(self, :opts => LAYOUT_FILL_X|FRAME_RAISED )
266
+
267
+ info_frame = FXHorizontalFrame.new(f, :opts => LAYOUT_FILL_X|FRAME_LINE )
268
+ # @filter_info = FXButton.new(f,"Filter: ", :opts => LAYOUT_FILL_X|FRAME_LINE|FRAME_NORMAL|JUSTIFY_LEFT)
269
+ @filter_info = FXText.new(info_frame, :opts => LAYOUT_FILL_X|TEXT_WORDWRAP )
270
+ @filter_info.setFont(FXFont.new(getApp(), "helvetica", 9, FONTWEIGHT_BOLD, FONTENCODING_DEFAULT))
271
+ @filter_info.backColor = @filter_info.parent.backColor
272
+ @filter_info.editable = false
285
273
  @filter_info.cursorColor = @filter_info.parent.backColor
286
274
  @filter_info.visibleRows = 2
287
275
  hs_green = FXHiliteStyle.new
@@ -297,16 +285,20 @@ module Watobo#:nodoc: all
297
285
  # Enable the style buffer for this text widget
298
286
  @filter_info.styled = true
299
287
  # Set the styles
300
- @filter_info.hiliteStyles = [ hs_green, hs_red]
301
-
288
+ @filter_info.hiliteStyles = [ hs_green, hs_red]
289
+
302
290
  # @filter_info.setText(filter_text)
303
- update_text
304
- # l = FXLabel.new(@filter_info, "Test")
291
+ update_text
292
+ # l = FXLabel.new(@filter_info, "Test")
305
293
 
306
- bframe = FXVerticalFrame.new(f, :opts => LAYOUT_FILL_Y, :padding => 0)
307
- @table_option_autoscroll = FXCheckButton.new(bframe, "autoscroll", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
294
+ bframe = FXVerticalFrame.new(f, :opts => LAYOUT_FILL_Y, :padding => 0)
295
+ @table_option_autoscroll = FXCheckButton.new(bframe, "autoscroll", nil, 0, ICON_BEFORE_TEXT|LAYOUT_SIDE_LEFT)
308
296
  @table_option_autoscroll.setCheck(true)
309
297
 
298
+ @table_option_autoscroll.connect(SEL_COMMAND){
299
+ @table.autoscroll = @table_option_autoscroll.checked?
300
+ }
301
+
310
302
  iframe = FXHorizontalFrame.new(bframe, :opts => LAYOUT_FILL_X, :padding => 0 )
311
303
 
312
304
  FXButton.new(iframe, "", ICON_BTN_DOWN, nil, 0, FRAME_RAISED|FRAME_THICK|LAYOUT_RIGHT).connect(SEL_COMMAND) {
@@ -319,122 +311,122 @@ module Watobo#:nodoc: all
319
311
 
320
312
 
321
313
 
322
-
323
-
324
-
325
-
326
-
327
-
328
- @filter_info.connect(SEL_LEFTBUTTONPRESS){
329
- filter = @table.nil? ? {} : @table.filter
330
- dlg = Watobo::Gui::ConversationFilterDialog.new(self, filter)
331
- if dlg.execute != 0
332
- #puts dlg.filter_settings.to_yaml
333
- @filter = dlg.filter_settings
334
-
335
- unless @table.nil?
336
- getApp().beginWaitCursor do
337
- @table.apply_filter(@filter)
338
- end
339
- end
340
- update_text
341
- end
342
- }
343
- =begin
344
- @filter_info.connect(SEL_COMMAND){
345
- @x = getApp.activeWindow.x + self.x + self.parent.x + self.parent.parent.x + self.parent.parent.parent.x + self.parent.parent.parent.parent.x
346
- @y = getApp.activeWindow.y + self.y + self.parent.y + self.parent.parent.y + self.parent.parent.parent.y + self.parent.parent.parent.parent.y
347
- @w = 200
348
- puts "open menu | #{@x}, #{@y}"
349
- FXMenuPane.new(self) do |menu_pane|
350
- #frame = ConversationFilterFrame.new(menu_pane, :opts => LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => @w, :height => 200)
351
- frame = ConversationFilterFrame.new(menu_pane, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_X)
352
-
353
-
354
- menu_pane.create
355
- #menu_pane.popup(nil, x, y, 200, 200)
356
- menu_pane.popup(nil, @x, @y)
357
- app.runModalWhileShown(menu_pane)
358
- puts "done!"
359
- puts frame.filter_settings.to_yaml
360
- end
361
- }
362
- =end
363
-
364
- end
365
-
366
- def subscribe(event, &callback)
367
- (@event_dispatcher_listeners[event] ||= []) << callback
368
- end
369
-
370
-
371
- private
372
-
373
- def filter_text
374
- text = ""
375
- text = "Show: "
376
- show_only = []
377
- show_only << "scope only" if @filter[:scope_only] == true
378
- show_only << "specific extensions" if @filter[:show_extensions] == true
379
- show_only << "URL pattern" unless @filter[:url_pattern].empty?
380
- show_only << "request pattern" unless @filter[:request_pattern].empty?
381
- show_only << "response pattern" unless @filter[:response_pattern].empty?
382
- show_only << "specific status codes" unless @filter[:status_codes].empty?
383
- show_only << "specific mime types" unless @filter[:mime_types].empty?
384
- text << show_only.join(", ")
385
- text << "All" if show_only.empty?
386
-
387
-
388
- text << " / Hide:"
389
- hide = []
390
- hide << "specific extensions" if @filter[:hidden_extensions] == true
391
- hide << "tested chats" if @filter[:hide_tested] == true
392
- text << hide.join(", ")
393
- text << "None" if hide.empty?
394
-
395
- unless @table.nil?
396
- text << "\n#{@table.numRows}/#{Watobo::Chats.length}"
397
- end
398
- text
399
- end
400
-
401
-
402
- def clearEvents(event)
403
- @event_dispatcher_listener[event].clear
404
- end
405
-
406
- def notify(event, *args)
407
- if @event_dispatcher_listeners[event]
408
- @event_dispatcher_listeners[event].each do |m|
409
- m.call(*args) if m.respond_to? :call
410
- end
411
- end
412
- end
413
-
414
- def clear_text_filter
415
- @text_filter.text = ''
416
- apply_filter
417
- end
418
-
419
- def apply_filter
420
- unless @table.nil?
421
- getApp().beginWaitCursor do
422
- @table.apply_filter(filter_settings)
423
- # update_info
424
- end
425
- end
426
- end
427
-
428
- def update_text_filter
429
- if @foption_url.checked? or @foption_req.checked? or @foption_res.checked?
430
- @text_filter.enable
431
- else
432
- @text_filter.disable
433
- end
434
- end
435
-
436
-
437
-
438
- end
439
- end
314
+
315
+
316
+
317
+
318
+
319
+
320
+ @filter_info.connect(SEL_LEFTBUTTONPRESS){
321
+ filter = @table.nil? ? {} : @table.filter
322
+ dlg = Watobo::Gui::ConversationFilterDialog.new(self, filter)
323
+ if dlg.execute != 0
324
+ #puts dlg.filter_settings.to_yaml
325
+ @filter = dlg.filter_settings
326
+
327
+ unless @table.nil?
328
+ getApp().beginWaitCursor do
329
+ @table.apply_filter(@filter)
330
+ end
331
+ end
332
+ update_text
333
+ end
334
+ }
335
+ =begin
336
+ @filter_info.connect(SEL_COMMAND){
337
+ @x = getApp.activeWindow.x + self.x + self.parent.x + self.parent.parent.x + self.parent.parent.parent.x + self.parent.parent.parent.parent.x
338
+ @y = getApp.activeWindow.y + self.y + self.parent.y + self.parent.parent.y + self.parent.parent.parent.y + self.parent.parent.parent.parent.y
339
+ @w = 200
340
+ puts "open menu | #{@x}, #{@y}"
341
+ FXMenuPane.new(self) do |menu_pane|
342
+ #frame = ConversationFilterFrame.new(menu_pane, :opts => LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => @w, :height => 200)
343
+ frame = ConversationFilterFrame.new(menu_pane, :opts => LAYOUT_FILL_Y|LAYOUT_FILL_X)
344
+
345
+
346
+ menu_pane.create
347
+ #menu_pane.popup(nil, x, y, 200, 200)
348
+ menu_pane.popup(nil, @x, @y)
349
+ app.runModalWhileShown(menu_pane)
350
+ puts "done!"
351
+ puts frame.filter_settings.to_yaml
352
+ end
353
+ }
354
+ =end
355
+
356
+ end
357
+
358
+ def subscribe(event, &callback)
359
+ (@event_dispatcher_listeners[event] ||= []) << callback
360
+ end
361
+
362
+
363
+ private
364
+
365
+ def filter_text
366
+ text = ""
367
+ text = "Show: "
368
+ show_only = []
369
+ show_only << "scope only" if @filter[:scope_only] == true
370
+ show_only << "specific extensions" if @filter[:show_extensions] == true
371
+ show_only << "URL pattern" unless @filter[:url_pattern].empty?
372
+ show_only << "request pattern" unless @filter[:request_pattern].empty?
373
+ show_only << "response pattern" unless @filter[:response_pattern].empty?
374
+ show_only << "specific status codes" unless @filter[:status_codes].empty?
375
+ show_only << "specific mime types" unless @filter[:mime_types].empty?
376
+ text << show_only.join(", ")
377
+ text << "All" if show_only.empty?
378
+
379
+
380
+ text << " / Hide:"
381
+ hide = []
382
+ hide << "specific extensions" if @filter[:hidden_extensions] == true
383
+ hide << "tested chats" if @filter[:hide_tested] == true
384
+ text << hide.join(", ")
385
+ text << "None" if hide.empty?
386
+
387
+ unless @table.nil?
388
+ text << "\n#{@table.numRows}/#{Watobo::Chats.length}"
389
+ end
390
+ text
391
+ end
392
+
393
+
394
+ def clearEvents(event)
395
+ @event_dispatcher_listener[event].clear
396
+ end
397
+
398
+ def notify(event, *args)
399
+ if @event_dispatcher_listeners[event]
400
+ @event_dispatcher_listeners[event].each do |m|
401
+ m.call(*args) if m.respond_to? :call
402
+ end
403
+ end
404
+ end
405
+
406
+ def clear_text_filter
407
+ @text_filter.text = ''
408
+ apply_filter
409
+ end
410
+
411
+ def apply_filter
412
+ unless @table.nil?
413
+ getApp().beginWaitCursor do
414
+ @table.apply_filter(filter_settings)
415
+ # update_info
416
+ end
417
+ end
418
+ end
419
+
420
+ def update_text_filter
421
+ if @foption_url.checked? or @foption_req.checked? or @foption_res.checked?
422
+ @text_filter.enable
423
+ else
424
+ @text_filter.disable
425
+ end
426
+ end
427
+
428
+
429
+
430
+ end
431
+ end
440
432
  end