typo 5.4.4 → 5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (292) hide show
  1. data/CHANGELOG +59 -28
  2. data/MAINTAINERS +9 -17
  3. data/README +28 -20
  4. data/UPGRADE +6 -2
  5. data/app/controllers/accounts_controller.rb +1 -1
  6. data/app/controllers/admin/content_controller.rb +1 -1
  7. data/app/controllers/admin/feedback_controller.rb +3 -3
  8. data/app/controllers/admin/pages_controller.rb +2 -0
  9. data/app/controllers/application_controller.rb +6 -1
  10. data/app/controllers/articles_controller.rb +13 -1
  11. data/app/helpers/application_helper.rb +5 -2
  12. data/app/helpers/authors_helper.rb +14 -3
  13. data/app/models/article.rb +6 -4
  14. data/app/models/blog.rb +0 -4
  15. data/app/models/blog_sweeper.rb +1 -1
  16. data/app/models/content.rb +10 -5
  17. data/app/models/page_cache.rb +6 -7
  18. data/app/models/user.rb +1 -0
  19. data/app/views/admin/content/_form.html.erb +13 -11
  20. data/app/views/admin/content/_images.html.erb +1 -1
  21. data/app/views/admin/content/_simple_editor.html.erb +1 -0
  22. data/app/views/admin/content/_visual_editor.html.erb +1 -0
  23. data/app/views/admin/dashboard/_overview.html.erb +7 -7
  24. data/app/views/admin/pages/_form.html.erb +1 -0
  25. data/app/views/admin/pages/_images.html.erb +18 -0
  26. data/app/views/admin/pages/_simple_editor.html.erb +1 -2
  27. data/app/views/admin/pages/_visual_editor.html.erb +2 -1
  28. data/app/views/admin/pages/index.html.erb +1 -1
  29. data/app/views/admin/settings/feedback.html.erb +2 -1
  30. data/app/views/admin/tags/edit.html.erb +1 -1
  31. data/app/views/articles/_article.html.erb +17 -13
  32. data/app/views/articles/_article_content.html.erb +1 -0
  33. data/app/views/articles/_comment_box.html.erb +1 -1
  34. data/app/views/articles/_password_form.html.erb +10 -0
  35. data/app/views/articles/groupings.html.erb +1 -1
  36. data/app/views/articles/index.html.erb +1 -2
  37. data/app/views/articles/read.html.erb +1 -4
  38. data/app/views/articles/search.html.erb +1 -1
  39. data/app/views/layouts/administration.html.erb +1 -1
  40. data/app/views/shared/_search.html.erb +1 -1
  41. data/config/ckeditor.yml +14 -0
  42. data/config/environment.rb +13 -25
  43. data/config/environments/test.rb +1 -3
  44. data/config/filemanager.yml +16 -0
  45. data/config/initializers/access_rules.rb +5 -0
  46. data/config/routes.rb +5 -1
  47. data/db/migrate/004_add_sidebars.rb +3 -9
  48. data/db/migrate/089_drop_cache_information_table.rb +31 -0
  49. data/db/migrate/090_remove_keywords_from_posts.rb +9 -0
  50. data/db/migrate/091_adds_password_protection_to_posts.rb +9 -0
  51. data/doc/CACHE.SETUP.README +36 -0
  52. data/lang/de_DE.rb +6 -1
  53. data/lang/pl_PL.rb +221 -89
  54. data/lib/filemanager.rb +53 -0
  55. data/lib/filemanager/controller.rb +217 -0
  56. data/lib/i18n_interpolation_deprecation.rb +26 -0
  57. data/lib/rails_patch/active_support.rb +4 -0
  58. data/lib/tasks/release.rake +4 -131
  59. data/lib/typo_version.rb +1 -1
  60. data/public/.htaccess +6 -5
  61. data/public/filemanager/images/avi.gif +0 -0
  62. data/public/filemanager/images/box.gif +0 -0
  63. data/public/filemanager/images/bullet.gif +0 -0
  64. data/public/filemanager/images/close.gif +0 -0
  65. data/public/filemanager/images/closelabel.gif +0 -0
  66. data/public/filemanager/images/doc.gif +0 -0
  67. data/public/filemanager/images/donate-button.gif +0 -0
  68. data/public/filemanager/images/download-icon.gif +0 -0
  69. data/public/filemanager/images/folder.gif +0 -0
  70. data/public/filemanager/images/gif.gif +0 -0
  71. data/public/filemanager/images/htm.gif +0 -0
  72. data/public/filemanager/images/html.gif +0 -0
  73. data/public/filemanager/images/image-1.jpg +0 -0
  74. data/public/filemanager/images/image.gif +0 -0
  75. data/public/filemanager/images/jpg.gif +0 -0
  76. data/public/filemanager/images/loading.gif +0 -0
  77. data/public/filemanager/images/mov.gif +0 -0
  78. data/public/filemanager/images/nextlabel.gif +0 -0
  79. data/public/filemanager/images/pdf.gif +0 -0
  80. data/public/filemanager/images/png.gif +0 -0
  81. data/public/filemanager/images/ppt.gif +0 -0
  82. data/public/filemanager/images/prevlabel.gif +0 -0
  83. data/public/filemanager/images/rar.gif +0 -0
  84. data/public/filemanager/images/rm.gif +0 -0
  85. data/public/filemanager/images/rmvb.gif +0 -0
  86. data/public/filemanager/images/separator.gif +0 -0
  87. data/public/filemanager/images/spacer.gif +0 -0
  88. data/public/filemanager/images/swf.gif +0 -0
  89. data/public/filemanager/images/thumb-1.jpg +0 -0
  90. data/public/filemanager/images/tool_copy.gif +0 -0
  91. data/public/filemanager/images/tool_cut.gif +0 -0
  92. data/public/filemanager/images/tool_del.gif +0 -0
  93. data/public/filemanager/images/tool_folder.gif +0 -0
  94. data/public/filemanager/images/tool_imagemanager.gif +0 -0
  95. data/public/filemanager/images/tool_new.gif +0 -0
  96. data/public/filemanager/images/tool_paste.gif +0 -0
  97. data/public/filemanager/images/tool_props.gif +0 -0
  98. data/public/filemanager/images/tool_refresh.gif +0 -0
  99. data/public/filemanager/images/tool_unzip.gif +0 -0
  100. data/public/filemanager/images/tool_upload.gif +0 -0
  101. data/public/filemanager/images/tool_zip.gif +0 -0
  102. data/public/filemanager/images/txt.gif +0 -0
  103. data/public/filemanager/images/unknown.gif +0 -0
  104. data/public/filemanager/images/wmv.gif +0 -0
  105. data/public/filemanager/images/xls.gif +0 -0
  106. data/public/filemanager/images/zip.gif +0 -0
  107. data/public/filemanager/javascripts/filemanager.js +6 -0
  108. data/public/filemanager/javascripts/lang/en.js +31 -0
  109. data/public/filemanager/javascripts/lang/zh_CN.js +31 -0
  110. data/public/filemanager/javascripts/lightbox.js +497 -0
  111. data/public/filemanager/javascripts/translate.js +42 -0
  112. data/public/filemanager/resources/resources.txt +1 -0
  113. data/public/filemanager/stylesheets/filelist.css +147 -0
  114. data/public/filemanager/stylesheets/general.css +135 -0
  115. data/public/filemanager/stylesheets/lightbox.css +27 -0
  116. data/public/javascripts/prototype_ext.js +117 -0
  117. data/public/stylesheets/administration.css +19 -2
  118. data/themes/dirtylicious/views/articles/_article.html.erb +16 -12
  119. data/themes/dirtylicious/views/articles/_article_content.html.erb +1 -0
  120. data/themes/dirtylicious/views/articles/_password_form.html.erb +10 -0
  121. data/themes/scribbish/views/articles/_article.html.erb +18 -14
  122. data/themes/scribbish/views/articles/_article_content.html.erb +1 -0
  123. data/themes/scribbish/views/articles/_password_form.html.erb +10 -0
  124. data/themes/standard_issue/views/articles/_article.html.erb +16 -12
  125. data/themes/standard_issue/views/articles/_article_content.html.erb +1 -0
  126. data/themes/standard_issue/views/articles/_password_form.html.erb +10 -0
  127. data/themes/true-blue-3/helpers/theme_helper.rb +2 -2
  128. data/themes/true-blue-3/images/submit_form.jpg +0 -0
  129. data/themes/true-blue-3/stylesheets/style.css +27 -3
  130. data/themes/true-blue-3/views/articles/_article.html.erb +13 -8
  131. data/themes/true-blue-3/views/articles/_article_content.html.erb +1 -0
  132. data/themes/true-blue-3/views/articles/_comment_form.html.erb +1 -1
  133. data/themes/true-blue-3/views/articles/_password_form.html.erb +10 -0
  134. data/themes/true-blue-3/views/categories/_article.html.erb +5 -0
  135. data/themes/true-blue-3/views/tags/_article.html.erb +4 -0
  136. data/themes/typographic/views/articles/_article.html.erb +16 -12
  137. data/themes/typographic/views/articles/_article_content.html.erb +1 -0
  138. data/themes/typographic/views/articles/_password_form.html.erb +10 -0
  139. data/vendor/plugins/easy-ckeditor/app/controllers/ckeditor_controller.rb +2 -1
  140. data/vendor/plugins/easy-ckeditor/lib/ckeditor.rb +1 -20
  141. data/vendor/plugins/easy-ckeditor/{tasks → lib/tasks}/ckeditor_tasks.rake +0 -0
  142. data/vendor/plugins/filemanager/app/controllers/fm/filemanager_controller.rb +22 -0
  143. data/vendor/plugins/filemanager/app/views/fm/filemanager/index.html.erb +512 -0
  144. data/vendor/plugins/filemanager/app/views/fm/filemanager/view.html.erb +67 -0
  145. data/vendor/plugins/filemanager/filemanager.yml +16 -0
  146. data/vendor/plugins/static_sidebar/lib/static_sidebar.rb +4 -2
  147. data/vendor/plugins/typo_converter/{tasks → lib/tasks}/typo_converters_tasks.rake +0 -0
  148. data/vendor/plugins/typo_login_system/lib/access_control.rb +24 -1
  149. data/vendor/plugins/typo_textfilter_code/{tasks → lib/tasks}/typo_textfilter_code_tasks.rake +0 -0
  150. data/vendor/plugins/typo_textfilter_code/lib/typo_textfilter_code.rb +4 -3
  151. data/vendor/plugins/typo_textfilter_flickr/{tasks → lib/tasks}/typo_textfilter_flickr_tasks.rake +0 -0
  152. data/vendor/plugins/typo_textfilter_htmlfilter/{tasks → lib/tasks}/typo_textfilter_htmlfilter_tasks.rake +0 -0
  153. data/vendor/plugins/typo_textfilter_lightbox/{tasks → lib/tasks}/typo_textfilter_lightbox_tasks.rake +0 -0
  154. data/vendor/plugins/typo_textfilter_markdown/{tasks → lib/tasks}/typo_textfilter_markdown_tasks.rake +0 -0
  155. data/vendor/plugins/typo_textfilter_none/{tasks → lib/tasks}/typo_textfilter_none_tasks.rake +0 -0
  156. data/vendor/plugins/typo_textfilter_smartypants/{tasks → lib/tasks}/typo_textfilter_smartypants_tasks.rake +0 -0
  157. data/vendor/plugins/typo_textfilter_textile/{tasks → lib/tasks}/typo_textfilter_textile_tasks.rake +0 -0
  158. data/vendor/plugins/typo_textfilter_textile_and_markdown/{tasks → lib/tasks}/typo_textfilter_textile_and_markdown_tasks.rake +0 -0
  159. data/vendor/plugins/xml_sidebar/views/content.rhtml +1 -1
  160. metadata +190 -195
  161. data/app/controllers/admin/cache_controller.rb +0 -9
  162. data/app/models/cache_information.rb +0 -19
  163. data/db/schema.rb +0 -242
  164. data/doc/test_themes.rb +0 -50
  165. data/public/javascripts/ckeditor/config.js +0 -27
  166. data/spec/controllers/accounts_controller_spec.rb +0 -414
  167. data/spec/controllers/admin/cache_controller_spec.rb +0 -18
  168. data/spec/controllers/admin/categories_controller_spec.rb +0 -73
  169. data/spec/controllers/admin/content_controller_spec.rb +0 -443
  170. data/spec/controllers/admin/dashboard_controller_spec.rb +0 -13
  171. data/spec/controllers/admin/feedback_controller_spec.rb +0 -308
  172. data/spec/controllers/admin/pages_controller_spec.rb +0 -80
  173. data/spec/controllers/admin/profiles_controller_spec.rb +0 -22
  174. data/spec/controllers/admin/resources_controller_spec.rb +0 -53
  175. data/spec/controllers/admin/settings_controller_spec.rb +0 -80
  176. data/spec/controllers/admin/tags_controller_spec.rb +0 -64
  177. data/spec/controllers/admin/textfilters_controller_spec.rb +0 -20
  178. data/spec/controllers/admin/themes_controller_spec.rb +0 -30
  179. data/spec/controllers/admin/users_controller_spec.rb +0 -109
  180. data/spec/controllers/application_controller_spec.rb +0 -18
  181. data/spec/controllers/articles_controller_spec.rb +0 -440
  182. data/spec/controllers/authors_controller_spec.rb +0 -42
  183. data/spec/controllers/backend_controller_spec.rb +0 -337
  184. data/spec/controllers/categories_controller_spec.rb +0 -117
  185. data/spec/controllers/comments_controller_spec.rb +0 -137
  186. data/spec/controllers/routes/articles_routing_spec.rb +0 -31
  187. data/spec/controllers/routes/xml_routing_spec.rb +0 -71
  188. data/spec/controllers/setup_controller_spec.rb +0 -24
  189. data/spec/controllers/tags_controller_spec.rb +0 -147
  190. data/spec/controllers/textfilter_controller_spec.rb +0 -192
  191. data/spec/controllers/theme_controller_spec.rb +0 -39
  192. data/spec/controllers/xml_controller_spec.rb +0 -185
  193. data/spec/factories.rb +0 -69
  194. data/spec/helpers/application_helper_spec.rb +0 -25
  195. data/spec/helpers/content_helper_spec.rb +0 -28
  196. data/spec/lib/text_filter_plugin_spec.rb +0 -15
  197. data/spec/models/amazon_sidebar_spec.rb +0 -40
  198. data/spec/models/article_closing_spec.rb +0 -42
  199. data/spec/models/article_spec.rb +0 -515
  200. data/spec/models/blog_spec.rb +0 -116
  201. data/spec/models/cache_information_spec.rb +0 -42
  202. data/spec/models/cache_support_spec.rb +0 -51
  203. data/spec/models/category_spec.rb +0 -44
  204. data/spec/models/comment_spec.rb +0 -240
  205. data/spec/models/configuration_spec.rb +0 -91
  206. data/spec/models/content_state/feedback_states_spec.rb +0 -64
  207. data/spec/models/notification_spec.rb +0 -8
  208. data/spec/models/page_cache_spec.rb +0 -30
  209. data/spec/models/page_spec.rb +0 -91
  210. data/spec/models/ping_pinger_spec.rb +0 -33
  211. data/spec/models/ping_spec.rb +0 -154
  212. data/spec/models/redirect_spec.rb +0 -17
  213. data/spec/models/resource_spec.rb +0 -39
  214. data/spec/models/route_cache_spec.rb +0 -11
  215. data/spec/models/sidebar_spec.rb +0 -7
  216. data/spec/models/static_sidebar_spec.rb +0 -17
  217. data/spec/models/tag_spec.rb +0 -65
  218. data/spec/models/text_filter_spec.rb +0 -34
  219. data/spec/models/theme_spec.rb +0 -45
  220. data/spec/models/trackback_spec.rb +0 -60
  221. data/spec/models/trigger_spec.rb +0 -40
  222. data/spec/models/user_spec.rb +0 -198
  223. data/spec/rcov.opts +0 -2
  224. data/spec/spec.opts +0 -4
  225. data/spec/spec_helper.rb +0 -133
  226. data/spec/views/articles/index_spec.rb +0 -63
  227. data/spec/views/articles/read_spec.rb +0 -67
  228. data/spec/views/comments/html_sanitization_spec.rb +0 -119
  229. data/test/fixtures/blogs.yml +0 -27
  230. data/test/fixtures/categories.yml +0 -29
  231. data/test/fixtures/categorizations.yml +0 -31
  232. data/test/fixtures/contents.yml +0 -231
  233. data/test/fixtures/feedback.yml +0 -180
  234. data/test/fixtures/notification_mailer/article +0 -3
  235. data/test/fixtures/notification_mailer/comment +0 -3
  236. data/test/fixtures/notification_mailer/trackback +0 -3
  237. data/test/fixtures/notifications.yml +0 -0
  238. data/test/fixtures/page_caches.yml +0 -7
  239. data/test/fixtures/profiles.yml +0 -27
  240. data/test/fixtures/redirects.yml +0 -10
  241. data/test/fixtures/resources.yml +0 -21
  242. data/test/fixtures/sidebars.yml +0 -10
  243. data/test/fixtures/tags.yml +0 -10
  244. data/test/fixtures/text_filters.yml +0 -37
  245. data/test/fixtures/triggers.yml +0 -1
  246. data/test/fixtures/users.yml +0 -101
  247. data/test/mocks/test/dns_mock.rb +0 -13
  248. data/test/mocks/test/flickr_mock.rb +0 -30
  249. data/test/mocks/test/http_mock.rb +0 -39
  250. data/test/mocks/test/theme_mock.rb +0 -5
  251. data/test/mocks/test/xmlrpc_mock.rb +0 -28
  252. data/test/mocks/themes/123-numbers-in-path/about.markdown +0 -0
  253. data/test/mocks/themes/CamelCaseDirectory/about.markdown +0 -0
  254. data/test/mocks/themes/i-have-special-chars/about.markdown +0 -0
  255. data/test/mocks/themes/typographic/about.markdown +0 -7
  256. data/test/mocks/themes/typographic/images/Thumbs.db +0 -0
  257. data/test/mocks/themes/typographic/images/accept.png +0 -0
  258. data/test/mocks/themes/typographic/images/accept50.png +0 -0
  259. data/test/mocks/themes/typographic/images/bg_body.jpg +0 -0
  260. data/test/mocks/themes/typographic/images/bg_white.png +0 -0
  261. data/test/mocks/themes/typographic/images/bg_wrapper.jpg +0 -0
  262. data/test/mocks/themes/typographic/images/bullet_bottom.png +0 -0
  263. data/test/mocks/themes/typographic/images/bullet_right.png +0 -0
  264. data/test/mocks/themes/typographic/images/email_open.png +0 -0
  265. data/test/mocks/themes/typographic/images/email_open50.png +0 -0
  266. data/test/mocks/themes/typographic/images/meta.png +0 -0
  267. data/test/mocks/themes/typographic/images/page_edit.png +0 -0
  268. data/test/mocks/themes/typographic/images/page_edit50.png +0 -0
  269. data/test/mocks/themes/typographic/images/tag.png +0 -0
  270. data/test/mocks/themes/typographic/images/user.png +0 -0
  271. data/test/mocks/themes/typographic/images/user50.png +0 -0
  272. data/test/mocks/themes/typographic/images/world_link.png +0 -0
  273. data/test/mocks/themes/typographic/images/world_link50.png +0 -0
  274. data/test/mocks/themes/typographic/layouts/default.html.erb +0 -42
  275. data/test/mocks/themes/typographic/preview.png +0 -0
  276. data/test/mocks/themes/typographic/stylesheets/colors.css +0 -51
  277. data/test/mocks/themes/typographic/stylesheets/layout.css +0 -346
  278. data/test/mocks/themes/typographic/stylesheets/reset.css +0 -5
  279. data/test/mocks/themes/typographic/stylesheets/style.css +0 -36
  280. data/test/mocks/themes/typographic/views/articles/_article.html.erb +0 -41
  281. data/test/mocks/themes/typographic/views/articles/_comment.html.erb +0 -14
  282. data/test/mocks/themes/typographic/views/articles/_comment_form.html.erb +0 -48
  283. data/test/mocks/themes/typographic/views/articles/_comment_list.html.erb +0 -7
  284. data/test/mocks/themes/typographic/views/articles/_trackback.html.erb +0 -9
  285. data/test/mocks/themes/typographic/views/articles/comment_preview.html.erb +0 -10
  286. data/test/mocks/themes/typographic/views/articles/index.html.erb +0 -5
  287. data/test/mocks/themes/typographic/views/articles/read.html.erb +0 -42
  288. data/test/mocks/themes/typographic/views/shared/_search.html.erb +0 -17
  289. data/test/mocks/themes/typographic/views/theme/static_view_test.html.erb +0 -1
  290. data/test/test_helper.rb +0 -13
  291. data/themes/true-blue-3/images/frederic-de-villamil.jpg +0 -0
  292. data/themes/true-blue-3/images/textarea_bg.jpg +0 -0
