Permalink
Browse files

New module: about

  • Loading branch information...
floridave committed May 10, 2011
1 parent 126658b commit f0a49860c0ec4899cf69d44d91a73155b3637a05
@@ -0,0 +1,28 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+* Gallery - a web based photo album viewer and editor
+* Copyright (C) 2000-2009 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 About_Controller extends Controller {
+ public function index() {
+ $template = new Theme_View("page.html", "other", "About");
+ $template->css("about.css");
+ $template->page_title = t("Gallery :: About");
+ $template->content = new View("about.html");
+ print $template;
+ }
+}
@@ -0,0 +1,61 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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_About_Controller extends Admin_Controller {
+ public function index() {
+ print $this->_get_view();
+ }
+
+ public function handler() {
+ access::verify_csrf();
+
+ $form = $this->_get_form();
+ if ($form->validate()) {
+ module::set_var(
+ "about", "code", $form->about->about_code->value);
+ module::set_var(
+ "about", "title", $form->about->about_title->value);
+ module::set_var (
+ "about", "hidden", $form->about->about_hidden->value);
+ message::success(t("Your settings have been saved."));
+ url::redirect("admin/about");
+ }
+
+ print $this->_get_view($form);
+ }
+
+ private function _get_view($form=null) {
+ $v = new Admin_View("admin.html");
+ $v->content = new View("admin_about.html");
+ $v->content->form = empty($form) ? $this->_get_form() : $form;
+ return $v;
+ }
+
+ private function _get_form() {
+ $form = new Forge("admin/about/handler", "", "post", array("id" => "g-admin-form"));
+ $group = $form->group("about");
+ $group->input("about_title")->label(t('Enter the headline.'))->value(module::get_var("about", "title"));
+ $group->textarea("about_code")->label(t('Enter the standard HTML code you want on the page.'))->value(module::get_var("about", "code"));
+ $group->checkbox("about_hidden")->label(t("Hide link"))
+ ->checked(module::get_var("about", "hidden", false) == 1);
+ $group->submit("submit")->value(t("Save"));
+
+ return $form;
+ }
+}
@@ -0,0 +1,2 @@
+table.about { text-align: center; width:500px; }
+table.about caption { font-size: 1.5em; padding: 0.2em; }
@@ -0,0 +1,39 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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 about_block_Core {
+ static function get_site_list() {
+ return array("about" => t("About page"));
+ }
+
+ static function get($block_id, $theme) {
+ $block = "";
+ switch ($block_id) {
+ case "about":
+ if ($theme->item()) {
+ $block = new Block();
+ $block->css_id = "g-metadata";
+ $block->title = module::get_var("about", "title");
+ $block->content = new View("about_block.html");
+ }
+ break;
+ }
+ return $block;
+ }
+}
@@ -0,0 +1,37 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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 about_event_Core {
+ static function admin_menu($menu, $theme) {
+ $menu->get("settings_menu")
+ ->append(Menu::factory("link")
+ ->id("about_menu")
+ ->label(t("About page"))
+ ->url(url::site("admin/about")));
+ }
+
+ static function site_menu($menu, $theme) {
+ if (module::get_var("about", "hidden") != true) {
+ $menu->add_after("home", Menu::factory("link")
+ ->id("about")
+ ->label(t("About"))
+ ->url(url::site("about/")));
+ }
+ }
+}
@@ -0,0 +1,26 @@
+<?php defined("SYSPATH") or die("No direct script access.");
+/**
+ * Gallery - a web based photo album viewer and editor
+ * Copyright (C) 2000-2009 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 about_installer {
+ static function deactivate() {
+ module::clear_var("about", "title");
+ module::clear_var("about", "code");
+ module::clear_var("about", "hidden");
+ }
+}
@@ -0,0 +1,6 @@
+name = "About"
+description = "About page and detail."
+author_name = "floridave"
+author_url = "http://codex.gallery2.org/User:Floridave"
+info_url = "http://codex.gallery2.org/Gallery3:Modules:about"
+discuss_url = "http://gallery.menalto.com/forum_module_about"
@@ -0,0 +1,3 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<h1><?= module::get_var("about", "title"); ?></h1>
+<?= module::get_var("about", "code"); ?>
@@ -0,0 +1,2 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<?= module::get_var("about", "code"); ?>
@@ -0,0 +1,5 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<div id="g-admin-code-block">
+ <h2><?= t("About Page Administration") ?></h2>
+ <?= $form ?>
+</div>

0 comments on commit f0a4986

Please sign in to comment.