1
0

Create gallery3-contrib hierarchy. Move atom, developer, polar_rose

and gmaps modules in here to start using svn export.

Move atom, devel
This commit is contained in:
Bharat Mediratta 2009-03-15 22:21:15 +00:00
commit 4d1252870b
35 changed files with 1625 additions and 0 deletions

View File

@ -0,0 +1,36 @@
<?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 atom_Core {
/**
* Converts a Unix timestamp to an Internet timestamp as defined in RFC3339.
* http://www.ietf.org/rfc/rfc3339.txt
*
* @todo Check if time zone is correct.
* @todo Write test.
*
* @param int Unix timestamp
* @return string Internet timestamp
*/
static function unix_to_internet_timestamp($timestamp) {
return sprintf("%sZ", date("Y-m-d\TH:i:s", $timestamp));
}
}

View File

@ -0,0 +1,36 @@
<?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 Atom_Author_Core extends Atom_Base {
public function name($name) {
$this->element->appendChild($this->dom->createElement("name", $name));
return $this;
}
public function email($email) {
$this->element->appendChild($this->dom->createElement("email", $email));
return $this;
}
public function uri($uri) {
$this->element->appendChild($this->dom->createElement("uri", $uri));
return $this;
}
}

View File

@ -0,0 +1,76 @@
<?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 Atom_Base_Core {
protected $dom;
protected $element;
protected $children = array();
protected $element_name;
function __construct($element_name, $dom=null) {
if ($dom) {
$this->dom = $dom;
$this->element = $dom->createElement($element_name);
} else {
$this->dom = new DOMDocument('1.0', 'utf-8');
$this->element = $this->dom->createElementNS("http://www.w3.org/2005/Atom", $element_name);
}
$this->dom->appendChild($this->element);
$this->element_name = $element_name;
return $this;
}
public function get_element() {
$this->add_children_to_base_element();
return $this->element;
}
public function as_xml() {
$this->add_children_to_base_element();
$this->dom->formatOutput = true;
return $this->dom->saveXML();
}
public function as_json() {
$this->add_children_to_base_element();
/* Both Google and Yahoo generate their JSON from XML. We could do that, too. */
return null;
}
public function load_xml($xml) {
/* Load XML into our DOM. We can also validate against the RELAX NG schema from the Atom RFC. */
}
protected function add_child($element_type, $element_name) {
// @todo check if element_type is of Atom_Base; this can also be done with no magic
$element = new $element_type($element_name, $this->dom);
$this->children[$element_name][] = $element;
return end($this->children[$element_name]);
}
protected function add_children_to_base_element() {
foreach ($this->children as $element_type => $elements) {
$base_element = $this->element;
foreach ($elements as $id => $element) {
$base_element->appendChild($element->get_element());
}
}
}
}

View File

@ -0,0 +1,52 @@
<?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 Atom_Entry_Core extends Atom_Base {
public function id($id) {
$this->element->appendChild($this->dom->createElement("id", $id));
return $this;
}
public function updated($timestamp) {
$this->element->appendChild(
$this->dom->createElement("updated", atom::unix_to_internet_timestamp($timestamp)));
return $this;
}
public function title($title) {
$this->element->appendChild($this->dom->createElement("title", $title));
return $this;
}
public function content($text, $type="html") {
$content = $this->dom->createElement("content", html::specialchars($text));
$content->setAttribute("type", $type);
$this->element->appendChild($content);
return $this;
}
public function author() {
return $this->add_child("Atom_Author", "author");
}
public function link() {
return $this->add_child("Atom_Link", "link");
}
}

View File

@ -0,0 +1,47 @@
<?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 Atom_Feed_Core extends Atom_Base {
public function id($id) {
$this->element->appendChild($this->dom->createElement("id", $id));
return $this;
}
public function title($title) {
/* @todo Add optional type argument that defaults to "text" */
$this->element->appendChild($this->dom->createElement("title", $title));
return $this;
}
public function updated($timestamp) {
$this->element->appendChild(
$this->dom->createElement("updated", atom::unix_to_internet_timestamp($timestamp)));
return $this;
}
public function link() {
return $this->add_child("Atom_Link", "link");
}
public function entry() {
/* Create new empty entry. */
return $this->add_child("Atom_Entry", "entry");
}
}

