diff -Nur mephisto-0.7.3/CHANGELOG technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/CHANGELOG
--- mephisto-0.7.3/CHANGELOG 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/CHANGELOG 2008-03-31 02:18:56.000000000 -0400
@@ -1,5 +1,149 @@
+* SVN *
+
+* Experimental comment preview. [court3nay]
+
+* Add multi-site admin interface. [Vincent, j2m]
+
+* Update Wordpress converter to support Wordpress 2.3+. [Aubrey]
+
+* refactor so that admin/comments is more restful, allow inline comment editing in the admin. [court3nay]
+
+* convert to cookie sessions.
+
+* Fix some failing test issues and git => svn sync errors. [Aubrey, octopod]
+
+* Fix issue where duplicate permalinks are allowed.
+
+* Fix admin/users issue where site admins could disable mephisto admins.
+
+* Fix nil.accept_comments? bug in CommentForm block.
+
+* allow the various link_to filters to accept multiple args to specify more html attributes. [rob-twf]
+
+ # use this order: :text, :title, :id, :class, :rel
+ link_to_article article, "click here", "this article", "article-1", "articles", "whatever-rel-means"
+
+* encode search/tag urls properly. [rob-twf]
+
+* update article forms to explain new tag syntax (comma and space delimited tags) [xavier, rick]
+
+* start converting tests to rspec.
+
+* tweak mephisto_init to support the new ActionController::Dispatcher class. [Rob Anderton]
+
+* Don't generate an article event for unversioned changes. [Marcus Brito]
+
+* Switch to will_paginate plugin. [Mislav]
+
+* unit test fixes for those not using mysql or psql. [Mislav]
+
+* add comment moderation links to the overview. [court3nay]
+
+* convert tests to use test/spec instead of simply bdd. [Chris McGrath]
+
+* move xmlrpc stuff to plugin. rails doesn't include AWS anymore. May need some simple autodetection so the plugin just prints a warning if AWS isn't found.
+
+* turn off session for mephisto controller. sorry, caused way too many problems.
+
+* fix url_for calls with symbolized controllers/actions.
+
+* Fix controllers so include_into works with them.
+
+* Change plugin class/module to Mephisto::Plugin and Mephisto::Plugins. Sorry for the breakage (still technically experimental!).
+
+* Fix admin overview date timezone. [Ben Wyrosdick]
+
+* Extract template rendering code to separate handler class, add support for alternate template handlers. [Pascal Belloncle]
+
+* Add {{ article.next }} and {{ article | next: section }} for paginating articles [Pascal Belloncle]
+
+* [converters] initial movable type support [sd]
+
+* [converters] use no filter for wordpress articles
+
+* Small bug fixes
+ - show correct asset thumbnail url
+ - assert with correct named asset resource route
+ - add missing fixtures for About Section Feed Test
+ - update asset labeling tests to reflect current behavior
+
+* RESTRICT hyphens as a possible separator for permalink styles. [Chris Wanstrath]
+
+* Initial article/asset assignment support. Perfect for podcasting.
+
+* Raise MissingThemesError if Site#theme is nil
+
+* RIP: Site#search_layout
+
+* Add link_to_search_result filter that uses either a paged or blog permalink, depending on the search section.
+
+* Allow search page to take ?s parameter to specify section path.
+
+ * nil (default) - all sections
+ * '' (empty string) - home section
+ * 'foo/bar' - given section
+
+* Initial Plugin Whammy Jammy [Nick Faiz, Rick Olson]
+
+* link_to_section adds class='selected' for the current section [Tammo Freese]
+
+* Process article permalinks with Iconv.
+
+* Support rel-tag microformat by default in liquid filters
+
+* Make ImageScience the default image processor for assets.
+ If you wish to configure this, set ASSET_IMAGE_PROCESSOR to one of 3 values in environment.rb
+
+ ASSET_IMAGE_PROCESSOR = :image_science || :rmagick || :none
+
+* paged section feeds will show the paged url for articles instead of the long permalink.
+
+* Replace a couple @article.full_permalink instances with @site.permalink_for(@article) [defunkt]
+
+# Allow Resource#non_image_extnames to be overridden by plugins [myles_b]
+
+* filter password fields in logs [chrissturm]
+
+* add *.ico to list of approved extensions for theme resources [myles_b]
+
+* Link comments to the currently logged in user, requires latest edge/1.2 rails [Josh Susser]
+
+* Convert typo filters and permalinks to mephisto [Josh Susser]
+
+* replace acts_as_attachment with attachment_fu plugin
+
+* add tags to atom feed [evilchelu]
+
+* flexible theme names in routes [evilchelu]
+
+* update liquid plugin
+
+* use default test.host domain where possible [courtenay]
+
+* fix test ensuring that comments, not articles are sanitized for script tags [courtenay]
+
+* fix articles form for latest rails 1.2 changes to date helpers [courtenay]
+
+* fix test that breaks in multi-site mode [courtenay]
+
+* Allow Modules to use #include_into to dynamically mixin to loaded classes (plugin stuff)
+
+* Allow custom routes.
+
+ Mephisto::Routing.connect_with map do
+ map.foo ...
+ end
+
+* fix that only published articles are available as section pages.
+
+Add sorting for liquid for statements.
+
+ {% for page in section.pages limit: 3 sort_by: title %}
+
* 0.7.3 *
+* Fix duplicate tag bug.
+
* add Mephisto.root javascript variable in case a mephisto site sets the relative_url_root
* don't sanitize custom anchor text for liquid filters [Jonathan Leighton]
@@ -52,7 +196,9 @@
* Remove any notion of a template hierarchy, and the page template itself. Paged sections now default to the 'single' template.
* Added {{ mode }} so you can check what 'view' you're in.
-
+
+ {% unless mode == 'single' %} Read more {% endunless %}
+
* Ensure templates are sorted by name [Brian Chapados]
* Fix bug that was caching redirected routes.
@@ -290,4 +436,4 @@
{% endif %}
{% endfor %}
-* Fix issue where Articles don't allow comments with comment_age = 0 [Rick]
\ No newline at end of file
+* Fix issue where Articles don't allow comments with comment_age = 0 [Rick]
diff -Nur mephisto-0.7.3/LICENSE technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/LICENSE
--- mephisto-0.7.3/LICENSE 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/LICENSE 2008-03-31 02:18:56.000000000 -0400
@@ -1,4 +1,4 @@
-Copyright (c) 2005 Rick Olson
+Copyright (c) 2005-2008 Rick Olson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
@@ -17,4 +17,4 @@
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff -Nur mephisto-0.7.3/README technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/README
--- mephisto-0.7.3/README 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/README 2008-03-31 02:18:56.000000000 -0400
@@ -5,7 +5,7 @@
= Timezones
You MUST export the environment variable TZ=UTC, or else the article dates
-and times will be fubar.
+and times will be invalid.
This would not be needed if rails used UTC for everything, but
unfortunately it doesn't... eg: action_view/helpers/date_helper.rb uses
@@ -19,4 +19,4 @@
= License
Mephisto is distributed under the same license as Ruby on Rails. See
-http://www.opensource.org/licenses/mit-license.php
\ No newline at end of file
+http://www.opensource.org/licenses/mit-license.php
diff -Nur mephisto-0.7.3/app/apis/meta_weblog_api.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_api.rb
--- mephisto-0.7.3/app/apis/meta_weblog_api.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_api.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,31 +0,0 @@
-class MetaWeblogApi < ActionWebService::API::Base
- inflect_names false
-
- api_method :getCategories,
- :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string} ],
- :returns => [[:string]]
-
- api_method :getPost,
- :expects => [ {:postid => :string}, {:username => :string}, {:password => :string} ],
- :returns => [MetaWeblogStructs::Article]
-
- api_method :getRecentPosts,
- :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:numberOfPosts => :int} ],
- :returns => [[MetaWeblogStructs::Article]]
-
- api_method :deletePost,
- :expects => [ {:appkey => :string}, {:postid => :string}, {:username => :string}, {:password => :string}, {:publish => :int} ],
- :returns => [:bool]
-
- api_method :editPost,
- :expects => [ {:postid => :string}, {:username => :string}, {:password => :string}, {:struct => MetaWeblogStructs::Article}, {:publish => :int} ],
- :returns => [:bool]
-
- api_method :newPost,
- :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:struct => MetaWeblogStructs::Article}, {:publish => :int} ],
- :returns => [:string]
-
- api_method :newMediaObject,
- :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:data => MetaWeblogStructs::MediaObject} ],
- :returns => [MetaWeblogStructs::Url]
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/apis/meta_weblog_service.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_service.rb
--- mephisto-0.7.3/app/apis/meta_weblog_service.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_service.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,91 +0,0 @@
-class MetaWeblogService < XmlRpcService
- web_service_api MetaWeblogApi
- before_invocation :authenticate
-
- def getCategories(blogid, username, password)
- site.sections.find(:all, :order => 'id ASC').collect &:name
- end
-
- def getPost(postid, username, password)
- article = @user.articles.find(postid)
- article_dto_from(article)
- end
-
- def getRecentPosts(blogid, username, password, numberOfPosts)
- @user.articles.find(:all, :order => "created_at DESC", :limit => numberOfPosts).collect{ |c| article_dto_from(c) }
- end
-
- def newPost(blogid, username, password, struct, publish)
- article = @user.articles.build :site => site
- post_it(article, username, password, struct, publish)
- end
-
- def editPost(postid, username, password, struct, publish)
- article = @user.articles.find(postid)
- post_it(article, username, password, struct, publish)
- true
- end
-
- def deletePost(appkey, postid, username, password, publish)
- article = @user.articles.find(postid)
- article.destroy
- true
- end
-
- def newMediaObject(blogid, username, password, data)
- asset = site.assets.create!(
- :filename => data['name'],
- :content_type => (data['type'] || guess_content_type_from(data['name'])),
- :attachment_data => data['bits']
- )
- MetaWeblogStructs::Url.new("url" => asset.public_filename)
- end
-
- def article_dto_from(article)
- MetaWeblogStructs::Article.new(
- :description => article.body,
- :title => article.title,
- :postid => article.id.to_s,
- :url => article_url(article).to_s,
- :link => article_url(article).to_s,
- :permaLink => article.permalink.to_s,
- :categories => article.sections.collect { |c| c.name },
- :mt_text_more => article.body.to_s,
- :mt_excerpt => article.excerpt.to_s,
- :mt_keywords => article.tag,
- # :mt_allow_comments => article.allow_comments? ? 1 : 0,
- # :mt_allow_pings => article.allow_pings? ? 1 : 0,
- # :mt_convert_breaks => (article.text_filter.name.to_s rescue ''),
- # :mt_tb_ping_urls => article.pings.collect { |p| p.url },
- :dateCreated => (article.published_at rescue "")
- )
- end
-
- protected
- def article_url(article)
- article.published? && article.full_permalink
- end
-
- def post_it(article, user, password, struct, publish)
- # make sure publish is true if it's 1 if not leave it the way it is.
- publish = publish == 1 || publish
- # if no categories are supplied do not attempt to set any.
- article.section_ids = Section.find(:all, :conditions => ['name IN (?)', struct['categories']]).collect(&:id) if struct['categories']
- article.attributes = {:updater => @user, :body => struct['description'].to_s, :title => struct['title'].to_s, :excerpt => struct['mt_excerpt'].to_s}
- # Keywords/Tags support
- Tagging.set_on article, struct['mt_keywords'] if struct['mt_keywords'] # set/modify keywords _only_ if they are supplied. mt_keywords _overwrite_ not alter the ``tags''
-
- utc_date = Time.utc(struct['dateCreated'].year, struct['dateCreated'].month, struct['dateCreated'].day, struct['dateCreated'].hour, struct['dateCreated'].sec, struct['dateCreated'].min) rescue article.published_at || Time.now.utc
- article.published_at = publish == true ? utc_date : nil
- article.save!
- article.id
- end
-
- def guess_content_type_from(name)
- if name =~ /(png|gif|jpe?g)/i
- "image/#{$1 == 'jpg' ? 'jpeg' : $1}"
- else
- 'application/octet-stream'
- end
- end
-end
diff -Nur mephisto-0.7.3/app/apis/meta_weblog_structs/article.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_structs/article.rb
--- mephisto-0.7.3/app/apis/meta_weblog_structs/article.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_structs/article.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,19 +0,0 @@
-module MetaWeblogStructs
- class Article < ActionWebService::Struct
- member :description, :string
- member :title, :string
- member :postid, :string
- member :url, :string
- member :link, :string
- member :permaLink, :string
- member :categories, [:string]
- member :mt_text_more, :string
- member :mt_excerpt, :string
- member :mt_keywords, :string
- member :mt_allow_comments, :int
- member :mt_allow_pings, :int
- member :mt_convert_breaks, :string
- member :mt_tb_ping_urls, [:string]
- member :dateCreated, :time
- end
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/apis/meta_weblog_structs/media_object.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_structs/media_object.rb
--- mephisto-0.7.3/app/apis/meta_weblog_structs/media_object.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_structs/media_object.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,7 +0,0 @@
-module MetaWeblogStructs
- class MediaObject < ActionWebService::Struct
- member :bits, :string
- member :name, :string
- member :type, :string
- end
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/apis/meta_weblog_structs/url.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_structs/url.rb
--- mephisto-0.7.3/app/apis/meta_weblog_structs/url.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/meta_weblog_structs/url.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,5 +0,0 @@
-module MetaWeblogStructs
- class Url < ActionWebService::Struct
- member :url, :string
- end
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/apis/movable_type_api.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_api.rb
--- mephisto-0.7.3/app/apis/movable_type_api.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_api.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,88 +0,0 @@
-class MovableTypeApi < ActionWebService::API::Base
- inflect_names false
-
- # Movable Type Programatic interface
- # see:
- # supportedTextFilters has already been there!
- # - Moritz Angermann
- #
- # mt.getRecentPostTitles
- # Description: Returns a bandwidth-friendly list of the most recent posts in the system.
- # Parameters: String blogid, String username, String password, int numberOfPosts
- # Return value: on success, array of structs containing ISO.8601 dateCreated, String userid, String postid, String title; on failure, fault
- # Notes: dateCreated is in the timezone of the weblog blogid
- # Reference:
-
- #api_method :getRecentPostTitles,
- # :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string}, {:numberOfPosts => :int} ],
- # :returns => [[MovableTypeStructs::Post]]
-
- # mt.getCategoryList
- # Description: Returns a list of all categories defined in the weblog.
- # Parameters: String blogid, String username, String password
- # Return value: on success, an array of structs containing String categoryId and String categoryName; on failure, fault.
- # Reference:
- api_method :getCategoryList,
- :expects => [ {:blogid => :string}, {:username => :string}, {:password => :string} ],
- :returns => [[MovableTypeStructs::Category]]
-
- # mt.getPostCategories
- # Description: Returns a list of all categories to which the post is assigned.
- # Parameters: String postid, String username, String password
- # Return value: on success, an array of structs containing String categoryName, String categoryId, and boolean isPrimary; on failure, fault.
- # Notes: isPrimary denotes whether a category is the post's primary category.
- # Reference:
- api_method :getPostCategories,
- :expects => [ {:postid => :string}, {:username => :string}, {:password => :string} ],
- :returns => [[MovableTypeStructs::Category]]
-
- # mt.setPostCategories
- # Description: Sets the categories for a post.
- # Parameters: String postid, String username, String password, array categories
- # Return value: on success, boolean true value; on failure, fault
- # Notes: the array categories is an array of structs containing String categoryId and boolean isPrimary. Using isPrimary to set the primary category is optional--in the absence of this flag, the first struct in the array will be assigned the primary category for the post.
- # Reference:
- api_method :setPostCategories,
- :expects => [ {:postid => :string}, {:username => :string}, {:password => :string}, {:categories => [MovableTypeStructs::PostCategory]} ],
- :returns => [:bool]
-
- # mt.supportedMethods
- # Description: Retrieve information about the XML-RPC methods supported by the server.
- # Parameters: none
- # Return value: an array of method names supported by the server.
- # Reference:
-
- api_method :supportedMethods,
- :expects => [],
- :returns => [[:string]]
-
- # mt.supportedTextFilters
- # Description: Retrieve information about the text formatting plugins supported by the server.
- # Parameters: none
- # Return value: an array of structs containing String key and String label. key is the unique string identifying a text formatting plugin, and label is the readable description to be displayed to a user. key is the value that should be passed in the mt_convert_breaks parameter to newPost and editPost.
- # Reference:
-
- api_method :supportedTextFilters,
- :expects => [],
- :returns => [[MovableTypeStructs::TextFilter]]
-
- # mt.getTrackbackPings
- # Description: Retrieve the list of TrackBack pings posted to a particular entry. This could be used to programmatically retrieve the list of pings for a particular entry, then iterate through each of those pings doing the same, until one has built up a graph of the web of entries referencing one another on a particular topic.
- # Parameters: String postid
- # Return value: an array of structs containing String pingTitle (the title of the entry sent in the ping), String pingURL (the URL of the entry), and String pingIP (the IP address of the host that sent the ping).
- # Reference:
-
- # api_method :getTrackbackPings,
- # :expects => [ {:postid => :string} ],
- # :returns => [[MovableTypeStructs::Trackback]]
-
- # mt.publishPost
- # Description: Publish (rebuild) all of the static files related to an entry from your weblog. Equivalent to saving an entry in the system (but without the ping).
- # Parameters: String postid, String username, String password
- # Returns value: on success, boolean true value; on failure, fault
- # Reference:
-
- #api_method :publishPost,
- # :expects => [ {:postid => :string}, {:username => :string}, {:password => :string} ],
- # :returns => [:bool]
-end
diff -Nur mephisto-0.7.3/app/apis/movable_type_service.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_service.rb
--- mephisto-0.7.3/app/apis/movable_type_service.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_service.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,44 +0,0 @@
-class MovableTypeService < XmlRpcService
- web_service_api MovableTypeApi
- before_invocation :authenticate, :except => [:supportedMethods, :supportedTextFilters]
-
- #def getRecentPostTitles(blogid, username, password, numberOfPosts)
- # # FIXME not implemented
- #end
-
- def getCategoryList(blogid, username, password)
- site.sections.find(:all, :order => 'id ASC').collect { |c| MovableTypeStructs::Category.new(:categoryId => c.id, :categoryName => c.name) }
- end
-
- def getPostCategories(postid, username, password)
- article = @user.articles.find(postid)
- article.sections.collect { |c| MovableTypeStructs::Category.new(:categoryId => c.id, :categoryName => c.name) }
- end
-
- def setPostCategories(postid, username, password, categories)
- article = @user.articles.find(postid)
- article.section_ids= categories.collect { |c| c.categoryId }
- article.save!
- true
- end
-
- def supportedMethods
- MetaWeblogService.public_instance_methods(false).collect { |m| "metaWeblog.{#m}" } \
- + MovableTypeService.public_instance_methods(false).collect { |m| "mt.{#m}" }
- end
-
- def supportedTextFilters
- FilteredColumn.filters.collect { |(key, filter)| MovableTypeStructs::TextFilter.new(:key => key, :label => filter.filter_name) }
- end
-
- # def getTrackbackPings,
- # ...
- # end
-
- #def publishPost(postid, username, password)
- # article = @user.articles.find(postid)
- # #article. hmmm now what?
- # true
- #end
-
-end
diff -Nur mephisto-0.7.3/app/apis/movable_type_structs/category.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/category.rb
--- mephisto-0.7.3/app/apis/movable_type_structs/category.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/category.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,12 +0,0 @@
-module MovableTypeStructs
- class Category < ActionWebService::Struct
- member :categoryId, :string
- member :categoryName, :string
- end
-end
-module MovableTypeStructs
- class Category < ActionWebService::Struct
- member :categoryId, :string
- member :categoryName, :string
- end
-end
diff -Nur mephisto-0.7.3/app/apis/movable_type_structs/post.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/post.rb
--- mephisto-0.7.3/app/apis/movable_type_structs/post.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/post.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,16 +0,0 @@
-module MovableTypeStructs
- class Post < ActionWebService::Struct
- member :dateCreated, :time #ISO.8601
- member :userid, :string
- member :postid, :string
- member :title, :string
- end
-end
-module MovableTypeStructs
- class Post < ActionWebService::Struct
- member :dateCreated, :time #ISO.8601
- member :userid, :string
- member :postid, :string
- member :title, :string
- end
-end
diff -Nur mephisto-0.7.3/app/apis/movable_type_structs/post_category.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/post_category.rb
--- mephisto-0.7.3/app/apis/movable_type_structs/post_category.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/post_category.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,14 +0,0 @@
-module MovableTypeStructs
- class PostCategory < ActionWebService::Struct
- member :categoryId, :string
- member :categoryName, :string
- member :isPrimary, :bool
- end
-end
-module MovableTypeStructs
- class PostCategory < ActionWebService::Struct
- member :categoryId, :string
- member :categoryName, :string
- member :isPrimary, :bool
- end
-end
diff -Nur mephisto-0.7.3/app/apis/movable_type_structs/text_filter.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/text_filter.rb
--- mephisto-0.7.3/app/apis/movable_type_structs/text_filter.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/text_filter.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,6 +0,0 @@
-module MovableTypeStructs
- class TextFilter < ActionWebService::Struct
- member :key, :string
- member :label, :string
- end
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/apis/movable_type_structs/trackback.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/trackback.rb
--- mephisto-0.7.3/app/apis/movable_type_structs/trackback.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/movable_type_structs/trackback.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,7 +0,0 @@
-module MovableTypeStructs
- class Trackback < ActionWebService::Struct
- member :pingTitle, :string
- member :pingURL, :string
- member :pingIP, :string
- end
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/apis/xml_rpc_service.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/xml_rpc_service.rb
--- mephisto-0.7.3/app/apis/xml_rpc_service.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/apis/xml_rpc_service.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,30 +0,0 @@
-class XmlRpcService < ActionWebService::Base
- attr_accessor :controller
- delegate :site, :to => :controller
-
- def initialize(controller)
- @controller = controller
- end
-
- protected
- def server_url
- controller.url_for(:only_path => false, :controller => "/")
- end
-
- def pub_date(time)
- time.strftime "%a, %e %b %Y %H:%M:%S %Z"
- end
-
- def authenticate(name, args)
- method = self.class.web_service_api.api_methods[name]
-
- # Coping with backwards incompatibility change in AWS releases post 0.6.2
- begin
- h = method.expects_to_hash(args)
- raise "Invalid login" unless @user = User.authenticate_for(controller.site, h[:username], h[:password])
- rescue NoMethodError
- username, password = method[:expects].index(:username=>String), method[:expects].index(:password=>String)
- raise "Invalid login" unless @user = User.authenticate_for(controller.site, args[username], args[password])
- end
- end
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/cachers/article_observer.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/cachers/article_observer.rb
--- mephisto-0.7.3/app/cachers/article_observer.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/cachers/article_observer.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,10 +1,12 @@
class ArticleObserver < ActiveRecord::Observer
def before_save(record)
- @event = Event.new
- @event.mode = case
- when record.is_a?(Comment) then 'comment'
- when record.new_record? then 'publish'
- else 'edit'
+ if (record.is_a?(Article) && record.save_version?) || record.is_a?(Comment)
+ @event = Event.new
+ @event.mode = case
+ when record.is_a?(Comment) then 'comment'
+ when record.new_record? then 'publish'
+ else 'edit'
+ end
end
end
@@ -15,4 +17,4 @@
end
alias after_destroy after_save
-end
\ No newline at end of file
+end
diff -Nur mephisto-0.7.3/app/cachers/comment_observer.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/cachers/comment_observer.rb
--- mephisto-0.7.3/app/cachers/comment_observer.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/cachers/comment_observer.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,8 +1,15 @@
class CommentObserver < ArticleObserver
- cattr_accessor :disabled
+ def self.disabled?
+ Thread.current[:comment_observer_disabled]
+ end
+
+ def disabled=(value)
+ Thread.current[:comment_observer_disabled] = value
+ end
+
def after_save(record)
@event.update_attributes :title => record.article.title, :body => record.body, :site => record.article.site,
- :article => record.article, :author => record.author, :comment => record if record.approved? && !disabled
+ :article => record.article, :author => record.author, :comment => record if record.approved? && !self.class.disabled?
end
def after_destroy(record)
diff -Nur mephisto-0.7.3/app/controllers/admin/articles_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/articles_controller.rb
--- mephisto-0.7.3/app/controllers/admin/articles_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/articles_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -3,21 +3,18 @@
with_options :only => [:create, :update, :destroy, :upload] do |c|
c.before_filter :set_default_section_ids
c.cache_sweeper :article_sweeper, :assigned_section_sweeper
- cache_sweeper :comment_sweeper, :only => [:approve, :unapprove, :destroy_comment]
end
before_filter :convert_times_to_utc, :only => [:create, :update, :upload]
before_filter :check_for_new_draft, :only => [:create, :update, :upload]
- before_filter :find_site_article, :only => [:edit, :update, :comments, :approve, :unapprove, :destroy]
+ before_filter :find_site_article, :only => [:edit, :update, :comments, :approve, :unapprove, :destroy, :attach, :detach]
before_filter :login_required, :except => :upload
before_filter :load_sections, :only => [:new, :edit]
def index
- @article_pages = Paginator.new self, site.articles.count(:all, article_options), 30, params[:page]
- @articles = site.articles.find(:all, article_options(:order => 'contents.published_at DESC', :select => 'contents.*',
- :limit => @article_pages.items_per_page,
- :offset => @article_pages.current.offset))
+ @articles = site.articles.paginate(article_options(:order => 'contents.published_at DESC', :select => 'contents.*',
+ :page => params[:page], :per_page => params[:per_page]))
@comments = @site.unapproved_comments.count :all, :group => :article, :order => '1 desc'
@sections = site.sections.find(:all)
@@ -29,7 +26,7 @@
Mephisto::Liquid::CommentForm.article = @article
@article = @article.to_liquid(:mode => :single)
- render :text => site.render_liquid_for(site.sections.home, :single, 'articles' => [@article], 'article' => @article, 'comments' => @comments, 'site' => site.to_liquid)
+ render :text => site.call_render(site.sections.home, :single, 'articles' => [@article], 'article' => @article, 'comments' => @comments, 'site' => site.to_liquid)
end
def new
@@ -65,38 +62,14 @@
def destroy
@article.destroy
+ flash[:notice] = "The article: #{@article.title.inspect} was deleted."
render :update do |page|
page.redirect_to :action => 'index'
end
end
def comments
- @comments =
- case params[:filter]
- when 'approved' then :comments
- when 'unapproved' then :unapproved_comments
- else :all_comments
- end
- @comments = @article.send @comments
- @articles = @site.unapproved_comments.count :all, :group => :article, :order => '1 desc'
- end
-
- # xhr baby
- # needs some restful lovin'
- def approve
- @comment = @article.unapproved_comments.approve(params[:comment])
- @comment.mark_as_ham(site, request)
- end
-
- def unapprove
- @comment = @article.comments.unapprove(params[:comment])
- @comment.mark_as_spam(site, request)
- render :action => 'approve'
- end
-
- def destroy_comment
- @comments = site.all_comments.find :all, :conditions => ['id in (?)', [params[:comment]].flatten] rescue []
- Comment.transaction { @comments.each(&:destroy) } if @comments.any?
+ redirect_to article_comments_path(@article)
end
def upload
@@ -117,9 +90,28 @@
end
end
+ def attach
+ @asset = site.assets.find(params[:version])
+ @article.assets.add @asset
+ end
+
+ def detach
+ @asset = site.assets.find(params[:version])
+ @article.assets.remove @asset
+ end
+
+ def label
+ AssignedAsset.update_all ['label = ?', params[:label]], ['article_id = ? and asset_id = ?', params[:id], params[:version]]
+ end
+
protected
def load_sections
- @assets = site.assets.find(:all, :order => 'created_at desc', :limit => 6)
+ @assets = site.assets.find(:all, :limit => 15)
+ @bucket_assets = []
+ session[:bucket].each do |id, values|
+ (@bucket_assets ||= []) << site.assets.find(id)
+ end unless session[:bucket].blank?
+
@sections = site.sections.find(:all)
home = @sections.find &:home?
@sections.delete home
diff -Nur mephisto-0.7.3/app/controllers/admin/assets_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/assets_controller.rb
--- mephisto-0.7.3/app/controllers/admin/assets_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/assets_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -29,8 +29,14 @@
end
Asset.transaction { @assets.each &:save! }
flash[:notice] = @assets.size == 1 ? "'#{CGI.escapeHTML @assets.first.title}' was uploaded." : "#{@assets.size} assets were uploaded."
- @assets.size.zero? ? render(:action => 'new') : redirect_to(assets_path)
- rescue ActiveRecord::RecordInvalid
+ if @assets.size.zero?
+ @asset = Asset.new
+ render :action => 'new'
+ else
+ redirect_to assets_path
+ end
+ rescue ActiveRecord::RecordInvalid => e
+ @asset = e.record
render :action => 'new'
end
@@ -45,7 +51,7 @@
def latest
@assets = site.assets.find(:all, :order => 'created_at desc', :limit => 6)
render :update do |page|
- page['latest-assets'].replace_html :partial => 'widget', :collection => @assets
+ page['latest-assets'].replace_html :partial => 'widget', :collection => @assets, :locals => { :prefix => 'latest' }
end
end
@@ -53,7 +59,7 @@
search_assets 6
render :update do |page|
page['spinner'].hide
- return page['search-assets'].replace_html(:partial => 'widget', :collection => @assets) if @assets.any?
+ return page['search-assets'].replace_html(:partial => 'widget', :collection => @assets, :locals => { :prefix => 'search' }) if @assets.any?
page['search-assets'].replace_html %(Couldn't find any matching assets.)
end
end
@@ -67,11 +73,11 @@
# rjs
def add_bucket
- if (session[:bucket] ||= {}).key?(@asset.public_filename)
+ if (session[:bucket] ||= {}).key?(@asset.id)
render :nothing => true and return
end
args = asset_image_args_for(@asset, :tiny, :title => "#{@asset.title} \n #{@asset.tags.join(', ')}")
- session[:bucket][@asset.public_filename] = args
+ session[:bucket][@asset.id] = args
end
def clear_bucket
@@ -85,14 +91,15 @@
def search_assets(limit)
@types = params[:filter].blank? ? [] : params[:filter].keys
- @asset_pages = Paginator.new self, count_by_conditions, limit, params[:page]
+ options = search_options.merge(:per_page => limit, :page => params[:page], :total_entries => count_by_conditions)
+
@assets = @types.any? ?
- site.assets.find_all_by_content_types(@types, :all, search_options) :
- site.assets.find(:all, search_options)
+ site.assets.paginate_by_content_types(@types, :all, options) :
+ site.assets.paginate(options)
end
def search_options
- search_conditions.merge(:order => 'created_at desc', :limit => @asset_pages.items_per_page, :offset => @asset_pages.current.offset)
+ search_conditions.merge(:order => 'created_at desc')
end
def search_conditions
diff -Nur mephisto-0.7.3/app/controllers/admin/cached_pages_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/cached_pages_controller.rb
--- mephisto-0.7.3/app/controllers/admin/cached_pages_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/cached_pages_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -3,10 +3,9 @@
def index
CachedPage.with_current_scope do
- @cached_page_pages = Paginator.new self, site.cached_pages.count, 30, params[:page]
- offset = (((params[:page] || 1).to_i - 1) * @cached_page_pages.items_per_page)
- @cached_pages = site.cached_pages.find(:all, :order => 'updated_at', :limit => @cached_page_pages.items_per_page, :offset => offset,
- :conditions => (params[:query] && ['url LIKE ?', ["#{params[:query]}%"]]))
+ @cached_pages = site.cached_pages.paginate(:order => 'updated_at',
+ :conditions => (params[:query] && ['url LIKE ?', ["#{params[:query]}%"]]),
+ :page => params[:page])
end
end
alias_method :query, :index
@@ -25,4 +24,4 @@
protected
alias authorized? admin?
-end
\ No newline at end of file
+end
diff -Nur mephisto-0.7.3/app/controllers/admin/comments_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/comments_controller.rb
--- mephisto-0.7.3/app/controllers/admin/comments_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/comments_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,6 +1,75 @@
class Admin::CommentsController < Admin::BaseController
+
+ member_actions.push(*%w(index unapproved create edit update approve unapprove destroy close ))
+
+private
+
+ before_filter :find_site_article, :except => [ :close, :index, :destroy ]
+ before_filter :find_optional_site_article, :only => [:index, :destroy]
+ def find_site_article
+ @article = site.articles.find params[:article_id]
+ end
+
+ def find_optional_site_article
+ @article = site.articles.find params[:article_id] unless params[:article_id].blank?
+ end
+
+ cache_sweeper :comment_sweeper, :only => [:approve, :unapprove, :destroy, :create]
+
+public
+
def index
- @comments = site.unapproved_comments.find(:all, :include => :article)
+ @comment = Comment.new
+ @articles = site.unapproved_comments.count :all, :group => :article, :order => '1 desc'
+ params[:filter] = 'unapproved' if @article.nil?
+ @comments =
+ (@article || @site).send case params[:filter]
+ when 'approved' then :comments
+ when 'unapproved' then :unapproved_comments
+ else :all_comments
+ end
+ end
+
+ def unapproved
+ site.unapproved_comments.find(:all, :include => :article)
+ end
+
+ def create
+ @comment = @article.comments.build(params[:comment].merge(
+ :user_id => session[:user],
+ :author_ip => request.remote_ip,
+ :user_agent => request.env['HTTP_USER_AGENT'],
+ :referrer => request.env['HTTP_REFERER'])
+ )
+ @comment.approved = true
+ @comment.save
+ end
+
+ def edit
+ @comment = @article.all_comments.find params[:id]
+ end
+
+ def update
+ @comment = @article.all_comments.find params[:id]
+ @comment.update_attributes(params[:comment])
+ end
+
+ # xhr baby
+ # needs some restful lovin'
+ def approve
+ @comment = @article.unapproved_comments.approve(params[:comment] || params[:id])
+ @comment.mark_as_ham(site, request)
+ end
+
+ def unapprove
+ @comment = @article.comments.unapprove(params[:comment] || params[:id])
+ @comment.mark_as_spam(site, request)
+ render :action => 'approve'
+ end
+
+ def destroy
+ @comments = site.all_comments.find :all, :conditions => ['id in (?)', [ (params[:comment] || params[:id])].flatten] # rescue []
+ Comment.transaction { @comments.each(&:destroy) } if @comments.any?
end
# ajax action, called from _page_nav
diff -Nur mephisto-0.7.3/app/controllers/admin/overview_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/overview_controller.rb
--- mephisto-0.7.3/app/controllers/admin/overview_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/overview_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -9,10 +9,10 @@
def index
@users = site.users(:order => 'updated_at desc')
@events, @todays_events, @yesterdays_events = [], [], []
- today, yesterday = Time.now.utc.to_date, 1.day.ago.utc.to_date
+ today, yesterday = utc_to_local(Time.now.utc).to_date, utc_to_local(1.day.ago.utc).to_date
@articles = @site.unapproved_comments.count :all, :group => :article, :order => '1 desc'
@site.events.find(:all, :order => 'events.created_at DESC', :include => [:article, :user], :limit => 50).each do |event|
- event_date = event.created_at.to_date
+ event_date = utc_to_local(event.created_at).to_date
if event_date >= today
@todays_events
elsif event_date == yesterday
diff -Nur mephisto-0.7.3/app/controllers/admin/plugins_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/plugins_controller.rb
--- mephisto-0.7.3/app/controllers/admin/plugins_controller.rb 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/plugins_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,24 @@
+class Admin::PluginsController < Admin::BaseController
+ before_filter :find_plugin, :except => :index
+
+ def index
+ @plugins = Mephisto.plugins
+ end
+
+ def update
+ @plugin.options = params[:options]
+ @plugin.save!
+
+ redirect_to :action => "show", :id => params[:id]
+ end
+
+ def destroy
+ @plugin.destroy
+ redirect_to :action => "show", :id => params[:id]
+ end
+
+ protected
+ def find_plugin
+ @plugin = Mephisto.plugins[params[:id]]
+ end
+end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/controllers/admin/settings_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/settings_controller.rb
--- mephisto-0.7.3/app/controllers/admin/settings_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/settings_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,6 +1,6 @@
class Admin::SettingsController < Admin::BaseController
before_filter :find_and_sort_templates
- clear_empty_templates_for :site, :search_layout, :tag_layout, :only => :update
+ clear_empty_templates_for :site, :tag_layout, :only => :update
def update
if site.update_attributes params[:site]
diff -Nur mephisto-0.7.3/app/controllers/admin/sites_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/sites_controller.rb
--- mephisto-0.7.3/app/controllers/admin/sites_controller.rb 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/sites_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,62 @@
+class Admin::SitesController < Admin::BaseController
+
+ before_filter :admin_required
+ member_actions.push *%W(index show new destroy create)
+
+ def index
+ @sites = Site.search_by_host_or_title params[:search_string] do
+ Site.paginate(:page => params[:page], :per_page => params[:per_page], :order => 'id')
+ end
+ end
+
+ def show
+ @site = Site.find(params[:id])
+ end
+
+ def new
+ @site = Site.new
+ end
+
+ def create
+ @site = Site.new(params[:site])
+ if @site.save
+ flash[:notice] = "Site #{@site.host} was successfully created."
+ redirect_to :action => 'index'
+ else
+ flash[:error] = "Failed to create site."
+ render :action => "new"
+ end
+ end
+
+ def update
+ @site = Site.find(params[:id])
+ if @site.update_attributes(params[:site])
+ flash[:notice] = "Site #{@site.host} was successfully updated."
+ redirect_to :action => 'show', :id => @site
+ else
+ render :action => 'show'
+ end
+ end
+
+ def destroy
+ @site = Site.find(params[:id])
+ if @site.destroy
+ flash[:notice] = "Site removed."
+ redirect_to :action => 'index'
+ else
+ flash[:error] = "Failed to remove site #{@site.host}. Check file permissions."
+ render :action => 'show'
+ end
+ end
+
+ private
+ def admin_required
+ current_user.admin? ? true : not_allowed
+ end
+
+ def not_allowed
+ flash[:error] = "Only global administrators can manage sites."
+ redirect_to :controller => "/account", :action => :login
+ end
+
+end
diff -Nur mephisto-0.7.3/app/controllers/admin/templates_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/templates_controller.rb
--- mephisto-0.7.3/app/controllers/admin/templates_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/templates_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -28,7 +28,7 @@
if !@tmpl.file?
page.flash.errors "File does not exist"
page.visual_effect :fade, params[:context], :duration => 0.3
- elsif @theme.templates.custom.include?(@tmpl.basename.to_s)
+ elsif @theme.templates.custom(@theme.extension).include?(@tmpl.basename.to_s)
@tmpl.unlink
page.visual_effect :fade, params[:context], :duration => 0.3
else
diff -Nur mephisto-0.7.3/app/controllers/admin/users_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/users_controller.rb
--- mephisto-0.7.3/app/controllers/admin/users_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/admin/users_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -34,19 +34,20 @@
end
def destroy
- @user.deleted_at = Time.now.utc
- @user.save!
+ if @user == current_user then return @error = "Cannot delete yourself." end
+ if @user.admin? then return @error = "Cannot delete a Mephisto administrator." end
+ @allowed = @user.update_attribute :deleted_at, Time.now.utc
end
def enable
- @user.deleted_at = nil
- @user.save!
+ @allowed = @user.update_attribute :deleted_at, nil
end
def admin
+ if @user == current_user then return @error = "Cannot toggle admin permissions for yourself." end
+ if @user.admin? then return @error = "Cannot toggle admin permissions for a Mephisto administrator." end
@membership = Membership.find_or_initialize_by_site_id_and_user_id(site.id, @user.id)
- @membership.admin = !@membership.admin?
- @membership.save!
+ @allowed = @membership.update_attribute :admin, !@membership.admin?
end
protected
diff -Nur mephisto-0.7.3/app/controllers/application/errors.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/application/errors.rb
--- mephisto-0.7.3/app/controllers/application/errors.rb 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/application/errors.rb 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,37 @@
+# Custom handlers for exceptions are defined here.
+class ApplicationController
+
+ protected
+
+ # Handle public-facing errors by rendering the "error" liquid template
+ def show_404
+ show_error 'Page Not Found', :not_found
+ end
+
+ def show_error(message = 'An error occurred.', status = :internal_server_error)
+ render_liquid_template_for(:error, 'message' => message, :status => status)
+ end
+
+ # Handle admin-application errors
+ # TODO: after rails 2.0.2, convert these to rescue_from [array] rather than 3 lines.
+ rescue_from ActiveRecord::RecordNotFound, :with => :render_admin_not_found
+ rescue_from ActionController::UnknownController, :with => :render_admin_not_found
+ rescue_from ActionController::UnknownAction, :with => :render_admin_not_found
+
+ def render_admin_not_found
+ # TODO: render this from the site's custom admin 404 file, if it's a multi-site install.
+ render :file => File.join(RAILS_ROOT, 'public/404.html'), :status => :not_found
+ end
+
+ def render_admin_error
+ # TODO: render this from the site's custom 500 file, if it's a multi-site install
+ render :file => File.join(RAILS_ROOT, 'public/500.html'), :status => :internal_server_error
+ end
+
+ def rescue_action_in_public(exception)
+ logger.debug "#{exception.class.name}: #{exception.to_s}"
+ exception.backtrace.each { |t| logger.debug " > #{t}" }
+ render_admin_error
+ end
+
+end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/controllers/application.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/application.rb
--- mephisto-0.7.3/app/controllers/application.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/application.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,20 +1,36 @@
class ApplicationController < ActionController::Base
+ require_dependency 'application/errors'
+
include Mephisto::CachingMethods
- cattr_accessor :site_count
before_filter :set_cache_root
helper_method :site
attr_reader :site
+
+ auto_include!
+
+ def self.inherited(klass)
+ super
+ klass.auto_include!
+ end
+
+ filter_parameter_logging "password"
protected
helper_method :admin?
+ helper_method :global_admin?
def admin?
logged_in? && (current_user.admin? || current_user.site_admin?)
end
+ def global_admin?
+ logged_in? && current_user.admin?
+ end
+
# so not the best place for this...
def asset_image_args_for(asset, thumbnail = :tiny, options = {})
- options = options.reverse_merge(:title => "#{asset.title} \n #{asset.tags.join(', ')}")
+ thumb_size = Array.new(2).fill(Asset.attachment_options[:thumbnails][thumbnail].to_i).join('x')
+ options = options.reverse_merge(:title => "#{asset.title} \n #{asset.tags.join(', ')}", :size => thumb_size)
if asset.movie?
['/images/mephisto/icons/video.png', options]
elsif asset.audio?
@@ -24,7 +40,7 @@
elsif asset.other?
['/images/mephisto/icons/doc.png', options]
elsif asset.thumbnails_count.zero?
- [asset.public_filename, options.update(:size => Array.new(2).fill(Asset.attachment_options[:thumbnails][thumbnail].to_i).join('x'))]
+ [asset.public_filename, options]
else
[asset.public_filename(thumbnail), options]
end
@@ -44,22 +60,14 @@
# use collect so it doesn't modify @articles
assigns['articles'] = assigns['articles'].collect &:to_liquid
end
- status = (assigns.delete(:status) || '200 OK')
+ status = (assigns.delete(:status) || :ok)
@liquid_assigns = assigns
- render :text => site.render_liquid_for(@section, template_type, assigns, self), :status => status
- end
-
- def show_error(message = 'An error occurred.', status = '500 Error')
- render_liquid_template_for(:error, 'message' => message, :status => status)
- end
-
- def show_404
- show_error 'Page Not Found', '404 NotFound'
+ render :text => site.call_render(@section, template_type, assigns, self), :status => status
end
def set_cache_root
host = request.domain(request.subdomains.size + (request.subdomains.first == 'www' ? 0 : 1))
- @site ||= Site.find_by_host(host) || Site.find(:first, :order => 'id')
+ @site ||= Site.find_by_host(host) || Site.find(:first, :order => 'id') || raise(ActiveRecord::RecordNotFound, "You need to create your first site!")
self.class.page_cache_directory = site.page_cache_directory.to_s
end
@@ -69,15 +77,5 @@
yield
ENV['TZ'] = old_tz
end
-
- def rescue_action_in_public(exception)
- logger.debug "#{exception.class.name}: #{exception.to_s}"
- exception.backtrace.each { |t| logger.debug " > #{t}" }
- case exception
- when ActiveRecord::RecordNotFound, ::ActionController::UnknownController, ::ActionController::UnknownAction
- render :file => File.join(RAILS_ROOT, 'public/404.html'), :status => '404 Not Found'
- else
- render :file => File.join(RAILS_ROOT, 'public/500.html'), :status => '500 Error'
- end
- end
+
end
diff -Nur mephisto-0.7.3/app/controllers/backend_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/backend_controller.rb
--- mephisto-0.7.3/app/controllers/backend_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/backend_controller.rb 1969-12-31 19:00:00.000000000 -0500
@@ -1,13 +0,0 @@
-require 'meta_weblog_api'
-require 'movable_type_api'
-class BackendController < ApplicationController
- session :off
-
- web_service_dispatching_mode :layered
- web_service(:metaWeblog) { MetaWeblogService.new(self) }
- web_service(:mt) { MovableTypeService.new(self) }
-
- alias xmlrpc api
-
- cache_sweeper :article_sweeper, :assigned_section_sweeper, :comment_sweeper
-end
diff -Nur mephisto-0.7.3/app/controllers/feed_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/feed_controller.rb
--- mephisto-0.7.3/app/controllers/feed_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/feed_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -36,7 +36,6 @@
def comment_feed_for_site
@comments = site.comments.find(:all, :limit => 15, :include => :article)
- cached_references << @section
self.cached_references += @comments
self.cached_references += @comments.collect(&:article_referenced_cache_key)
end
diff -Nur mephisto-0.7.3/app/controllers/mephisto_controller.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/mephisto_controller.rb
--- mephisto-0.7.3/app/controllers/mephisto_controller.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/controllers/mephisto_controller.rb 2008-03-31 02:18:56.000000000 -0400
@@ -18,7 +18,7 @@
# @dispatch_path.first has the headers
if @dispatch_path.first.is_a?(Hash)
response.headers['Status'] = interpret_status @section
- redirect_to @dispatch_path.first[:location]
+ redirect_to @dispatch_path.first[:location], :status=>301
else
head @section
end
@@ -31,21 +31,23 @@
end
def dispatch_page
- @article = @dispatch_path.empty? ? @section.articles.find_by_position : @section.articles.find_by_permalink(@dispatch_path.first)
+ Article.with_published do
+ @article = @dispatch_path.empty? ? @section.articles.find_by_position : @section.articles.find_by_permalink(@dispatch_path.first)
+ end
show_404 and return unless @article
Mephisto::Liquid::CommentForm.article = @article
render_liquid_template_for(:page, 'section' => @section.to_liquid(true),
- 'article' => @article.to_liquid(:mode => :single))
+ 'article' => @article.to_liquid(:mode => :single, :page => @dispatch_path.empty?))
end
def dispatch_comments
+ @skip_caching = true
show_404 and return unless find_article
if !request.post? || params[:comment].blank?
- @skip_caching = true
redirect_to site.permalink_for(@article) and return
end
- @comment = @article.comments.build(params[:comment].merge(:author_ip => request.remote_ip, :user_agent => request.user_agent, :referrer => request.referer))
+ @comment = @article.comments.build(params[:comment].merge(:user_id => session[:user], :author_ip => request.remote_ip, :user_agent => request.user_agent, :referrer => request.referer))
@comment.check_approval site, request if @comment.valid?
@comment.save!
redirect_to dispatch_path(:path => (site.permalink_for(@article)[1..-1].split('/') << 'comments' << @comment.id.to_s), :anchor => @comment.dom_id)
@@ -53,9 +55,12 @@
show_article_with 'errors' => @comment.errors.full_messages, 'submitted' => params[:comment]
rescue Article::CommentNotAllowed
show_article_with 'errors' => ["Commenting has been disabled on this article"]
+ rescue Comment::Previewing
+ show_article_with 'errors' => ["Previewing your comment"], 'submitted' => params[:comment]
end
def dispatch_comment
+ @skip_caching = true
show_article_with 'message' => 'Thanks for the comment!'
end
@@ -73,20 +78,25 @@
end
def dispatch_search
+ @section = params[:s].nil? ? nil : site.sections.detect { |s| s.path == params[:s] }
+ joins = nil
conditions = ['(published_at IS NOT NULL AND published_at <= :now) AND (title LIKE :q OR excerpt LIKE :q OR body LIKE :q)',
{ :now => Time.now.utc, :q => "%#{params[:q]}%" }]
- search_count = site.articles.count(:all, :conditions => conditions)
- @article_pages = Paginator.new self, search_count, site.articles_per_page, params[:page]
- @articles = site.articles.find(:all, :conditions => conditions, :order => 'published_at DESC',
- :include => [:user, :sections],
- :limit => @article_pages.items_per_page,
- :offset => @article_pages.current.offset)
+ if @section
+ conditions.first << ' AND (assigned_sections.section_id = :section)'
+ conditions.last[:section] = @section.id
+ end
+
+ @articles = site.articles.paginate(:conditions => conditions, :order => 'published_at DESC',
+ :include => [:user, :sections],
+ :per_page => site.articles_per_page, :page => params[:page])
render_liquid_template_for(:search, 'articles' => @articles,
- 'previous_page' => paged_search_url_for(@article_pages.current.previous),
- 'next_page' => paged_search_url_for(@article_pages.current.next),
- 'search_string' => params[:q],
- 'search_count' => search_count)
+ 'previous_page' => paged_search_url_for(@articles.previous_page),
+ 'next_page' => paged_search_url_for(@articles.next_page),
+ 'search_string' => CGI::escapeHTML(params[:q]),
+ 'search_count' => @articles.total_entries,
+ 'section' => @section)
@skip_caching = true
end
@@ -124,7 +134,7 @@
show_404 and return unless @article || find_article
Mephisto::Liquid::CommentForm.article = @article
@article = @article.to_liquid(:mode => :single)
- render_liquid_template_for(:single, assigns.merge('articles' => [@article], 'article' => @article))
+ render_liquid_template_for(:single, assigns.update('articles' => [@article], 'article' => @article))
end
alias dispatch_single show_article_with
end
diff -Nur mephisto-0.7.3/app/drops/article_drop.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/drops/article_drop.rb
--- mephisto-0.7.3/app/drops/article_drop.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/drops/article_drop.rb 2008-03-31 02:18:56.000000000 -0400
@@ -6,12 +6,12 @@
def initialize(source, options = {})
super source
- @options = options
+ @options = options
@liquid.update \
- 'body' => @source.body_html,
- 'excerpt' => (@source.excerpt_html.nil? || @source.excerpt_html.empty? ? nil : @source.excerpt_html),
- 'accept_comments' => @source.accept_comments?,
- 'is_page_home' => (options[:page] == true)
+ 'body' => @source.body_html,
+ 'excerpt' => (@source.excerpt_html.blank? ? nil : @source.excerpt_html),
+ 'accept_comments' => @source.accept_comments?,
+ 'is_page_home' => (options[:page] == true)
end
def author
@@ -19,12 +19,11 @@
end
def comments
- @comments ||= liquify(*@source.comments.reject(&:new_record?))
+ @comments ||= liquify(*@source.comments) # .reject(&:new_record?) <-- show new comments as they're built as a preview
end
def sections
- @sections ||= @source.sections.inject([]) { |all, s| s.home? ? all : all << s.to_liquid } # your days are numbered, home section!
- @sections ||= liquify(*@source.sections) { |s| s.home? ? nil : s.to_liquid }
+ @sections ||= liquify(*@source.sections.reject(&:home?))
end
def tags
@@ -44,7 +43,7 @@
end
def url
- @url ||= absolute_url(@site.permalink_for(@source))
+ @url ||= absolute_url(@site.permalink_for(@source)[1..-1])
end
def comments_feed_url
@@ -54,6 +53,10 @@
def changes_feed_url
@changes_feed_url ||= url + '/changes.xml'
end
+
+ def assets
+ @assets ||= liquify(*@source.assets)
+ end
protected
def body_for_mode(mode)
diff -Nur mephisto-0.7.3/app/drops/comment_drop.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/drops/comment_drop.rb
--- mephisto-0.7.3/app/drops/comment_drop.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/drops/comment_drop.rb 2008-03-31 02:18:56.000000000 -0400
@@ -19,7 +19,22 @@
@url ||= absolute_url(@source.site.permalink_for(@source))
end
+ def new_record
+ @source.new_record?
+ end
+
def author_link
- @source.author_url.blank? ? "#{CGI::escapeHTML(@source.author)} " : %Q{#{CGI::escapeHTML @source.author} }
+ @source.author_url.blank? ? "#{@source.author} " : %Q{#{@source.author} }
+ end
+
+ def presentation_class
+ @presentation_class ||= case @source.user_id
+ when @source.article.user_id
+ "by-author"
+ when nil
+ "by-guest"
+ else
+ "by-user"
+ end
end
end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/filters/core_filters.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/filters/core_filters.rb
--- mephisto-0.7.3/app/filters/core_filters.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/filters/core_filters.rb 2008-03-31 02:18:56.000000000 -0400
@@ -56,6 +56,10 @@
def assign_to_global(value, name)
@context.scopes.last[name] = value ; nil
end
+
+ def contains(source, text)
+ !source[text].nil?
+ end
protected
def liquify(*records, &block)
diff -Nur mephisto-0.7.3/app/filters/drop_filters.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/filters/drop_filters.rb
--- mephisto-0.7.3/app/filters/drop_filters.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/filters/drop_filters.rb 2008-03-31 02:18:56.000000000 -0400
@@ -13,8 +13,12 @@
@context['site'].find_descendant_sections(path)
end
- def linked_section_list(article, seperator = ', ')
- article.sections.collect {|s| link_to_section s }.join(seperator)
+ def linked_section_list(article, separator = ', ')
+ article.sections.collect {|s| link_to_section s }.join(separator)
+ end
+
+ def linked_tag_list(article, separator = ', ')
+ article.tags.collect {|t| link_to_tag t }.join(separator)
end
def latest_articles(site_or_section, limit = nil)
@@ -28,6 +32,22 @@
def latest_comments(site, limit = nil)
site.latest_comments(limit || site['articles_per_page'])
end
+
+ def find_asset(article, label)
+ article.assets.detect { |a| a.source.label == label }
+ end
+
+ def next_article(article, section=nil)
+ if nxt = article.source.next(section ? section.source : nil)
+ nxt.to_liquid.tap { |n| n.context = @context if n }
+ end
+ end
+
+ def previous_article(article, section=nil)
+ if prev = article.source.previous(section ? section.source : nil)
+ prev.to_liquid.tap { |p| p.context = @context if p }
+ end
+ end
def monthly_articles(section, date = nil)
date = parse_date(date)
@@ -38,11 +58,17 @@
liquify(*@context['site'].source.articles.find(:all, :include => :tags, :conditions => ['tags.name in (?)', Tag.parse(tags)], :order => 'contents.created_at desc'))
end
- def assets_by_type(type)
- liquify(*@context['site'].source.assets.find_all_by_content_types([type.to_sym], :all, :order => 'created_at desc'))
+ def tagged_articles_in_section(tags, section)
+ liquify(*section.source.articles.find(:all, :include => :tags, :conditions => ['tags.name in (?)', Tag.parse(tags)], :order => 'contents.published_at desc'))
+ end
+
+ def assets_by_type(type, drop = nil)
+ drop ||= @context['site']
+ liquify(*drop.source.assets.find_all_by_content_types([type.to_sym], :all, :order => 'created_at desc'))
end
- def tagged_assets(tags)
- liquify(*@context['site'].source.assets.find(:all, :include => :tags, :conditions => ['tags.name in (?)', Tag.parse(tags)], :order => 'assets.created_at desc'))
+ def tagged_assets(tags, drop = nil)
+ drop ||= @context['site']
+ liquify(*drop.source.assets.find(:all, :include => :tags, :conditions => ['tags.name in (?)', Tag.parse(tags)], :order => 'assets.created_at desc'))
end
end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/filters/url_filters.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/filters/url_filters.rb
--- mephisto-0.7.3/app/filters/url_filters.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/filters/url_filters.rb 2008-03-31 02:18:56.000000000 -0400
@@ -4,26 +4,43 @@
include ActionView::Helpers::TagHelper
include ActionView::Helpers::AssetTagHelper
- def link_to_article(article, text = nil)
- content_tag :a, text || h(article['title']), :href => article['url']
+ def link_to_article(article, *args)
+ options = link_args_to_options(args)
+ text = options.delete(:text) || h(article['title'])
+ content_tag :a, text, { :href => article['url'], :title => text }.merge(options)
end
- def link_to_page(page, section = nil, text = nil)
- content_tag :a, text || h(page['title']), page_anchor_options(page, section)
+ def link_to_page(page, section = nil, *args)
+ options = link_args_to_options(args)
+ text = options.delete(:text) || h(page['title'])
+ content_tag :a, text, page_anchor_options(page, section, { :title => text }.merge(options))
end
- def link_to_comments(article, text = nil)
- content_tag :a, text || pluralize(article['comments_count'], 'comment'), :href => article['url']
+ def link_to_comments(article, *args)
+ options = link_args_to_options(args)
+ text = options.delete(:text) || pluralize(article['comments_count'], 'comment')
+ content_tag :a, text, { :href => article['url'] + '#comments', :title => text }.merge(options)
end
- def link_to_section(section, text = nil)
- content_tag :a, text || h(section['name']), :href => section['url'], :title => section['title']
+ def link_to_section(section, *args)
+ options = link_args_to_options(args)
+ text = options.delete(:text) || h(section['name'])
+ content_tag :a, text, section_anchor_options(section, { :title => text }.merge(options))
end
def img_tag(img, options = {})
tag 'img', {:src => asset_url(img), :alt => img.split('.').first }.merge(options)
end
+ # Special link that checks for current section. If it exists and it's a paged section, use link_to_page instead.
+ def link_to_search_result(article, *args)
+ if current_page_section && current_page_section[:is_paged]
+ link_to_page(article, current_page_section, *args)
+ else
+ link_to_article(article, *args)
+ end
+ end
+
def stylesheet_url(css)
absolute_url :stylesheets, css
end
@@ -54,12 +71,16 @@
image_tag url, :class => 'gravatar', :size => "#{size}x#{size}", :alt => comment['author']
end
- def link_to_tag(tag)
- content_tag :a, h(tag), :href => tag_url(tag)
+ def link_to_tag(tag, *args)
+ options = link_args_to_options(args)
+ text = options.delete(:text) || h(tag)
+ content_tag :a, text, { :href => tag_url(tag), :rel => 'tag', :title => text }.merge(options)
end
- def link_to_month(section, date = nil, format = 'my')
- content_tag :a, format_date(date, format), :href => monthly_url(section, date)
+ def link_to_month(section, date = nil, format = 'my', *args)
+ options = link_args_to_options(args)
+ text = options.delete(:text) || h(format_date(date, format))
+ content_tag :a, text, { :href => monthly_url(section, date), :title => text }.merge(options)
end
def monthly_url(section, date = nil)
@@ -109,11 +130,33 @@
atom_feed '/feed/' + section.source.to_feed_url.join('/'), (title.blank? ? "Articles for #{section['name']}" : title)
end
+ def next(article, section = nil)
+ article.next(section)
+ end
+
+ def previous(article, section = nil)
+ article.previous(section)
+ end
+
private
# marks a page as class=selected
- def page_anchor_options(page, section = nil)
- options = {:href => page_url(page, section)}
- current_page_article == page ? options.update(:class => 'selected') : options
+ def page_anchor_options(page, section = nil, options = {})
+ options.update(:href => page_url(page, section))
+ options[:class].nil? ? options.update(:class => 'selected') : options[:class] += ' selected' if current_page_article == page
+ options
+ end
+
+ # marks a section as class=selected
+ def section_anchor_options(section, options = {})
+ options.update(:href => section['url'])
+ options[:class].nil? ? options.update(:class => 'selected') : options[:class] += ' selected' if current_page_section && (current_page_section.url == section.url)
+ options
+ end
+
+ def link_args_to_options(args)
+ options = {}
+ [:text, :title, :id, :class, :rel].zip(args) {|key, value| options[key] = h(value) unless value.blank?}
+ options
end
def current_page_section
@@ -123,4 +166,4 @@
def current_page_article
@current_page_article ||= @context['article']
end
-end
\ No newline at end of file
+end
diff -Nur mephisto-0.7.3/app/helpers/admin/cached_pages_helper.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/admin/cached_pages_helper.rb
--- mephisto-0.7.3/app/helpers/admin/cached_pages_helper.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/admin/cached_pages_helper.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,14 +1,4 @@
module Admin::CachedPagesHelper
- def pagination_remote_links(paginator, options={}, html_options={})
- name = options[:name] || ActionController::Pagination::DEFAULT_OPTIONS[:name]
- params = (options[:params] || ActionController::Pagination::DEFAULT_OPTIONS[:params]).clone
-
- pagination_links_each(paginator, options) do |n|
- params[name] = n
- link_to n.to_s, :page => n
- end
- end
-
def display_cached_page_date(page)
if Date.today == page.updated_at.to_date
if page.updated_at > Time.now - 4.hours
@@ -20,4 +10,4 @@
page.updated_at.strftime("%b %d, %Y")
end
end
-end
\ No newline at end of file
+end
diff -Nur mephisto-0.7.3/app/helpers/admin/plugins_helper.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/admin/plugins_helper.rb
--- mephisto-0.7.3/app/helpers/admin/plugins_helper.rb 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/admin/plugins_helper.rb 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,4 @@
+module Admin
+ module PluginsHelper
+ end
+end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/helpers/application_helper.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/application_helper.rb
--- mephisto-0.7.3/app/helpers/application_helper.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/application_helper.rb 2008-03-31 02:18:56.000000000 -0400
@@ -2,7 +2,7 @@
module ApplicationHelper
def author_link_for(comment)
- return comment.author if comment.author_url.blank?
+ return h(comment.author) if comment.author_url.blank?
link_to h(comment.author), "#{'http://' unless comment.author_url =~ /^https?:\/\//}#{comment.author_url}"
end
@@ -52,16 +52,6 @@
end
end
- def pagination_remote_links(paginator, options={}, html_options={})
- name = options[:name] || ActionController::Pagination::DEFAULT_OPTIONS[:name]
- params = (options[:params] || ActionController::Pagination::DEFAULT_OPTIONS[:params]).clone
-
- pagination_links_each(paginator, options) do |n|
- params[name] = n
- link_to_function n.to_s, "window.spotlight.search('#{n}')"
- end
- end
-
def comment_expiration_options
[['Are not allowed', -1],
['Never expire', 0],
diff -Nur mephisto-0.7.3/app/helpers/feed_helper.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/feed_helper.rb
--- mephisto-0.7.3/app/helpers/feed_helper.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/helpers/feed_helper.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,2 +1,12 @@
-module FeedHelper
+module FeedHelper
+ # show paged url for an article if the section is a paged section
+ def section_url_for(article)
+ if @section && @section.show_paged_articles?
+ @section_articles ||= {}
+ @section_articles[@section.id] ||= (@section.articles.find(:first) || :false)
+ ([nil] << (@section_articles[@section.id].permalink == article.permalink ? @section.to_url : @section.to_page_url(article))).join("/")
+ else
+ site.permalink_for(article)
+ end
+ end
end
diff -Nur mephisto-0.7.3/app/models/article.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/article.rb
--- mephisto-0.7.3/app/models/article.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/article.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,12 +1,13 @@
class Article < Content
class CommentNotAllowed < StandardError; end
-
+
validates_presence_of :title, :user_id, :site_id
before_validation { |record| record.set_default_filter! }
after_validation :convert_to_utc
- before_create :create_permalink
+ has_permalink :title
after_save :save_assigned_sections
+ after_update :reset_comment_attributes
acts_as_versioned :if_changed => [:title, :body, :excerpt], :limit => 5 do
def self.included(base)
@@ -33,7 +34,7 @@
has_many :events, :order => 'created_at desc', :dependent => :delete_all
with_options :order => 'created_at', :class_name => 'Comment' do |comment|
- comment.has_many :comments, :conditions => ['contents.approved = ?', true], :dependent => :delete_all do
+ comment.has_many :comments, :conditions => ['contents.approved = ?', true] do
def unapprove(id)
returning find(id) do |comment|
comment.approved = false
@@ -49,14 +50,33 @@
end
end
end
- comment.has_many :all_comments
+ comment.has_many :all_comments, :dependent => :delete_all
+ end
+
+ has_many :assigned_assets, :order => 'position', :dependent => :destroy
+ has_many :assets, :through => :assigned_assets, :conditions => ['assigned_assets.active = ?', true], :select => 'assets.*, assigned_assets.label' do
+ def add(asset, label = nil)
+ returning AssignedAsset.find_or_create_by_article_id_and_asset_id(proxy_owner.id, asset.id) do |aa|
+ aa.label = label
+ aa.active = true
+ aa.save!
+ end
+ end
+
+ def remove(asset)
+ AssignedAsset.update_all ['active = ?', false], ['article_id = ? AND asset_id = ?', proxy_owner.id, asset.id]
+ end
end
class << self
+ def with_published(&block)
+ with_scope({:find => { :conditions => ['contents.published_at <= ? AND contents.published_at IS NOT NULL', Time.now.utc] } }, &block)
+ end
+
def find_by_date(options = {})
- find(:all, { :order => 'contents.published_at desc',
- :conditions => ['contents.published_at <= ? AND contents.published_at IS NOT NULL', Time.now.utc] } \
- .merge(options))
+ with_published do
+ find :all, {:order => 'contents.published_at desc'}.update(options)
+ end
end
def find_all_in_month(year, month, options = {})
@@ -70,7 +90,7 @@
end
def permalink_for(str)
- str.gsub(/\W+/, ' ').strip.downcase.gsub(/\ +/, '-')
+ PermalinkFu.escape(str)
end
end
@@ -134,11 +154,52 @@
set_default_filter_from user
end
- protected
- def create_permalink
- self.permalink = self.class.permalink_for(title.to_s) if permalink.blank?
+ def add_xml(builder)
+ add_podcast_xml(builder)
+ end
+
+ def next(section=nil)
+ return nil if section && !sections.include?(section)
+ section = sections[0] if (section.nil?)
+ self.class.with_published do
+ if section
+ if section.paged?
+ index = section.articles.index(self)
+ (index <= section.articles.length-1) ? section.articles[index+1] : nil
+ # article = section.articles.detect {|article| article.id == id }
+ else
+ site.articles.find :first, :conditions => ['published_at > ? and assigned_sections.section_id = ?', published_at, section.id],
+ :joins => 'inner join assigned_sections on contents.id = assigned_sections.article_id',
+ :order => 'published_at'
+ end
+ else
+ site.articles.find :first, :conditions => ['published_at > ?', published_at], :order => 'published_at'
+ end
end
+ end
+
+ def previous(section=nil)
+ return nil if section && !sections.include?(section)
+ section = sections[0] if (section.nil?)
+ self.class.with_published do
+ if section
+ if section.paged?
+ index = section.articles.index(self)
+ (index > 0) ? section.articles[index-1] : nil
+ # article = section.articles.detect {|article| article.id == id }
+ else
+ site.articles.find :first, :conditions => ['published_at < ? and assigned_sections.section_id = ?', published_at, section.id],
+ :joins => 'inner join assigned_sections on contents.id = assigned_sections.article_id',
+ :order => 'published_at desc'
+ end
+ else
+ site.articles.find :first, :conditions => ['published_at < ?', published_at], :order => 'published_at desc'
+ end
+ end
+ end
+
+ protected
def convert_to_utc
self.published_at = published_at.utc if published_at
end
@@ -156,4 +217,14 @@
@new_sections = nil
end
+
+ def reset_comment_attributes
+ Content.update_all ['title = ?, published_at = ?, permalink = ?', title, published_at, permalink], ['article_id = ?', id]
+ end
+
+ def add_podcast_xml(builder)
+ if asset = assets.find(:first, :conditions => ['label = ?', 'podcast'], :select => 'assets.*')
+ builder.link :rel => :enclosure, :type => asset.content_type, :length => asset.size, :href => asset.public_filename
+ end
+ end
end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/models/asset.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/asset.rb
--- mephisto-0.7.3/app/models/asset.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/asset.rb 2008-03-31 02:18:56.000000000 -0400
@@ -6,10 +6,10 @@
# use #send due to a ruby 1.8.2 issue
@@movie_condition = send(:sanitize_sql, ['content_type LIKE ? OR content_type IN (?)', 'video%', extra_content_types[:movie]]).freeze
@@audio_condition = send(:sanitize_sql, ['content_type LIKE ? OR content_type IN (?)', 'audio%', extra_content_types[:audio]]).freeze
- @@image_condition = send(:sanitize_sql, ['content_type IN (?)', Technoweenie::ActsAsAttachment.content_types]).freeze
+ @@image_condition = send(:sanitize_sql, ['content_type IN (?)', Technoweenie::AttachmentFu.content_types]).freeze
@@other_condition = send(:sanitize_sql, [
'content_type NOT LIKE ? AND content_type NOT LIKE ? AND content_type NOT IN (?)',
- 'audio%', 'video%', (extra_content_types[:movie] + extra_content_types[:audio] + Technoweenie::ActsAsAttachment.content_types)]).freeze
+ 'audio%', 'video%', (extra_content_types[:movie] + extra_content_types[:audio] + Technoweenie::AttachmentFu.content_types)]).freeze
cattr_reader *%w(movie audio image other).collect! { |t| "#{t}_condition".to_sym }
class << self
@@ -45,7 +45,9 @@
include Mephisto::TaggableMethods
belongs_to :site
- acts_as_attachment :storage => :file_system, :thumbnails => { :thumb => '120>', :tiny => '50>' }, :max_size => 30.megabytes
+ has_many :assigned_assets, :order => 'position', :dependent => :destroy
+ has_attachment :storage => :file_system, :thumbnails => { :thumb => '120>', :tiny => '50>' }, :max_size => 30.megabytes,
+ :processor => (Object.const_defined?(:ASSET_IMAGE_PROCESSOR) ? ASSET_IMAGE_PROCESSOR : nil)
before_validation_on_create :set_site_from_parent
validates_presence_of :site_id
validates_as_attachment
@@ -69,6 +71,7 @@
end
after_attachment_saved do |record|
+ File.chmod 0644, record.full_filename
Asset.update_all ['thumbnails_count = ?', record.thumbnails.count], ['id = ?', record.id] unless record.parent_id
end
@@ -82,7 +85,7 @@
protected
def rename_unique_filename
- if (@old_filename || new_record?) && errors.empty? && site_id && filename
+ if ((@old_filename && !@old_filename.eql?(full_filename)) || new_record?) && errors.empty? && site_id && filename
i = 1
pieces = filename.split('.')
ext = pieces.size == 1 ? nil : pieces.pop
diff -Nur mephisto-0.7.3/app/models/assigned_asset.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/assigned_asset.rb
--- mephisto-0.7.3/app/models/assigned_asset.rb 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/assigned_asset.rb 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,14 @@
+class AssignedAsset < ActiveRecord::Base
+ belongs_to :article, :counter_cache => 'assets_count'
+ belongs_to :asset
+ acts_as_list :scope => :article_id
+ validates_presence_of :article_id, :asset_id
+ validate_on_create :check_for_dupe_article_and_asset
+
+ protected
+ def check_for_dupe_article_and_asset
+ unless self.class.count(:all, :conditions => ['article_id = ? and asset_id = ?', article_id, asset_id]).zero?
+ errors.add_to_base("Cannot have a duplicate assignment for this article and asset")
+ end
+ end
+end
diff -Nur mephisto-0.7.3/app/models/assigned_section.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/assigned_section.rb
--- mephisto-0.7.3/app/models/assigned_section.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/assigned_section.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,14 +1,14 @@
class AssignedSection < ActiveRecord::Base
belongs_to :article
belongs_to :section, :counter_cache => 'articles_count'
- acts_as_list :scope => 'section_id = #{section_id}'
+ acts_as_list :scope => :section_id
validates_presence_of :article_id, :section_id
validate_on_create :check_for_dupe_article_and_section
protected
def check_for_dupe_article_and_section
unless self.class.count(:all, :conditions => ['article_id = ? and section_id = ?', article_id, section_id]).zero?
- errors.add_to_base("Cannot have a duplicate categorization for this article and section")
+ errors.add_to_base("Cannot have a duplicate assignment for this article and section")
end
end
end
diff -Nur mephisto-0.7.3/app/models/comment.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/comment.rb
--- mephisto-0.7.3/app/models/comment.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/comment.rb 2008-03-31 02:18:56.000000000 -0400
@@ -7,12 +7,23 @@
before_validation :clean_up_author_url
after_validation_on_create :snag_article_attributes
before_create :check_comment_expiration
+ before_create :sanitize_attributes
before_save :update_counter_cache
before_destroy :decrement_counter_cache
belongs_to :article
has_one :event, :dependent => :destroy
- attr_protected :approved
+ before_create :check_if_previewing
+ attr_accessible :article, :article_id, :user_id, :user, :excerpt, :body, :author, :author_url, :author_email, :author_ip, :updater_id, :updater, :comment_age, :user_agent, :referrer, :preview
+ attr_accessor :preview
+ class Previewing < StandardError; end
+
+ # If the view sends the "preview" accessor, we raise this
+ # error so the controller can simply rescue
+ def check_if_previewing
+ raise Comment::Previewing if preview
+ end
+
def self.find_all_by_section(section, options = {})
find :all, options.update(:conditions => ['contents.approved = ? and assigned_sections.section_id = ?', true, section.id],
:select => 'contents.*', :joins => 'INNER JOIN assigned_sections ON assigned_sections.article_id = contents.article_id',
@@ -67,12 +78,19 @@
end
protected
+ def sanitize_attributes
+ [:author, :author_url, :author_email, :author_ip, :user_agent, :referrer].each do |a|
+ self.send("#{a}=", CGI::escapeHTML(self.send(a).to_s))
+ end
+ end
+
def snag_article_attributes
- self.attributes = { :site => article.site, :filter => article.site.filter, :title => article.title, :published_at => article.published_at, :permalink => article.permalink }
+ self.filter ||= article.site.filter
+ [:site, :title, :published_at, :permalink].each { |a| self.send("#{a}=", article.send(a)) }
end
def check_comment_expiration
- raise Article::CommentNotAllowed unless article.accept_comments?
+ raise Article::CommentNotAllowed, "#{article.status} does not allow comments" unless article.accept_comments?
end
def update_counter_cache
diff -Nur mephisto-0.7.3/app/models/resources.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/resources.rb
--- mephisto-0.7.3/app/models/resources.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/resources.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,7 +1,8 @@
class Resources < Attachments
- NON_IMAGE_EXTNAMES = %w(.js .css)
+ @@non_image_extnames = %w(.js .css)
+ cattr_reader :non_image_extnames
def image?(path)
- !NON_IMAGE_EXTNAMES.include?(path.extname)
+ !non_image_extnames.include?(path.extname)
end
def content_type(path)
@@ -12,6 +13,7 @@
when '.jpg', '.jpeg' then 'image/jpeg'
when '.gif' then 'image/gif'
when '.swf' then 'application/x-shockwave-flash'
+ when '.ico' then 'image/x-icon'
end
end
diff -Nur mephisto-0.7.3/app/models/site.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/site.rb
--- mephisto-0.7.3/app/models/site.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/site.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,10 +1,32 @@
+require 'uri'
+
class Site < ActiveRecord::Base
- @@theme_path = Pathname.new(RAILS_ROOT) + 'themes'
- cattr_reader :theme_path
+ @@default_assigns = {}
+ @@theme_path = Pathname.new(RAILS_ROOT) + 'themes'
+ cattr_reader :theme_path, :default_assigns
cattr_accessor :multi_sites_enabled, :cache_sweeper_tracing
+
+ # @@template_handlers = HashWithIndifferentAccess.new if @@template_handlers.nil?
+ @@template_handlers = {}
+
+ # Register a class that knows how to handle template files with the given
+ # extension. This can be used to implement new template types.
+ # The constructor for the class must take a Site instance
+ # as a parameter, and the class must implement a #render method that
+ # has the following signature
+ # def render(section, layout, template, assigns ={}, controller = nil)
+ # and return the rendered template as a string.
+ def self.register_template_handler(extension, klass)
+ @@template_handlers[extension] = klass
+ end
+ register_template_handler(".liquid", Mephisto::Liquid::LiquidTemplate)
+
+ def self.extensions
+ @@template_handlers.keys
+ end
- has_many :sections, :order => "position" do
+ has_many :sections, :order => "position", :dependent => :destroy do
def home
find_by_path ''
end
@@ -19,7 +41,7 @@
end
end
- has_many :articles do
+ has_many :articles, :dependent => :destroy do
def find_by_permalink(options)
conditions =
returning ["(contents.published_at IS NOT NULL AND contents.published_at <= ?)", Time.now.utc] do |cond|
@@ -41,13 +63,13 @@
end
end
- has_many :comments, :order => 'comments.created_at desc'
+ has_many :comments, :order => 'comments.created_at desc', :dependent => :delete_all
- has_many :events
+ has_many :events, :dependent => :destroy
- has_many :cached_pages
+ has_many :cached_pages, :dependent => :destroy
- has_many :assets, :order => 'created_at desc', :conditions => 'parent_id is null'
+ has_many :assets, :order => 'created_at desc', :conditions => 'parent_id is null', :dependent => :destroy
has_many :memberships, :dependent => :destroy
has_many :members, :through => :memberships, :source => :user
@@ -60,13 +82,23 @@
validates_format_of :host, :with => Format::DOMAIN
validates_uniqueness_of :host
validate :check_permalink_style
- after_create { |s| s.sections.create(:name => 'Home') }
+
+ after_create :setup_site_theme_directories
+ after_create { |site| site.sections.create(:name => 'Home') }
+ before_destroy :flush_cache_and_remove_site_directories
with_options :order => 'contents.created_at DESC', :class_name => 'Comment' do |comment|
comment.has_many :comments, :conditions => ['contents.approved = ?', true]
comment.has_many :unapproved_comments, :conditions => ['contents.approved = ? or contents.approved is null', false]
comment.has_many :all_comments
end
+
+ def self.search_by_host_or_title(search_string)
+ conditions = search_string.blank? ? nil : ["host LIKE ? OR title LIKE ?"] + ["%#{search_string}%"] * 2
+ with_scope( :find => { :conditions => conditions } ) do
+ yield
+ end
+ end
def users(options = {})
User.find_all_by_site self, options
@@ -123,7 +155,7 @@
end
def theme
- @theme ||= themes[current_theme_path] || themes.first
+ @theme ||= themes[current_theme_path] || themes.first || raise(MissingThemesError.new(self))
end
def change_theme_to(new_theme_path)
@@ -150,23 +182,26 @@
end
def search_url(query, page = nil)
- "/#{search_path}?q=#{CGI::escapeHTML(query)}#{%(&page=#{CGI::escapeHTML(page.to_s)}) unless page.blank?}"
+ "/#{search_path}?q=#{CGI::escapeHTML(query)}#{%(&page=#{CGI::escapeHTML(page.to_s)}) unless page.blank?}"
end
def tag_url(*tags)
- ['', tag_path, *tags] * '/'
+ ['', tag_path, *tags.collect { |t| URI::escape(t.to_s) }] * '/'
end
def accept_comments?
comment_age.to_i > -1
end
- def render_liquid_for(section, template_type, assigns = {}, controller = nil)
+ def call_render(section, template_type, assigns = {}, controller = nil)
assigns.update('site' => to_liquid(section), 'mode' => template_type)
- parse_inner_template(set_content_template(section, template_type), assigns, controller)
- parse_template(set_layout_template(section, template_type), assigns, controller)
+ assigns.update(default_assigns) unless default_assigns.empty?
+ template = set_content_template(section, template_type)
+ layout = set_layout_template(section, template_type)
+ handler = @@template_handlers[theme.extension] || @@template_handlers[".liquid"]
+ handler.new(self).render(section, layout, template, assigns, controller)
end
-
+
def to_liquid(current_section = nil)
SiteDrop.new self, current_section
end
@@ -194,6 +229,13 @@
end
end
+#need non protected method for ErbTemplate - psq
+ def find_preferred_template(template_type, custom_template)
+ preferred = templates.find_preferred(template_type, custom_template)
+ return preferred if preferred && preferred.file?
+ raise MissingTemplateError.new(template_type, templates.collect_templates(template_type, custom_template).collect(&:basename))
+ end
+
protected
def cached_log_message_for(log_message, pages)
pages.inject([log_message, "Expiring #{pages.size} page(s)"]) { |msg, p| msg << " - #{p.url}" }.join("\n")
@@ -259,33 +301,38 @@
else
case template_type
when :tag then tag_layout
- when :search then search_layout
+ when :search then sections.detect(&:home?).layout
end
end
find_preferred_template(:layout, layout_template)
end
- def find_preferred_template(template_type, custom_template)
- preferred = templates.find_preferred(template_type, custom_template)
- return preferred if preferred && preferred.file?
- raise MissingTemplateError.new(template_type, templates.collect_templates(template_type, custom_template).collect(&:basename))
- end
+ private
- def parse_template(template, assigns, controller)
- # give the include tag access to files in the site's fragments directory
- Liquid::Template.file_system = Liquid::LocalFileSystem.new(File.join(theme.path, 'templates'))
- tmpl = Liquid::Template.parse(template.read.to_s)
- returning tmpl.render(assigns, :registers => {:controller => controller}) do |result|
- yield tmpl, result if block_given?
+ def setup_site_theme_directories
+ begin
+ theme_path = "#{RAILS_ROOT}/themes/site-#{self.id}/simpla"
+ FileUtils.mkdir_p("#{RAILS_ROOT}/themes/site-#{self.id}")
+ FileUtils.cp_r("#{RAILS_ROOT}/themes/default", theme_path)
+ Dir[File.join(theme_path, '**/.svn')].each do |dir|
+ FileUtils.rm_rf dir
+ end
+ rescue
+ logger.error "ERROR: removing directories for site #{self.host}, check file permissions."
+ errors.add_to_base "Unable to create theme directories."
+ false
end
end
-
- def parse_inner_template(template, assigns, controller)
- parse_template(template, assigns, controller) do |tmpl, result|
- # Liquid::Template takes a copy of the assigns.
- # merge any new values in to the assigns and pass them to the layout
- tmpl.assigns.each { |k, v| assigns[k] = v } if tmpl.respond_to?(:assigns)
- assigns['content_for_layout'] = result
+
+ def flush_cache_and_remove_site_directories
+ begin
+ CachedPage.expire_pages self, self.cached_pages
+ FileUtils.rm_rf("#{RAILS_ROOT}/themes/site-#{self.id}")
+ FileUtils.rm_rf("#{RAILS_ROOT}/public/cache/#{self.host}")
+ rescue
+ logger.error "ERROR: removing directories for site #{self.host}, check file permissions."
+ false
end
end
+
end
diff -Nur mephisto-0.7.3/app/models/tag.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/tag.rb
--- mephisto-0.7.3/app/models/tag.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/tag.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,5 +1,4 @@
class Tag < ActiveRecord::Base
- @@tag_parse_regex = /((?: |)['"]{0,1})['"]?\s*(.*?)\s*(?:[,'"]|$)(?:\1(?: |$))/
has_many :taggings
class << self
@@ -7,23 +6,19 @@
find_by_name(tag.to_s)
end
- # parses a comma separated list of tags into tag names
- # handles all kinds of different tags. (comma seperated, space seperated (in quotation marks))
- # should handle most the common keyword formats.
- #
- # e.g.: b'log, emacs fun, rails, ruby => "b'log", "emacs fun", "rails", "ruby"
- # "b'log" "emacs fun" "rails" "ruby" => "b'log", "emacs fun", "rails", "ruby"
- # 'b\'log' 'emacs fun' 'rails' 'ruby' => "b'log", "emacs fun", "rails", "ruby"
+ # parses a list of tags into tag names
#
# Tag.parse('a, b, c')
# # => ['a', 'b', 'c']
+ #
+ # Tag.parse("a b c")
+ # # => ['a', 'b', 'c']
+ #
+ # Tag.parse(%(a "b c"))
+ # # => ['a', 'b c']
def parse(list)
return list if list.is_a?(Array)
- returning list.scan(@@tag_parse_regex) do |tags|
- tags.collect! { |t| t.last.strip!; t.last }
- tags.uniq!
- tags.delete_if &:blank?
- end
+ list.include?(',') ? parse_with_commas(list) : parse_with_spaces(list)
end
# Parses comma separated tag list and returns tags for them.
@@ -44,6 +39,38 @@
found_tags + (tag_names - found_tags.collect(&:name)).collect { |s| create!(:name => s) }
end
end
+
+ private
+ def parse_with_commas(list)
+ cleanup_tags(list.split(','))
+ end
+
+ def parse_with_spaces(list)
+ tags = []
+
+ # first, pull out the quoted tags
+ list.gsub!(/\"(.*?)\"\s*/ ) { tags << $1; "" }
+
+ # then, get whatever's left
+ tags.concat list.split(/\s/)
+
+ cleanup_tags(tags)
+ end
+
+ def cleanup_tags(tags)
+ tags.tap do |t|
+ t.collect! do |tag|
+ unless tag.blank?
+ tag.downcase!
+ tag.gsub!(/:/, '')
+ tag.strip!
+ tag
+ end
+ end
+ t.compact!
+ t.uniq!
+ end
+ end
end
def ==(comparison_object)
diff -Nur mephisto-0.7.3/app/models/templates.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/templates.rb
--- mephisto-0.7.3/app/models/templates.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/templates.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,15 +1,18 @@
class Templates < Attachments
- @@template_types = [:section, :single, :archive, :search, :error, :tag, :layout].collect! { |f| "#{f}.liquid" }
+ @@template_types = ["section", "single", "archive", "search", "error", "tag", "layout"]
@@template_types.sort!
- cattr_reader :template_types
+ def template_types(extension = ".liquid")
+ @@template_types.collect { |f| "#{f}"+extension }
+ end
+
def [](template_name)
- template_name = File.basename(template_name.to_s).sub /\.liquid$/, ''
- theme.path + "#{template_name =~ /layout$/ ? 'layouts' : 'templates'}/#{template_name}.liquid"
+ template_name = File.basename(template_name.to_s).sub /#{theme.extension}$/, ''
+ theme.path + "#{template_name =~ /layout$/ ? 'layouts' : 'templates'}/#{template_name}#{theme.extension}"
end
def collect_templates(template_type, *custom_templates)
- custom_templates.push(template_type).collect! { |t| self[t] }
+ custom_templates.push(template_type.to_s+theme.extension).collect! { |t| self[t] }
end
# adds the custom_template to the top of the hierarchy if given
@@ -17,7 +20,7 @@
collect_templates(template_type, custom_template).detect(&:file?)
end
- def custom
- @custom ||= collect { |p| p.basename.to_s } - template_types
+ def custom(extension = ".liquid")
+ @custom ||= (collect { |p| p.basename.to_s } - template_types(extension)).sort
end
end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/models/theme.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/theme.rb
--- mephisto-0.7.3/app/models/theme.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/theme.rb 2008-03-31 02:18:56.000000000 -0400
@@ -1,9 +1,9 @@
class Theme
@@root_theme_files = %w(about.yml preview.png)
@@theme_directories = %w(templates layouts javascripts stylesheets images)
- @@allowed_extensions = %w(.js .css .liquid .png .gif .jpg .swf)
+ @@allowed_extensions = %w(.js .css .png .gif .jpg .swf .ico) | Site.extensions
cattr_reader :root_theme_files, :theme_directories, :allowed_extensions
- attr_reader :path, :base_path
+ attr_reader :path, :base_path, :extension
def self.import(zip_file, options = {})
dest = options[:to].is_a?(Pathname) ? options[:to] : Pathname.new(options[:to] || '.')
@@ -47,6 +47,8 @@
@base_path = base
@path = Pathname.new(@base_path)
end
+ layout = (@path + "layouts").children(false).select {|v| v.to_s =~ /^layout/}[0] if (@path + "layouts").directory?
+ @extension = layout.extname if layout
end
def current?
@@ -98,7 +100,7 @@
Pathname.glob(File.join(base_path, '*/*')).each do |path|
next unless path.file?
@attachments << path
- (path.extname == '.liquid' ? @templates : @resources) << path
+ ((path.extname == @extension) ? @templates : @resources) << path
end
@attachments
end
diff -Nur mephisto-0.7.3/app/models/user.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/user.rb
--- mephisto-0.7.3/app/models/user.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/user.rb 2008-03-31 02:18:56.000000000 -0400
@@ -6,7 +6,10 @@
# Virtual attribute for the unencrypted password
attr_accessor :password
-
+
+ #Only these can be modified through bulk-setters like update_attributes, new, create
+ attr_accessible :login, :email, :password, :password_confirmation, :filter
+
validates_presence_of :login, :email
validates_format_of :email, :with => Format::EMAIL
validates_presence_of :password, :if => :password_required?
diff -Nur mephisto-0.7.3/app/models/user_mailer.rb technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/user_mailer.rb
--- mephisto-0.7.3/app/models/user_mailer.rb 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/models/user_mailer.rb 2008-03-31 02:18:56.000000000 -0400
@@ -6,7 +6,7 @@
def forgot_password(user)
setup_email(user)
@subject += 'Request to change your password'
- @body[:url] = url_for :controller => :account, :action => :activate, :id => user.token
+ @body[:url] = url_for :controller => 'account', :action => 'activate', :id => user.token
end
protected
diff -Nur mephisto-0.7.3/app/views/account/login.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/account/login.rhtml
--- mephisto-0.7.3/app/views/account/login.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/account/login.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -1,5 +1,5 @@
-<% form_tag({:controller=>:account, :action=>:login}, { :id => 'login_form' }) do -%>
+<% form_tag({:controller=>'account', :action=>'login'}, { :id => 'login_form' }) do -%>
<%= label_tag 'login', 'Login' %>
<%= text_field_tag 'login', params[:login], :class => 'big' %>
diff -Nur mephisto-0.7.3/app/views/admin/articles/_article.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_article.rhtml
--- mephisto-0.7.3/app/views/admin/articles/_article.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_article.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -5,9 +5,9 @@
<% if article.comments.size == 0 %>
none
<% else %>
- <%= link_to article.comments.size.to_s.rjust(2, '0'), { :action => 'comments', :id => article } %>
+ <%= link_to article.comments.size.to_s.rjust(2, '0'), article_comments_path(article) %>
<% end %>
<%= published_at_for article %>
- <%= article.published? ? link_to(image_tag('/images/mephisto/icons/24-zoom-in.png', :style => 'vertical-align: middle'), article.full_permalink) : ' ' %>
+ <%= article.published? ? link_to(image_tag('/images/mephisto/icons/24-zoom-in.png', :style => 'vertical-align: middle'), @site.permalink_for(article)) : ' ' %>
diff -Nur mephisto-0.7.3/app/views/admin/articles/_form.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_form.rhtml
--- mephisto-0.7.3/app/views/admin/articles/_form.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_form.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -5,11 +5,11 @@
Title
<%= form.text_field :title, :class => 'big' %>
- <%= form.label_for :excerpt %> (<%= link_to_function 'Cancel', %(['x-lbl', 'x-body'].each(Element.toggle)) %>)
+ <%= form.label_for :excerpt %> (<%= link_to_function 'Hide', %(['x-lbl', 'x-body'].each(Element.toggle)) %>)
<%= form.text_area :excerpt, :rows => '8', :class => 'fat' %>
Write your article (<%= link_to_function 'Add an excerpt', %(['x-lbl', 'x-body'].each(Element.toggle)) %>)
<%= form.text_area :body, :class => 'fat', :rows => 25 %>
- Tags Enter one or more tags separated by a comma.
+ Tags Enter one or more tags separated by a comma or a space (for example, "Web Dev" Tutorials or Web Dev, Tutorials ).
<%= form.text_field :tag %>
@@ -22,7 +22,7 @@
><%= label_tag 'article_created_at', 'Publish on this date:' %>
>
<%= form.datetime_select :published_at,
- :start_year => (@article.published_at || Time.now.utc).year-1, :discard_year => true, :order => [:month, :day, :year] %>
+ :start_year => (@article.published_at || Time.now.utc).year-1, :end_year => (Time.now.utc.year + 5), :order => [:month, :day, :year] %>
diff -Nur mephisto-0.7.3/app/views/admin/articles/_page_nav.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_page_nav.rhtml
--- mephisto-0.7.3/app/views/admin/articles/_page_nav.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_page_nav.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -2,13 +2,15 @@
<% content_for :action_nav do %>
- <% if admin? || @article.user_id == current_user.id -%>
- <%= link_to_remote 'Delete this article', :url => {:action => 'destroy', :id => @article}, :confirm => 'Are you sure you want to delete this article?' %>
- <% unless @article.comment_age == -1 -%>
+ <% if controller.controller_name == 'comments' && controller.action_name == 'index' && @comments.size > 0 -%>
+ <%= link_to_remote "Delete these #{@filter != 'all' ? @filter : ''} comments", :confirm => "Are you sure you wish to delete all #{@filter != 'all' ? @filter : ''} comments?",
+ :url => { :controller => 'comments', :action => 'destroy', :id => @article }, :with => "ArticleForm.getAvailableComments().toQueryString('comment')"
+ %>
+ <% end -%>
+ <% if @article && (admin? || @article.user_id == current_user.id) && @article.comment_age != -1 -%>
<%= link_to_remote 'Close comments for this article',
:url => { :controller => 'admin/comments', :action => 'close', :id => @article } %>
<% end -%>
- <% end -%>
<% if controller.action_name == 'edit' -%>
<%= link_to('Preview', {:action => 'show', :id => @article}, {:target => '_blank'}) %>
<% end -%>
@@ -16,17 +18,15 @@
- <% unless @article.new_record? -%>
- <%= link_to 'Edit this article', :action => :edit, :id => @article, :version => nil %>
+ <% unless @article.nil? || @article.new_record? -%>
+ <%= link_to 'Edit this article', :controller => 'articles', :action => 'edit', :id => @article, :version => nil %>
<% end -%>
- <% if @article.comments.any? && controller.action_name != 'comments' -%>
- <%= link_to "View comments", :controller => 'articles', :action => 'comments', :id => @article %>
+ <% if @article && @article.comments.size > 0 && !(controller.controller_name == 'comments' && controller.action_name == 'index') -%>
+ <%= link_to "View comments", :controller => 'comments', :action => 'index', :article_id => @article %>
<% end %>
- <% if controller.action_name == 'comments' && @comments.any? -%>
- <%= link_to_remote "Delete all #{@filter != 'all' ? @filter : ''} comments", :confirm => "Are you sure you wish to delete all #{@filter != 'all' ? @filter : ''} comments?",
- :url => { :action => 'destroy_comment', :id => @article }, :with => "ArticleForm.getAvailableComments().toQueryString('comment')"
- %>
- <% end -%>
+ <% if @article && (admin? || @article.user_id == current_user.id) -%>
+ <%= link_to_remote 'Delete this article', :url => article_path(@article), :method => :delete, :confirm => 'Are you sure you want to delete this article?' %>
+ <% end -%>
@@ -38,7 +38,7 @@
- <% unless controller.action_name == 'comments' %>
+ <% if @article && controller.controller_name == 'articles' && controller.action_name == 'edit' -%>
Revision:
@@ -46,15 +46,15 @@
<%= options_from_collection_for_select @article.versions.reverse, :version, :version, params[:version].to_i %>
- <% end %>
- <% if controller.action_name == 'comments' -%>
+ <% end -%>
+ <% if controller.controller_name == 'comments' && controller.action_name == 'index' -%>
Show comments:
- <% end %>
+ <% end -%>
-<% end unless @article.new_record? && @article.comments.empty? -%>
\ No newline at end of file
+<% end unless @article && @article.new_record? && @article.comments.size == 0 -%>
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/articles/_shared_options.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_shared_options.rhtml
--- mephisto-0.7.3/app/views/admin/articles/_shared_options.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/_shared_options.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -14,6 +14,7 @@
Latest
+ Attached
Search
Upload
Bucket
@@ -21,8 +22,13 @@
-
- <%= render :partial => "admin/assets/widget", :collection => @assets %>
+
+ <%= render :partial => "admin/assets/widget", :collection => @assets, :locals => { :prefix => 'latest' } %>
+
+
+
+
+ <%= render :partial => "admin/assets/widget", :collection => @article.assets, :locals => { :prefix => 'attached' } %>
-
- <% session[:bucket].each do |filename, values| -%>
-
- <%= link_to(image_tag(*values), filename, :target => '_blank') %>
-
- <% end unless session[:bucket].blank? %>
+
+ <%= render :partial => "admin/assets/widget", :collection => @bucket_assets, :locals => { :prefix => 'bucket' } %>
diff -Nur mephisto-0.7.3/app/views/admin/articles/approve.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/approve.rjs
--- mephisto-0.7.3/app/views/admin/articles/approve.rjs 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/approve.rjs 1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-page["comment-#{@comment.id}"].add_class_name 'disabled'
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/articles/attach.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/attach.rjs
--- mephisto-0.7.3/app/views/admin/articles/attach.rjs 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/attach.rjs 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1 @@
+page.insert_html :bottom, 'attached-assets', :partial => 'admin/assets/widget', :object => @asset, :locals => { :prefix => 'attached' }
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/articles/comments.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/comments.rhtml
--- mephisto-0.7.3/app/views/admin/articles/comments.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/comments.rhtml 1969-12-31 19:00:00.000000000 -0500
@@ -1,57 +0,0 @@
-<%= render :partial => "page_nav" %>
-
-
-Comments on <%= link_to @article.title, { :action => 'edit', :id => @article }, :style => 'border:none' %> <%= @article.published? ? link_to(image_tag('/images/mephisto/icons/24-zoom-in.png', :style => 'vertical-align: middle'), @article.full_permalink, :style => 'border:none;') : ' ' %>
-
-
-
-
-<% content_for :sidebar do %>
- <% if @articles.size > 1 -%>
-
-
Comments awaiting your approval
-
- <% @articles.each do |article, count| -%>
- <% if article.title != @article.title -%>
- <%= link_to "(#{count}) #{h(article.title)}", :controller => 'articles', :action => 'comments', :id => article.id, :filter => :unapproved %>
- <% end -%>
- <% end -%>
-
-
- <% end -%>
-<% end %>
-
-
-
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/articles/destroy_comment.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/destroy_comment.rjs
--- mephisto-0.7.3/app/views/admin/articles/destroy_comment.rjs 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/destroy_comment.rjs 1969-12-31 19:00:00.000000000 -0500
@@ -1,3 +0,0 @@
-@comments.each do |comment|
- page["comment-#{comment.id}"].add_class_name 'disabled'
-end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/articles/edit.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/edit.rhtml
--- mephisto-0.7.3/app/views/admin/articles/edit.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/edit.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -1,23 +1,24 @@
<%= render :partial => "page_nav" %>
<% fields_for :article, @version do |f| -%>
-<% content_for :sidebar do %>
- <%= render :partial => 'shared_options', :locals => { :form => f } %>
-<% end %>
+ <% content_for :sidebar do %>
+ <%= render :partial => 'shared_options', :locals => { :form => f } %>
+ <% end %>
<% end %>
<%= error_messages_for :article %>
<% content_for :form do -%>
- <%= form_tag({:action => 'update', :id => @article}, {:id => 'article-form', :multipart => true}) %>
+ <%= form_tag({:action => 'update', :id => @article}, {:id => 'article-form', :multipart => true, :method => :put}) %>
<% end -%>
<% fields_for :article, @version do |f| -%>
-<%= render :partial => 'form', :object => f %>
-
- <%= submit_tag 'Apply Changes' %>
- <%= submit_tag 'Save without Revision' %>
- <%= link_to "cancel", :controller => "articles" %>
+ <%= render :partial => 'form', :object => f %>
+
+ <%= submit_tag 'Apply Changes' %>
+ <%= submit_tag 'Save without Revision' %>
+ <%= link_to "cancel", :controller => "articles" %>
+
<% end -%>
diff -Nur mephisto-0.7.3/app/views/admin/articles/index.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/index.rhtml
--- mephisto-0.7.3/app/views/admin/articles/index.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/index.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -36,7 +36,12 @@
<% end %>
-<% if @articles.any? %>
+<% if @articles.size > 0 -%>
+
+<% content_tag :p, :class => 'total' do %>
+ Total: <%= content_tag :strong, @articles.total_entries %> articles.
+<% end %>
+
-
-
<% else %>
@@ -79,7 +81,7 @@
Comments awaiting your approval
<% @comments.each do |article, count| -%>
- <%= link_to "(#{count}) #{h(article.title)}", :controller => 'articles', :action => 'comments', :id => article.id, :filter => :unapproved %>
+ <%= link_to "(#{count}) #{h(article.title)}", article_comments_path(article), :filter => :unapproved %>
<% end -%>
diff -Nur mephisto-0.7.3/app/views/admin/articles/label.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/label.rjs
--- mephisto-0.7.3/app/views/admin/articles/label.rjs 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/articles/label.rjs 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1 @@
+page["label-attached-widget-#{params[:version]}"].replace_html "Save"
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/assets/_assets.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/_assets.rhtml
--- mephisto-0.7.3/app/views/admin/assets/_assets.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/_assets.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -27,8 +27,6 @@
You have no files of this type or have yet to upload any files. <%= link_to 'Upload one now »', :action => 'new' %>
<% end %>
-<% if @asset_pages.page_count > 1 %>
-
-<% end %>
\ No newline at end of file
+<% if @assets.page_count > 1 %>
+ <%= will_paginate @assets, :id => 'pagination' %>
+<% end %>
diff -Nur mephisto-0.7.3/app/views/admin/assets/_widget.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/_widget.rhtml
--- mephisto-0.7.3/app/views/admin/assets/_widget.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/_widget.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -1,3 +1,18 @@
-
+ " class="widget<%= ' selected-widget' if @article && @article.assets.include?(widget) %>">
+<% if prefix == 'attached' -%>
+
+ <%= link_to asset_image_for(widget), widget.public_filename %>
+
+ <%= text_field_tag :version, (widget.respond_to?(:label) ? widget.label : nil), :id => widget.dom_id("#{prefix}-widget-version"), :class => 'txt' %>
+ ">Save
+
+
+<% else -%>
<%= link_to asset_image_for(widget), widget.public_filename %>
-
\ No newline at end of file
+<% end -%>
+ <%= image_tag('mephisto/icons/8-em-cross.png', :size => '16x16', :id => widget.dom_id("detach-#{prefix}-widget"),
+ :style => 'display:none', :class => 'detach-widget') %>
+ <%= image_tag('mephisto/icons/8-em-plus.png', :size => '16x16', :id => widget.dom_id("attach-#{prefix}-widget"),
+ :style => 'display:none', :class => 'attach-widget') %>
+
+<% if widget_counter.remainder(4).zero? && widget_counter > 0 %> <% end %>
diff -Nur mephisto-0.7.3/app/views/admin/assets/edit.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/edit.rhtml
--- mephisto-0.7.3/app/views/admin/assets/edit.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/edit.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -6,7 +6,7 @@
<%= error_messages_for :asset %>
- Tags Enter one or more tags separated by a comma.
+ Tags Enter one or more tags separated by a comma or a space (for example, "Web Dev" Tutorials or Web Dev, Tutorials ).
<%= f.text_field :tag %>
Select a file
<%= f.file_field :uploaded_data %>
diff -Nur mephisto-0.7.3/app/views/admin/assets/index.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/index.rhtml
--- mephisto-0.7.3/app/views/admin/assets/index.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/assets/index.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -43,7 +43,7 @@
<% session[:bucket].each do |filename, values| -%>
- <%= link_to(image_tag(*values), filename, :target => '_blank') %>
+ <%= image_tag(*values) %>
<% end unless session[:bucket].blank? %>
@@ -55,4 +55,4 @@
<%= number_to_human_size site.assets.sum(:size) %> .
-<% end %>
\ No newline at end of file
+<% end %>
diff -Nur mephisto-0.7.3/app/views/admin/cached_pages/pages.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/cached_pages/pages.rhtml
--- mephisto-0.7.3/app/views/admin/cached_pages/pages.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/cached_pages/pages.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -1,34 +1,23 @@
-<% if @cached_pages.size > 0 -%>
-
-
-<% if @cached_page_pages.page_count > 1 %>
-Pages: <%= pagination_remote_links @cached_page_pages, :params => { :action => :index } %>
-<% end %>
-
-Cached Pages
-
-
-
-
- URL
- Date
- Actions
-
-
+<% unless @cached_pages.empty? -%>
+ <%= will_paginate @cached_pages, :class => 'pages' if @cached_pages.page_count > 1 %>
+
+ Cached Pages
+
+
+
+
+ URL
+ Date
+ Actions
+
+
-
- <%= render :partial => 'page', :collection => @cached_pages %>
-
-
-
+
+ <%= render :partial => 'page', :collection => @cached_pages %>
+
+
+
+ <%= will_paginate @cached_pages, :id => 'pagination' if @cached_pages.page_count > 1 %>
<% else -%>
There currently aren't any pages being cached by Mephisto.
-<% end -%>
-
-
-
-
\ No newline at end of file
+<% end -%>
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/comments/_comment.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_comment.rhtml
--- mephisto-0.7.3/app/views/admin/comments/_comment.rhtml 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_comment.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,16 @@
+
+
diff -Nur mephisto-0.7.3/app/views/admin/comments/_edit_comment.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_edit_comment.rhtml
--- mephisto-0.7.3/app/views/admin/comments/_edit_comment.rhtml 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_edit_comment.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,9 @@
+
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/comments/_form.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_form.rhtml
--- mephisto-0.7.3/app/views/admin/comments/_form.rhtml 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_form.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,16 @@
+
+ Name (required)
+ <%= form.text_field :author %>
+
+
+ Mail (will not be published
+ <%= form.text_field :author_email %>
+
+
+ Website
+ <%= form.text_field :author_url %>
+
+
+ <%= form.text_area :body, { :rows => '10' } %>
+
+
diff -Nur mephisto-0.7.3/app/views/admin/comments/_new_comment.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_new_comment.rhtml
--- mephisto-0.7.3/app/views/admin/comments/_new_comment.rhtml 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/_new_comment.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,5 @@
+ <%= error_messages_for :comment %>
+ <% remote_form_for :comment, :url => article_comments_path(@article) do |form| %>
+ <%= render :partial => 'form', :object => form %>
+ <%= submit_tag "Create" %> or <%= link_to_function "hide", "$('new-comment-form').toggle()" %>
+ <% end # form %>
diff -Nur mephisto-0.7.3/app/views/admin/comments/approve.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/approve.rjs
--- mephisto-0.7.3/app/views/admin/comments/approve.rjs 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/approve.rjs 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1 @@
+page["comment-#{@comment.id}"].add_class_name 'disabled'
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/comments/create.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/create.rjs
--- mephisto-0.7.3/app/views/admin/comments/create.rjs 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/create.rjs 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,6 @@
+ if @comment.new_record?
+ page.replace_html 'new-comment-form', :partial => 'new_comment'
+ else
+ page['new-comment-form'].reset
+ page.insert_html :top, 'comment-list', :partial => 'comment', :object => @comment
+ end
diff -Nur mephisto-0.7.3/app/views/admin/comments/destroy.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/destroy.rjs
--- mephisto-0.7.3/app/views/admin/comments/destroy.rjs 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/destroy.rjs 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,3 @@
+@comments.each do |comment|
+ page["comment-#{comment.id}"].add_class_name 'disabled'
+end
\ No newline at end of file
diff -Nur mephisto-0.7.3/app/views/admin/comments/edit.rjs technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/edit.rjs
--- mephisto-0.7.3/app/views/admin/comments/edit.rjs 1969-12-31 19:00:00.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/edit.rjs 2008-03-31 02:18:56.000000000 -0400
@@ -0,0 +1,2 @@
+ page.insert_html :after, "comment-#{@comment.id}", :partial => 'edit_comment', :locals => { :comment => @comment }
+ page.hide "comment-#{@comment.id}"
diff -Nur mephisto-0.7.3/app/views/admin/comments/index.rhtml technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/index.rhtml
--- mephisto-0.7.3/app/views/admin/comments/index.rhtml 2006-11-23 13:57:06.000000000 -0500
+++ technoweenie-mephisto-9072b487bf45c5e41e33c66b32d94aea84732d1b/app/views/admin/comments/index.rhtml 2008-03-31 02:18:56.000000000 -0400
@@ -1,33 +1,65 @@
-<% content_for :action_nav do %>
-
-
-
- <%= link_to_remote 'Delete these comments', :confirm => "Are you sure you wish to delete all of these comments?",
- :url => { :controller => 'articles', :action => 'destroy_comment' },
- :with => "ArticleForm.getAvailableComments().toQueryString('comment')"
- %>
-
-
-
-<% end %>
+<%= render :partial => "admin/articles/page_nav" %>
+
+
+<% if @article -%>
+Comments on <%= link_to @article.title, edit_article_path(@article), :style => 'border:none' %> <%= @article.published? ? link_to(image_tag('/images/mephisto/icons/24-zoom-in.png', :style => 'vertical-align: middle'), @site.permalink_for(@article), :style => 'border:none;') : ' ' %>
+<% else -%>
+Comments for all articles
+<% end -%>
+
-<%= pluralize(@comments.size, 'Unapproved Comment') %>
+<% if @article -%>
+ <%= link_to_function "New comment", "$('new-comment-form').toggle()" %>
+
+<% end -%>
-