/modules/mod_admin/resources/resource_admin.erl

https://code.google.com/p/zotonic/ · Erlang · 36 lines · 13 code · 7 blank · 16 comment · 0 complexity · ef5855a9c8dafd01de578863bd27c784 MD5 · raw file

  1. %% @author Tim Benniks <tim@timbenniks.com>
  2. %% @copyright 2009 Tim Benniks.
  3. %% @doc Admin webmachine_resource.
  4. %% Copyright 2009 Tim Benniks
  5. %%
  6. %% Licensed under the Apache License, Version 2.0 (the "License");
  7. %% you may not use this file except in compliance with the License.
  8. %% You may obtain a copy of the License at
  9. %%
  10. %% http://www.apache.org/licenses/LICENSE-2.0
  11. %%
  12. %% Unless required by applicable law or agreed to in writing, software
  13. %% distributed under the License is distributed on an "AS IS" BASIS,
  14. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. %% See the License for the specific language governing permissions and
  16. %% limitations under the License.
  17. -module(resource_admin).
  18. -author("Tim Benniks <tim@timbenniks.com>").
  19. -export([
  20. is_authorized/2
  21. ]).
  22. -include_lib("resource_html.hrl").
  23. is_authorized(ReqData, Context) ->
  24. z_acl:wm_is_authorized(use, z_context:get(acl_module, Context, mod_admin), ReqData, Context).
  25. html(Context) ->
  26. Template = z_context:get(template, Context, "admin.tpl"),
  27. Selected = z_context:get(selected, Context, "dashboard"),
  28. Html = z_template:render(Template, [{selected, Selected}], Context),
  29. z_context:output(Html, Context).