View File

@ -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 Atom_Link_Core extends Atom_Base {
public function rel($rel) {
$this->element->setAttribute("rel", $rel);
return $this;
}
public function type($type) {
$this->element->setAttribute("type", $type);
return $this;
}
public function title($title) {
$this->element->setAttribute("title", $title);
return $this;
}
public function href($href) {
$this->element->setAttribute("href", $href);
return $this;
}
}

View File

@ -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-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.
*/
/**
* This class implements Gallery's specific needs for Atom entries.
*
*/
class Gallery_Atom_Entry_Core extends Atom_Entry {
function __construct() {
parent::__construct("entry");
/* Set feed ID and self link. */
$this->id(html::specialchars(url::abs_current()));
$this->link()
->rel("self")
->href(url::abs_current());
}
public function link() {
return $this->add_child("Gallery_Atom_Link", "link");
}
}

View File

@ -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-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.
*/
/**
* This class implements Gallery's specific needs for Atom feeds.
*
*/
class Gallery_Atom_Feed_Core extends Atom_Feed {
function __construct() {
parent::__construct("feed");
/* Set feed ID and self link. */
$this->id(html::specialchars(url::abs_current()));
$this->link()
->rel("self")
->href(url::abs_current());
}
public function link() {
return $this->add_child("Gallery_Atom_Link", "link");
}
}

View File

@ -0,0 +1,45 @@
<?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 Gallery_Atom_Link_Core extends Atom_Link {
public function related_atom($relative_uri, $title="") {
if (empty($title)) {
$title = t("Get related meta data");
}
$this->rel("related")
->type(rest::ATOM)
->title($title)
->href(sprintf("%s%s", url::base(true, "http"), $relative_uri));
return $this;
}
public function related_image($relative_uri, $title="", $image_type="jpeg") {
if (empty($title)) {
$title = t("Get related image");
}
$this->rel("related")
->type("image/" . $image_type)
->title($title)
->href(sprintf("%s%s", url::base(true, "http"), $relative_uri));
return $this;
}
}

View File

@ -0,0 +1,69 @@
<?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.
*/
/**
* Defines the available callback methods
*/
$config["methods"] = array(
"theme" => array("album_blocks" => t("Album block"),
"album_bottom" => t("Bottom of album content"),
"album_top" => t("Top of Album content"),
"admin_credits" => t("Administration page credits"),
"admin_footer" => t("Adminsitration page footer"),
"admin_header_top" => t("Top of administration page header"),
"admin_header_bottom" => t("Bottom of administration page header"),
"admin_page_bottom" => t("Bottom of administration page"),
"admin_page_top" => t("Top of administration page"),
"admin_head" => t("Adminstration page head"),
"credits" => t("Album or photo page credits"),
"dynamic_bottom" => t("Bottom of dynamic page content"),
"dynamic_top" => t("Top of dynamic page content"),
"footer" => t("Album or photo page footer"),
"head" => t("Album or photo page head"),
"header_bottom" => t("Album or photo header bottom"),
"header_top" => t("Album or photo header top"),
"page_bottom" => t("Album or photo bottom"),
"page_top" => t("Album or photo top"),
"photo_blocks" => t("Photo block"),
"photo_bottom" => t("Bottom of photo content"),
"photo_top" => t("Top of photo content"),
"sidebar_bottom" => t("Bottom of sidebar"),
"sidebar_top" => t("Top of sidebar"),
"thumb_bottom" => t("Bottom of thumbnail"),
"thumb_info" => t("Thumbnail information"),
"thumb_top" => t("Top of thumbnail display")),
"menu" => array("album" => t("Add an album menu element"),
"photo" => t("Add an photo menu element")),
"event" => array("batch_complete" => t("Batch completion"),
"comment_add_form" => t("Comment add form creation"),
"comment_created" => t("Comment created"),
"comment_updated" => t("Comment updated"),
"group_before_delete" => t("Before delete group"),
"group_created" => t("Group created"),
"item_before_delete" => t("Before album or photo deletion"),
"item_created" => t("Album or photo created"),
"item_related_update" => t("Photo meta data update"),
"item_related_update_batch" => t("Photo meta data update"),
"item_updated" => t("Album or photo update"),
"user_before_delete" => t("Before user deletion"),
"user_created" => t("User created"),
"user_login" => t("User login"),
"user_logout" => t("User logout")));

