orange 0.5.5 → 0.5.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/lib/orange.rb +2 -5
  2. data/spec/orange_spec.rb +5 -0
  3. data/spec/{orange-core/spec_helper.rb → spec_helper.rb} +0 -0
  4. metadata +28 -235
  5. data/lib/orange-core.rb +0 -8
  6. data/lib/orange-core/application.rb +0 -132
  7. data/lib/orange-core/assets/css/exceptions.css +0 -50
  8. data/lib/orange-core/assets/js/exceptions.js +0 -44
  9. data/lib/orange-core/carton.rb +0 -178
  10. data/lib/orange-core/core.rb +0 -266
  11. data/lib/orange-core/magick.rb +0 -270
  12. data/lib/orange-core/middleware/base.rb +0 -96
  13. data/lib/orange-core/middleware/database.rb +0 -45
  14. data/lib/orange-core/middleware/four_oh_four.rb +0 -45
  15. data/lib/orange-core/middleware/globals.rb +0 -17
  16. data/lib/orange-core/middleware/loader.rb +0 -13
  17. data/lib/orange-core/middleware/rerouter.rb +0 -53
  18. data/lib/orange-core/middleware/restful_router.rb +0 -99
  19. data/lib/orange-core/middleware/route_context.rb +0 -39
  20. data/lib/orange-core/middleware/route_site.rb +0 -51
  21. data/lib/orange-core/middleware/show_exceptions.rb +0 -80
  22. data/lib/orange-core/middleware/static.rb +0 -67
  23. data/lib/orange-core/middleware/static_file.rb +0 -32
  24. data/lib/orange-core/middleware/template.rb +0 -60
  25. data/lib/orange-core/packet.rb +0 -232
  26. data/lib/orange-core/plugin.rb +0 -172
  27. data/lib/orange-core/resource.rb +0 -96
  28. data/lib/orange-core/resources/mapper.rb +0 -36
  29. data/lib/orange-core/resources/model_resource.rb +0 -228
  30. data/lib/orange-core/resources/not_found.rb +0 -10
  31. data/lib/orange-core/resources/page_parts.rb +0 -68
  32. data/lib/orange-core/resources/parser.rb +0 -113
  33. data/lib/orange-core/resources/routable_resource.rb +0 -16
  34. data/lib/orange-core/resources/scaffold.rb +0 -106
  35. data/lib/orange-core/stack.rb +0 -226
  36. data/lib/orange-core/templates/exceptions.haml +0 -111
  37. data/lib/orange-core/views/default_resource/create.haml +0 -4
  38. data/lib/orange-core/views/default_resource/edit.haml +0 -9
  39. data/lib/orange-core/views/default_resource/list.haml +0 -10
  40. data/lib/orange-core/views/default_resource/show.haml +0 -4
  41. data/lib/orange-core/views/default_resource/table_row.haml +0 -7
  42. data/lib/orange-core/views/not_found/404.haml +0 -2
  43. data/lib/orange-more.rb +0 -23
  44. data/lib/orange-more/administration.rb +0 -1
  45. data/lib/orange-more/administration/assets/css/admin.css +0 -286
  46. data/lib/orange-more/administration/assets/css/blueprint-ie.css +0 -35
  47. data/lib/orange-more/administration/assets/css/blueprint-print.css +0 -29
  48. data/lib/orange-more/administration/assets/css/blueprint.css +0 -257
  49. data/lib/orange-more/administration/assets/js/jquery.js +0 -152
  50. data/lib/orange-more/administration/cartons/site.rb +0 -7
  51. data/lib/orange-more/administration/cartons/site_carton.rb +0 -12
  52. data/lib/orange-more/administration/cartons/user.rb +0 -27
  53. data/lib/orange-more/administration/middleware/access_control.rb +0 -156
  54. data/lib/orange-more/administration/middleware/site_load.rb +0 -25
  55. data/lib/orange-more/administration/plugin.rb +0 -23
  56. data/lib/orange-more/administration/resources/admin_resource.rb +0 -27
  57. data/lib/orange-more/administration/resources/site_resource.rb +0 -10
  58. data/lib/orange-more/administration/resources/user_resource.rb +0 -40
  59. data/lib/orange-more/administration/templates/admin.haml +0 -25
  60. data/lib/orange-more/administration/views/openid_login.haml +0 -14
  61. data/lib/orange-more/administration/views/users/create.haml +0 -10
  62. data/lib/orange-more/administration/views/users/edit.haml +0 -15
  63. data/lib/orange-more/adverts.rb +0 -1
  64. data/lib/orange-more/adverts/cartons/adverts_carton.rb +0 -14
  65. data/lib/orange-more/adverts/plugin.rb +0 -13
  66. data/lib/orange-more/adverts/resources/adverts_resource.rb +0 -27
  67. data/lib/orange-more/adverts/views/adverts/adverts.haml +0 -2
  68. data/lib/orange-more/analytics.rb +0 -1
  69. data/lib/orange-more/analytics/middleware/analytics.rb +0 -30
  70. data/lib/orange-more/analytics/plugin.rb +0 -11
  71. data/lib/orange-more/analytics/resources/analytics_resource.rb +0 -42
  72. data/lib/orange-more/assets.rb +0 -1
  73. data/lib/orange-more/assets/cartons/asset_carton.rb +0 -27
  74. data/lib/orange-more/assets/plugin.rb +0 -13
  75. data/lib/orange-more/assets/resources/asset_resource.rb +0 -115
  76. data/lib/orange-more/assets/views/assets/change.haml +0 -1
  77. data/lib/orange-more/assets/views/assets/create.haml +0 -13
  78. data/lib/orange-more/assets/views/assets/insert.haml +0 -1
  79. data/lib/orange-more/blog.rb +0 -1
  80. data/lib/orange-more/blog/cartons/blog.rb +0 -8
  81. data/lib/orange-more/blog/cartons/blog_post.rb +0 -60
  82. data/lib/orange-more/blog/plugin.rb +0 -14
  83. data/lib/orange-more/blog/resources/blog_post_resource.rb +0 -53
  84. data/lib/orange-more/blog/resources/blog_resource.rb +0 -104
  85. data/lib/orange-more/blog/views/blog/blog_archive_view.haml +0 -6
  86. data/lib/orange-more/blog/views/blog/blog_offset_list_view.haml +0 -12
  87. data/lib/orange-more/blog/views/blog/blog_post_view.haml +0 -4
  88. data/lib/orange-more/blog/views/blog/sitemap_row.haml +0 -14
  89. data/lib/orange-more/blog/views/blog_posts/edit.haml +0 -8
  90. data/lib/orange-more/blog/views/blog_posts/show.haml +0 -4
  91. data/lib/orange-more/cloud.rb +0 -1
  92. data/lib/orange-more/cloud/plugin.rb +0 -10
  93. data/lib/orange-more/cloud/resources/cloud_resource.rb +0 -21
  94. data/lib/orange-more/contactforms.rb +0 -1
  95. data/lib/orange-more/contactforms/assets/js/jquery.validate.pack.js +0 -15
  96. data/lib/orange-more/contactforms/assets/js/lib/jquery-1.4.2.js +0 -6240
  97. data/lib/orange-more/contactforms/assets/js/lib/jquery.form.js +0 -660
  98. data/lib/orange-more/contactforms/assets/js/lib/jquery.js +0 -4376
  99. data/lib/orange-more/contactforms/assets/js/lib/jquery.metadata.js +0 -122
  100. data/lib/orange-more/contactforms/cartons/contactforms_carton.rb +0 -12
  101. data/lib/orange-more/contactforms/plugin.rb +0 -13
  102. data/lib/orange-more/contactforms/resources/contactforms_resource.rb +0 -56
  103. data/lib/orange-more/contactforms/views/contactforms/contactform.haml +0 -20
  104. data/lib/orange-more/debugger.rb +0 -1
  105. data/lib/orange-more/debugger/assets/css/debug_bar.css +0 -46
  106. data/lib/orange-more/debugger/middleware/debugger.rb +0 -50
  107. data/lib/orange-more/debugger/plugin.rb +0 -12
  108. data/lib/orange-more/debugger/views/debug_bar.haml +0 -87
  109. data/lib/orange-more/disqus.rb +0 -1
  110. data/lib/orange-more/disqus/plugin.rb +0 -11
  111. data/lib/orange-more/disqus/resources/disqus_resource.rb +0 -9
  112. data/lib/orange-more/disqus/views/disqus/comment_thread.haml +0 -7
  113. data/lib/orange-more/donations.rb +0 -1
  114. data/lib/orange-more/donations/cartons/donation_carton.rb +0 -9
  115. data/lib/orange-more/donations/plugin.rb +0 -12
  116. data/lib/orange-more/donations/resources/donations_resource.rb +0 -51
  117. data/lib/orange-more/donations/views/donations/donate_form.haml +0 -21
  118. data/lib/orange-more/donations/views/donations/donate_thanks.haml +0 -2
  119. data/lib/orange-more/donations/views/donations/paypal_form.haml +0 -13
  120. data/lib/orange-more/events.rb +0 -1
  121. data/lib/orange-more/events/assets/js/events.js +0 -55
  122. data/lib/orange-more/events/cartons/orange_calendar.rb +0 -8
  123. data/lib/orange-more/events/cartons/orange_event.rb +0 -60
  124. data/lib/orange-more/events/plugin.rb +0 -14
  125. data/lib/orange-more/events/resources/calendar_resource.rb +0 -33
  126. data/lib/orange-more/events/resources/event_resource.rb +0 -147
  127. data/lib/orange-more/events/views/calendar/calendar.haml +0 -8
  128. data/lib/orange-more/events/views/events/create.haml +0 -55
  129. data/lib/orange-more/events/views/events/edit.haml +0 -59
  130. data/lib/orange-more/events/views/events/list.haml +0 -13
  131. data/lib/orange-more/events/views/events/show.haml +0 -4
  132. data/lib/orange-more/events/views/events/table_row.haml +0 -17
  133. data/lib/orange-more/members.rb +0 -1
  134. data/lib/orange-more/members/cartons/member_carton.rb +0 -38
  135. data/lib/orange-more/members/plugin.rb +0 -13
  136. data/lib/orange-more/members/resources/members_resource.rb +0 -327
  137. data/lib/orange-more/members/views/members/create.haml +0 -12
  138. data/lib/orange-more/members/views/members/edit.haml +0 -15
  139. data/lib/orange-more/members/views/members/live.show.haml +0 -1
  140. data/lib/orange-more/members/views/members/login.haml +0 -17
  141. data/lib/orange-more/members/views/members/logout.haml +0 -1
  142. data/lib/orange-more/members/views/members/profile.haml +0 -50
  143. data/lib/orange-more/members/views/members/register.haml +0 -37
  144. data/lib/orange-more/news.rb +0 -1
  145. data/lib/orange-more/news/cartons/news.rb +0 -12
  146. data/lib/orange-more/news/plugin.rb +0 -13
  147. data/lib/orange-more/news/resources/news_resource.rb +0 -82
  148. data/lib/orange-more/news/views/news/archive.haml +0 -14
  149. data/lib/orange-more/news/views/news/edit.haml +0 -7
  150. data/lib/orange-more/news/views/news/latest.haml +0 -8
  151. data/lib/orange-more/news/views/news/sitemap_row.haml +0 -14
  152. data/lib/orange-more/pages.rb +0 -1
  153. data/lib/orange-more/pages/cartons/page_carton.rb +0 -14
  154. data/lib/orange-more/pages/cartons/page_version_carton.rb +0 -12
  155. data/lib/orange-more/pages/plugin.rb +0 -13
  156. data/lib/orange-more/pages/resources/page_resource.rb +0 -179
  157. data/lib/orange-more/pages/views/pages/edit.haml +0 -34
  158. data/lib/orange-more/pages/views/pages/show.haml +0 -6
  159. data/lib/orange-more/sitemap.rb +0 -1
  160. data/lib/orange-more/sitemap/assets/img/sitemap_down.png +0 -0
  161. data/lib/orange-more/sitemap/assets/img/sitemap_down_d.png +0 -0
  162. data/lib/orange-more/sitemap/assets/img/sitemap_indent.png +0 -0
  163. data/lib/orange-more/sitemap/assets/img/sitemap_indent_d.png +0 -0
  164. data/lib/orange-more/sitemap/assets/img/sitemap_outdent.png +0 -0
  165. data/lib/orange-more/sitemap/assets/img/sitemap_outdent_d.png +0 -0
  166. data/lib/orange-more/sitemap/assets/img/sitemap_up.png +0 -0
  167. data/lib/orange-more/sitemap/assets/img/sitemap_up_d.png +0 -0
  168. data/lib/orange-more/sitemap/assets/js/sitemap.js +0 -11
  169. data/lib/orange-more/sitemap/cartons/route.rb +0 -43
  170. data/lib/orange-more/sitemap/middleware/flex_router.rb +0 -25
  171. data/lib/orange-more/sitemap/plugin.rb +0 -17
  172. data/lib/orange-more/sitemap/resources/sitemap_resource.rb +0 -295
  173. data/lib/orange-more/sitemap/views/default_resource/sitemap_row.haml +0 -30
  174. data/lib/orange-more/sitemap/views/sitemap/breadcrumb.haml +0 -12
  175. data/lib/orange-more/sitemap/views/sitemap/list.haml +0 -4
  176. data/lib/orange-more/sitemap/views/sitemap/one_level.haml +0 -7
  177. data/lib/orange-more/sitemap/views/sitemap/route_actions.haml +0 -15
  178. data/lib/orange-more/sitemap/views/sitemap/sitemap_links.haml +0 -14
  179. data/lib/orange-more/sitemap/views/sitemap/table_row.haml +0 -30
  180. data/lib/orange-more/sitemap/views/sitemap/two_level.haml +0 -13
  181. data/lib/orange-more/slices.rb +0 -1
  182. data/lib/orange-more/slices/middleware/radius_parser.rb +0 -24
  183. data/lib/orange-more/slices/plugin.rb +0 -15
  184. data/lib/orange-more/slices/resources/radius.rb +0 -117
  185. data/lib/orange-more/slices/resources/slices.rb +0 -35
  186. data/lib/orange-more/subsites.rb +0 -1
  187. data/lib/orange-more/subsites/cartons/subsite.rb +0 -8
  188. data/lib/orange-more/subsites/middleware/subsite_load.rb +0 -29
  189. data/lib/orange-more/subsites/plugin.rb +0 -17
  190. data/lib/orange-more/subsites/resources/subsite_resource.rb +0 -54
  191. data/lib/orange-more/subsites/views/subsites/index.haml +0 -2
  192. data/lib/orange-more/testimonials.rb +0 -1
  193. data/lib/orange-more/testimonials/cartons/testimonials_carton.rb +0 -15
  194. data/lib/orange-more/testimonials/plugin.rb +0 -13
  195. data/lib/orange-more/testimonials/resources/testimonials_resource.rb +0 -42
  196. data/lib/orange-more/testimonials/views/testimonials/testimonials.haml +0 -4
  197. data/spec/orange-core/application_spec.rb +0 -183
  198. data/spec/orange-core/carton_spec.rb +0 -136
  199. data/spec/orange-core/core_spec.rb +0 -248
  200. data/spec/orange-core/magick_spec.rb +0 -96
  201. data/spec/orange-core/middleware/base_spec.rb +0 -38
  202. data/spec/orange-core/middleware/globals_spec.rb +0 -3
  203. data/spec/orange-core/middleware/rerouter_spec.rb +0 -3
  204. data/spec/orange-core/middleware/restful_router_spec.rb +0 -3
  205. data/spec/orange-core/middleware/route_context_spec.rb +0 -3
  206. data/spec/orange-core/middleware/route_site_spec.rb +0 -3
  207. data/spec/orange-core/middleware/show_exceptions_spec.rb +0 -3
  208. data/spec/orange-core/middleware/static_file_spec.rb +0 -3
  209. data/spec/orange-core/middleware/static_spec.rb +0 -3
  210. data/spec/orange-core/mock/mock_app.rb +0 -16
  211. data/spec/orange-core/mock/mock_carton.rb +0 -43
  212. data/spec/orange-core/mock/mock_core.rb +0 -2
  213. data/spec/orange-core/mock/mock_middleware.rb +0 -25
  214. data/spec/orange-core/mock/mock_mixins.rb +0 -19
  215. data/spec/orange-core/mock/mock_model_resource.rb +0 -47
  216. data/spec/orange-core/mock/mock_pulp.rb +0 -24
  217. data/spec/orange-core/mock/mock_resource.rb +0 -26
  218. data/spec/orange-core/mock/mock_router.rb +0 -10
  219. data/spec/orange-core/orange_spec.rb +0 -19
  220. data/spec/orange-core/packet_spec.rb +0 -203
  221. data/spec/orange-core/resource_spec.rb +0 -96
  222. data/spec/orange-core/resources/mapper_spec.rb +0 -5
  223. data/spec/orange-core/resources/model_resource_spec.rb +0 -246
  224. data/spec/orange-core/resources/parser_spec.rb +0 -5
  225. data/spec/orange-core/resources/routable_resource_spec.rb +0 -5
  226. data/spec/orange-core/stack_spec.rb +0 -232
