Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Upgraded this project to Rails 3. There are still several broken unit…

… tests, and I suspect the BlogObserver is not working either. There may be some differences between how Rails 2 and Rails 3 observers work.
  • Loading branch information...
commit b5ed944ae57fa8797166d14030075b4705624b5f 1 parent f3f725a
@peakpg peakpg authored
Showing with 223 additions and 28,628 deletions.
  1. +3 −2 .gitignore
  2. +1 −0  Gemfile
  3. +14 −1 README.markdown
  4. +8 −0 app/controllers/feeds_controller.rb
  5. +6 −0 app/helpers/cms/blog_helper.rb
  6. +2 −0  app/helpers/feeds_helper.rb
  7. +3 −67 app/models/blog.rb
  8. +137 −0 app/models/blog_observer.rb
  9. +1 −1  app/models/blog_post.rb
  10. +18 −0 app/views/feeds/index.rss.builder
  11. +3 −45 app/views/partials/_blog_post.html.erb
  12. +3 −7 app/views/portlets/blog_post/render.html.erb
  13. +4 −7 bcms_blog.gemspec
  14. +7 −0 config/database.yml
  15. +1 −1  config/environment.rb
  16. +1 −0  config/environments/test.rb
  17. +9 −4 doc/release_notes.txt
  18. +2 −0  lib/bcms_blog/routes.rb
  19. +0 −15 public/fckeditor/editor/css/behaviors/disablehandles.htc
  20. +0 −36 public/fckeditor/editor/css/behaviors/showtableborders.htc
  21. +0 −110 public/fckeditor/editor/css/fck_editorarea.css
  22. +0 −199 public/fckeditor/editor/css/fck_internal.css
  23. +0 −49 public/fckeditor/editor/css/fck_showtableborders_gecko.css
  24. BIN  public/fckeditor/editor/css/images/block_address.png
  25. BIN  public/fckeditor/editor/css/images/block_blockquote.png
  26. BIN  public/fckeditor/editor/css/images/block_div.png
  27. BIN  public/fckeditor/editor/css/images/block_h1.png
  28. BIN  public/fckeditor/editor/css/images/block_h2.png
  29. BIN  public/fckeditor/editor/css/images/block_h3.png
  30. BIN  public/fckeditor/editor/css/images/block_h4.png
  31. BIN  public/fckeditor/editor/css/images/block_h5.png
  32. BIN  public/fckeditor/editor/css/images/block_h6.png
  33. BIN  public/fckeditor/editor/css/images/block_p.png
  34. BIN  public/fckeditor/editor/css/images/block_pre.png
  35. BIN  public/fckeditor/editor/css/images/fck_anchor.gif
  36. BIN  public/fckeditor/editor/css/images/fck_flashlogo.gif
  37. BIN  public/fckeditor/editor/css/images/fck_hiddenfield.gif
  38. BIN  public/fckeditor/editor/css/images/fck_pagebreak.gif
  39. BIN  public/fckeditor/editor/css/images/fck_plugin.gif
  40. +0 −85 public/fckeditor/editor/dialog/common/fck_dialog_common.css
  41. +0 −311 public/fckeditor/editor/dialog/common/fck_dialog_common.js
  42. BIN  public/fckeditor/editor/dialog/common/images/locked.gif
  43. BIN  public/fckeditor/editor/dialog/common/images/reset.gif
  44. BIN  public/fckeditor/editor/dialog/common/images/unlocked.gif
  45. +0 −161 public/fckeditor/editor/dialog/fck_about.html
  46. BIN  public/fckeditor/editor/dialog/fck_about/logo_fckeditor.gif
  47. BIN  public/fckeditor/editor/dialog/fck_about/logo_fredck.gif
  48. BIN  public/fckeditor/editor/dialog/fck_about/sponsors/spellchecker_net.gif
  49. +0 −220 public/fckeditor/editor/dialog/fck_anchor.html
  50. +0 −104 public/fckeditor/editor/dialog/fck_button.html
  51. +0 −104 public/fckeditor/editor/dialog/fck_checkbox.html
  52. +0 −172 public/fckeditor/editor/dialog/fck_colorselector.html
  53. +0 −364 public/fckeditor/editor/dialog/fck_div.html
  54. +0 −600 public/fckeditor/editor/dialog/fck_docprops.html
  55. +0 −113 public/fckeditor/editor/dialog/fck_docprops/fck_document_preview.html
  56. +0 −152 public/fckeditor/editor/dialog/fck_flash.html
  57. +0 −300 public/fckeditor/editor/dialog/fck_flash/fck_flash.js
  58. +0 −50 public/fckeditor/editor/dialog/fck_flash/fck_flash_preview.html
  59. +0 −109 public/fckeditor/editor/dialog/fck_form.html
  60. +0 −115 public/fckeditor/editor/dialog/fck_hiddenfield.html
  61. +0 −258 public/fckeditor/editor/dialog/fck_image.html
  62. +0 −512 public/fckeditor/editor/dialog/fck_image/fck_image.js
  63. +0 −72 public/fckeditor/editor/dialog/fck_image/fck_image_preview.html
  64. +0 −295 public/fckeditor/editor/dialog/fck_link.html
  65. +0 −893 public/fckeditor/editor/dialog/fck_link/fck_link.js
  66. +0 −120 public/fckeditor/editor/dialog/fck_listprop.html
  67. +0 −346 public/fckeditor/editor/dialog/fck_paste.html
  68. +0 −104 public/fckeditor/editor/dialog/fck_radiobutton.html
  69. +0 −648 public/fckeditor/editor/dialog/fck_replace.html
  70. +0 −180 public/fckeditor/editor/dialog/fck_select.html
  71. +0 −194 public/fckeditor/editor/dialog/fck_select/fck_select.js
  72. +0 −111 public/fckeditor/editor/dialog/fck_smiley.html
  73. +0 −68 public/fckeditor/editor/dialog/fck_source.html
  74. +0 −121 public/fckeditor/editor/dialog/fck_specialchar.html
  75. +0 −70 public/fckeditor/editor/dialog/fck_spellerpages.html
  76. 0  public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/blank.html
  77. +0 −87 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controlWindow.js
  78. +0 −153 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/controls.html
  79. +0 −148 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.cfm
  80. +0 −199 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.php
  81. +0 −181 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/server-scripts/spellchecker.pl
  82. +0 −461 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellChecker.js
  83. +0 −71 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellchecker.html
  84. +0 −49 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/spellerStyle.css
  85. +0 −272 public/fckeditor/editor/dialog/fck_spellerpages/spellerpages/wordWindow.js
  86. +0 −298 public/fckeditor/editor/dialog/fck_table.html
  87. +0 −257 public/fckeditor/editor/dialog/fck_tablecell.html
  88. +0 −242 public/fckeditor/editor/dialog/fck_template.html
  89. BIN  public/fckeditor/editor/dialog/fck_template/images/template1.gif
  90. BIN  public/fckeditor/editor/dialog/fck_template/images/template2.gif
  91. BIN  public/fckeditor/editor/dialog/fck_template/images/template3.gif
  92. +0 −94 public/fckeditor/editor/dialog/fck_textarea.html
  93. +0 −136 public/fckeditor/editor/dialog/fck_textfield.html
  94. +0 −41 public/fckeditor/editor/dtd/fck_dtd_test.html
  95. +0 −116 public/fckeditor/editor/dtd/fck_xhtml10strict.js
  96. +0 −140 public/fckeditor/editor/dtd/fck_xhtml10transitional.js
  97. +0 −153 public/fckeditor/editor/fckdebug.html
  98. +0 −812 public/fckeditor/editor/fckdialog.html
  99. +0 −317 public/fckeditor/editor/fckeditor.html
  100. +0 −424 public/fckeditor/editor/fckeditor.original.html
  101. +0 −87 public/fckeditor/editor/filemanager/browser/default/browser.css
  102. +0 −200 public/fckeditor/editor/filemanager/browser/default/browser.html
  103. +0 −95 public/fckeditor/editor/filemanager/browser/default/frmactualfolder.html
  104. +0 −114 public/fckeditor/editor/filemanager/browser/default/frmcreatefolder.html
  105. +0 −198 public/fckeditor/editor/filemanager/browser/default/frmfolders.html
  106. +0 −169 public/fckeditor/editor/filemanager/browser/default/frmresourceslist.html
  107. +0 −68 public/fckeditor/editor/filemanager/browser/default/frmresourcetype.html
  108. +0 −115 public/fckeditor/editor/filemanager/browser/default/frmupload.html
  109. BIN  public/fckeditor/editor/filemanager/browser/default/images/ButtonArrow.gif
  110. BIN  public/fckeditor/editor/filemanager/browser/default/images/Folder.gif
  111. BIN  public/fckeditor/editor/filemanager/browser/default/images/Folder32.gif
  112. BIN  public/fckeditor/editor/filemanager/browser/default/images/FolderOpened.gif
  113. BIN  public/fckeditor/editor/filemanager/browser/default/images/FolderOpened32.gif
  114. BIN  public/fckeditor/editor/filemanager/browser/default/images/FolderUp.gif
  115. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/ai.gif
  116. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/avi.gif
  117. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/bmp.gif
  118. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/cs.gif
  119. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/default.icon.gif
  120. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/dll.gif
  121. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/doc.gif
  122. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/exe.gif
  123. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/fla.gif
  124. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/gif.gif
  125. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/htm.gif
  126. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/html.gif
  127. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/jpg.gif
  128. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/js.gif
  129. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/mdb.gif
  130. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/mp3.gif
  131. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/pdf.gif
  132. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/png.gif
  133. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/ppt.gif
  134. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/rdp.gif
  135. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/swf.gif
  136. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/swt.gif
  137. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/txt.gif
  138. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/vsd.gif
  139. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/xls.gif
  140. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/xml.gif
  141. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/32/zip.gif
  142. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/ai.gif
  143. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/avi.gif
  144. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/bmp.gif
  145. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/cs.gif
  146. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/default.icon.gif
  147. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/dll.gif
  148. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/doc.gif
  149. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/exe.gif
  150. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/fla.gif
  151. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/gif.gif
  152. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/htm.gif
  153. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/html.gif
  154. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/jpg.gif
  155. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/js.gif
  156. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/mdb.gif
  157. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/mp3.gif
  158. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/pdf.gif
  159. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/png.gif
  160. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/ppt.gif
  161. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/rdp.gif
  162. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/swf.gif
  163. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/swt.gif
  164. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/txt.gif
  165. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/vsd.gif
  166. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/xls.gif
  167. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/xml.gif
  168. BIN  public/fckeditor/editor/filemanager/browser/default/images/icons/zip.gif
  169. BIN  public/fckeditor/editor/filemanager/browser/default/images/spacer.gif
  170. +0 −88 public/fckeditor/editor/filemanager/browser/default/js/common.js
  171. +0 −147 public/fckeditor/editor/filemanager/browser/default/js/fckxml.js
  172. BIN  public/fckeditor/editor/images/anchor.gif
  173. BIN  public/fckeditor/editor/images/arrow_ltr.gif
  174. BIN  public/fckeditor/editor/images/arrow_rtl.gif
  175. BIN  public/fckeditor/editor/images/smiley/msn/angel_smile.gif
  176. BIN  public/fckeditor/editor/images/smiley/msn/angry_smile.gif
  177. BIN  public/fckeditor/editor/images/smiley/msn/broken_heart.gif
  178. BIN  public/fckeditor/editor/images/smiley/msn/cake.gif
  179. BIN  public/fckeditor/editor/images/smiley/msn/confused_smile.gif
  180. BIN  public/fckeditor/editor/images/smiley/msn/cry_smile.gif
  181. BIN  public/fckeditor/editor/images/smiley/msn/devil_smile.gif
  182. BIN  public/fckeditor/editor/images/smiley/msn/embaressed_smile.gif
  183. BIN  public/fckeditor/editor/images/smiley/msn/envelope.gif
  184. BIN  public/fckeditor/editor/images/smiley/msn/heart.gif
  185. BIN  public/fckeditor/editor/images/smiley/msn/kiss.gif
  186. BIN  public/fckeditor/editor/images/smiley/msn/lightbulb.gif
  187. BIN  public/fckeditor/editor/images/smiley/msn/omg_smile.gif
  188. BIN  public/fckeditor/editor/images/smiley/msn/regular_smile.gif
  189. BIN  public/fckeditor/editor/images/smiley/msn/sad_smile.gif
  190. BIN  public/fckeditor/editor/images/smiley/msn/shades_smile.gif
  191. BIN  public/fckeditor/editor/images/smiley/msn/teeth_smile.gif
  192. BIN  public/fckeditor/editor/images/smiley/msn/thumbs_down.gif
  193. BIN  public/fckeditor/editor/images/smiley/msn/thumbs_up.gif
  194. BIN  public/fckeditor/editor/images/smiley/msn/tounge_smile.gif
  195. BIN  public/fckeditor/editor/images/smiley/msn/whatchutalkingabout_smile.gif
  196. BIN  public/fckeditor/editor/images/smiley/msn/wink_smile.gif
  197. BIN  public/fckeditor/editor/images/spacer.gif
  198. +0 −176 public/fckeditor/editor/js/fckadobeair.js
  199. +0 −108 public/fckeditor/editor/js/fckeditorcode_gecko.js
  200. +0 −109 public/fckeditor/editor/js/fckeditorcode_ie.js
  201. +0 −78 public/fckeditor/editor/lang/_translationstatus.txt
  202. +0 −526 public/fckeditor/editor/lang/af.js
  203. +0 −526 public/fckeditor/editor/lang/ar.js
  204. +0 −526 public/fckeditor/editor/lang/bg.js
  205. +0 −526 public/fckeditor/editor/lang/bn.js
  206. +0 −526 public/fckeditor/editor/lang/bs.js
  207. +0 −526 public/fckeditor/editor/lang/ca.js
  208. +0 −526 public/fckeditor/editor/lang/cs.js
  209. +0 −526 public/fckeditor/editor/lang/da.js
  210. +0 −526 public/fckeditor/editor/lang/de.js
  211. +0 −526 public/fckeditor/editor/lang/el.js
  212. +0 −526 public/fckeditor/editor/lang/en-au.js
  213. +0 −526 public/fckeditor/editor/lang/en-ca.js
  214. +0 −526 public/fckeditor/editor/lang/en-uk.js
  215. +0 −526 public/fckeditor/editor/lang/en.js
  216. +0 −526 public/fckeditor/editor/lang/eo.js
  217. +0 −526 public/fckeditor/editor/lang/es.js
  218. +0 −526 public/fckeditor/editor/lang/et.js
  219. +0 −527 public/fckeditor/editor/lang/eu.js
  220. +0 −526 public/fckeditor/editor/lang/fa.js
  221. +0 −526 public/fckeditor/editor/lang/fi.js
  222. +0 −526 public/fckeditor/editor/lang/fo.js
  223. +0 −526 public/fckeditor/editor/lang/fr-ca.js
  224. +0 −526 public/fckeditor/editor/lang/fr.js
  225. +0 −526 public/fckeditor/editor/lang/gl.js
  226. +0 −526 public/fckeditor/editor/lang/gu.js
  227. +0 −526 public/fckeditor/editor/lang/he.js
  228. +0 −526 public/fckeditor/editor/lang/hi.js
  229. +0 −526 public/fckeditor/editor/lang/hr.js