View File

@ -0,0 +1,127 @@
<?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_Developer_Controller extends Admin_Controller {
public function index() {
$view = new Admin_View("admin.html");
$view->content = new View("admin_developer.html");
if (!is_writable(MODPATH)) {
message::warning(
t("The module directory is not writable. Please insure that it is writable by the web server"));
}
list ($form, $errors) = $this->_get_module_form();
$view->content->module_create = $this->_get_module_create_content($form, $errors);
print $view;
}
public function module_create() {
access::verify_csrf();
list ($form, $errors) = $this->_get_module_form();
$post = new Validation($_POST);
$post->add_rules("name", "required");
$post->add_rules("description", "required");
$post->add_callbacks("name", array($this, "_is_module_defined"));
if ($post->validate()) {
$task_def = Task_Definition::factory()
->callback("developer_task::create_module")
->description(t("Create a new module"))
->name(t("Create Module"));
$task = task::create($task_def, array_merge(array("step" => 0), $post->as_array()));
print json_encode(array("result" => "started",
"url" => url::site("admin/developer/run_create/{$task->id}?csrf=" .
access::csrf_token()),
"task" => $task->as_array()));
} else {
$v = $this->_get_module_create_content(arr::overwrite($form, $post->as_array()),
arr::overwrite($errors, $post->errors()));
print json_encode(array("result" => "error",
"form" => $v->__toString()));
}
}
public function run_create($task_id) {
access::verify_csrf();
$task = task::run($task_id);
if ($task->done) {
$context = unserialize($task->context);
switch ($task->state) {
case "success":
message::success(t("Generation of %module completed successfully",
array("module" => $context["name"])));
break;
case "error":
message::success(t("Generation of %module failed.",
array("module" => $context["name"])));
break;
}
print json_encode(array("result" => "success",
"task" => $task->as_array()));
} else {
print json_encode(array("result" => "in_progress",
"task" => $task->as_array()));
}
}
public function session($key) {
if (!(user::active()->admin)) {
throw new Exception("@todo UNAUTHORIZED", 401);
}
Session::instance()->set($key, $this->input->get("value", false));
$this->auto_render = false;
url::redirect($_SERVER["HTTP_REFERER"]);
}
private function _get_module_create_content($form, $errors) {
$config = Kohana::config("developer.methods");
$v = new View("developer_module.html");
$v->action = "admin/developer/module_create";
$v->hidden = array("csrf" => access::csrf_token());
$v->theme = $config["theme"];
$v->event = $config["event"];
$v->menu = $config["menu"];
$v->form = $form;
$v->errors = $errors;
return $v;
}
public function _is_module_defined(Validation $post, $field) {
$module_name = $post[$field];
if (file_exists(MODPATH . "$module_name/module.info")) {
$post->add_error($field, "module_exists");
}
}
private function _get_module_form($name="", $description="") {
$form = array("name" => "", "description" => "", "theme[]" => array(), "menu[]" => array(),
"event[]" => array());
$errors = array_fill_keys(array_keys($form), "");
return array($form, $errors);
}
}

View File

