card 1.16.1 → 1.16.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (372) hide show
  1. checksums.yaml +4 -4
  2. data/.yardoc/checksums +60 -0
  3. data/.yardoc/object_types +0 -0
  4. data/.yardoc/objects/root.dat +0 -0
  5. data/.yardoc/proxy_types +0 -0
  6. data/.yardopts +6 -0
  7. data/README_Developers.rdoc +100 -0
  8. data/VERSION +1 -1
  9. data/card.gemspec +18 -18
  10. data/db/migrate/20150724210803_add_comment_to_actions.rb +5 -0
  11. data/db/migrate_core_cards/20150724123438_update_file_and_image_cards.rb +70 -0
  12. data/db/migrate_core_cards/20150807205221_create_references_for_search_cards.rb +10 -0
  13. data/db/migrate_core_cards/data/1.12_stylesheets/common.scss +4 -2
  14. data/db/schema.rb +2 -1
  15. data/db/seed/new/card_actions.yml +2334 -12538
  16. data/db/seed/new/card_acts.yml +1 -1
  17. data/db/seed/new/card_changes.yml +7384 -38929
  18. data/db/seed/new/card_references.yml +207 -207
  19. data/db/seed/new/cards.yml +1364 -1440
  20. data/db/seed/test/fixtures/card_actions.yml +3285 -13219
  21. data/db/seed/test/fixtures/card_acts.yml +107 -107
  22. data/db/seed/test/fixtures/card_changes.yml +10830 -42375
  23. data/db/seed/test/fixtures/card_references.yml +393 -393
  24. data/db/seed/test/fixtures/cards.yml +1701 -1777
  25. data/db/version.txt +1 -1
  26. data/db/version_core_cards.txt +1 -1
  27. data/lib/card.rb +13 -3
  28. data/lib/card/chunk.rb +22 -15
  29. data/lib/card/content.rb +9 -8
  30. data/lib/card/diff.rb +79 -79
  31. data/lib/card/loader.rb +33 -33
  32. data/lib/card/name.rb +8 -0
  33. data/lib/card/set.rb +44 -17
  34. data/lib/card/set_pattern.rb +8 -0
  35. data/lib/cardio.rb +19 -3
  36. data/mod/01_core/chunk/link.rb +7 -6
  37. data/mod/01_core/chunk/query_reference.rb +65 -0
  38. data/mod/01_core/set/all/content.rb +1 -1
  39. data/mod/01_core/set/all/fetch.rb +15 -7
  40. data/mod/01_core/set/all/initialize.rb +4 -3
  41. data/mod/01_core/set/all/phases.rb +12 -8
  42. data/mod/01_core/set/all/references.rb +12 -6
  43. data/mod/01_core/set/all/rules.rb +14 -11
  44. data/mod/01_core/set/all/states.rb +2 -1
  45. data/mod/01_core/set/all/tracked_attributes.rb +14 -0
  46. data/mod/01_core/spec/set/all/collection_spec.rb +5 -5
  47. data/mod/01_core/spec/set/all/name_spec.rb +6 -6
  48. data/mod/01_history/lib/card/act.rb +2 -2
  49. data/mod/01_history/lib/card/action.rb +11 -2
  50. data/mod/01_history/set/all/actions.rb +4 -3
  51. data/mod/01_history/set/all/content_history.rb +1 -1
  52. data/mod/01_history/set/all/history.rb +55 -66
  53. data/mod/02_basic_types/set/all/file.rb +26 -3
  54. data/mod/02_basic_types/set/type/pointer.rb +13 -14
  55. data/mod/02_basic_types/spec/set/all/file_spec.rb +0 -1
  56. data/mod/03_machines/lib/card/machine.rb +4 -4
  57. data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +4 -17
  58. data/mod/03_machines/lib/stylesheets/style_cards.scss +5 -0
  59. data/mod/03_machines/set/right/machine_input.rb +3 -0
  60. data/mod/03_machines/set/right/machine_output.rb +4 -0
  61. data/mod/04_settings/lib/card/setting.rb +2 -1
  62. data/mod/04_settings/set/abstract/permission.rb +95 -0
  63. data/mod/04_settings/set/right/comment.rb +2 -90
  64. data/mod/04_settings/set/right/create.rb +2 -2
  65. data/mod/04_settings/set/right/delete.rb +2 -3
  66. data/mod/04_settings/set/right/read.rb +3 -2
  67. data/mod/04_settings/set/right/update.rb +3 -2
  68. data/mod/04_settings/set/self/recent_settings.rb +3 -0
  69. data/mod/04_settings/set/type/setting.rb +9 -1
  70. data/mod/05_email/set/all/notify.rb +2 -1
  71. data/mod/05_email/set/type/email_template.rb +17 -17
  72. data/mod/05_standard/file/credit_image/image-icon.png +0 -0
  73. data/mod/05_standard/file/credit_image/image-large.png +0 -0
  74. data/mod/05_standard/file/credit_image/image-medium.png +0 -0
  75. data/mod/05_standard/file/credit_image/image-original.png +0 -0
  76. data/mod/05_standard/file/credit_image/image-small.png +0 -0
  77. data/mod/05_standard/file/favicon/{icon-image.png → image-icon.png} +0 -0
  78. data/mod/05_standard/file/favicon/{large-image.png → image-large.png} +0 -0
  79. data/mod/05_standard/file/favicon/{medium-image.png → image-medium.png} +0 -0
  80. data/mod/05_standard/file/favicon/{original-image.png → image-original.png} +0 -0
  81. data/mod/05_standard/file/favicon/{small-image.png → image-small.png} +0 -0
  82. data/mod/05_standard/file/logo/{icon-image.png → image-icon.png} +0 -0
  83. data/mod/05_standard/file/logo/{large-image.png → image-large.png} +0 -0
  84. data/mod/05_standard/file/logo/{medium-image.png → image-medium.png} +0 -0
  85. data/mod/05_standard/file/logo/{original-image.png → image-original.png} +0 -0
  86. data/mod/05_standard/file/logo/{small-image.png → image-small.png} +0 -0
  87. data/mod/05_standard/lib/carrier_wave/cardmount.rb +79 -0
  88. data/mod/05_standard/lib/file_uploader.rb +127 -0
  89. data/mod/05_standard/lib/image_uploader.rb +35 -0
  90. data/mod/05_standard/set/abstract/attachment.rb +85 -0
  91. data/mod/05_standard/set/all/error.rb +1 -18
  92. data/mod/05_standard/set/all/event_viz.rb +17 -14
  93. data/mod/05_standard/set/all/rich_html/editing.rb +10 -10
  94. data/mod/05_standard/set/all/rich_html/toolbar.rb +44 -37
  95. data/mod/05_standard/set/right/account.rb +1 -1
  96. data/mod/05_standard/set/right/password.rb +9 -10
  97. data/mod/05_standard/set/self/recent.rb +1 -1
  98. data/mod/05_standard/set/type/file.rb +43 -31
  99. data/mod/05_standard/set/type/image.rb +22 -6
  100. data/mod/05_standard/set/type/search_type.rb +4 -2
  101. data/mod/05_standard/set/type/session.rb +7 -5
  102. data/mod/05_standard/set/type/set.rb +3 -1
  103. data/mod/05_standard/spec/set/all/history_spec.rb +1 -1
  104. data/mod/05_standard/spec/set/type/cardtype_spec.rb +3 -3
  105. data/mod/05_standard/spec/set/type/file_spec.rb +85 -1
  106. data/mod/05_standard/spec/set/type/image_spec.rb +89 -5
  107. data/mod/05_standard/spec/set/type/search_type_spec.rb +16 -1
  108. data/mod/06_bootstrap/file/{cerulean_skin/icon-image.png → cerulean_skin_image/image-icon.png} +0 -0
  109. data/mod/06_bootstrap/file/{cerulean_skin/large-image.png → cerulean_skin_image/image-large.png} +0 -0
  110. data/mod/06_bootstrap/file/{cerulean_skin/medium-image.png → cerulean_skin_image/image-medium.png} +0 -0
  111. data/mod/06_bootstrap/file/{cerulean_skin/original-image.png → cerulean_skin_image/image-original.png} +0 -0
  112. data/mod/06_bootstrap/file/{cerulean_skin/small-image.png → cerulean_skin_image/image-small.png} +0 -0
  113. data/mod/06_bootstrap/file/{cosmo_skin/icon-image.png → cosmo_skin_image/image-icon.png} +0 -0
  114. data/mod/06_bootstrap/file/{cosmo_skin/large-image.png → cosmo_skin_image/image-large.png} +0 -0
  115. data/mod/06_bootstrap/file/{cosmo_skin/medium-image.png → cosmo_skin_image/image-medium.png} +0 -0
  116. data/mod/06_bootstrap/file/{cosmo_skin/original-image.png → cosmo_skin_image/image-original.png} +0 -0
  117. data/mod/06_bootstrap/file/{cosmo_skin/small-image.png → cosmo_skin_image/image-small.png} +0 -0
  118. data/mod/06_bootstrap/file/{cyborg_skin/icon-image.png → cyborg_skin_image/image-icon.png} +0 -0
  119. data/mod/06_bootstrap/file/{cyborg_skin/large-image.png → cyborg_skin_image/image-large.png} +0 -0
  120. data/mod/06_bootstrap/file/{cyborg_skin/medium-image.png → cyborg_skin_image/image-medium.png} +0 -0
  121. data/mod/06_bootstrap/file/{cyborg_skin/original-image.png → cyborg_skin_image/image-original.png} +0 -0
  122. data/mod/06_bootstrap/file/{cyborg_skin/small-image.png → cyborg_skin_image/image-small.png} +0 -0
  123. data/mod/06_bootstrap/file/{darkly_skin/icon-image.png → darkly_skin_image/image-icon.png} +0 -0
  124. data/mod/06_bootstrap/file/{darkly_skin/large-image.png → darkly_skin_image/image-large.png} +0 -0
  125. data/mod/06_bootstrap/file/{darkly_skin/medium-image.png → darkly_skin_image/image-medium.png} +0 -0
  126. data/mod/06_bootstrap/file/{darkly_skin/original-image.png → darkly_skin_image/image-original.png} +0 -0
  127. data/mod/06_bootstrap/file/{darkly_skin/small-image.png → darkly_skin_image/image-small.png} +0 -0
  128. data/mod/06_bootstrap/file/{flatly_skin/icon-image.png → flatly_skin_image/image-icon.png} +0 -0
  129. data/mod/06_bootstrap/file/{flatly_skin/large-image.png → flatly_skin_image/image-large.png} +0 -0
  130. data/mod/06_bootstrap/file/{flatly_skin/medium-image.png → flatly_skin_image/image-medium.png} +0 -0
  131. data/mod/06_bootstrap/file/{flatly_skin/original-image.png → flatly_skin_image/image-original.png} +0 -0
  132. data/mod/06_bootstrap/file/{flatly_skin/small-image.png → flatly_skin_image/image-small.png} +0 -0
  133. data/mod/06_bootstrap/file/{journal_skin/icon-image.png → journal_skin_image/image-icon.png} +0 -0
  134. data/mod/06_bootstrap/file/{journal_skin/large-image.png → journal_skin_image/image-large.png} +0 -0
  135. data/mod/06_bootstrap/file/{journal_skin/medium-image.png → journal_skin_image/image-medium.png} +0 -0
  136. data/mod/06_bootstrap/file/{journal_skin/original-image.png → journal_skin_image/image-original.png} +0 -0
  137. data/mod/06_bootstrap/file/{journal_skin/small-image.png → journal_skin_image/image-small.png} +0 -0
  138. data/mod/06_bootstrap/file/{lumen_skin/icon-image.png → lumen_skin_image/image-icon.png} +0 -0
  139. data/mod/06_bootstrap/file/{lumen_skin/large-image.png → lumen_skin_image/image-large.png} +0 -0
  140. data/mod/06_bootstrap/file/{lumen_skin/medium-image.png → lumen_skin_image/image-medium.png} +0 -0
  141. data/mod/06_bootstrap/file/{lumen_skin/original-image.png → lumen_skin_image/image-original.png} +0 -0
  142. data/mod/06_bootstrap/file/{lumen_skin/small-image.png → lumen_skin_image/image-small.png} +0 -0
  143. data/mod/06_bootstrap/file/{paper_skin/icon-image.png → paper_skin_image/image-icon.png} +0 -0
  144. data/mod/06_bootstrap/file/{paper_skin/large-image.png → paper_skin_image/image-large.png} +0 -0
  145. data/mod/06_bootstrap/file/{paper_skin/medium-image.png → paper_skin_image/image-medium.png} +0 -0
  146. data/mod/06_bootstrap/file/{paper_skin/original-image.png → paper_skin_image/image-original.png} +0 -0
  147. data/mod/06_bootstrap/file/{paper_skin/small-image.png → paper_skin_image/image-small.png} +0 -0
  148. data/mod/06_bootstrap/file/{readable_skin/icon-image.png → readable_skin_image/image-icon.png} +0 -0
  149. data/mod/06_bootstrap/file/{readable_skin/large-image.png → readable_skin_image/image-large.png} +0 -0
  150. data/mod/06_bootstrap/file/{readable_skin/medium-image.png → readable_skin_image/image-medium.png} +0 -0
  151. data/mod/06_bootstrap/file/{readable_skin/original-image.png → readable_skin_image/image-original.png} +0 -0
  152. data/mod/06_bootstrap/file/{readable_skin/small-image.png → readable_skin_image/image-small.png} +0 -0
  153. data/mod/06_bootstrap/file/{sandstone_skin/icon-image.png → sandstone_skin_image/image-icon.png} +0 -0
  154. data/mod/06_bootstrap/file/{sandstone_skin/large-image.png → sandstone_skin_image/image-large.png} +0 -0
  155. data/mod/06_bootstrap/file/{sandstone_skin/medium-image.png → sandstone_skin_image/image-medium.png} +0 -0
  156. data/mod/06_bootstrap/file/{sandstone_skin/original-image.png → sandstone_skin_image/image-original.png} +0 -0
  157. data/mod/06_bootstrap/file/{sandstone_skin/small-image.png → sandstone_skin_image/image-small.png} +0 -0
  158. data/mod/06_bootstrap/file/{simplex_skin/icon-image.png → simplex_skin_image/image-icon.png} +0 -0
  159. data/mod/06_bootstrap/file/{simplex_skin/large-image.png → simplex_skin_image/image-large.png} +0 -0
  160. data/mod/06_bootstrap/file/{simplex_skin/medium-image.png → simplex_skin_image/image-medium.png} +0 -0
  161. data/mod/06_bootstrap/file/{simplex_skin/original-image.png → simplex_skin_image/image-original.png} +0 -0
  162. data/mod/06_bootstrap/file/{simplex_skin/small-image.png → simplex_skin_image/image-small.png} +0 -0
  163. data/mod/06_bootstrap/file/{slate_skin/icon-image.png → slate_skin_image/image-icon.png} +0 -0
  164. data/mod/06_bootstrap/file/{slate_skin/large-image.png → slate_skin_image/image-large.png} +0 -0
  165. data/mod/06_bootstrap/file/{slate_skin/medium-image.png → slate_skin_image/image-medium.png} +0 -0
  166. data/mod/06_bootstrap/file/{slate_skin/original-image.png → slate_skin_image/image-original.png} +0 -0
  167. data/mod/06_bootstrap/file/{slate_skin/small-image.png → slate_skin_image/image-small.png} +0 -0
  168. data/mod/06_bootstrap/file/{spacelab_skin/icon-image.png → spacelab_skin_image/image-icon.png} +0 -0
  169. data/mod/06_bootstrap/file/{spacelab_skin/large-image.png → spacelab_skin_image/image-large.png} +0 -0
  170. data/mod/06_bootstrap/file/{spacelab_skin/medium-image.png → spacelab_skin_image/image-medium.png} +0 -0
  171. data/mod/06_bootstrap/file/{spacelab_skin/original-image.png → spacelab_skin_image/image-original.png} +0 -0
  172. data/mod/06_bootstrap/file/{spacelab_skin/small-image.png → spacelab_skin_image/image-small.png} +0 -0
  173. data/mod/06_bootstrap/file/{superhero_skin/icon-image.png → superhero_skin_image/image-icon.png} +0 -0
  174. data/mod/06_bootstrap/file/{superhero_skin/large-image.png → superhero_skin_image/image-large.png} +0 -0
  175. data/mod/06_bootstrap/file/{superhero_skin/medium-image.png → superhero_skin_image/image-medium.png} +0 -0
  176. data/mod/06_bootstrap/file/{superhero_skin/original-image.png → superhero_skin_image/image-original.png} +0 -0
  177. data/mod/06_bootstrap/file/{superhero_skin/small-image.png → superhero_skin_image/image-small.png} +0 -0
  178. data/mod/06_bootstrap/file/{united_skin/icon-image.png → united_skin_image/image-icon.png} +0 -0
  179. data/mod/06_bootstrap/file/{united_skin/large-image.png → united_skin_image/image-large.png} +0 -0
  180. data/mod/06_bootstrap/file/{united_skin/medium-image.png → united_skin_image/image-medium.png} +0 -0
  181. data/mod/06_bootstrap/file/{united_skin/original-image.png → united_skin_image/image-original.png} +0 -0
  182. data/mod/06_bootstrap/file/{united_skin/small-image.png → united_skin_image/image-small.png} +0 -0
  183. data/mod/06_bootstrap/file/{yeti_skin/icon-image.png → yeti_skin_image/image-icon.png} +0 -0
  184. data/mod/06_bootstrap/file/{yeti_skin/large-image.png → yeti_skin_image/image-large.png} +0 -0
  185. data/mod/06_bootstrap/file/{yeti_skin/medium-image.png → yeti_skin_image/image-medium.png} +0 -0
  186. data/mod/06_bootstrap/file/{yeti_skin/original-image.png → yeti_skin_image/image-original.png} +0 -0
  187. data/mod/06_bootstrap/file/{yeti_skin/small-image.png → yeti_skin_image/image-small.png} +0 -0
  188. data/mod/06_bootstrap/lib/stylesheets/bootstrap_cards.scss +5 -3
  189. data/spec/lib/card/reference_spec.rb +8 -1
  190. data/tmpsets/README.md +2 -0
  191. data/tmpsets/set/mod001-01_core/all/active_card.rb +40 -0
  192. data/tmpsets/set/mod001-01_core/all/collection.rb +348 -0
  193. data/tmpsets/set/mod001-01_core/all/content.rb +68 -0
  194. data/tmpsets/set/mod001-01_core/all/erb.rb +17 -0
  195. data/tmpsets/set/mod001-01_core/all/fetch.rb +242 -0
  196. data/tmpsets/set/mod001-01_core/all/haml.rb +13 -0
  197. data/tmpsets/set/mod001-01_core/all/initialize.rb +56 -0
  198. data/tmpsets/set/mod001-01_core/all/name.rb +279 -0
  199. data/tmpsets/set/mod001-01_core/all/pattern.rb +62 -0
  200. data/tmpsets/set/mod001-01_core/all/permissions.rb +289 -0
  201. data/tmpsets/set/mod001-01_core/all/phases.rb +187 -0
  202. data/tmpsets/set/mod001-01_core/all/references.rb +130 -0
  203. data/tmpsets/set/mod001-01_core/all/rules.rb +324 -0
  204. data/tmpsets/set/mod001-01_core/all/states.rb +28 -0
  205. data/tmpsets/set/mod001-01_core/all/templating.rb +132 -0
  206. data/tmpsets/set/mod001-01_core/all/tracked_attributes.rb +136 -0
  207. data/tmpsets/set/mod001-01_core/all/trash.rb +56 -0
  208. data/tmpsets/set/mod001-01_core/all/type.rb +91 -0
  209. data/tmpsets/set/mod001-01_core/all/utils.rb +162 -0
  210. data/tmpsets/set/mod001-01_core/all/view_cache.rb +14 -0
  211. data/tmpsets/set/mod002-01_history/all/actions.rb +54 -0
  212. data/tmpsets/set/mod002-01_history/all/content_history.rb +140 -0
  213. data/tmpsets/set/mod002-01_history/all/history.rb +341 -0
  214. data/tmpsets/set/mod003-02_basic_types/all/all_css.rb +48 -0
  215. data/tmpsets/set/mod003-02_basic_types/all/all_csv.rb +58 -0
  216. data/tmpsets/set/mod003-02_basic_types/all/all_js.rb +13 -0
  217. data/tmpsets/set/mod003-02_basic_types/all/base.rb +128 -0
  218. data/tmpsets/set/mod003-02_basic_types/all/file.rb +42 -0
  219. data/tmpsets/set/mod003-02_basic_types/all/json.rb +72 -0
  220. data/tmpsets/set/mod003-02_basic_types/all/rss.rb +78 -0
  221. data/tmpsets/set/mod003-02_basic_types/all/text.rb +14 -0
  222. data/tmpsets/set/mod003-02_basic_types/type/html.rb +33 -0
  223. data/tmpsets/set/mod003-02_basic_types/type/plain_text.rb +16 -0
  224. data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +358 -0
  225. data/tmpsets/set/mod004-03_machines/right/machine_input.rb +8 -0
  226. data/tmpsets/set/mod004-03_machines/right/machine_output.rb +30 -0
  227. data/tmpsets/set/mod004-03_machines/self/script_ace.rb +18 -0
  228. data/tmpsets/set/mod004-03_machines/self/script_card_menu.rb +17 -0
  229. data/tmpsets/set/mod004-03_machines/self/script_html5shiv_printshiv.rb +8 -0
  230. data/tmpsets/set/mod004-03_machines/self/script_jquery.rb +8 -0
  231. data/tmpsets/set/mod004-03_machines/self/script_jquery_helper.rb +18 -0
  232. data/tmpsets/set/mod004-03_machines/self/script_slot.rb +13 -0
  233. data/tmpsets/set/mod004-03_machines/self/script_tinymce.rb +8 -0
  234. data/tmpsets/set/mod004-03_machines/self/style_bootstrap_compatible.rb +11 -0
  235. data/tmpsets/set/mod004-03_machines/self/style_cards.rb +12 -0
  236. data/tmpsets/set/mod004-03_machines/self/style_jquery_ui_smoothness.rb +9 -0
  237. data/tmpsets/set/mod004-03_machines/type/coffee_script.rb +67 -0
  238. data/tmpsets/set/mod004-03_machines/type/css.rb +55 -0
  239. data/tmpsets/set/mod004-03_machines/type/java_script.rb +43 -0
  240. data/tmpsets/set/mod004-03_machines/type/scss.rb +28 -0
  241. data/tmpsets/set/mod004-03_machines/type/skin.rb +18 -0
  242. data/tmpsets/set/mod005-04_settings/abstract/permission.rb +101 -0
  243. data/tmpsets/set/mod005-04_settings/right/add_help.rb +17 -0
  244. data/tmpsets/set/mod005-04_settings/right/comment.rb +9 -0
  245. data/tmpsets/set/mod005-04_settings/right/create.rb +9 -0
  246. data/tmpsets/set/mod005-04_settings/right/default.rb +9 -0
  247. data/tmpsets/set/mod005-04_settings/right/delete.rb +9 -0
  248. data/tmpsets/set/mod005-04_settings/right/help.rb +9 -0
  249. data/tmpsets/set/mod005-04_settings/right/read.rb +9 -0
  250. data/tmpsets/set/mod005-04_settings/right/script.rb +16 -0
  251. data/tmpsets/set/mod005-04_settings/right/structure.rb +16 -0
  252. data/tmpsets/set/mod005-04_settings/right/style.rb +16 -0
  253. data/tmpsets/set/mod005-04_settings/right/update.rb +9 -0
  254. data/tmpsets/set/mod005-04_settings/self/accountable.rb +9 -0
  255. data/tmpsets/set/mod005-04_settings/self/add_help.rb +8 -0
  256. data/tmpsets/set/mod005-04_settings/self/autoname.rb +8 -0
  257. data/tmpsets/set/mod005-04_settings/self/captcha.rb +8 -0
  258. data/tmpsets/set/mod005-04_settings/self/create.rb +8 -0
  259. data/tmpsets/set/mod005-04_settings/self/default.rb +8 -0
  260. data/tmpsets/set/mod005-04_settings/self/delete.rb +8 -0
  261. data/tmpsets/set/mod005-04_settings/self/help.rb +8 -0
  262. data/tmpsets/set/mod005-04_settings/self/input.rb +7 -0
  263. data/tmpsets/set/mod005-04_settings/self/layout.rb +8 -0
  264. data/tmpsets/set/mod005-04_settings/self/on_create.rb +8 -0
  265. data/tmpsets/set/mod005-04_settings/self/on_delete.rb +8 -0
  266. data/tmpsets/set/mod005-04_settings/self/on_update.rb +8 -0
  267. data/tmpsets/set/mod005-04_settings/self/options.rb +8 -0
  268. data/tmpsets/set/mod005-04_settings/self/options_label.rb +8 -0
  269. data/tmpsets/set/mod005-04_settings/self/read.rb +8 -0
  270. data/tmpsets/set/mod005-04_settings/self/recent_settings.rb +8 -0
  271. data/tmpsets/set/mod005-04_settings/self/script.rb +8 -0
  272. data/tmpsets/set/mod005-04_settings/self/structure.rb +8 -0
  273. data/tmpsets/set/mod005-04_settings/self/style.rb +8 -0
  274. data/tmpsets/set/mod005-04_settings/self/table_of_contents.rb +8 -0
  275. data/tmpsets/set/mod005-04_settings/self/thanks.rb +8 -0
  276. data/tmpsets/set/mod005-04_settings/self/update.rb +8 -0
  277. data/tmpsets/set/mod005-04_settings/type/setting.rb +96 -0
  278. data/tmpsets/set/mod006-05_email/all/email_html.rb +11 -0
  279. data/tmpsets/set/mod006-05_email/all/email_text.rb +11 -0
  280. data/tmpsets/set/mod006-05_email/all/follow.rb +260 -0
  281. data/tmpsets/set/mod006-05_email/all/notify.rb +244 -0
  282. data/tmpsets/set/mod006-05_email/all/observer.rb +33 -0
  283. data/tmpsets/set/mod006-05_email/right/bcc.rb +51 -0
  284. data/tmpsets/set/mod006-05_email/right/cc.rb +9 -0
  285. data/tmpsets/set/mod006-05_email/right/follow.rb +90 -0
  286. data/tmpsets/set/mod006-05_email/right/follow_fields.rb +8 -0
  287. data/tmpsets/set/mod006-05_email/right/followers.rb +35 -0
  288. data/tmpsets/set/mod006-05_email/right/following.rb +58 -0
  289. data/tmpsets/set/mod006-05_email/right/from.rb +9 -0
  290. data/tmpsets/set/mod006-05_email/right/html_message.rb +9 -0
  291. data/tmpsets/set/mod006-05_email/right/to.rb +9 -0
  292. data/tmpsets/set/mod006-05_email/self/always.rb +20 -0
  293. data/tmpsets/set/mod006-05_email/self/created.rb +27 -0
  294. data/tmpsets/set/mod006-05_email/self/edited.rb +30 -0
  295. data/tmpsets/set/mod006-05_email/self/follow.rb +8 -0
  296. data/tmpsets/set/mod006-05_email/self/follow_defaults.rb +71 -0
  297. data/tmpsets/set/mod006-05_email/self/never.rb +21 -0
  298. data/tmpsets/set/mod006-05_email/type/email_template.rb +119 -0
  299. data/tmpsets/set/mod006-05_email/type_plus_right/user/follow.rb +182 -0
  300. data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +91 -0
  301. data/tmpsets/set/mod007-05_standard/all/account.rb +73 -0
  302. data/tmpsets/set/mod007-05_standard/all/comment.rb +45 -0
  303. data/tmpsets/set/mod007-05_standard/all/error.rb +198 -0
  304. data/tmpsets/set/mod007-05_standard/all/event_viz.rb +75 -0
  305. data/tmpsets/set/mod007-05_standard/all/links.rb +153 -0
  306. data/tmpsets/set/mod007-05_standard/all/rich_html/content.rb +248 -0
  307. data/tmpsets/set/mod007-05_standard/all/rich_html/editing.rb +216 -0
  308. data/tmpsets/set/mod007-05_standard/all/rich_html/form.rb +238 -0
  309. data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +80 -0
  310. data/tmpsets/set/mod007-05_standard/all/rich_html/menu.rb +135 -0
  311. data/tmpsets/set/mod007-05_standard/all/rich_html/modal.rb +98 -0
  312. data/tmpsets/set/mod007-05_standard/all/rich_html/toolbar.rb +271 -0
  313. data/tmpsets/set/mod007-05_standard/all/rich_html/wrapper.rb +158 -0
  314. data/tmpsets/set/mod007-05_standard/right/account.rb +187 -0
  315. data/tmpsets/set/mod007-05_standard/right/discussion.rb +9 -0
  316. data/tmpsets/set/mod007-05_standard/right/email.rb +57 -0
  317. data/tmpsets/set/mod007-05_standard/right/password.rb +44 -0
  318. data/tmpsets/set/mod007-05_standard/right/salt.rb +11 -0
  319. data/tmpsets/set/mod007-05_standard/right/stats.rb +41 -0
  320. data/tmpsets/set/mod007-05_standard/right/status.rb +15 -0
  321. data/tmpsets/set/mod007-05_standard/right/token.rb +11 -0
  322. data/tmpsets/set/mod007-05_standard/right/when_created.rb +11 -0
  323. data/tmpsets/set/mod007-05_standard/right/when_last_edited.rb +11 -0
  324. data/tmpsets/set/mod007-05_standard/rstar/rules.rb +411 -0
  325. data/tmpsets/set/mod007-05_standard/self/account_links.rb +55 -0
  326. data/tmpsets/set/mod007-05_standard/self/alerts.rb +11 -0
  327. data/tmpsets/set/mod007-05_standard/self/all.rb +28 -0
  328. data/tmpsets/set/mod007-05_standard/self/foot.rb +14 -0
  329. data/tmpsets/set/mod007-05_standard/self/head.rb +126 -0
  330. data/tmpsets/set/mod007-05_standard/self/navbox.rb +39 -0
  331. data/tmpsets/set/mod007-05_standard/self/now.rb +12 -0
  332. data/tmpsets/set/mod007-05_standard/self/performance_log.rb +98 -0
  333. data/tmpsets/set/mod007-05_standard/self/recent.rb +54 -0
  334. data/tmpsets/set/mod007-05_standard/self/search.rb +49 -0
  335. data/tmpsets/set/mod007-05_standard/self/signin.rb +130 -0
  336. data/tmpsets/set/mod007-05_standard/self/stats.rb +109 -0
  337. data/tmpsets/set/mod007-05_standard/self/version.rb +15 -0
  338. data/tmpsets/set/mod007-05_standard/type/basic.rb +52 -0
  339. data/tmpsets/set/mod007-05_standard/type/cardtype.rb +78 -0
  340. data/tmpsets/set/mod007-05_standard/type/date.rb +14 -0
  341. data/tmpsets/set/mod007-05_standard/type/file.rb +103 -0
  342. data/tmpsets/set/mod007-05_standard/type/image.rb +89 -0
  343. data/tmpsets/set/mod007-05_standard/type/layout_type.rb +21 -0
  344. data/tmpsets/set/mod007-05_standard/type/number.rb +25 -0
  345. data/tmpsets/set/mod007-05_standard/type/phrase.rb +9 -0
  346. data/tmpsets/set/mod007-05_standard/type/search_type.rb +291 -0
  347. data/tmpsets/set/mod007-05_standard/type/session.rb +42 -0
  348. data/tmpsets/set/mod007-05_standard/type/set.rb +354 -0
  349. data/tmpsets/set/mod007-05_standard/type/signup.rb +150 -0
  350. data/tmpsets/set/mod007-05_standard/type/toggle.rb +18 -0
  351. data/tmpsets/set/mod007-05_standard/type/uri.rb +17 -0
  352. data/tmpsets/set/mod007-05_standard/type/user.rb +78 -0
  353. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/form.rb +41 -0
  354. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/helper.rb +150 -0
  355. data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/wrapper.rb +18 -0
  356. data/tmpsets/set/mod008-06_bootstrap/all/rich_bootstrap.rb +14 -0
  357. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_cards.rb +15 -0
  358. data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_js.rb +13 -0
  359. data/tmpsets/set/mod008-06_bootstrap/self/bootswatch_shared.rb +38 -0
  360. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_css.rb +13 -0
  361. data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_js.rb +12 -0
  362. data/tmpsets/set_pattern/100-all.rb +24 -0
  363. data/tmpsets/set_pattern/101-all_plus.rb +26 -0
  364. data/tmpsets/set_pattern/102-type.rb +36 -0
  365. data/tmpsets/set_pattern/103-star.rb +28 -0
  366. data/tmpsets/set_pattern/104-rstar.rb +30 -0
  367. data/tmpsets/set_pattern/105-right.rb +33 -0
  368. data/tmpsets/set_pattern/106-type_plus_right.rb +36 -0
  369. data/tmpsets/set_pattern/107-self.rb +32 -0
  370. metadata +306 -107
  371. data/mod/05_standard/set/all/attach.rb +0 -164
  372. data/mod/05_standard/spec/set/all/attach_spec.rb +0 -9
