watobo 0.9.21 → 0.9.23

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