@ -0,0 +1,35 @@
<?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 developer_installer {
static function install() {
$config = Kohana::config("developer.methods");
Kohana::log(Kohana::debug($config));
$version = module::get_version("developer");
if ($version == 0) {
module::set_version("developer", 1);
}
}
static function uninstall() {
$config = Kohana::config("developer.methods");
Kohana::log(Kohana::debug($config));
module::delete("developer");
}
}

View File

@ -0,0 +1,56 @@
<?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 developer_menu_Core {
static function admin($menu, $theme) {
$developer_menu = Menu::factory("submenu")
->id("developer_menu")
->label(t("Developer Tools"));
$menu->append($developer_menu);
$developer_menu
->append(Menu::factory("link")
->id("generate_menu")
->label(t("Generate"))
->url(url::site("admin/developer")));
if (Session::instance()->get("profiler", false)) {
$developer_menu->append(Menu::factory("link")
->id("scaffold_profiler")
->label("Profiling off")
->url(url::site("admin/developer/session/profiler?value=0")));
} else {
$developer_menu->append(Menu::factory("link")
->id("scaffold_profiler")
->label("Profiling on")
->url(url::site("admin/developer/session/profiler?value=1")));
}
if (Session::instance()->get("debug", false)) {
$developer_menu->append(Menu::factory("link")
->id("scaffold_debugger")
->label("Debugging off")
->url(url::site("admin/developer/session/debug?value=0")));
} else {
$developer_menu->append(Menu::factory("link")
->id("scaffold_debugger")
->label("Debugging on")
->url(url::site("admin/developer/session/debug?value=1")));
}
}
}

View File

@ -0,0 +1,148 @@
<?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 developer_task_Core {
static function available_tasks() {
// Return empty array so nothing appears in the maintenance screen
return array();
}
static function create_module($task) {
$context = unserialize($task->context);
if (empty($context["module"])) {
$context["class_name"] = strtr($context["name"], " ", "_");
$context["module"] = strtolower($context["class_name"]);
$context["module_path"] = (MODPATH . $context["module"]);
}
switch ($context["step"]) {
case 0: // Create directory tree
Kohana::log("debug", Kohana::debug($context));
foreach (array("", "controllers", "helpers", "js", "views") as $dir) {
$path = "{$context['module_path']}/$dir";
if (!file_exists($path)) {
mkdir($path);
chmod($path, 0774);
}
}
break;
case 1: // Generate installer
$context["installer"] = 1;
self::_render_helper_file($context, "installer");
break;
case 2: // Generate theme helper
$context["theme"] = 1;
self::_render_helper_file($context, "theme");
break;
case 3: // Generate block helper
$context["block"] = 1;
self::_render_helper_file($context, "block");
break;
case 4: // Generate menu helper
$context["menu"] = empty($context["menu"]) ? 1 : $context["menu"];
self::_render_helper_file($context, "menu");
break;
case 5: // Generate event helper
self::_render_helper_file($context, "event");
break;
case 6: // Generate admin controller
$file = "{$context['module_path']}/controllers/admin_{$context['module']}.php";
ob_start();
$v = new View("admin_controller.txt");
$v->name = $context["name"];
$v->module = $context["module"];
$v->class_name = $context["class_name"];
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
break;
case 7: // Generate admin form
$file = "{$context['module_path']}/views/admin_{$context['module']}.html.php";
ob_start();
$v = new View("admin_html.txt");
$v->name = $context["name"];
$v->module = $context["module"];
$v->css_id = preg_replace("#\s+#", "", $context["name"]);
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
break;
case 8: // Generate controller
$file = "{$context['module_path']}/controllers/{$context['module']}.php";
ob_start();
$v = new View("controller.txt");
$v->name = $context["name"];
$v->module = $context["module"];
$v->class_name = $context["class_name"];
$v->css_id = preg_replace("#\s+#", "", $context["name"]);
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
break;
case 9: // Generate sidebar block view
$file = "{$context['module_path']}/views/{$context['module']}_block.html.php";
ob_start();
$v = new View("block_html.txt");
$v->name = $context["name"];
$v->module = $context["module"];
$v->class_name = $context["class_name"];
$v->css_id = preg_replace("#\s+#", "", $context["name"]);
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
break;
case 10: // Generate module.info (do last)
$file = "{$context["module_path"]}/module.info";
ob_start();
$v = new View("module_info.txt");
$v->module_name = $context["name"];
$v->module_description = $context["description"];
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
break;
}
$task->done = (++$context["step"]) >= 11;
$task->context = serialize($context);
$task->state = "success";
$task->percent_complete = ($context["step"] / 11.0) * 100;
}
private static function _render_helper_file($context, $helper) {
if (!empty($context[$helper])) {
$config = Kohana::config("developer.methods");
$file = "{$context["module_path"]}/helpers/{$context["module"]}_{$helper}.php";
touch($file);
chmod($file, 0772);
ob_start();
$v = new View("$helper.txt");
$v->helper = $helper;
$v->name = $context["name"];
$v->module = $context["module"];
$v->module_name = $context["name"];
$v->css_id = strtr($context["name"], " ", "");
$v->css_id = preg_replace("#\s#", "", $context["name"]);
$v->callbacks = empty($context[$helper]) ? array() : array_fill_keys($context[$helper], 1);
print $v->render();
file_put_contents($file, ob_get_contents());
ob_end_clean();
}
}
}

