Permalink
Browse files

Webmachine resources are now called controllers

Did full scan of codebase for resource -> controller rename.  This
change is backward incompatible -- you need to adjust your custom
dispatch rules and controllers (resources); see the 0.9 upgrade notes
on exactly what's changed.
  • Loading branch information...
1 parent e3fa112 commit 8e6332cadb7ed370de16699da383398a0f74e638 @arjan arjan committed Sep 18, 2012
Showing with 272 additions and 272 deletions.
  1. +1 −1 deps/webzmachine
  2. +3 −3 include/{resource_html.hrl → html_controller.hrl}
  3. +1 −1 include/{webmachine_resource.hrl → webmachine_controller.hrl}
  4. +1 −1 include/wm_host_dispatch_list.hrl
  5. +2 −2 include/zotonic.hrl
  6. +1 −1 modules/mod_acl_simple_roles/dispatch/dispatch
  7. +3 −3 modules/mod_admin/{resources/resource_admin.erl → controllers/controller_admin.erl}
  8. +3 −3 modules/mod_admin/{resources/resource_admin_edit.erl → controllers/controller_admin_edit.erl}
  9. +2 −2 ...min/{resources/resource_admin_media_preview.erl → controllers/controller_admin_media_preview.erl}
  10. +2 −2 ...s/mod_admin/{resources/resource_admin_referrers.erl → controllers/controller_admin_referrers.erl}
  11. +8 −8 modules/mod_admin/dispatch/dispatch
  12. +2 −2 ...{resources/resource_admin_category_sorter.erl → controllers/controller_admin_category_sorter.erl}
  13. +1 −1 modules/mod_admin_category/dispatch/dispatch
  14. +2 −2 .../mod_admin_config/{resources/resource_admin_config.erl → controllers/controller_admin_config.erl}
  15. +1 −1 modules/mod_admin_config/dispatch/dispatch
  16. +1 −1 modules/mod_admin_identity/dispatch/admin_dispatch
  17. +2 −2 ...s/{resources/resource_admin_module_manager.erl → controllers/controller_admin_module_manager.erl}
  18. +1 −1 modules/mod_admin_modules/dispatch/dispatch_module_admin
  19. +2 −2 modules/mod_admin_predicate/dispatch/dispatch
  20. +2 −2 modules/mod_atom/{resources/resource_atom_entry.erl → controllers/controller_atom_entry.erl}
  21. +1 −1 modules/mod_atom/dispatch/dispatch
  22. +2 −2 ...s/mod_atom_feed/{resources/resource_atom_feed_cat.erl → controllers/controller_atom_feed_cat.erl}
  23. +2 −2 ...atom_feed/{resources/resource_atom_feed_search.erl → controllers/controller_atom_feed_search.erl}
  24. +3 −3 modules/mod_atom_feed/dispatch/dispatch
  25. +3 −3 modules/mod_authentication/{resources/resource_logoff.erl → controllers/controller_logoff.erl}
  26. +2 −2 modules/mod_authentication/{resources/resource_logon.erl → controllers/controller_logon.erl}
  27. +2 −2 modules/mod_authentication/dispatch/dispatch
  28. +1 −1 modules/mod_authentication/mod_authentication.erl
  29. +1 −1 modules/mod_authentication/templates/logon_confirm_form.tpl
  30. +2 −2 modules/mod_backup/{resources/resource_admin_backup.erl → controllers/controller_admin_backup.erl}
  31. +2 −2 ...{resources/resource_admin_backup_revision.erl → controllers/controller_admin_backup_revision.erl}
  32. +3 −3 modules/mod_backup/dispatch/backup
  33. +2 −2 modules/mod_base/{resources/resource_api.erl → controllers/controller_api.erl}
  34. +2 −2 .../mod_base/{resources/resource_close_connection.erl → controllers/controller_close_connection.erl}
  35. +2 −2 modules/mod_base/{resources/resource_comet.erl → controllers/controller_comet.erl}
  36. +3 −3 modules/mod_base/{resources/resource_error.erl → controllers/controller_error.erl}
  37. +3 −3 modules/mod_base/{resources/resource_file_readonly.erl → controllers/controller_file_readonly.erl}
  38. +3 −3 modules/mod_base/{resources/resource_home.erl → controllers/controller_home.erl}
  39. +2 −2 modules/mod_base/{resources/resource_id.erl → controllers/controller_id.erl}
  40. +3 −3 modules/mod_base/{resources/resource_lib.erl → controllers/controller_lib.erl}
  41. +2 −2 modules/mod_base/{resources/resource_page.erl → controllers/controller_page.erl}
  42. +4 −4 modules/mod_base/{resources/resource_postback.erl → controllers/controller_postback.erl}
  43. +2 −2 modules/mod_base/{resources/resource_redirect.erl → controllers/controller_redirect.erl}
  44. +3 −3 modules/mod_base/{resources/resource_static_pages.erl → controllers/controller_static_pages.erl}
  45. +2 −2 modules/mod_base/{resources/resource_template.erl → controllers/controller_template.erl}
  46. +2 −2 .../mod_base/{resources/resource_user_agent_probe.erl → controllers/controller_user_agent_probe.erl}
  47. +2 −2 ...od_base/{resources/resource_user_agent_select.erl → controllers/controller_user_agent_select.erl}
  48. +2 −2 .../mod_base/{resources/resource_website_redirect.erl → controllers/controller_website_redirect.erl}
  49. +2 −2 modules/mod_base/{resources/resource_websocket.erl → controllers/controller_websocket.erl}
  50. +19 −19 modules/mod_base/dispatch/dispatch
  51. +1 −1 modules/mod_base/scomps/scomp_base_draggable.erl
  52. +3 −3 modules/mod_base/scomps/scomp_base_droppable.erl
  53. +1 −1 modules/mod_base/scomps/scomp_base_sortable.erl
  54. +1 −1 modules/mod_base/scomps/scomp_base_sorter.erl
  55. +10 −10 modules/mod_base_site/dispatch/dispatch
  56. +2 −2 ...s/mod_comment/{resources/resource_admin_comments.erl → controllers/controller_admin_comments.erl}
  57. +2 −2 ...ources/resource_admin_comments_settings.erl → controllers/controller_admin_comments_settings.erl}
  58. +2 −2 modules/mod_comment/dispatch/dispatch
  59. +1 −1 modules/mod_contact/dispatch/dispatch
  60. +2 −2 modules/mod_development/{resources/resource_wmtrace.erl → controllers/controller_wmtrace.erl}
  61. +11 −11 ...s/mod_development/{resources/resource_wmtrace_conf.erl → controllers/controller_wmtrace_conf.erl}
  62. +5 −5 modules/mod_development/dispatch/development
  63. +2 −2 .../mod_facebook/{resources/resource_admin_facebook.erl → controllers/controller_admin_facebook.erl}
  64. +2 −2 ...ebook/{resources/resource_facebook_authorize.erl → controllers/controller_facebook_authorize.erl}
  65. +2 −2 ...acebook/{resources/resource_facebook_redirect.erl → controllers/controller_facebook_redirect.erl}
  66. +3 −3 modules/mod_facebook/dispatch/dispatch
  67. +2 −2 modules/mod_logging/dispatch/dispatch
  68. +2 −2 ...{resources/resource_admin_mailing_preview.erl → controllers/controller_admin_mailing_preview.erl}
  69. +2 −2 ...t/{resources/resource_admin_mailing_status.erl → controllers/controller_admin_mailing_status.erl}
  70. +2 −2 ...inglist/{resources/resource_admin_mailinglist.erl → controllers/controller_admin_mailinglist.erl}
  71. +2 −2 ...ource_admin_mailinglist_recipients.erl → controllers/controller_admin_mailinglist_recipients.erl}
  72. +2 −2 ...glist/{resources/resource_mailinglist_export.erl → controllers/controller_mailinglist_export.erl}
  73. +9 −9 modules/mod_mailinglist/dispatch/dispatch_mailinglist
  74. +2 −2 ...oauth/{resources/resource_oauth_access_token.erl → controllers/controller_oauth_access_token.erl}
  75. +2 −2 modules/mod_oauth/{resources/resource_oauth_apps.erl → controllers/controller_oauth_apps.erl}
  76. +2 −2 ...s/mod_oauth/{resources/resource_oauth_authorize.erl → controllers/controller_oauth_authorize.erl}
  77. +2 −2 ...uth/{resources/resource_oauth_request_token.erl → controllers/controller_oauth_request_token.erl}
  78. +5 −5 modules/mod_oauth/dispatch/dispatch
  79. +2 −2 modules/mod_rest/{resources/resource_rest_rsc.erl → controllers/controller_rest_rsc.erl}
  80. +2 −2 modules/mod_rest/dispatch/dispatch_rest
  81. +2 −2 modules/mod_seo/{resources/resource_admin_seo.erl → controllers/controller_admin_seo.erl}
  82. +1 −1 modules/mod_seo/dispatch/dispatch
  83. +1 −1 modules/mod_seo_sitemap/dispatch/dispatch
  84. +2 −2 modules/mod_signup/{resources/resource_signup.erl → controllers/controller_signup.erl}
  85. +2 −2 ...es/mod_signup/{resources/resource_signup_confirm.erl → controllers/controller_signup_confirm.erl}
  86. +3 −3 modules/mod_signup/dispatch/dispatch
  87. +2 −2 ...es/mod_survey/{resources/resource_survey_results.erl → controllers/controller_survey_results.erl}
  88. +7 −7 modules/mod_survey/dispatch/survey
  89. +2 −2 ...s/mod_translation/{resources/resource_language_set.erl → controllers/controller_language_set.erl}
  90. +4 −4 modules/mod_translation/dispatch/dispatch_translation
  91. +2 −2 ...twitter/{resources/resource_twitter_authorize.erl → controllers/controller_twitter_authorize.erl}
  92. +2 −2 ...d_twitter/{resources/resource_twitter_redirect.erl → controllers/controller_twitter_redirect.erl}
  93. +2 −2 modules/mod_twitter/dispatch/dispatch
  94. +3 −3 ...testsandbox/{resources/resource_test_helloworld.erl → controllers/controller_test_helloworld.erl}
  95. +2 −2 ...otonic_status/{resources/resource_zotonic_status.erl → controllers/controller_zotonic_status.erl}
  96. +1 −1 priv/sites/zotonic_status/dispatch/dispatch
  97. +1 −1 priv/skel/blog/{resources/resource_default_contact.erl → controllers/controller_default_contact.erl}
  98. +2 −2 ...log/{resources/resource_default_postcomment.erl → controllers/controller_default_postcomment.erl}
  99. +6 −6 priv/skel/blog/dispatch/dispatch
  100. +1 −1 priv/skel/empty/dispatch/dispatch
  101. +1 −1 priv/skel/nodb/dispatch/dispatch
  102. +9 −9 src/support/z_context.erl
  103. +1 −1 src/support/z_render.erl
