From 6ac6c6a7e0824d8fda81e36240818f9b7e9c4696 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 15 Mar 2009 19:27:30 +0000 Subject: Updates to the developer tool create module. It now creates a fully functional sidebar block, a dialog pop up on the option menu for albums or photos, a dashboard block and an admin screen. --- modules/developer/views/admin_controller.txt.php | 21 ++++---- modules/developer/views/admin_html.txt.php | 2 +- modules/developer/views/block.txt.php | 12 +++++ modules/developer/views/block_html.txt.php | 10 ++++ modules/developer/views/controller.txt.php | 53 ++++++++++++++++++ modules/developer/views/helpers.txt.php | 26 --------- modules/developer/views/menu.txt.php | 9 ++++ modules/developer/views/theme.txt.php | 69 +++++++++++++----------- 8 files changed, 131 insertions(+), 71 deletions(-) create mode 100644 modules/developer/views/block_html.txt.php create mode 100644 modules/developer/views/controller.txt.php delete mode 100644 modules/developer/views/helpers.txt.php (limited to 'modules/developer/views') diff --git a/modules/developer/views/admin_controller.txt.php b/modules/developer/views/admin_controller.txt.php index 42b5ff38..7f741378 100644 --- a/modules/developer/views/admin_controller.txt.php +++ b/modules/developer/views/admin_controller.txt.php @@ -20,17 +20,13 @@ */ class Admin__Controller extends Admin_Controller { public function index() { - $view = new Admin_View("admin.html"); - $view->content = new View("admin_.html"); - $view->content->form = $this->_get_admin_form(); - - print $view; + print $this->_get_view(); } public function handler() { access::verify_csrf(); - $form = $this->_get_admin_form(); + $form = $this->_get_form(); if ($form->validate()) { // @todo process the admin form @@ -38,17 +34,18 @@ class Admin__Controller extends Admin_Controller { url::redirect("admin/"); } - $view = new Admin_View("admin.html"); - $view->content = new View("admin_.html"); - $view->content->form = $form; - print $view; + print $this->_get_view($form); } - private function _get_admin_view($form=null) { + private function _get_view($form=null) { + $v = new Admin_View("admin.html"); + $v->content = new View("admin_.html"); + $v->content->form = empty($form) ? $this->_get_form() : $form; + return $v; } - private function _get_admin_form() { + private function _get_form() { $form = new Forge("admin//handler", "", "post", array("id" => "gAdminForm")); $group = $form->group("group"); diff --git a/modules/developer/views/admin_html.txt.php b/modules/developer/views/admin_html.txt.php index 34b699d7..5408cdab 100644 --- a/modules/developer/views/admin_html.txt.php +++ b/modules/developer/views/admin_html.txt.php @@ -1,7 +1,7 @@ " ?> -
+

" ?>

diff --git a/modules/developer/views/block.txt.php b/modules/developer/views/block.txt.php index b8a96da0..56c0bf8c 100644 --- a/modules/developer/views/block.txt.php +++ b/modules/developer/views/block.txt.php @@ -20,7 +20,19 @@ */ class _block { static function get($block_id) { + $block = new Block(); + if ($block_id == "") { + $block->css_id = "gAdmin"; + $block->title = t(" Dashboard Block"); + $block->content = new View("block.html"); + + $block->content->item = ORM::factory("item", 1); + } + return $block; } + static function get_list() { + return array( + "" => t(" Dashboard Block")); } } diff --git a/modules/developer/views/block_html.txt.php b/modules/developer/views/block_html.txt.php new file mode 100644 index 00000000..b0e07a1a --- /dev/null +++ b/modules/developer/views/block_html.txt.php @@ -0,0 +1,10 @@ + +" ?> + +
+ url() ?>\">" ?> + + thumb_tag(array(\"class\" => \"gThumbnail\")) ?>" ?> + + +
diff --git a/modules/developer/views/controller.txt.php b/modules/developer/views/controller.txt.php new file mode 100644 index 00000000..b11fa5f3 --- /dev/null +++ b/modules/developer/views/controller.txt.php @@ -0,0 +1,53 @@ + + +/** + * 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 _Controller extends Controller { + public function index() { + print $this->_get_form(); + } + + public function handler() { + access::verify_csrf(); + + $form = $this->_get_form(); + if ($form->validate()) { + // @todo process the admin form + + message::success(t(" Processing Successfully")); + + print json_encode( + array("result" => "success")); + } else { + print json_encode( + array("result" => "error", + "form" => $form->__toString())); + } + } + + private function _get_form() { + $form = new Forge("/handler", "", "post", + array("id" => "gForm")); + $group = $form->group("group")->label(t(" Handler")); + $group->input("text")->label(t("Text"))->rules("required"); + $group->submit("submit")->value(t("Submit")); + + return $form; + } +} \ No newline at end of file diff --git a/modules/developer/views/helpers.txt.php b/modules/developer/views/helpers.txt.php deleted file mode 100644 index 648015d0..00000000 --- a/modules/developer/views/helpers.txt.php +++ /dev/null @@ -1,26 +0,0 @@ - - -/** - * 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 _ { - $args): ?> - static function () { - } - -} diff --git a/modules/developer/views/menu.txt.php b/modules/developer/views/menu.txt.php index 5404f6c5..dd315972 100644 --- a/modules/developer/views/menu.txt.php +++ b/modules/developer/views/menu.txt.php @@ -38,5 +38,14 @@ class _menu { static function site($menu, $theme) { + $item = $theme->item(); + + if ($item && access::can("edit", $item)) { + $options_menu = $menu->get("options_menu") + ->append(Menu::factory("dialog") + ->id("") + ->label(t("Peform Processing")) + ->url(url::site("/index/$item->id"))); + } } } diff --git a/modules/developer/views/theme.txt.php b/modules/developer/views/theme.txt.php index df7b18e0..339a7553 100644 --- a/modules/developer/views/theme.txt.php +++ b/modules/developer/views/theme.txt.php @@ -19,144 +19,149 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class _theme { + static function sidebar_blocks($theme) { + $block = new Block(); + $block->css_id = "g"; + $block->title = t(""); + $block->content = new View("_block.html"); + $block->content->item = ORM::factory("item", 1); + + return $block; + } + - static function album_blocks() { + static function album_blocks($theme) { } - static function album_bottom() { + static function album_bottom($theme) { } - static function album_top() { + static function album_top($theme) { } - static function admin_credits() { + static function admin_credits($theme) { } - static function admin_footer() { + static function admin_footer($theme) { } - static function admin_header_top() { + static function admin_header_top($theme) { } - static function admin_header_bottom() { + static function admin_header_bottom($theme) { } - static function admin_page_bottom() { + static function admin_page_bottom($theme) { } - static function admin_page_top() { + static function admin_page_top($theme) { } - static function admin_head() { + static function admin_head($theme) { } - static function credits() { + static function credits($theme) { } - static function dynamic_bottom() { + static function dynamic_bottom($theme) { } - static function dynamic_top() { + static function dynamic_top($theme) { } - static function footer() { + static function footer($theme) { } - static function head() { + static function head($theme) { } - static function header_bottom() { + static function header_bottom($theme) { } - static function header_top() { + static function header_top($theme) { } - static function page_bottom() { + static function page_bottom($theme) { } - static function page_top() { + static function page_top($theme) { } - static function photo_blocks() { + static function photo_blocks($theme) { } - static function photo_bottom() { + static function photo_bottom($theme) { } - static function photo_top() { - } - - - - static function sidebar_blocks() { + static function photo_top($theme) { } - static function sidebar_bottom() { + static function sidebar_bottom($theme) { } - static function sidebar_top() { + static function sidebar_top($theme) { } - static function thumb_bottom($child) { + static function thumb_bottom($theme, $child) { } - static function thumb_info($child) { + static function thumb_info($theme, $child) { } - static function thumb_top($child) { + static function thumb_top($theme, $child) { } -- cgit v1.2.3