View File

@ -0,0 +1,39 @@
$("#gDeveloperTools").ready(function() {
$("#gDeveloperTools").tabs();
});
var module_success = function(data) {
$("#gGenerateModule").after('<div id="moduleProgress" style="margin-left: 5.5em;"></div>');
$("#moduleProgress").progressbar();
var task = data.task;
var url = data.url;
var done = false;
while (!done) {
$.ajax({async: false,
success: function(data, textStatus) {
$("#moduleProgress").progressbar("value", data.task.percent_complete);
done = data.task.done;
},
dataType: "json",
type: "POST",
url: url
});
}
document.location.reload();
};
function ajaxify_developer_form(selector, success) {
$(selector).ajaxForm({
dataType: "json",
success: function(data) {
if (data.form && data.result != "started") {
$(selector).replaceWith(data.form);
ajaxify_developer_form(selector, success);
}
if (data.result == "started") {
success(data);
}
}
});
}

View File

@ -0,0 +1,3 @@
name = Developer
description = Tools to assist module and theme developers
version = 1

View File

@ -0,0 +1,57 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?= "<?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_<?= $class_name ?>_Controller extends Admin_Controller {
public function index() {
print $this->_get_view();
}
public function handler() {
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate()) {
// @todo process the admin form
message::success(t("<?= $name ?> Adminstration Complete Successfully"));
url::redirect("admin/<?= $module ?>");
}
print $this->_get_view($form);
}
private function _get_view($form=null) {
$v = new Admin_View("admin.html");
$v->content = new View("admin_<?=$module ?>.html");
$v->content->form = empty($form) ? $this->_get_form() : $form;
return $v;
}
private function _get_form() {
$form = new Forge("admin/<?= $module ?>/handler", "", "post",
array("id" => "gAdminForm"));
$group = $form->group("group");
$group->input("text")->label(t("Text"))->rules("required");
$group->submit("submit")->value(t("Submit"));
return $form;
}
}

View File

@ -0,0 +1,15 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= html::script("modules/developer/js/developer.js") ?>
<div id="gDeveloper">
<h2>
<?= t("Developer Tools") ?>
</h2>
<div id="gDeveloperTools">
<ul>
<li><a href="#create-module"><span><?= t("Create new module") ?></span></a></li>
</ul>
<div id="#create-module">
<?= $module_create ?>
</div>
</div>
</div>

View File

@ -0,0 +1,10 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>" ?>
<div id="gAdmin<?= $css_id ?>">
<h2>
<?= "<?= t(\"$name Adminstration\") ?>" ?>
</h2>
<?= "<?= \$form ?>" ?>
</div>

View File

