/modules/mod_backup/resources/resource_admin_backup.erl

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

  1. %% @author Marc Worrell <marc@worrell.nl>
  2. %% @copyright 2010 Marc Worrell
  3. %% @doc Overview of all backups.
  4. %% Copyright 2010 Marc Worrell
  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_backup).
  18. -author("Marc Worrell <marc@worrell.nl>").
  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, mod_backup, ReqData, Context).
  25. html(Context) ->
  26. Vars = [
  27. {page_admin_backup, true},
  28. {backups, mod_backup:list_backups(Context)},
  29. {backup_in_progress, mod_backup:backup_in_progress(Context)}
  30. ],
  31. Html = z_template:render("admin_backup.tpl", Vars, Context),
  32. z_context:output(Html, Context).