@@ -0,0 +1,53 @@
1
+ =begin
2
+ filemanager.rb
3
+ Copyright (C) 2008 Leon Li
4
+
5
+ You may redistribute it and/or modify it under the same
6
+ license terms as Ruby.
7
+ =end
8
+ require 'uri'
9
+ require 'fileutils'
10
+ FM_ID = 'filemanager'
11
+ FM_ROOT = File.join(RAILS_ROOT, 'vendor', 'plugins', FM_ID)
12
+ FM_PATH_PUBLIC = File.join(FM_ROOT, 'public')
13
+
14
+ =begin
15
+ if $FM_OVERWRITE || ! File.exist?(FM_ROOT)
16
+ fm_rails_path = File.dirname(File.dirname(__FILE__)) + "/#{FM_ID}"
17
+ FileUtils.cp_r(fm_rails_path, File.join(RAILS_ROOT, 'vendor', 'plugins'))
18
+ FileUtils.cp_r(FM_PATH_PUBLIC, RAILS_ROOT)
19
+ FileUtils.rm_rf(FM_PATH_PUBLIC)
20
+ end
21
+ =end
22
+
23
+ FM_CONFIG_FILE = File.join(RAILS_ROOT, 'config', 'filemanager.yml')
24
+ unless File.exist?(FM_CONFIG_FILE)
25
+ FileUtils.cp(File.join(FM_ROOT, 'filemanager.yml'))
26
+ end
27
+ require "erb"
28
+ require "yaml"
29
+ $FM_PROPERTIES = YAML::load(ERB.new(IO.read(FM_CONFIG_FILE)).result)
30
+
31
+ FM_IMAGE_TYPES = $FM_PROPERTIES['image.type'].split(' ')
32
+ FM_FLASH_TYPES = $FM_PROPERTIES['flash.type'].split(' ')
33
+ FM_MOVIE_TYPES = $FM_PROPERTIES['movie.type'].split(' ')
34
+ FM_RM_TYPES = $FM_PROPERTIES['rm.type'].split(' ')
35
+ FM_OFFICE_TYPES = $FM_PROPERTIES['office.type'].split(' ')
36
+ FM_EXCEL_TYPES = $FM_PROPERTIES['excel.type'].split(' ')
37
+ FM_WORD_TYPES = $FM_PROPERTIES['word.type'].split(' ')
38
+ FM_PPT_TYPES = $FM_PROPERTIES['ppt.type'].split(' ')
39
+ FM_HELP_TYPES = $FM_PROPERTIES['help.type'].split(' ')
40
+ FM_PLAIN_TYPES = $FM_PROPERTIES['plain.type'].split(' ')
41
+ FM_NONE_TYPES = $FM_PROPERTIES['none.type'].split(' ')
42
+ FM_SUPPORT_TYPES = FM_IMAGE_TYPES + FM_FLASH_TYPES + FM_MOVIE_TYPES + FM_RM_TYPES + FM_OFFICE_TYPES + FM_HELP_TYPES + FM_PLAIN_TYPES
43
+ FM_UNKNOWN_TYPE = 'unknown'
44
+
45
+ FM_RESOURCES_PATH= $FM_PROPERTIES['resources.path']
46
+ FM_LOCK_PATH = $FM_PROPERTIES['resources.url']
47
+ FM_ENCODING_TO = $FM_PROPERTIES['encoding.to']
48
+ FM_ENCODING_FROM = $FM_PROPERTIES['encoding.from'].nil? ? '' : $FM_PROPERTIES['encoding.from']
49
+
50
+ FM_TEMP_DIR = $FM_PROPERTIES['temp.dir'].nil? ? File.join(FM_ROOT, 'temp') : $FM_PROPERTIES['temp.dir']
51
+
52
+ FileUtils.rm_rf(Dir.glob("#{FM_TEMP_DIR}/*"))
53
+
@@ -0,0 +1,217 @@
1
+ =begin
2
+ controller.rb
3
+ Copyright (C) 2008 Leon Li
4
+
5
+ You may redistribute it and/or modify it under the same
6
+ license terms as Ruby.
7
+ =end
8
+ module Filemanager
9
+ module Controller
10
+ def set_up
11
+ @lock_path = FM_LOCK_PATH
12
+ @source = params[:source]
13
+ @source = decode(@source) unless @source.nil?
14
+ @path = (params[:path].nil? || ! params[:path].index('..').nil?) ? '' : params[:path]
15
+ @path = '' if @path == '/'
16
+ @path = decode(@path)
17
+ @resource_path = FM_RESOURCES_PATH
18
+ @current_path = @resource_path + @path
19
+ @current_file = (File.directory?(@current_path) ? Dir.new(@current_path) : File.new(@current_path))
20
+ @parent_path = (!@path.blank? && !@path.rindex('/').nil?) ? (@path.rindex('/') == 0 ? '/' : @path[0..(@path.rindex('/')-1)]) : nil
21
+ @path_suffix = @path.index('.').nil? || @path[-1] == '.' ? '' : @path[@path.index('.')+1..-1].downcase
22
+ if File.directory?(@current_path)
23
+ @all_files = Dir.entries(@current_path)
24
+ @directories = @all_files.map{|f| File.directory?(@current_path + File::SEPARATOR + f) ? f : nil}.compact
25
+ @files = @all_files.map{|f| File.directory?(@current_path + File::SEPARATOR + f) ? nil : f}.compact
26
+ @file_total_size = @files.inject(0){|size, f| size + File.size(@current_path + File::SEPARATOR + f)}
27
+ end
28
+ end
29
+
30
+ def tear_off
31
+ @current_file.close unless @current_file.nil?
32
+ end
33
+
34
+ def index
35
+
36
+ end
37
+
38
+ def view
39
+ # respond_to do |wants|
40
+ # wants.js { render :text => File.size(@current_path) > 1000000 ? 'File too big' : File.read(@current_path) }
41
+ # end
42
+ end
43
+
44
+ def file_content
45
+ File.size(@current_path) > 1000000 ? 'File too big' : File.read(@current_path)
46
+ end
47
+
48
+ # def office
49
+ # render :action=>'excel' if is_excel?
50
+ # render :action=>'word' if is_word?
51
+ # render :action=>'ppt' if is_ppt?
52
+ # render :action=>'help' if is_help?
53
+ # end
54
+
55
+ def rename
56
+ old_name = @current_path + File::SEPARATOR + decode(params[:old_name])
57
+ new_name = @current_path + File::SEPARATOR + decode(params[:new_name])
58
+ File.rename(old_name, new_name)
59
+ success
60
+ end
61
+
62
+ def remove
63
+ FileUtils.rm_rf(@source.map{|s| @current_path + File::SEPARATOR + s})
64
+ success
65
+ end
66
+
67
+ def new_file
68
+ File.new(@current_path + File::SEPARATOR + decode(params[:new_name]), 'w')
69
+ success
70
+ end
71
+
72
+ def new_folder
73
+ Dir.mkdir(@current_path + File::SEPARATOR + decode(params[:new_name]))
74
+ success
75
+ end
76
+
77
+ def copy
78
+ session[:source] = @source.map{|s| @current_path + File::SEPARATOR + s}
79
+ session[:remove] = false
80
+ success
81
+ end
82
+
83
+ def cut
84
+ session[:source] = @source.map{|s| @current_path + File::SEPARATOR + s}
85
+ session[:remove] = true
86
+ success
87
+ end
88
+
89
+ def paste
90
+ return error if session[:remove].nil? || session[:source].nil?
91
+ begin
92
+ session[:remove] == true ? FileUtils.mv(session[:source], @current_path) : FileUtils.cp_r(session[:source], @current_path)
93
+ session[:remove] = nil
94
+ session[:source] = nil
95
+ success
96
+ rescue => exception
97
+ result(exception)
98
+ end
99
+
100
+ end
101
+
102
+ def download
103
+ now = Time.new
104
+ now = "#{now.to_i}#{now.usec}"
105
+ temp_file = FM_TEMP_DIR + File::SEPARATOR + now + '.zip'
106
+ FileUtils.cd(@current_path) do |dir|
107
+ system "zip -r #{temp_file} #{@source.map{|s| '"' + s + '"'}.join(' ')}"
108
+ end
109
+ send_file(temp_file)
110
+ end
111
+
112
+
113
+ def upload
114
+ file = params[:upload]
115
+ filename = decode(file.original_filename)
116
+ File.open(@current_path + File::SEPARATOR + filename, "wb") do |f|
117
+ f.write(file.read)
118
+ end
119
+ to_index
120
+ end
121
+
122
+
123
+
124
+ #TODO
125
+ def adjust_size
126
+
127
+ end
128
+
129
+ #TODO
130
+ def rotate
131
+
132
+ end
133
+
134
+ #TODO
135
+ def unzip
136
+ filename = decode(params[:old_name])
137
+ FileUtils.cd(@current_path) do |dir|
138
+ system "unzip -o #{filename}"
139
+ end
140
+ to_index
141
+ end
142
+
143
+ def to_index
144
+ redirect_to :action => 'index', :path => encode(@path)
145
+ end
146
+
147
+ def success
148
+ result("SUCCESS")
149
+ end
150
+
151
+ def error()
152
+ result("ERROR")
153
+ end
154
+
155
+ def result(message)
156
+ respond_to do |wants|
157
+ wants.js { render :text => message }
158
+ end
159
+ end
160
+
161
+ #methods for view
162
+ def method_missing(method_id, *args)
163
+ method_id_s = method_id.to_s
164
+ if method_id_s[0, 3] == 'is_' && method_id_s[-1, 1] == '?'
165
+ instance_eval %{
166
+ def #{method_id}(*args)
167
+ FM_#{method_id_s[3..-2].upcase}_TYPES.include?(@path_suffix)
168
+ end
169
+ }
170
+ send(method_id, *args)
171
+ else
172
+ super
173
+ end
174
+ end
175
+
176
+ def transfer(from, to, target)
177
+ if FM_ENCODING_TO.nil?
178
+ target
179
+ else
180
+ if target.is_a?(Array)
181
+ target.map{|i| to.nil? ? i : Iconv.conv(to, from, i)}
182
+ else
183
+ Iconv.conv(to, from, target)
184
+ end
185
+ end
186
+ end
187
+
188
+ def encode(target)
189
+ transfer(FM_ENCODING_FROM, FM_ENCODING_TO, target);
190
+ end
191
+
192
+ def decode(target)
193
+ transfer(FM_ENCODING_TO, FM_ENCODING_FROM, target);
194
+ end
195
+
196
+ def hsize(size)
197
+ size = size/1024
198
+ if size > 1024
199
+ size = size/1024
200
+ size = format('%0.2f',(size)) + ' mb'
201
+ else
202
+ size = format('%0.2f', size) + ' kb'
203
+ end
204
+ end
205
+
206
+ def get_file_type(file)
207
+ type = File.extname(file)
208
+
209
+ unless type.blank?
210
+ type = type.downcase[1..-1]
211
+ return type if FM_SUPPORT_TYPES.include?(type)
212
+ end
213
+ FM_UNKNOWN_TYPE
214
+ end
215
+
216
+ end
217
+ end
@@ -0,0 +1,26 @@
1
+ # Deprecates the use of the former message interpolation syntax in activerecord
2
+ # as in "must have %d characters". The new syntax uses explicit variable names
3
+ # as in "{{value}} must have {{count}} characters".
4
+
5
+ require 'i18n/backend/simple'
6
+ module I18n
7
+ module Backend
8
+ class Simple
9
+ DEPRECATED_INTERPOLATORS = { '%d' => '{{count}}', '%s' => '{{value}}' }
10
+
11
+ protected
12
+ def interpolate_with_deprecated_syntax(locale, string, values = {})
13
+ return string unless string.is_a?(String) && !values.empty?
14
+
15
+ string = string.gsub(/%d|%s/) do |s|
16
+ instead = DEPRECATED_INTERPOLATORS[s]
17
+ ActiveSupport::Deprecation.warn "using #{s} in messages is deprecated; use #{instead} instead."
18
+ instead
19
+ end
20
+
21
+ interpolate_without_deprecated_syntax(locale, string, values)
22
+ end
23
+ alias_method_chain :interpolate, :deprecated_syntax
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,4 @@
1
+ class ActiveSupport::SafeBuffer
2
+ def concat(*args) super end
3
+ alias << concat
4
+ end
@@ -1,7 +1,7 @@
1
1
  require 'rake/gempackagetask'