@ -0,0 +1,38 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?= "<?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 <?= $module ?>_block {
static function get($block_id) {
$block = new Block();
if ($block_id == "<?= $module ?>") {
$block->css_id = "g<?= $css_id ?>Admin";
$block->title = t("<?= $module ?> Dashboard Block");
$block->content = new View("<?= $module ?>block.html");
$block->content->item = ORM::factory("item", 1);
}
return $block;
}
static function get_list() {
return array(
"<?= $module ?>" => t("<?= $name ?> Dashboard Block"));
}
}

View File

@ -0,0 +1,10 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>" ?>
<div class="g<?= $css_id ?>Block">
<?= "<a href=\"<?= \$item->url() ?>\">" ?>
<?= "<?= \$item->thumb_tag(array(\"class\" => \"gThumbnail\")) ?>" ?>
</a>
</div>

View File

@ -0,0 +1,53 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?= "<?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 <?= $class_name ?>_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("<?= $name ?> 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("<?= $module ?>/handler", "", "post",
array("id" => "g<?= $css_id ?>Form"));
$group = $form->group("group")->label(t("<?= $name ?> Handler"));
$group->input("text")->label(t("Text"))->rules("required");
$group->submit("submit")->value(t("Submit"));
return $form;
}
}

View File

@ -0,0 +1,49 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script>
$("#gModuleCreateForm").ready(function() {
ajaxify_developer_form("#gModuleCreateForm form", module_success);
});
</script>
<div id="gModuleCreateForm">
<?= form::open($action, array("method" => "post"), $hidden) ?>
<ul>
<li <? if (!empty($errors["name"])): ?> class="gError"<? endif ?>>
<?= form::label("name", t("Name")) ?>
<?= form::input("name", $form["name"]) ?>
<? if (!empty($errors["name"]) && $errors["name"] == "required"): ?>
<p class="gError"><?= t("Module name is required") ?></p>
<? endif ?>
<? if (!empty($errors["name"]) && $errors["name"] == "module_exists"): ?>
<p class="gError"><?= t("Module is already implemented") ?></p>
<? endif ?>
</li>
<li <? if (!empty($errors["description"])): ?> class="gError"<? endif ?>>
<?= form::label("description", t("Description")) ?>
<?= form::input("description", $form["description"]) ?>
<? if (!empty($errors["description"]) && $errors["description"] == "required"): ?>
<p class="gError"><?= t("Module description is required")?></p>
<? endif ?>
</li>
<li>
<ul>
<li>
<?= form::label("theme[]", t("Theme Callbacks")) ?>
<?= form::dropdown(array("name" => "theme[]", "multiple" => true, "size" => 6), $theme, $form["theme[]"]) ?>
</li>
<li>
<?= form::label("menu[]", t("Menu Callback")) ?>
<?= form::dropdown(array("name" => "menu[]", "multiple" => true, "size" => 6), $menu, $form["menu[]"]) ?>
</li>
<li>
<?= form::label("event[]", t("Gallery Event Handlers")) ?>
<?= form::dropdown(array("name" => "event[]", "multiple" => true, "size" => 6), $event, $form["event[]"]) ?>
</li>
</ul>
</li>
<li>
<?= form::submit(array("id" => "gGenerateModule", "name" => "generate", "class" => "submit"), t("Generate")) ?>
</li>
</ul>
<?= form::close() ?>
</div>

View File

