diff options
author | Felix Rabinovich <virshu@users.sourceforge.net> | 2009-01-01 18:56:06 +0000 |
---|---|---|
committer | Felix Rabinovich <virshu@users.sourceforge.net> | 2009-01-01 18:56:06 +0000 |
commit | 50dceb50159c407629274352143f539d252bae6f (patch) | |
tree | 0f98c9effe89701ccd8d4880f1a92a3fc77761d1 /core | |
parent | 540e4ed9eb6df5955a58ea9946049a84efa67e33 (diff) |
Theme Administration implementation
Diffstat (limited to 'core')
-rw-r--r-- | core/controllers/admin_themes.php | 41 | ||||
-rw-r--r-- | core/helpers/core_menu.php | 2 | ||||
-rw-r--r-- | core/views/admin_themes.html.php | 13 |
3 files changed, 55 insertions, 1 deletions
diff --git a/core/controllers/admin_themes.php b/core/controllers/admin_themes.php new file mode 100644 index 00000000..5c9a2ad1 --- /dev/null +++ b/core/controllers/admin_themes.php @@ -0,0 +1,41 @@ +<?php defined("SYSPATH") or die("No direct script access."); +/** + * Gallery - a web based photo album viewer and editor + * Copyright (C) 2000-2008 Bharat Mediratta + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or (at + * your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. + */ +class Admin_Themes_Controller extends Admin_Controller { + public function index() { + $view = new Admin_View("admin.html"); + $view->content = new View("admin_themes.html"); + $themes = scandir(THEMEPATH); + $view->content->themes = array_diff($themes, array(".", "..", ".svn")); + $view->content->active = module::get_var("core", "active_theme"); + print $view; + } + + public function save() { + access::verify_csrf(); + $theme = $this->input->post("theme"); + if ($theme != module::get_var("core", "active_theme")) { + module::set_var("core", "active_theme", $theme); + message::success(_("Updated Theme")); + log::success("graphics", sprintf(_("Changed theme to %s"), $theme)); + } + url::redirect("admin/themes"); + } +} + diff --git a/core/helpers/core_menu.php b/core/helpers/core_menu.php index 9bf6de3f..c863400f 100644 --- a/core/helpers/core_menu.php +++ b/core/helpers/core_menu.php @@ -97,7 +97,7 @@ class core_menu_Core { ->append(Menu::factory("link") ->id("themes") ->label(_("Themes")) - ->url("#")) + ->url(url::site("admin/themes"))) ->append(Menu::factory("link") ->id("image_sizes") ->label(_("Image Sizes")) diff --git a/core/views/admin_themes.html.php b/core/views/admin_themes.html.php new file mode 100644 index 00000000..b1fefd1e --- /dev/null +++ b/core/views/admin_themes.html.php @@ -0,0 +1,13 @@ +<? defined("SYSPATH") or die("No direct script access.") ?> +<div id="gThemes"> + <h1><?= _("Theme Administration") ?></h2> + <p><?= _("These are the themes in your system") ?></p> + <form method="post" action="<?= url::site("admin/themes/save") ?>"> + <?= access::csrf_form_field() ?> + <? foreach ($themes as $theme): ?> + <input type="radio" name="theme" value="<?= $theme ?>" + <? if ($theme == $active): ?> checked="checked" <? endif ?> /><?= $theme ?> + <? endforeach ?> + <input type="submit" value="<?= _("Save") ?>"/> + </form> +</div> |