Skip to content

Commit

Permalink
Additional more resource_ -> controller_ fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Arjan Scherpenisse committed Sep 18, 2012
1 parent b75c0b3 commit 5cd6a26
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 21 deletions.
4 changes: 2 additions & 2 deletions include/html_controller.hrl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
%% @author Marc Worrell <marc@worrell.nl>
%% @copyright 2009 Marc Worrell
%% @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:
%% Make a new controller (controller_plop.erl) by:
%%
%% -module(resource_plop).
%% -module(controller_plop).
%% -author("Your Name <me@example.com>").
%% -include_lib("html_controller.hrl").
%%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ event(#submit{message={rsc_edit_basics, Args}}, Context) ->
Actions = proplists:get_value(actions, Args, []),

Post = z_context:get_q_all_noz(Context),
Props = resource_admin_edit:filter_props(Post),
Props = controller_admin_edit:filter_props(Post),
Props1 = proplists:delete("id", Props),

case m_rsc:update(Id, Props1, Context) of
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ provide_content(ReqData, Context) ->

% @doc Logoff and reset the rememberme cookie.
reset_rememberme_cookie_and_logoff(Context) ->
ContextNoCookie = resource_logon:reset_rememberme_cookie(Context),
ContextNoCookie = controller_logon:reset_rememberme_cookie(Context),
ContextLogOff = z_auth:logoff(ContextNoCookie),
{ok, ContextNoSession} = z_session_manager:stop_session(ContextLogOff),
ContextNoSession.
4 changes: 2 additions & 2 deletions modules/mod_backup/mod_backup.erl
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ observe_rsc_update(_, Acc, _Context) ->
Acc.


%% @doc Callback for resource_file_readonly. Check if the file exists.
%% @doc Callback for controller_file_readonly. Check if the file exists.
file_exists(File, Context) ->
PathFile = filename:join([dir(Context), File]),
case filelib:is_regular(PathFile) of
Expand All @@ -86,7 +86,7 @@ file_exists(File, Context) ->
end.


%% @doc Callback for resource_file_readonly. Check if access is allowed.
%% @doc Callback for controller_file_readonly. Check if access is allowed.
file_forbidden(_File, Context) ->
not z_acl:is_allowed(use, mod_admin_backup, Context).

Expand Down
2 changes: 1 addition & 1 deletion modules/mod_base/controllers/controller_template.erl
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ is_authorized(ReqData, Context) ->
Context2 = z_context:ensure_all(Context1),
case z_auth:is_auth(Context2) of
true ->
Context3 = resource_logoff:reset_rememberme_cookie_and_logoff(Context2),
Context3 = controller_logoff:reset_rememberme_cookie_and_logoff(Context2),
?WM_REPLY(true, Context3);
false ->
?WM_REPLY(true, Context2)
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_base/controllers/controller_websocket.erl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ handle_message(Msg, Context) ->
{ResultScript, ResultContext} = try
% Enable caching lookup values, essential for fast data handling
z_depcache:in_process(true),
resource_postback:process_postback(Context1)
controller_postback:process_postback(Context1)
catch
Error:X ->
?zWarning(io_lib:format("~p:~p~n~p", [Error, X, erlang:get_stacktrace()]), Context1),
Expand Down
6 changes: 3 additions & 3 deletions modules/mod_base/mod_base.erl
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ observe_scomp_script_render(#scomp_script_render{is_nostartup=false}, Context) -
observe_scomp_script_render(#scomp_script_render{is_nostartup=true}, _Context) ->
[].

%% @doc Check if there is a resource or template matching the path.
%% @doc Check if there is a controller or template matching the path.
observe_dispatch(#dispatch{path=Path}, Context) ->
case m_rsc:page_path_to_id(Path, Context) of
{ok, Id} ->
Expand All @@ -92,7 +92,7 @@ observe_dispatch(#dispatch{path=Path}, Context) ->
case z_module_indexer:find(template, Template, Context) of
{ok, _} ->
{ok, #dispatch_match{
mod=resource_template,
mod=controller_template,
mod_opts=[{template, Template}, {ssl, any}],
bindings=[{path, Path}, {is_static, true}]
}};
Expand All @@ -108,7 +108,7 @@ observe_dispatch(#dispatch{path=Path}, Context) ->
case z_module_indexer:find(template, Template1, Context) of
{ok, _} ->
{ok, #dispatch_match{
mod=resource_template,
mod=controller_template,
mod_opts=[{template, Template1}, {ssl, any}],
bindings=[{path, Path}, {is_static, true}]
}};
Expand Down
4 changes: 2 additions & 2 deletions modules/mod_base/support/z_websocket_hixie75.erl
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,14 @@ handle_data(<<>>, nolength, <<255,_T/binary>>, _Socket, _Context) ->
% A packet of <<0,255>> signifies that the ua wants to close the connection
ua_close_request;
handle_data(Msg, nolength, <<255,T/binary>>, Socket, Context) ->
resource_websocket:handle_message(Msg, Context),
controller_websocket:handle_message(Msg, Context),
handle_data(none, nolength, T, Socket, Context);
handle_data(Msg, nolength, <<H,T/binary>>, Socket, Context) ->
handle_data(<<Msg/binary, H>>, nolength, T, Socket, Context);

%% Extract frame with length bytes
handle_data(Msg, 0, T, Socket, Context) ->
resource_websocket:handle_message(Msg, Context),
controller_websocket:handle_message(Msg, Context),
handle_data(none, nolength, T, Socket, Context);
handle_data(Msg, Length, <<H,T/binary>>, Socket, Context) when is_integer(Length) and Length > 0 ->
handle_data(<<Msg/binary, H>>, Length-1, T, Socket, Context);
Expand Down
4 changes: 2 additions & 2 deletions modules/mod_base/support/z_websocket_hybi17.erl
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,11 @@ unmask_data(Opcode, <<O:8>>, MaskKey, RemainingData, Socket, Context, Acc) ->

% Text frame
handle_frame(RemainingData, 1, Message, Socket, Context) ->
resource_websocket:handle_message(Message, Context),
controller_websocket:handle_message(Message, Context),
handle_data(RemainingData, Socket, Context);
% Binary frame
handle_frame(RemainingData, 2, Message, Socket, Context) ->
resource_websocket:handle_message(Message, Context),
controller_websocket:handle_message(Message, Context),
handle_data(RemainingData, Socket, Context);
% Close control frame
handle_frame(_RemainingData, 8, _Message, Socket, Context) ->
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_geomap/services/service_geomap_locations.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ add_locations([Id|Ids], Acc, Context) ->


get_ids(Context) ->
QueryArgs = resource_api:get_q_all(Context),
QueryArgs = controller_api:get_q_all(Context),
case QueryArgs of
[{"id", RscId}] ->
get_from_id(RscId, Context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@

%% @todo Change this into "visible" and add a view instead of edit template.
is_authorized(ReqData, Context) ->
{Context2, Id} = resource_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
{Context2, Id} = controller_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
z_acl:wm_is_authorized([{use, mod_mailinglist}, {view, Id}], Context2).


resource_exists(ReqData, Context) ->
{Context2, Id} = resource_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
{Context2, Id} = controller_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
case Id of
undefined -> ?WM_REPLY(false, Context2);
_N -> ?WM_REPLY(m_rsc:exists(Id, Context2), Context2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@

%% @todo Change this into "visible" and add a view instead of edit template.
is_authorized(ReqData, Context) ->
{Context2, Id} = resource_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
{Context2, Id} = controller_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
z_acl:wm_is_authorized([{use, mod_mailinglist}, {view, Id}], Context2).


resource_exists(ReqData, Context) ->
{Context2, Id} = resource_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
{Context2, Id} = controller_admin_edit:ensure_id(?WM_REQ(ReqData, Context)),
case Id of
undefined -> ?WM_REPLY(false, Context2);
_N -> ?WM_REPLY(m_rsc:exists(Id, Context2), Context2)
Expand Down
2 changes: 1 addition & 1 deletion modules/mod_search/services/service_search_search.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
-include_lib("zotonic.hrl").

process_get(_ReqData, Context) ->
Q1 = resource_api:get_q_all(Context),
Q1 = controller_api:get_q_all(Context),
try
Q = search_query:parse_request_args(Q1),
S = z_search:search({'query', Q}, Context),
Expand Down

0 comments on commit 5cd6a26

Please sign in to comment.