@ -0,0 +1,96 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?= "<?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 <?= $module ?>_event {
<? if (!empty($callbacks["batch_complete"])): ?>
static function batch_complete() {
}
<? endif ?>
<? if (!empty($callbacks["comment_add_form"])): ?>
static function comment_add_form($form) {
}
<? endif ?>
<? if (!empty($callbacks["comment_created"])): ?>
static function comment_created($theme, $args) {
}
<? endif ?>
<? if (!empty($callbacks["comment_updated"])): ?>
static function comment_updated($old, $new) {
}
<? endif ?>
<? if (!empty($callbacks["group_before_delete"])): ?>
static function group_before_delete($group) {
}
<? endif ?>
<? if (!empty($callbacks["group_created"])): ?>
static function group_created($group) {
}
<? endif ?>
<? if (!empty($callbacks["item_before_delete"])): ?>
static function item_before_delete($item) {
}
<? endif ?>
<? if (!empty($callbacks["item_created"])): ?>
static function item_created($item) {
}
<? endif ?>
<? if (!empty($callbacks["item_related_update"])): ?>
static function item_related_update($item) {
}
<? endif ?>
<? if (!empty($callbacks["item_related_update_batch"])): ?>
static function item_related_update_batch($sql) {
}
<? endif ?>
<? if (!empty($callbacks["item_updated"])): ?>
static function item_updated($old, $new) {
}
<? endif ?>
<? if (!empty($callbacks["user_before_delete"])): ?>
static function user_before_delete($user) {
}
<? endif ?>
<? if (!empty($callbacks["user_created"])): ?>
static function user_created($user) {
}
<? endif ?>
<? if (!empty($callbacks["user_login"])): ?>
static function user_login($user) {
}
<? endif ?>
<? if (!empty($callbacks["user_logout"])): ?>
static function user_logout($user) {
}
<? endif ?>
}

View File

@ -0,0 +1,34 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?= "<?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 <?= $module ?>_installer {
static function install() {
$version = module::get_version("<?= $module ?>");
if ($version == 0) {
/* @todo Put database creation here */
module::set_version("<?= $module ?>", 1);
}
}
static function uninstall() {
/* @todo Put database table drops here */
module::delete("<?= $module ?>");
}
}

View File

@ -0,0 +1,51 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?= "<?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 <?= $module ?>_menu {
static function admin($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("<?= $module ?>_menu")
->label(t("<?= $module_name ?> Administration"))
->url(url::site("admin/<?= $module ?>")));
}
<? if (!empty($callbacks["album"])): ?>
static function album($menu, $theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo"])): ?>
static function photo($menu, $theme) {
}
<? endif ?>
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("<?= $module ?>")
->label(t("Peform <?= $module_name ?> Processing"))
->url(url::site("<?= $module ?>/index/$item->id")));
}
}
}

View File

@ -0,0 +1,5 @@
name = <?= $module_name ?>
description = <?= $module_description ?>
version = 1

View File

@ -0,0 +1,168 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?= "<?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 <?= $module ?>_theme {
static function sidebar_blocks($theme) {
$block = new Block();
$block->css_id = "g<?= $css_id ?>";
$block->title = t("<?= $name ?>");
$block->content = new View("<?= $module ?>_block.html");
$block->content->item = ORM::factory("item", 1);
return $block;
}
<? if (!empty($callbacks["album_blocks"])): ?>
static function album_blocks($theme) {
}
<? endif ?>
<? if (!empty($callbacks["album_bottom"])): ?>
static function album_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["album_top"])): ?>
static function album_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_credits"])): ?>
static function admin_credits($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo"])): ?>
static function admin_footer($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_header_top"])): ?>
static function admin_header_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_header_bottom"])): ?>
static function admin_header_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_page_bottom"])): ?>
static function admin_page_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_page_top"])): ?>
static function admin_page_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["admin_head"])): ?>
static function admin_head($theme) {
}
<? endif ?>
<? if (!empty($callbacks["credits"])): ?>
static function credits($theme) {
}
<? endif ?>
<? if (!empty($callbacks["dynamic_bottom"])): ?>
static function dynamic_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["dynamic_top"])): ?>
static function dynamic_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["footer"])): ?>
static function footer($theme) {
}
<? endif ?>
<? if (!empty($callbacks["head"])): ?>
static function head($theme) {
}
<? endif ?>
<? if (!empty($callbacks["header_bottom"])): ?>
static function header_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["header_top"])): ?>
static function header_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["page_bottom"])): ?>
static function page_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["pae_top"])): ?>
static function page_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo_blocks"])): ?>
static function photo_blocks($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo_bottom"])): ?>
static function photo_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["photo_top"])): ?>
static function photo_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["sidebar_bottom"])): ?>
static function sidebar_bottom($theme) {
}
<? endif ?>
<? if (!empty($callbacks["sidebar_top"])): ?>
static function sidebar_top($theme) {
}
<? endif ?>
<? if (!empty($callbacks["thumb_bottom"])): ?>
static function thumb_bottom($theme, $child) {
}
<? endif ?>
<? if (!empty($callbacks["thumb_info"])): ?>
static function thumb_info($theme, $child) {
}
<? endif ?>
<? if (!empty($callbacks["thumb_top"])): ?>
static function thumb_top($theme, $child) {
}
<? endif ?>
}