2
2
  require 'rake/contrib/rubyforgepublisher'
3
3
 
4
- PKG_VERSION = "5.4.4"
4
+ PKG_VERSION = "5.5"
5
5
  PKG_NAME = "typo"
6
6
  PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
7
7
  RUBY_FORGE_PROJECT = 'typo'
@@ -30,16 +30,16 @@ spec = Gem::Specification.new do |s|
30
30
  s.platform = Gem::Platform::RUBY
31
31
  s.executables = ['typo']
32
32
 
33
- s.add_dependency("rails", "= 2.3.5")
33
+ s.add_dependency("rails", "= 2.3.8")
34
34
  s.add_dependency("rails-app-installer", ">= 0.2.0")
35
35
  s.add_dependency("ruby-debug", ">= 0.10.3")
36
36
  s.add_dependency("flexmock", ">= 0.8.3")
37
- s.add_dependency("rspec-rails", "= 1.2.7.1")
37
+ s.add_dependency("rspec-rails", "= 1.3.2")
38
38
  s.add_dependency("bluecloth", "~> 2.0.5")
39
39
  s.add_dependency("htmlentities")
40
40
  s.add_dependency("json")
41
41
  s.add_dependency("calendar_date_select")
42
- s.add_dependency("coderay", "~> 0.8")
42
+ s.add_dependency("coderay", "~> 0.9")
43
43
  s.add_dependency('RedCloth', "~> 4.2.2")
