rtml 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. data/History.txt +4 -0
  2. data/Manifest.txt +396 -0
  3. data/PostInstall.txt +2 -0
  4. data/README.rdoc +42 -0
  5. data/Rakefile +33 -0
  6. data/app_generators/rtml/USAGE +5 -0
  7. data/app_generators/rtml/rtml_generator.rb +78 -0
  8. data/app_generators/rtml/templates/rails_template.rb +36 -0
  9. data/app_generators/rtml/templates/rtml/MIT-LICENSE +20 -0
  10. data/app_generators/rtml/templates/rtml/README +109 -0
  11. data/app_generators/rtml/templates/rtml/Rakefile +38 -0
  12. data/app_generators/rtml/templates/rtml/app/controllers/beryl_controller.rb +70 -0
  13. data/app_generators/rtml/templates/rtml/app/controllers/rtml/magcard_demo_controller.rb +9 -0
  14. data/app_generators/rtml/templates/rtml/app/controllers/rtml/oe/btmlpa_controller.rb +158 -0
  15. data/app_generators/rtml/templates/rtml/app/controllers/rtml/rtml_app_controller.rb +252 -0
  16. data/app_generators/rtml/templates/rtml/app/controllers/rtml/tml_app_controller.rb +418 -0
  17. data/app_generators/rtml/templates/rtml/app/helpers/beryl_helper.rb +72 -0
  18. data/app_generators/rtml/templates/rtml/app/helpers/beryl_tml_helpers/auth_result.rb +56 -0
  19. data/app_generators/rtml/templates/rtml/app/helpers/beryl_tml_helpers/common.rb +19 -0
  20. data/app_generators/rtml/templates/rtml/app/helpers/beryl_tml_helpers/index.rb +82 -0
  21. data/app_generators/rtml/templates/rtml/app/helpers/rtml/magcard_demo_helper.rb +2 -0
  22. data/app_generators/rtml/templates/rtml/app/helpers/rtml/magcard_demo_tml_helpers/authorized.rb +10 -0
  23. data/app_generators/rtml/templates/rtml/app/helpers/rtml/magcard_demo_tml_helpers/common.rb +20 -0
  24. data/app_generators/rtml/templates/rtml/app/helpers/rtml/magcard_demo_tml_helpers/index.rb +33 -0
  25. data/app_generators/rtml/templates/rtml/app/helpers/rtml/oe/btmlpa_helper.rb +2 -0
  26. data/app_generators/rtml/templates/rtml/app/helpers/rtml/oe/btmlpa_tml_helpers/auth_result.rb +23 -0
  27. data/app_generators/rtml/templates/rtml/app/helpers/rtml/oe/btmlpa_tml_helpers/common.rb +23 -0
  28. data/app_generators/rtml/templates/rtml/app/helpers/rtml/oe/btmlpa_tml_helpers/dynamic.rb +11 -0
  29. data/app_generators/rtml/templates/rtml/app/helpers/rtml/oe/btmlpa_tml_helpers/icc.rb +384 -0
  30. data/app_generators/rtml/templates/rtml/app/helpers/rtml/oe/btmlpa_tml_helpers/index.rb +191 -0
  31. data/app_generators/rtml/templates/rtml/app/helpers/rtml/oe/btmlpa_tml_helpers/receipt.rb +152 -0
  32. data/app_generators/rtml/templates/rtml/app/helpers/rtml/rtml_app_helper.rb +74 -0
  33. data/app_generators/rtml/templates/rtml/app/helpers/rtml/rtml_app_tml_helpers/common.rb +9 -0
  34. data/app_generators/rtml/templates/rtml/app/helpers/rtml/tml_app_helper.rb +43 -0
  35. data/app_generators/rtml/templates/rtml/app/models/rtml/card.rb +83 -0
  36. data/app_generators/rtml/templates/rtml/app/models/rtml/card_avs.rb +14 -0
  37. data/app_generators/rtml/templates/rtml/app/models/rtml/card_cvv.rb +14 -0
  38. data/app_generators/rtml/templates/rtml/app/models/rtml/card_parser.rb +21 -0
  39. data/app_generators/rtml/templates/rtml/app/models/rtml/card_pin.rb +18 -0
  40. data/app_generators/rtml/templates/rtml/app/models/rtml/emv_card_data.rb +25 -0
  41. data/app_generators/rtml/templates/rtml/app/models/rtml/mag_card_data.rb +21 -0
  42. data/app_generators/rtml/templates/rtml/app/models/rtml/reference_code.rb +26 -0
  43. data/app_generators/rtml/templates/rtml/app/models/rtml/state.rb +12 -0
  44. data/app_generators/rtml/templates/rtml/app/models/rtml/terminal.rb +8 -0
  45. data/app_generators/rtml/templates/rtml/app/models/rtml/transaction.rb +68 -0
  46. data/app_generators/rtml/templates/rtml/app/views/beryl/auth_result/another_rcpt.rtml.erb +15 -0
  47. data/app_generators/rtml/templates/rtml/app/views/beryl/auth_result/receipt.rtml.erb +108 -0
  48. data/app_generators/rtml/templates/rtml/app/views/beryl/auth_result/receipt_single_column.rtml.erb +106 -0
  49. data/app_generators/rtml/templates/rtml/app/views/beryl/index/about.rtml.erb +8 -0
  50. data/app_generators/rtml/templates/rtml/app/views/beryl/index/admin.rtml.erb +4 -0
  51. data/app_generators/rtml/templates/rtml/app/views/beryl/index/construction.rtml.erb +10 -0
  52. data/app_generators/rtml/templates/rtml/app/views/beryl/index/idle.rtml.erb +13 -0
  53. data/app_generators/rtml/templates/rtml/app/views/beryl/index/main_menu.rtml.erb +12 -0
  54. data/app_generators/rtml/templates/rtml/app/views/beryl/index/menu_credit.rtml.erb +8 -0
  55. data/app_generators/rtml/templates/rtml/app/views/beryl/index/menu_debit.rtml.erb +3 -0
  56. data/app_generators/rtml/templates/rtml/app/views/layouts/rtml/beryl_color.rtml.erb +24 -0
  57. data/app_generators/rtml/templates/rtml/app/views/layouts/rtml/beryl_mono.rtml.erb +8 -0
  58. data/app_generators/rtml/templates/rtml/app/views/layouts/rtml/magcard_demo_color.rtml.erb +24 -0
  59. data/app_generators/rtml/templates/rtml/app/views/layouts/rtml/magcard_demo_mono.rtml.erb +3 -0
  60. data/app_generators/rtml/templates/rtml/app/views/layouts/rtml/oe/btmlpa_i5100.rtml.erb +3 -0
  61. data/app_generators/rtml/templates/rtml/app/views/layouts/rtml/oe/btmlpa_i8550.rtml.erb +17 -0
  62. data/app_generators/rtml/templates/rtml/app/views/layouts/rtml/uml.html.erb +11 -0
  63. data/app_generators/rtml/templates/rtml/app/views/rtml/magcard_demo/authorized.html.erb +15 -0
  64. data/app_generators/rtml/templates/rtml/app/views/rtml/magcard_demo/authorized/main.rtml.erb +5 -0
  65. data/app_generators/rtml/templates/rtml/app/views/rtml/magcard_demo/index.html.erb +15 -0
  66. data/app_generators/rtml/templates/rtml/app/views/rtml/magcard_demo/index/_error.rtml.erb +2 -0
  67. data/app_generators/rtml/templates/rtml/app/views/rtml/magcard_demo/index/enter_amount.rtml.erb +5 -0
  68. data/app_generators/rtml/templates/rtml/app/views/rtml/magcard_demo/index/main.rtml.erb +4 -0
  69. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/dynamic/response.rtml.erb +2 -0
  70. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/icc.rtml.erb +760 -0
  71. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_enter_amount.rtml.erb +4 -0
  72. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_about.rtml.erb +8 -0
  73. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_duplicate.rtml.erb +9 -0
  74. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_examples.rtml.erb +9 -0
  75. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_logo.rtml.erb +11 -0
  76. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_other.rtml.erb +20 -0
  77. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_refund.rtml.erb +8 -0
  78. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_reversal.rtml.erb +9 -0
  79. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_sale.rtml.erb +8 -0
  80. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/_menu_sale_cashback.rtml.erb +8 -0
  81. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/about.rtml.erb +1 -0
  82. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/assert.rtml.erb +2 -0
  83. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/card_nmb.rtml.erb +19 -0
  84. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/compl_txn.rtml.erb +1 -0
  85. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/confirm_rev.rtml.erb +3 -0
  86. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/duplicate_na.rtml.erb +1 -0
  87. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/error_scr.rtml.erb +4 -0
  88. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/main_menu.rtml.bak +31 -0
  89. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/main_menu.rtml.erb +40 -0
  90. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/print_pf.rtml.erb +1 -0
  91. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/rd_sale_disp.rtml.erb +1 -0
  92. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/read_refund.rtml.erb +1 -0
  93. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/read_scb.rtml.erb +10 -0
  94. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/reject_trans.rtml.erb +1 -0
  95. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/remove_card.rtml.erb +1 -0
  96. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/rev_bad.rtml.erb +1 -0
  97. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/scb_check_f.rtml.erb +2 -0
  98. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/sign_check.rtml.erb +3 -0
  99. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/subm_err.rtml.erb +2 -0
  100. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/to_man_entry.rtml.erb +2 -0
  101. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/trans_abrt.rtml.erb +1 -0
  102. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/index/void_trans.rtml.erb +1 -0
  103. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/receipt/_receipt.rtml.erb +29 -0
  104. data/app_generators/rtml/templates/rtml/app/views/rtml/oe/btmlpa/receipt/error_paper.rtml.erb +3 -0
  105. data/app_generators/rtml/templates/rtml/app/views/rtml/rtml_app/_default_development.html.erb +167 -0
  106. data/app_generators/rtml/templates/rtml/app/views/rtml/rtml_app/_default_header.html.erb +12 -0
  107. data/app_generators/rtml/templates/rtml/app/views/rtml/rtml_app/_default_production.html.erb +8 -0
  108. data/app_generators/rtml/templates/rtml/app/views/rtml/rtml_app/charts.html.erb +14 -0
  109. data/app_generators/rtml/templates/rtml/app/views/rtml/tml_app/do_tml_redirect.rtml.erb +7 -0
  110. data/app_generators/rtml/templates/rtml/app/views/rtml/tml_app/get_terminal_info.rtml.erb +26 -0
  111. data/app_generators/rtml/templates/rtml/app/views/rtml/tml_app/rescue_action_in_public.rtml.erb +9 -0
  112. data/app_generators/rtml/templates/rtml/app/views/rtml/tml_app/rescue_action_locally.rtml.erb +42 -0
  113. data/app_generators/rtml/templates/rtml/components/rtml/features/common.rb +303 -0
  114. data/app_generators/rtml/templates/rtml/components/rtml/features/force.rb +46 -0
  115. data/app_generators/rtml/templates/rtml/components/rtml/features/return.rb +22 -0
  116. data/app_generators/rtml/templates/rtml/components/rtml/features/sale.rb +49 -0
  117. data/app_generators/rtml/templates/rtml/components/rtml/features/views/_confirmation.rtml.erb +10 -0
  118. data/app_generators/rtml/templates/rtml/components/rtml/features/views/_receipt_agreement.rtml.erb +3 -0
  119. data/app_generators/rtml/templates/rtml/components/rtml/features/views/_receipt_footer.rtml.erb +2 -0
  120. data/app_generators/rtml/templates/rtml/components/rtml/features/views/_receipt_header.rtml.erb +4 -0
  121. data/app_generators/rtml/templates/rtml/components/rtml/features/views/ask_cashback.rtml.erb +11 -0
  122. data/app_generators/rtml/templates/rtml/components/rtml/features/views/card_imprint.rtml.erb +7 -0
  123. data/app_generators/rtml/templates/rtml/components/rtml/features/views/check_cb.rtml.erb +11 -0
  124. data/app_generators/rtml/templates/rtml/components/rtml/features/views/conf_debit.rtml.erb +5 -0
  125. data/app_generators/rtml/templates/rtml/components/rtml/features/views/confirm_sale.rtml.erb +4 -0
  126. data/app_generators/rtml/templates/rtml/components/rtml/features/views/confrm_force.rtml.erb +4 -0
  127. data/app_generators/rtml/templates/rtml/components/rtml/features/views/cvv_skipped.rtml.erb +10 -0
  128. data/app_generators/rtml/templates/rtml/components/rtml/features/views/disp_avs.rtml.erb +8 -0
  129. data/app_generators/rtml/templates/rtml/components/rtml/features/views/do_avs_zip.rtml.erb +8 -0
  130. data/app_generators/rtml/templates/rtml/components/rtml/features/views/enter_amount.rtml.erb +12 -0
  131. data/app_generators/rtml/templates/rtml/components/rtml/features/views/enter_card.rtml.erb +8 -0
  132. data/app_generators/rtml/templates/rtml/components/rtml/features/views/enter_cashbk.rtml.erb +10 -0
  133. data/app_generators/rtml/templates/rtml/components/rtml/features/views/enter_cvv2.rtml.erb +8 -0
  134. data/app_generators/rtml/templates/rtml/components/rtml/features/views/enter_expiry.rtml.erb +9 -0
  135. data/app_generators/rtml/templates/rtml/components/rtml/features/views/fraud_check1.rtml.erb +6 -0
  136. data/app_generators/rtml/templates/rtml/components/rtml/features/views/fraud_check2.rtml.erb +8 -0
  137. data/app_generators/rtml/templates/rtml/components/rtml/features/views/frc_aprvl.rtml.erb +8 -0
  138. data/app_generators/rtml/templates/rtml/components/rtml/features/views/frc_avs_zip.rtml.erb +8 -0
  139. data/app_generators/rtml/templates/rtml/components/rtml/features/views/frc_bad_aprv.rtml.erb +5 -0
  140. data/app_generators/rtml/templates/rtml/components/rtml/features/views/frd_chk_fail.rtml.erb +5 -0
  141. data/app_generators/rtml/templates/rtml/components/rtml/features/views/invalid_exp.rtml.erb +1 -0
  142. data/app_generators/rtml/templates/rtml/components/rtml/features/views/no_entr_crd.rtml.erb +1 -0
  143. data/app_generators/rtml/templates/rtml/components/rtml/features/views/remove_card.rtml.erb +1 -0
  144. data/app_generators/rtml/templates/rtml/components/rtml/features/views/swipe_card.rtml.erb +7 -0
  145. data/app_generators/rtml/templates/rtml/components/rtml/features/views/trans_abort.rtml.erb +1 -0
  146. data/app_generators/rtml/templates/rtml/components/rtml/features/views/trans_reject.rtml.erb +1 -0
  147. data/app_generators/rtml/templates/rtml/components/rtml/features/views/void_ref.rtml.erb +10 -0
  148. data/app_generators/rtml/templates/rtml/components/rtml/features/void.rb +30 -0
  149. data/app_generators/rtml/templates/rtml/components/rtml/widgets/card_parser_widget.rb +90 -0
  150. data/app_generators/rtml/templates/rtml/components/rtml/widgets/display_widget.rb +66 -0
  151. data/app_generators/rtml/templates/rtml/components/rtml/widgets/element_builder_widget.rb +123 -0
  152. data/app_generators/rtml/templates/rtml/components/rtml/widgets/emv_support_widget.rb +365 -0
  153. data/app_generators/rtml/templates/rtml/components/rtml/widgets/form_submit_widget.rb +65 -0
  154. data/app_generators/rtml/templates/rtml/components/rtml/widgets/get_transaction_variables_widget.rb +33 -0
  155. data/app_generators/rtml/templates/rtml/components/rtml/widgets/get_variable_widget.rb +39 -0
  156. data/app_generators/rtml/templates/rtml/components/rtml/widgets/receipt_widget.rb +66 -0
  157. data/app_generators/rtml/templates/rtml/components/rtml/widgets/screen_builder_widget.rb +49 -0
  158. data/app_generators/rtml/templates/rtml/db/migrate/20090825132217_create_rtml_states.rb +15 -0
  159. data/app_generators/rtml/templates/rtml/db/migrate/20090825132401_create_rtml_terminals.rb +16 -0
  160. data/app_generators/rtml/templates/rtml/db/migrate/20090825132530_create_rtml_transactions.rb +24 -0
  161. data/app_generators/rtml/templates/rtml/db/migrate/20090825134118_create_rtml_cards.rb +23 -0
  162. data/app_generators/rtml/templates/rtml/db/migrate/20090825134622_create_rtml_emv_card_data.rb +20 -0
  163. data/app_generators/rtml/templates/rtml/db/migrate/20090825134629_create_rtml_mag_card_data.rb +17 -0
  164. data/app_generators/rtml/templates/rtml/db/migrate/20090825135838_create_rtml_card_parsers.rb +19 -0
  165. data/app_generators/rtml/templates/rtml/db/migrate/20090826103509_create_reference_codes.rb +14 -0
  166. data/app_generators/rtml/templates/rtml/db/migrate/20090915030044_add_batch_to_rtml_transactions.rb +10 -0
  167. data/app_generators/rtml/templates/rtml/db/migrate/20090915031155_add_additional_data_to_rtml_transactions.rb +10 -0
  168. data/app_generators/rtml/templates/rtml/db/migrate/20090915031156_add_hidden_data_to_rtml_transactions.rb +10 -0
  169. data/app_generators/rtml/templates/rtml/db/migrate/20091016133313_create_rtml_card_avs.rb +16 -0
  170. data/app_generators/rtml/templates/rtml/db/migrate/20091016135800_create_rtml_card_cvvs.rb +16 -0
  171. data/app_generators/rtml/templates/rtml/db/migrate/20091016135810_create_rtml_card_pins.rb +16 -0
  172. data/app_generators/rtml/templates/rtml/db/migrate/20091016135820_reverse_card_transaction_relationship.rb +11 -0
  173. data/app_generators/rtml/templates/rtml/db/migrate/20100127115105_convert_rtml_migrations_to_rails_migrations.rb +31 -0
  174. data/app_generators/rtml/templates/rtml/generators/rtml_controller/USAGE +25 -0
  175. data/app_generators/rtml/templates/rtml/generators/rtml_controller/rtml_controller_generator.rb +49 -0
  176. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/common_tml_helper.rb +20 -0
  177. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/controller.rb +3 -0
  178. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/css_color.css +37 -0
  179. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/css_mono.css +12 -0
  180. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/functional_test.rb +11 -0
  181. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/helper.rb +2 -0
  182. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/layout_color.rtml.erb +24 -0
  183. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/layout_mono.rtml.erb +3 -0
  184. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/tml_helper.rb +16 -0
  185. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/view.html.erb +15 -0
  186. data/app_generators/rtml/templates/rtml/generators/rtml_controller/templates/view.rtml.erb +2 -0
  187. data/app_generators/rtml/templates/rtml/generators/rtml_document/USAGE +8 -0
  188. data/app_generators/rtml/templates/rtml/generators/rtml_document/rtml_document_generator.rb +45 -0
  189. data/app_generators/rtml/templates/rtml/generators/rtml_document/templates/controller.rb +7 -0
  190. data/app_generators/rtml/templates/rtml/generators/rtml_document/templates/functional_test.rb +10 -0
  191. data/app_generators/rtml/templates/rtml/generators/rtml_document/templates/helper.rb +2 -0
  192. data/app_generators/rtml/templates/rtml/generators/rtml_document/templates/view.rtml.erb +11 -0
  193. data/app_generators/rtml/templates/rtml/generators/rtml_widget/USAGE +8 -0
  194. data/app_generators/rtml/templates/rtml/generators/rtml_widget/rtml_widget_generator.rb +66 -0
  195. data/app_generators/rtml/templates/rtml/generators/rtml_widget/templates/basic_widget.rb +57 -0
  196. data/app_generators/rtml/templates/rtml/generators/rtml_widget/templates/basic_widget_no_help.rb +27 -0
  197. data/app_generators/rtml/templates/rtml/init.rb +40 -0
  198. data/app_generators/rtml/templates/rtml/install.rb +18 -0
  199. data/app_generators/rtml/templates/rtml/lib/environment.rb +61 -0
  200. data/app_generators/rtml/templates/rtml/lib/extensions/action_controller/request.rb +9 -0
  201. data/app_generators/rtml/templates/rtml/lib/extensions/action_controller/routing/route_set.rb +34 -0
  202. data/app_generators/rtml/templates/rtml/lib/extensions/action_view/base.rb +74 -0
  203. data/app_generators/rtml/templates/rtml/lib/extensions/action_view/partial_template.rb +24 -0
  204. data/app_generators/rtml/templates/rtml/lib/extensions/active_record.rb +13 -0
  205. data/app_generators/rtml/templates/rtml/lib/extensions/active_support/dependencies.rb +25 -0
  206. data/app_generators/rtml/templates/rtml/lib/extensions/array.rb +15 -0
  207. data/app_generators/rtml/templates/rtml/lib/extensions/attr_boolean.rb +10 -0
  208. data/app_generators/rtml/templates/rtml/lib/extensions/hash.rb +28 -0
  209. data/app_generators/rtml/templates/rtml/lib/extensions/nil_class.rb +20 -0
  210. data/app_generators/rtml/templates/rtml/lib/extensions/rake.rb +19 -0
  211. data/app_generators/rtml/templates/rtml/lib/extensions/regexp.rb +16 -0
  212. data/app_generators/rtml/templates/rtml/lib/extensions/string.rb +37 -0
  213. data/app_generators/rtml/templates/rtml/lib/other_plugins.rb +23 -0
  214. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/MIT-LICENSE +20 -0
  215. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/README +36 -0
  216. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/Rakefile +44 -0
  217. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/init.rb +25 -0
  218. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/lib/action_controller/filters/before_render_filter.rb +30 -0
  219. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/lib/before_render.rb +43 -0
  220. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/lib/before_render_instance.rb +45 -0
  221. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/lib/filter_chain_has_many_types_of_filters.rb +87 -0
  222. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/lib/filter_has_before_render.rb +26 -0
  223. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/tasks/before_render_tasks.rake +25 -0
  224. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/test/before_render_test.rb +29 -0
  225. data/app_generators/rtml/templates/rtml/lib/other_plugins/before_render/test/test_helper.rb +24 -0
  226. data/app_generators/rtml/templates/rtml/lib/rtml.rb +77 -0
  227. data/app_generators/rtml/templates/rtml/lib/rtml/beryl/constants.rb +12 -0
  228. data/app_generators/rtml/templates/rtml/lib/rtml/beryl/version.rb +11 -0
  229. data/app_generators/rtml/templates/rtml/lib/rtml/common/renderable.rb +13 -0
  230. data/app_generators/rtml/templates/rtml/lib/rtml/core/include.rb +30 -0
  231. data/app_generators/rtml/templates/rtml/lib/rtml/core/layout.rb +59 -0
  232. data/app_generators/rtml/templates/rtml/lib/rtml/core/next.rb +188 -0
  233. data/app_generators/rtml/templates/rtml/lib/rtml/core/screen.rb +91 -0
  234. data/app_generators/rtml/templates/rtml/lib/rtml/core/screen/iterators.rb +63 -0
  235. data/app_generators/rtml/templates/rtml/lib/rtml/core/screen/next_screen_methods.rb +70 -0
  236. data/app_generators/rtml/templates/rtml/lib/rtml/core/screen/variable_methods.rb +73 -0
  237. data/app_generators/rtml/templates/rtml/lib/rtml/core/support/importer.rb +55 -0
  238. data/app_generators/rtml/templates/rtml/lib/rtml/core/tml_document.rb +318 -0
  239. data/app_generators/rtml/templates/rtml/lib/rtml/core/tml_document/screen_methods.rb +79 -0
  240. data/app_generators/rtml/templates/rtml/lib/rtml/core/tml_document/variable_methods.rb +83 -0
  241. data/app_generators/rtml/templates/rtml/lib/rtml/core/variable.rb +123 -0
  242. data/app_generators/rtml/templates/rtml/lib/rtml/debug/browser_emulator.rb +59 -0
  243. data/app_generators/rtml/templates/rtml/lib/rtml/debug/rtml_controller_test_case.rb +7 -0
  244. data/app_generators/rtml/templates/rtml/lib/rtml/debug/rtml_core_unit_test.rb +11 -0
  245. data/app_generators/rtml/templates/rtml/lib/rtml/debug/unit_test.rb +3 -0
  246. data/app_generators/rtml/templates/rtml/lib/rtml/delegation.rb +8 -0
  247. data/app_generators/rtml/templates/rtml/lib/rtml/doc.rb +12 -0
  248. data/app_generators/rtml/templates/rtml/lib/rtml/element.rb +75 -0
  249. data/app_generators/rtml/templates/rtml/lib/rtml/errors/widget_accessor_failure.rb +9 -0
  250. data/app_generators/rtml/templates/rtml/lib/rtml/events/event_handler.rb +79 -0
  251. data/app_generators/rtml/templates/rtml/lib/rtml/events/event_processor.rb +106 -0
  252. data/app_generators/rtml/templates/rtml/lib/rtml/events/processors.rb +10 -0
  253. data/app_generators/rtml/templates/rtml/lib/rtml/events/processors/defaults_processor.rb +18 -0
  254. data/app_generators/rtml/templates/rtml/lib/rtml/events/processors/key_processor.rb +21 -0
  255. data/app_generators/rtml/templates/rtml/lib/rtml/feature.rb +32 -0
  256. data/app_generators/rtml/templates/rtml/lib/rtml/feature_config.rb +195 -0
  257. data/app_generators/rtml/templates/rtml/lib/rtml/features.rb +18 -0
  258. data/app_generators/rtml/templates/rtml/lib/rtml/features/array_of_feature_instances.rb +17 -0
  259. data/app_generators/rtml/templates/rtml/lib/rtml/features/controller_class_methods.rb +30 -0
  260. data/app_generators/rtml/templates/rtml/lib/rtml/features/controller_instance_methods.rb +35 -0
  261. data/app_generators/rtml/templates/rtml/lib/rtml/helpers.rb +21 -0
  262. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/controller_helpers.rb +59 -0
  263. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/controller_helpers/menu_helpers.rb +193 -0
  264. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/core_helpers/action_view_wrapper.rb +23 -0
  265. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/core_helpers/event_helpers.rb +28 -0
  266. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/core_helpers/layout_helpers.rb +47 -0
  267. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/core_helpers/widget_support.rb +181 -0
  268. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/core_helpers/widget_support/class_methods.rb +28 -0
  269. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/core_helpers/yield_helpers.rb +33 -0
  270. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/proxy_helpers/feature_helpers.rb +17 -0
  271. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/render_helper.rb +71 -0
  272. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/terminal_helpers.rb +21 -0
  273. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/test_helpers.rb +6 -0
  274. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/test_helpers/tml_validation_assertions.rb +10 -0
  275. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/test_helpers/variable_assertions.rb +27 -0
  276. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/view_helpers/form_helpers.rb +70 -0
  277. data/app_generators/rtml/templates/rtml/lib/rtml/helpers/view_helpers/rtml_form_builder.rb +174 -0
  278. data/app_generators/rtml/templates/rtml/lib/rtml/oe/btmlpa_constants.rb +48 -0
  279. data/app_generators/rtml/templates/rtml/lib/rtml/proxying/method_missing_methods.rb +14 -0
  280. data/app_generators/rtml/templates/rtml/lib/rtml/proxying/rtml_interface.rb +33 -0
  281. data/app_generators/rtml/templates/rtml/lib/rtml/proxying/sandbox.rb +18 -0
  282. data/app_generators/rtml/templates/rtml/lib/rtml/text_utils.rb +51 -0
  283. data/app_generators/rtml/templates/rtml/lib/rtml/tml_param_parser.rb +95 -0
  284. data/app_generators/rtml/templates/rtml/lib/rtml/validation/dom_rule_parser.rb +61 -0
  285. data/app_generators/rtml/templates/rtml/lib/rtml/validation/dom_tag.rb +52 -0
  286. data/app_generators/rtml/templates/rtml/lib/rtml/validation/predefined_variable_rule_parser.rb +97 -0
  287. data/app_generators/rtml/templates/rtml/lib/rtml/validation/tml_validator.rb +16 -0
  288. data/app_generators/rtml/templates/rtml/lib/rtml/version.rb +11 -0
  289. data/app_generators/rtml/templates/rtml/lib/rtml/widgets/property.rb +11 -0
  290. data/app_generators/rtml/templates/rtml/lib/rtml/widgets/property_accessors.rb +59 -0
  291. data/app_generators/rtml/templates/rtml/lib/rtml/widgets/widget.rb +251 -0
  292. data/app_generators/rtml/templates/rtml/lib/rtml/widgets/widget_class_methods.rb +213 -0
  293. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/dot.gif +0 -0
  294. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_can.gif +0 -0
  295. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_cand.gif +0 -0
  296. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_en.gif +0 -0
  297. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_end.gif +0 -0
  298. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_i.gif +0 -0
  299. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_icd.gif +0 -0
  300. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_icl.gif +0 -0
  301. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_icr.gif +0 -0
  302. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_ics.gif +0 -0
  303. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_icsw.gif +0 -0
  304. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_icv.gif +0 -0
  305. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_int.gif +0 -0
  306. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_int2.gif +0 -0
  307. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_men.gif +0 -0
  308. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_mend.gif +0 -0
  309. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_next.gif +0 -0
  310. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_no.gif +0 -0
  311. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_nod.gif +0 -0
  312. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_ok.gif +0 -0
  313. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_okd.gif +0 -0
  314. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_pic1.gif +0 -0
  315. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_pic2.gif +0 -0
  316. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_pic3.gif +0 -0
  317. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_pic4.gif +0 -0
  318. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_top.gif +0 -0
  319. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_txn.gif +0 -0
  320. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_yes.gif +0 -0
  321. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/btmlpa/nbg_yesd.gif +0 -0
  322. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/btmlpa.gif +0 -0
  323. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/can_dn.gif +0 -0
  324. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/can_up.gif +0 -0
  325. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/conf.gif +0 -0
  326. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/iccemv.gif +0 -0
  327. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/images.lib +0 -0
  328. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/magcard.gif +0 -0
  329. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/no_dn.gif +0 -0
  330. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/no_up.gif +0 -0
  331. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/ok_dn.gif +0 -0
  332. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/ok_up.gif +0 -0
  333. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/top.gif +0 -0
  334. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/yes_dn.gif +0 -0
  335. data/app_generators/rtml/templates/rtml/public/images/rtml/oe/examples/yes_up.gif +0 -0
  336. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/beryl_color.css +37 -0
  337. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/beryl_mono.css +17 -0
  338. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/charts.css +0 -0
  339. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/oe/btmlpa/i5100.css +12 -0
  340. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/oe/btmlpa/i8550.css +37 -0
  341. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/oe/btmlpa/receipt.css +4 -0
  342. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/oe/examples/i5100.css +12 -0
  343. data/app_generators/rtml/templates/rtml/public/stylesheets/rtml/oe/examples/i8550.css +37 -0
  344. data/app_generators/rtml/templates/rtml/reporting/110409 +227 -0
  345. data/app_generators/rtml/templates/rtml/reporting/linecount.rb +42 -0
  346. data/app_generators/rtml/templates/rtml/rules/predefined_tml_variables.rb +63 -0
  347. data/app_generators/rtml/templates/rtml/rules/tml_document_structure.rb +84 -0
  348. data/app_generators/rtml/templates/rtml/rules/varns/audio.rb +30 -0
  349. data/app_generators/rtml/templates/rtml/rules/varns/card.rb +17 -0
  350. data/app_generators/rtml/templates/rtml/rules/varns/card/emv.rb +31 -0
  351. data/app_generators/rtml/templates/rtml/rules/varns/card/mag.rb +8 -0
  352. data/app_generators/rtml/templates/rtml/rules/varns/card/parser.rb +7 -0
  353. data/app_generators/rtml/templates/rtml/rules/varns/card/pin.rb +6 -0
  354. data/app_generators/rtml/templates/rtml/rules/varns/cfgm.rb +15 -0
  355. data/app_generators/rtml/templates/rtml/rules/varns/com.rb +9 -0
  356. data/app_generators/rtml/templates/rtml/rules/varns/err.rb +14 -0
  357. data/app_generators/rtml/templates/rtml/rules/varns/gma/event.rb +13 -0
  358. data/app_generators/rtml/templates/rtml/rules/varns/gprs.rb +8 -0
  359. data/app_generators/rtml/templates/rtml/rules/varns/imager.rb +8 -0
  360. data/app_generators/rtml/templates/rtml/rules/varns/ip.rb +15 -0
  361. data/app_generators/rtml/templates/rtml/rules/varns/oebr.rb +42 -0
  362. data/app_generators/rtml/templates/rtml/rules/varns/oebr/3rdparty.rb +7 -0
  363. data/app_generators/rtml/templates/rtml/rules/varns/oebr/backlight.rb +4 -0
  364. data/app_generators/rtml/templates/rtml/rules/varns/oebr/cache.rb +1 -0
  365. data/app_generators/rtml/templates/rtml/rules/varns/oebr/connect.rb +5 -0
  366. data/app_generators/rtml/templates/rtml/rules/varns/oebr/connection.rb +5 -0
  367. data/app_generators/rtml/templates/rtml/rules/varns/oebr/offline.rb +5 -0
  368. data/app_generators/rtml/templates/rtml/rules/varns/oegw.rb +12 -0
  369. data/app_generators/rtml/templates/rtml/rules/varns/payment.rb +21 -0
  370. data/app_generators/rtml/templates/rtml/rules/varns/ppp.rb +11 -0
  371. data/app_generators/rtml/templates/rtml/rules/varns/terminal.rb +29 -0
  372. data/app_generators/rtml/templates/rtml/tasks/rtml_tasks.rake +78 -0
  373. data/app_generators/rtml/templates/rtml/template.rb +64 -0
  374. data/app_generators/rtml/templates/rtml/test/core/element_test.rb +17 -0
  375. data/app_generators/rtml/templates/rtml/test/core/screen_test.rb +91 -0
  376. data/app_generators/rtml/templates/rtml/test/core/tml_document_test.rb +53 -0
  377. data/app_generators/rtml/templates/rtml/test/functional/beryl_controller_test.rb +13 -0
  378. data/app_generators/rtml/templates/rtml/test/functional/btmlpa_controller_test.rb +13 -0
  379. data/app_generators/rtml/templates/rtml/test/functional/magcard_demo_controller_test.rb +20 -0
  380. data/app_generators/rtml/templates/rtml/test/functional/rtml_app_controller_test.rb +9 -0
  381. data/app_generators/rtml/templates/rtml/test/functional/rtml_routing_test.rb +19 -0
  382. data/app_generators/rtml/templates/rtml/test/functional/tml_controller_params_test.rb +20 -0
  383. data/app_generators/rtml/templates/rtml/test/rtml_test_helper.rb +44 -0
  384. data/app_generators/rtml/templates/rtml/test/validation/predefined_variable_rule_parser_test.rb +11 -0
  385. data/app_generators/rtml/templates/rtml/uninstall.rb +1 -0
  386. data/app_generators/rtml/templates/rtml/update.rb +57 -0
  387. data/bin/rtml +36 -0
  388. data/lib/rtml.rb +4 -0
  389. data/script/console +10 -0
  390. data/script/destroy +14 -0
  391. data/script/generate +14 -0
  392. data/tasks/reglob.rake +28 -0
  393. data/test/test_generator_helper.rb +29 -0
  394. data/test/test_helper.rb +3 -0
  395. data/test/test_rtml.rb +11 -0
  396. data/test/test_rtml_generator.rb +43 -0
  397. metadata +516 -0