@@ -0,0 +1,130 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module All; module References; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/references.rb ~~~~~~~~~~~
3
+
4
+ def name_referencers link_name=nil
5
+ link_name = link_name.nil? ? key : link_name.to_name.key
6
+ Card.joins( :references_to ).where card_references: { referee_key: link_name }
7
+ end
8
+
9
+ def extended_referencers
10
+ # FIXME .. we really just need a number here.
11
+ (dependents + [self]).map(&:referencers).flatten.uniq
12
+ end
13
+
14
+
15
+ # replace references in card content
16
+ def replace_references old_name, new_name
17
+ obj_content = Card::Content.new raw_content, card=self
18
+ obj_content.find_chunks( Card::Chunk::Reference ).select do |chunk|
19
+ if old_ref_name = chunk.referee_name and new_ref_name = old_ref_name.replace_part(old_name, new_name)
20
+ chunk.referee_name = chunk.replace_reference old_name, new_name
21
+ Card::Reference.where( :referee_key => old_ref_name.key ).update_all :referee_key => new_ref_name.key
22
+ end
23
+ end
24
+
25
+ obj_content.to_s
26
+ end
27
+
28
+ # update entries in reference table
29
+ def update_references rendered_content = nil, refresh = false
30
+ raise "update references should not be called on new cards" if id.nil?
31
+
32
+ Card::Reference.delete_all_from self
33
+
34
+ # FIXME: why not like this: references_expired = nil # do we have to make sure this is saved?
35
+ #Card.update( id, :references_expired=>nil )
36
+ # or just this and save it elsewhere?
37
+ #references_expired=nil
38
+
39
+ Card.connection.execute("update cards set references_expired=NULL where id=#{id}")
40
+ # references_expired = nil
41
+ expire if refresh
42
+
43
+ rendered_content ||= Card::Content.new(raw_content, card=self)
44
+ rendered_content.find_chunks(Card::Chunk::Reference).each do |chunk|
45
+ if referee_name = chunk.referee_name # name is referenced (not true of commented inclusions)
46
+ referee_id = chunk.referee_id
47
+ if id != referee_id # not self reference
48
+
49
+ #update_references chunk.referee_name if Card::Content === chunk.referee_name
50
+ # for the above to work we will need to get past delete_all!
51
+ referee_name.piece_names.each do |name|
52
+ if name.key != key # don't create self reference
53
+
54
+ # reference types:
55
+ # L = link
56
+ # I = inclusion
57
+ # P = partial (i.e. the name is part of a compound name that is referenced by a link or inclusion)
58
+
59
+ # The partial type is needed to keep track of references of virtual cards.
60
+ # For example a link [[A+*self]] won't make it to the reference table because A+*self is virtual and
61
+ # doesn't have an id but when A's name is changed we have to find and update that link.
62
+ ref_type =
63
+ if name == referee_name
64
+ case chunk
65
+ when Card::Chunk::Link then 'L'
66
+ when Card::Chunk::QueryReference then 'Q'
67
+ else 'I'
68
+ end
69
+ else 'P'
70
+ end
71
+ Card::Reference.create!(
72
+ :referer_id => id,
73
+ :referee_id => Card.where(:key=>name.key).pluck(:id).first,
74
+ :referee_key => name.key,
75
+ :ref_type => ref_type,
76
+ :present => 1
77
+ )
78
+ end
79
+ end
80
+ end
81
+
82
+ end
83
+ end
84
+ end
85
+
86
+
87
+
88
+ def referencers
89
+ return [] unless refs = references_from
90
+ refs.map(&:referer_id).map( &Card.method(:fetch) ).compact
91
+ end
92
+
93
+ def includers
94
+ return [] unless refs = references_from.where( :ref_type => 'I' )
95
+ refs.map(&:referer_id).map( &Card.method(:fetch) ).compact
96
+ end
97
+
98
+ def referees
99
+ return [] unless refs = references_to
100
+ refs.map { |ref| Card.fetch ref.referee_key, :new=>{} }.compact
101
+ end
102
+
103
+ def includees
104
+ return [] unless refs = references_to.where( :ref_type => 'I' )
105
+ refs.map { |ref| Card.fetch ref.referee_key, :new=>{} }.compact
106
+ end
107
+
108
+
109
+
110
+ protected
111
+
112
+
113
+ event :refresh_references, :after=>:store, :on=>:save do
114
+ self.update_references
115
+ expire_structuree_references
116
+ end
117
+
118
+ event :refresh_references_on_create, :before=>:refresh_references, :on=>:create do
119
+ Card::Reference.update_existing_key self
120
+ # FIXME: bogus blank default content is set on structured cards...
121
+ end
122
+
123
+ event :refresh_references_on_delete, :after=>:store, :on=>:delete do
124
+ Card::Reference.update_on_delete self
125
+ expire_structuree_references
126
+ end
127
+
128
+
129
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/references.rb ~~~~~~~~~~~
130
+ end;end;end;end;
@@ -0,0 +1,324 @@
1
+ # -*- encoding : utf-8 -*-
2
+ class Card; module Set; module All; module Rules; extend Card::Set # ~~~~~~~~~~~ above autogenerated; below pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/rules.rb ~~~~~~~~~~~
3
+
4
+
5
+
6
+
7
+ RuleSQL = %{
8
+ select rules.id as rule_id, settings.id as setting_id, sets.id as set_id, sets.left_id as anchor_id, sets.right_id as set_tag_id
9
+ from cards rules
10
+ join cards sets on rules.left_id = sets.id
11
+ join cards settings on rules.right_id = settings.id
12
+ where sets.type_id = #{Card::SetID } and sets.trash is false
13
+ and settings.type_id = #{Card::SettingID} and settings.trash is false
14
+ and rules.trash is false
15
+ and (settings.codename != 'follow' or rules.db_content != '');
16
+ }
17
+
18
+ ReadRuleSQL = %{
19
+ select refs.referee_id as party_id, read_rules.id as read_rule_id
20
+ from cards read_rules
21
+ join card_references refs on refs.referer_id = read_rules.id
22
+ join cards sets on read_rules.left_id = sets.id
23
+ where read_rules.right_id = #{Card::ReadID} and read_rules.trash is false and sets.type_id = #{Card::SetID};
24
+ }
25
+
26
+ def is_rule?
27
+ is_standard_rule? || is_user_rule?
28
+ end
29
+
30
+ def is_standard_rule?
31
+ (r = right( :skip_modules=>true )) &&
32
+ r.type_id == Card::SettingID &&
33
+ (l = left( :skip_modules=>true )) &&
34
+ l.type_id == Card::SetID
35
+ end
36
+
37
+ def is_user_rule?
38
+ cardname.parts.length > 2 &&
39
+ (r = right( :skip_modules=>true )) &&
40
+ r.type_id == Card::SettingID &&
41
+ (set = self[0..-3, :skip_modules=>true]) &&
42
+ set.type_id == Card::SetID &&
43
+ (user = self[-2, :skip_modules=>true] ) &&
44
+ (user.type_id == Card::UserID || user.codename == 'all' )
45
+ end
46
+
47
+
48
+ def rule setting_code, options={}
49
+ options[:skip_modules] = true
50
+ card = rule_card setting_code, options
51
+ card && card.db_content
52
+ end
53
+
54
+ def rule_card setting_code, options={}
55
+ Card.fetch rule_card_id( setting_code, options ), options
56
+ end
57
+
58
+ def rule_card_id setting_code, options={}
59
+ fallback = options.delete( :fallback )
60
+
61
+ if Card::Setting.user_specific? setting_code
62
+ user_id = options[:user_id] || (options[:user] and options[:user].id) || Auth.current_id
63
+ if user_id
64
+ fallback = "#{setting_code}+#{AllID}"
65
+ setting_code = "#{setting_code}+#{user_id}"
66
+ end
67
+ end
68
+
69
+ rule_set_keys.each do |rule_set_key|
70
+ rule_id = self.class.rule_cache["#{rule_set_key}+#{setting_code}"]
71
+ rule_id ||= fallback && self.class.rule_cache["#{rule_set_key}+#{fallback}"]
72
+ return rule_id if rule_id
73
+ end
74
+ nil
75
+ end
76
+
77
+ def related_sets with_self = false
78
+ # refers to sets that users may configure from the current card - NOT to sets to which the current card belongs
79
+
80
+ sets = []
81
+ sets << ["#{name}+*type", Card::TypeSet.label( name) ] if known? && type_id==Card::CardtypeID
82
+ sets << ["#{name}+*self", Card::SelfSet.label( name) ] if with_self
83
+ sets << ["#{name}+*right", Card::RightSet.label(name) ] if known? && cardname.simple?
84
+
85
+ # Card.search(:type=>'Set',:left=>{:right=>name},:right=>'*type plus right',:return=>'name').each do |set_name|
86
+ # sets<< set_name
87
+ # end
88
+ sets
89
+ end
90
+
91
+
92
+
93
+ module ClassMethods
94
+
95
+ # User-specific rule use the pattern
96
+ # user+set+setting
97
+ def user_rule_sql user_id=nil
98
+ user_restriction = if user_id
99
+ "users.id = #{user_id}"
100
+ else
101
+ "users.type_id = #{Card::UserID}"
102
+ end
103
+
104
+ %{
105
+ select
106
+ user_rules.id as rule_id,
107
+ settings.id as setting_id,
108
+ sets.id as set_id,
109
+ sets.left_id as anchor_id,
110
+ sets.right_id as set_tag_id,
111
+ users.id as user_id
112
+ from cards user_rules
113
+ join cards user_sets on user_rules.left_id = user_sets.id
114
+ join cards settings on user_rules.right_id = settings.id
115
+ join cards users on user_sets.right_id = users.id
116
+ join cards sets on user_sets.left_id = sets.id
117
+ where sets.type_id = #{Card::SetID } and sets.trash is false
118
+ and settings.type_id = #{Card::SettingID} and settings.trash is false
119
+ and ( #{user_restriction} or users.codename = 'all' ) and users.trash is false
120
+ and user_sets.trash is false
121
+ and user_rules.trash is false;
122
+ }
123
+ end
124
+
125
+
126
+ def setting name
127
+ Auth.as_bot do
128
+ card=Card[name] and !card.db_content.strip.empty? and card.db_content
129
+ end
130
+ end
131
+
132
+ def path_setting name #shouldn't this be in location helper?
133
+ name ||= '/'
134
+ return name if name =~ /^(http|mailto)/
135
+ "#{Card.config.relative_url_root}#{name}"
136
+ end
137
+
138
+ def toggle val
139
+ val.to_s.strip == '1'
140
+ end
141
+
142
+ def cache_key row
143
+ setting_code = Codename[ row['setting_id'].to_i ] or return false
144
+
145
+ anchor_id = row['anchor_id']
146
+ set_class_id = anchor_id.nil? ? row['set_id'] : row['set_tag_id']
147
+ set_class_code = Codename[ set_class_id.to_i ] or return false
148
+
149
+ key_base = [ anchor_id, set_class_code, setting_code].compact.map( &:to_s ) * '+'
150
+ end
151
+
152
+ def all_rule_keys_with_id
153
+ ActiveRecord::Base.connection.select_all(RuleSQL).each do |row|
154
+ if key = cache_key(row)
155
+ yield(key, row['rule_id'].to_i)
156
+ end
157
+ end
158
+ end
159
+
160
+ def all_user_rule_keys_with_id_and_user_id
161
+ ActiveRecord::Base.connection.select_all(user_rule_sql).each do |row|
162
+ if key = cache_key(row) and user_id = row['user_id']
163
+ yield(key, row['rule_id'].to_i, user_id.to_i)
164
+ end
165
+ end
166
+ end
167
+
168
+ def all_rule_keys_with_id_for user_id
169
+ ActiveRecord::Base.connection.select_all(user_rule_sql(user_id)).each do |row|
170
+ if key = cache_key(row)
171
+ yield(key, row['rule_id'].to_i)
172
+ end
173
+ end
174
+ end
175
+
176
+ def cached_rule_keys_for user_id
177
+ rule_keys_cache[user_id] || []
178
+ end
179
+
180
+ def all_user_ids_with_rule_for set_card, setting_code
181
+ key = if (l=set_card.left) and (r=set_card.right)
182
+ set_class_code = Codename[ r.id ]
183
+ "#{l.id}+#{set_class_code}+#{setting_code}"
184
+ else
185
+ set_class_code = Codename[ set_card.id ]
186
+ "#{set_class_code}+#{setting_code}"
187
+ end
188
+ user_ids = user_ids_cache[key] || []
189
+ if user_ids.include? AllID # rule for all -> return all user ids
190
+ Card.where(:type_id=>UserID).pluck(:id)
191
+ else
192
+ user_ids
193
+ end
194
+
195
+ end
196
+
197
+ def user_rule_cards user_name, setting_code
198
+ Card.search :right=>{:codename=>setting_code}, :left=>{:left=>{:type_id=>SetID}, :right=>user_name}
199
+ end
200
+
201
+ def rule_cache
202
+ Card.cache.read('RULES') || begin
203
+ rule_hash = {}
204
+ all_rule_keys_with_id do |key,rule_id|
205
+ rule_hash[key] = rule_id
206
+ end
207
+
208
+ user_ids_hash = {}
209
+ rule_keys_hash = {}
210
+ all_user_rule_keys_with_id_and_user_id do |key, rule_id, user_id|
211
+ rule_hash[ user_rule_key(key,user_id) ] = rule_id
212
+ user_ids_hash[key] ||= []
213
+ user_ids_hash[key] << user_id
214
+ rule_keys_hash[user_id] ||= []
215
+ rule_keys_hash[user_id] << key
216
+ end
217
+ write_user_ids_cache user_ids_hash
218
+ write_rule_keys_cache rule_keys_hash
219
+ write_rule_cache rule_hash
220
+ end
221
+ end
222
+
223
+ def user_rule_key key, user_id
224
+ "#{key}+#{user_id}"
225
+ end
226
+
227
+ # all users that have a user-specific rule for a given rule key
228
+ def user_ids_cache
229
+ Card.cache.read('USER_IDS') || begin
230
+ rule_cache
231
+ Card.cache.read('USER_IDS')
232
+ end
233
+ end
234
+
235
+ # all keys of user-specific rules for a given user
236
+ def rule_keys_cache
237
+ Card.cache.read('RULE_KEYS') || begin
238
+ rule_cache
239
+ Card.cache.read('RULE_KEYS')
240
+ end
241
+ end
242
+
243
+ def clear_rule_cache
244
+ write_rule_cache nil
245
+ write_user_ids_cache nil
246
+ write_rule_keys_cache nil
247
+ end
248
+
249
+ def clear_user_rule_cache
250
+ clear_rule_cache
251
+ end
252
+
253
+ def refresh_rule_cache_for_user user_id
254
+ rule_hash = rule_cache
255
+ user_ids_hash = user_ids_cache
256
+ rule_keys_hash = rule_keys_cache
257
+
258
+ cached_rule_keys_for(user_id).each do |key|
259
+ rule_hash[ user_rule_key(key, user_id) ] = nil
260
+ user_ids_hash[ key ].delete(user_id)
261
+ end
262
+ rule_keys_hash[ user_id ] = nil
263
+
264
+ all_rule_keys_with_id_for(user_id) do |key, rule_id|
265
+ rule_hash[ user_rule_key(key,user_id) ] = rule_id
266
+
267
+ user_ids_hash[ key ] ||= []
268
+ user_ids_hash[ key ] << user_id
269
+ rule_keys_hash[ user_id ] ||= []
270
+ rule_keys_hash[ user_id ] << key
271
+ end
272
+ write_user_ids_cache user_ids_hash
273
+ write_rule_keys_cache rule_keys_hash
274
+ write_rule_cache rule_hash
275
+ end
276
+
277
+ def write_rule_cache hash
278
+ Card.cache.write 'RULES', hash
279
+ end
280
+
281
+ def write_user_ids_cache hash
282
+ Card.cache.write 'USER_IDS', hash
283
+ end
284
+
285
+ def write_rule_keys_cache hash
286
+ Card.cache.write 'RULE_KEYS', hash
287
+ end
288
+
289
+
290
+
291
+ def read_rule_cache
292
+ Card.cache.read('READRULES') || begin
293
+ hash = {}
294
+ ActiveRecord::Base.connection.select_all( Card::Set::All::Rules::ReadRuleSQL ).each do |row|
295
+ party_id, read_rule_id = row['party_id'].to_i, row['read_rule_id'].to_i
296
+ hash[party_id] ||= []
297
+ hash[party_id] << read_rule_id
298
+ end
299
+ Card.cache.write 'READRULES', hash
300
+ end
301
+ end
302
+
303
+ def clear_read_rule_cache
304
+ Card.cache.write 'READRULES', nil
305
+ end
306
+ =begin
307
+ def default_rule setting_code, fallback=nil
308
+ card = default_rule_card setting_code, fallback
309
+ return card && card.content
310
+ end
311
+
312
+ def default_rule_card setting_code, fallback=nil
313
+ rule_id = rule_cache["all+#{setting_code}"]
314
+ rule_id ||= fallback && rule_cache["all+#{fallback}"]
315
+ Card[rule_id] if rule_id
316
+ end
317
+ =end
318
+ end
319
+
320
+
321
+
322
+
323
+ # ~~~~~~~~~~~ below autogenerated; above pulled from /Users/ethan/dev/wagn/gem/card/mod/01_core/set/all/rules.rb ~~~~~~~~~~~
324
+ end;end;end;end;