44
44
  end
45
45
 
@@ -49,132 +49,5 @@ Rake::GemPackageTask.new(spec) do |p|
49
49
  p.need_zip = true
50
50
  end
51
51
 
52
- desc "Publish the zip/tgz"
53
- task :leetsoft_upload => [:package] do
54
- Rake::SshFilePublisher.new("leetsoft.com", "dist/pkg", "pkg", "#{PKG_FILE_NAME}.zip").upload
55
- Rake::SshFilePublisher.new("leetsoft.com", "dist/pkg", "pkg", "#{PKG_FILE_NAME}.tgz").upload
56
- end
57
-
58
- desc "Publish the release files to RubyForge."
59
- task :tag_svn do
60
- system("svn cp svn://typosphere.org/typo/trunk svn://typosphere.org/typo/tags/release_#{PKG_VERSION.gsub(/\./,'_')} -m 'tag release #{PKG_VERSION}'")
61
- end
62
-
63
- desc "Publish the release files to RubyForge."
64
- task :rubyforge_upload => [:package] do
65
- files = ["tgz", "zip"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
66
-
67
- if RUBY_FORGE_PROJECT then
68
- require 'net/http'
69
- require 'open-uri'
70
-
71
- project_uri = "http://rubyforge.org/projects/#{RUBY_FORGE_PROJECT}/"
72
- project_data = open(project_uri) { |data| data.read }
73
- group_id = project_data[/[?&]group_id=(\d+)/, 1]
74
- raise "Couldn't get group id" unless group_id
75
-
76
- # This echos password to shell which is a bit sucky
77
- if ENV["RUBY_FORGE_PASSWORD"]
78
- password = ENV["RUBY_FORGE_PASSWORD"]
79
- else
80
- print "#{RUBY_FORGE_USER}@rubyforge.org's password: "
81
- password = STDIN.gets.chomp
82
- end
83
-
84
- login_response = Net::HTTP.start("rubyforge.org", 80) do |http|
85
- data = [
86
- "login=1",
87
- "form_loginname=#{RUBY_FORGE_USER}",
88
- "form_pw=#{password}"
89
- ].join("&")
90
- http.post("/account/login.php", data)
91
- end
92
-
93
- cookie = login_response["set-cookie"]
94
- raise "Login failed" unless cookie
95
- headers = { "Cookie" => cookie }
96
-
97
- release_uri = "http://rubyforge.org/frs/admin/?group_id=#{group_id}"
98
- release_data = open(release_uri, headers) { |data| data.read }
99
- package_id = release_data[/[?&]package_id=(\d+)/, 1]
100
- raise "Couldn't get package id" unless package_id
101
-
102
- first_file = true
103
- release_id = ""
104
-
105
- files.each do |filename|
106
- basename = File.basename(filename)
107
- file_ext = File.extname(filename)
108
- file_data = File.open(filename, "rb") { |file| file.read }
109
-
110
- puts "Releasing #{basename}..."
111
-
112
- release_response = Net::HTTP.start("rubyforge.org", 80) do |http|
113
- release_date = Time.now.strftime("%Y-%m-%d %H:%M")
114
- type_map = {
115
- ".zip" => "3000",
116
- ".tgz" => "3110",
117
- ".gz" => "3110",
118
- ".gem" => "1400"
119
- }; type_map.default = "9999"
120
- type = type_map[file_ext]
121
- boundary = "rubyqMY6QN9bp6e4kS21H4y0zxcvoor"
122
-
123
- query_hash = if first_file then
124
- {
125
- "group_id" => group_id,
126
- "package_id" => package_id,
127
- "release_name" => RELEASE_NAME,
128
- "release_date" => release_date,
129
- "type_id" => type,
130
- "processor_id" => "8000", # Any
131
- "release_notes" => "",
132
- "release_changes" => "",
133
- "preformatted" => "1",
134
- "submit" => "1"
135
- }
136
- else
137
- {
138
- "group_id" => group_id,
139
- "release_id" => release_id,
140
- "package_id" => package_id,
141
- "step2" => "1",
142
- "type_id" => type,
143
- "processor_id" => "8000", # Any
144
- "submit" => "Add This File"
145
- }
146
- end
147
-
148
- query = "?" + query_hash.map do |(name, value)|
149
- [name, URI.encode(value)].join("=")
150
- end.join("&")
151
-
152
- data = [
153
- "--" + boundary,
154
- "Content-Disposition: form-data; name=\"userfile\"; filename=\"#{basename}\"",
155
- "Content-Type: application/octet-stream",
156
- "Content-Transfer-Encoding: binary",
157
- "", file_data, ""
158
- ].join("\x0D\x0A")
159
-
160
- release_headers = headers.merge(
161
- "Content-Type" => "multipart/form-data; boundary=#{boundary}"
162
- )
163
-
164
- target = first_file ? "/frs/admin/qrs.php" : "/frs/admin/editrelease.php"
165
- http.post(target + query, data, release_headers)
166
- end
167
-
168
- if first_file then
169
- release_id = release_response.body[/release_id=(\d+)/, 1]
170
- raise("Couldn't get release id") unless release_id
171
- end
172
-
173
- first_file = false
174
- end
175
- end
176
- end
177
-
178
52
  desc "Upload the package to leetsoft, rubyforge and tag the release in svn"
179
- #task :release => [:sweep_cache, :package, :leetsoft_upload, :rubyforge_upload, :tag_svn ]
180
53
  task :release => [:sweep_cache, :package ]