@@ -0,0 +1,52 @@
1
+ class Rtml::Validation::DomTag
2
+ attr_accessor :name
3
+ attr_accessor :children
4
+ attr_accessor :child_order
5
+ attr_writer :root
6
+
7
+ def root?; @root end
8
+
9
+ def initialize(name)
10
+ @name = name.to_s
11
+ @children = []
12
+ @child_order = []
13
+ end
14
+
15
+ def validate(validator, ruleset, xml)
16
+ # note that validate does NOT validate *this* element -- only children!
17
+ tml_elements = xml/"/#{self.name}"
18
+ tml_elements.each do |element|
19
+ #validate that children specified are present
20
+ children.each do |set|
21
+ for chele in set[0]
22
+ chele = ruleset.tags.find_by_name(chele) if chele.kind_of? Symbol or chele.kind_of? String
23
+ options = set[1].reverse_merge(:minimum => 0)
24
+ found = chele.validate(validator, ruleset, element).length
25
+
26
+ validator.test_case.assert_operator found, ">=", options[:minimum],
27
+ "Found #{found} occurrances of #{chele.name}; expected to find at least #{options[:minimum]}"
28
+
29
+ if options[:maximum]
30
+ validator.test_case.assert_operator found, "<=", options[:maximum],
31
+ "Found #{found} occurrances of #{chele.name}; expected to find at most #{options[:maximum]}"
32
+ end
33
+ end
34
+ end
35
+
36
+ # validate that children not specified are not present
37
+ acceptable = children.collect { |c| c[0] }.flatten.collect do |c|
38
+ ((c.kind_of? Symbol or c.kind_of? String) ? ruleset.tags.find_by_name(c) : c)
39
+ end
40
+ forbidden = ruleset.tags - acceptable
41
+ forbidden.each do |tag|
42
+ count = (element/"/#{tag.name}").length
43
+ validator.test_case.assert_equal count, 0,
44
+ "Element #{tag.name} is not allowed to appear within parent #{element.name}"
45
+ end
46
+ end
47
+ end
48
+
49
+ def to_s
50
+ name
51
+ end
52
+ end
@@ -0,0 +1,97 @@
1
+ class Rtml::Validation::PredefinedVariableRuleParser
2
+ class VariableNamespace
3
+ VAR_INHERITABLE_OPTIONS = [ :type, :default, :values, :perms ]
4
+ attr_reader :children, :name
5
+ attr_accessor :filename, :fail_if_file_missing, :base_path, :parent_path
6
+ attr_writer *VAR_INHERITABLE_OPTIONS
7
+ attr_writer :desc
8
+ delegate :to_s, :to => :name
9
+
10
+ def initialize(name, options = {}, &block)
11
+ @name = name
12
+ @children = HashWithIndifferentAccess.new
13
+ @variables = []
14
+ @base_path = File.join(File.dirname(__FILE__), "../../../rules")
15
+ @parent_path = ""
16
+ @search_path = ""
17
+
18
+ options.each { |k,v| self.send("#{k}=", v) }
19
+ self.filename ||= @name
20
+ #self.search_path = File.join(search_path.to_s, filename.to_s)
21
+ process(options, &block)
22
+ end
23
+
24
+ def _vardcl(name, options = {})
25
+ options.reverse_merge!({:type => type, :default => default, :values => values, :perms => perms})
26
+ options[:name] = name
27
+ @variables << options
28
+ options
29
+ end
30
+
31
+ def to_a
32
+ (@variables + @children.collect { |i| i[1].to_a }).flatten.collect do |i|
33
+ r = i.dup
34
+ unless self.name.blank?
35
+ r[:name] = "#{self.name}.#{r[:name]}"
36
+ else
37
+ r[:name] = "#{r[:name]}"
38
+ end
39
+ r
40
+ end
41
+ end
42
+
43
+ def respond_to?(*a); super; end
44
+ def method_missing(name, *args, &block)
45
+ options = args.extract_options!
46
+ if args.length == 1
47
+ options[:desc] = args[0]
48
+ elsif args.length == 0
49
+ options[:desc] = name.to_s.titleize
50
+ else
51
+ raise "Invalid number of arguments: Expected 0 or 1"
52
+ end
53
+ _vardcl(name, options)
54
+ end
55
+
56
+ (VAR_INHERITABLE_OPTIONS + [:desc, :search_path]).each do |t|
57
+ attr_writer t
58
+ eval "def #{t}(a = nil); @#{t} = a if a; @#{t}; end", binding, __FILE__, __LINE__
59
+ end
60
+
61
+ def namespace(name, options = {}, &block)
62
+ name = name.to_s
63
+ o = { :base_path => base_path, :parent_path => File.join(parent_path, search_path, self.name.to_s) }
64
+ VAR_INHERITABLE_OPTIONS.each { |i| o[i] = self.send(i) }
65
+ if children[name]
66
+ children[name].process(options.merge(o), &block)
67
+ else
68
+ children[name] = VariableNamespace.new(name, options.merge(o), &block)
69
+ end
70
+ end
71
+
72
+ private
73
+ def process(options = {}, &block)
74
+ if filename
75
+ fn = File.join("", parent_path.to_s, search_path, "#{filename}.rb")
76
+ print "Searching for namespace: #{fn}... " if $DEBUG
77
+ if File.exist?(File.join(base_path, fn))
78
+ puts "Found!" if $DEBUG
79
+ eval File.read(File.join(base_path, fn)), binding, fn, 1
80
+ else
81
+ puts "not found." if $DEBUG
82
+ raise "File not found: #{fn}" if fail_if_file_missing
83
+ end
84
+ end
85
+
86
+ instance_eval &block if block_given?
87
+ end
88
+ end
89
+
90
+ def initialize(filename, &block)
91
+ @root_namespace = VariableNamespace.new(nil, :fail_if_file_missing => true, :filename => filename, &block)
92
+ end
93
+
94
+ def to_a
95
+ @root_namespace.to_a
96
+ end
97
+ end
@@ -0,0 +1,16 @@
1
+ class Rtml::Validation::TmlValidator
2
+ attr_reader :test_case
3
+
4
+ def initialize(tc, tml)
5
+ tc = tc.test_case if tc.respond_to? :test_case
6
+ @test_case = tc
7
+ @tml = tml
8
+ @parser = Rtml::Validation::DomRuleParser.new
9
+ @parser.parse! File.join(File.dirname(__FILE__), "../../../rules", "tml_document_structure.rb")
10
+ validate
11
+ end
12
+
13
+ def validate(root = nil)
14
+ @parser.validate(self, @tml, root)
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ require 'rtml/beryl/version'
2
+
3
+ module Rtml
4
+ module VERSION
5
+ MAJOR = 1
6
+ MINOR = 2
7
+ TINY = 2
8
+
9
+ STRING = [MAJOR, MINOR, TINY].join('.')
10
+ end
11
+ end
@@ -0,0 +1,11 @@
1
+ module Rtml::Widgets
2
+ # Defines a Property for a Widget. You should not have to instantiate this directly.
3
+ class Property
4
+ attr_accessor :value
5
+ attr_reader :name
6
+
7
+ def initialize(name)
8
+ @name = name
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,59 @@
1
+ module Rtml::Widgets::PropertyAccessors
2
+ # Ensures that all properties currently contain valid values.
3
+ # If a property has been declared to REQUIRE a value, and its
4
+ # current value is nil, an exception will be raised.
5
+ #
6
+ def validate_properties
7
+ properties.each do |name, prop|
8
+ raise "Value for property #{name.inspect} in Widget #{self.class.name} was not set" if prop.value == :required
9
+ end
10
+ 1
11
+ end
12
+
13
+ # Sets or gets the value of the specified property. If no arguments are specified, the
14
+ # current value is returned. Otherwise, the arguments are assigned and the new value is
15
+ # returned. If a block is given, it is passed into the callbacks for the property.
16
+ def access_property(prop_name, *args, &block)
17
+ if args.length == 0 and not block_given? then get_property_value prop_name
18
+ else set_property_value prop_name, args[0], &block
19
+ end
20
+ end
21
+
22
+ # Returns the current value for the specified property
23
+ def get_property_value(prop_name)
24
+ get_property(prop_name).value
25
+ end
26
+
27
+ # Sets the specified property to the given value. Block is passed into the callbacks, if any.
28
+ def set_property_value(prop_name, value, &block)
29
+ self.class.callbacks_for(prop_name).each { |c| value = self.send(c, value, &block) }
30
+ get_property(prop_name).value = value
31
+ end
32
+
33
+ # Returns the Property object with the given property name. This is the actual
34
+ # RTML Property object, not the value of the specified property.
35
+ def get_property(prop_name)
36
+ properties[prop_name] ||= Rtml::Widgets::Property.new(prop_name)
37
+ end
38
+
39
+ # An optional callback to be called immediately after initialization. Should be used
40
+ # to set up default values for properties.
41
+ #
42
+ # If a property is given the value :required, then an exception will be raised if no
43
+ # overriding value is set before to_tml is called.
44
+ #
45
+ # Example:
46
+ # property :first_name, :password
47
+ #
48
+ # def init_properties
49
+ # first_name "Joe"
50
+ # password :required
51
+ # end
52
+ #
53
+ def init_properties; end
54
+
55
+ # Returns the hash of properties for this Widget.
56
+ def properties
57
+ @properties ||= HashWithIndifferentAccess.new
58
+ end
59
+ end
@@ -0,0 +1,251 @@
1
+ require 'find'
2
+
3
+ module Rtml::Widgets
4
+ # All RTML Widgets should extend this class.
5
+ #
6
+ # The simplest definition of an RTML \Widget is "an object which generates raw TML code".
7
+ # Widgets are responsible for the vast majority of the heavy lifting in RTML, and are
8
+ # indispensable.
9
+ #
10
+ # It is important to realize that "core" RTML – that is, RTML without Widgets -- is entirely
11
+ # unable to accommodate an acceptable TML application. This is because "core" RTML consists
12
+ # of the TMLDocument object, which is responsible for creating the highest level only of the
13
+ # document object model, and the Screen object, which is responsible for creating the
14
+ # individual screens within that document. All other content -- such as displays, views,
15
+ # credit card parsers, and so forth -- is brought to you by Widgets.
16
+ #
17
+ # By default, you can create new Widgets in your lib/rtml/widgets directory. If you
18
+ # need to change this load path or add more directories to it, you can do so by modifying
19
+ # the Widget.load_paths array via your environment.rb file:
20
+ #
21
+ # Rtml::Widgets::Widget.load_paths << "lib/rtml/third_party/widgets"
22
+ #
23
+ # The simplest way to create a Widget is to use the command line generator:
24
+ #
25
+ # script/generate rtml_widget my_test
26
+ #
27
+ # This will create a Widget called MyTestWidget in the lib/rtml/widgets directory.
28
+ # By default, there will be lots of comments in this file to help you get started. If
29
+ # you wish to generate a Widget without the comments, disable them:
30
+ #
31
+ # script/generate rtml_widget my_test --no-help
32
+ #
33
+ # There are required components to your Widget. First, it <strong>must</code> list at least
34
+ # one Accessor. An Accessor is the class name of an object that is going to be allowed to
35
+ # make use of this Widget. For instance, if you want a user to be able to use your Widget
36
+ # from the TMLDocument object itself, you would say:
37
+ #
38
+ # accessor TMLDocument
39
+ #
40
+ # The usage of the MyTestWidget with a TML helper, then, would look like:
41
+ #
42
+ # Rtml::actions_for MyTestController do
43
+ # def index
44
+ # my_test { . . . }
45
+ # end
46
+ # end
47
+ #
48
+ # To make this Widget accessible to a Screen, you would specify Screen as the accessor.
49
+ # Then, usage would look like:
50
+ #
51
+ # Rtml::actions_for MyTestController do
52
+ # def index
53
+ # screen :index, :next => :next_scr do
54
+ # my_test { . . . }
55
+ # end
56
+ # end
57
+ # end
58
+ #
59
+ # You can also specify other Widgets as accessors directly. For instance, you could specify
60
+ # the Display Widget as an accessor to make this Widget available from within the Display
61
+ # builder. Likewise, you can specify the Widget class itself as an accessor, which would make
62
+ # your Widget accessible to <strong>all</code> other Widgets. This wouldn't include TMLDocument
63
+ # or Screen, however, because they are not Widgets. You can also specify multiple accessors:
64
+ #
65
+ # accessor Widget
66
+ # accessor TMLDocument, Screen
67
+ #
68
+ # This would, in effect, make this Widget accessible from any context whatsoever.
69
+ #
70
+ #
71
+ # The other required component of a Widget is a #to_tml method. This method most often returns
72
+ # a String, and if it does not, the value it does return will be converted to one. It can, for
73
+ # instance, return a reference to another Widget. Its #to_tml method would be called automatically,
74
+ # and then the String value of that would be substituted for the Widget itself. The #to_tml
75
+ # method is in charge of actually building the TML content of a document. Without this method,
76
+ # there is no content.
77
+ #
78
+ # See the rest of this page for information on the non-required elements of a Widget, or the
79
+ # RTML Wiki ( at http://wiki.rubytml.com ) for complete tutorials.
80
+ #
81
+ # Many of the methods available to a Widget are defined in WidgetSupport, so be sure to take a
82
+ # look at that class as well.
83
+ #
84
+ class Widget < Rtml::Element
85
+ include Rtml::Core
86
+ include Rtml::Helpers
87
+
88
+ include Rtml::Widgets::PropertyAccessors
89
+ extend Rtml::Widgets::WidgetClassMethods
90
+
91
+ # Provides access to the RTML object which this Widget was added to.
92
+ attr_reader :parent
93
+ attr_writer :layout
94
+
95
+ # The return value of the block given during initialization, or nil if no
96
+ # block was supplied.
97
+ attr_reader :block_value
98
+
99
+ # Provides access to the RTML Layout in use, if any. This will be assigned
100
+ # prior to render, but may not necessarily be assigned during initialization.
101
+ # If a screen Layout is applied to the entire document, it will be applied to this
102
+ # Widget.
103
+ #
104
+ # However, if this Widget resides within a Screen object and an explicit Layout
105
+ # is applied to that Screen, then this will override the TMLDocument Layout
106
+ # and be applied to this Widget instead. This sequence is behind-the-scenes
107
+ # and is not something the author of the Widget should ever have to think about.
108
+ #
109
+ # Regardless, it is up to the author of the Widget whether or not to take
110
+ # advantage of the supplied Layout.
111
+ #
112
+ # Note that any Widgets underneath this one will also inherit its Layout, so
113
+ # even if this particular Widget does not make use of a Layout, yielding to
114
+ # child Widgets may result in a Layout being rendered anyways. If this Widget
115
+ # is going to disallow layouts, it should also iterate through its children
116
+ # and clear their Layouts as well.
117
+ def layout
118
+ return @layout if @layout
119
+ return parent.layout if parent
120
+ return nil
121
+ end
122
+
123
+ # A Widget is initialized with a reference to its parent object (for instance, Screen)
124
+ # and a Hash of options. It is optionally constructed with a block which can also set these
125
+ # options. The constructor assigns the values specified in the options Hash and yields to
126
+ # the block (if given).
127
+ def initialize(parent, *arguments, &block)
128
+ super(nil, nil, nil, parent)
129
+ @arguments = arguments.dup
130
+ @options = arguments.extract_options!
131
+ @parent = parent
132
+ protect_all_instance_variables!
133
+ protected_instance_variables << "@block_value"
134
+ wrap_view(parent.action_view) if parent
135
+ if self.methods.include? 'init_properties'
136
+ if self.method(:init_properties).arity == 0 then self.init_properties
137
+ else self.init_properties(options.first)
138
+ end
139
+ end
140
+
141
+ if self.class.assign_properties?
142
+ (arguments + [@options]).each do |o|
143
+ if o.kind_of? Hash
144
+ o.each { |n,v| self.send("#{n}=", v) if self.respond_to? "#{n}=" }
145
+ end
146
+ end
147
+ end
148
+
149
+ self.send :after_initialize if self.respond_to? :after_initialize
150
+
151
+ @block_value = yield_with_optional_param self, &block if block_given?
152
+ end
153
+
154
+ # Returns the array of load paths to look for Widget definitions in.
155
+ # You can modify this array directly This is probably best done
156
+ # from config/environment.rb.
157
+ def Widget.load_paths
158
+ @@load_paths ||= [ File.join(RAILS_ROOT, "lib", "rtml", "widgets"),
159
+ File.join(PLUGIN_BASE, "components", "rtml", "widgets")]
160
+ end
161
+
162
+ def Widget.load_widgets(unused = __FILE__)#:nodoc:
163
+ default_widget_constants = Rtml::Widgets.constants
164
+ Widget.load_paths.each do |dir|
165
+ Dir.glob(File.join(dir, "**", "*.rb")) do |file|
166
+ require_dependency(file) unless file =~ /[\\\/]\.svn[\\\/]/
167
+ end
168
+ end
169
+ (Rtml::Widgets.constants - default_widget_constants).each do |konst|
170
+ klass = Rtml::Widgets.const_get(konst)
171
+ # When it's done, do this...
172
+ if klass.accessor_list.empty? and klass != self
173
+ raise "Error: Widget #{klass.name} is not accessible"
174
+ end
175
+ end
176
+ true
177
+ end
178
+
179
+ # Returns the ID for the current screen, or raises an error if it can't be found.
180
+ def current_screen_id
181
+ current_screen.id
182
+ end
183
+
184
+ def current_screen
185
+ ancestors.each { |p| return p if p.kind_of? Rtml::Core::Screen }
186
+ raise "Can't find any screen in parent hierarchy"
187
+ end
188
+
189
+ # Renders this Widget. This method should always be called instead
190
+ # of to_tml when dealing with Widgets, because it takes care of
191
+ # :before_render validation and ensures that a layout, if available,
192
+ # has been assigned. This method is also in charge of constructing
193
+ # the block which is passed to #to_tml.
194
+ #
195
+ # For content generation, this method takes 3 steps:
196
+ # 1. The current Widget's to_tml method is called with a block
197
+ # which, when yielded to, will call #render_widget_tml.
198
+ # 2. The return value of to_tml is tested for 3 conditions:
199
+ # a. If the returned object contains a #render_tml method,
200
+ # that method is called and this second return value will be
201
+ # returned as a String.
202
+ # b. If the #render_tml method does not exist but the #to_tml
203
+ # method does exist, it is called with no block and returned
204
+ # as a String.
205
+ # c. If neither of these two methods exist, the current value
206
+ # is returned as a String.
207
+ #
208
+ # In normal RTML generation, you should never have to directly reference
209
+ # this method; it is called internally, but is made available to you in
210
+ # case you need to circumvent the built-in functionality for some reason.
211
+ #
212
+ def render_tml
213
+ validate_properties
214
+ to_tml { render_widget_tml }.to_s.strip
215
+ end
216
+
217
+ # This method can be called in any way that Rtml::Helpers::WidgetSupport#content_of_view
218
+ # can be called. You should see that method for usage examples, because there are a lot
219
+ # of them. Arguments include a String, nil or no arguments, a Block, a Hash or another
220
+ # RTML argument.
221
+ #
222
+ # The #display method will call Rtml::Helpers::WidgetSupport#content_of_view on the
223
+ # input arguments and then call Widget#do_layout on the return value. The result
224
+ # is a set of content that has had the current layout, if any, applied to it.
225
+ # That content is then concatenated to the current element using the #concat
226
+ # method, which adds the content to the output buffer of this Widget. Finally,
227
+ # nil is returned. This is useful because there are some cases where a Widget's
228
+ # return value is concatenated to the element being generated. By returning nil,
229
+ # this method ensures that its content will not be added twice.
230
+ #
231
+ def display(*a, &b)
232
+ c = content_of_view(*a, &b).to_s
233
+ r = ((layout.nil? or layout == false) ? c : (layout.to_tml { c.indent })).to_s.indent
234
+ concat r
235
+ nil
236
+ end
237
+
238
+ # This method is in charge of producing the TML which will be sent to your Widget's parent
239
+ # object. Obviously, this return value must be a String. An exception will be raised if
240
+ # to_tml is referenced and is not overridden in your Widget.
241
+ def to_tml
242
+ raise "Implement method to_tml to return a String or Widget to be rendered in the TML document"
243
+ end
244
+
245
+ protected
246
+ # Returns the list of arguments this Widget was constructed with.
247
+ attr_reader :arguments
248
+ # Returns the options hash this Widget was constructed with.
249
+ attr_reader :options
250
+ end
251
+ end