2 deps/webzmachine
@@ -1 +1 @@
-Subproject commit 8fb53e40a506a9c55f28a570d2bd4a944183dd2b
+Subproject commit 2d3a5d22e9ee63ea5a9946a27aeefd76fd674e0a
View
6 include/resource_html.hrl → include/html_controller.hrl
@@ -1,11 +1,11 @@
%% @author Marc Worrell <marc@worrell.nl>
%% @copyright 2009 Marc Worrell
-%% @doc Empty HTML resource, defining the basic callbacks needed for a html page. All is needed is the 'html' function.
+%% @doc Empty HTML controller, defining the basic callbacks needed for a html page. All is needed is the 'html' function.
%% Make a new resource (resource_plop.erl) by:
%%
%% -module(resource_plop).
%% -author("Your Name <me@example.com>").
-%% -include_lib("resource_html.hrl").
+%% -include_lib("html_controller.hrl").
%%
%% html(Context) ->
%% Html = z_template:render("plop.tpl", Context),
@@ -27,7 +27,7 @@
-export([init/1, to_html/2, service_available/2, charsets_provided/2]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
init(DispatchArgs) ->
View
2 include/webmachine_resource.hrl → include/webmachine_controller.hrl
@@ -4,7 +4,7 @@
-export([ping/2]).
start_link(Args) ->
- webmachine_resource:start_link(?MODULE, [Args]).
+ webmachine_controller:start_link(?MODULE, [Args]).
ping(ReqData, State) ->
{pong, ReqData, State}.
View
2 include/wm_host_dispatch_list.hrl
@@ -5,6 +5,6 @@
%% requests for this hostname are not redirected. '*.' is replaced by a random hostname.
%% hostalias = list of accepted aliases, lowercase (eg. [ "example.com", "example.net" ])
%% redirect = boolean, set to true to redirect GET requests to the main host
-%% dispatch_list = list of {pathspec, resource, args}
+%% dispatch_list = list of {pathspec, controller, args}
-record(wm_host_dispatch_list, {host, hostname, streamhost, smtphost, hostalias, redirect, dispatch_list}).
View
4 include/zotonic.hrl
@@ -33,8 +33,8 @@
%% Webmachine request data (only set when this context is used because of a request)
wm_reqdata=undefined :: #wm_reqdata{} | undefined,
- %% The resource responsible for handling this request
- resource_module=undefined :: atom(),
+ %% The controller responsible for handling this request
+ controller_module=undefined :: atom(),
%% The page and session processes associated with the current request
session_pid=undefined :: pid() | undefined, % one session per browser (also manages the persistent data)
View
2 modules/mod_acl_simple_roles/dispatch/dispatch
@@ -1,5 +1,5 @@
%% -*- mode: erlang -*-
%% Dispatch rule for a predicate list page
[
- {admin_acl, ["admin", "acl"], resource_admin, [{template, "admin_acl.tpl"}, {selected, "acl"}]}
+ {admin_acl, ["admin", "acl"], controller_admin, [{template, "admin_acl.tpl"}, {selected, "acl"}]}
].
View
6 ...es/mod_admin/resources/resource_admin.erl → ...od_admin/controllers/controller_admin.erl
@@ -1,6 +1,6 @@
%% @author Tim Benniks <tim@timbenniks.com>
%% @copyright 2009 Tim Benniks.
-%% @doc Admin webmachine_resource.
+%% @doc Admin webmachine_controller.
%% Copyright 2009 Tim Benniks
%%
@@ -16,13 +16,13 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin).
+-module(controller_admin).
-author("Tim Benniks <tim@timbenniks.com>").
-export([is_authorized/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, z_context:get(acl_module, Context, mod_admin), admin_logon, ReqData, Context).
View
6 ...d_admin/resources/resource_admin_edit.erl → ...min/controllers/controller_admin_edit.erl
@@ -1,6 +1,6 @@
%% @author Marc Worrell <marc@worrell.nl>
%% @copyright 2009-2010 Marc Worrell, Arjan Scherpenisse
-%% @doc Admin webmachine_resource.
+%% @doc Admin webmachine_controller.
%% Copyright 2009-2010 Marc Worrell, Arjan Scherpenisse
%%
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_edit).
+-module(controller_admin_edit).
-author("Marc Worrell <marc@worrell.nl>").
-export([resource_exists/2,
@@ -26,7 +26,7 @@
ensure_id/1
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
%% @todo Change this into "visible" and add a view instead of edit template.
is_authorized(ReqData, Context) ->
View
4 ...esources/resource_admin_media_preview.erl → ...ollers/controller_admin_media_preview.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_media_preview).
+-module(controller_admin_media_preview).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
-export([init/1,
@@ -26,7 +26,7 @@
to_image/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init([]) -> {ok, []}.
View
4 ...in/resources/resource_admin_referrers.erl → ...ontrollers/controller_admin_referrers.erl
@@ -17,14 +17,14 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_referrers).
+-module(controller_admin_referrers).
-author("Marc Worrell <marc@worrell.nl").
-export([resource_exists/2,
is_authorized/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_admin, admin_logon, ReqData, Context).
View
16 modules/mod_admin/dispatch/dispatch
@@ -1,14 +1,14 @@
%% -*- mode: erlang -*-
%% Admin dispatch rules
[
- {admin, ["admin"], resource_admin, []},
- {admin_logon, ["admin", "logon"], resource_logon, [{template, "admin_logon.tpl"}]},
- {admin_overview_rsc, ["admin", "overview"], resource_admin, [{template, "admin_overview.tpl"}, {selected, "overview"}]},
- {admin_media, ["admin", "media"], resource_admin, [{template, "admin_media.tpl"}, {selected, "media"}]},
+ {admin, ["admin"], controller_admin, []},
+ {admin_logon, ["admin", "logon"], controller_logon, [{template, "admin_logon.tpl"}]},
+ {admin_overview_rsc, ["admin", "overview"], controller_admin, [{template, "admin_overview.tpl"}, {selected, "overview"}]},
+ {admin_media, ["admin", "media"], controller_admin, [{template, "admin_media.tpl"}, {selected, "media"}]},
- {admin_edit_rsc, ["admin", "edit", id], resource_admin_edit, []},
- {admin_referrers, ["admin", "referrer", id], resource_admin_referrers, []},
- {admin_media_preview, ["admin", "media", "preview", id], resource_admin_media_preview, []},
+ {admin_edit_rsc, ["admin", "edit", id], controller_admin_edit, []},
+ {admin_referrers, ["admin", "referrer", id], controller_admin_referrers, []},
+ {admin_media_preview, ["admin", "media", "preview", id], controller_admin_media_preview, []},
- {admin_status, ["admin", "status"], resource_admin, [{template, "admin_status.tpl"}, {selected, "status"}]}
+ {admin_status, ["admin", "status"], controller_admin, [{template, "admin_status.tpl"}, {selected, "status"}]}
].
View
4 ...ources/resource_admin_category_sorter.erl → ...lers/controller_admin_category_sorter.erl
@@ -16,14 +16,14 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_category_sorter).
+-module(controller_admin_category_sorter).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_admin_category, ReqData, Context).
View
2 modules/mod_admin_category/dispatch/dispatch
@@ -1,4 +1,4 @@
%% -*- mode: erlang -*-
[
- {admin_category_sorter, ["admin", "category"], resource_admin_category_sorter, []}
+ {admin_category_sorter, ["admin", "category"], controller_admin_category_sorter, []}
].
View
4 ...onfig/resources/resource_admin_config.erl → ...g/controllers/controller_admin_config.erl
@@ -17,14 +17,14 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_config).
+-module(controller_admin_config).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_admin_config, ReqData, Context).
View
2 modules/mod_admin_config/dispatch/dispatch
@@ -1,5 +1,5 @@
%% -*- mode: erlang -*-
%% Dispatch rule for overview of configuration settings.
[
- {admin_config, ["admin", "config"], resource_admin_config, []}
+ {admin_config, ["admin", "config"], controller_admin_config, []}
].
View
2 modules/mod_admin_identity/dispatch/admin_dispatch
@@ -1,4 +1,4 @@
%% -*- mode: erlang -*-
[
- {admin_user, ["admin", "users"], resource_admin, [{template, "admin_users.tpl"}, {selected, "users"}]}
+ {admin_user, ["admin", "users"], controller_admin, [{template, "admin_users.tpl"}, {selected, "users"}]}
].
View
4 ...sources/resource_admin_module_manager.erl → ...llers/controller_admin_module_manager.erl
@@ -16,14 +16,14 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_module_manager).
+-module(controller_admin_module_manager).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_admin_modules, ReqData, Context).
View
2 modules/mod_admin_modules/dispatch/dispatch_module_admin
@@ -1,4 +1,4 @@
%% -*- mode: erlang -*-
[
- {admin_modules, ["admin", "modules"], resource_admin_module_manager, []}
+ {admin_modules, ["admin", "modules"], controller_admin_module_manager, []}
].
View
4 modules/mod_admin_predicate/dispatch/dispatch
@@ -1,6 +1,6 @@
%% -*- mode: erlang -*-
%% Dispatch rule for a predicate list page
[
- {admin_predicate, ["admin", "predicate"], resource_admin, [{template, "admin_predicate.tpl"}, {selected, "predicate"}]},
- {admin_predicate_edit, ["admin", "predicate", id], resource_admin_predicate_edit, []}
+ {admin_predicate, ["admin", "predicate"], controller_admin, [{template, "admin_predicate.tpl"}, {selected, "predicate"}]},
+ {admin_predicate_edit, ["admin", "predicate", id], controller_admin_predicate_edit, []}
].
View
4 ...od_atom/resources/resource_atom_entry.erl → ...tom/controllers/controller_atom_entry.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_atom_entry).
+-module(controller_atom_entry).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
-export([
@@ -35,7 +35,7 @@
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
%% Let cached versions expire in an hour.
View
2 modules/mod_atom/dispatch/dispatch
@@ -1,5 +1,5 @@
%% -*- mode: erlang -*-
[
%% Atom entry
- {atom_entry, ["atom", id], resource_atom_entry, []}
+ {atom_entry, ["atom", id], controller_atom_entry, []}
].
View
4 ...feed/resources/resource_atom_feed_cat.erl → .../controllers/controller_atom_feed_cat.erl
@@ -18,7 +18,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_atom_feed_cat).
+-module(controller_atom_feed_cat).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -34,7 +34,7 @@
provide_content/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
%% Let cached versions expire in an hour.
View
4 ...d/resources/resource_atom_feed_search.erl → ...ntrollers/controller_atom_feed_search.erl
@@ -15,7 +15,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_atom_feed_search).
+-module(controller_atom_feed_search).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
@@ -31,7 +31,7 @@
provide_content/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
%% Let cached versions expire in an hour.
View
6 modules/mod_atom_feed/dispatch/dispatch
@@ -1,6 +1,6 @@
%% -*- mode: erlang -*-
[
- { atom_feed_search, ["feed", "search" ], resource_atom_feed_search, [] },
- { atom_feed, ["feed", cat], resource_atom_feed_cat, [] },
- { atom_feed_upcoming, ["feed", "upcoming", cat], resource_atom_feed_cat, [{upcoming, true}] }
+ { atom_feed_search, ["feed", "search" ], controller_atom_feed_search, [] },
+ { atom_feed, ["feed", cat], controller_atom_feed_cat, [] },
+ { atom_feed_upcoming, ["feed", "upcoming", cat], controller_atom_feed_cat, [{upcoming, true}] }
].
View
6 ...hentication/resources/resource_logoff.erl → ...ication/controllers/controller_logoff.erl
@@ -17,14 +17,14 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_logoff).
+-module(controller_logoff).
-author("Marc Worrell <marc@worrell.nl>").
-export([init/1, service_available/2, charsets_provided/2, content_types_provided/2, provide_content/2]).
-export([resource_exists/2, previously_existed/2, moved_temporarily/2]).
-export([reset_rememberme_cookie_and_logoff/1]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
@@ -72,4 +72,4 @@ reset_rememberme_cookie_and_logoff(Context) ->
ContextNoCookie = resource_logon:reset_rememberme_cookie(Context),
ContextLogOff = z_auth:logoff(ContextNoCookie),
{ok, ContextNoSession} = z_session_manager:stop_session(ContextLogOff),
- ContextNoSession.
+ ContextNoSession.
View
4 ...thentication/resources/resource_logon.erl → ...tication/controllers/controller_logon.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_logon).
+-module(controller_logon).
-author("Marc Worrell <marc@worrell.nl>").
-export([init/1, service_available/2, charsets_provided/2, content_types_provided/2]).
@@ -26,7 +26,7 @@
-export([event/2]).
-export([get_rememberme_cookie/1, reset_rememberme_cookie/1]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
-define(LOGON_REMEMBERME_COOKIE, "z_logon").
View
4 modules/mod_authentication/dispatch/dispatch
@@ -1,5 +1,5 @@
%% -*- mode: erlang -*-
[
- {logon, ["logon"], resource_logon, [{ssl, true}]},
- {logoff, ["logoff"], resource_logoff, []}
+ {logon, ["logon"], controller_logon, [{ssl, true}]},
+ {logoff, ["logoff"], controller_logoff, []}
].
View
2 modules/mod_authentication/mod_authentication.erl
@@ -58,7 +58,7 @@ observe_logon_submit(#logon_submit{query_args=Args}, Context) ->
end.
observe_auth_autologon(auth_autologon, Context) ->
- case resource_logon:get_rememberme_cookie(Context) of
+ case controller_logon:get_rememberme_cookie(Context) of
undefined -> undefined;
{ok, UserId} -> {ok, UserId}
end.
View
2 modules/mod_authentication/templates/logon_confirm_form.tpl
@@ -2,7 +2,7 @@
wire id="logon_confirm_form"
type="submit"
postback={logon_confirm on_success=on_success on_success={dialog_close}}
- delegate="resource_logon"
+ delegate="controller_logon"
%}
<form id="logon_confirm_form" method="post" action="postback">
<h1 class="logon_header">{_ Please confirm your _} <span>{{ m.config.site.title.value|default:"Zotonic" }} password</span></h1>
View
4 ...ackup/resources/resource_admin_backup.erl → ...p/controllers/controller_admin_backup.erl
@@ -16,15 +16,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_backup).
+-module(controller_admin_backup).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_backup, ReqData, Context).
View
4 ...ources/resource_admin_backup_revision.erl → ...lers/controller_admin_backup_revision.erl
@@ -16,15 +16,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_backup_revision).
+-module(controller_admin_backup_revision).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context0) ->
Context = ?WM_REQ(ReqData, Context0),
View
6 modules/mod_backup/dispatch/backup
@@ -1,9 +1,9 @@
%% -*- mode: erlang -*-
[
- {admin_backup, [ "admin", "backup" ], resource_admin_backup, []},
- {admin_backup_revision, [ "admin", "backup", id ], resource_admin_backup_revision, []},
+ {admin_backup, [ "admin", "backup" ], controller_admin_backup, []},
+ {admin_backup_revision, [ "admin", "backup", id ], controller_admin_backup_revision, []},
- {backup_download, [ "backup", '*' ], resource_file_readonly,
+ {backup_download, [ "backup", '*' ], controller_file_readonly,
[
{root, [{module, mod_backup}]},
{content_disposition, attachment},
View
4 modules/mod_base/resources/resource_api.erl → ...s/mod_base/controllers/controller_api.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_api).
+-module(controller_api).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
@@ -33,7 +33,7 @@
get_q_all/1
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
4 ...e/resources/resource_close_connection.erl → ...ntrollers/controller_close_connection.erl
@@ -17,15 +17,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_close_connection).
+-module(controller_close_connection).
-author("Marc Worrell <marc@worrell.nl").
-export([
init/1,
to_html/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init(_Args) -> {ok, []}.
View
4 ...les/mod_base/resources/resource_comet.erl → ...mod_base/controllers/controller_comet.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_comet).
+-module(controller_comet).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -28,7 +28,7 @@
process_post/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
View
6 ...les/mod_base/resources/resource_error.erl → ...mod_base/controllers/controller_error.erl
@@ -1,6 +1,6 @@
%% @author Tim Benniks <tim@timbenniks.com>
%% @copyright 2009 Tim Benniks.
-%% @doc Home Page webmachine_resource.
+%% @doc Home Page webmachine_controller.
%% Copyright 2009 Tim Benniks
%%
@@ -16,9 +16,9 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_error).
+-module(controller_error).
-author("Tim Benniks <tim@timbenniks.com>").
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
html(Context) ->
ErrorCode = "404 Page not found",
View
6 ...base/resources/resource_file_readonly.erl → .../controllers/controller_file_readonly.erl
@@ -24,7 +24,7 @@
%% /media/inline/<filepath>
%% /media/attachment/<filepath>
--module(resource_file_readonly).
+-module(controller_file_readonly).
-export([
init/1,
service_available/2,
@@ -40,7 +40,7 @@
finish_request/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
-record(cache, {path, fullpath, mime, last_modified, body}).
@@ -317,7 +317,7 @@ rsc_media_check(File, Context) ->
cache_key(Path) ->
- {resource_file, Path}.
+ {?MODULE, Path}.
file_exists(undefined, _Context) ->
false;
View
6 modules/mod_base/resources/resource_home.erl → .../mod_base/controllers/controller_home.erl
@@ -1,6 +1,6 @@
%% @author Tim Benniks <tim@timbenniks.com>
%% @copyright 2009 Tim Benniks.
-%% @doc Home Page webmachine_resource.
+%% @doc Home Page webmachine_controller.
%% Copyright 2009 Tim Benniks
%%
@@ -16,9 +16,9 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_home).
+-module(controller_home).
-author("Tim Benniks <tim@timbenniks.com>").
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
html(Context) ->
Html = z_template:render("home.tpl", [], Context),
View
4 modules/mod_base/resources/resource_id.erl → ...es/mod_base/controllers/controller_id.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_id).
+-module(controller_id).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -28,7 +28,7 @@
see_other/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
6 modules/mod_base/resources/resource_lib.erl → ...s/mod_base/controllers/controller_lib.erl
@@ -19,7 +19,7 @@
%% limitations under the License.
--module(resource_lib).
+-module(controller_lib).
-export([init/1]).
-export([allowed_methods/2,
resource_exists/2,
@@ -32,7 +32,7 @@
finish_request/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
%% These are used for file serving (move to metadata)
@@ -196,7 +196,7 @@ finish_request(ReqData, State) ->
%%%%%%%%%%%%%% Helper functions %%%%%%%%%%%%%%
cache_key(Path) ->
- {resource_file, Path}.
+ {?MODULE, Path}.
file_exists(_State, [], _Context) ->
false;
View
4 modules/mod_base/resources/resource_page.erl → .../mod_base/controllers/controller_page.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_page).
+-module(controller_page).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -25,7 +25,7 @@
html/1
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
%% @doc Check if the id in the request (or dispatch conf) exists.
resource_exists(ReqData, Context) ->
View
8 .../mod_base/resources/resource_postback.erl → ..._base/controllers/controller_postback.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_postback).
+-module(controller_postback).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -31,7 +31,7 @@
process_postback/1
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
@@ -98,7 +98,7 @@ process_post(ReqData, Context) ->
-%% @doc Process the postback, shared with the resource_websocket.
+%% @doc Process the postback, shared with the controller_websocket.
process_postback(Context1) ->
EventContext = case z_context:get_q("postback", Context1) of
"notify" ->
@@ -130,7 +130,7 @@ process_postback(Context1) ->
undefined -> z_context:get_q("z_trigger_id", Context1);
_ -> TriggerId
end,
- ContextRsc = z_context:set_resource_module(Module, Context1),
+ ContextRsc = z_context:set_controller_module(Module, Context1),
case EventType of
"submit" ->
case z_validation:validate_query_args(ContextRsc) of
View
4 .../mod_base/resources/resource_redirect.erl → ..._base/controllers/controller_redirect.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_redirect).
+-module(controller_redirect).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -28,7 +28,7 @@
moved_permanently/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
View
6 ..._base/resources/resource_static_pages.erl → ...e/controllers/controller_static_pages.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_static_pages).
+-module(controller_static_pages).
-export([init/1]).
-export([allowed_methods/2,
resource_exists/2,
@@ -32,7 +32,7 @@
moved_temporarily/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
%% These are used for file serving (move to metadata)
@@ -227,7 +227,7 @@ finish_request(ReqData, State) ->
%%%%%%%%%%%%%% Helper functions %%%%%%%%%%%%%%
cache_key(Path) ->
- {resource_static_pages, Path}.
+ {?MODULE, Path}.
check_resource(ReqData, #state{fullpath=undefined} = State) ->
Context = z_context:set_noindex_header(z_context:new(ReqData, ?MODULE)),
View
4 .../mod_base/resources/resource_template.erl → ..._base/controllers/controller_template.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_template).
+-module(controller_template).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -28,7 +28,7 @@
provide_content/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
View
4 ...e/resources/resource_user_agent_probe.erl → ...ntrollers/controller_user_agent_probe.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_user_agent_probe).
+-module(controller_user_agent_probe).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -28,7 +28,7 @@
to_js/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
4 .../resources/resource_user_agent_select.erl → ...trollers/controller_user_agent_select.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_user_agent_select).
+-module(controller_user_agent_select).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -27,7 +27,7 @@
moved_temporarily/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
4 ...e/resources/resource_website_redirect.erl → ...ntrollers/controller_website_redirect.erl
@@ -15,7 +15,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_website_redirect).
+-module(controller_website_redirect).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
-export([
@@ -26,7 +26,7 @@
moved_temporarily/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
4 ...mod_base/resources/resource_websocket.erl → ...base/controllers/controller_websocket.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_websocket).
+-module(controller_websocket).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -31,7 +31,7 @@
handle_message/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
init(_Args) -> {ok, []}.
View
38 modules/mod_base/dispatch/dispatch
@@ -2,71 +2,71 @@
%% Base dispatch rules for zotonic
[
%% Comet connection, used with long polls from the browser.
- {comet, ["comet"], resource_comet, [{ssl, any}, {no_session, true}]},
+ {comet, ["comet"], controller_comet, [{ssl, any}, {no_session, true}]},
%% Comet sub-domain connection, used with long polls from the browser.
- {comet, ["comet", "subdomain"], resource_template, [{template, "comet_subdomain.tpl"}]},
+ {comet, ["comet", "subdomain"], controller_template, [{template, "comet_subdomain.tpl"}]},
%% WebSocket connection.
- {websocket, ["websocket"], resource_websocket, [{ssl, any}, {no_session, true}]},
+ {websocket, ["websocket"], controller_websocket, [{ssl, any}, {no_session, true}]},
%% Postback of events from the browser to the server, dispatched from the postback resource.
- {postback, ["postback"], resource_postback, [{ssl, any}, {no_session, true}]},
+ {postback, ["postback"], controller_postback, [{ssl, any}, {no_session, true}]},
%% Used in Ajax file upload, fixes a problem in Safari. Just closes the connection.
- {close_connection, ["close-connection"], resource_close_connection, [{ssl, any}, {no_session, true}]},
+ {close_connection, ["close-connection"], controller_close_connection, [{ssl, any}, {no_session, true}]},
%% The id controller redirects depending on the accept header sent by the user agent.
- {id, ["id", id], resource_id, []},
+ {id, ["id", id], controller_id, []},
%% CSS and Javascript files from the "lib" module folder. Possibly more than one file combined in one request.
- {lib, ["lib",'*'], resource_lib, [ {use_cache, false}, {ssl, any} ]},
+ {lib, ["lib",'*'], controller_lib, [ {use_cache, false}, {ssl, any} ]},
%% Resized images, expects resize parameters and a checksum. Places resized images in the root folder.
%% The original images must be present in the media_path.
- {image, ["image",'*'], resource_file_readonly,
+ {image, ["image",'*'], controller_file_readonly,
[
{use_cache, false},
{is_media_preview, true},
{ssl, any}
]},
%% Download of an image, attached to a media rsc
- {media_attachment, ["media","attachment","id",id], resource_file_readonly,
+ {media_attachment, ["media","attachment","id",id], controller_file_readonly,
[
{path, id},
{use_cache, false},
{content_disposition, attachment}
]},
%% Download of an image, attached to a media rsc
- {media_inline, ["media","inline","id",id], resource_file_readonly,
+ {media_inline, ["media","inline","id",id], controller_file_readonly,
[
{path, id},
{use_cache, false},
{content_disposition, inline}
]},
%% Inline display of original uploaded files. Assumes the files are in the root folder.
- {media_inline, ["media","inline",'*'], resource_file_readonly,
+ {media_inline, ["media","inline",'*'], controller_file_readonly,
[
{use_cache, false},
{content_disposition, inline}
]},
%% Download of original uploaded files. Assumes the files are in the root folder.
- {media_attachment, ["media","attachment",'*'], resource_file_readonly,
+ {media_attachment, ["media","attachment",'*'], controller_file_readonly,
[
{use_cache, false},
{content_disposition, attachment}
]},
%% API access
- {api, ["api",module,method], resource_api, []},
- {api, ["api",module], resource_api, []},
+ {api, ["api",module,method], controller_api, []},
+ {api, ["api",module], controller_api, []},
%% Serves the favicon.ico from "lib/images/favicon.ico" in the modules.
- {favicon, ["favicon.ico"], resource_file_readonly,
+ {favicon, ["favicon.ico"], controller_file_readonly,
[
{path, "images/favicon.ico"},
{root,[lib]},
@@ -76,12 +76,12 @@
]},
%% User Agent handling
- {ua_probe, ["useragent","probe.js"], resource_user_agent_probe, []},
- {ua_select, ["useragent","select", ua_class], resource_user_agent_select, []},
- {ua_select, ["useragent","select"], resource_user_agent_select, []},
+ {ua_probe, ["useragent","probe.js"], controller_user_agent_probe, []},
+ {ua_select, ["useragent","select", ua_class], controller_user_agent_select, []},
+ {ua_select, ["useragent","select"], controller_user_agent_select, []},
%% robots.txt - simple allow all file
- {robots_txt, ["robots.txt"], resource_file_readonly,
+ {robots_txt, ["robots.txt"], controller_file_readonly,
[
{path, "misc/robots.txt"},
{root,[lib]},
View
2 modules/mod_base/scomps/scomp_base_draggable.erl
@@ -50,7 +50,7 @@ render(Params, _Vars, Context) ->
% Get properties...
Delegate1 = case Delegate of
- undefined -> z_context:get_resource_module(Context);
+ undefined -> z_context:get_controller_module(Context);
_ -> z_convert:to_atom(Delegate)
end,
PickledTag = z_utils:pickle({Tag,Delegate1,Id}, Context),
View
6 modules/mod_base/scomps/scomp_base_droppable.erl
@@ -44,7 +44,7 @@ render(Params, _Vars, Context) ->
{error, "droppable scomp, please give the id of the droppable"};
_ ->
Delegate1 = case Delegate of
- undefined -> z_context:get_resource_module(Context);
+ undefined -> z_context:get_controller_module(Context);
_ -> z_convert:to_atom(Delegate)
end,
@@ -69,11 +69,11 @@ event(#postback{message={DropTag,DropDelegate}, trigger=TriggerId}, Context) ->
Drag = #dragdrop{tag=DragTag, delegate=DragDelegate, id=DragId},
try
- Context1 = DropDelegate:event(#drop{drag=Drag, drop=Drop}, z_context:set_resource_module(DropDelegate, Context)),
+ Context1 = DropDelegate:event(#drop{drag=Drag, drop=Drop}, z_context:set_controller_module(DropDelegate, Context)),
% also notify the dragged element that it has been dragged
try
- DragDelegate:event(#drag{drag=Drag, drop=Drop}, z_context:set_resource_module(DragDelegate, Context1))
+ DragDelegate:event(#drag{drag=Drag, drop=Drop}, z_context:set_controller_module(DragDelegate, Context1))
catch
_M1:_E1 -> Context1
end
View
2 modules/mod_base/scomps/scomp_base_sortable.erl
@@ -38,7 +38,7 @@ render(Params, _Vars, Context) ->
% Get properties...
Delegate1 = case Delegate of
- undefined -> z_context:get_resource_module(Context);
+ undefined -> z_context:get_controller_module(Context);
_ -> z_convert:to_atom(Delegate)
end,
View
2 modules/mod_base/scomps/scomp_base_sorter.erl
@@ -50,7 +50,7 @@ render(Params, _Vars, Context) ->
_ ->
Delegate1 = case Delegate of
- undefined -> z_context:get_resource_module(Context);
+ undefined -> z_context:get_controller_module(Context);
_ -> z_convert:to_atom(Delegate)
end,
View
20 modules/mod_base_site/dispatch/dispatch
@@ -1,26 +1,26 @@
%% -*- mode: erlang -*-
[
%% The home page, just shows the "home.tpl" template.
- {home, [], resource_template, [ {template, "home.tpl"} ]},
+ {home, [], controller_template, [ {template, "home.tpl"} ]},
%% Normal page to show a resource.
- {page, ["page", id], resource_page, [ {template, {cat, "page.tpl"}} ]},
- {page, ["page", id, slug], resource_page, [ {template, {cat, "page.tpl"}} ]},
+ {page, ["page", id], controller_page, [ {template, {cat, "page.tpl"}} ]},
+ {page, ["page", id, slug], controller_page, [ {template, {cat, "page.tpl"}} ]},
%% Pages when part of a menu
- {page, ["page", id, "in-menu", in_menu], resource_page, [ {template, {cat, "page.tpl"}} ]},
- {page, ["page", id, "in-menu", in_menu, slug], resource_page, [ {template, {cat, "page.tpl"}} ]},
+ {page, ["page", id, "in-menu", in_menu], controller_page, [ {template, {cat, "page.tpl"}} ]},
+ {page, ["page", id, "in-menu", in_menu, slug], controller_page, [ {template, {cat, "page.tpl"}} ]},
%% Pages when part of a collection
- {page, ["page", id, "in-collection", in_collection], resource_page, [ {template, {cat, "page.tpl"}} ]},
- {page, ["page", id, "in-collection", in_collection, slug], resource_page, [ {template, {cat, "page.tpl"}} ]},
+ {page, ["page", id, "in-collection", in_collection], controller_page, [ {template, {cat, "page.tpl"}} ]},
+ {page, ["page", id, "in-collection", in_collection, slug], controller_page, [ {template, {cat, "page.tpl"}} ]},
%% Show the map of an item
- {map, ["map", id], resource_page, [ {template, {cat, "map.tpl"}} ]},
+ {map, ["map", id], controller_page, [ {template, {cat, "map.tpl"}} ]},
%% Redirect controller for resource of type 'website'
- {website, ["redirect", id, slug], resource_website_redirect, []},
+ {website, ["redirect", id, slug], controller_website_redirect, []},
%% Simple search page
- {search, ["search"], resource_template, [ {template, "search.tpl"} ]}
+ {search, ["search"], controller_template, [ {template, "search.tpl"} ]}
].
View
4 ...ent/resources/resource_admin_comments.erl → ...controllers/controller_admin_comments.erl
@@ -17,15 +17,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_comments).
+-module(controller_admin_comments).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_comment, ReqData, Context).
View
4 ...rces/resource_admin_comments_settings.erl → ...rs/controller_admin_comments_settings.erl
@@ -17,15 +17,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_comments_settings).
+-module(controller_admin_comments_settings).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_comment, ReqData, Context).
View
4 modules/mod_comment/dispatch/dispatch
@@ -1,5 +1,5 @@
%% -*- mode: erlang -*-
[
- {admin_comments, ["admin", "comments"], resource_admin_comments, []},
- {admin_comments_settings, ["admin", "comments", "settings"], resource_admin_comments_settings, []}
+ {admin_comments, ["admin", "comments"], controller_admin_comments, []},
+ {admin_comments_settings, ["admin", "comments", "settings"], controller_admin_comments_settings, []}
].
View
2 modules/mod_contact/dispatch/dispatch
@@ -1,4 +1,4 @@
%% -*- mode: erlang -*-
[
- {contact, ["contact"], resource_page, [{template, "contact.tpl"}, {id, page_contact}]}
+ {contact, ["contact"], controller_page, [{template, "contact.tpl"}, {id, page_contact}]}
].
View
4 ...evelopment/resources/resource_wmtrace.erl → ...opment/controllers/controller_wmtrace.erl
@@ -20,15 +20,15 @@
%% Resource
%%
--module(resource_wmtrace).
+-module(controller_wmtrace).
-export([
is_authorized/2,
resource_exists/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
-include_lib("webmachine_logger.hrl").
is_authorized(ReqData, Context) ->
View
22 ...pment/resources/resource_wmtrace_conf.erl → ...t/controllers/controller_wmtrace_conf.erl
@@ -1,7 +1,7 @@
%% @author Atilla Erdodi <atilla@maximonster.com>
%% @copyright 2010 Maximonster Interactive Things
%% Date: 2010-10-20
-%% @doc Resource to configure tracing of webmachine requests.
+%% @doc Controller to configure tracing of webmachine requests.
%% Copyright 2010 Maximonster Interactive Things
%%
@@ -20,15 +20,15 @@
%% Resource
%%
--module(resource_wmtrace_conf).
+-module(controller_wmtrace_conf).
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
-include_lib("webmachine_logger.hrl").
%% GLOBAL
@@ -94,17 +94,17 @@ event(#postback{message={delete, Args}}, Context) ->
html(Context) ->
- Resources_ = get_resources(Context),
+ Controllers_ = get_controllers(Context),
TraceConf_ = get_trace_conf(?WMTRACE_CONF_TBL, ets:first(?WMTRACE_CONF_TBL), []),
TraceConf = [Res || {Res, _Eagerness} <- TraceConf_],
- Resources = Resources_ -- TraceConf,
+ Controllers = Controllers_ -- TraceConf,
TraceGlobal = case ets:lookup(?WMTRACE_CONF_TBL, trace_global) of
[] -> "disabled";
[{trace_global, TrGl}] -> atom_to_list(TrGl)
end,
Vars = [{trace_global, TraceGlobal}, {trace_conf, TraceConf},
- {res, Resources}, {page_admin_wmtrace_conf, true}],
+ {res, Controllers}, {page_admin_wmtrace_conf, true}],
Html = z_template:render("wmtrace_conf.tpl", Vars, Context),
z_context:output(Html, Context).
@@ -118,13 +118,13 @@ get_trace_conf(Tbl, Key, Acc) ->
[Res] = ets:lookup(Tbl, Key),
get_trace_conf(Tbl, ets:next(Tbl, Key), [Res | Acc]).
-get_resources(Context) ->
+get_controllers(Context) ->
{_Host, _Hostname, _Streamhost, _Smtphost, _Hostaliases, _Redirect, SiteDispatch} = z_dispatcher:dispatchinfo(Context),
- Resources = lists:foldl(fun({_, _, Resource, _}, ResList) ->
- case lists:member(Resource, ResList) of
- false -> [Resource | ResList];
+ Controllers = lists:foldl(fun({_, _, Controller, _}, ResList) ->
+ case lists:member(Controller, ResList) of
+ false -> [Controller | ResList];
true -> ResList
end
end, [], SiteDispatch),
- lists:reverse(Resources).
+ lists:reverse(Controllers).
View
10 modules/mod_development/dispatch/development
@@ -1,11 +1,11 @@
%% -*- mode: erlang -*-
[
- {admin_development, ["admin", "development"], resource_admin, [{template, "admin_development.tpl"}, {selected, "development"}]},
+ {admin_development, ["admin", "development"], controller_admin, [{template, "admin_development.tpl"}, {selected, "development"}]},
- {admin_development_templates, ["admin", "development", "templates"], resource_admin, [{template, "admin_development_templates.tpl"}, {selected, "development"}]},
+ {admin_development_templates, ["admin", "development", "templates"], controller_admin, [{template, "admin_development_templates.tpl"}, {selected, "development"}]},
- {wmtrace_conf, ["wmtrace_conf"], resource_wmtrace_conf, []},
+ {wmtrace_conf, ["wmtrace_conf"], controller_wmtrace_conf, []},
- {wmtrace, ["wmtrace"], resource_wmtrace, []},
- {wmtrace, ["wmtrace", '*'], resource_wmtrace, []}
+ {wmtrace, ["wmtrace"], controller_wmtrace, []},
+ {wmtrace, ["wmtrace", '*'], controller_wmtrace, []}
].
View
4 ...ook/resources/resource_admin_facebook.erl → ...controllers/controller_admin_facebook.erl
@@ -17,15 +17,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_facebook).
+-module(controller_admin_facebook).
-author("Maas-Maarten Zeeman <mmzeeman@xs4all.nl>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_facebook, ReqData, Context).
View
4 ...resources/resource_facebook_authorize.erl → ...rollers/controller_facebook_authorize.erl
@@ -18,13 +18,13 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_facebook_authorize).
+-module(controller_facebook_authorize).
-author("Marc Worrell <marc@worrell.nl>").
-export([init/1, service_available/2, charsets_provided/2, content_types_provided/2]).
-export([resource_exists/2, previously_existed/2, moved_temporarily/2]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
4 .../resources/resource_facebook_redirect.erl → ...trollers/controller_facebook_redirect.erl
@@ -19,13 +19,13 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_facebook_redirect).
+-module(controller_facebook_redirect).
-author("Marc Worrell <marc@worrell.nl>").
-export([init/1, service_available/2, charsets_provided/2, content_types_provided/2]).
-export([resource_exists/2, previously_existed/2, moved_temporarily/2]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
6 modules/mod_facebook/dispatch/dispatch
@@ -1,6 +1,6 @@
%% -*- mode: erlang -*-
[
- {admin_facebook, ["admin", "facebook"], resource_admin_facebook, []},
- {facebook_authorize, ["facebook", "authorize"], resource_facebook_authorize, []},
- {facebook_redirect, ["facebook", "redirect"], resource_facebook_redirect, []}
+ {admin_facebook, ["admin", "facebook"], controller_admin_facebook, []},
+ {facebook_authorize, ["facebook", "authorize"], controller_facebook_authorize, []},
+ {facebook_redirect, ["facebook", "redirect"], controller_facebook_redirect, []}
].
View
4 modules/mod_logging/dispatch/dispatch
@@ -1,6 +1,6 @@
%% -*- mode: erlang -*-
%% Dispatch rule for a predicate list page
[
- {admin_log, ["admin", "log"], resource_admin, [{template, "admin_log.tpl"}, {selected, "log"}]},
- {admin_log_email, ["admin", "log", "email"], resource_admin, [{template, "admin_log_email.tpl"}, {selected, "log"}]}
+ {admin_log, ["admin", "log"], controller_admin, [{template, "admin_log.tpl"}, {selected, "log"}]},
+ {admin_log_email, ["admin", "log", "email"], controller_admin, [{template, "admin_log_email.tpl"}, {selected, "log"}]}
].
View
4 ...ources/resource_admin_mailing_preview.erl → ...lers/controller_admin_mailing_preview.erl
@@ -16,15 +16,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_mailing_preview).
+-module(controller_admin_mailing_preview).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
-export([
resource_exists/2,
is_authorized/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
%% @todo Change this into "visible" and add a view instead of edit template.
is_authorized(ReqData, Context) ->
View
4 ...sources/resource_admin_mailing_status.erl → ...llers/controller_admin_mailing_status.erl
@@ -16,15 +16,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_mailing_status).
+-module(controller_admin_mailing_status).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
-export([
resource_exists/2,
is_authorized/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
%% @todo Change this into "visible" and add a view instead of edit template.
is_authorized(ReqData, Context) ->
View
4 .../resources/resource_admin_mailinglist.erl → ...trollers/controller_admin_mailinglist.erl
@@ -16,15 +16,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_mailinglist).
+-module(controller_admin_mailinglist).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_mailinglist, ReqData, Context).
View
4 ...resource_admin_mailinglist_recipients.erl → ...ntroller_admin_mailinglist_recipients.erl
@@ -16,15 +16,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_admin_mailinglist_recipients).
+-module(controller_admin_mailinglist_recipients).
-author("Marc Worrell <marc@worrell.nl>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
z_acl:wm_is_authorized(use, mod_mailinglist, ReqData, Context).
View
4 ...resources/resource_mailinglist_export.erl → ...rollers/controller_mailinglist_export.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_mailinglist_export).
+-module(controller_mailinglist_export).
-author("Marc Worrell <marc@worrell.nl>").
-export([
@@ -31,7 +31,7 @@
to_text_csv/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("include/zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
18 modules/mod_mailinglist/dispatch/dispatch_mailinglist
@@ -1,18 +1,18 @@
%% -*- mode: erlang -*-
[
- {admin_mailinglist, ["admin", "mailinglists"], resource_admin_mailinglist, []},
+ {admin_mailinglist, ["admin", "mailinglists"], controller_admin_mailinglist, []},
- {admin_mailing_preview, ["admin", "mailing", "preview", id], resource_admin_mailing_preview, []},
- {admin_mailing_status, ["admin", "mailing", id], resource_admin_mailing_status, []},
+ {admin_mailing_preview, ["admin", "mailing", "preview", id], controller_admin_mailing_preview, []},
+ {admin_mailing_status, ["admin", "mailing", id], controller_admin_mailing_status, []},
- {admin_mailinglist_recipients, ["admin", "mailinglists", "recipients", id ], resource_admin_mailinglist_recipients, []},
+ {admin_mailinglist_recipients, ["admin", "mailinglists", "recipients", id ], controller_admin_mailinglist_recipients, []},
- {mailinglist_confirm, ["mailinglist", "confirm", confirm_key], resource_template, [{template, "mailinglist_confirm.tpl"}]},
- {mailinglist_unsubscribe, ["mailinglist", "unsubscribe", confirm_key], resource_template, [{template, "mailinglist_unsubscribe.tpl"}]},
+ {mailinglist_confirm, ["mailinglist", "confirm", confirm_key], controller_template, [{template, "mailinglist_confirm.tpl"}]},
+ {mailinglist_unsubscribe, ["mailinglist", "unsubscribe", confirm_key], controller_template, [{template, "mailinglist_unsubscribe.tpl"}]},
- {mailinglist_export, ["mailinglist", "export", id], resource_mailinglist_export, []},
+ {mailinglist_export, ["mailinglist", "export", id], controller_mailinglist_export, []},
%% Normal page to show a resource.
- {mailinglist, ["mailinglist", id], resource_page, [ {template, {cat, "mailinglist.tpl"}} ]},
- {mailinglist, ["mailinglist", id, slug], resource_page, [ {template, {cat, "mailinglist.tpl"}} ]}
+ {mailinglist, ["mailinglist", id], controller_page, [ {template, {cat, "mailinglist.tpl"}} ]},
+ {mailinglist, ["mailinglist", id, slug], controller_page, [ {template, {cat, "mailinglist.tpl"}} ]}
].
View
4 ...resources/resource_oauth_access_token.erl → ...rollers/controller_oauth_access_token.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_oauth_access_token).
+-module(controller_oauth_access_token).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
@@ -30,7 +30,7 @@
response/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
View
4 ...d_oauth/resources/resource_oauth_apps.erl → ...uth/controllers/controller_oauth_apps.erl
@@ -17,15 +17,15 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_oauth_apps).
+-module(controller_oauth_apps).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
-export([
is_authorized/2,
event/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
is_authorized(ReqData, Context) ->
View
4 ...th/resources/resource_oauth_authorize.erl → ...ontrollers/controller_oauth_authorize.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_oauth_authorize).
+-module(controller_oauth_authorize).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
-export([
@@ -27,7 +27,7 @@
process_post/2
]).
--include_lib("resource_html.hrl").
+-include_lib("html_controller.hrl").
allowed_methods(ReqData, Context) ->
View
4 ...esources/resource_oauth_request_token.erl → ...ollers/controller_oauth_request_token.erl
@@ -17,7 +17,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_oauth_request_token).
+-module(controller_oauth_request_token).
-author("Arjan Scherpenisse <arjan@scherpenisse.net>").
@@ -30,7 +30,7 @@
process_post/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
View
10 modules/mod_oauth/dispatch/dispatch
@@ -1,11 +1,11 @@
%% -*- mode: erlang -*-
%% Dispatch rules for OAuth
[
- {oauth_request_token, ["oauth", "request_token"], resource_oauth_request_token, []},
- {oauth_access_token, ["oauth", "access_token"], resource_oauth_access_token, []},
+ {oauth_request_token, ["oauth", "request_token"], controller_oauth_request_token, []},
+ {oauth_access_token, ["oauth", "access_token"], controller_oauth_access_token, []},
- {oauth_authorize, ["oauth", "authorize"], resource_oauth_authorize, []},
- {oauth_finish, ["oauth", "authorize", "finished"], resource_template, [ {template, "oauth_authorize_finished.tpl"} ]},
+ {oauth_authorize, ["oauth", "authorize"], controller_oauth_authorize, []},
+ {oauth_finish, ["oauth", "authorize", "finished"], controller_template, [ {template, "oauth_authorize_finished.tpl"} ]},
- {admin_oauth, ["admin", "oauth", "apps"], resource_oauth_apps, []}
+ {admin_oauth, ["admin", "oauth", "apps"], controller_oauth_apps, []}
].
View
4 .../mod_rest/resources/resource_rest_rsc.erl → ..._rest/controllers/controller_rest_rsc.erl
@@ -16,7 +16,7 @@
%% See the License for the specific language governing permissions and
%% limitations under the License.
--module(resource_rest_rsc).
+-module(controller_rest_rsc).
-author("Marc Worrell <marc@worrell.nl>").
@@ -36,7 +36,7 @@
get_bert/2
]).
--include_lib("webmachine_resource.hrl").
+-include_lib("webmachine_controller.hrl").
-include_lib("zotonic.hrl").
init(DispatchArgs) -> {ok, DispatchArgs}.
View
4 modules/mod_rest/dispatch/dispatch_rest
@@ -1,4 +1,4 @@
[ <