@@ -1,30 +0,0 @@
1
- - if route
2
- .sitemap_item{:class => "sitemap_level_#{route.level}"}
3
- - if route.level > 0
4
- .move_actions.dent_actions
5
- = form_link('Outdent', route_to(:sitemap, route.id, 'outdent'), false, {:method => 'post', :class => 'outdent arrow'}) if route.level > 1
6
- %p= ' '
7
- .move_actions
8
- - if route.previous_sibling
9
- = form_link('Up', route_to(:sitemap, route.id, 'higher'), false, {:method => 'post', :class => 'up arrow'})
10
- - else
11
- %p.disabled_up.arrow= ' '
12
- - if route.next_sibling
13
- = form_link('Down', route_to(:sitemap, route.id, 'lower'), false, {:method => 'post', :class => 'down arrow'})
14
- - else
15
- %p.disabled_down.arrow= ' '
16
- .move_actions.dent_actions
17
- = form_link('Indent', route_to(:sitemap, route.id, 'indent'), false, {:method => 'post', :class => 'indent arrow'}) if route.previous_sibling && route.previous_sibling.level == route.level
18
- %p= ' '
19
- %h4 #{route.link_text} <span>(#{route.full_path})</span>
20
- .linked_to
21
- %p
22
- Linked to:
23
- %a{:href => route.resource.blank? ? '#' : route_to(route.resource, route.resource_id, 'edit')} [#{route.resource}] ##{route.resource_id}
24
- %p
25
- Views:
26
- = orange[:analytics].pageviews(route.full_path)
27
- .actions
28
- = form_link('Delete', route_to(:sitemap, route.id, 'delete'), 'Are you sure you want to delete this?', {:method => 'delete'})
29
- %a{:href => route_to(:sitemap, route.id, 'edit')} Edit
30
- %br.clear
@@ -1,12 +0,0 @@
1
- - if model
2
- %p
3
- - for a in model.ancestors
4
- %a{:href => a.full_path}= a.link_text
5
- &gt;
6
- %span.here= model.link_text
7
- - else # Possibly a restful route
8
- %p
9
- - home = orange[:sitemap].home(packet)
10
- %a{:href => home.full_path}= home.link_text
11
- &gt;
12
- %span.here= packet['route.resource'].to_s.capitalize
@@ -1,4 +0,0 @@
1
- #sitemap_list
2
- - for obj in list
3
- = view_table_row(model_name, :model => obj)
4
- %a{:href => route_to(model_name, 'create')} New
@@ -1,7 +0,0 @@
1
- %ul.nav
2
- %li.first
3
- %a{:href => model.full_path} Home
4
- - for item in model.children
5
- - next unless item.show_in_nav
6
- %li
7
- %a{:href => item.full_path}= orange[:sitemap].link_text_for(item)
@@ -1,15 +0,0 @@
1
- .move_actions.dent_actions
2
- = form_link('Outdent', route_to(:sitemap, model.id, 'outdent'), false, {:method => 'post', :class => 'outdent arrow'}) if model.level > 1
3
- %p= '&nbsp;'
4
- .move_actions
5
- - if model.previous_sibling
6
- = form_link('Up', route_to(:sitemap, model.id, 'higher'), false, {:method => 'post', :class => 'up arrow'})
7
- - else
8
- %p.disabled_up.arrow= '&nbsp;'
9
- - if model.next_sibling
10
- = form_link('Down', route_to(:sitemap, model.id, 'lower'), false, {:method => 'post', :class => 'down arrow'})
11
- - else
12
- %p.disabled_down.arrow= '&nbsp;'
13
- .move_actions.dent_actions
14
- = form_link('Indent', route_to(:sitemap, model.id, 'indent'), false, {:method => 'post', :class => 'indent arrow'}) if model.previous_sibling && model.previous_sibling.level == model.level
15
- %p= '&nbsp;'
@@ -1,14 +0,0 @@
1
- - if list.empty?
2
- .sitemap_links_info.notice
3
- %p
4
- This resource is not in the sitemap.
5
- %a{:href => add_route_link + '/' + slug_me} Add one?
6
- - else
7
- .sitemap_links_info.success
8
- %h4 Current Route: #{list.first.full_path} #{list.size > 1 ? '(and ' + (list.size - 1).to_s + ' others)' : ''}
9
- %a.more_info{:href=>'#'} More Info
10
- .sitemap_links{:style => 'display:none'}
11
- - for obj in list
12
- .sitemap_link
13
- %span Path: #{obj.full_path}
14
- %a{:href => add_route_link + '/' + slug_me} Add another?
@@ -1,30 +0,0 @@
1
- - if model
2
- .sitemap_item{:class => "sitemap_level_#{model.level}"}
3
- - if model.level > 0
4
- .move_actions.dent_actions
5
- = form_link('Outdent', route_to(model_name, model.id, 'outdent'), false, {:method => 'post', :class => 'outdent arrow'}) if model.level > 1
6
- %p= '&nbsp;'
7
- .move_actions
8
- - if model.previous_sibling
9
- = form_link('Up', route_to(model_name, model.id, 'higher'), false, {:method => 'post', :class => 'up arrow'})
10
- - else
11
- %p.disabled_up.arrow= '&nbsp;'
12
- - if model.next_sibling
13
- = form_link('Down', route_to(model_name, model.id, 'lower'), false, {:method => 'post', :class => 'down arrow'})
14
- - else
15
- %p.disabled_down.arrow= '&nbsp;'
16
- .move_actions.dent_actions
17
- = form_link('Indent', route_to(model_name, model.id, 'indent'), false, {:method => 'post', :class => 'indent arrow'}) if model.previous_sibling && model.previous_sibling.level == model.level
18
- %p= '&nbsp;'
19
- %h4 #{orange[:sitemap].link_text_for(model)} <span>(#{model.full_path})</span>
20
- .linked_to
21
- %p
22
- Linked to:
23
- %a{:href => model.resource.blank? ? '#' : route_to(model.resource, model.resource_id, 'edit')} [#{model.resource}] ##{model.resource_id}
24
- %p
25
- Views:
26
- = orange[:analytics].pageviews(route.full_path)
27
- .actions
28
- = form_link('Delete', route_to(model_name, model.id, 'delete'), 'Are you sure you want to delete this?', {:method => 'delete'})
29
- %a{:href => route_to(model_name, model.id, 'edit')} Edit
30
- %br.clear
@@ -1,13 +0,0 @@
1
- %ul.nav
2
- %li.first
3
- %a{:href => model.full_path} Home
4
- - for item in model.children
5
- - next unless item.show_in_nav
6
- %li
7
- %a{:href => item.full_path}= orange[:sitemap].link_text_for(item)
8
- - unless item.descendants.empty?
9
- %ul.subnav
10
- - for x in item.children
11
- - next unless x.show_in_nav
12
- %li
13
- %a{:href => x.full_path}= orange[:sitemap].link_text_for(x)
@@ -1 +0,0 @@
1
- require File.join('orange-more', 'slices', 'plugin')
@@ -1,24 +0,0 @@
1
- require 'orange-core/middleware/base'
2
-
3
- module Orange::Middleware
4
- # The RadiusParser middleware will parse all outgoing content with
5
- # Radius.
6
- #
7
- # For more details on how Radius works, see http://radius.rubyforge.org/
8
- # This middleware also loads a resource: "Orange::Radius", for the
9
- # purpose of exposing the context object.
10
- class RadiusParser < Base
11
- def init(opts = {})
12
- @contexts = opts[:radius_contexts] || [:live]
13
- # orange.load Orange::Radius.new, :radius
14
- end
15
-
16
- # Passes packet then parses the return
17
- def packet_call(packet)
18
- pass packet
19
- orange[:radius].parse packet if @contexts.include? packet['route.context']
20
- packet.finish
21
- end
22
-
23
- end
24
- end
@@ -1,15 +0,0 @@
1
- Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
2
- Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
3
-
4
- module Orange::Plugins
5
- class Slices < Base
6
- resource Orange::Radius.new
7
- resource Orange::Slices.new
8
-
9
- postrouter Orange::Middleware::RadiusParser
10
-
11
- end
12
- end
13
-
14
- Orange.plugin(Orange::Plugins::Slices.new)
15
-
@@ -1,117 +0,0 @@
1
- require 'radius'
2
-
3
- module Orange
4
- # Radius resource is for exposing the Radius context
5
- # and allowing parsing.
6
- class Radius < Resource
7
- call_me :radius
8
- def afterLoad
9
- @context = ::Radius::PacketContext.new
10
- @defined_tags = []
11
- orange.fire(:radius_loaded, self)
12
- end
13
-
14
- def context
15
- @context
16
- end
17
-
18
- def defined_tags
19
- @defined_tags
20
- end
21
-
22
- def define_tag(*args, &block)
23
- @defined_tags << args.first unless @defined_tags.include? args.first
24
- @context.define_tag(*args, &block)
25
- end
26
-
27
- def parse_text(packet, text = false)
28
- content = text
29
- unless content.blank?
30
- parser = ::Radius::PacketParser.new(context, :tag_prefix => 'o')
31
- parser.parse(content, packet)
32
- end
33
- end
34
-
35
- def parse(packet)
36
- content = packet[:content, false]
37
- unless content.blank?
38
- parser = ::Radius::PacketParser.new(context, :tag_prefix => 'o')
39
- packet[:content] = parser.parse(content, packet)
40
- end
41
- end
42
- end
43
- end
44
-
45
- module Radius
46
- #
47
- # The Radius parser. Initialize a parser with a Context object that
48
- # defines how tags should be expanded. See the QUICKSTART[link:files/QUICKSTART.html]
49
- # for a detailed explaination of its usage.
50
- #
51
- class PacketParser < Parser
52
- def parse(string, packet = false)
53
- @stack = [ParseContainerTag.new { |t| t.contents.to_s }]
54
- tokenize(string)
55
- stack_up(packet)
56
- @stack.last.to_s
57
- end
58
-
59
- protected
60
-
61
- def stack_up(packet = false)
62
- @tokens.each do |t|
63
- if t.is_a? String
64
- @stack.last.contents << t
65
- next
66
- end
67
- case t[:flavor]
68
- when :open
69
- @stack.push(ParseContainerTag.new(t[:name], t[:attrs]))
70
- when :self
71
- @stack.last.contents << ParseTag.new {@context.render_tag(t[:name], t[:attrs], packet)}
72
- when :close
73
- popped = @stack.pop
74
- raise WrongEndTagError.new(popped.name, t[:name], @stack) if popped.name != t[:name]
75
- popped.on_parse { |b| @context.render_tag(popped.name, popped.attributes, packet) { b.contents.to_s } }
76
- @stack.last.contents << popped
77
- when :tasteless
78
- raise TastelessTagError.new(t, @stack)
79
- else
80
- raise UndefinedFlavorError.new(t, @stack)
81
- end
82
- end
83
- raise MissingEndTagError.new(@stack.last.name, @stack) if @stack.length != 1
84
- end
85
- end
86
- class PacketContext < Context
87
-
88
- # Returns the value of a rendered tag. Used internally by Parser#parse.
89
- def render_tag(name, attributes = {}, packet = false, &block)
90
- if name =~ /^(.+?):(.+)$/
91
- render_tag($1) { render_tag($2, attributes, packet, &block) }
92
- else
93
- tag_definition_block = @definitions[qualified_tag_name(name.to_s)]
94
- if tag_definition_block
95
- stack(name, attributes, packet, block) do |tag|
96
- tag_definition_block.call(tag).to_s
97
- end
98
- else
99
- tag_missing(name, attributes, &block)
100
- end
101
- end
102
- end
103
- # A convienence method for managing the various parts of the
104
- # tag binding stack.
105
- def stack(name, attributes, packet, block)
106
- previous = @tag_binding_stack.last
107
- previous_locals = previous.nil? ? @globals : previous.locals
108
- locals = DelegatingOpenStruct.new(previous_locals)
109
- locals.packet = packet
110
- binding = TagBinding.new(self, locals, name, attributes, block)
111
- @tag_binding_stack.push(binding)
112
- result = yield(binding)
113
- @tag_binding_stack.pop
114
- result
115
- end
116
- end
117
- end
@@ -1,35 +0,0 @@
1
- module Orange
2
- class Slices < Orange::Resource
3
- call_me :slices
4
- def stack_init
5
- orange[:radius].define_tag "slice" do |tag|
6
- content = ''
7
- resource = (tag.attr['resource'] || :slices).to_sym
8
- id = tag.attr['id'] || nil
9
- mode = (tag.attr['mode'] || tag.attr['chunk'] || (id ? :show : :index )).to_sym
10
- if orange.loaded?(resource)
11
- if orange[resource].respond_to?(mode) || resource == :slices
12
- content << (id ? orange[resource].__send__(mode, tag.locals.packet, :id => id) : orange[resource].__send__(mode, tag.locals.packet, {:attrs => tag.attr}))
13
- else
14
- content << "resource #{resource} doesn't respond to #{mode}"
15
- end
16
- else
17
- content << "resource #{resource} not loaded"
18
- end
19
- content
20
- end
21
- end
22
-
23
- def view(packet, *args)
24
- mode = packet['route.resource_action']
25
- do_view(packet, mode, args.extract_options!)
26
- end
27
-
28
- def method_missing(mode, *args)
29
- packet = args.first if args.first.kind_of? Orange::Packet
30
- opts = args.extract_options!
31
- opts[:resource_name] = 'slices'
32
- do_view(packet, mode, opts)
33
- end
34
- end
35
- end
@@ -1 +0,0 @@
1
- require File.join('orange-more', 'subsites', 'plugin')
@@ -1,8 +0,0 @@
1
- class OrangeSite < Orange::Carton
2
- property :type, Discriminator
3
- has n, :subsites, 'OrangeSubsite'
4
- end
5
-
6
- class OrangeSubsite < OrangeSite
7
- belongs_to :orange_site, :required => false
8
- end
@@ -1,29 +0,0 @@
1
- require 'orange-core/middleware/base'
2
- module Orange::Middleware
3
- # This will load information about the site to into the orange env
4
- # - packet['site'] will be an instance of the site object
5
- #
6
- class SubsiteLoad < Base
7
- def packet_call(packet)
8
- if packet['site']
9
- site = packet['site']
10
- path = packet['route.path'] || packet.request.path_info
11
-
12
- # Find the subsite in the sitemap table
13
- extras, matched = orange[:sitemap].find_route_info(packet, path)
14
-
15
- # If matched, update the loaded site and trim the path down a bit
16
- if !matched.resource.blank? && matched.resource.to_sym == :subsites
17
- if(m = site.subsites.first(:id => matched.resource_id))
18
- packet['route.main_site_route'] = matched
19
- packet['route.path'] = extras
20
- packet['subsite'] = m
21
- end
22
- end
23
- end
24
- pass packet
25
- end
26
- end
27
-
28
- end
29
-
@@ -1,17 +0,0 @@
1
- Dir.glob(File.join(File.dirname(__FILE__), 'cartons', '*.rb')).each {|f| require f }
2
- Dir.glob(File.join(File.dirname(__FILE__), 'resources', '*.rb')).each {|f| require f }
3
- Dir.glob(File.join(File.dirname(__FILE__), 'middleware', '*.rb')).each {|f| require f }
4
-
5
- module Orange::Plugins
6
- class Subsites < Base
7
- views_dir File.join(File.dirname(__FILE__), 'views')
8
-
9
- resource Orange::SubsiteResource.new
10
-
11
- prerouter Orange::Middleware::SubsiteLoad
12
-
13
- end
14
- end
15
-
16
- Orange.plugin(Orange::Plugins::Subsites.new)
17
-
@@ -1,54 +0,0 @@
1
- module Orange
2
- class SubsiteResource < Orange::ModelResource
3
- use OrangeSubsite
4
- call_me :subsites
5
- def stack_init
6
- orange[:admin, true].add_link("Settings", :resource => @my_orange_name, :text => 'Subsites')
7
- end
8
-
9
- # Creates a new model object and saves it (if a post), then reroutes to the main page
10
- # @param [Orange::Packet] packet the packet being routed
11
- def new(packet, *opts)
12
- if packet.request.post?
13
- m = packet['site'].subsites.new(packet.request.params[@my_orange_name.to_s])
14
- m.save
15
- orange[:sitemap].add_route_for(packet,
16
- :orange_site_id => packet['site'].id,
17
- :resource => :subsites,
18
- :resource_id => m.id,
19
- :slug => 'subsite',
20
- :link_text => 'Orange Subsite'
21
- )
22
- end
23
- packet.reroute(@my_orange_name, :orange)
24
- end
25
-
26
- def url_for(packet, opts = {})
27
- orange[:sitemap].url_for(packet, {:resource => 'subsites', :resource_id => (opts.is_a?(model_class) ? opts.id : packet['subsite'].id)})
28
- end
29
-
30
- def subsite_nav(packet, opts = {})
31
- orange[:sitemap].one_level(packet, :model => orange[:sitemap].home(packet, :subsite => true))
32
- end
33
-
34
- def sitemap_row(packet, opts = {})
35
- do_view(packet, :sitemap_row, opts)
36
- end
37
-
38
- end
39
-
40
- class Mapper < Resource
41
- def route_to(packet, resource, *args)
42
- opts = args.extract_options!
43
- packet = DefaultHash.new unless packet
44
- context = opts[:context]
45
- context = packet['route.context', nil] unless (context || (packet['route.context'] == :live))
46
- site = packet['route.faked_site'] ? packet['route.site_url', nil] : nil
47
- args.unshift(resource)
48
- args.unshift(orange[:subsites].url_for(packet).gsub(/^\//, '').gsub(/\/$/, '')) if(packet['subsite'])
49
- args.unshift(context)
50
- args.unshift(site)
51
- '/'+args.compact.join('/')
52
- end
53
- end
54
- end