refinerycms 0.9.9 → 0.9.9.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (630) hide show
  1. data/.gitignore +1 -1
  2. data/Gemfile +8 -24
  3. data/Gemfile.lock +94 -69
  4. data/Rakefile +1 -1
  5. data/bin/refinerycms +118 -109
  6. data/changelog.md +13 -2
  7. data/config/cucumber.yml +3 -7
  8. data/config/settings.rb +0 -1
  9. data/lib/refinery.rb +14 -1
  10. data/lib/refinerycms.rb +2 -9
  11. data/refinerycms.gemspec +15 -855
  12. data/spec/spec_helper.rb +3 -2
  13. metadata +27 -907
  14. data/authentication/app/controllers/admin/users_controller.rb +0 -90
  15. data/authentication/app/controllers/passwords_controller.rb +0 -43
  16. data/authentication/app/controllers/registrations_controller.rb +0 -67
  17. data/authentication/app/controllers/sessions_controller.rb +0 -23
  18. data/authentication/app/helpers/sessions_helper.rb +0 -2
  19. data/authentication/app/helpers/users_helper.rb +0 -2
  20. data/authentication/app/mailers/user_mailer.rb +0 -20
  21. data/authentication/app/models/role.rb +0 -16
  22. data/authentication/app/models/roles_users.rb +0 -6
  23. data/authentication/app/models/user.rb +0 -58
  24. data/authentication/app/models/user_plugin.rb +0 -5
  25. data/authentication/app/views/admin/users/_form.html.erb +0 -92
  26. data/authentication/app/views/admin/users/_user.html.erb +0 -19
  27. data/authentication/app/views/admin/users/_users.html.erb +0 -4
  28. data/authentication/app/views/admin/users/edit.html.erb +0 -1
  29. data/authentication/app/views/admin/users/index.html.erb +0 -12
  30. data/authentication/app/views/admin/users/new.html.erb +0 -1
  31. data/authentication/app/views/layouts/login.html.erb +0 -21
  32. data/authentication/app/views/passwords/edit.html.erb +0 -31
  33. data/authentication/app/views/passwords/new.html.erb +0 -18
  34. data/authentication/app/views/registrations/new.html.erb +0 -41
  35. data/authentication/app/views/sessions/new.html.erb +0 -29
  36. data/authentication/app/views/user_mailer/reset_notification.html.erb +0 -12
  37. data/authentication/app/views/user_mailer/reset_notification.text.plain.erb +0 -7
  38. data/authentication/config/locales/cs.yml +0 -75
  39. data/authentication/config/locales/da.yml +0 -72
  40. data/authentication/config/locales/de.yml +0 -72
  41. data/authentication/config/locales/el.yml +0 -72
  42. data/authentication/config/locales/en.yml +0 -72
  43. data/authentication/config/locales/es.yml +0 -100
  44. data/authentication/config/locales/fr.yml +0 -72
  45. data/authentication/config/locales/it.yml +0 -97
  46. data/authentication/config/locales/lolcat.yml +0 -55
  47. data/authentication/config/locales/lt.yml +0 -55
  48. data/authentication/config/locales/lv.yml +0 -72
  49. data/authentication/config/locales/nb.yml +0 -72
  50. data/authentication/config/locales/nl.yml +0 -70
  51. data/authentication/config/locales/pl.yml +0 -100
  52. data/authentication/config/locales/pt-BR.yml +0 -68
  53. data/authentication/config/locales/rs.yml +0 -72
  54. data/authentication/config/locales/ru.yml +0 -97
  55. data/authentication/config/locales/sl.yml +0 -61
  56. data/authentication/config/locales/sv.yml +0 -64
  57. data/authentication/config/locales/zh-CN.yml +0 -72
  58. data/authentication/config/locales/zh-TW.yml +0 -72
  59. data/authentication/config/routes.rb +0 -31
  60. data/authentication/db/migrate/20100913234705_create_refinerycms_authentication_schema.rb +0 -43
  61. data/authentication/db/migrate/20100929035252_add_missing_indexes_to_roles_users.rb +0 -11
  62. data/authentication/db/migrate/20101206013505_change_to_devise_users_table.rb +0 -27
  63. data/authentication/db/migrate/20110106184757_add_remember_created_at_to_users.rb +0 -9
  64. data/authentication/features/lost_password.feature +0 -49
  65. data/authentication/features/manage_users.feature +0 -61
  66. data/authentication/features/step_definitions/lost_password.rb +0 -8
  67. data/authentication/features/step_definitions/user_steps.rb +0 -36
  68. data/authentication/features/support/factories.rb +0 -18
  69. data/authentication/features/support/paths.rb +0 -24
  70. data/authentication/lib/authenticated_system.rb +0 -29
  71. data/authentication/lib/authentication.rb +0 -30
  72. data/authentication/lib/generators/refinerycms_authentication_generator.rb +0 -8
  73. data/authentication/license.md +0 -21
  74. data/authentication/readme.md +0 -17
  75. data/authentication/refinerycms-authentication.gemspec +0 -20
  76. data/authentication/spec/models/user_spec.rb +0 -159
  77. data/base/db/migrate/20100913234706_create_refinerycms_core_schema.rb +0 -23
  78. data/base/db/migrate/20101217113424_add_locale_to_slugs.rb +0 -13
  79. data/base/features/step_definitions/web_steps.rb +0 -219
  80. data/base/features/support/env.rb +0 -84
  81. data/base/features/support/factories.rb +0 -1
  82. data/base/features/support/negative_expectations_helper.rb +0 -57
  83. data/base/features/support/paths.rb +0 -91
  84. data/base/lib/base.rb +0 -32
  85. data/base/lib/generators/refinerycms_base_generator.rb +0 -8
  86. data/base/lib/refinery.rb +0 -32
  87. data/base/lib/refinery/version.rb +0 -16
  88. data/base/license.md +0 -21
  89. data/base/refinerycms-base.gemspec +0 -18
  90. data/core/app/controllers/admin/base_controller.rb +0 -10
  91. data/core/app/controllers/admin/dialogs_controller.rb +0 -26
  92. data/core/app/controllers/admin/refinery_core_controller.rb +0 -12
  93. data/core/app/controllers/application_controller.rb +0 -6
  94. data/core/app/controllers/refinery/fast_controller.rb +0 -9
  95. data/core/app/controllers/sitemap_controller.rb +0 -14
  96. data/core/app/helpers/application_helper.rb +0 -5
  97. data/core/app/views/admin/_head.html.erb +0 -43
  98. data/core/app/views/admin/_javascripts.html.erb +0 -32
  99. data/core/app/views/admin/_menu.html.erb +0 -17
  100. data/core/app/views/admin/dialogs/show.html.erb +0 -19
  101. data/core/app/views/layouts/admin.html.erb +0 -24
  102. data/core/app/views/layouts/admin_dialog.html.erb +0 -14
  103. data/core/app/views/layouts/application.html.erb +0 -21
  104. data/core/app/views/shared/_content_page.html.erb +0 -63
  105. data/core/app/views/shared/_draft_page_message.html.erb +0 -3
  106. data/core/app/views/shared/_footer.html.erb +0 -4
  107. data/core/app/views/shared/_google_analytics.html.erb +0 -8
  108. data/core/app/views/shared/_head.html.erb +0 -42
  109. data/core/app/views/shared/_header.html.erb +0 -8
  110. data/core/app/views/shared/_html_tag.html.erb +0 -6
  111. data/core/app/views/shared/_ie6check.html.erb +0 -63
  112. data/core/app/views/shared/_javascripts.html.erb +0 -10
  113. data/core/app/views/shared/_menu.html.erb +0 -30
  114. data/core/app/views/shared/_menu_branch.html.erb +0 -26
  115. data/core/app/views/shared/_message.html.erb +0 -10
  116. data/core/app/views/shared/_no_script.html.erb +0 -9
  117. data/core/app/views/shared/_site_bar.html.erb +0 -25
  118. data/core/app/views/shared/admin/_continue_editing.html.erb +0 -3
  119. data/core/app/views/shared/admin/_error_messages.html.erb +0 -16
  120. data/core/app/views/shared/admin/_form_actions.html.erb +0 -77
  121. data/core/app/views/shared/admin/_image_picker.html.erb +0 -60
  122. data/core/app/views/shared/admin/_make_sortable.html.erb +0 -13
  123. data/core/app/views/shared/admin/_resource_picker.html.erb +0 -66
  124. data/core/app/views/shared/admin/_search.html.erb +0 -6
  125. data/core/app/views/shared/admin/_sortable_list.html.erb +0 -7
  126. data/core/app/views/shared/admin/_tabbed_fields.html.erb +0 -42
  127. data/core/app/views/welcome.html.erb +0 -17
  128. data/core/app/views/wymiframe.html.erb +0 -15
  129. data/core/config/locales/cs.yml +0 -77
  130. data/core/config/locales/da.yml +0 -75
  131. data/core/config/locales/de.yml +0 -75
  132. data/core/config/locales/el.yml +0 -75
  133. data/core/config/locales/en.yml +0 -75
  134. data/core/config/locales/es.yml +0 -68
  135. data/core/config/locales/fr.yml +0 -72
  136. data/core/config/locales/it.yml +0 -96
  137. data/core/config/locales/lolcat.yml +0 -68
  138. data/core/config/locales/lt.yml +0 -75
  139. data/core/config/locales/lv.yml +0 -72
  140. data/core/config/locales/nb.yml +0 -75
  141. data/core/config/locales/nl.yml +0 -75
  142. data/core/config/locales/pl.yml +0 -75
  143. data/core/config/locales/pt-BR.yml +0 -72
  144. data/core/config/locales/rs.yml +0 -76
  145. data/core/config/locales/ru.yml +0 -71
  146. data/core/config/locales/sl.yml +0 -72
  147. data/core/config/locales/sv.yml +0 -75
  148. data/core/config/locales/zh-CN.yml +0 -75
  149. data/core/config/locales/zh-TW.yml +0 -75
  150. data/core/config/routes.rb +0 -19
  151. data/core/crud.md +0 -197
  152. data/core/doc/included-jquery-ui-packages.jpg +0 -0
  153. data/core/engines.md +0 -179
  154. data/core/features/search.feature +0 -55
  155. data/core/features/site_bar.feature +0 -24
  156. data/core/features/step_definitions/core_steps.rb +0 -61
  157. data/core/features/support/paths.rb +0 -14
  158. data/core/features/uploads/beach.jpeg +0 -0
  159. data/core/features/uploads/refinery_is_awesome.txt +0 -1
  160. data/core/lib/core.rb +0 -143
  161. data/core/lib/generators/refinerycms_generator.rb +0 -107
  162. data/core/lib/generators/templates/.gitignore +0 -83
  163. data/core/lib/generators/templates/.rspec +0 -2
  164. data/core/lib/generators/templates/app/views/sitemap/index.xml.builder +0 -22
  165. data/core/lib/generators/templates/autotest/autotest.rb +0 -17
  166. data/core/lib/generators/templates/autotest/discover.rb +0 -2
  167. data/core/lib/generators/templates/config/cucumber.yml +0 -15
  168. data/core/lib/generators/templates/config/database.yml.mysql +0 -20
  169. data/core/lib/generators/templates/config/database.yml.postgresql +0 -57
  170. data/core/lib/generators/templates/config/database.yml.sqlite3 +0 -26
  171. data/core/lib/generators/templates/config/i18n-js.yml +0 -6
  172. data/core/lib/generators/templates/config/initializers/devise.rb +0 -142
  173. data/core/lib/generators/templates/config/settings.rb +0 -3
  174. data/core/lib/generators/templates/db/seeds.rb +0 -5
  175. data/core/lib/generators/templates/spec/rcov.opts +0 -2
  176. data/core/lib/generators/templates/spec/spec_helper.rb +0 -76
  177. data/core/lib/refinery/activity.rb +0 -45
  178. data/core/lib/refinery/admin/base_controller.rb +0 -111
  179. data/core/lib/refinery/admin_base_controller.rb +0 -5
  180. data/core/lib/refinery/application.rb +0 -76
  181. data/core/lib/refinery/application_controller.rb +0 -116
  182. data/core/lib/refinery/application_helper.rb +0 -19
  183. data/core/lib/refinery/base_presenter.rb +0 -27
  184. data/core/lib/refinery/catch_all_routes.rb +0 -11
  185. data/core/lib/refinery/crud.rb +0 -295
  186. data/core/lib/refinery/helpers/form_helper.rb +0 -66
  187. data/core/lib/refinery/helpers/head_helper.rb +0 -17
  188. data/core/lib/refinery/helpers/html_truncation_helper.rb +0 -25
  189. data/core/lib/refinery/helpers/image_helper.rb +0 -49
  190. data/core/lib/refinery/helpers/menu_helper.rb +0 -68
  191. data/core/lib/refinery/helpers/meta_helper.rb +0 -67
  192. data/core/lib/refinery/helpers/pagination_helper.rb +0 -16
  193. data/core/lib/refinery/helpers/script_helper.rb +0 -36
  194. data/core/lib/refinery/helpers/site_bar_helper.rb +0 -24
  195. data/core/lib/refinery/helpers/tag_helper.rb +0 -21
  196. data/core/lib/refinery/helpers/translation_helper.rb +0 -17
  197. data/core/lib/refinery/link_renderer.rb +0 -55
  198. data/core/lib/refinery/plugin.rb +0 -134
  199. data/core/lib/refinery/plugins.rb +0 -75
  200. data/core/lib/tasks/cucumber.rake +0 -53
  201. data/core/lib/tasks/doc.rake +0 -29
  202. data/core/lib/tasks/refinery.rake +0 -231
  203. data/core/lib/tasks/yard.rake +0 -30
  204. data/core/license.md +0 -21
  205. data/core/public/404.html +0 -26
  206. data/core/public/422.html +0 -26
  207. data/core/public/500.html +0 -26
  208. data/core/public/favicon.ico +0 -0
  209. data/core/public/images/refinery/add.png +0 -0
  210. data/core/public/images/refinery/admin_bg.png +0 -0
  211. data/core/public/images/refinery/ajax-loader.gif +0 -0
  212. data/core/public/images/refinery/branch-end.gif +0 -0
  213. data/core/public/images/refinery/branch-start.gif +0 -0
  214. data/core/public/images/refinery/branch.gif +0 -0
  215. data/core/public/images/refinery/carousel-left.png +0 -0
  216. data/core/public/images/refinery/carousel-right.png +0 -0
  217. data/core/public/images/refinery/cross.png +0 -0
  218. data/core/public/images/refinery/dialogLoadingAnimation.gif +0 -0
  219. data/core/public/images/refinery/header_background.png +0 -0
  220. data/core/public/images/refinery/hover-gradient.jpg +0 -0
  221. data/core/public/images/refinery/icons/accept.png +0 -0
  222. data/core/public/images/refinery/icons/add.png +0 -0
  223. data/core/public/images/refinery/icons/ajax-loader.gif +0 -0
  224. data/core/public/images/refinery/icons/application_edit.png +0 -0
  225. data/core/public/images/refinery/icons/application_go.png +0 -0
  226. data/core/public/images/refinery/icons/arrow_left.png +0 -0
  227. data/core/public/images/refinery/icons/arrow_switch.png +0 -0
  228. data/core/public/images/refinery/icons/arrow_up.png +0 -0
  229. data/core/public/images/refinery/icons/bin.png +0 -0
  230. data/core/public/images/refinery/icons/bin_closed.png +0 -0
  231. data/core/public/images/refinery/icons/cancel.png +0 -0
  232. data/core/public/images/refinery/icons/cog_add.png +0 -0
  233. data/core/public/images/refinery/icons/cog_edit.png +0 -0
  234. data/core/public/images/refinery/icons/cross.png +0 -0
  235. data/core/public/images/refinery/icons/delete.png +0 -0
  236. data/core/public/images/refinery/icons/doc.png +0 -0
  237. data/core/public/images/refinery/icons/down.gif +0 -0
  238. data/core/public/images/refinery/icons/edit.png +0 -0
  239. data/core/public/images/refinery/icons/email.png +0 -0
  240. data/core/public/images/refinery/icons/email_edit.png +0 -0
  241. data/core/public/images/refinery/icons/email_go.png +0 -0
  242. data/core/public/images/refinery/icons/email_open.png +0 -0
  243. data/core/public/images/refinery/icons/eye.png +0 -0
  244. data/core/public/images/refinery/icons/folder_page_white.png +0 -0
  245. data/core/public/images/refinery/icons/image_add.png +0 -0
  246. data/core/public/images/refinery/icons/image_edit.png +0 -0
  247. data/core/public/images/refinery/icons/img.png +0 -0
  248. data/core/public/images/refinery/icons/information.png +0 -0
  249. data/core/public/images/refinery/icons/layout_add.png +0 -0
  250. data/core/public/images/refinery/icons/layout_edit.png +0 -0
  251. data/core/public/images/refinery/icons/music.png +0 -0
  252. data/core/public/images/refinery/icons/page_add.png +0 -0
  253. data/core/public/images/refinery/icons/page_edit.png +0 -0
  254. data/core/public/images/refinery/icons/page_white_edit.png +0 -0
  255. data/core/public/images/refinery/icons/page_white_gear.png +0 -0
  256. data/core/public/images/refinery/icons/page_white_put.png +0 -0
  257. data/core/public/images/refinery/icons/pdf.png +0 -0
  258. data/core/public/images/refinery/icons/ppt.png +0 -0
  259. data/core/public/images/refinery/icons/star.png +0 -0
  260. data/core/public/images/refinery/icons/tick.png +0 -0
  261. data/core/public/images/refinery/icons/up.gif +0 -0
  262. data/core/public/images/refinery/icons/user_add.png +0 -0
  263. data/core/public/images/refinery/icons/user_comment.png +0 -0
  264. data/core/public/images/refinery/icons/user_edit.png +0 -0
  265. data/core/public/images/refinery/icons/xls.png +0 -0
  266. data/core/public/images/refinery/icons/zip.png +0 -0
  267. data/core/public/images/refinery/icons/zoom.png +0 -0
  268. data/core/public/images/refinery/logo-large.png +0 -0
  269. data/core/public/images/refinery/logo-medium.png +0 -0
  270. data/core/public/images/refinery/logo-site-bar.png +0 -0
  271. data/core/public/images/refinery/logo-small-medium.png +0 -0
  272. data/core/public/images/refinery/logo-small.png +0 -0
  273. data/core/public/images/refinery/logo-tiny.png +0 -0
  274. data/core/public/images/refinery/logo.png +0 -0
  275. data/core/public/images/refinery/nav-3-background.gif +0 -0
  276. data/core/public/images/refinery/nav_inactive_background.png +0 -0
  277. data/core/public/images/refinery/orange_button.png +0 -0
  278. data/core/public/images/refinery/page_bg.png +0 -0
  279. data/core/public/images/refinery/resolve_digital_footer_logo.png +0 -0
  280. data/core/public/images/refinery/text_field_background.png +0 -0
  281. data/core/public/images/refinery/tooltip-nib.gif +0 -0
  282. data/core/public/images/refinery/tooltip-nib.png +0 -0
  283. data/core/public/images/wymeditor/skins/refinery/arrow_redo.png +0 -0
  284. data/core/public/images/wymeditor/skins/refinery/arrow_undo.png +0 -0
  285. data/core/public/images/wymeditor/skins/refinery/eye.png +0 -0
  286. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-blockquote.png +0 -0
  287. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-h1.png +0 -0
  288. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-h2.png +0 -0
  289. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-h3.png +0 -0
  290. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-h4.png +0 -0
  291. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-h5.png +0 -0
  292. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-h6.png +0 -0
  293. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-p.png +0 -0
  294. data/core/public/images/wymeditor/skins/refinery/iframe/lbl-pre.png +0 -0
  295. data/core/public/images/wymeditor/skins/refinery/link_add.png +0 -0
  296. data/core/public/images/wymeditor/skins/refinery/link_break.png +0 -0
  297. data/core/public/images/wymeditor/skins/refinery/page_code.png +0 -0
  298. data/core/public/images/wymeditor/skins/refinery/page_paste.png +0 -0
  299. data/core/public/images/wymeditor/skins/refinery/photo_add.png +0 -0
  300. data/core/public/images/wymeditor/skins/refinery/right.png +0 -0
  301. data/core/public/images/wymeditor/skins/refinery/style.png +0 -0
  302. data/core/public/images/wymeditor/skins/refinery/table_add.png +0 -0
  303. data/core/public/images/wymeditor/skins/refinery/text_align_center.png +0 -0
  304. data/core/public/images/wymeditor/skins/refinery/text_align_justify.png +0 -0
  305. data/core/public/images/wymeditor/skins/refinery/text_align_left.png +0 -0
  306. data/core/public/images/wymeditor/skins/refinery/text_align_right.png +0 -0
  307. data/core/public/images/wymeditor/skins/refinery/text_bold.png +0 -0
  308. data/core/public/images/wymeditor/skins/refinery/text_heading_1.png +0 -0
  309. data/core/public/images/wymeditor/skins/refinery/text_heading_2.png +0 -0
  310. data/core/public/images/wymeditor/skins/refinery/text_heading_3.png +0 -0
  311. data/core/public/images/wymeditor/skins/refinery/text_heading_4.png +0 -0
  312. data/core/public/images/wymeditor/skins/refinery/text_heading_5.png +0 -0
  313. data/core/public/images/wymeditor/skins/refinery/text_heading_6.png +0 -0
  314. data/core/public/images/wymeditor/skins/refinery/text_indent.png +0 -0
  315. data/core/public/images/wymeditor/skins/refinery/text_indent_remove.png +0 -0
  316. data/core/public/images/wymeditor/skins/refinery/text_italic.png +0 -0
  317. data/core/public/images/wymeditor/skins/refinery/text_list_bullets.png +0 -0
  318. data/core/public/images/wymeditor/skins/refinery/text_list_numbers.png +0 -0
  319. data/core/public/images/wymeditor/skins/refinery/text_paragraph.png +0 -0
  320. data/core/public/images/wymeditor/skins/refinery/text_strikethrough.png +0 -0
  321. data/core/public/images/wymeditor/skins/refinery/text_subscript.png +0 -0
  322. data/core/public/images/wymeditor/skins/refinery/text_superscript.png +0 -0
  323. data/core/public/images/wymeditor/skins/refinery/text_underline.png +0 -0
  324. data/core/public/images/wymeditor/skins/wymeditor_icon.png +0 -0
  325. data/core/public/javascripts/admin.js +0 -7
  326. data/core/public/javascripts/application.js +0 -1
  327. data/core/public/javascripts/dd_belatedpng.js +0 -13
  328. data/core/public/javascripts/i18n-messages.js +0 -2
  329. data/core/public/javascripts/jquery-min.js +0 -154
  330. data/core/public/javascripts/jquery-ui-custom-min.js +0 -249
  331. data/core/public/javascripts/jquery.js +0 -6240
  332. data/core/public/javascripts/jquery/GPL-LICENSE.txt +0 -278
  333. data/core/public/javascripts/jquery/MIT-LICENSE.txt +0 -20
  334. data/core/public/javascripts/jquery/jquery.corner.js +0 -345
  335. data/core/public/javascripts/jquery/jquery.html5-placeholder-shim.js +0 -88
  336. data/core/public/javascripts/jquery/jquery.jcarousel.js +0 -900
  337. data/core/public/javascripts/jquery/jquery.textTruncate.js +0 -174
  338. data/core/public/javascripts/jquery/jquery.timers.js +0 -138
  339. data/core/public/javascripts/modernizr-min.js +0 -30
  340. data/core/public/javascripts/rails.js +0 -152
  341. data/core/public/javascripts/refinery/admin.js +0 -1114
  342. data/core/public/javascripts/refinery/boot_wym.js +0 -285
  343. data/core/public/javascripts/refinery/core.js +0 -18
  344. data/core/public/javascripts/refinery/i18n.js +0 -340
  345. data/core/public/javascripts/refinery/nestedsortables.js +0 -164
  346. data/core/public/javascripts/refinery/serializelist.js +0 -66
  347. data/core/public/javascripts/refinery/site_bar.js +0 -16
  348. data/core/public/javascripts/refinery/submenu.js +0 -49
  349. data/core/public/javascripts/wymeditor/jquery.refinery.wymeditor.js +0 -5142
  350. data/core/public/javascripts/wymeditor/lang/ca.js +0 -45
  351. data/core/public/javascripts/wymeditor/lang/cs.js +0 -45
  352. data/core/public/javascripts/wymeditor/lang/da.js +0 -48
  353. data/core/public/javascripts/wymeditor/lang/de.js +0 -45
  354. data/core/public/javascripts/wymeditor/lang/en.js +0 -47
  355. data/core/public/javascripts/wymeditor/lang/es.js +0 -45
  356. data/core/public/javascripts/wymeditor/lang/fa.js +0 -46
  357. data/core/public/javascripts/wymeditor/lang/fr.js +0 -45
  358. data/core/public/javascripts/wymeditor/lang/he.js +0 -45
  359. data/core/public/javascripts/wymeditor/lang/hu.js +0 -45
  360. data/core/public/javascripts/wymeditor/lang/it.js +0 -45
  361. data/core/public/javascripts/wymeditor/lang/lv.js +0 -47
  362. data/core/public/javascripts/wymeditor/lang/nb.js +0 -48
  363. data/core/public/javascripts/wymeditor/lang/nl.js +0 -47
  364. data/core/public/javascripts/wymeditor/lang/nn.js +0 -45
  365. data/core/public/javascripts/wymeditor/lang/pl.js +0 -45
  366. data/core/public/javascripts/wymeditor/lang/pt-BR.js +0 -47
  367. data/core/public/javascripts/wymeditor/lang/pt.js +0 -45
  368. data/core/public/javascripts/wymeditor/lang/rs.js +0 -47
  369. data/core/public/javascripts/wymeditor/lang/ru.js +0 -45
  370. data/core/public/javascripts/wymeditor/lang/sl.js +0 -47
  371. data/core/public/javascripts/wymeditor/lang/sv.js +0 -45
  372. data/core/public/javascripts/wymeditor/lang/tr.js +0 -45
  373. data/core/public/javascripts/wymeditor/lang/zh_cn.js +0 -47
  374. data/core/public/javascripts/wymeditor/skins/refinery/skin.js +0 -48
  375. data/core/public/robots.txt +0 -3
  376. data/core/public/stylesheets/application.css +0 -4
  377. data/core/public/stylesheets/formatting.css +0 -4
  378. data/core/public/stylesheets/home.css +0 -4
  379. data/core/public/stylesheets/refinery/application.css +0 -72
  380. data/core/public/stylesheets/refinery/formatting.css +0 -57
  381. data/core/public/stylesheets/refinery/home.css +0 -0
  382. data/core/public/stylesheets/refinery/refinery.css +0 -1572
  383. data/core/public/stylesheets/refinery/site_bar.css +0 -87
  384. data/core/public/stylesheets/refinery/submenu.css +0 -22
  385. data/core/public/stylesheets/refinery/theme.css +0 -36
  386. data/core/public/stylesheets/refinery/tooltips.css +0 -34
  387. data/core/public/stylesheets/refinery/ui.css +0 -107
  388. data/core/public/stylesheets/theme.css +0 -4
  389. data/core/public/stylesheets/wymeditor/skins/refinery/skin.css +0 -528
  390. data/core/public/stylesheets/wymeditor/skins/refinery/wymiframe.css +0 -96
  391. data/core/public/wymeditor/GPL-license.txt +0 -278
  392. data/core/public/wymeditor/MIT-license.txt +0 -20
  393. data/core/public/wymeditor/README +0 -35
  394. data/core/refinerycms-core.gemspec +0 -20
  395. data/core/spec/lib/refinery/plugins_spec.rb +0 -90
  396. data/dashboard/app/controllers/admin/dashboard_controller.rb +0 -38
  397. data/dashboard/app/helpers/admin/dashboard_helper.rb +0 -24
  398. data/dashboard/app/views/admin/dashboard/_additional_dashboard_menu_items.html.erb +0 -1
  399. data/dashboard/app/views/admin/dashboard/_recent_activity.html.erb +0 -14
  400. data/dashboard/app/views/admin/dashboard/_recent_inquiries.html.erb +0 -11
  401. data/dashboard/app/views/admin/dashboard/index.html.erb +0 -70
  402. data/dashboard/app/views/admin/dashboard/index.rss.builder +0 -26
  403. data/dashboard/config/locales/cs.yml +0 -25
  404. data/dashboard/config/locales/da.yml +0 -25
  405. data/dashboard/config/locales/de.yml +0 -25
  406. data/dashboard/config/locales/el.yml +0 -25
  407. data/dashboard/config/locales/en.yml +0 -25
  408. data/dashboard/config/locales/es.yml +0 -28
  409. data/dashboard/config/locales/fr.yml +0 -25
  410. data/dashboard/config/locales/it.yml +0 -27
  411. data/dashboard/config/locales/lolcat.yml +0 -24
  412. data/dashboard/config/locales/lt.yml +0 -25
  413. data/dashboard/config/locales/lv.yml +0 -27
  414. data/dashboard/config/locales/nb.yml +0 -25
  415. data/dashboard/config/locales/nl.yml +0 -25
  416. data/dashboard/config/locales/pl.yml +0 -29
  417. data/dashboard/config/locales/pt-BR.yml +0 -29
  418. data/dashboard/config/locales/rs.yml +0 -26
  419. data/dashboard/config/locales/ru.yml +0 -29
  420. data/dashboard/config/locales/sl.yml +0 -24
  421. data/dashboard/config/locales/sv.yml +0 -25
  422. data/dashboard/config/locales/zh-CN.yml +0 -25
  423. data/dashboard/config/locales/zh-TW.yml +0 -25
  424. data/dashboard/config/routes.rb +0 -11
  425. data/dashboard/features/dashboard.feature +0 -35
  426. data/dashboard/features/support/paths.rb +0 -14
  427. data/dashboard/lib/dashboard.rb +0 -19
  428. data/dashboard/license.md +0 -21
  429. data/dashboard/readme.md +0 -22
  430. data/dashboard/refinerycms-dashboard.gemspec +0 -20
  431. data/images/app/controllers/admin/images_controller.rb +0 -108
  432. data/images/app/helpers/admin/images_helper.rb +0 -27
  433. data/images/app/models/image.rb +0 -72
  434. data/images/app/views/admin/images/_existing_image.html.erb +0 -73
  435. data/images/app/views/admin/images/_form.html.erb +0 -54
  436. data/images/app/views/admin/images/_grid_view.html.erb +0 -19
  437. data/images/app/views/admin/images/_images.html.erb +0 -2
  438. data/images/app/views/admin/images/_list_view.html.erb +0 -10
  439. data/images/app/views/admin/images/_list_view_image.html.erb +0 -17
  440. data/images/app/views/admin/images/edit.html.erb +0 -1
  441. data/images/app/views/admin/images/index.html.erb +0 -38
  442. data/images/app/views/admin/images/insert.html.erb +0 -47
  443. data/images/app/views/admin/images/new.html.erb +0 -1
  444. data/images/config/locales/cs.yml +0 -41
  445. data/images/config/locales/da.yml +0 -41
  446. data/images/config/locales/de.yml +0 -41
  447. data/images/config/locales/el.yml +0 -41
  448. data/images/config/locales/en.yml +0 -41
  449. data/images/config/locales/es.yml +0 -40
  450. data/images/config/locales/fr.yml +0 -41
  451. data/images/config/locales/it.yml +0 -47
  452. data/images/config/locales/lolcat.yml +0 -41
  453. data/images/config/locales/lt.yml +0 -41
  454. data/images/config/locales/lv.yml +0 -41
  455. data/images/config/locales/nb.yml +0 -42
  456. data/images/config/locales/nl.yml +0 -40
  457. data/images/config/locales/pl.yml +0 -42
  458. data/images/config/locales/pt-BR.yml +0 -42
  459. data/images/config/locales/rs.yml +0 -42
  460. data/images/config/locales/ru.yml +0 -41
  461. data/images/config/locales/sl.yml +0 -40
  462. data/images/config/locales/sv.yml +0 -41
  463. data/images/config/locales/zh-CN.yml +0 -41
  464. data/images/config/locales/zh-TW.yml +0 -41
  465. data/images/config/routes.rb +0 -11
  466. data/images/db/migrate/20100913234707_create_refinerycms_images_schema.rb +0 -23
  467. data/images/features/manage_images.feature +0 -49
  468. data/images/features/step_definitions/image_steps.rb +0 -40
  469. data/images/features/support/factories.rb +0 -5
  470. data/images/features/support/paths.rb +0 -17
  471. data/images/features/uploads/beach.jpeg +0 -0
  472. data/images/features/uploads/id-rather-be-here.jpg +0 -0
  473. data/images/features/uploads/refinery_is_awesome.txt +0 -1
  474. data/images/lib/generators/refinerycms_images_generator.rb +0 -8
  475. data/images/lib/images.rb +0 -59
  476. data/images/license.md +0 -21
  477. data/images/readme.md +0 -34
  478. data/images/refinerycms-images.gemspec +0 -20
  479. data/images/spec/models/image_spec.rb +0 -87
  480. data/images/spec/uploads/beach.jpeg +0 -0
  481. data/pages/app/controllers/admin/page_parts_controller.rb +0 -24
  482. data/pages/app/controllers/admin/pages_controller.rb +0 -37
  483. data/pages/app/controllers/admin/pages_dialogs_controller.rb +0 -87
  484. data/pages/app/controllers/pages_controller.rb +0 -32
  485. data/pages/app/helpers/pages_helper.rb +0 -2
  486. data/pages/app/models/page.rb +0 -290
  487. data/pages/app/models/page_part.rb +0 -23
  488. data/pages/app/presenters/page_presenter.rb +0 -7
  489. data/pages/app/views/admin/pages/_form.html.erb +0 -61
  490. data/pages/app/views/admin/pages/_form_advanced_options.html.erb +0 -79
  491. data/pages/app/views/admin/pages/_form_advanced_options_seo.html.erb +0 -24
  492. data/pages/app/views/admin/pages/_form_fields_after_title.html.erb +0 -1
  493. data/pages/app/views/admin/pages/_form_new_page_parts.html.erb +0 -14
  494. data/pages/app/views/admin/pages/_form_page_parts.html.erb +0 -47
  495. data/pages/app/views/admin/pages/_locale_picker.html.erb +0 -11
  496. data/pages/app/views/admin/pages/_page.html.erb +0 -33
  497. data/pages/app/views/admin/pages/_page_part_field.html.erb +0 -5
  498. data/pages/app/views/admin/pages/_sortable_list.html.erb +0 -5
  499. data/pages/app/views/admin/pages/edit.html.erb +0 -1
  500. data/pages/app/views/admin/pages/index.html.erb +0 -40
  501. data/pages/app/views/admin/pages/new.html.erb +0 -1
  502. data/pages/app/views/admin/pages_dialogs/_page_link.html.erb +0 -13
  503. data/pages/app/views/admin/pages_dialogs/link_to.html.erb +0 -141
  504. data/pages/app/views/pages/home.html.erb +0 -1
  505. data/pages/app/views/pages/show.html.erb +0 -1
  506. data/pages/config/locales/cs.yml +0 -84
  507. data/pages/config/locales/da.yml +0 -84
  508. data/pages/config/locales/de.yml +0 -84
  509. data/pages/config/locales/el.yml +0 -84
  510. data/pages/config/locales/en.yml +0 -84
  511. data/pages/config/locales/es.yml +0 -83
  512. data/pages/config/locales/fr.yml +0 -84
  513. data/pages/config/locales/it.yml +0 -98
  514. data/pages/config/locales/lolcat.yml +0 -83
  515. data/pages/config/locales/lt.yml +0 -85
  516. data/pages/config/locales/lv.yml +0 -86
  517. data/pages/config/locales/nb.yml +0 -85
  518. data/pages/config/locales/nl.yml +0 -81
  519. data/pages/config/locales/pl.yml +0 -85
  520. data/pages/config/locales/pt-BR.yml +0 -85
  521. data/pages/config/locales/rs.yml +0 -84
  522. data/pages/config/locales/ru.yml +0 -108
  523. data/pages/config/locales/sl.yml +0 -83
  524. data/pages/config/locales/sv.yml +0 -84
  525. data/pages/config/locales/zh-CN.yml +0 -84
  526. data/pages/config/locales/zh-TW.yml +0 -84
  527. data/pages/config/routes.rb +0 -21
  528. data/pages/db/migrate/20100913234708_create_refinerycms_pages_schema.rb +0 -53
  529. data/pages/db/migrate/20101214040815_translate_page_plugin.rb +0 -29
  530. data/pages/db/migrate/20101216194133_remove_cached_slug_from_pages.rb +0 -9
  531. data/pages/db/seeds/pages.rb +0 -43
  532. data/pages/features/manage_pages.feature +0 -47
  533. data/pages/features/step_definitions/page_steps.rb +0 -53
  534. data/pages/features/support/paths.rb +0 -26
  535. data/pages/features/visit_pages.feature +0 -47
  536. data/pages/lib/generators/refinerycms_pages_generator.rb +0 -8
  537. data/pages/lib/pages.rb +0 -36
  538. data/pages/lib/pages/marketable_routes.rb +0 -3
  539. data/pages/lib/pages/tabs.rb +0 -30
  540. data/pages/license.md +0 -21
  541. data/pages/readme.md +0 -156
  542. data/pages/refinerycms-pages.gemspec +0 -21
  543. data/pages/spec/models/page_spec.rb +0 -155
  544. data/resources/app/controllers/admin/resources_controller.rb +0 -89
  545. data/resources/app/models/resource.rb +0 -53
  546. data/resources/app/views/admin/resources/_existing_resource.html.erb +0 -32
  547. data/resources/app/views/admin/resources/_form.html.erb +0 -55
  548. data/resources/app/views/admin/resources/_resource.html.erb +0 -17
  549. data/resources/app/views/admin/resources/_resources.html.erb +0 -10
  550. data/resources/app/views/admin/resources/edit.html.erb +0 -1
  551. data/resources/app/views/admin/resources/index.html.erb +0 -31
  552. data/resources/app/views/admin/resources/insert.html.erb +0 -54
  553. data/resources/app/views/admin/resources/new.html.erb +0 -1
  554. data/resources/config/locales/cs.yml +0 -34
  555. data/resources/config/locales/da.yml +0 -34
  556. data/resources/config/locales/de.yml +0 -34
  557. data/resources/config/locales/el.yml +0 -34
  558. data/resources/config/locales/en.yml +0 -34
  559. data/resources/config/locales/es.yml +0 -33
  560. data/resources/config/locales/fr.yml +0 -34
  561. data/resources/config/locales/it.yml +0 -43
  562. data/resources/config/locales/lolcat.yml +0 -34
  563. data/resources/config/locales/lt.yml +0 -34
  564. data/resources/config/locales/lv.yml +0 -34
  565. data/resources/config/locales/nb.yml +0 -34
  566. data/resources/config/locales/nl.yml +0 -33
  567. data/resources/config/locales/pl.yml +0 -35
  568. data/resources/config/locales/pt-BR.yml +0 -34
  569. data/resources/config/locales/rs.yml +0 -35
  570. data/resources/config/locales/ru.yml +0 -34
  571. data/resources/config/locales/sl.yml +0 -33
  572. data/resources/config/locales/sv.yml +0 -34
  573. data/resources/config/locales/zh-CN.yml +0 -34
  574. data/resources/config/locales/zh-TW.yml +0 -34
  575. data/resources/config/routes.rb +0 -11
  576. data/resources/db/migrate/20100913234709_create_refinerycms_resources_schema.rb +0 -21
  577. data/resources/features/manage_files.feature +0 -43
  578. data/resources/features/step_definitions/file_steps.rb +0 -21
  579. data/resources/features/support/paths.rb +0 -17
  580. data/resources/features/uploads/beach.jpeg +0 -0
  581. data/resources/features/uploads/refinery_is_awesome.txt +0 -1
  582. data/resources/lib/generators/refinerycms_resources_generator.rb +0 -8
  583. data/resources/lib/resources.rb +0 -58
  584. data/resources/license.md +0 -21
  585. data/resources/readme.md +0 -9
  586. data/resources/refinerycms-resources.gemspec +0 -20
  587. data/resources/spec/models/resource_spec.rb +0 -91
  588. data/resources/spec/uploads/refinery_is_awesome.txt +0 -1
  589. data/settings/app/controllers/admin/refinery_settings_controller.rb +0 -77
  590. data/settings/app/helpers/refinery_settings_helper.rb +0 -25
  591. data/settings/app/models/refinery_setting.rb +0 -212
  592. data/settings/app/views/admin/refinery_settings/_form.html.erb +0 -62
  593. data/settings/app/views/admin/refinery_settings/_refinery_setting.html.erb +0 -23
  594. data/settings/app/views/admin/refinery_settings/_refinery_settings.html.erb +0 -5
  595. data/settings/app/views/admin/refinery_settings/edit.html.erb +0 -1
  596. data/settings/app/views/admin/refinery_settings/index.html.erb +0 -49
  597. data/settings/app/views/admin/refinery_settings/new.html.erb +0 -1
  598. data/settings/config/locales/cs.yml +0 -45
  599. data/settings/config/locales/da.yml +0 -46
  600. data/settings/config/locales/de.yml +0 -46
  601. data/settings/config/locales/el.yml +0 -46
  602. data/settings/config/locales/en.yml +0 -46
  603. data/settings/config/locales/es.yml +0 -43
  604. data/settings/config/locales/fr.yml +0 -44
  605. data/settings/config/locales/it.yml +0 -36
  606. data/settings/config/locales/lolcat.yml +0 -43
  607. data/settings/config/locales/lt.yml +0 -46
  608. data/settings/config/locales/lv.yml +0 -46
  609. data/settings/config/locales/nb.yml +0 -47
  610. data/settings/config/locales/nl.yml +0 -46
  611. data/settings/config/locales/pl.yml +0 -46
  612. data/settings/config/locales/pt-BR.yml +0 -44
  613. data/settings/config/locales/rs.yml +0 -46
  614. data/settings/config/locales/ru.yml +0 -43
  615. data/settings/config/locales/sl.yml +0 -25
  616. data/settings/config/locales/sv.yml +0 -45
  617. data/settings/config/locales/zh-CN.yml +0 -46
  618. data/settings/config/locales/zh-TW.yml +0 -46
  619. data/settings/config/routes.rb +0 -8
  620. data/settings/db/migrate/20100913234710_create_refinerycms_settings_schema.rb +0 -24
  621. data/settings/db/migrate/20100926142529_add_value_type_to_refinery_settings.rb +0 -9
  622. data/settings/features/manage_refinery_settings.feature +0 -5
  623. data/settings/features/step_definitions/setting_steps.rb +0 -9
  624. data/settings/features/support/paths.rb +0 -14
  625. data/settings/lib/generators/refinerycms_settings_generator.rb +0 -8
  626. data/settings/lib/settings.rb +0 -16
  627. data/settings/license.md +0 -21
  628. data/settings/readme.md +0 -55
  629. data/settings/refinerycms-settings.gemspec +0 -20
  630. data/settings/spec/models/refinery_setting_spec.rb +0 -101