View File

@ -0,0 +1,31 @@
<?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 gmaps_installer {
static function install() {
$version = module::get_version("gmaps");
if ($version == 0) {
module::set_version("gmaps", 1);
}
}
static function uninstall() {
module::delete("gmaps");
}
}

View File

@ -0,0 +1,30 @@
<?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 gmaps_theme_Core {
static function sidebar_blocks($theme) {
if ($theme->item()) {
$block = new Block();
$block->css_id = "gMaps";
$block->title = t("Location");
$block->content = new View("gmaps_block.html");
return $block;
}
}
}

View File

@ -0,0 +1,3 @@
name = Google Maps
description = Integrate with the Google Maps service
version = 1

View File

@ -0,0 +1,2 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<iframe width="214" height="214" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/ms?hl=en&amp;geocode=&amp;ie=UTF8&amp;t=h&amp;ei=-ropSbi8KpXIjAOiibmHDQ&amp;view=map&amp;attrid=&amp;s=AARTsJoEm4ODiRa9-yt6-lndtYMlWHPR4w&amp;msa=0&amp;msid=106914852640486882019.000452143d9aa600cc0d6&amp;ll=52.369835,4.886341&amp;spn=0.022429,0.036736&amp;z=13&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps/ms?hl=en&amp;geocode=&amp;ie=UTF8&amp;t=h&amp;ei=-ropSbi8KpXIjAOiibmHDQ&amp;view=map&amp;attrid=&amp;msa=0&amp;msid=106914852640486882019.000452143d9aa600cc0d6&amp;ll=52.369835,4.886341&amp;spn=0.022429,0.036736&amp;z=13&amp;source=embed" style="color:#0000FF;text-align:left">View Larger Map</a></small>

View File

@ -0,0 +1,32 @@
<?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 polar_rose_installer {
static function install() {
$db = Database::instance();
$version = module::get_version("polar_rose");
if ($version == 0) {
module::set_version("polar_rose", 1);
}
}
static function uninstall() {
module::delete("polar_rose");
}
}

View File

@ -0,0 +1,50 @@
<?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 polar_rose_theme_Core {
static function head($theme) {
if (module::is_installed("rss")) {
if ($theme->item()) {
$url = rss::item_feed($theme->item());
} else if ($theme->tag()) {
$url = rss::tag_feed($theme->tag());
}
// Polar Rose doesn't understand relative URLs. Hack around that until they fix it.
$url = url::abs_site(substr($url, strpos($url, "index.php") + 10));
return "<script type=\"text/javascript\">" .
"var polarroseconfig = {" .
"partner: 'gallery3'," .
"rss: '$url'," .
"insert: 'gPolarRose'," .
"optin: ''," .
"theme: 'dark'," .
"progress: true" .
"}</script>" .
"<script type=\"text/javascript\" " .
"src=\"http://cdn.widget.polarrose.com/polarrosewidget.js\">" .
"</script>";
}
}
static function page_bottom($theme) {
return "<div id=\"gPolarRose\"></div>";
}
}

View File

@ -0,0 +1,3 @@
name = Polar Rose
description = Integrate Gallery with the Polar Rose facial recognition service.
version = 1