diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-21 08:52:26 -0700 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2009-06-21 08:52:26 -0700 |
commit | 39cf3c2b046b03691937e112268403130508da63 (patch) | |
tree | f53a072417cc52a39cad9e96b8bf6207ba6bcded | |
parent | 1fa05d2f39604febda698743d78ff0c36cd25f5f (diff) |
The start of the digibug printing module. The first cut at the administration
panels. <Caution:> This is still a work in progress.
-rw-r--r-- | modules/digibug/controllers/admin_digibug.php | 73 | ||||
-rw-r--r-- | modules/digibug/controllers/digibug.php | 51 | ||||
-rw-r--r-- | modules/digibug/css/digibug.css | 88 | ||||
-rw-r--r-- | modules/digibug/css/logo.png | bin | 0 -> 17296 bytes | |||
-rw-r--r-- | modules/digibug/helpers/digibug_installer.php | 43 | ||||
-rw-r--r-- | modules/digibug/helpers/digibug_menu.php | 42 | ||||
-rw-r--r-- | modules/digibug/helpers/digibug_theme.php | 25 | ||||
-rw-r--r-- | modules/digibug/module.info | 3 | ||||
-rw-r--r-- | modules/digibug/views/admin_digibug.html.php | 70 |
9 files changed, 395 insertions, 0 deletions
diff --git a/modules/digibug/controllers/admin_digibug.php b/modules/digibug/controllers/admin_digibug.php new file mode 100644 index 00000000..86338f6b --- /dev/null +++ b/modules/digibug/controllers/admin_digibug.php @@ -0,0 +1,73 @@ +<?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_Digibug_Controller extends Admin_Controller { + public function index() { + print $this->_get_view(); + } + + public function basic() { + access::verify_csrf(); + + module::set_var("digibug", "mode", "basic"); + message::success(t("Successfully set Digibug mode to basic")); + + url::redirect("admin/digibug"); + } + + public function advanced() { + access::verify_csrf(); + + $form = $this->_get_form(); + if ($form->validate()) { + module::set_var("digibug", "company_id", $form->group->company_id->value); + module::set_var("digibug", "event_id", $form->group->event_id->value); + module::set_var("digibug", "mode", "advanced"); + message::success(t("Successfully set Digibug mode to advanced")); + + url::redirect("admin/digibug"); + } + + print $this->_get_view($form); + } + + private function _get_view($form=null) { + $v = new Admin_View("admin.html"); + $v->content = new View("admin_digibug.html"); + $v->content->mode = module::get_var("digibug", "mode", "basic"); + $v->content->form = empty($form) ? $this->_get_form() : $form; + return $v; + } + + private function _get_form() { + $form = new Forge("admin/digibug/advanced", "", "post", + array("id" => "gAdminForm")); + $group = $form->group("group"); + $group->input("company_id") + ->label(t("Company Id")) + ->rules("required") + ->value(module::get_var("digibug", "company_id", "")); + $group->input("event_id") + ->label(t("Event Id")) + ->rules("required") + ->value(module::get_var("digibug", "event_id", "")); + $group->submit("submit")->value(t("Submit")); + + return $form; + } +}
\ No newline at end of file diff --git a/modules/digibug/controllers/digibug.php b/modules/digibug/controllers/digibug.php new file mode 100644 index 00000000..1e968d74 --- /dev/null +++ b/modules/digibug/controllers/digibug.php @@ -0,0 +1,51 @@ +<?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 Digibug_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("Digibug 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("digibug/handler", "", "post", + array("id" => "gDigibugForm")); + $group = $form->group("group")->label(t("Digibug 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/digibug/css/digibug.css b/modules/digibug/css/digibug.css new file mode 100644 index 00000000..f5cd6717 --- /dev/null +++ b/modules/digibug/css/digibug.css @@ -0,0 +1,88 @@ +.gAdminDigibugIntro { + background-image: url(logo.png); + background-repeat: no-repeat; + padding-bottom: 20px; + width: 820px; +} + +.gAdminDigibugIntro p { + font-family: Trebuchet MS,Arial,Verdana,Helvetica,sans-serif; + font-size: 1.3em; + font-weight: bold; + padding-left: 110px; + padding-top: 15px; +} + +.gDigibugTab { + width: 820px; + height: 420px; +} + +.gDigibugTab .gDigibugTitle { + font-family: Georgia; + font-size: 20px; + font-weight: bold; + padding-bottom: 10px; +} + +.gDigibugTab .gDigibugText { + font-size: 12px; + font-weight: bold; + line-height: 17px; + padding-bottom: 15px; +} + +.gDigibugListItems ul { + list-style-type: disc; + padding-left: 20px; + font-size: 12px; + font-weight: bold; + line-height: 15px; +} + +.gDigibugListItems ul li{ + padding-top: 10px; +} + +.gDigibugRounded { + background-color:#5C9CCC; + color: white; + width: 308px; + height: 45px; + text-align: center; + line-height: 15px; + margin-top: 10px; + font-weight: bold; + font-size: 12px; + margin-left: 60px; + margin-right: -50px; + margin-left: 20px; + margin-right: 0px; +} + +.gDigibugRounded a { + color: white !important; + font-weight: bold; + text-decoration: underline; +} + +.gDigibugSignIn { + width: 115px; + float: left; +} + +.gDigibugSignIn a { + color: black; + font-size: 16px; + font-weight: bold; + text-decoration: underline; +} + +.gDigibugAdvancedForm { + float: left; + padding-left: 30px; + width: 180px; +} + + + diff --git a/modules/digibug/css/logo.png b/modules/digibug/css/logo.png Binary files differnew file mode 100644 index 00000000..5eac2c7d --- /dev/null +++ b/modules/digibug/css/logo.png diff --git a/modules/digibug/helpers/digibug_installer.php b/modules/digibug/helpers/digibug_installer.php new file mode 100644 index 00000000..90dab990 --- /dev/null +++ b/modules/digibug/helpers/digibug_installer.php @@ -0,0 +1,43 @@ +<?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 digibug_installer { + static function install() { + $version = module::get_version("digibug"); + if ($version == 0) { + Database::instance() + ->query("CREATE TABLE {print_proxy} ( + `id` int(9) NOT NULL auto_increment, + `proxy_id` char(55) NOT NULL, + `item_id` int(9), + PRIMARY KEY (`id`)) + ENGINE=InnoDB DEFAULT CHARSET=utf8;"); + + module::set_var("digibug", "basic_company_id", "3153"); + module::set_var("digibug", "basic_event_id", "8491"); + module::set_var("digibug", "mode", "basic"); + + module::set_version("digibug", 1); + } + } + + static function uninstall() { + Database::instance()->query("DROP TABLE IF EXISTS {print_proxy}"); + module::delete("digibug"); + } +} diff --git a/modules/digibug/helpers/digibug_menu.php b/modules/digibug/helpers/digibug_menu.php new file mode 100644 index 00000000..3f41bb16 --- /dev/null +++ b/modules/digibug/helpers/digibug_menu.php @@ -0,0 +1,42 @@ +<?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 digibug_menu { + static function admin($menu, $theme) { + $menu->get("settings_menu") + ->append(Menu::factory("link") + ->id("digibug_menu") + ->label(t("Digibug Administration")) + ->url(url::site("admin/digibug"))); + } + + static function photo($menu, $theme) { + } + + 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("digibug") + ->label(t("Peform Digibug Processing")) + ->url(url::site("digibug/index/$item->id"))); + } + } +} diff --git a/modules/digibug/helpers/digibug_theme.php b/modules/digibug/helpers/digibug_theme.php new file mode 100644 index 00000000..06d656c8 --- /dev/null +++ b/modules/digibug/helpers/digibug_theme.php @@ -0,0 +1,25 @@ +<?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 digibug_theme_Core { + static function admin_head($theme) { + return "<link media=\"screen, projection\" rel=\"stylesheet\" type=\"text/css\" href=\"" . + url::file("modules/digibug/css/digibug.css") . "\" />"; + } +} diff --git a/modules/digibug/module.info b/modules/digibug/module.info new file mode 100644 index 00000000..58602c0d --- /dev/null +++ b/modules/digibug/module.info @@ -0,0 +1,3 @@ +name = Digibug +description = Digibug Photo Printing Module +version = 1 diff --git a/modules/digibug/views/admin_digibug.html.php b/modules/digibug/views/admin_digibug.html.php new file mode 100644 index 00000000..33ce5f83 --- /dev/null +++ b/modules/digibug/views/admin_digibug.html.php @@ -0,0 +1,70 @@ +<?php defined("SYSPATH") or die("No direct script access.") ?> +<script type="text/javascript"> + $("#gDigibugTabs").ready(function() { + $("#gDigibugTabs").tabs({ + event: "mouseover" + }); + }); +</script> +<div id="gAdminDigibug"> + <h2><?= t("Digibug Adminstration") ?> </h2> + <div class="gAdminDigibugIntro"> + <p> + <?= t("Digibug offers you two options for turning your photos into a wide variety of prints, gifts and games. Choose your solution and get started today!") ?> + </p> + </div> + <div id="gDigibugTabs"> + <ul> + <li><a href="#gDigibugTabBasic"><?= t("Basic") ?></a></li> + <li><a href="#gDigibugTabAdvanced"><?= t("Advanced") ?></a></li> + </ul> + <div id="gDigibugTabBasic" class="gDigibugTab"> + <div class="gDigibugTitle"> + <?= t("Digibug Basic") ?> + <br/> + <?= t("Fast Easy Photo Fulfillment") ?> + </div> + <div class="gDigibugText"> + <?= t("Power up your Gallery with professional level fulfillment from Kodak. Just use Digibug Basic and there's nothing else to do - no registration, no administration, no hassles.") ?> + </div> + <div class="gDigibugListItems"> + <ul> + <li><?= t("Matte and Glossy prints, from 4x6 to as big as 30x40") ?></li> + <li><?= t("Great photo gifts like canvases, apparel, bags, puzzles, mugs and sports memorabilia and more") ?></li> + <li><?= t("Outstanding quality and customer service") ?></li> + </ul> + </div> + <div class="gDigibugRounded ui-corner-all"> + <br/> + <? if ($mode == "basic"): ?> + <?= t("You are currently using Basic mode!") ?> + <? else: ?> + <a href='<?= url::site("admin/digibug/basic?csrf=$csrf") ?>'><?= t("Click Here") ?></a> + <?= t(" to switch back to basic") ?> + <? endif ?> + </div> + </div> + <div id="gDigibugTabAdvanced" class="gDigibugTab"> + <div class="gDigibugTitle"> + <?= t("Digibug ADVANCED") ?> + <br/> + <?= t("The Pro\'s Solution") ?> + </div> + <div class="gDigibugText"> + <?= t("Digibug ADVANCED allows you to set your own price for photos and gifts. Simply provide us with your account information and we'll send you a check each month with your profits. It's the perfect online retail business solution for a photographer - no inventory, no overhead... just profits!") ?> + </div> + <div class="gDigibugText"> + <?= t("Enjoy the same range of professional level photo prints and gifts, but set your own price and charge what you believe your photos are worth. We'll take care of the rest.") ?> + </div> + <div style="width: 120px;" class="gDigibugText gDigibugSignIn"> + <?= t("New to Digibug ADVANCED?") ?> + <br/> <br/> + <a href="http://www.digibug.com/signup.php" style=""><?= t("Sign up") ?></a><?= t(" to get started") ?> + </div> + <div class="gDigibugAdvancedForm"> + <div class="gDigibugText"><?= t("Do you have a Digibug Company ID and Event ID?") ?></div> + <?= $form ?> + </div> + </div> + </div> +</div> |