@@ -1,1114 +0,0 @@
1
- var shiftHeld = false;
2
- var initialLoad = true;
3
- $(document).ready(function(){
4
- init_interface();
5
- init_sortable_menu();
6
- init_submit_continue();
7
- init_modal_dialogs();
8
- init_tooltips();
9
- init_ajaxy_pagination();
10
- });
11
-
12
- if(typeof(window.onpopstate) == "object"){
13
- $(window).bind('popstate', function(e) {
14
- // this fires on initial page load too which we don't need.
15
- if(!initialLoad) {
16
- $.get(location.href, function(data) {
17
- $('.pagination_container').slideTo(data);
18
- });
19
- }
20
- initialLoad = false;
21
- });
22
- }
23
-
24
- $.fn.slideTo = function(response) {
25
- $(this).html(response);
26
- $(this).applyMinimumHeightFromChildren();
27
- $(this).find('.pagination_frame').removeClass('frame_right').addClass('frame_center');
28
- init_modal_dialogs();
29
- init_tooltips();
30
- return $(this);
31
- }
32
-
33
- $.fn.applyMinimumHeightFromChildren = function() {
34
- child_heights = 0;
35
- $(this).children().each(function(i, child){
36
- child_heights += $(child).height();
37
- $.each(['marginTop', 'marginBottom', 'paddingTop', 'paddingBottom'], function(i, attr) {
38
- child_heights += (parseInt($(child).css(attr)) || 0);
39
- });
40
- });
41
- $(this).css('min-height', child_heights);
42
- return $(this);
43
- }
44
-
45
- init_ajaxy_pagination = function(){
46
- if(typeof(window.history.pushState) == 'function' && $('.pagination_container').length > 0){
47
- var pagination_pages = $('.pagination_container .pagination a');
48
- pagination_pages.live('click',function(e) {
49
- this.href = (this.href.replace(/(\&(amp\;)?)?from_page\=\d+/, '')
50
- + '&from_page=' + $(this).parent().find('em').text()).replace('?&', '?');
51
- history.pushState({ path: this.path }, '', this.href);
52
- $.get(this.href, function(data) {
53
- $('.pagination_container').slideTo(data)
54
- })
55
- e.preventDefault();
56
- });
57
- }
58
- $('.pagination_container').applyMinimumHeightFromChildren();
59
- if ($('.pagination_container').find('.pagination').length == 0) {
60
- $('.pagination_frame').css('top', '0px');
61
- }
62
- }
63
-
64
- init_interface = function() {
65
- if (parent && parent.document.location.href != document.location.href) {
66
- $('body#dialog_container.dialog').addClass('iframed');
67
- }
68
- $('input:submit:not(.button)').addClass('button');
69
-
70
- if (!$.browser.msie) {
71
- $('#page_container, .wym_box').corner('5px bottom');
72
- $('.wym_box').corner('5px tr');
73
- $('.field > .wym_box').corner('5px tl');
74
- $('.wym_iframe iframe').corner('2px');
75
- $('.form-actions:not(".form-actions-dialog")').corner('5px');
76
- }
77
- $('#recent_activity li a, #recent_inquiries li a').each(function(i, a) {
78
- $(this).textTruncate({
79
- width: $(this).width()
80
- , tooltip: false
81
- });
82
- });
83
-
84
- // make sure that users can tab to wymeditor fields and add an overlay while loading.
85
- $('textarea.wymeditor').each(function() {
86
- textarea = $(this);
87
- if ((instance = WYMeditor.INSTANCES[$((textarea.next('.wym_box').find('iframe').attr('id')||'').split('_')).last().get(0)]) != null) {
88
- if ((next = textarea.parent().next()) != null && next.length > 0) {
89
- next.find('input, textarea').keydown($.proxy(function(e) {
90
- shiftHeld = e.shiftKey;
91
- if (shiftHeld && e.keyCode == $.ui.keyCode.TAB) {
92
- this._iframe.contentWindow.focus();
93
- e.preventDefault();
94
- }
95
- }, instance)).keyup(function(e) {
96
- shiftHeld = false;
97
- });
98
- }
99
- if ((prev = textarea.parent().prev()) != null && prev.length > 0) {
100
- prev.find('input, textarea').keydown($.proxy(function(e) {
101
- if (e.keyCode == $.ui.keyCode.TAB) {
102
- this._iframe.contentWindow.focus();
103
- e.preventDefault();
104
- }
105
- }, instance));
106
- }
107
- }
108
- });
109
-
110
- // ensure that the menu isn't wider than the page_container or else it looks silly to round that corner.
111
- if (($menu = $('#menu')).length > 0) {
112
- $menu.jcarousel({
113
- vertical: false
114
- , scroll: 1
115
- , buttonNextHTML: "<img src='/images/refinery/carousel-right.png' alt='down' height='15' width='10' />"
116
- , buttonPrevHTML: "<img src='/images/refinery/carousel-left.png' alt='up' height='15' width='10' />"
117
- , listTag: $menu.get(0).tagName.toLowerCase()
118
- , itemTag: $menu.children(':first').get(0).tagName.toLowerCase()
119
- });
120
-
121
- if ($menu.outerWidth() < $('#page_container').outerWidth()) {
122
- $("#page_container:not('.login #page_container')").corner('5px tr');
123
- } else {
124
- $("#page_container:not('.login #page_container')").uncorner();
125
- }
126
- }
127
-
128
- $('#current_locale li a').click(function(e) {
129
- $('#current_locale li a span').each(function(span){
130
- $(this).css('display', $(this).css('display') == 'none' ? '' : 'none');
131
- });
132
- $('#other_locales').animate({opacity: 'toggle', height: 'toggle'}, 250);
133
- $('html,body').animate({
134
- scrollTop: $('#other_locales').parent().offset().top
135
- }, 250);
136
- e.preventDefault();
137
- });
138
-
139
- $('#existing_image img').load(function(){
140
- $('form.edit_image .form-actions').css({
141
- 'margin-top': ($('#existing_image').height() - $('form.edit_image').height() + 8)
142
- });
143
- });
144
-
145
- $('.form-actions .form-actions-left input:submit#submit_button').click(function(e) {
146
- $("<img src='/images/refinery/icons/ajax-loader.gif' width='16' height='16' class='save-loader' />").appendTo($(this).parent());
147
- });
148
-
149
- $('a.suppress').live('click', function(e){
150
- e.preventDefault();
151
- });
152
- };
153
-
154
- init_modal_dialogs = function(){
155
- $('a[href*="dialog=true"]').not('#dialog_container a').each(function(i, anchor) {
156
- $(anchor).data({
157
- 'dialog-width': parseInt($($(anchor).attr('href').match("width=([0-9]*)")).last().get(0), 10)||928
158
- , 'dialog-height': parseInt($($(anchor).attr('href').match("height=([0-9]*)")).last().get(0), 10)||473
159
- , 'dialog-title': ($(anchor).attr('title') || $(anchor).attr('name') || $(anchor).html() || null)
160
- }).attr('href', $(anchor).attr('href').replace(/(\&(amp\;)?)?dialog\=true/, '')
161
- .replace(/(\&(amp\;)?)?width\=\d+/, '')
162
- .replace(/(\&(amp\;)?)?height\=\d+/, '')
163
- .replace(/(\?&(amp\;)?)/, '?')
164
- .replace(/\?$/, ''))
165
- .click(function(e){
166
- $anchor = $(this);
167
- iframe_src = (iframe_src = $anchor.attr('href'))
168
- + (iframe_src.indexOf('?') > -1 ? '&' : '?')
169
- + 'app_dialog=true&dialog=true';
170
-
171
- iframe = $("<iframe id='dialog_iframe' frameborder='0' marginheight='0' marginwidth='0' border='0'></iframe>");
172
- if(!$.browser.msie) { iframe.corner('8px'); }
173
- iframe.dialog({
174
- title: $anchor.data('dialog-title')
175
- , modal: true
176
- , resizable: false
177
- , autoOpen: true
178
- , width: $anchor.data('dialog-width')
179
- , height: $anchor.data('dialog-height')
180
- , open: onOpenDialog
181
- , close: onCloseDialog
182
- });
183
-
184
- iframe.attr('src', iframe_src);
185
- e.preventDefault();
186
- });
187
- });
188
- };
189
-
190
- init_sortable_menu = function(){
191
- var $menu = $('#menu');
192
-
193
- if($menu.length === 0){return;}
194
-
195
- $menu.sortable({
196
- axis: 'x',
197
- cursor: 'crosshair',
198
- connectWith: '.nested',
199
- update: function(){
200
- $.post('/refinery/update_menu_positions', $menu.sortable('serialize', {
201
- key: 'menu[]'
202
- , expression: /plugin_([\w]*)$/
203
- }));
204
- }
205
- }).tabs();
206
- //Initial status disabled
207
- $menu.sortable('disable');
208
-
209
- $menu.find('#menu_reorder').click(function(e){
210
- trigger_reordering(e, true);
211
- });
212
-
213
- $menu.find('#menu_reorder_done').click(function(e){
214
- trigger_reordering(e, false);
215
- });
216
-
217
- $menu.find('> a').corner('top 5px');
218
- };
219
-
220
- trigger_reordering = function(e, enable) {
221
- e.preventDefault();
222
- $('#menu_reorder, #menu_reorder_done').toggle();
223
- $('#site_bar, #content').fadeTo(500, enable ? 0.35 : 1);
224
-
225
- if(enable) {
226
- $menu.find('.tab a').click(function(ev){
227
- ev.preventDefault();
228
- });
229
- } else {
230
- $menu.find('.tab a').unbind('click');
231
- }
232
-
233
- $menu.sortable(enable ? 'enable' : 'disable');
234
- };
235
-
236
- init_submit_continue = function(){
237
- $('#submit_continue_button').click(submit_and_continue);
238
-
239
- $('form').change(function(e) {
240
- $(this).attr('data-changes-made', true);
241
- });
242
-
243
- if ((continue_editing_button = $('#continue_editing')).length > 0 && continue_editing_button.attr('rel') != 'no-prompt') {
244
- $('#editor_switch a').click(function(e) {
245
- if ($('form[data-changes-made]').length > 0) {
246
- if (!confirm("Any changes you've made will be lost. Are you sure you want to continue without saving?")) {
247
- e.preventDefault();
248
- }
249
- }
250
- });
251
- }
252
- };
253
-
254
- submit_and_continue = function(e, redirect_to) {
255
- // ensure wymeditors are up to date.
256
- if ($(this).hasClass('wymupdate')) {
257
- $.each(WYMeditor.INSTANCES, function(index, wym)
258
- {
259
- wym.update();
260
- });
261
- }
262
-
263
- $('#continue_editing').val(true);
264
- $('#flash').fadeOut(250);
265
-
266
- $('.fieldWithErrors').removeClass('fieldWithErrors').addClass('field');
267
- $('#flash_container .errorExplanation').remove();
268
-
269
- $.post($('#continue_editing').get(0).form.action, $($('#continue_editing').get(0).form).serialize(), function(data) {
270
- if (($flash_container = $('#flash_container')).length > 0) {
271
- $flash_container.html(data);
272
-
273
- $('#flash').css({'width': 'auto', 'visibility': null}).fadeIn(550);
274
-
275
- $('.errorExplanation').not($('#flash_container .errorExplanation')).remove();
276
-
277
- if ((error_fields = $('#fieldsWithErrors').val()) != null) {
278
- $.each(error_fields.split(','), function() {
279
- $("#" + this).wrap("<div class='fieldWithErrors' />");
280
- });
281
- } else if (redirect_to) {
282
- window.location = redirect_to;
283
- }
284
-
285
- $('.fieldWithErrors:first :input:first').focus();
286
-
287
- $('#continue_editing').val(false);
288
-
289
- init_flash_messages();
290
- }
291
- });
292
-
293
- e.preventDefault();
294
- };
295
-
296
- init_tooltips = function(args){
297
- $($(args != null ? args : 'a[title], span[title], #image_grid img[title], *[tooltip]')).not('.no-tooltip').each(function(index, element)
298
- {
299
- // create tooltip on hover and destroy it on hoveroff.
300
- $(element).hover(function(e) {
301
- if (e.type == 'mouseenter' || e.type == 'mouseover') {
302
- $(this).oneTime(350, 'tooltip', $.proxy(function() {
303
- $('.tooltip').remove();
304
- tooltip = $("<div class='tooltip'><div><span></span></div></div>").appendTo('#tooltip_container');
305
- tooltip.find("span").html($(this).attr('tooltip'));
306
- if(!$.browser.msie) {
307
- tooltip.corner('6px').find('span').corner('6px');
308
- }
309
-
310
- tooltip_nib_image = $.browser.msie ? 'tooltip-nib.gif' : 'tooltip-nib.png';
311
- nib = $("<img src='/images/refinery/"+tooltip_nib_image+"' class='tooltip-nib'/>").appendTo('#tooltip_container');
312
-
313
- tooltip.css({
314
- 'opacity': 0
315
- , 'maxWidth': '300px'
316
- });
317
- required_left_offset = $(this).offset().left - (tooltip.outerWidth() / 2) + ($(this).outerWidth() / 2);
318
- tooltip.css('left', (required_left_offset > 0 ? required_left_offset : 0));
319
-
320
- var tooltip_offset = tooltip.offset();
321
- var tooltip_outer_width = tooltip.outerWidth();
322
- if (tooltip_offset && (tooltip_offset.left + tooltip_outer_width) > (window_width = $(window).width())) {
323
- tooltip.css('left', window_width - tooltip_outer_width);
324
- }
325
-
326
- tooltip.css({
327
- 'top': $(this).offset().top - tooltip.outerHeight() - 2
328
- });
329
-
330
- nib.css({
331
- 'opacity': 0
332
- });
333
-
334
- if (tooltip_offset = tooltip.offset()) {
335
- nib.css({
336
- 'left': $(this).offset().left + ($(this).outerWidth() / 2) - 5
337
- , 'top': tooltip_offset.top + tooltip.height()
338
- });
339
- }
340
-
341
- try {
342
- tooltip.animate({
343
- top: tooltip_offset.top - 10
344
- , opacity: 1
345
- }, 200, 'swing');
346
- nib.animate({
347
- top: nib.offset().top - 10
348
- , opacity: 1
349
- }, 200);
350
- } catch(e) {
351
- tooltip.show();
352
- nib.show();
353
- }
354
- }, $(this)));
355
- } else if (e.type == 'mouseleave' || e.type == 'mouseout') {
356
- $(this).stopTime('tooltip');
357
- if ((tt_offset = (tooltip = $('.tooltip')).css('z-index', '-1').offset()) == null) {
358
- tt_offset = {'top':0,'left':0};
359
- }
360
- tooltip.animate({
361
- top: tt_offset.top - 20
362
- , opacity: 0
363
- }, 125, 'swing', function(){
364
- $(this).remove();
365
- });
366
- if ((nib_offset = (nib = $('.tooltip-nib')).offset()) == null) {
367
- nib_offset = {'top':0,'left':0};
368
- }
369
- nib.animate({
370
- top: nib_offset.top - 20
371
- , opacity: 0
372
- }, 125, 'swing', function(){
373
- $(this).remove();
374
- });
375
- }
376
- }).click(function(e) {
377
- $(this).stopTime('tooltip');
378
- });
379
-
380
- if ($(element).attr('tooltip') == null) {
381
- $(element).attr('tooltip', $(element).attr('title'));
382
- }
383
- // wipe clean the title on any children too.
384
- $elements = $(element).add($(element).children('img')).removeAttr('title');
385
- // if we're unlucky and in Internet Explorer then we have to say goodbye to 'alt', too.
386
- if ($.browser.msie){$elements.removeAttr('alt');}
387
- });
388
- };
389
-
390
- var link_tester = {
391
- initialised: false
392
- , init: function(test_url, test_email) {
393
- this.test_url = test_url;
394
- this.test_email = test_email;
395
- this.initialised = true;
396
- },
397
-
398
- email: function(value, callback) {
399
- $.getJSON(link_tester.test_email, {email: value}, function(data){
400
- callback(data.result == 'success');
401
- });
402
- },
403
-
404
- url: function(value, callback) {
405
- $.getJSON(link_tester.test_url, {'url': value}, function(data){
406
- callback(data.result == 'success');
407
- });
408
- },
409
-
410
- validate_textbox: function(validation_method, textbox_id, callback) {
411
- var icon = '';
412
- var loader_img = $("<img id='" + textbox_id.replace('#','') + "_test_loader' src='/images/refinery/ajax-loader.gif' alt='Testing...' style='display: none;'/>");
413
- var result_span = $("<span id='" + textbox_id.replace('#','') + "_test_result'></span>");
414
-
415
- loader_img.insertAfter($(textbox_id));
416
- result_span.insertAfter(loader_img);
417
-
418
- $(textbox_id).bind('paste keypress',function(){
419
- $(textbox_id).stop(true); // Clear the current queue; if we weren't checking yet, cancel it.
420
- $(textbox_id + '_test_loader').hide();
421
- $(textbox_id + '_test_result').hide();
422
- $(textbox_id + '_test_result').removeClass('success_icon').removeClass('failure_icon');
423
-
424
- // Wait one second before checking.
425
- $(textbox_id).delay(1000).queue(function () {
426
- $(textbox_id + '_test_loader').show();
427
- $(textbox_id + '_test_result').hide();
428
- $(textbox_id + '_test_result').removeClass('success_icon').removeClass('failure_icon');
429
-
430
- validation_method(this.value, function (success) {
431
- if (success) {
432
- icon = 'success_icon';
433
- }else{
434
- icon = 'failure_icon';
435
- }
436
- $(textbox_id + '_test_result').addClass(icon).show();
437
- $(textbox_id + '_test_loader').hide();
438
- });
439
-
440
- if (callback) { callback($(textbox_id)); }
441
-
442
- $(this).dequeue();
443
- }); // queue
444
- }); // bind
445
- },
446
-
447
- validate_url_textbox: function(textbox_id, callback) {
448
- link_tester.validate_textbox(link_tester.url, textbox_id, callback);
449
- },
450
-
451
- validate_email_textbox: function(textbox_id, callback) {
452
- link_tester.validate_textbox(link_tester.email, textbox_id, callback);
453
- }
454
-
455
- };
456
-
457
- var link_dialog = {
458
- initialised: false
459
- , init: function(){
460
- this.init_tabs();
461
- this.init_resources_submit();
462
- this.init_close();
463
- this.page_tab();
464
- this.web_tab();
465
- this.email_tab();
466
- this.initialised = true;
467
- },
468
-
469
- init_tabs: function(){
470
- var radios = $('#dialog_menu_left input:radio');
471
- var selected = radios.parent().filter(".selected_radio").find('input:radio').first() || radios.first();
472
-
473
- radios.click(function(){
474
- link_dialog.switch_area($(this));
475
- });
476
-
477
- selected.attr('checked', 'true');
478
- link_dialog.switch_area(selected);
479
- },
480
-
481
- init_resources_submit: function(){
482
- $('#existing_resource_area .form-actions-dialog #submit_button').click(function(e){
483
- e.preventDefault();
484
- if((resource_selected = $('#existing_resource_area_content ul li.linked a')).length > 0) {
485
- resourceUrl = parseURL(resource_selected.attr('href'));
486
- relevant_href = resourceUrl.pathname;
487
-
488
- // Add any alternate resource stores that need a absolute URL in the regex below
489
- if(resourceUrl.hostname.match(/s3.amazonaws.com/)) {
490
- relevant_href = resourceUrl.protocol + '//' + resourceUrl.host + relevant_href;
491
- }
492
-
493
- if (typeof(resource_picker.callback) == "function") {
494
- resource_picker.callback({
495
- id: resource_selected.attr('id').replace("resource_", "")
496
- , href: relevant_href
497
- , html: resource_selected.html()
498
- });
499
- }
500
- }
501
- });
502
-
503
- $('.form-actions-dialog #cancel_button').trigger('click');
504
- },
505
-
506
- init_close: function(){
507
- $('.form-actions-dialog #cancel_button').not('.wym_iframe_body .form-actions-dialog #cancel_button').click(close_dialog);
508
-
509
- if (parent
510
- && parent.document.location.href != document.location.href
511
- && parent.document.getElementById('wym_dialog_submit') != null) {
512
- $('#dialog_container .form-actions input#submit_button').click(function(e) {
513
- e.preventDefault();
514
- $(parent.document.getElementById('wym_dialog_submit')).click();
515
- });
516
- $('#dialog_container .form-actions a.close_dialog').click(close_dialog);
517
- }
518
- },
519
-
520
- switch_area: function(area){
521
- $('#dialog_menu_left .selected_radio').removeClass('selected_radio');
522
- $(area).parent().addClass('selected_radio');
523
- $('#dialog_main .dialog_area').hide();
524
- $('#' + $(area).val() + '_area').show();
525
- },
526
-
527
- //Same for resources tab
528
- page_tab: function(){
529
- $('.link_list li').click(function(e){
530
- e.preventDefault();
531
-
532
- $('.link_list li.linked').removeClass('linked');
533
- $(this).addClass('linked');
534
-
535
- var link = $(this).children('a.page_link').get(0);
536
- var port = (window.location.port.length > 0 ? (":" + window.location.port) : "");
537
- var url = link.href.replace(window.location.protocol + "//" + window.location.hostname + port, "");
538
-
539
- link_dialog.update_parent(url, link.rel.replace(/\ ?<em>.+?<\/em>/, ''));
540
- });
541
- },
542
-
543
- web_tab: function(){
544
- link_tester.validate_url_textbox("#web_address_text", function() {
545
- link_dialog.update_parent( $('#web_address_text').val(),
546
- $('#web_address_text').val(),
547
- ($('#web_address_target_blank').checked ? "_blank" : "")
548
- );
549
- });
550
-
551
- $('#web_address_target_blank').click(function(){
552
- parent.document.getElementById('wym_target').value = this.checked ? "_blank" : "";
553
- });
554
- },
555
-
556
- email_tab: function() {
557
- $('#email_address_text, #email_default_subject_text, #email_default_body_text').change(function(e){
558
- var default_subject = $('#email_default_subject_text').val(),
559
- default_body = $('#email_default_body_text').val(),
560
- mailto = "mailto:" + $('#email_address_text').val(),
561
- modifier = "?",
562
- icon = '';
563
-
564
- $('#email_address_test_loader').show();
565
- $('#email_address_test_result').hide();
566
- $('#email_address_test_result').removeClass('success_icon').removeClass('failure_icon');
567
-
568
-
569
- link_tester.email(mailto, function (success) {
570
- if (success) {
571
- icon = 'success_icon';
572
- }else{
573
- icon = 'failure_icon';
574
- }
575
- $('#email_address_test_result').addClass(icon).show();
576
- $('#email_address_test_loader').hide();
577
- });
578
-
579
- if(default_subject.length > 0){
580
- mailto += modifier + "subject=" + default_subject;
581
- modifier = "&";
582
- }
583
-
584
- if(default_body.length > 0){
585
- mailto += modifier + "body=" + default_body;
586
- modifier = "&";
587
- }
588
-
589
- link_dialog.update_parent(mailto, mailto.replace('mailto:', ''));
590
- });
591
- },
592
-
593
- update_parent: function(url, title, target) {
594
- if (parent != null) {
595
- if ((wym_href = parent.document.getElementById('wym_href')) != null) {
596
- wym_href.value = url;
597
- }
598
- if ((wym_title = parent.document.getElementById('wym_title')) != null) {
599
- wym_title.value = title;
600
- }
601
- if ((wym_target = parent.document.getElementById('wym_target')) != null) {
602
- wym_target.value = target || "";
603
- }
604
- }
605
- }
606
- };
607
-
608
- var page_options = {
609
- initialised: false
610
- , init: function(enable_parts, new_part_url, del_part_url){
611
- // set the page tabs up, but ensure that all tabs are shown so that when wymeditor loads it has a proper height.
612
- page_options.tabs = $('#page-tabs');
613
- page_options.tabs.tabs({tabTemplate: '<li><a href="#{href}">#{label}</a></li>'});
614
- page_options.tabs.find(' > ul li a').corner('top 5px');
615
-
616
- part_shown = $('#page-tabs .page_part.field').not('.ui-tabs-hide');
617
- $('#page-tabs .page_part.field').removeClass('ui-tabs-hide');
618
-
619
- this.enable_parts = enable_parts;
620
- this.new_part_url = new_part_url;
621
- this.del_part_url = del_part_url;
622
- this.show_options();
623
- this.title_type();
624
-
625
- $(document).ready($.proxy(function(){
626
- // hide the tabs that are supposed to be hidden.
627
- $('#page-tabs .page_part.field').not(this).addClass('ui-tabs-hide');
628
- $('#page-tabs > ul li a').corner('top 5px');
629
- }, part_shown));
630
-
631
- if(this.enable_parts){
632
- this.page_part_dialog();
633
- }
634
- this.initialised = true;
635
- },
636
-
637
- show_options: function(){
638
- $('#toggle_advanced_options').click(function(e){
639
- e.preventDefault();
640
- $('#more_options').animate({opacity: 'toggle', height: 'toggle'}, 250);
641
-
642
- $('html,body').animate({
643
- scrollTop: $('#toggle_advanced_options').parent().offset().top
644
- }, 250);
645
- });
646
- },
647
-
648
- title_type: function(){
649
- $("input[name=page\[custom_title_type\]]").change(function(){
650
- $('#custom_title_text, #custom_title_image').hide();
651
- $('#custom_title_' + this.value).show();
652
- });
653
- },
654
-
655
- page_part_dialog: function(){
656
- $('#new_page_part_dialog').dialog({
657
- title: 'Create Content Section',
658
- modal: true,
659
- resizable: false,
660
- autoOpen: false,
661
- width: 600,
662
- height: 200
663
- });
664
-
665
- $('#add_page_part').click(function(e){
666
- e.preventDefault();
667
- $('#new_page_part_dialog').dialog('open');
668
- });
669
-
670
- $('#new_page_part_save').click(function(e){
671
- e.preventDefault();
672
-
673
- var part_title = $('#new_page_part_title').val();
674
-
675
- if(part_title.length > 0){
676
- var tab_title = part_title.toLowerCase().replace(" ", "_");
677
-
678
- if ($('#part_' + tab_title).size() === 0) {
679
- $.get(page_options.new_part_url,
680
- {
681
- title: part_title
682
- , part_index: $('#new_page_part_index').val()
683
- , body: ''
684
- }
685
- , function(data, status){
686
- $('#submit_continue_button').remove();
687
- // Add a new tab for the new content section.
688
- $(data).appendTo('#page_part_editors');
689
- page_options.tabs.tabs('add', '#page_part_new_' + $('#new_page_part_index').val(), part_title);
690
- page_options.tabs.tabs('select', $('#new_page_part_index').val());
691
-
692
- // turn the new textarea into a wymeditor.
693
- $('#page_parts_attributes_' + $('#new_page_part_index').val() + "_body").wymeditor(wymeditor_boot_options);
694
-
695
- // hook into wymedtior to instruct it to select this new tab again once it has loaded.
696
- WYMeditor.onload_functions.push(function() {
697
- page_options.tabs.tabs('select', $('#new_page_part_index').val());
698
- });
699
-
700
- // Wipe the title and increment the index counter by one.
701
- $('#new_page_part_index').val(parseInt($('#new_page_part_index').val(), 10) + 1);
702
- $('#new_page_part_title').val('');
703
-
704
- page_options.tabs.find('> ul li a').corner('top 5px');
705
-
706
- $('#new_page_part_dialog').dialog('close');
707
- }
708
- );
709
- }else{
710
- alert("A content section with that title already exists, please choose another.");
711
- }
712
- }else{
713
- alert("You have not entered a title for the content section, please enter one.");
714
- }
715
- });
716
-
717
- $('#new_page_part_cancel').click(function(e){
718
- e.preventDefault();
719
- $('#new_page_part_dialog').dialog('close');
720
- $('#new_page_part_title').val('');
721
- });
722
-
723
- $('#delete_page_part').click(function(e){
724
- e.preventDefault();
725
-
726
- if(confirm("This will remove the content section '" + $('#page_parts .ui-tabs-selected a').text() + "' immediately even if you don't save this page, are you sure?")) {
727
- var tabId = page_options.tabs.tabs('option', 'selected');
728
- $.ajax({
729
- url: page_options.del_part_url + '/' + $('#page_parts_attributes_' + tabId + '_id').val(),
730
- type: 'DELETE'
731
- });
732
- page_options.tabs.tabs('remove', tabId);
733
- $('#page_parts_attributes_' + tabId + '_id').remove();
734
- $('#submit_continue_button').remove();
735
- }
736
-
737
- });
738
-
739
- }
740
-
741
- };
742
-
743
- var image_dialog = {
744
- initialised: false
745
- , callback: null
746
-
747
- , init: function(callback){
748
- this.callback = callback;
749
- this.init_tabs();
750
- this.init_select();
751
- this.init_actions();
752
- this.initialised = true;
753
- return this;
754
- }
755
-
756
- , init_tabs: function(){
757
- var radios = $('#dialog_menu_left input:radio');
758
- var selected = radios.parent().filter(".selected_radio").find('input:radio').first() || radios.first();
759
-
760
- radios.click(function(){
761
- link_dialog.switch_area($(this));
762
- });
763
-
764
- selected.attr('checked', 'true');
765
- link_dialog.switch_area(selected);
766
- }
767
-
768
- , switch_area: function(radio){
769
- $('#dialog_menu_left .selected_radio').removeClass('selected_radio');
770
- $(radio).parent().addClass('selected_radio');
771
- $('#dialog_main .dialog_area').hide();
772
- $('#' + radio.value + '_area').show();
773
- }
774
-
775
- , init_select: function(){
776
- $('#existing_image_area_content ul li img').click(function(){
777
- image_dialog.set_image(this);
778
- });
779
- //Select any currently selected, just uploaded...
780
- if ((selected_img = $('#existing_image_area_content ul li.selected img')).length > 0) {
781
- image_dialog.set_image(selected_img.first());
782
- }
783
- }
784
-
785
- , set_image: function(img){
786
- if ($(img).length > 0) {
787
- $('#existing_image_area_content ul li.selected').removeClass('selected');
788
-
789
- $(img).parent().addClass('selected');
790
- var imageId = $(img).attr('data-id');
791
- var geometry = $('#existing_image_size_area li.selected a').attr('data-geometry');
792
- var size = $('#existing_image_size_area li.selected a').attr('data-size');
793
- var resize = $("#wants_to_resize_image").is(':checked');
794
-
795
- image_url = resize ? $(img).attr('data-' + size) : $(img).attr('data-original');
796
-
797
- if (parent) {
798
- if ((wym_src = parent.document.getElementById('wym_src')) != null) {
799
- wym_src.value = image_url;
800
- }
801
- if ((wym_title = parent.document.getElementById('wym_title')) != null) {
802
- wym_title.value = $(img).attr('title');
803
- }
804
- if ((wym_alt = parent.document.getElementById('wym_alt')) != null) {
805
- wym_alt.value = $(img).attr('alt');
806
- }
807
- if ((wym_size = parent.document.getElementById('wym_size')) != null
808
- && typeof(geometry) != 'undefined') {
809
- wym_size.value = geometry.replace(/[<>=]/g, '');
810
- }
811
- }
812
- }
813
- }
814
-
815
- , submit_image_choice: function(e) {
816
- e.preventDefault();
817
- if((img_selected = $('#existing_image_area_content ul li.selected img').get(0)) && $.isFunction(this.callback))
818
- {
819
- this.callback(img_selected);
820
- }
821
-
822
- close_dialog(e);
823
- }
824
-
825
- , init_actions: function(){
826
- var _this = this;
827
- // get submit buttons not inside a wymeditor iframe
828
- $('#existing_image_area .form-actions-dialog #submit_button')
829
- .not('.wym_iframe_body #existing_image_area .form-actions-dialog #submit_button')
830
- .click($.proxy(_this.submit_image_choice, _this));
831
-
832
- // get cancel buttons not inside a wymeditor iframe
833
- $('.form-actions-dialog #cancel_button')
834
- .not('.wym_iframe_body .form-actions-dialog #cancel_button')
835
- .click($.proxy(close_dialog, _this));
836
-
837
- $('#existing_image_size_area ul li a').click(function(e) {
838
- $('#existing_image_size_area ul li').removeClass('selected');
839
- $(this).parent().addClass('selected');
840
- $('#existing_image_size_area #wants_to_resize_image').attr('checked', 'checked');
841
- image_dialog.set_image($('#existing_image_area_content ul li.selected img'));
842
- e.preventDefault();
843
- });
844
-
845
- $('#existing_image_size_area #wants_to_resize_image').change(function(){
846
- if($(this).is(":checked")) {
847
- $('#existing_image_size_area ul li:first a').click();
848
- } else {
849
- $('#existing_image_size_area ul li').removeClass('selected');
850
- image_dialog.set_image($('#existing_image_area_content ul li.selected img'));
851
- }
852
- });
853
-
854
- image_area = $('#existing_image_area').not('#wym_iframe_body #existing_image_area');
855
- image_area.find('.form-actions input#submit_button').click($.proxy(function(e) {
856
- e.preventDefault();
857
- $(this.document.getElementById('wym_dialog_submit')).click();
858
- }, parent));
859
- image_area.find('.form-actions a.close_dialog').click(close_dialog);
860
- }
861
- };
862
-
863
- var list_reorder = {
864
- initialised: false
865
- , init: function() {
866
- $('#reorder_action').click(list_reorder.enable_reordering);
867
- $('#reorder_action_done').click(list_reorder.disable_reordering);
868
- if(list_reorder.tree === false) {
869
- list_reorder.sortable_list.find('li').addClass('no-nest');
870
- }
871
- list_reorder.sortable_list.nestedSortable({
872
- disableNesting: 'no-nest',
873
- forcePlaceholderSize: true,
874
- handle: list_reorder.tree ? 'div' : null,
875
- items: 'li',
876
- opacity: .6,
877
- placeholder: 'placeholder',
878
- tabSize: 25,
879
- tolerance: 'pointer',
880
- toleranceElement: list_reorder.tree ? '> div' : null,
881
- disabled: true,
882
- start: function () {
883
- },
884
- change: function () {
885
- if (list_reorder.tree) {
886
- list_reorder.reset_branch_classes(this);
887
- }
888
- },
889
- stop: function () {
890
- if (list_reorder.tree) {
891
- list_reorder.reset_branch_classes(this);
892
- } else {
893
- list_reorder.reset_on_off_classes(this);
894
- }
895
- }
896
- });
897
- if (list_reorder.tree) {
898
- list_reorder.reset_branch_classes(list_reorder.sortable_list);
899
- } else {
900
- list_reorder.reset_on_off_classes(list_reorder.sortable_list);
901
- }
902
- this.initialised = true;
903
- }
904
- , reset_on_off_classes: function(ul) {
905
- $("> li", ul).each(function(i, li) {
906
- $(li).removeClass('on off on-hover').addClass(i % 2 === 0 ? 'on' : 'off');
907
- });
908
- }
909
-
910
- , reset_branch_classes: function (ul) {
911
- $("li.ui-sortable-helper", this).removeClass("record").removeClass("branch_start").removeClass("branch_end");
912
- $("li", ul).removeClass("branch_start").removeClass("branch_end");
913
-
914
- $("> li:first", ul).addClass("branch_start");
915
- $("> li:last", ul).addClass("branch_end");
916
-
917
- var nested_ul = $("ul", ul);
918
- $("> li:last", nested_ul).addClass("branch_end");
919
- }
920
-
921
- ,enable_reordering: function(e) {
922
- if(e) { e.preventDefault(); }
923
- $('#sortable_list').addClass("reordering");
924
-
925
- $('#sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(500, 0.3);
926
- $('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(500, 0.55);
927
-
928
- list_reorder.sortable_list.nestedSortable("enable");
929
- $('#reorder_action').hide();
930
- $('#reorder_action_done').show();
931
- }
932
-
933
- , disable_reordering: function(e) {
934
- if($('#reorder_action_done').hasClass('loading')){
935
- return false;
936
- }
937
- if(e) { e.preventDefault(); }
938
- $('#reorder_action_done').addClass('loading');
939
- list_reorder.sortable_list.nestedSortable("disable");
940
-
941
- $('#sortable_list').removeClass("reordering");
942
-
943
- if (list_reorder.update_url != null) {
944
-
945
- var serialized = list_reorder.sortable_list.serializelist();
946
-
947
- $.post(list_reorder.update_url, serialized, function(data) {
948
- list_reorder.restore_controls(e);
949
- });
950
- } else {
951
- list_reorder.restore_controls(e);
952
- }
953
- }
954
-
955
- , restore_controls: function(e) {
956
- if (list_reorder.tree && !$.browser.msie) {
957
- list_reorder.sortable_list.add(list_reorder.sortable_list.find('ul, li, div')).draggable({ disabled: true });
958
- } else {
959
- $(list_reorder.sortable_list).sortable('destroy');
960
- }
961
- $(list_reorder.sortable_list).removeClass('reordering, ui-sortable');
962
-
963
- $('#sortable_list .actions, #site_bar, header > *:not(script)').fadeTo(250, 1);
964
- $('#actions *:not("#reorder_action_done, #reorder_action")').not($('#reorder_action_done').parents('li, ul, div')).fadeTo(250, 1, function() {
965
- $('#reorder_action_done').hide().removeClass('loading');
966
- $('#reorder_action').show();
967
- });
968
- }
969
- };
970
-
971
- var image_picker = {
972
- initialised: false
973
- , options: {
974
- selected: ''
975
- , thumbnail: 'medium'
976
- , field: '#image'
977
- , image_display: '.current_picked_image'
978
- , no_image_message: '.no_picked_image_selected'
979
- , image_container: '.current_image_container'
980
- , remove_image_button: '.remove_picked_image'
981
- , picker_container: '.image_picker_container'
982
- , image_link: '.current_image_link'
983
- , image_toggler: null
984
- }
985
-
986
- , init: function(new_options){
987
- this.options = $.extend(this.options, new_options);
988
- $(this.options.picker_container).find(this.options.remove_image_button)
989
- .click($.proxy(this.remove_image, {container: this.options.picker_container, picker: this}));
990
- $(this.options.picker_container).find(this.options.image_toggler)
991
- .click($.proxy(this.toggle_image, {container: this.options.picker_container, picker: this}));
992
-
993
- this.initialised = true;
994
-
995
- return this;
996
- }
997
-
998
- , remove_image: function(e) {
999
- e.preventDefault();
1000
-
1001
- $(this.container).find(this.picker.options.image_display)
1002
- .removeClass('brown_border')
1003
- .attr({'src': '', 'width': '', 'height': ''})
1004
- .css({'width': 'auto', 'height': 'auto'})
1005
- .hide();
1006
- $(this.container).find(this.picker.options.field).val('');
1007
- $(this.container).find(this.picker.options.no_image_message).show();
1008
- $(this.container).find(this.picker.options.remove_image_button).hide();
1009
- $(this).hide();
1010
- }
1011
-
1012
- , toggle_image: function(e) {
1013
- $(this.container).find(this.options.image_toggler).html(
1014
- ($(this.container).find(options.image_toggler).html() == 'Show' ? 'Hide' : 'Show')
1015
- );
1016
- $(this.container).find(this.options.image_container).toggle();
1017
- e.preventDefault();
1018
- }
1019
-
1020
- , changed: function(e) {
1021
- $(this.container).find(this.picker.options.field).val(
1022
- this.image.id.replace("image_", "")
1023
- );
1024
-
1025
- var size = this.picker.options.thumbnail || 'original';
1026
- this.image.src = $(this.image).attr('data-' + size);
1027
- current_image = $(this.container).find(this.picker.options.image_display);
1028
- current_image.replaceWith(
1029
- $("<img src='"+this.image.src+"?"+Math.floor(Math.random() * 100000)+"' id='"+current_image.attr('id')+"' class='"+this.picker.options.image_display.replace(/^./, '')+" brown_border' />")
1030
- );
1031
-
1032
- $(this.container).find(this.picker.options.remove_image_button).show();
1033
- $(this.container).find(this.picker.options.no_image_message).hide();
1034
- }
1035
- };
1036
-
1037
- var resource_picker = {
1038
- initialised: false
1039
- , callback: null
1040
-
1041
- , init: function(callback) {
1042
- this.callback = callback;
1043
- this.initialised = true;
1044
- }
1045
- };
1046
-
1047
- close_dialog = function(e) {
1048
- if (iframed())
1049
- {
1050
- the_body = $(parent.document.body);
1051
- the_dialog = parent.$('.ui-dialog-content');
1052
- } else {
1053
- the_body = $(document.body).removeClass('hide-overflow');
1054
- the_dialog = $('.ui-dialog-content');
1055
- the_dialog.filter(':data(dialog)').dialog('close');
1056
- the_dialog.remove();
1057
- }
1058
-
1059
- // if there's a wymeditor involved don't try to close the dialog as wymeditor will.
1060
- if (!$(document.body).hasClass('wym_iframe_body')) {
1061
- the_body.removeClass('hide-overflow');
1062
- the_dialog.filter(':data(dialog)').dialog('close');
1063
- the_dialog.remove();
1064
- e.preventDefault();
1065
- }
1066
- };
1067
-
1068
- //parse a URL to form an object of properties
1069
- parseURL = function(url)
1070
- {
1071
- //save the unmodified url to href property
1072
- //so that the object we get back contains
1073
- //all the same properties as the built-in location object
1074
- var loc = { 'href' : url };
1075
-
1076
- //split the URL by single-slashes to get the component parts
1077
- var parts = url.replace('//', '/').split('/');
1078
-
1079
- //store the protocol and host
1080
- loc.protocol = parts[0];
1081
- loc.host = parts[1];
1082
-
1083
- //extract any port number from the host
1084
- //from which we derive the port and hostname
1085
- parts[1] = parts[1].split(':');
1086
- loc.hostname = parts[1][0];
1087
- loc.port = parts[1].length > 1 ? parts[1][1] : '';
1088
-
1089
- //splice and join the remainder to get the pathname
1090
- parts.splice(0, 2);
1091
- // ensure we don't destroy absolute urls like /system/images/whatever.jpg
1092
- loc.pathname = (loc.href[0] == '/' ? ("/" + loc.host) : '');
1093
- loc.pathname += '/' + parts.join('/');
1094
-
1095
- //extract any hash and remove from the pathname
1096
- loc.pathname = loc.pathname.split('#');
1097
- loc.hash = loc.pathname.length > 1 ? '#' + loc.pathname[1] : '';
1098
- loc.pathname = loc.pathname[0];
1099
-
1100
- //extract any search query and remove from the pathname
1101
- loc.pathname = loc.pathname.split('?');
1102
- loc.search = loc.pathname.length > 1 ? '?' + loc.pathname[1] : '';
1103
- loc.pathname = loc.pathname[0];
1104
-
1105
- var options = url.split('?')[1];
1106
- loc.options = options;
1107
-
1108
- //return the final object
1109
- return loc;
1110
- };
1111
-
1112
- iframed = function() {
1113
- return (parent && parent.document.location.href != document.location.href && $.isFunction(parent.$));
1114
- };