rtml 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
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,91 @@
1
+ module Rtml
2
+ module Core
3
+ # Constructs a new TML Screen to be added to a document.
4
+ class Screen < Element
5
+ attr_accessor :id
6
+ include Rtml::Helpers::CoreHelpers::LayoutHelpers
7
+ include Rtml::Core::Screen::Iterators
8
+ include Rtml::Core::Screen::VariableMethods
9
+ include Rtml::Core::Screen::NextScreenMethods
10
+
11
+ # Initializes a new Screen object. An exception is raised if the given ID is longer than 12 characters.
12
+ def initialize(view = nil, id = nil, parent = nil, &blk)
13
+ raise "ID '#{id}' is too long by #{(id.to_s.length - 12)} characters" if id.to_s.length > 12
14
+ @id = id
15
+ super(view,id,nil,parent)
16
+ @css_class = nil
17
+ @content = nil
18
+ @on_cancel = nil
19
+ @on_menu = nil
20
+ @setvars = [ ]
21
+ @timeout = -1
22
+ @next = Core::Next.new
23
+ layout parent.layout if parent
24
+ protect_all_instance_variables!
25
+
26
+ assert
27
+ yield_with_optional_param self, &blk if block_given?
28
+ end
29
+
30
+ # Gets or sets the CSS class to use for this Screen
31
+ def css_class(*a)
32
+ with_first_argument(*a) { |arg| @css_class = arg }
33
+ @css_class
34
+ end
35
+
36
+ # If the specified conditions are true, sends the user to the target screen.
37
+ # If all assertions for this screen fail, an assertion error will be raised.
38
+ # If no target is given, or no conditions are given, the assertion will always fail.
39
+ def assert(target = nil, *conditions)
40
+ unless document.screens.screen_defined?(:assert) or self.id == :assert
41
+ document.screen :assert, :next => ((document.default_screen.blank?) ? url_for(:action => params[:action]) :
42
+ document.default_screen) do |scr|
43
+ scr.display <<-end_tml
44
+ <h1>Assertion Failure</h1>
45
+ on screen "<getvar name='oebr.prev_screen' />"<br/>
46
+ (Did you define a #next_screen?)
47
+ end_tml
48
+ end
49
+ end
50
+
51
+ next_screen((conditions.empty?) ? (target || :assert) : :assert)
52
+ next_screen target, *conditions unless target.nil? or conditions.length == 0
53
+ end
54
+
55
+ # Sets the timeout length, in seconds, before the user is forwarded to the Next screen.
56
+ # If set to -1, there is no timeout.
57
+ # If there are any links on the current screen, this will have no effect.
58
+ def timeout(*a)
59
+ with_first_argument(*a) { |arg| @timeout = arg }
60
+ @timeout
61
+ end
62
+
63
+ # Defines what screen to go to next if the user presses the "cancel" button on the terminal.
64
+ # If no parameter is specified, no change is made and the current value is returned.
65
+ def on_cancel(*a); on :cancel => a[0]; end
66
+
67
+ # Defines what screen to go to next if the user presses the "menu" button on the terminal.
68
+ # If no parameter is specified, no change is made and the current value is returned.
69
+ def on_menu(*a); on :menu => a[0]; end
70
+
71
+ # Constructs the TML representation of this Screen object.
72
+ def to_tml
73
+ rtml = render_widget_tml
74
+
75
+ c = properties.to_s
76
+ c.concat " timeout='#{@timeout}'" unless @timeout == -1
77
+ c.concat " class='#{@css_class}'" unless @css_class.blank?
78
+
79
+ nxt = @next.to_tml
80
+ nxt += "\n" unless nxt.blank?
81
+ svars = @setvars.join("\n")
82
+ svars += "\n" unless svars.blank?
83
+ content = svars + nxt + rtml
84
+
85
+ "<screen id='#{@id}'#{c}>\n" +
86
+ content.strip.indent + "\n" +
87
+ "</screen>"
88
+ end
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,63 @@
1
+ module Rtml::Core::Screen::Iterators
2
+ def each_hyperlink
3
+ # process hyperlinks
4
+ base = controller.url_for(:anchor => "", :only_path => true)
5
+ unless widgets.select { |c| c.kind_of? Rtml::Widgets::DisplayWidget }.empty?
6
+ rx = /href=["']([^"']*)['"]/
7
+ rx.each_match(self.to_tml) do |match|
8
+ # determine whether it's a screen name or an external link
9
+ s = document.screens.find(match[1])
10
+ y = (s ? s.id : match[1])
11
+ yield y
12
+ end
13
+ end
14
+ end
15
+
16
+ # Iterates through and yields each conditional variant associated with this screen.
17
+ # This does not include hyperlinks or event listeners.
18
+ def each_condition(&block)
19
+ self.next.each &block
20
+ end
21
+
22
+ # Returns a hash of every possible variant. Each value is the condition under which
23
+ # that path can be chosen, and its key is the ID or URL of the destination.
24
+ #
25
+ # If a block is given, it is passed each condition and destination before returning.
26
+ #
27
+ # There are two special keys, :hyperlink and :default, representing a destination that
28
+ # must be manually selected by the user and the default destination (if no other conditions
29
+ # are met), respectively. These are both Symbols. Any other key will be a String, so it
30
+ # is trivial to check these:
31
+ #
32
+ # @screen.every_possible_variant do |condition, destination|
33
+ # case condition
34
+ # when :hyperlink
35
+ # puts "found hyperlink: #{destination}"
36
+ # when :default
37
+ # puts "found default destination: #{destination}"
38
+ # else
39
+ # puts "When #{condition}, goto #{destination}"
40
+ # end
41
+ # end
42
+ #
43
+ def every_possible_variant
44
+ ret = ActiveSupport::OrderedHash.new
45
+ each_hyperlink do |href|
46
+ ret[href] = :hyperlink
47
+ yield :hyperlink, href if block_given?
48
+ end
49
+
50
+ @next.each do |condition, dest|
51
+ if condition.blank?
52
+ ret[dest] = :default
53
+ else
54
+ ret[dest] = condition
55
+ end
56
+ yield ret[dest], dest if block_given?
57
+ end
58
+
59
+ ret
60
+ end
61
+
62
+ alias each_possible_variant every_possible_variant
63
+ end
@@ -0,0 +1,70 @@
1
+ module Rtml::Core::Screen::NextScreenMethods
2
+ # Specifies the next screen for the user to visit. The options can specify conditions
3
+ # under which the screen will be visited. If next_screen is called twice with exactly
4
+ # the same options (or options that equate to the same value), an exception will be raised.
5
+ # Examples:
6
+ # screen.next_screen :address # Will go to :address if all other conditions fail
7
+ # screen.next_screen :zip, :if => "tmlvar:address != ''" # Will go to :zip if the address variable is not blank
8
+ # screen.next_screen :phone, :unless => "tmlvar:phone_required == 1" #Will go to :phone if phone_required != 1
9
+ # screen.next_screen :name, :key => :f1 # Will go to :name if the user presses F1
10
+ #
11
+ # The :if and :unless conditions can be specified as Strings, as in the example above,
12
+ # or as Arrays of Strings (["tmlvar:address", "!=", ""]). In either case, they must
13
+ # equate to three parameters -- a left operand, an operator, and a right operand.
14
+ #
15
+ # There is an alias for next_screen, "next", which can be used instead. However,
16
+ # "next" is also a Ruby keyword, so it may not be available depending on your context.
17
+ # (The "screen.next" format should be allowed, but simply calling "next" will result in an error.)
18
+ #
19
+ def next_screen(*args)#scrid, options = {})
20
+ if args.length > 0
21
+ scrid = args[0]
22
+ options = args[1] || {}
23
+ if scrid.kind_of? Hash
24
+ if options.empty?
25
+ options[:if] = scrid.delete :if
26
+ options[:unless] = scrid.delete :unless
27
+ options[:key] = scrid.delete :key
28
+ end
29
+ scrid = url_for scrid
30
+ end
31
+ @next.variant(scrid, options)
32
+ else
33
+ @next.for_variant({})
34
+ end
35
+ @next
36
+ end
37
+
38
+ alias next next_screen
39
+ alias goto next_screen
40
+
41
+ # Constructs a set of variants (conditional next_screen calls)
42
+ # Takes a hash of conditions => screen_names.
43
+ # For example:
44
+ #
45
+ # variants "tmlvar:scrid == 1" => :scr1,
46
+ # "tmlvar:scrid == 2" => :scr2
47
+ #
48
+ # Produces the same output as:
49
+ #
50
+ # next_screen :scr1, :if => "tmlvar:scrid == 1"
51
+ # next_screen :scr2, :if => "tmlvar:scrid == 2"
52
+ #
53
+ # You can also specify an Array for the conditions, in order
54
+ # to point more than one condition to the same screen.
55
+ def variants(hash)
56
+ hash.each do |cond,scr|
57
+ cond = [ cond ] unless cond.respond_to? :each
58
+ cond.each do |c|
59
+ next_screen scr, :if => c
60
+ end
61
+ end
62
+ end
63
+
64
+ def variants_for(scrid, hash)
65
+ next_screen scrid
66
+ variants hash
67
+ end
68
+
69
+ alias variant_for variants_for
70
+ end
@@ -0,0 +1,73 @@
1
+ module Rtml::Core::Screen::VariableMethods
2
+ # Returns an array of strings, containing the name of each variable used in this document
3
+ def variables_used
4
+ tml = self.to_tml
5
+ r = []
6
+ /setvar name=['"]([^'"]+)['"]/.each_match(tml) { |match| r << find_or_register_variable(match[1]).name }
7
+ /getvar name=['"]([^'"]+)['"]/.each_match(tml) { |match| r << find_or_register_variable(match[1]).name }
8
+ /input[^<>]*name=['"]([^'"]+)['"]/.each_match(tml) { |match| r << find_or_register_variable(match[1]).name }
9
+ /[lr]o=['"]tmlvar:([^'"]+)['"]/.each_match(tml) { |match| r << find_or_register_variable(match[1]).name }
10
+ r
11
+ end
12
+
13
+ # Returns true if the specified variable or variable name has been used by this screen.
14
+ def uses_variable?(var_or_name)
15
+ var = var_or_name
16
+ var = document.variables.find_by_name(var) if var.kind_of? Symbol or var.kind_of? String
17
+ tml = self.to_tml
18
+
19
+ return true if tml =~ /name=['"]#{Regexp::escape var.name}['"]/ or
20
+ tml =~ /input[^<>]*name=['"]([^'"]+)['"]/ or
21
+ tml =~ /[lr]o=['"]tmlvar:#{Regexp::escape var.name}['"]/
22
+ false
23
+ end
24
+
25
+ # Sets the specified variable to a given value. The value can be a single parameter,
26
+ # or can be a three-part assignment in the form of an Array, Hash or String.
27
+ # Examples:
28
+ # screen.set :i, [ "tmlvar:i", "+", "1" ]
29
+ # screen.set :i, "tmlvar:i"
30
+ # screen.set :i, :true
31
+ # screen.set :i, "tmlvar:i + 1"
32
+ # screen.set :i, :to => [ "tmlvar:i", "+", "1" ]
33
+ # screen.set :i, :to => "tmlvar:i + 1"
34
+ # screen.set :i, :to => true
35
+ # screen.set :i, :value => [ "tmlvar:i", "+", "1" ]
36
+ # screen.set :i, :value => "tmlvar:i + 1"
37
+ # screen.set :i, :value => "tmlvar:i"
38
+ # screen.set :name, 'Joe'
39
+ # screen.set :name, :to => "Joe"
40
+ # screen.set :name, :value => "Joe"
41
+ #
42
+ # screen.set :name => "Joe"
43
+ # screen.set :i => "tmlvar:i + 1"
44
+ # screen.set :i => [ "tmlvar:i", "+", "1" ]
45
+ #
46
+ # set_variable is an alias for the this method.
47
+ def set(*args)#varn, ops)
48
+ if args.length == 2
49
+ varn, ops = args
50
+ varn.each { |v| set v, ops } and return if varn.kind_of? Array
51
+ #varn = qualified_variable_name varn
52
+ var = find_or_register_variable(varn)
53
+ @setvars << var.setvar(ops)
54
+ else
55
+ args[0].each do |key,value|
56
+ set(key, value)
57
+ end
58
+ end
59
+ end
60
+ alias set_variable set
61
+
62
+ # Finds and returns the specified variable or variable name, registering it for use with the
63
+ # document if it is not found and creating it if it is not a Variable object.
64
+ def find_or_register_variable(var_or_name)
65
+ var_or_name = var_or_name.name if var_or_name.kind_of? Rtml::Core::Variable
66
+ var = document.variables.find_by_name(var_or_name)
67
+ if var.nil?
68
+ var = Rtml::Core::Variable.new(nil, { :name => var_or_name }, self)
69
+ document.register_variable var
70
+ end
71
+ var
72
+ end
73
+ end
@@ -0,0 +1,55 @@
1
+ class Rtml::Core::Support::Importer
2
+ # Looks up the specified path, converts it into an instance of ActionController::Base,
3
+ # and executes the action in the ActionController instance against the specified TML
4
+ # document. The net result is to "import" the action into this TML document.
5
+ def initialize(tml_document, path)
6
+ route = ActionController::Routing::Routes.recognize_path(path)
7
+ root = ((defined? RAILS_ROOT) ? RAILS_ROOT : File.join(File.dirname(__FILE__), '../../../../../../..'))
8
+ helpers_path = File.join(root, "app", "helpers", "#{route[:controller]}_tml_helpers")
9
+ helpers = [ 'common', route[:action] ]
10
+
11
+ for helper in helpers
12
+ path = File.join helpers_path, helper
13
+ tml_document.controller.class.tml_helper path
14
+ end
15
+
16
+ tml_document.controller.send :add_instance_view_paths, route[:action]
17
+ tml_document.controller.rtml_interface.fire_action route[:action], tml_document.controller
18
+
19
+ =begin
20
+ env = tml_document.controller.request.env.dup
21
+ %W(rack. action_controller.).each do |i|
22
+ env.keys.each do |key|
23
+ env.delete key if key =~ /#{Regexp.escape i}/
24
+ end
25
+ end
26
+ env['PATH_INFO'] = env['REQUEST_URI'] = env['REQUEST_PATH'] = path
27
+ request = ActionController::Request.new(env)
28
+ controller_class = "#{route[:controller].camelize}Controller".constantize.new
29
+ controller_class.process(request, ActionController::Response.new)
30
+ =end
31
+ #ActionController::Dispatcher.new.call(env)
32
+
33
+
34
+
35
+
36
+ #raise env.inspect.to_yaml
37
+
38
+ #raise tml_document.controller.request.env.inspect
39
+ #request = Rack::Request.new(env)
40
+ #ActionController::Routing::Routes.call(env)
41
+ #app = ActionController::Routing::Routes.recognize(request)
42
+ #app.call(env).to_a
43
+
44
+ # controller_class = "#{route[:controller].camelize}Controller".constantize.new
45
+ #ctrlr.send(:tml_document=, self)
46
+
47
+ #session = ActionController::Integration::Session.new
48
+ #session.get(path)
49
+ #session.controller
50
+
51
+ #action = route[:action]
52
+ #template = controller.send :default_template_name, action, format, ctrlr
53
+ #render options.merge(:file => template)
54
+ end
55
+ end
@@ -0,0 +1,318 @@
1
+ module Rtml
2
+ module Core
3
+ # TMLDocument is the root of all RTML generation.
4
+ # It is called with an ActionView as a parameter, but this parameter is supplied
5
+ # via the Rtml::tml_document helper. So instead of embedding TMLDocument.new(. . .) { . . . }
6
+ # into your application's view, you simply call tml_document { |doc| . . . }
7
+ # See the README for a complete usage example.
8
+ class TMLDocument < Element
9
+ include Rtml::Core::TMLDocument::VariableMethods
10
+ include Rtml::Core::TMLDocument::ScreenMethods
11
+ include Rtml::Helpers::CoreHelpers::LayoutHelpers
12
+
13
+ alias variable_declarations vardecs
14
+
15
+ # Initializes a new TML document with the given ActionView.
16
+ # Requires a block which configures the document and adds content.
17
+ def initialize(view = nil, &blk)
18
+ Rtml::Widgets::Widget.load_widgets
19
+ super(view)
20
+
21
+ reset!
22
+
23
+ def @screens.screen_defined?(a)
24
+ return true unless self.find(a).nil?
25
+ false
26
+ end
27
+
28
+ def @screens.find(id)
29
+ # FIXME: False positives are possible here, because it doesn't match against the controller or action.
30
+ if id.kind_of? String
31
+ if id =~ /#/
32
+ self.each { |scr| return scr if scr.id.to_s == id[$~.offset(0)[1]..-1] }
33
+ end
34
+ end
35
+ self.each { |scr| return scr if scr.id == id }
36
+ nil
37
+ end
38
+
39
+ def @variables.find_by_name(name)
40
+ name = name.to_s if name.kind_of? Symbol
41
+ # name = document.qualified_variable_name name
42
+ self.each { |var| return var if var.name == name }
43
+ nil
44
+ end
45
+
46
+ protect_all_instance_variables!
47
+ process_block &blk if block_given?
48
+ end
49
+
50
+ # Resets this document to an "unmodified" state. This will reverse ALL changes made to the document and
51
+ # cannot be undone!
52
+ def reset!
53
+ @tab_stop = 3
54
+ (@includes ||= []).clear
55
+ (@variables ||= []).clear
56
+ (@vardecs ||= []).clear
57
+ (@screens ||= []).clear
58
+ (@defaults ||= {}).clear
59
+ @layout = nil
60
+ @default_screen = nil
61
+ @cache = nil
62
+ @base = nil
63
+ widgets.clear
64
+
65
+ # order is important: creating the string "modifies" this document. Processing block is allowed to, though.
66
+ #self.string action_view.request_forgery_protection_token.to_s, :value => action_view.form_authenticity_token if action_view
67
+ @modified = false
68
+ end
69
+
70
+ # Sets the TML document to a "modified" state.
71
+ def modify!
72
+ @modified = true
73
+ end
74
+
75
+ # Returns true if the document has been modified.
76
+ def modified?
77
+ @modified
78
+ end
79
+
80
+ # Returns true if a screen with the specified ID is in this document.
81
+ def screen_defined?(a)
82
+ @screens.screen_defined? a
83
+ end
84
+
85
+ # Duplicates the screen with the first ID. The clone will be given the second ID.
86
+ def alias_screen(source, target)
87
+ scr = @screens.find(source).dup
88
+ scr.id = target
89
+ @screens << scr
90
+ scr
91
+ end
92
+
93
+ # Imports the specified TML document and applies everything in it to this document
94
+ # Valid options are:
95
+ # :super - imports the parent TML document (useful for only overriding a section of the parent document)
96
+ # [hash] - imports the TML document found at the path that the specified hash routes to when url_for is
97
+ # called
98
+ #
99
+ # Examples:
100
+ # <%=tml_document do
101
+ # import :super
102
+ # screen :main_menu, :next => :trans_abrt do
103
+ # display :partial => 'custom_menu_content'
104
+ # end
105
+ # end%>
106
+ #
107
+ # -or-
108
+ #
109
+ # <%=tml_document do
110
+ # import :controller => 'recipes', :action => 'list'
111
+ # . . .
112
+ # end%>
113
+ #
114
+ def import(p)
115
+ if p.kind_of? Hash then
116
+ # Hash could be render(options), or render(:file => url_for(options)) -- figure out which
117
+ # and act accordingly
118
+ options = { :locals => p.delete(:locals), :layout => p.delete(:layout) }
119
+ options.delete :locals if options[:locals].nil?
120
+ options.delete :layout if options[:layout].nil?
121
+ render_methods = ['file', 'partial', 'inline', 'text']
122
+ direct_render = (p.keys.select { |i| render_methods.include? i.to_s }).length > 0
123
+ if direct_render
124
+ render p.merge(options)
125
+ else
126
+ #format = controller.response.template.template_format
127
+ path = url_for(p.merge(:only_path => true))
128
+ Rtml::Core::Support::Importer.new(self, path)
129
+ end
130
+ else
131
+ case p
132
+ when :super then render :super
133
+ else raise "Import directive not recognized: #{p.inspect}"
134
+ end
135
+ end
136
+ end
137
+
138
+ # Generates the actual TML for this document. This is the root generation method
139
+ # to build all TML for this entire document, including the header, screens, submits,
140
+ # etc.
141
+ def to_tml
142
+ #TODO: We kind of need a before_render type of hook so that this sort of thing can be fired properly.
143
+ # force assert to the end of the list
144
+ assert_screen = @screens.find(:assert)
145
+ if assert_screen
146
+ @screens.delete assert_screen
147
+ @screens << assert_screen
148
+ end
149
+
150
+ rtml = render_widget_tml
151
+ on :error => url_for(:action => 'error') unless self[:on_error] or ENV['RAILS_ENV'] != 'production'
152
+ cache = nil
153
+ cache = 'deny' if @cache == false
154
+ cache = 'allow' if @cache
155
+ r = Rtml::Widgets::ElementBuilderWidget.new(self, nil) do |doc|
156
+ doc.drop_empty_attributes = true
157
+ doc.tml :xmlns => "http://www.ingenico.co.uk/tml", :cache => cache do |tml|
158
+ tml.build :head do |head|
159
+ head.concat includes.to_tml
160
+ head.build :base, :href => base unless base.blank?
161
+ build_defaults(head)
162
+ build_error_screen(head)
163
+ end
164
+ tml.concat @vardecs.collect { |i| i.to_s }.join("\n")
165
+ tml.build :name => :screen, :id => :__default do |scr|
166
+ scr.build :name => :next, :uri => default_screen.to_screen_ref
167
+ end unless default_screen.blank?
168
+ tml.concat @screens.to_tml
169
+ tml.concat rtml
170
+ end
171
+ end
172
+
173
+ r = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n#{r.to_s}".gsub(/\t/, ''.ljust(tab_stop))
174
+ r
175
+ end
176
+
177
+ def base(*a)
178
+ with_first_argument(*a) { |arg| @base = arg }
179
+ @base
180
+ end
181
+
182
+ # Sets or retrieves whether or not this document is allowed to be cached.
183
+ def cache(*a)
184
+ with_first_argument(*a) do |arg|
185
+ case arg
186
+ when false, 'false', 'deny', :false, :deny then @cache = false #"deny"
187
+ when '', nil then @cache = nil
188
+ else @cache = true#'allow'
189
+ end
190
+ end
191
+ @cache
192
+ end
193
+ alias allow_cache cache
194
+
195
+ # If a parameter is supplied, the tab stop for this document is set to the given
196
+ # value (which should be a number). Otherwise, the current value is returned.
197
+ # This alters the degree of indentation used when to_tml is called.
198
+ def tab_stop(*a)
199
+ with_first_argument(*a) { |arg| @tab_stop = arg.to_i }
200
+ @tab_stop
201
+ end
202
+
203
+ # Specifies a default screen for this document. In TML, the "default" screen is
204
+ # simply the first screen to be encountered within the file. This method ensures
205
+ # that no matter what order your screens appear in, the specified screen is where
206
+ # the user will start. If no parameters are given, the current default screen is
207
+ # returned and no changes will occur. Note that if this is not set, there will
208
+ # be no "default" screen, and the first screen added to the document within your
209
+ # code will be the end user's starting point.
210
+ def default_screen(*a)
211
+ with_first_argument(*a) { |arg| @default_screen = arg }
212
+ @default_screen
213
+ end
214
+
215
+ # Accepts a hash of options, containing :menu => 'some url' and/or :cancel => 'some url'.
216
+ # Both values are optional, but no other values may be specified. What this is saying
217
+ # is, if the user presses the "menu" button on their terminal and the screen they
218
+ # are viewing is not overriding this default, the user will be redirected to the
219
+ # :menu URL specified in this method. Similarly, if they press the "cancel" button
220
+ # on the terminal, they will be forwarded to the :cancel action. If they press the
221
+ # corresponding button but no action was supplied (you didn't call defaults or you
222
+ # called it with :cancel and they pressed "enter", or vice versa), then nothing happens.
223
+ def defaults(options)
224
+ on options
225
+ # options.each { |a,b| on a => b }
226
+ end
227
+
228
+ # As of 05/08/09, this method can be called with just a String for an argument. In this
229
+ # case, the method will attempt to get the :css or :tml option based on the filename.
230
+ #
231
+ # Directs the terminal to include the specified file while loading this application.
232
+ # The first parameter specifies either :css, :stylesheet, or :tml, which is the format
233
+ # of the file being included. (:css and :stylesheet are for convenience, and both mean the
234
+ # same thing.) The properties hash should include a :source URL to the file to be included.
235
+ # Or, you can call this method with only a single parameter, which must be a Hash.
236
+ # In this case, you must specify :type => (:css or :stylesheet or :tml).
237
+ #
238
+ # Examples:
239
+ # tmldoc.includes :css, :source => 'pretty.css'
240
+ # tmldoc.includes :source => 'pretty.css', :type => :stylesheet
241
+ # tmldoc.includes :tml, :source => 'error_screens.tml'
242
+ # tmldoc.includes :rtml, :source => 'error_screens.tml'
243
+ #
244
+ # Note that you can, of course, reference Rails actions in this same way:
245
+ # tmldoc.includes :tml, :source => 'errors/500'
246
+ # tmldoc.includes :rtml, :source => 'errors/500'
247
+ # tmldoc.includes :action => :errors, :id => 500
248
+ # tmldoc.includes :tml, :source => { :action => :errors, :id => 500 }
249
+ #
250
+ # Just be sure that the controller ("errors" in this case) is rendering TML...
251
+ #
252
+ # Also note that in all forms, if type is unspecified, it defaults to :tml.
253
+ def includes(type = nil, properties = { })
254
+ # TODO: This should probably be broken into several methods, maybe even its own class.
255
+ if type.kind_of? Hash
256
+ if properties.kind_of? Hash
257
+ properties.merge! type
258
+ else
259
+ properties = type
260
+ end
261
+ type = nil
262
+ end
263
+
264
+ properties = { :source => properties } if properties.kind_of? String
265
+ return @includes if type.nil? and properties.empty?
266
+ type = properties.delete :type if properties.key? :type and type.nil?
267
+ type = properties.delete :format if properties.key? :format and type.nil?
268
+ if properties.kind_of? Hash
269
+ if type.kind_of? String and not properties.key? :source
270
+ properties.merge!(:source => type)
271
+ type = nil
272
+ end
273
+ else
274
+ properties = { :source => properties } unless properties.kind_of? Hash
275
+ end
276
+
277
+ type = :css if type == :stylesheet
278
+ type = :tml if type == :rtml
279
+
280
+ # get source
281
+ source = ((properties.key? :source) ? properties[:source] : url_for(properties))
282
+ raise "Could not build source for include directive" if source.nil? or properties.blank?
283
+
284
+ # get type
285
+ if type.nil?
286
+ # try to infer type from source
287
+ %W(format=tml .tml type=tml format=rtml .rtml type=rtml /tml/).each { |f| type = :tml if source[f] }
288
+ %W(format=css .css stylesheets/ css/ type=css).each { |f| type = :css if source[f] }
289
+ raise "Could not infer type from source, specify :css or :tml in include directive" unless type
290
+ else
291
+ raise "Type must be one of [ :css, :stylesheet, :tml, :rtml ]" unless [:css, :tml].include? type
292
+ end
293
+ incl = Include.new(action_view, {:source=>source,:type=>type}, self)
294
+ @includes << incl
295
+ incl
296
+ end
297
+
298
+ def proc#:nodoc:
299
+ super
300
+ end
301
+
302
+
303
+ private
304
+ def build_defaults(head)
305
+ c = {}
306
+ c[:menu] = self[:on_menu] unless self[:on_menu].blank?
307
+ c[:cancel] = self[:on_cancel] unless self[:on_cancel].blank?
308
+ head.concat "<defaults #{c.to_s} />" unless c.empty?
309
+ end
310
+
311
+ def build_error_screen(head)
312
+ c = { }
313
+ c[:uri] = self[:on_error] unless self[:on_error].blank?
314
+ head.concat "<error #{c.to_s} />" unless c.empty?
315
+ end
316
+ end
317
+ end
318
+ end