Sorry, we could not display the entire diff because too many files (349) changed.
View
5 .gitignore
@@ -4,11 +4,12 @@ log/*.log
tmp/**/*
db/*.sqlite3
db/schema.rb
-config/database.yml
*.gem
.dotest
tmp/restart.txt
public/cache
.idea
.specification
-Gemfile.lock
+Gemfile.lock
+*.swp
+TODO
View
1  Gemfile
@@ -5,4 +5,5 @@ gem 'sqlite3'
gem 'factory_girl_rails', '1.0', :group=>:test
gem 'mocha', :require=>false, :group=>:test
+gem 'bcms_support'
gemspec
View
15 README.markdown
@@ -49,6 +49,20 @@ under 'Blog Comments', these comments will appear in draft status. They can be P
If the blog is set to no moderation, then comments will appear immediately. This obviously increases the likelyhood of spam, but staff can use the Content Library to delete the offending comments like any other content.
+## Feeds
+
+This module includes an RSS feeds route that can handle multiple blogs. To expose the RSS autodiscovery link, you can call the feeds\_link\_tag\_for helper in your template header:
+
+ <%= feeds_link_tag_for "MyBlog" %>
+
+Where "MyBlog" is the __name__ of the blog.
+
+If your site has multiple blogs, you need to call the helper once for every link you intend to expose:
+
+ <%= feeds_link_tag_for "MyBlog" %>
+ <%= feeds_link_tag_for "MyOtherBlog" %>
+
+
## Security
This module adds some additional level of security around blogs and content that are slightly different from a vanilla BrowserCMS installation. Here's the highlights:
@@ -92,7 +106,6 @@ Special thanks to some amazing folks from the BrowserCMS community for their wor
## Wishlist Features
-* RSS feeds - Each blog should have its own RSS feed created as part of the initial blog creation.
* Notifications for Comments - Blogs should have an option to be notified when a new comment is created. This will allow for practical management of comments/spam.
* Messaging for Moderated comments - If moderation is turned on, users get no feedback about the comment they just left. Ideally, they would get some sort of javascript notice that their comment is awaiting notification.
View
8 app/controllers/feeds_controller.rb
@@ -0,0 +1,8 @@
+class FeedsController < ApplicationController
+
+ def index
+ @blog = Blog.find(params[:blog_id])
+ @blog_posts = @blog.posts.published.all(:limit => 10, :order => "published_at DESC")
+ end
+
+end
View
6 app/helpers/cms/blog_helper.rb
@@ -7,5 +7,11 @@ def _blog_path(blog, route_name, route_params)
def _blog_post_path(blog_post)
send("#{blog_post.route_name}_path", blog_post.route_params)
end
+
+ def feeds_link_tag_for(name)
+ blog = Blog.find_by_name(name)
+ auto_discovery_link_tag(:rss, blog_feeds_url(:blog_id => blog), :title => "#{blog.name}")
+ end
+
end
View
2  app/helpers/feeds_helper.rb
@@ -0,0 +1,2 @@
+module FeedsHelper
+end
View
70 app/models/blog.rb
@@ -1,7 +1,7 @@
class Blog < ActiveRecord::Base
acts_as_content_block
+
has_many :posts, :class_name => "BlogPost", :conditions => { :published => true }, :order => "published_at desc"
-
has_many :blog_group_memberships
has_many :groups, :through => :blog_group_memberships
@@ -25,8 +25,8 @@ def self.default_template
end
def self.posts_finder(finder, options)
- if options[:tags]
- finder = finder.tagged_with(options[:tags])
+ if options[:tag]
+ finder = finder.tagged_with(options[:tag])
end
if options[:exclude_tags]
finder = finder.not_tagged_with(options[:exclude_tags])
@@ -88,72 +88,8 @@ def potential_authors
groups.map(&:users).flatten.uniq
end
-
- #-------------------------------------------------------------------------------------------------
-
def name_for_path
name.to_slug.gsub('-', '_')
end
-protected
- def after_create
- section = Section.find_by_name(name) || (
- section = Section.create!(
- :name => name,
- :path => "/#{name_for_path}",
- :parent_id => 1
- )
- section.groups << Group.find_by_code("cms-admin")
- section.groups << Group.find_by_code("guest")
- section.groups << Group.find_by_code("content-editor")
- section.save!
- section
- )
-
- page = Page.find_by_name(name) || Page.create!(
- :name => name,
- :path => "/#{name_for_path}",
- :section => section,
- :template_file_name => "default.html.erb",
- :hidden => true
- )
- page.create_connector(self, 'main')
- create_route(page, "#{name}: Posts In Day", "/#{name_for_path}/:year/:month/:day")
- create_route(page, "#{name}: Posts In Month", "/#{name_for_path}/:year/:month")
- create_route(page, "#{name}: Posts In Year", "/#{name_for_path}/:year")
- create_route(page, "#{name}: Posts With Tag", "/#{name_for_path}/tag/:tag")
- create_route(page, "#{name}: Posts In Category", "/#{name_for_path}/category/:category")
-
- page = Page.find_by_name(portlet_name = "#{name}: Post") || Page.create!(
- :name => portlet_name,
- :path => "/#{name_for_path}/post",
- :section => section,
- :template_file_name => "default.html.erb",
- :hidden => true)
- page.publish
- create_route( page, portlet_name, "/#{name_for_path}/:year/:month/:day/:slug")
- create_portlet(page, portlet_name, BlogPostPortlet)
-
- PageRoute.reload_routes
- end
-
- def create_route(page, name, pattern)
- route = page.page_routes.build(:name => name, :pattern => pattern, :code => "")
- route.add_condition(:method, "get")
- route.add_requirement(:year, '\d{4,}') if pattern.include?(":year")
- route.add_requirement(:month, '\d{2,}') if pattern.include?(":month")
- route.add_requirement(:day, '\d{2,}') if pattern.include?(":day")
- # route.send(:create_without_callbacks)
- route.save!
- end
-
- def create_portlet(page, name, portlet_class)
- portlet_class.create!(
- :name => "#{name} Portlet",
- :blog_id => self.id,
- :template => portlet_class.default_template,
- :connect_to_page_id => page.id,
- :connect_to_container => "main",
- :publish_on_save => true)
- end
end
View
137 app/models/blog_observer.rb
@@ -0,0 +1,137 @@
+class BlogObserver < ActiveRecord::Observer
+
+ def after_create(blog)
+ @blog = blog
+ create_section_pages_and_routes
+ end
+
+ def before_update(blog)
+ update_section_pages_and_route(blog)
+ end
+
+ def after_update(blog)
+ blog.publish
+ end
+
+ private
+ # A section, two pages, 6 routes and a portlet are created alongside every blog.
+ # This structure provides sensible defaults so users can pretty much start adding
+ # posts right after creating a blog without having to worry about where to put
+ # their blog and portlets.
+ def create_section_pages_and_routes
+ create_blog_section
+ create_blog_block_page
+ create_post_portlet_page
+ reload_routes
+ end
+
+ # Every blog is created within a section with the same name.
+ # For example, if you create a blog named 'MyBlog', a section 'MyBlog' will be
+ # created. This section will hold two pages: one for the blog ContentBlock that
+ # will render the list of posts and one for the BlogPost portlet (ie the individual
+ # post view)
+ def create_blog_section
+ @section = Section.find_by_name(@blog.name) || (
+ @section = Section.create!(
+ :name => @blog.name,
+ :path => "/#{@blog.name_for_path}",
+ :parent_id => 1
+ )
+ @section.groups << Group.find_by_code("cms-admin")
+ @section.groups << Group.find_by_code("guest")
+ @section.groups << Group.find_by_code("content-editor")
+ @section.save!
+ @section
+ )
+ end
+
+ # Following with the above example, the first page that is created is named 'MyBlog' and
+ # holds the Blog ContentBlock directly, not a portlet. Together with the 5 created routes,
+ # this page and its ContentBlock handle different post listings (all posts, posts in year,
+ # month or day and posts by tag or category).
+ def create_blog_block_page
+ page = Page.find_by_name(@blog.name) || Page.create!(
+ :name => @blog.name,
+ :path => "/#{@blog.name_for_path}",
+ :section => @section,
+ :template_file_name => "default.html.erb",
+ :hidden => true
+ )
+ page.create_connector(@blog, 'main')
+
+ create_route(page, "#{@blog.name}: Posts In Day", "/#{@blog.name_for_path}/:year/:month/:day")
+ create_route(page, "#{@blog.name}: Posts In Month", "/#{@blog.name_for_path}/:year/:month")
+ create_route(page, "#{@blog.name}: Posts In Year", "/#{@blog.name_for_path}/:year")
+ create_route(page, "#{@blog.name}: Posts With Tag", "/#{@blog.name_for_path}/tag/:tag")
+ create_route(page, "#{@blog.name}: Posts In Category", "/#{@blog.name_for_path}/category/:category")
+ end
+
+ # The second page that is created holds the BlogPostPortlet and displays the individual
+ # post view, along with it's comments.
+ def create_post_portlet_page
+ page = Page.find_by_name(portlet_name = "#{@blog.name}: Post") || Page.create!(
+ :name => portlet_name,
+ :path => "/#{@blog.name_for_path}/post",
+ :section => @section,
+ :template_file_name => "default.html.erb",
+ :hidden => true)
+ page.publish
+ create_route(page, portlet_name, "/#{@blog.name_for_path}/:year/:month/:day/:slug")
+ create_portlet(page, portlet_name, BlogPostPortlet)
+ end
+
+ # When the name of a Blog block changes, we need to change the Post page route.
+ # We also change the *names* of the section and pages that hold the blog block and
+ # post portlet because presumably, by changing the name of the blog, the intention
+ # was to reflect this name change in breadcrumbs and menus.
+ #
+ # Note that no other routes or paths are updated. This is intentional to be consistent
+ # with how BrowserCMS behaves when a Section or Page names change: paths are not
+ # updated automatically.
+ def update_section_pages_and_route(blog)
+ if blog.name_changed?
+ old_blog_name = blog.name_was
+
+ Section.find_by_name(old_blog_name).update_attribute(:name, blog.name)
+ PageRoute.find_by_name("#{old_blog_name}: Post").update_attribute(:name, "#{blog.name}: Post")
+
+ page = Page.find_by_name("#{old_blog_name}: Post")
+ page.update_attribute(:name, "#{blog.name}: Post")
+ page.publish
+
+ page = Page.find_by_name(old_blog_name)
+ page.update_attribute(:name, blog.name)
+ page.publish
+ end
+ end
+
+ def reload_routes
+ PageRoute.reload_routes
+ end
+
+ def create_route(page, name, pattern)
+ route = page.page_routes.build(:name => name, :pattern => pattern, :code => "")
+ # route.send(:create_without_callbacks)
+ route.save!
+ route.add_condition(:method, "get").save
+ route.add_requirement(:year, '\d{4,}') if pattern.include?(":year")
+ route.add_requirement(:month, '\d{2,}') if pattern.include?(":month")
+ route.add_requirement(:day, '\d{2,}') if pattern.include?(":day")
+ route.requirements.each(&:save)
+ end
+
+ def create_portlet(page, name, portlet_class)
+ portlet_class.create!(
+ :name => "#{name} Portlet",
+ :blog_id => @blog.id,
+ :template => portlet_class.default_template,
+ :connect_to_page_id => page.id,
+ :connect_to_container => "main",
+ :publish_on_save => true)
+ end
+end
+
+
+
+
+
View
2  app/models/blog_post.rb
@@ -78,7 +78,7 @@ def self.default_order
def self.columns_for_index
[ {:label => "Name", :method => :name, :order => "name" },
- {:label => "Published", :method => :published_label, :order => "published" } ]
+ {:label => "Published At", :method => :published_label, :order => "published_at" } ]
end
def published_label
View
18 app/views/feeds/index.rss.builder
@@ -0,0 +1,18 @@
+xml.instruct! :xml, :version=>"1.0"
+xml.rss(:version=>"2.0") do
+ xml.channel do
+ xml.title("#{@blog.name} Posts Feed")
+ xml.link(blog_feeds_url(:id => @blog.id, :format => "rss"))
+ xml.description("")
+ xml.language('en-us')
+ for post in @blog_posts
+ xml.item do
+ xml.title(post.name)
+ xml.description(post.summary) unless post.summary.blank?
+ xml.pubDate(post.published_at.strftime("%a, %d %b %Y %H:%M:%S %z")) unless post.published_at.blank?
+ xml.link(send("#{@blog.name_for_path}_post_url", post.route_params))
+ xml.guid(send("#{@blog.name_for_path}_post_url", post.route_params))
+ end
+ end
+ end
+end
View
48 app/views/partials/_blog_post.html.erb
@@ -1,44 +1,3 @@
-<style>
- .blog_post {
- border-bottom: 1px solid #ccc;
- margin-bottom: 20px;
- }
-
- .blog_post h2 {
- margin-bottom: 0
- }
-
- .blog_post h2,
- .blog_post h2 a {
- font: normal 30px/28px 'arial black', arial, sans-serif !important;
- text-decoration: none !important;
- }
- .blog_post h2 a:hover {
- text-decoration: underline !important;
- }
-
- .blog_post .image {
- float: left;
- border: 1px solid #ccc;
- margin: 10px;
- margin-top: 0;
- }
- .blog_post .date {
- color: #666;
- }
- .blog_post .read_more {
- font-weight: bold;
- }
-
- .blog_post .comment + .comment {
- border-top: 1px dashed #ccc;
- }
-
- .clear {
- clear: both;
- }
-</style>
-
<%
# _counter is defined only if we pass :collection to the partial
if defined?(blog_post_counter)
@@ -48,11 +7,9 @@
blog_post_counter = 0
end
%>
-
-<div id="blog_post_<%= blog_post.id %>" class="blog_post clear">
+<div id="blog_post_<%= blog_post.id %>" class="blog_post">
<% if blog_post.attachment %>
<div class="image">
- <%# image_tag_with_max_size blog_post.attachment.file_path, blog_post.attachment.full_file_location, :width => max_width %>
<%= image_tag blog_post.attachment.file_path %>
</div>
<% end %>
@@ -88,7 +45,8 @@
<%= link_to h(pluralize(blog_post.comments.published.count, "Comment")), "#{_blog_post_path(blog_post)}#comments" %>
</div>
- <br class="clear" />
+
+ <br />
<% comments = blog_post.comments.published.reject(&:new_record?) %>
<% if showing_individual_post and comments.any? -%>
View
10 app/views/portlets/blog_post/render.html.erb
@@ -1,10 +1,6 @@
<% page_title @blog_post.name %>
<%= render :partial => "partials/blog_post", :object => @blog_post %>
-<style>
- @import url('/stylesheets/cms/form_layout.css');
-</style>
-
<div class="blog_comment_form">
<% form_for @blog_comment, :url => cms_handler_path(@portlet, "create_comment") do |f| %>
<%= f.hidden_field :post_id %>
@@ -13,15 +9,15 @@
<%= f.label :author, 'Name *' %>
<%= f.text_field :author %>
</div>
- <div class="fields text_fields clear">
+ <div class="fields text_fields">
<%= f.label :email, 'E-mail address' %>
<%= f.text_field :email %>
</div>
- <div class="fields text_fields clear">
+ <div class="fields text_fields">
<%= f.label :url, 'Web site' %>
<%= f.text_field :url %>
</div>
- <div class="fields text_editor_fields clear">
+ <div class="fields text_editor_fields">
<%= f.label :body, 'Body *' %>
<br/>
<%= f.text_area :body, :size => "50x5", :style => 'height: auto' %>
View
11 bcms_blog.gemspec
@@ -1,27 +1,24 @@
Gem::Specification.new do |s|
s.name = %q{bcms_blog}
+ s.rubyforge_project = "bcms_blog"
s.version = "1.2.0"
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version
s.authors = ["BrowserMedia"]
- s.date = %q{2010-05-24}
+ s.date = %q{2010-07-11}
s.description = %q{The Blog Module for BrowserCMS}
- s.email = %q{github@browsermedia.com}
s.extra_rdoc_files = [
"LICENSE.txt",
"README.markdown"
]
- s.name = "bcms_blog"
- s.rubyforge_project = "bcms_blog"
s.summary = "The Blog Module for BrowserCMS"
s.email = "github@browsermedia.com"
s.homepage = "http://www.github.com/browsermedia/bcms_blog"
- s.description = "The Blog Module for BrowserCMS"
- s.authors = ["BrowserMedia"]
s.files = Dir["app/**/*"]
s.files += Dir["doc/**/*"]
s.files += Dir["db/migrate/[0-9]*.rb"].reject {|f| f =~ /_browsercms|_load_seed/ }
s.files += Dir["lib/**/*"]
s.files -= Dir["lib/tasks/build_gem.rake"]
s.add_dependency('browsercms', '3.3.0')
+
end
+
View
7 config/database.yml
@@ -0,0 +1,7 @@
+development:
+ adapter: sqlite3
+ database: db/dev.sqlite3
+
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
View
2  config/environment.rb
@@ -2,4 +2,4 @@
require File.expand_path('../application', __FILE__)
# Initialize the rails application
-BcmsBlog::Application.initialize!
+BcmsBlog::Application.initialize!
View
1  config/environments/test.rb
@@ -33,3 +33,4 @@
# Print deprecation notices to the stderr
config.active_support.deprecation = :stderr
end
+
View
13 doc/release_notes.txt
@@ -1,3 +1,11 @@
+v1.1.1
+
+- Blog partials and templates no longer include any css style declarations
+- Fixed browsing by tags, categories and dates
+- Fixed bug on page route conditions and requirements when creating a blog
+- Tests refactoring. Tests now depend on bcms_support gem
+
+
v1.1.0
This version introduces significant changes and improvements over version 1.0.0
@@ -34,7 +42,4 @@ https://browsermedia.lighthouseapp.com/projects/28481/tickets/163-review-and-int
Contributors:
=============
Tyler Rick
-Jon Leighton
-
-
-v1.0.0
+Jon Leighton
View
2  lib/bcms_blog/routes.rb
@@ -1,9 +1,11 @@
module Cms::Routes
def routes_for_bcms_blog
+ match '/blog/feeds', :to=>"feeds#index", :defaults=>{:format => "rss"}, :as=>'blog_feeds'
namespace(:cms) do
content_blocks :blogs
content_blocks :blog_posts
content_blocks :blog_comments
end
+
end
end
View
15 public/fckeditor/editor/css/behaviors/disablehandles.htc
@@ -1,15 +0,0 @@
-<public:component lightweight="true">
-
-<script language="javascript">
-
-function CancelEvent()
-{
- return false ;
-}
-
-this.onresizestart = CancelEvent ;
-this.onbeforeeditfocus = CancelEvent ;
-
-</script>
-
-</public:component>
View
36 public/fckeditor/editor/css/behaviors/showtableborders.htc
@@ -1,36 +0,0 @@
-<public:component lightweight="true">
-
-<public:attach event="oncontentready" onevent="ShowBorders()" />
-<public:attach event="onpropertychange" onevent="OnPropertyChange()" />
-
-<script language="javascript">
-
-var oClassRegex = /\s*FCK__ShowTableBorders/ ;
-
-function ShowBorders()
-{
- if ( this.border == 0 )
- {
- if ( !oClassRegex.test( this.className ) )
- this.className += ' FCK__ShowTableBorders' ;
- }
- else
- {
- if ( oClassRegex.test( this.className ) )
- {
- this.className = this.className.replace( oClassRegex, '' ) ;
- if ( this.className.length == 0 )
- this.removeAttribute( 'className', 0 ) ;
- }
- }
-}
-
-function OnPropertyChange()
-{
- if ( event.propertyName == 'border' || event.propertyName == 'className' )
- ShowBorders.call(this) ;
-}
-
-</script>
-
-</public:component>
View
110 public/fckeditor/editor/css/fck_editorarea.css
@@ -1,110 +0,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * This is the default CSS file used by the editor area. It defines the
- * initial font of the editor and background color.
- *
- * A user can configure the editor to use another CSS file. Just change
- * the value of the FCKConfig.EditorAreaCSS key in the configuration
- * file.
- */
-
-/**
- * The "body" styles should match your editor web site, mainly regarding
- * background color and font family and size.
- */
-
-body
-{
- background-color: #ffffff;
- padding: 5px 5px 5px 5px;
- margin: 0px;
-}
-
-body, td
-{
- font-family: Arial, Verdana, sans-serif;
- font-size: 12px;
-}
-
-a[href]
-{
- color: -moz-hyperlinktext !important; /* For Firefox... mark as important, otherwise it becomes black */
- text-decoration: -moz-anchor-decoration; /* For Firefox 3, otherwise no underline will be used */
-}
-
-/**
- * Just uncomment the following block if you want to avoid spaces between
- * paragraphs. Remember to apply the same style in your output front end page.
- */
-
-/*
-p, ul, li
-{
- margin-top: 0px;
- margin-bottom: 0px;
-}
-*/
-
-/**
- * Uncomment the following block, or only selected lines if appropriate,
- * if you have some style items that would break the styles combo box.
- * You can also write other CSS overrides inside the style block below
- * as needed and they will be applied to inside the style combo only.
- */
-
-/*
-.SC_Item *, .SC_ItemSelected *
-{
- margin: 0px !important;
- padding: 0px !important;
- text-indent: 0px !important;
- clip: auto !important;
- position: static !important;
-}
-*/
-
-/**
- * The following are some sample styles used in the "Styles" toolbar command.
- * You should instead remove them, and include the styles used by the site
- * you are using the editor in.
- */
-
-.Bold
-{
- font-weight: bold;
-}
-
-.Title
-{
- font-weight: bold;
- font-size: 18px;
- color: #cc3300;
-}
-
-.Code
-{
- border: #8b4513 1px solid;
- padding-right: 5px;
- padding-left: 5px;
- color: #000066;
- font-family: 'Courier New' , Monospace;
- background-color: #ff9933;
-}
View
199 public/fckeditor/editor/css/fck_internal.css
@@ -1,199 +0,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * This CSS Style Sheet defines rules used by the editor for its internal use.
- */
-
-/* #########
- * WARNING
- * #########
- * When changing this file, the minified version of it must be updated in the
- * fckeditor.html file (see FCK_InternalCSS).
- */
-
-/* Fix to allow putting the caret at the end of the content in Firefox if
- clicking below the content. */
-html
-{
- min-height: 100%;
-}
-
-table.FCK__ShowTableBorders, table.FCK__ShowTableBorders td, table.FCK__ShowTableBorders th
-{
- border: #d3d3d3 1px solid;
-}
-
-form
-{
- border: 1px dotted #FF0000;
- padding: 2px;
-}
-
-.FCK__Flash
-{
- border: #a9a9a9 1px solid;
- background-position: center center;
- background-image: url(images/fck_flashlogo.gif);
- background-repeat: no-repeat;
- width: 80px;
- height: 80px;
-}
-
-.FCK__UnknownObject
-{
- border: #a9a9a9 1px solid;
- background-position: center center;
- background-image: url(images/fck_plugin.gif);
- background-repeat: no-repeat;
- width: 80px;
- height: 80px;
-}
-
-/* Empty anchors images */
-.FCK__Anchor
-{
- border: 1px dotted #00F;
- background-position: center center;
- background-image: url(images/fck_anchor.gif);
- background-repeat: no-repeat;
- width: 16px;
- height: 15px;
- vertical-align: middle;
-}
-
-/* Anchors with content */
-.FCK__AnchorC
-{
- border: 1px dotted #00F;
- background-position: 1px center;
- background-image: url(images/fck_anchor.gif);
- background-repeat: no-repeat;
- padding-left: 18px;
-}
-
-/* Any anchor for non-IE, if we combine it with the previous rule IE ignores all. */
-a[name]
-{
- border: 1px dotted #00F;
- background-position: 0 center;
- background-image: url(images/fck_anchor.gif);
- background-repeat: no-repeat;
- padding-left: 18px;
-}
-
-.FCK__PageBreak
-{
- background-position: center center;
- background-image: url(images/fck_pagebreak.gif);
- background-repeat: no-repeat;
- clear: both;
- display: block;
- float: none;
- width: 100%;
- border-top: #999999 1px dotted;
- border-bottom: #999999 1px dotted;
- border-right: 0px;
- border-left: 0px;
- height: 5px;
-}
-
-/* Hidden fields */
-.FCK__InputHidden
-{
- width: 19px;
- height: 18px;
- background-image: url(images/fck_hiddenfield.gif);
- background-repeat: no-repeat;
- vertical-align: text-bottom;
- background-position: center center;
-}
-
-.FCK__ShowBlocks p,
-.FCK__ShowBlocks div,
-.FCK__ShowBlocks pre,
-.FCK__ShowBlocks address,
-.FCK__ShowBlocks blockquote,
-.FCK__ShowBlocks h1,
-.FCK__ShowBlocks h2,
-.FCK__ShowBlocks h3,
-.FCK__ShowBlocks h4,
-.FCK__ShowBlocks h5,
-.FCK__ShowBlocks h6
-{
- background-repeat: no-repeat;
- border: 1px dotted gray;
- padding-top: 8px;
- padding-left: 8px;
-}
-
-.FCK__ShowBlocks p
-{
- background-image: url(images/block_p.png);
-}
-
-.FCK__ShowBlocks div
-{
- background-image: url(images/block_div.png);
-}
-
-.FCK__ShowBlocks pre
-{
- background-image: url(images/block_pre.png);
-}
-
-.FCK__ShowBlocks address
-{
- background-image: url(images/block_address.png);
-}
-
-.FCK__ShowBlocks blockquote
-{
- background-image: url(images/block_blockquote.png);
-}
-
-.FCK__ShowBlocks h1
-{
- background-image: url(images/block_h1.png);
-}
-
-.FCK__ShowBlocks h2
-{
- background-image: url(images/block_h2.png);
-}
-
-.FCK__ShowBlocks h3
-{
- background-image: url(images/block_h3.png);
-}
-
-.FCK__ShowBlocks h4
-{
- background-image: url(images/block_h4.png);
-}
-
-.FCK__ShowBlocks h5
-{
- background-image: url(images/block_h5.png);
-}
-
-.FCK__ShowBlocks h6
-{
- background-image: url(images/block_h6.png);
-}
View
49 public/fckeditor/editor/css/fck_showtableborders_gecko.css
@@ -1,49 +0,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * This CSS Style Sheet defines the rules to show table borders on Gecko.
- */
-
-/* #########
- * WARNING
- * #########
- * When changing this file, the minified version of it must be updated in the
- * fckeditor.html file (see FCK_ShowTableBordersCSS).
- */
-
-/* For tables with the "border" attribute set to "0" */
-table[border="0"],
-table[border="0"] > tr > td, table[border="0"] > tr > th,
-table[border="0"] > tbody > tr > td, table[border="0"] > tbody > tr > th,
-table[border="0"] > thead > tr > td, table[border="0"] > thead > tr > th,
-table[border="0"] > tfoot > tr > td, table[border="0"] > tfoot > tr > th
-{
- border: #d3d3d3 1px dotted ;
-}
-
-/* For tables with no "border" attribute set */
-table:not([border]),
-table:not([border]) > tr > td, table:not([border]) > tr > th,
-table:not([border]) > tbody > tr > td, table:not([border]) > tbody > tr > th,
-table:not([border]) > thead > tr > td, table:not([border]) > thead > tr > th,
-table:not([border]) > tfoot > tr > td, table:not([border]) > tfoot > tr > th
-{
- border: #d3d3d3 1px dotted ;
-}
View
BIN  public/fckeditor/editor/css/images/block_address.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_blockquote.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_div.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_h1.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_h2.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_h3.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_h4.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_h5.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_h6.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_p.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/block_pre.png
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/fck_anchor.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/fck_flashlogo.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/fck_hiddenfield.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/fck_pagebreak.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/css/images/fck_plugin.gif
Deleted file not rendered
View
85 public/fckeditor/editor/dialog/common/fck_dialog_common.css
@@ -1,85 +0,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * This is the CSS file used for interface details in some dialog
- * windows.
- */
-
-/* #########
- * WARNING
- * #########
- * When changing this file, the minified version of it must be updated in the
- * fck_dialog_common.js file (see GetCommonDialogCss).
- */
-
-.ImagePreviewArea
-{
- border: #000000 1px solid;
- overflow: auto;
- width: 100%;
- height: 170px;
- background-color: #ffffff;
-}
-
-.FlashPreviewArea
-{
- border: #000000 1px solid;
- padding: 5px;
- overflow: auto;
- width: 100%;
- height: 170px;
- background-color: #ffffff;
-}
-
-.BtnReset
-{
- float: left;
- background-position: center center;
- background-image: url(images/reset.gif);
- width: 16px;
- height: 16px;
- background-repeat: no-repeat;
- border: 1px none;
- font-size: 1px ;
-}
-
-.BtnLocked, .BtnUnlocked
-{
- float: left;
- background-position: center center;
- background-image: url(images/locked.gif);
- width: 16px;
- height: 16px;
- background-repeat: no-repeat;
- border: none 1px;
- font-size: 1px ;
-}
-
-.BtnUnlocked
-{
- background-image: url(images/unlocked.gif);
-}
-
-.BtnOver
-{
- border: outset 1px;
- cursor: pointer;
- cursor: hand;
-}
View
311 public/fckeditor/editor/dialog/common/fck_dialog_common.js
@@ -1,311 +0,0 @@
-/*
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * Useful functions used by almost all dialog window pages.
- * Dialogs should link to this file as the very first script on the page.
- */
-
-// Automatically detect the correct document.domain (#123).
-(function()
-{
- var d = document.domain ;
-
- while ( true )
- {
- // Test if we can access a parent property.
- try
- {
- var test = window.parent.document.domain ;
- break ;
- }
- catch( e ) {}
-
- // Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
- d = d.replace( /.*?(?:\.|$)/, '' ) ;
-
- if ( d.length == 0 )
- break ; // It was not able to detect the domain.
-
- try
- {
- document.domain = d ;
- }
- catch (e)
- {
- break ;
- }
- }
-})() ;
-
-// Attention: FCKConfig must be available in the page.
-function GetCommonDialogCss( prefix )
-{
- // CSS minified by http://iceyboard.no-ip.org/projects/css_compressor (see _dev/css_compression.txt).
- return FCKConfig.BasePath + 'dialog/common/' + '|.ImagePreviewArea{border:#000 1px solid;overflow:auto;width:100%;height:170px;background-color:#fff}.FlashPreviewArea{border:#000 1px solid;padding:5px;overflow:auto;width:100%;height:170px;background-color:#fff}.BtnReset{float:left;background-position:center center;background-image:url(images/reset.gif);width:16px;height:16px;background-repeat:no-repeat;border:1px none;font-size:1px}.BtnLocked,.BtnUnlocked{float:left;background-position:center center;background-image:url(images/locked.gif);width:16px;height:16px;background-repeat:no-repeat;border:none 1px;font-size:1px}.BtnUnlocked{background-image:url(images/unlocked.gif)}.BtnOver{border:outset 1px;cursor:pointer;cursor:hand}' ;
-}
-
-// Gets a element by its Id. Used for shorter coding.
-function GetE( elementId )
-{
- return document.getElementById( elementId ) ;
-}
-
-function ShowE( element, isVisible )
-{
- if ( typeof( element ) == 'string' )
- element = GetE( element ) ;
- element.style.display = isVisible ? '' : 'none' ;
-}
-
-function SetAttribute( element, attName, attValue )
-{
- if ( attValue == null || attValue.length == 0 )
- element.removeAttribute( attName, 0 ) ; // 0 : Case Insensitive
- else
- element.setAttribute( attName, attValue, 0 ) ; // 0 : Case Insensitive
-}
-
-function GetAttribute( element, attName, valueIfNull )
-{
- var oAtt = element.attributes[attName] ;
-
- if ( oAtt == null || !oAtt.specified )
- return valueIfNull ? valueIfNull : '' ;
-
- var oValue = element.getAttribute( attName, 2 ) ;
-
- if ( oValue == null )
- oValue = oAtt.nodeValue ;
-
- return ( oValue == null ? valueIfNull : oValue ) ;
-}
-
-function SelectField( elementId )
-{
- var element = GetE( elementId ) ;
- element.focus() ;
-
- // element.select may not be available for some fields (like <select>).
- if ( element.select )
- element.select() ;
-}
-
-// Functions used by text fields to accept numbers only.
-var IsDigit = ( function()
- {
- var KeyIdentifierMap =
- {
- End : 35,
- Home : 36,
- Left : 37,
- Right : 39,
- 'U+00007F' : 46 // Delete
- } ;
-
- return function ( e )
- {
- if ( !e )
- e = event ;
-
- var iCode = ( e.keyCode || e.charCode ) ;
-
- if ( !iCode && e.keyIdentifier && ( e.keyIdentifier in KeyIdentifierMap ) )
- iCode = KeyIdentifierMap[ e.keyIdentifier ] ;
-
- return (
- ( iCode >= 48 && iCode <= 57 ) // Numbers
- || (iCode >= 35 && iCode <= 40) // Arrows, Home, End
- || iCode == 8 // Backspace
- || iCode == 46 // Delete
- || iCode == 9 // Tab
- ) ;
- }
- } )() ;
-
-String.prototype.Trim = function()
-{
- return this.replace( /(^\s*)|(\s*$)/g, '' ) ;
-}
-
-String.prototype.StartsWith = function( value )
-{
- return ( this.substr( 0, value.length ) == value ) ;
-}
-
-String.prototype.Remove = function( start, length )
-{
- var s = '' ;
-
- if ( start > 0 )
- s = this.substring( 0, start ) ;
-
- if ( start + length < this.length )
- s += this.substring( start + length , this.length ) ;
-
- return s ;
-}
-
-String.prototype.ReplaceAll = function( searchArray, replaceArray )
-{
- var replaced = this ;
-
- for ( var i = 0 ; i < searchArray.length ; i++ )
- {
- replaced = replaced.replace( searchArray[i], replaceArray[i] ) ;
- }
-
- return replaced ;
-}
-
-function OpenFileBrowser( url, width, height )
-{
- // oEditor must be defined.
-
- var iLeft = ( oEditor.FCKConfig.ScreenWidth - width ) / 2 ;
- var iTop = ( oEditor.FCKConfig.ScreenHeight - height ) / 2 ;
-
- var sOptions = "toolbar=no,status=no,resizable=yes,dependent=yes,scrollbars=yes" ;
- sOptions += ",width=" + width ;
- sOptions += ",height=" + height ;
- sOptions += ",left=" + iLeft ;
- sOptions += ",top=" + iTop ;
-
- window.open( url, 'FCKBrowseWindow', sOptions ) ;
-}
-
-/**
- Utility function to create/update an element with a name attribute in IE, so it behaves properly when moved around
- It also allows to change the name or other special attributes in an existing node
- oEditor : instance of FCKeditor where the element will be created
- oOriginal : current element being edited or null if it has to be created
- nodeName : string with the name of the element to create
- oAttributes : Hash object with the attributes that must be set at creation time in IE
- Those attributes will be set also after the element has been
- created for any other browser to avoid redudant code
-*/
-function CreateNamedElement( oEditor, oOriginal, nodeName, oAttributes )
-{
- var oNewNode ;
-
- // IE doesn't allow easily to change properties of an existing object,
- // so remove the old and force the creation of a new one.
- var oldNode = null ;
- if ( oOriginal && oEditor.FCKBrowserInfo.IsIE )
- {
- // Force the creation only if some of the special attributes have changed:
- var bChanged = false;
- for( var attName in oAttributes )
- bChanged |= ( oOriginal.getAttribute( attName, 2) != oAttributes[attName] ) ;
-
- if ( bChanged )
- {
- oldNode = oOriginal ;
- oOriginal = null ;
- }
- }
-
- // If the node existed (and it's not IE), then we just have to update its attributes
- if ( oOriginal )
- {
- oNewNode = oOriginal ;
- }
- else
- {
- // #676, IE doesn't play nice with the name or type attribute
- if ( oEditor.FCKBrowserInfo.IsIE )
- {
- var sbHTML = [] ;
- sbHTML.push( '<' + nodeName ) ;
- for( var prop in oAttributes )
- {
- sbHTML.push( ' ' + prop + '="' + oAttributes[prop] + '"' ) ;
- }
- sbHTML.push( '>' ) ;
- if ( !oEditor.FCKListsLib.EmptyElements[nodeName.toLowerCase()] )
- sbHTML.push( '</' + nodeName + '>' ) ;
-
- oNewNode = oEditor.FCK.EditorDocument.createElement( sbHTML.join('') ) ;
- // Check if we are just changing the properties of an existing node: copy its properties
- if ( oldNode )
- {
- CopyAttributes( oldNode, oNewNode, oAttributes ) ;
- oEditor.FCKDomTools.MoveChildren( oldNode, oNewNode ) ;
- oldNode.parentNode.removeChild( oldNode ) ;
- oldNode = null ;
-
- if ( oEditor.FCK.Selection.SelectionData )
- {
- // Trick to refresh the selection object and avoid error in
- // fckdialog.html Selection.EnsureSelection
- var oSel = oEditor.FCK.EditorDocument.selection ;
- oEditor.FCK.Selection.SelectionData = oSel.createRange() ; // Now oSel.type will be 'None' reflecting the real situation
- }
- }
- oNewNode = oEditor.FCK.InsertElement( oNewNode ) ;
-
- // FCK.Selection.SelectionData is broken by now since we've
- // deleted the previously selected element. So we need to reassign it.
- if ( oEditor.FCK.Selection.SelectionData )
- {
- var range = oEditor.FCK.EditorDocument.body.createControlRange() ;
- range.add( oNewNode ) ;
- oEditor.FCK.Selection.SelectionData = range ;
- }
- }
- else
- {
- oNewNode = oEditor.FCK.InsertElement( nodeName ) ;
- }
- }
-
- // Set the basic attributes
- for( var attName in oAttributes )
- oNewNode.setAttribute( attName, oAttributes[attName], 0 ) ; // 0 : Case Insensitive
-
- return oNewNode ;
-}
-
-// Copy all the attributes from one node to the other, kinda like a clone
-// But oSkipAttributes is an object with the attributes that must NOT be copied
-function CopyAttributes( oSource, oDest, oSkipAttributes )
-{
- var aAttributes = oSource.attributes ;
-
- for ( var n = 0 ; n < aAttributes.length ; n++ )
- {
- var oAttribute = aAttributes[n] ;
-
- if ( oAttribute.specified )
- {
- var sAttName = oAttribute.nodeName ;
- // We can set the type only once, so do it with the proper value, not copying it.
- if ( sAttName in oSkipAttributes )
- continue ;
-
- var sAttValue = oSource.getAttribute( sAttName, 2 ) ;
- if ( sAttValue == null )
- sAttValue = oAttribute.nodeValue ;
-
- oDest.setAttribute( sAttName, sAttValue, 0 ) ; // 0 : Case Insensitive
- }
- }
- // The style:
- oDest.style.cssText = oSource.style.cssText ;
-}
View
BIN  public/fckeditor/editor/dialog/common/images/locked.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/dialog/common/images/reset.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/dialog/common/images/unlocked.gif
Deleted file not rendered
View
161 public/fckeditor/editor/dialog/fck_about.html
@@ -1,161 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<!--
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * "About" dialog window.
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title></title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta name="robots" content="noindex, nofollow" />
- <script src="common/fck_dialog_common.js" type="text/javascript"></script>
- <script type="text/javascript">
-
-var oEditor = window.parent.InnerDialogLoaded() ;
-var FCKLang = oEditor.FCKLang ;
-
-window.parent.AddTab( 'About', FCKLang.DlgAboutAboutTab ) ;
-window.parent.AddTab( 'License', FCKLang.DlgAboutLicenseTab ) ;
-window.parent.AddTab( 'BrowserInfo', FCKLang.DlgAboutBrowserInfoTab ) ;
-
-// Function called when a dialog tag is selected.
-function OnDialogTabChange( tabCode )
-{
- ShowE('divAbout', ( tabCode == 'About' ) ) ;
- ShowE('divLicense', ( tabCode == 'License' ) ) ;
- ShowE('divInfo' , ( tabCode == 'BrowserInfo' ) ) ;
-}
-
-function SendEMail()
-{
- var eMail = 'mailto:' ;
- eMail += 'fredck' ;
- eMail += '@' ;
- eMail += 'fckeditor' ;
- eMail += '.' ;
- eMail += 'net' ;
-
- window.location = eMail ;
-}
-
-window.onload = function()
-{
- // Translate the dialog box texts.
- oEditor.FCKLanguageManager.TranslatePage(document) ;
-
- window.parent.SetAutoSize( true ) ;
-}
-
- </script>
-</head>
-<body style="overflow: hidden">
- <div id="divAbout">
- <table cellpadding="0" cellspacing="0" border="0" width="100%" style="height: 100%">
- <tr>
- <td colspan="2">
- <img alt="" src="fck_about/logo_fckeditor.gif" width="236" height="41" align="left" />
- <table width="80" border="0" cellspacing="0" cellpadding="5" bgcolor="#ffffff" align="right">
- <tr>
- <td align="center" nowrap="nowrap" style="border-right: #000000 1px solid; border-top: #000000 1px solid;
- border-left: #000000 1px solid; border-bottom: #000000 1px solid">
- <span fcklang="DlgAboutVersion">version</span>
- <br />
- <b>2.6.3</b><br />
- Build 19836</td>
- </tr>
- </table>
- </td>
- </tr>
- <tr style="height: 100%">
- <td align="center" valign="middle">
- <span style="font-size: 14px" dir="ltr">
- <b><a href="http://www.fckeditor.net/?about" target="_blank" title="Visit the FCKeditor web site">
- Support <b>Open Source</b> Software</a></b> </span>
- <div style="padding-top:15px">
- <img alt="" src="fck_about/logo_fredck.gif" width="87" height="36" />
- </div>
- </td>
- <td align="center" nowrap="nowrap" valign="middle">
- <div>
- <div style="margin-bottom:5px" dir="ltr">Selected Sponsor</div>
- <a href="http://www.spellchecker.net/fckeditor/" target="_blank"><img alt="Selected Sponsor" border="0" src="fck_about/sponsors/spellchecker_net.gif" width="75" height="75" /></a>
- </div>
- </td>
- </tr>
- <tr>
- <td width="100%" nowrap="nowrap">
- <span fcklang="DlgAboutInfo">For further information go to</span> <a href="http://www.fckeditor.net/?About"
- target="_blank">http://www.fckeditor.net/</a>.
- <br />
- Copyright &copy; 2003-2008 <a href="#" onclick="SendEMail();">Frederico Caldeira Knabben</a>
- </td>
- <td align="center">
- <a href="http://www.fckeditor.net/sponsors/apply" target="_blank">Become a Sponsor</a>
- </td>
- </tr>
- </table>
- </div>
- <div id="divLicense" style="display: none">
- <p>
- Licensed under the terms of any of the following licenses at your
- choice:
- </p>
- <ul>
- <li style="margin-bottom:15px">
- <b>GNU General Public License</b> Version 2 or later (the "GPL")<br />
- <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">http://www.gnu.org/licenses/gpl.html</a>
- </li>
- <li style="margin-bottom:15px">
- <b>GNU Lesser General Public License</b> Version 2.1 or later (the "LGPL")<br />
- <a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">http://www.gnu.org/licenses/lgpl.html</a>
- </li>
- <li>
- <b>Mozilla Public License</b> Version 1.1 or later (the "MPL")<br />
- <a href="http://www.mozilla.org/MPL/MPL-1.1.html" target="_blank">http://www.mozilla.org/MPL/MPL-1.1.html</a>
- </li>
- </ul>
- </div>
- <div id="divInfo" style="display: none" dir="ltr">
- <table align="center" width="80%" border="0">
- <tr>
- <td>
- <script type="text/javascript">
-<!--
-document.write( '<b>User Agent<\/b><br />' + window.navigator.userAgent + '<br /><br />' ) ;
-document.write( '<b>Browser<\/b><br />' + window.navigator.appName + ' ' + window.navigator.appVersion + '<br /><br />' ) ;
-document.write( '<b>Platform<\/b><br />' + window.navigator.platform + '<br /><br />' ) ;
-
-var sUserLang = '?' ;
-
-if ( window.navigator.language )
- sUserLang = window.navigator.language.toLowerCase() ;
-else if ( window.navigator.userLanguage )
- sUserLang = window.navigator.userLanguage.toLowerCase() ;
-
-document.write( '<b>User Language<\/b><br />' + sUserLang ) ;
-//-->
- </script>
- </td>
- </tr>
- </table>
- </div>
-</body>
-</html>
View
BIN  public/fckeditor/editor/dialog/fck_about/logo_fckeditor.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/dialog/fck_about/logo_fredck.gif
Deleted file not rendered
View
BIN  public/fckeditor/editor/dialog/fck_about/sponsors/spellchecker_net.gif
Deleted file not rendered
View
220 public/fckeditor/editor/dialog/fck_anchor.html
@@ -1,220 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
-<!--
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * Anchor dialog window.
--->
-<html>
- <head>
- <title>Anchor Properties</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
- <meta content="noindex, nofollow" name="robots">
- <script src="common/fck_dialog_common.js" type="text/javascript"></script>
- <script type="text/javascript">
-
-var dialog = window.parent ;
-var oEditor = dialog.InnerDialogLoaded() ;
-
-var FCK = oEditor.FCK ;
-var FCKBrowserInfo = oEditor.FCKBrowserInfo ;
-var FCKTools = oEditor.FCKTools ;
-var FCKRegexLib = oEditor.FCKRegexLib ;
-
-var oDOM = FCK.EditorDocument ;
-
-var oFakeImage = dialog.Selection.GetSelectedElement() ;
-
-var oAnchor ;
-
-if ( oFakeImage )
-{
- if ( oFakeImage.tagName == 'IMG' && oFakeImage.getAttribute('_fckanchor') )
- oAnchor = FCK.GetRealElement( oFakeImage ) ;
- else
- oFakeImage = null ;
-}
-
-//Search for a real anchor
-if ( !oFakeImage )
-{
- oAnchor = FCK.Selection.MoveToAncestorNode( 'A' ) ;
- if ( oAnchor )
- FCK.Selection.SelectNode( oAnchor ) ;
-}
-
-window.onload = function()
-{
- // First of all, translate the dialog box texts
- oEditor.FCKLanguageManager.TranslatePage(document) ;
-
- if ( oAnchor )
- GetE('txtName').value = oAnchor.name ;
- else
- oAnchor = null ;
-
- window.parent.SetOkButton( true ) ;
- window.parent.SetAutoSize( true ) ;
-
- SelectField( 'txtName' ) ;
-}
-
-function Ok()
-{
- var sNewName = GetE('txtName').value ;
-
- // Remove any illegal character in a name attribute:
- // A name should start with a letter, but the validator passes anyway.
- sNewName = sNewName.replace( /[^\w-_\.:]/g, '_' ) ;
-
- if ( sNewName.length == 0 )
- {
- // Remove the anchor if the user leaves the name blank
- if ( oAnchor )
- {
- // Removes the current anchor from the document using the new command
- FCK.Commands.GetCommand( 'AnchorDelete' ).Execute() ;
- return true ;
- }
-
- alert( oEditor.FCKLang.DlgAnchorErrorName ) ;
- return false ;
- }
-
- oEditor.FCKUndo.SaveUndoStep() ;
-
- if ( oAnchor ) // Modifying an existent anchor.
- {
- ReadjustLinksToAnchor( oAnchor.name, sNewName );
-
- // Buggy explorer, bad bad browser. http://alt-tag.com/blog/archives/2006/02/ie-dom-bugs/
- // Instead of just replacing the .name for the existing anchor (in order to preserve the content), we must remove the .name
- // and assign .name, although it won't appear until it's specially processed in fckxhtml.js
-
- // We remove the previous name
- oAnchor.removeAttribute( 'name' ) ;
- // Now we set it, but later we must process it specially
- oAnchor.name = sNewName ;
-
- return true ;
- }
-
- // Create a new anchor preserving the current selection
- var aNewAnchors = oEditor.FCK.CreateLink( '#' ) ;
-
- if ( aNewAnchors.length == 0 )
- aNewAnchors.push( oEditor.FCK.InsertElement( 'a' ) ) ;
- else
- {
- // Remove the fake href
- for ( var i = 0 ; i < aNewAnchors.length ; i++ )
- aNewAnchors[i].removeAttribute( 'href' ) ;
- }
-
- // More than one anchors may have been created, so interact through all of them (see #220).
- for ( var i = 0 ; i < aNewAnchors.length ; i++ )
- {
- oAnchor = aNewAnchors[i] ;
-
- // Set the name
- if ( FCKBrowserInfo.IsIE )
- {
- // Setting anchor names directly in IE will trash the HTML code stored
- // in FCKTempBin after undos. See #2263.
- var replaceAnchor = oEditor.FCK.EditorDocument.createElement( '<a name="' +
- FCKTools.HTMLEncode( sNewName ).replace( '"', '&quot;' ) + '">' ) ;
- oEditor.FCKDomTools.MoveChildren( oAnchor, replaceAnchor ) ;
- oAnchor.parentNode.replaceChild( replaceAnchor, oAnchor ) ;
- oAnchor = replaceAnchor ;
- }
- else
- oAnchor.name = sNewName ;
-
- // IE does require special processing to show the Anchor's image
- // Opera doesn't allow to select empty anchors
- if ( FCKBrowserInfo.IsIE || FCKBrowserInfo.IsOpera )
- {
- if ( oAnchor.innerHTML != '' )
- {
- if ( FCKBrowserInfo.IsIE )
- oAnchor.className += ' FCK__AnchorC' ;
- }
- else
- {
- // Create a fake image for both IE and Opera
- var oImg = oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Anchor', oAnchor.cloneNode(true) ) ;
- oImg.setAttribute( '_fckanchor', 'true', 0 ) ;
-
- oAnchor.parentNode.insertBefore( oImg, oAnchor ) ;
- oAnchor.parentNode.removeChild( oAnchor ) ;
- }
-
- }
- }
-
- return true ;
-}
-
-// Checks all the links in the current page pointing to the current name and changes them to the new name
-function ReadjustLinksToAnchor( sCurrent, sNew )
-{
- var oDoc = FCK.EditorDocument ;
-
- var aLinks = oDoc.getElementsByTagName( 'A' ) ;
-
- var sReference = '#' + sCurrent ;
- // The url of the document, so we check absolute and partial references.
- var sFullReference = oDoc.location.href.replace( /(#.*$)/, '') ;
- sFullReference += sReference ;
-
- var oLink ;
- var i = aLinks.length - 1 ;
- while ( i >= 0 && ( oLink = aLinks[i--] ) )
- {
- var sHRef = oLink.getAttribute( '_fcksavedurl' ) ;
- if ( sHRef == null )
- sHRef = oLink.getAttribute( 'href' , 2 ) || '' ;
-
- if ( sHRef == sReference || sHRef == sFullReference )
- {
- oLink.href = '#' + sNew ;
- SetAttribute( oLink, '_fcksavedurl', '#' + sNew ) ;
- }
- }
-}
-
- </script>
- </head>
- <body style="overflow: hidden">
- <table height="100%" width="100%">
- <tr>
- <td align="center">
- <table border="0" cellpadding="0" cellspacing="0" width="80%">
- <tr>
- <td>
- <span fckLang="DlgAnchorName">Anchor Name</span><BR>
- <input id="txtName" style="WIDTH: 100%" type="text">
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </body>
-</html>
View
104 public/fckeditor/editor/dialog/fck_button.html
@@ -1,104 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
-<!--
- * FCKeditor - The text editor for Internet - http://www.fckeditor.net
- * Copyright (C) 2003-2008 Frederico Caldeira Knabben
- *
- * == BEGIN LICENSE ==
- *
- * Licensed under the terms of any of the following licenses at your
- * choice:
- *
- * - GNU General Public License Version 2 or later (the "GPL")
- * http://www.gnu.org/licenses/gpl.html
- *
- * - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
- * http://www.gnu.org/licenses/lgpl.html
- *
- * - Mozilla Public License Version 1.1 or later (the "MPL")
- * http://www.mozilla.org/MPL/MPL-1.1.html
- *
- * == END LICENSE ==
- *
- * Button dialog window.
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>Button Properties</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <meta content="noindex, nofollow" name="robots" />
- <script src="common/fck_dialog_common.js" type="text/javascript"></script>
- <script type="text/javascript">
-
-var dialog = window.parent ;
-var oEditor = dialog.InnerDialogLoaded() ;
-
-// Gets the document DOM
-var oDOM = oEditor.FCK.EditorDocument ;
-
-var oActiveEl = dialog.Selection.GetSelectedElement() ;
-
-window.onload = function()
-{
- // First of all, translate the dialog box texts
- oEditor.FCKLanguageManager.TranslatePage(document) ;
-
- if ( oActiveEl && oActiveEl.tagName.toUpperCase() == "INPUT" && ( oActiveEl.type == "button" || oActiveEl.type == "submit" || oActiveEl.type == "reset" ) )
- {
- GetE('txtName').value = oActiveEl.name ;
- GetE('txtValue').value = oActiveEl.value ;
- GetE('txtType').value = oActiveEl.type ;
- }
- else
- oActiveEl = null ;
-
- dialog.SetOkButton( true ) ;
- dialog.SetAutoSize( true ) ;
- SelectField( 'txtName' ) ;
-}
-
-function Ok()
-{
- oEditor.FCKUndo.SaveUndoStep() ;
-
- oActiveEl = CreateNamedElement( oEditor, oActiveEl, 'INPUT', {name: GetE('txtName').value, type: GetE('txtType').value } ) ;
-
- SetAttribute( oActiveEl, 'value', GetE('txtValue').value ) ;
-
- return true ;
-}
-
- </script>
-</head>
-<body style="overflow: hidden">
- <table width="100%" style="height: 100%">
- <tr>
- <td align="center">
- <table border="0" cellpadding="0" cellspacing="0" width="80%">
- <tr>
- <td colspan="">
- <span fcklang="DlgCheckboxName">Name</span><br />
- <input type="text" size="20" id="txtName" style="width: 100%" />
- </td>
- </tr>
- <tr>
- <td>
- <span fcklang="DlgButtonText">Text (Value)</span><br />
- <input type="text" id="txtValue" style="width: 100%" />
- </td>
- </tr>
- <tr>
- <td>
- <span fcklang="DlgButtonType">Type</span><br />
- <select id="txtType">
- <option fcklang="DlgButtonTypeBtn" value="button" selected="selected">Button</option>
- <option fcklang="DlgButtonTypeSbm" value="submit">Submit</option>
- <option fcklang="DlgButtonTypeRst" value="reset">Reset</option>
- </select>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-</body>
-</html>