Merge commit 'upstream/master'
This commit is contained in:
commit
159fa9c815
154
modules/basket/controllers/admin_postage_bands.php
Normal file
154
modules/basket/controllers/admin_postage_bands.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?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_Postage_Bands_Controller extends Controller
|
||||
{
|
||||
/**
|
||||
* the index page of the user homes admin
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_postage_bands.html");
|
||||
$view->content->postage_bands = ORM::factory("postage_band")->orderby("name")->find_all();
|
||||
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function add_postage_band_form() {
|
||||
print postage_band::get_add_form_admin();
|
||||
}
|
||||
|
||||
|
||||
public function add_postage_band() {
|
||||
access::verify_csrf();
|
||||
|
||||
$form = postage_band::get_add_form_admin();
|
||||
$valid = $form->validate();
|
||||
$name = $form->add_postage->inputs["name"]->value;
|
||||
$postage = ORM::factory("postage_band")->where("name", $name)->find();
|
||||
if ($postage->loaded) {
|
||||
$form->add_postage->inputs["name"]->add_error("in_use", 1);
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if ($valid) {
|
||||
$postage = postage_band::create(
|
||||
$name,
|
||||
$form->add_postage->flat_rate->value,
|
||||
$form->add_postage->per_item->value
|
||||
);
|
||||
|
||||
$postage->save();
|
||||
message::success(t("Created postage band %postage_name", array(
|
||||
"postage_name" => html::clean($postage->name))));
|
||||
print json_encode(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error",
|
||||
"form" => $form->__toString()));
|
||||
}
|
||||
}
|
||||
|
||||
public function delete_postage_band_form($id) {
|
||||
$postage = ORM::factory("postage_band", $id);
|
||||
if (!$postage->loaded) {
|
||||
kohana::show_404();
|
||||
}
|
||||
print postage_band::get_delete_form_admin($postage);
|
||||
}
|
||||
|
||||
public function delete_postage_band($id) {
|
||||
access::verify_csrf();
|
||||
|
||||
if ($id == user::active()->id || $id == user::guest()->id) {
|
||||
access::forbidden();
|
||||
}
|
||||
|
||||
$postage = ORM::factory("postage_band", $id);
|
||||
if (!$postage->loaded) {
|
||||
kohana::show_404();
|
||||
}
|
||||
|
||||
$form = postage_band::get_delete_form_admin($postage);
|
||||
if($form->validate()) {
|
||||
$name = $postage->name;
|
||||
$postage->delete();
|
||||
} else {
|
||||
print json_encode(array("result" => "error",
|
||||
"form" => $form->__toString()));
|
||||
}
|
||||
|
||||
$message = t("Deleted user %postage_band", array("postage_band" => html::clean($name)));
|
||||
log::success("user", $message);
|
||||
message::success($message);
|
||||
print json_encode(array("result" => "success"));
|
||||
}
|
||||
|
||||
public function edit_postage_band($id) {
|
||||
access::verify_csrf();
|
||||
|
||||
$postage = ORM::factory("postage_band", $id);
|
||||
if (!$postage->loaded) {
|
||||
kohana::show_404();
|
||||
}
|
||||
|
||||
$form = postage_band::get_edit_form_admin($postage);
|
||||
$valid = $form->validate();
|
||||
if ($valid) {
|
||||
$new_name = $form->edit_postage->inputs["name"]->value;
|
||||
if ($new_name != $postage->name &&
|
||||
ORM::factory("postage_band")
|
||||
->where("name", $new_name)
|
||||
->where("id !=", $postage->id)
|
||||
->find()
|
||||
->loaded) {
|
||||
$form->edit_postage->inputs["name"]->add_error("in_use", 1);
|
||||
$valid = false;
|
||||
} else {
|
||||
$postage->name = $new_name;
|
||||
}
|
||||
}
|
||||
|
||||
if ($valid) {
|
||||
$postage->flat_rate = $form->edit_postage->flat_rate->value;
|
||||
$postage->per_item = $form->edit_postage->per_item->value;
|
||||
$postage->save();
|
||||
|
||||
message::success(t("Changed postage band %postage_name",
|
||||
array("postage_name" => html::clean($postage->name))));
|
||||
print json_encode(array("result" => "success"));
|
||||
} else {
|
||||
print json_encode(array("result" => "error",
|
||||
"form" => $form->__toString()));
|
||||
}
|
||||
}
|
||||
|
||||
public function edit_postage_band_form($id) {
|
||||
$postage = ORM::factory("postage_band", $id);
|
||||
if (!$postage->loaded) {
|
||||
kohana::show_404();
|
||||
}
|
||||
|
||||
$form = postage_band::get_edit_form_admin($postage);
|
||||
|
||||
print $form;
|
||||
}
|
||||
|
||||
}
|
@ -51,7 +51,11 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
|
||||
if ($valid) {
|
||||
$product = product::create(
|
||||
$name, $form->add_product->cost->value, $form->add_product->description->value);
|
||||
$name,
|
||||
$form->add_product->cost->value,
|
||||
$form->add_product->description->value,
|
||||
$form->add_product->postage_band->value
|
||||
);
|
||||
|
||||
$product->save();
|
||||
message::success(t("Created product %product_name", array(
|
||||
@ -83,7 +87,7 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
kohana::show_404();
|
||||
}
|
||||
|
||||
$form = user::get_delete_form_admin($product);
|
||||
$form = product::get_delete_form_admin($product);
|
||||
if($form->validate()) {
|
||||
$name = $product->name;
|
||||
$product->delete();
|
||||
@ -126,6 +130,7 @@ class Admin_Product_Lines_Controller extends Controller
|
||||
if ($valid) {
|
||||
$product->cost = $form->edit_product->cost->value;
|
||||
$product->description = $form->edit_product->description->value;
|
||||
$product->postage_band_id = $form->edit_product->postage_band->value;
|
||||
$product->save();
|
||||
|
||||
message::success(t("Changed product %product_name",
|
||||
|
@ -21,7 +21,7 @@ class Basket_Controller extends Controller {
|
||||
|
||||
public function view_basket() {
|
||||
|
||||
$template = new Theme_View("page.html", "basket");
|
||||
$template = new Theme_View("page.html", "other", "basket");
|
||||
|
||||
$view = new View("view_basket.html");
|
||||
$view->basket = Session_Basket::get();
|
||||
@ -31,7 +31,7 @@ class Basket_Controller extends Controller {
|
||||
print $template;
|
||||
}
|
||||
|
||||
private function getCheckoutForm(){
|
||||
private function getCheckoutForm(){
|
||||
$form = new Forge("basket/confirm", "", "post", array("id" => "checkout", "name" =>"checkout"));
|
||||
$group = $form->group("contact")->label(t("Contact Details"));
|
||||
$group->input("fullname")->label(t("Name"))->id("fullname");
|
||||
@ -48,7 +48,7 @@ class Basket_Controller extends Controller {
|
||||
|
||||
public function checkout () {
|
||||
|
||||
$template = new Theme_View("page.html", "basket");
|
||||
$template = new Theme_View("page.html", "other", "basket");
|
||||
|
||||
$view = new View("checkout.html");
|
||||
|
||||
@ -89,7 +89,7 @@ class Basket_Controller extends Controller {
|
||||
$basket->email = $form->contact->email->value;
|
||||
$basket->phone = $form->contact->phone->value;
|
||||
|
||||
$template = new Theme_View("page.html", "basket");
|
||||
$template = new Theme_View("page.html", "other", "basket");
|
||||
|
||||
$form = new Forge("basket/complete", "", "post", array("id" => "confirm", "name" =>"confirm"));
|
||||
$view = new View("confirm_order.html");
|
||||
@ -110,6 +110,8 @@ class Basket_Controller extends Controller {
|
||||
$basket = Session_Basket::get();
|
||||
|
||||
//$admin_address = basket::getEmailAddress();
|
||||
$postage = $basket->postage_cost();
|
||||
$product_cost = $basket->cost();
|
||||
|
||||
$admin_email = "Order for :
|
||||
".$basket->name."
|
||||
@ -121,7 +123,9 @@ class Basket_Controller extends Controller {
|
||||
".$basket->email."
|
||||
".$basket->phone."
|
||||
Placed at ".date("d F Y - H:i" ,time())."
|
||||
Total Owed ".$basket->cost()." in ".basket::getCurrency()."
|
||||
Cost of Ordered Products = ".$product_cost."
|
||||
Postage and Packaging Costs + ".$postage."
|
||||
Total Owed ".($product_cost+$postage)." Total in ".basket::getCurrency()."
|
||||
|
||||
Items Ordered:
|
||||
|
||||
@ -145,7 +149,7 @@ Items Ordered:
|
||||
|
||||
$basket->clear();
|
||||
|
||||
$template = new Theme_View("page.html", "basket");
|
||||
$template = new Theme_View("page.html", "other", "basket");
|
||||
$view = new View("order_complete.html");
|
||||
$template->content = $view;
|
||||
print $template;
|
||||
@ -153,13 +157,13 @@ Items Ordered:
|
||||
|
||||
private function getAddToBasketForm($id){
|
||||
|
||||
$form = new Forge("basket/add_to_basket", "", "post", array("id" => "gAddToBasketForm"));
|
||||
$form = new Forge("basket/add_to_basket", "", "post", array("id" => "g-add-to-basket-form"));
|
||||
$group = $form->group("add_to_basket")->label(t("Add To Basket"));
|
||||
$group->hidden("id");
|
||||
$group->dropdown("product")
|
||||
->label(t("Product"))
|
||||
->options(product::getProductArray($id));
|
||||
$group->input("quantity")->label(t("Quantity"))->id("gQuantity");
|
||||
$group->input("quantity")->label(t("Quantity"))->id("g-quantity");
|
||||
$group->submit("")->value(t("Add"));
|
||||
//$group->submit("proceedToCheckout")->value(t("Proceed To Checkout"));
|
||||
|
||||
|
@ -42,9 +42,9 @@ class basket_Core {
|
||||
static $format= array(
|
||||
"AUD" => "$",
|
||||
"CAD" => "$",
|
||||
"EUR" => "€",
|
||||
"GBP" => "£",
|
||||
"JPY" => "¥",
|
||||
"EUR" => "€",
|
||||
"GBP" => "£",
|
||||
"JPY" => "¥",
|
||||
"USD" => "$",
|
||||
"NZD" => "$",
|
||||
"CHF" => "",
|
||||
@ -61,15 +61,15 @@ class basket_Core {
|
||||
|
||||
|
||||
static function get_configure_form() {
|
||||
$form = new Forge("admin/configure", "", "post", array("id" => "gConfigureForm"));
|
||||
$form = new Forge("admin/configure", "", "post", array("id" => "g-configure-form"));
|
||||
$group = $form->group("configure")->label(t("Configure Basket"));
|
||||
$group->input("email")->label(t("Offline Paying Email Address"))->id("gOrderEmailAddress");
|
||||
$group->input("email")->label(t("Offline Paying Email Address"))->id("g-order-email-address");
|
||||
$group->dropdown("currency")
|
||||
->label(t("Currency"))
|
||||
->options(self::$currencies);
|
||||
|
||||
$group->checkbox("paypal")->label(t("Use Paypal"))->id("gPaypal");
|
||||
$group->input("paypal_account")->label(t("Paypal E-Mail Address"))->id("gPaypalAddress");
|
||||
$group->checkbox("paypal")->label(t("Use Paypal"))->id("g-paypal");
|
||||
$group->input("paypal_account")->label(t("Paypal E-Mail Address"))->id("g-paypal-address");
|
||||
$group->submit("")->value(t("Save"));
|
||||
return $form;
|
||||
}
|
||||
@ -114,7 +114,7 @@ class basket_Core {
|
||||
}
|
||||
|
||||
static function formatMoney($money){
|
||||
return self::$format[self::getCurrency()].number_format($money);
|
||||
return self::$format[self::getCurrency()].number_format($money,2);
|
||||
}
|
||||
|
||||
static function setEmailAddress($email){
|
||||
@ -141,6 +141,12 @@ class basket_Core {
|
||||
<input type=\"hidden\" name=\"currency_code\" value=\"".self::getCurrency()."\">
|
||||
<input type=\"hidden\" name=\"business\" value=\"".self::getPaypalAccount()."\"/>";
|
||||
|
||||
$postage = $session_basket->postage_cost();
|
||||
if ($postage > 0) {
|
||||
$form = $form."
|
||||
<input type=\"hidden\" name=\"shipping_1\" value=\"".$postage."\">";
|
||||
}
|
||||
|
||||
$id = 1;
|
||||
foreach ($session_basket->contents as $key => $basket_item){
|
||||
$form = $form."
|
||||
@ -149,6 +155,7 @@ class basket_Core {
|
||||
<input type=\"hidden\" name=\"quantity_$id\" value=\"$basket_item->quantity\"/>";
|
||||
$id++;
|
||||
}
|
||||
|
||||
$form = $form."</form>";
|
||||
|
||||
return $form;
|
||||
|
@ -38,6 +38,11 @@ class basket_event_Core{
|
||||
->id("product_line")
|
||||
->label(t("Product Lines"))
|
||||
->url(url::site("admin/product_lines")));
|
||||
$basket_menu->append(
|
||||
Menu::factory("link")
|
||||
->id("postage_bands")
|
||||
->label(t("Postage Bands"))
|
||||
->url(url::site("admin/postage_bands")));
|
||||
|
||||
}
|
||||
|
||||
|
@ -17,14 +17,18 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class basket_installer {
|
||||
static function install() {
|
||||
|
||||
class basket_installer
|
||||
{
|
||||
static function install(){
|
||||
|
||||
$db = Database::instance();
|
||||
$db->query("CREATE TABLE IF NOT EXISTS {products} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`name` TEXT NOT NULL,
|
||||
`cost` INTEGER(9) default 0,
|
||||
`cost` DECIMAL(10,2) default 0,
|
||||
`description` varchar(1024),
|
||||
`postage_band_id` int(9) default 1,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
@ -40,21 +44,57 @@ class basket_installer {
|
||||
`product_override_id` int(9) NOT NULL,
|
||||
`product_id` int(9) NOT NULL,
|
||||
`include` BOOLEAN default false,
|
||||
`cost` INTEGER(9) default -1,
|
||||
`cost` DECIMAL(10,2) default -1,
|
||||
PRIMARY KEY (`id`))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
|
||||
|
||||
$db->query("CREATE TABLE IF NOT EXISTS {postage_bands} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`name` TEXT NOT NULL,
|
||||
`flat_rate` DECIMAL(10,2) default 0,
|
||||
`per_item` DECIMAL(10,2) default 0,
|
||||
PRIMARY KEY (`id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
product::create("4x6",5,"4\"x6\" print");
|
||||
product::create("8x10",25,"8\"x10\" print");
|
||||
product::create("8x12",30,"8\"x12\" print");
|
||||
postage_band::create("No Postage",0,0);
|
||||
|
||||
product::create("4x6",5,"4\"x6\" print",1);
|
||||
product::create("8x10",25,"8\"x10\" print",1);
|
||||
product::create("8x12",30,"8\"x12\" print",1);
|
||||
|
||||
|
||||
module::set_version("basket", 2);
|
||||
|
||||
module::set_version("basket", 1);
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
static function upgrade($version) {
|
||||
$db = Database::instance();
|
||||
if ($version == 1) {
|
||||
|
||||
// fix for allowing decimel place in money
|
||||
$db->query("ALTER TABLE {products} CHANGE COLUMN `cost` `cost` DECIMAL(10,2) default 0;");
|
||||
$db->query("ALTER TABLE {item_products} CHANGE COLUMN `cost` `cost` DECIMAL(10,2) default -1;");
|
||||
|
||||
// postage bands
|
||||
$db->query("ALTER TABLE {products} ADD COLUMN `postage_band_id` int(9) default 1");
|
||||
$db->query("CREATE TABLE IF NOT EXISTS {postage_bands} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`name` TEXT NOT NULL,
|
||||
`flat_rate` DECIMAL(10,2) default 0,
|
||||
`per_item` DECIMAL(10,2) default 0,
|
||||
PRIMARY KEY (`id`))
|
||||
ENGINE=InnoDB DEFAULT CHARSET=utf8;");
|
||||
postage_band::create("No Postage",0,0);
|
||||
|
||||
module::set_version("basket", $version = 2);
|
||||
}
|
||||
}
|
||||
|
||||
static function uninstall(){
|
||||
$db = Database::instance();
|
||||
$db->query("DROP TABLE IF EXISTS {products}");
|
||||
$db->query("DROP TABLE IF EXISTS {product_overrides}");
|
||||
$db->query("DROP TABLE IF EXISTS {item_products}");
|
||||
$db->query("DROP TABLE IF EXISTS {postage_bands}");
|
||||
}
|
||||
}
|
||||
|
99
modules/basket/helpers/postage_band.php
Normal file
99
modules/basket/helpers/postage_band.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?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 postage_band_Core {
|
||||
|
||||
static function get_add_form_admin() {
|
||||
$form = new Forge("admin/postage_bands/add_postage_band", "", "post", array("id" => "gAddPostageForm"));
|
||||
$group = $form->group("add_postage")->label(t("Add Postage Band"));
|
||||
$group->input("name")->label(t("Name"))->id("gPostageName")
|
||||
->error_messages("in_use", t("There is already a postage band with that name"));
|
||||
$group->input("flat_rate")->label(t("Flat Rate"))->id("gFlatRate");
|
||||
$group->input("per_item")->label(t("Per Item"))->id("gPetItem");
|
||||
$group->submit("")->value(t("Add Postage Band"));
|
||||
$postage = ORM::factory("postage_band");
|
||||
$form->add_rules_from($postage);
|
||||
return $form;
|
||||
}
|
||||
|
||||
static function get_edit_form_admin($postage) {
|
||||
$form = new Forge("admin/postage_bands/edit_postage_band/$postage->id", "", "post",
|
||||
array("id" => "gEditPostageForm"));
|
||||
$group = $form->group("edit_postage")->label(t("Edit Postage Band"));
|
||||
$group->input("name")->label(t("Name"))->id("gPostageName")->value($postage->name);
|
||||
$group->inputs["name"]->error_messages(
|
||||
"in_use", t("There is already a postage band with that name"));
|
||||
$group->input("flat_rate")->label(t("Flat Rate"))->id("gFlatRate")->value($postage->flat_rate);
|
||||
$group->input("per_item")->label(t("Per Item"))->id("gPetItem")->
|
||||
value($postage->per_item);
|
||||
|
||||
$group->submit("")->value(t("Modify Postage Band"));
|
||||
$form->add_rules_from($postage);
|
||||
return $form;
|
||||
}
|
||||
|
||||
|
||||
static function get_delete_form_admin($postage) {
|
||||
$form = new Forge("admin/postage_bands/delete_postage_band/$postage->id", "", "post",
|
||||
array("id" => "gDeletePostageForm"));
|
||||
$group = $form->group("delete_postage")->label(
|
||||
t("Are you sure you want to delete postage band %name?", array("name" => $postage->name)));
|
||||
$group->submit("")->value(t("Delete postage band %name", array("name" => $postage->name)));
|
||||
return $form;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new postage band
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $full_name
|
||||
* @param string $password
|
||||
* @return User_Model
|
||||
*/
|
||||
static function create($name, $flatrate, $peritemcost) {
|
||||
$postage = ORM::factory("postage_band")->where("name", $name)->find();
|
||||
if ($postage->loaded) {
|
||||
throw new Exception("@todo postage already EXISTS $name");
|
||||
}
|
||||
|
||||
$postage->name = $name;
|
||||
$postage->flat_rate = $flatrate;
|
||||
$postage->per_item = $peritemcost;
|
||||
|
||||
$postage->save();
|
||||
return $postage;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the array of postage bands
|
||||
* @return an array of postage bands
|
||||
*/
|
||||
static function getPostageArray(){
|
||||
$postagea = array();
|
||||
|
||||
$postages = ORM::factory("postage_band")->find_all();
|
||||
foreach ($postages as $postage){
|
||||
$show = true;
|
||||
$postagea[$postage->id] = $postage->name;
|
||||
}
|
||||
|
||||
return $postagea;
|
||||
}
|
||||
|
||||
}
|
@ -20,12 +20,15 @@
|
||||
class product_Core {
|
||||
|
||||
static function get_add_form_admin() {
|
||||
$form = new Forge("admin/product_lines/add_product", "", "post", array("id" => "gAddProductForm"));
|
||||
$form = new Forge("admin/product_lines/add_product", "", "post", array("id" => "g-add-product-form"));
|
||||
$group = $form->group("add_product")->label(t("Add Product"));
|
||||
$group->input("name")->label(t("Name"))->id("gProductName")
|
||||
$group->input("name")->label(t("Name"))->id("g-product-name")
|
||||
->error_messages("in_use", t("There is already a product with that name"));
|
||||
$group->input("cost")->label(t("Cost"))->id("gCost");
|
||||
$group->input("description")->label(t("Description"))->id("gDescription");
|
||||
$group->input("description")->label(t("Description"))->id("g-description");
|
||||
$group->dropdown("postage_band")
|
||||
->label(t("Postage Band"))
|
||||
->options(postage_band::getPostageArray());
|
||||
$group->submit("")->value(t("Add Product"));
|
||||
$product = ORM::factory("product");
|
||||
$form->add_rules_from($product);
|
||||
@ -34,14 +37,18 @@ class product_Core {
|
||||
|
||||
static function get_edit_form_admin($product) {
|
||||
$form = new Forge("admin/product_lines/edit_product/$product->id", "", "post",
|
||||
array("id" => "gEditProductForm"));
|
||||
array("id" => "g-edit-product-form"));
|
||||
$group = $form->group("edit_product")->label(t("Edit Product"));
|
||||
$group->input("name")->label(t("Name"))->id("gProductName")->value($product->name);
|
||||
$group->input("name")->label(t("Name"))->id("g-product-name")->value($product->name);
|
||||
$group->inputs["name"]->error_messages(
|
||||
"in_use", t("There is already a product with that name"));
|
||||
$group->input("cost")->label(t("Cost"))->id("gCost")->value($product->cost);
|
||||
$group->input("description")->label(t("Description"))->id("gDescription")->
|
||||
$group->input("cost")->label(t("Cost"))->id("g-cost")->value($product->cost);
|
||||
$group->input("description")->label(t("Description"))->id("g-description")->
|
||||
value($product->description);
|
||||
$group->dropdown("postage_band")
|
||||
->label(t("Postage Band"))
|
||||
->options(postage_band::getPostageArray())
|
||||
->selected($product->postage_band_id);
|
||||
|
||||
$group->submit("")->value(t("Modify Product"));
|
||||
$form->add_rules_from($product);
|
||||
@ -51,7 +58,7 @@ class product_Core {
|
||||
|
||||
static function get_delete_form_admin($product) {
|
||||
$form = new Forge("admin/product_lines/delete_product/$product->id", "", "post",
|
||||
array("id" => "gDeleteProductForm"));
|
||||
array("id" => "g-delete-product-form"));
|
||||
$group = $form->group("delete_product")->label(
|
||||
t("Are you sure you want to delete product %name?", array("name" => $product->name)));
|
||||
$group->submit("")->value(t("Delete product %name", array("name" => $product->name)));
|
||||
@ -66,7 +73,7 @@ class product_Core {
|
||||
* @param string $password
|
||||
* @return User_Model
|
||||
*/
|
||||
static function create($name, $cost, $description) {
|
||||
static function create($name, $cost, $description, $postage_band) {
|
||||
$product = ORM::factory("product")->where("name", $name)->find();
|
||||
if ($product->loaded) {
|
||||
throw new Exception("@todo USER_ALREADY_EXISTS $name");
|
||||
@ -75,7 +82,7 @@ class product_Core {
|
||||
$product->name = $name;
|
||||
$product->cost = $cost;
|
||||
$product->description = $description;
|
||||
|
||||
$product->postage_band_id = $postage_band;
|
||||
$product->save();
|
||||
return $product;
|
||||
}
|
||||
|
@ -64,6 +64,11 @@ class basket_item
|
||||
return $prod->description;
|
||||
}
|
||||
|
||||
public function getProduct(){
|
||||
$prod = ORM::factory("product", $this->product);
|
||||
return $prod;
|
||||
}
|
||||
|
||||
public function getCode(){
|
||||
$photo = ORM::factory("item", $this->item);
|
||||
$prod = ORM::factory("product", $this->product);
|
||||
@ -122,6 +127,32 @@ class Session_Basket_Core {
|
||||
unset($this->contents[$key]);
|
||||
}
|
||||
|
||||
public function postage_cost(){
|
||||
$postage_cost = 0;
|
||||
$postage_bands = array();
|
||||
$postage_quantities = array();
|
||||
if (isset($this->contents)){
|
||||
// create array of postage bands
|
||||
foreach ($this->contents as $product => $basket_item){
|
||||
$postage_band = $basket_item->getProduct()->postage_band;
|
||||
if (isset($postage_bands[$postage_band->id]))
|
||||
{
|
||||
$postage_quantities[$postage_band->id] += $basket_item->quantity;
|
||||
}
|
||||
else
|
||||
{
|
||||
$postage_quantities[$postage_band->id] = $basket_item->quantity;
|
||||
$postage_bands[$postage_band->id] = $postage_band;
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($postage_bands as $id => $postage_band){
|
||||
$postage_cost += $postage_band->flat_rate + ($postage_band->per_item * $postage_quantities[$id]);
|
||||
}
|
||||
}
|
||||
return $postage_cost;
|
||||
}
|
||||
|
||||
public function cost(){
|
||||
$cost = 0;
|
||||
if (isset($this->contents)){
|
||||
|
26
modules/basket/models/postage_band.php
Normal file
26
modules/basket/models/postage_band.php
Normal file
@ -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 Postage_Band_Model extends ORM {
|
||||
var $rules = array(
|
||||
"name" => "length[1,32]");
|
||||
|
||||
protected $has_many=array('products');
|
||||
|
||||
}
|
@ -21,4 +21,6 @@ class Product_Model extends ORM {
|
||||
var $rules = array(
|
||||
"name" => "length[1,32]",
|
||||
"description" => "length[0,255]");
|
||||
protected $belongs_to=array('postage_band');
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
name = "Shopping Basket"
|
||||
description = "Provides a simple shopping basket and checkout with paypal integration"
|
||||
version = 1
|
||||
version = 2
|
||||
|
@ -3,6 +3,6 @@
|
||||
<div id="add_to_basket">
|
||||
<a href="<?= url::site("basket/add_to_basket_ajax/$item->id") ?>"
|
||||
title="<?= t("Add To Basket") ?>"
|
||||
class="gDialogLink">
|
||||
class="g-dialog-link">
|
||||
Add To Basket</a>
|
||||
</div>
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gAddToBasket">
|
||||
<div id="g-add-to-basket">
|
||||
<div id="basketThumb">
|
||||
<img src="<?= $item->thumb_url()?>" title="<?= $item->title?>" alt="<?= $item->title?>" />
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gAdminConfigure">
|
||||
<div id="g-admin-configure">
|
||||
<h1> <?= t("Configure Shopping Basket") ?> </h1>
|
||||
<p>
|
||||
<?= t("Use this page to configure the shopping basket. If you have paypal you can use this to processs the final payments.") ?>
|
||||
|
70
modules/basket/views/admin_postage_bands.html.php
Normal file
70
modules/basket/views/admin_postage_bands.html.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?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.
|
||||
*/
|
||||
?>
|
||||
<div class="gBlock">
|
||||
|
||||
<a href="<?= url::site("admin/postage_bands/add_postage_band_form") ?>"
|
||||
class="gDialogLink gButtonLink right ui-icon-left ui-state-default ui-corner-all"
|
||||
title="<?= t("Create a new Postage Band") ?>">
|
||||
<span class="ui-icon ui-icon-circle-plus"></span>
|
||||
<?= t("Add a new Postage Band") ?>
|
||||
</a>
|
||||
|
||||
<h2>
|
||||
<?= t("Postage Bands") ?>
|
||||
</h2>
|
||||
|
||||
<div class="gBlockContent">
|
||||
<table id="gPostageAdminList">
|
||||
<tr>
|
||||
<th><?= t("Name") ?></th>
|
||||
<th><?= t("Flat Rate") ?></th>
|
||||
<th><?= t("Per Item") ?></th>
|
||||
<th><?= t("Actions") ?></th>
|
||||
|
||||
</tr>
|
||||
<? foreach ($postage_bands as $i => $postage_band): ?>
|
||||
<tr id="gProduct-<?= $postage_band->id ?>" class="<?= text::alternate("gOddRow", "gEvenRow") ?>">
|
||||
<td id="product-<?= $postage_band->id ?>" class="core-info ">
|
||||
<?= html::clean($postage_band->name) ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= basket::formatMoney($postage_band->flat_rate) ?>
|
||||
</td>
|
||||
<td>
|
||||
<?= basket::formatMoney($postage_band->per_item) ?>
|
||||
</td>
|
||||
<td class="gActions">
|
||||
<a href="<?= url::site("admin/postage_bands/edit_postage_band_form/$postage_band->id") ?>"
|
||||
open_text="<?= t("close") ?>"
|
||||
class="gPanelLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-pencil"></span><span class="gButtonText"><?= t("edit") ?></span></a>
|
||||
|
||||
<a href="<?= url::site("admin/postage_bands/delete_postage_band_form/$postage_band->id") ?>"
|
||||
class="gDialogLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span><?= t("delete") ?></a>
|
||||
</td>
|
||||
|
||||
</tr>
|
||||
<? endforeach ?>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
@ -18,10 +18,10 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
<div class="gBlock">
|
||||
<div class="g-block">
|
||||
|
||||
<a href="<?= url::site("admin/product_lines/add_product_form") ?>"
|
||||
class="gDialogLink gButtonLink right ui-icon-left ui-state-default ui-corner-all"
|
||||
class="g-dialog-link g-button g-right ui-icon-left ui-state-default ui-corner-all"
|
||||
title="<?= t("Create a new Product") ?>">
|
||||
<span class="ui-icon ui-icon-circle-plus"></span>
|
||||
<?= t("Add a new Product") ?>
|
||||
@ -31,17 +31,18 @@
|
||||
<?= t("Product Lines") ?>
|
||||
</h2>
|
||||
|
||||
<div class="gBlockContent">
|
||||
<table id="gProductAdminList">
|
||||
<div class="g-block-content">
|
||||
<table id="g-product-admin-list">
|
||||
<tr>
|
||||
<th><?= t("Name") ?></th>
|
||||
<th><?= t("Cost") ?></th>
|
||||
<th><?= t("Description") ?></th>
|
||||
<th><?= t("Postage Band") ?></th>
|
||||
<th><?= t("Actions") ?></th>
|
||||
|
||||
</tr>
|
||||
<? foreach ($products as $i => $product): ?>
|
||||
<tr id="gProduct-<?= $product->id ?>" class="<?= text::alternate("gOddRow", "gEvenRow") ?>">
|
||||
<tr id="g-product-<?= $product->id ?>" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td id="product-<?= $product->id ?>" class="core-info ">
|
||||
<?= html::clean($product->name) ?>
|
||||
</td>
|
||||
@ -51,14 +52,19 @@
|
||||
<td>
|
||||
<?= html::clean($product->description) ?>
|
||||
</td>
|
||||
<td class="gActions">
|
||||
<td>
|
||||
<?= html::clean($product->postage_band->name) ?>
|
||||
</td>
|
||||
|
||||
|
||||
<td class="g-actions">
|
||||
<a href="<?= url::site("admin/product_lines/edit_product_form/$product->id") ?>"
|
||||
open_text="<?= t("close") ?>"
|
||||
class="gPanelLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-pencil"></span><span class="gButtonText"><?= t("edit") ?></span></a>
|
||||
class="g-panel-link g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-pencil"></span><span class="g-button-text"><?= t("edit") ?></span></a>
|
||||
|
||||
<a href="<?= url::site("admin/product_lines/delete_product_form/$product->id") ?>"
|
||||
class="gDialogLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
class="g-dialog-link g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span><?= t("delete") ?></a>
|
||||
</td>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
<? if ($theme->page_type != 'basket'): ?>
|
||||
<? if ($theme->page_subtype != 'basket'): ?>
|
||||
<? if (isset($basket) && isset($basket->contents) && ($basket->size() > 0)): ?>
|
||||
<div id="basket">
|
||||
<a href="<?= url::site("basket/view_basket") ?>"
|
||||
|
@ -53,12 +53,12 @@ function so(){
|
||||
}
|
||||
}
|
||||
</SCRIPT>
|
||||
<div class="gBlock">
|
||||
<div class="g-block">
|
||||
<?= $form ?>
|
||||
<h2>Payment Details</h2>
|
||||
<p>After you have confirmed the order we will get in contact with you to arrange payment.</p>
|
||||
<a href="<?= url::site("basket/view_basket") ?>" class="left gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
<a href="<?= url::site("basket/view_basket") ?>" class="left g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-arrow-1-w"></span><?= t("Back to Basket") ?></a>
|
||||
<a href="javascript: so()" class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
<a href="javascript: so()" class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Proceed to Confirmation") ?></a>
|
||||
</div>
|
||||
|
@ -22,10 +22,10 @@
|
||||
function so(){document.confirm.submit();}
|
||||
</SCRIPT>
|
||||
<?= $form ?>
|
||||
<div class="gBlock">
|
||||
<div class="g-block">
|
||||
<h2>Basket Summary</h2>
|
||||
<div class="gBlockContent">
|
||||
<table id="gBasketList">
|
||||
<div class="g-block-content">
|
||||
<table id="g-basket-list">
|
||||
<tr>
|
||||
<th><?= t("Name") ?></th>
|
||||
<th><?= t("Product") ?></th>
|
||||
@ -33,8 +33,7 @@ function so(){document.confirm.submit();}
|
||||
<th><?= t("Cost") ?></th>
|
||||
</tr>
|
||||
<? foreach ($basket->contents as $key => $prod_details): ?>
|
||||
<tr id="" class="<?= text::alternate("gOddRow", "gEvenRow") ?>">
|
||||
|
||||
<tr id="" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td id="item-<?= $prod_details->item ?>" class="core-info ">
|
||||
<? $item = $prod_details->getItem(); ?>
|
||||
<div>
|
||||
@ -50,12 +49,17 @@ function so(){document.confirm.submit();}
|
||||
<td>
|
||||
<?= html::clean(basket::formatMoney($prod_details->cost)) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<? endforeach ?>
|
||||
<tr id="" class="<?= text::alternate("gOddRow", "gEvenRow") ?>">
|
||||
<td></td><td></td><td>Total Cost</td><td><?= html::clean($basket->cost())?></td>
|
||||
</tr>
|
||||
|
||||
<? endforeach ?>
|
||||
<? $postage = $basket->postage_cost();?>
|
||||
<? if ($postage > 0):?>
|
||||
<tr id="" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td></td><td></td><td>Postage and Packaging</td><td><?= html::clean(basket::formatMoney($postage))?></td><td></td>
|
||||
</tr>
|
||||
<? endif;?>
|
||||
<tr id="" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td></td><td></td><td>Total Cost</td><td><?= html::clean(basket::formatMoney($basket->cost() + $postage))?></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<table>
|
||||
@ -74,9 +78,9 @@ E-mail : <?= $basket->email ?><br/>
|
||||
Telephone : <?= $basket->phone ?>
|
||||
</td></tr>
|
||||
</table>
|
||||
<a href="<?= url::site("basket/checkout") ?>" class="left gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
<a href="<?= url::site("basket/checkout") ?>" class="g-left g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-arrow-1-w"></span><?= t("Back to Checkout") ?></a>
|
||||
<a href="javascript: so()" class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
<a href="javascript: so()" class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Confirm Order") ?></a>
|
||||
|
||||
</div>
|
||||
|
@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
<div class="gBlock">
|
||||
<div class="g-block">
|
||||
<h2>Thankyou for your order</h2>
|
||||
You will be contacted soon to arrange payment and delivery.
|
||||
</div>
|
@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
?>
|
||||
<div class="gBlock">
|
||||
<div class="g-block">
|
||||
<? if (isset($basket->contents ) && count($basket->contents) > 0): ?>
|
||||
|
||||
<? if (basket::isPaypal()): ?>
|
||||
@ -28,14 +28,14 @@
|
||||
var d=document.paypal_form.submit();
|
||||
}</script>
|
||||
<a href="javascript:co();"
|
||||
class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Pay with Credit Card or Paypal") ?></a>
|
||||
<a href="<?= url::site("basket/checkout") ?>"
|
||||
class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Pay off line") ?></a>
|
||||
<? else: ?>
|
||||
<a href="<?= url::site("basket/checkout") ?>"
|
||||
class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Proceed to Checkout") ?></a>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
@ -43,10 +43,10 @@
|
||||
<?= t("Shopping Basket") ?>
|
||||
</h2>
|
||||
|
||||
<div class="gBlockContent">
|
||||
<div class="g-block-content">
|
||||
<? if (isset($basket->contents ) && count($basket->contents) > 0): ?>
|
||||
|
||||
<table id="gBasketList">
|
||||
<table id="g-basket-list">
|
||||
<tr>
|
||||
<th><?= t("Picture") ?></th>
|
||||
<th><?= t("Product") ?></th>
|
||||
@ -58,7 +58,7 @@
|
||||
<? $total=0;?>
|
||||
|
||||
<? foreach ($basket->contents as $key => $prod_details): ?>
|
||||
<tr id="" class="<?= text::alternate("gOddRow", "gEvenRow") ?>">
|
||||
<tr id="" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
|
||||
<td id="item-<?= $prod_details->item ?>" class="core-info ">
|
||||
<? $item = $prod_details->getItem(); ?>
|
||||
@ -76,20 +76,26 @@
|
||||
<? $total += $prod_details->cost?>
|
||||
<?= html::clean(basket::formatMoney($prod_details->cost)) ?>
|
||||
</td>
|
||||
<td class="gActions">
|
||||
<td class="g-actions">
|
||||
<!-- a href="<?= url::site("admin/product_lines/edit_product_form/") ?>"
|
||||
open_text="<?= t("close") ?>"
|
||||
class="gPanelLink gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-pencil"></span><span class="gButtonText"><?= t("edit") ?></span></a-->
|
||||
class="g-panel-link g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-pencil"></span><span class="g-button-text"><?= t("edit") ?></span></a-->
|
||||
|
||||
<a href="<?= url::site("basket/remove_item/$key") ?>"
|
||||
class="gButtonLink ui-state-default ui-corner-all ui-icon-left">
|
||||
class="g-button ui-state-default ui-corner-all ui-icon-left">
|
||||
<span class="ui-icon ui-icon-trash"></span><?= t("Remove") ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<? endforeach ?>
|
||||
<tr id="" class="<?= text::alternate("gOddRow", "gEvenRow") ?>">
|
||||
<td></td><td></td><td>Total Cost</td><td><?= html::clean(basket::formatMoney($total))?></td><td></td>
|
||||
<? $postage = $basket->postage_cost();?>
|
||||
<? if ($postage > 0):?>
|
||||
<tr id="" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td></td><td></td><td>Postage and Packaging</td><td><?= html::clean(basket::formatMoney($postage))?></td><td></td>
|
||||
</tr>
|
||||
<? endif;?>
|
||||
<tr id="" class="<?= text::alternate("g-odd", "g-even") ?>">
|
||||
<td></td><td></td><td>Total Cost</td><td><?= html::clean(basket::formatMoney($total + $postage))?></td><td></td>
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
@ -103,14 +109,14 @@
|
||||
|
||||
<? if (basket::isPaypal()): ?>
|
||||
<a href="javascript:co();"
|
||||
class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Pay with Credit Card or Paypal") ?></a>
|
||||
<a href="<?= url::site("basket/checkout") ?>"
|
||||
class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Pay off line") ?></a>
|
||||
<? else: ?>
|
||||
<a href="<?= url::site("basket/checkout") ?>"
|
||||
class="right gButtonLink ui-state-default ui-corner-all ui-icon-right">
|
||||
class="g-right g-button ui-state-default ui-corner-all ui-icon-right">
|
||||
<span class="ui-icon ui-icon-arrow-1-e"></span><?= t("Proceed to Checkout") ?></a>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
|
@ -24,11 +24,23 @@ class BatchTag_Controller extends Controller {
|
||||
// Prevent Cross Site Request Forgery
|
||||
access::verify_csrf();
|
||||
|
||||
// Generate an array of all non-album items in the current album.
|
||||
$children = ORM::factory("item")
|
||||
->where("parent_id", $this->input->post("item_id"))
|
||||
->where("type !=", "album")
|
||||
->find_all();
|
||||
// Figure out if the contents of sub-albums should also be tagged
|
||||
$str_tag_subitems = Input::instance()->post("tag_subitems");
|
||||
|
||||
$children = "";
|
||||
if ($str_tag_subitems == false) {
|
||||
// Generate an array of all non-album items in the current album.
|
||||
$children = ORM::factory("item")
|
||||
->where("parent_id", $this->input->post("item_id"))
|
||||
->where("type !=", "album")
|
||||
->find_all();
|
||||
} else {
|
||||
// Generate an array of all non-album items in the current album
|
||||
// and any sub albums.
|
||||
$children = ORM::factory("item", $this->input->post("item_id"))
|
||||
->where("type !=", "album")
|
||||
->descendants();
|
||||
}
|
||||
|
||||
// Loop through each item in the album and make sure the user has
|
||||
// access to view and edit it.
|
||||
|
@ -17,38 +17,45 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class batchtag_theme_Core {
|
||||
static function sidebar_blocks($theme) {
|
||||
// Display form for tagging in the album sidebar.
|
||||
class batchtag_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("batch_tag" => t("Batch Tag"));
|
||||
}
|
||||
|
||||
// Make sure the current page belongs to an item.
|
||||
if (!$theme->item()) {
|
||||
static function get($block_id, $theme) {
|
||||
$block = "";
|
||||
|
||||
// Only display on album pages that the user can edit.
|
||||
$item = $theme->item();
|
||||
if (!$item || !$item->is_album() || !access::can("edit", $item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$item = $theme->item();
|
||||
|
||||
// Only display the form in albums that the user has edit permission in.
|
||||
if ($item->is_album() && access::can("edit", $item)) {
|
||||
|
||||
switch ($block_id) {
|
||||
case "batch_tag":
|
||||
// Make a new sidebar block.
|
||||
$block = new Block();
|
||||
$block->css_id = "gBatchTag";
|
||||
$block->css_id = "g-batch-tag";
|
||||
$block->title = t("Batch Tag");
|
||||
$block->content = new View("batchtag_block.html");
|
||||
|
||||
// Make a new form to place in the sidebar block.
|
||||
$form = new Forge("batchtag/tagitems", "", "post",
|
||||
array("id" => "gBatchTagForm"));
|
||||
array("id" => "g-batch-tag-form"));
|
||||
$label = t("Tag everything in this album:");
|
||||
$group = $form->group("add_tag")->label("Add Tag");
|
||||
$group->input("name")->label($label)->rules("required|length[1,64]");
|
||||
$group->checkbox("tag_subitems")
|
||||
->label(t("Include sub-albums?"))
|
||||
->value(true)
|
||||
->checked(false);
|
||||
|
||||
$group->hidden("item_id")->value($item->id);
|
||||
$group->submit("")->value(t("Add Tag"));
|
||||
$block->content->form = $form;
|
||||
$block->content->batch_tag_form = $form;
|
||||
|
||||
// Display the block.
|
||||
return $block;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
name = BatchTag
|
||||
description = Automatically apply a tag to the entire contents of an album.
|
||||
name = "BatchTag"
|
||||
description = "Automatically apply a tag to the entire contents of an album."
|
||||
version = 1
|
||||
|
@ -1,2 +1,2 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?= $form ?>
|
||||
<?= $batch_tag_form ?>
|
265
modules/calendarview/controllers/calendarview.php
Normal file
265
modules/calendarview/controllers/calendarview.php
Normal file
@ -0,0 +1,265 @@
|
||||
<?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 CalendarView_Controller extends Controller {
|
||||
public function calendar($display_year, $display_user) {
|
||||
// Draw a calendar for the year specified by $display_year.
|
||||
|
||||
// Make sure the function parameters aren't null,
|
||||
// give them default values if they are.
|
||||
if ($display_year == "") {
|
||||
$display_year = date('Y');
|
||||
}
|
||||
if ($display_user == "") {
|
||||
$display_user = "-1";
|
||||
}
|
||||
|
||||
// Draw the page.
|
||||
$template = new Theme_View("page.html", "other", "CalendarView");
|
||||
$template->css("calendarview_calendar.css");
|
||||
$template->set_global("calendar_user", $display_user);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
$template->content = new View("calendarview_year.html");
|
||||
$template->content->calendar_year = $display_year;
|
||||
$template->content->calendar_user = $display_user;
|
||||
$template->content->calendar_user_year_form = $this->_get_calenderprefs_form($display_year, $display_user);
|
||||
print $template;
|
||||
}
|
||||
|
||||
public function day($display_year, $display_user, $display_month, $display_day) {
|
||||
// Display all images for the specified day.
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = 0;
|
||||
if ($display_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
|
||||
// Figure out paging stuff.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
$page = (int) $this->input->get("page", "1");
|
||||
$offset = ($page-1) * $page_size;
|
||||
$max_pages = max(ceil($day_count / $page_size), 1);
|
||||
|
||||
// Make sure that the page references a valid offset
|
||||
if (($page < 1) || ($page > $max_pages)) {
|
||||
Kohana::show_404();
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
$template = new Theme_View("page.html", "collection", "CalendarDayView");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
if ($display_user == "-1") {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->orderby("captured", "ASC")
|
||||
->find_all($page_size, $offset));
|
||||
} else {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
||||
->orderby("captured", "ASC")
|
||||
->find_all($page_size, $offset));
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month));
|
||||
$fake_item = new Calendar_Breadcrumb($display_day, "");
|
||||
$template->set_global("item", $fake_item);
|
||||
$template->set_global("parents", $calendar_breadcrumbs);
|
||||
|
||||
// Finish setting up and then display the page.
|
||||
$template->set_global("children_count", $day_count);
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = t("Photos From ") . date("d", mktime(0, 0, 0, $display_month, $display_day, $display_year)) . " " . t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
print $template;
|
||||
}
|
||||
|
||||
public function month($display_year, $display_user, $display_month) {
|
||||
// Display all images for the specified month.
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = 0;
|
||||
if ($display_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
|
||||
// Figure out paging stuff.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
$page = (int) $this->input->get("page", "1");
|
||||
$offset = ($page-1) * $page_size;
|
||||
$max_pages = max(ceil($day_count / $page_size), 1);
|
||||
|
||||
// Make sure that the page references a valid offset
|
||||
if (($page < 1) || ($page > $max_pages)) {
|
||||
Kohana::show_404();
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
$template = new Theme_View("page.html", "collection", "CalendarMonthView");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
if ($display_user == "-1") {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->orderby("captured", "ASC")
|
||||
->find_all($page_size, $offset));
|
||||
} else {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->orderby("captured", "ASC")
|
||||
->find_all($page_size, $offset));
|
||||
}
|
||||
|
||||
// Set up breadcrumbs for this page.
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$fake_item = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), "");
|
||||
$template->set_global("item", $fake_item);
|
||||
$template->set_global("parents", $calendar_breadcrumbs);
|
||||
|
||||
// Finish setting up and then display the page.
|
||||
$template->set_global("children_count", $day_count);
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = t("Photos From ") . t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||
print $template;
|
||||
}
|
||||
|
||||
private function _get_calenderprefs_form($display_year, $display_user) {
|
||||
// Generate a form to allow the visitor to select a year and a gallery photo owner.
|
||||
$form = new Forge("calendarview/setprefs", "", "post",
|
||||
array("id" => "g-view-calendar-form"));
|
||||
|
||||
// Generate a list of all Gallery users who have uploaded photos.
|
||||
$valid_users[-1] = "(All Users)";
|
||||
$gallery_users = ORM::factory("user")->find_all();
|
||||
foreach ($gallery_users as $one_user) {
|
||||
$count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $one_user->id)
|
||||
->where("type !=", "album")
|
||||
->where("captured !=", "")
|
||||
->find_all()
|
||||
->count();
|
||||
if ($count > 0) {
|
||||
$valid_users[$one_user->id] = $one_user->full_name;
|
||||
}
|
||||
}
|
||||
|
||||
// Generate a list of years, starting with the year the earliest photo was
|
||||
// taken, and ending with the year of the most recent photo.
|
||||
$valid_years = Array();
|
||||
$all_photos = ORM::factory("item")
|
||||
->viewable()
|
||||
//->where("owner_id", $one_user->id)
|
||||
->where("type !=", "album")
|
||||
->where("captured !=", "")
|
||||
->orderby("captured", "DESC")
|
||||
->find_all();
|
||||
$counter = date('Y', $all_photos[count($all_photos)-1]->captured);
|
||||
while ($counter <= date('Y', $all_photos[0]->captured)) {
|
||||
$valid_years[$counter] = $counter;
|
||||
$counter++;
|
||||
}
|
||||
|
||||
// Create the form.
|
||||
$calendar_group = $form->group("CalendarPrefs");
|
||||
$calendar_group->dropdown('cal_user')
|
||||
->label(t("Display Photos From User: "))
|
||||
->options($valid_users)
|
||||
->selected($display_user);
|
||||
$calendar_group->dropdown('cal_year')
|
||||
->label(t("For Year: "))
|
||||
->options($valid_years)
|
||||
->selected($display_year);
|
||||
|
||||
// Add a save button to the form.
|
||||
$calendar_group->submit("SaveSettings")->value(t("Go"));
|
||||
|
||||
// Return the newly generated form.
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function setprefs() {
|
||||
// Change the calendar year and / or user.
|
||||
|
||||
// Prevent Cross Site Request Forgery
|
||||
access::verify_csrf();
|
||||
|
||||
// Get user specified settings.
|
||||
$str_user_id = Input::instance()->post("cal_user");
|
||||
$str_year_id = Input::instance()->post("cal_year");
|
||||
|
||||
// redirect to the currect page.
|
||||
url::redirect(url::site("calendarview/calendar/" . $str_year_id . "/" . $str_user_id));
|
||||
|
||||
}
|
||||
}
|
8
modules/calendarview/css/calendarview_calendar.css
Normal file
8
modules/calendarview/css/calendarview_calendar.css
Normal file
@ -0,0 +1,8 @@
|
||||
table.calendar { text-align: center; width:100px; }
|
||||
table.calendar caption { font-size: 1.5em; padding: 0.2em; }
|
||||
table.calendar th, table.calendar td { padding: 0.2em; background: #fff; border: 0; }
|
||||
table.calendar td:hover { background: #ddf; }
|
||||
table.calendar td.prev-next { background: #ccc; color: #999; }
|
||||
table.calendar td.today { color: #800; }
|
||||
#cal_user, #cal_year, #g-view-calendar-form li { display: inline; }
|
||||
#SaveSettings { float: right; }
|
3
modules/calendarview/css/calendarview_menu.css
Normal file
3
modules/calendarview/css/calendarview_menu.css
Normal file
@ -0,0 +1,3 @@
|
||||
#g-view-menu #g-calendarview-link {
|
||||
background-image: url('../images/ico-view-calendarview.png');
|
||||
}
|
44
modules/calendarview/helpers/calendarview_event.php
Normal file
44
modules/calendarview/helpers/calendarview_event.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?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 calendarview_event_Core {
|
||||
static function photo_menu($menu, $theme) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("calendarview")
|
||||
->label(t("View Calendar"))
|
||||
->url(url::site("calendarview/calendar/"))
|
||||
->css_id("g-calendarview-link"));
|
||||
}
|
||||
|
||||
static function movie_menu($menu, $theme) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("calendarview")
|
||||
->label(t("View Calendar"))
|
||||
->url(url::site("calendarview/calendar/"))
|
||||
->css_id("g-calendarview-link"));
|
||||
}
|
||||
|
||||
static function album_menu($menu, $theme) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("calendarview")
|
||||
->label(t("View Calendar"))
|
||||
->url(url::site("calendarview/calendar/"))
|
||||
->css_id("g-calendarview-link"));
|
||||
}
|
||||
}
|
25
modules/calendarview/helpers/calendarview_theme.php
Normal file
25
modules/calendarview/helpers/calendarview_theme.php
Normal file
@ -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 calendarview_theme_Core {
|
||||
|
||||
static function head($theme) {
|
||||
$theme->css("calendarview_menu.css");
|
||||
}
|
||||
}
|
BIN
modules/calendarview/images/ico-view-calendarview.png
Normal file
BIN
modules/calendarview/images/ico-view-calendarview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
362
modules/calendarview/libraries/Calendar.php
Normal file
362
modules/calendarview/libraries/Calendar.php
Normal file
@ -0,0 +1,362 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
/**
|
||||
* Calendar creation library.
|
||||
*
|
||||
* $Id: Calendar.php 3769 2008-12-15 00:48:56Z zombor $
|
||||
*
|
||||
* @package Calendar
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2007-2008 Kohana Team
|
||||
* @license http://kohanaphp.com/license.html
|
||||
*/
|
||||
class Calendar_Core extends Event_Subject {
|
||||
|
||||
// Start the calendar on Sunday by default
|
||||
public static $start_monday = FALSE;
|
||||
|
||||
// Month and year to use for calendaring
|
||||
protected $month;
|
||||
protected $year;
|
||||
|
||||
// Week starts on Sunday
|
||||
protected $week_start = 0;
|
||||
|
||||
// Observed data
|
||||
protected $observed_data;
|
||||
|
||||
/**
|
||||
* Returns an array of the names of the days, using the current locale.
|
||||
*
|
||||
* @param integer left of day names
|
||||
* @return array
|
||||
*/
|
||||
public static function days($length = TRUE)
|
||||
{
|
||||
// strftime day format
|
||||
$format = ($length > 3) ? '%A' : '%a';
|
||||
|
||||
// Days of the week
|
||||
$days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
|
||||
|
||||
if (Calendar::$start_monday === TRUE)
|
||||
{
|
||||
// Push Sunday to the end of the days
|
||||
array_push($days, array_shift($days));
|
||||
}
|
||||
|
||||
if (strpos(Kohana::config('locale.language.0'), 'en') !== 0)
|
||||
{
|
||||
// This is a bit awkward, but it works properly and is reliable
|
||||
foreach ($days as $i => $day)
|
||||
{
|
||||
// Convert the English names to i18n names
|
||||
$days[$i] = strftime($format, strtotime($day));
|
||||
}
|
||||
}
|
||||
|
||||
if (is_int($length) OR ctype_digit($length))
|
||||
{
|
||||
foreach ($days as $i => $day)
|
||||
{
|
||||
// Shorten the days to the expected length
|
||||
$days[$i] = utf8::substr($day, 0, $length);
|
||||
}
|
||||
}
|
||||
|
||||
return $days;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Calendar instance. A month and year can be specified.
|
||||
* By default, the current month and year are used.
|
||||
*
|
||||
* @param integer month number
|
||||
* @param integer year number
|
||||
* @return object
|
||||
*/
|
||||
public static function factory($month = NULL, $year = NULL)
|
||||
{
|
||||
return new Calendar($month, $year);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Calendar instance. A month and year can be specified.
|
||||
* By default, the current month and year are used.
|
||||
*
|
||||
* @param integer month number
|
||||
* @param integer year number
|
||||
* @return void
|
||||
*/
|
||||
public function __construct($month = NULL, $year = NULL)
|
||||
{
|
||||
empty($month) and $month = date('n'); // Current month
|
||||
empty($year) and $year = date('Y'); // Current year
|
||||
|
||||
// Set the month and year
|
||||
$this->month = (int) $month;
|
||||
$this->year = (int) $year;
|
||||
|
||||
if (Calendar::$start_monday === TRUE)
|
||||
{
|
||||
// Week starts on Monday
|
||||
$this->week_start = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows fetching the current month and year.
|
||||
*
|
||||
* @param string key to get
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($key)
|
||||
{
|
||||
if ($key === 'month' OR $key === 'year')
|
||||
{
|
||||
return $this->$key;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calendar_Event factory method.
|
||||
*
|
||||
* @param string unique name for the event
|
||||
* @return object Calendar_Event
|
||||
*/
|
||||
public function event($name = NULL)
|
||||
{
|
||||
return new Calendar_Event($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calendar_Event factory method.
|
||||
*
|
||||
* @chainable
|
||||
* @param string standard event type
|
||||
* @return object
|
||||
*/
|
||||
public function standard($name)
|
||||
{
|
||||
switch ($name)
|
||||
{
|
||||
case 'today':
|
||||
// Add an event for the current day
|
||||
$this->attach($this->event()->condition('timestamp', strtotime('today'))->add_class('today'));
|
||||
break;
|
||||
case 'prev-next':
|
||||
// Add an event for padding days
|
||||
$this->attach($this->event()->condition('current', FALSE)->add_class('prev-next'));
|
||||
break;
|
||||
case 'holidays':
|
||||
// Base event
|
||||
$event = $this->event()->condition('current', TRUE)->add_class('holiday');
|
||||
|
||||
// Attach New Years
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 1)->condition('day', 1));
|
||||
|
||||
// Attach Valentine's Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 2)->condition('day', 14));
|
||||
|
||||
// Attach St. Patrick's Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 3)->condition('day', 17));
|
||||
|
||||
// Attach Easter
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('easter', TRUE));
|
||||
|
||||
// Attach Memorial Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 5)->condition('day_of_week', 1)->condition('last_occurrence', TRUE));
|
||||
|
||||
// Attach Independance Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 7)->condition('day', 4));
|
||||
|
||||
// Attach Labor Day
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 9)->condition('day_of_week', 1)->condition('occurrence', 1));
|
||||
|
||||
// Attach Halloween
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 10)->condition('day', 31));
|
||||
|
||||
// Attach Thanksgiving
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 11)->condition('day_of_week', 4)->condition('occurrence', 4));
|
||||
|
||||
// Attach Christmas
|
||||
$holiday = clone $event;
|
||||
$this->attach($holiday->condition('month', 12)->condition('day', 25));
|
||||
break;
|
||||
case 'weekends':
|
||||
// Weekend events
|
||||
$this->attach($this->event()->condition('weekend', TRUE)->add_class('weekend'));
|
||||
break;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array for use with a view. The array contains an array for
|
||||
* each week. Each week contains 7 arrays, with a day number and status:
|
||||
* TRUE if the day is in the month, FALSE if it is padding.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function weeks()
|
||||
{
|
||||
// First day of the month as a timestamp
|
||||
$first = mktime(1, 0, 0, $this->month, 1, $this->year);
|
||||
|
||||
// Total number of days in this month
|
||||
$total = (int) date('t', $first);
|
||||
|
||||
// Last day of the month as a timestamp
|
||||
$last = mktime(1, 0, 0, $this->month, $total, $this->year);
|
||||
|
||||
// Make the month and week empty arrays
|
||||
$month = $week = array();
|
||||
|
||||
// Number of days added. When this reaches 7, start a new week
|
||||
$days = 0;
|
||||
$week_number = 1;
|
||||
|
||||
if (($w = (int) date('w', $first) - $this->week_start) < 0)
|
||||
{
|
||||
$w = 6;
|
||||
}
|
||||
|
||||
if ($w > 0)
|
||||
{
|
||||
// Number of days in the previous month
|
||||
$n = (int) date('t', mktime(1, 0, 0, $this->month - 1, 1, $this->year));
|
||||
|
||||
// i = number of day, t = number of days to pad
|
||||
for ($i = $n - $w + 1, $t = $w; $t > 0; $t--, $i++)
|
||||
{
|
||||
// Notify the listeners
|
||||
$this->notify(array($this->month - 1, $i, $this->year, $week_number, FALSE));
|
||||
|
||||
// Add previous month padding days
|
||||
$week[] = array($i, FALSE, $this->observed_data);
|
||||
$days++;
|
||||
}
|
||||
}
|
||||
|
||||
// i = number of day
|
||||
for ($i = 1; $i <= $total; $i++)
|
||||
{
|
||||
if ($days % 7 === 0)
|
||||
{
|
||||
// Start a new week
|
||||
$month[] = $week;
|
||||
$week = array();
|
||||
|
||||
$week_number++;
|
||||
}
|
||||
|
||||
// Notify the listeners
|
||||
$this->notify(array($this->month, $i, $this->year, $week_number, TRUE));
|
||||
|
||||
// Add days to this month
|
||||
$week[] = array($i, TRUE, $this->observed_data);
|
||||
$days++;
|
||||
}
|
||||
|
||||
if (($w = (int) date('w', $last) - $this->week_start) < 0)
|
||||
{
|
||||
$w = 6;
|
||||
}
|
||||
|
||||
if ($w >= 0)
|
||||
{
|
||||
// i = number of day, t = number of days to pad
|
||||
for ($i = 1, $t = 6 - $w; $t > 0; $t--, $i++)
|
||||
{
|
||||
// Notify the listeners
|
||||
$this->notify(array($this->month + 1, $i, $this->year, $week_number, FALSE));
|
||||
|
||||
// Add next month padding days
|
||||
$week[] = array($i, FALSE, $this->observed_data);
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty($week))
|
||||
{
|
||||
// Append the remaining days
|
||||
$month[] = $week;
|
||||
}
|
||||
|
||||
return $month;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds new data from an observer. All event data contains and array of CSS
|
||||
* classes and an array of output messages.
|
||||
*
|
||||
* @param array observer data.
|
||||
* @return void
|
||||
*/
|
||||
public function add_data(array $data)
|
||||
{
|
||||
// Add new classes
|
||||
$this->observed_data['classes'] += $data['classes'];
|
||||
|
||||
if ( ! empty($data['output']))
|
||||
{
|
||||
// Only add output if it's not empty
|
||||
$this->observed_data['output'][] = $data['output'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the observed data and sends a notify to all attached events.
|
||||
*
|
||||
* @param array UNIX timestamp
|
||||
* @return void
|
||||
*/
|
||||
public function notify($data)
|
||||
{
|
||||
// Reset observed data
|
||||
$this->observed_data = array
|
||||
(
|
||||
'classes' => array(),
|
||||
'output' => array(),
|
||||
);
|
||||
|
||||
// Send a notify
|
||||
parent::notify($data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the calendar to HTML using the kohana_calendar view.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$view = new View('kohana_calendar', array
|
||||
(
|
||||
'month' => $this->month,
|
||||
'year' => $this->year,
|
||||
'weeks' => $this->weeks(),
|
||||
));
|
||||
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Magically convert this object to a string, the rendered calendar.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->render();
|
||||
}
|
||||
|
||||
} // End Calendar
|
47
modules/calendarview/libraries/Calendar_Breadcrumb.php
Normal file
47
modules/calendarview/libraries/Calendar_Breadcrumb.php
Normal 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-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 Calendar_Breadcrumb_Core {
|
||||
// Creates a class to maintain a single breadcrumb.
|
||||
// Multiple breadcrumbs can be achieved by createing an array of this class type.
|
||||
public $title = "";
|
||||
public $id = 0;
|
||||
public $url = "";
|
||||
|
||||
public function __construct($new_title, $new_url) {
|
||||
$this->title = $new_title;
|
||||
$this->url = $new_url;
|
||||
}
|
||||
|
||||
public function url($query=null) {
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function parent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function is_album() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function is_photo() {
|
||||
return false;
|
||||
}
|
||||
}
|
307
modules/calendarview/libraries/Calendar_Event.php
Normal file
307
modules/calendarview/libraries/Calendar_Event.php
Normal file
@ -0,0 +1,307 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
/**
|
||||
* Calendar event observer class.
|
||||
*
|
||||
* $Id: Calendar_Event.php 4129 2009-03-27 17:47:03Z zombor $
|
||||
*
|
||||
* @package Calendar
|
||||
* @author Kohana Team
|
||||
* @copyright (c) 2007-2008 Kohana Team
|
||||
* @license http://kohanaphp.com/license.html
|
||||
*/
|
||||
class Calendar_Event_Core extends Event_Observer {
|
||||
|
||||
// Boolean conditions
|
||||
protected $booleans = array
|
||||
(
|
||||
'current',
|
||||
'weekend',
|
||||
'first_day',
|
||||
'last_day',
|
||||
'last_occurrence',
|
||||
'easter',
|
||||
);
|
||||
|
||||
// Rendering conditions
|
||||
protected $conditions = array();
|
||||
|
||||
// Cell classes
|
||||
protected $classes = array();
|
||||
|
||||
// Cell output
|
||||
protected $output = '';
|
||||
|
||||
/**
|
||||
* Adds a condition to the event. The condition can be one of the following:
|
||||
*
|
||||
* timestamp - UNIX timestamp
|
||||
* day - day number (1-31)
|
||||
* week - week number (1-5)
|
||||
* month - month number (1-12)
|
||||
* year - year number (4 digits)
|
||||
* day_of_week - day of week (1-7)
|
||||
* current - active month (boolean) (only show data for the month being rendered)
|
||||
* weekend - weekend day (boolean)
|
||||
* first_day - first day of month (boolean)
|
||||
* last_day - last day of month (boolean)
|
||||
* occurrence - occurrence of the week day (1-5) (use with "day_of_week")
|
||||
* last_occurrence - last occurrence of week day (boolean) (use with "day_of_week")
|
||||
* easter - Easter day (boolean)
|
||||
* callback - callback test (boolean)
|
||||
*
|
||||
* To unset a condition, call condition with a value of NULL.
|
||||
*
|
||||
* @chainable
|
||||
* @param string condition key
|
||||
* @param mixed condition value
|
||||
* @return object
|
||||
*/
|
||||
public function condition($key, $value)
|
||||
{
|
||||
if ($value === NULL)
|
||||
{
|
||||
unset($this->conditions[$key]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($key === 'callback')
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
elseif (in_array($key, $this->booleans))
|
||||
{
|
||||
// Make the value boolean
|
||||
$value = (bool) $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Make the value an int
|
||||
$value = (int) $value;
|
||||
}
|
||||
|
||||
$this->conditions[$key] = $value;
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CSS class for this event. This can be called multiple times.
|
||||
*
|
||||
* @chainable
|
||||
* @param string CSS class name
|
||||
* @return object
|
||||
*/
|
||||
public function add_class($class)
|
||||
{
|
||||
$this->classes[$class] = $class;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a CSS class for this event. This can be called multiple times.
|
||||
*
|
||||
* @chainable
|
||||
* @param string CSS class name
|
||||
* @return object
|
||||
*/
|
||||
public function remove_class($class)
|
||||
{
|
||||
unset($this->classes[$class]);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set HTML output for this event.
|
||||
*
|
||||
* @chainable
|
||||
* @param string HTML output
|
||||
* @return object
|
||||
*/
|
||||
public function output($str)
|
||||
{
|
||||
$this->output = $str;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a CSS class for this event. This can be called multiple times.
|
||||
*
|
||||
* @chainable
|
||||
* @param string CSS class name
|
||||
* @return object
|
||||
*/
|
||||
public function notify($data)
|
||||
{
|
||||
// Split the date and current status
|
||||
list ($month, $day, $year, $week, $current) = $data;
|
||||
|
||||
// Get a timestamp for the day
|
||||
$timestamp = mktime(0, 0, 0, $month, $day, $year);
|
||||
|
||||
// Date conditionals
|
||||
$condition = array
|
||||
(
|
||||
'timestamp' => (int) $timestamp,
|
||||
'day' => (int) date('j', $timestamp),
|
||||
'week' => (int) $week,
|
||||
'month' => (int) date('n', $timestamp),
|
||||
'year' => (int) date('Y', $timestamp),
|
||||
'day_of_week' => (int) date('w', $timestamp),
|
||||
'current' => (bool) $current,
|
||||
);
|
||||
|
||||
// Tested conditions
|
||||
$tested = array();
|
||||
|
||||
foreach ($condition as $key => $value)
|
||||
{
|
||||
// Timestamps need to be handled carefully
|
||||
if($key === 'timestamp' AND isset($this->conditions['timestamp']))
|
||||
{
|
||||
// This adds 23 hours, 59 minutes and 59 seconds to today's timestamp, as 24 hours
|
||||
// is classed as a new day
|
||||
$next_day = $timestamp + 86399;
|
||||
|
||||
if($this->conditions['timestamp'] < $timestamp OR $this->conditions['timestamp'] > $next_day)
|
||||
return FALSE;
|
||||
}
|
||||
// Test basic conditions first
|
||||
elseif (isset($this->conditions[$key]) AND $this->conditions[$key] !== $value)
|
||||
return FALSE;
|
||||
|
||||
// Condition has been tested
|
||||
$tested[$key] = TRUE;
|
||||
}
|
||||
|
||||
if (isset($this->conditions['weekend']))
|
||||
{
|
||||
// Weekday vs Weekend
|
||||
$condition['weekend'] = ($condition['day_of_week'] === 0 OR $condition['day_of_week'] === 6);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['first_day']))
|
||||
{
|
||||
// First day of month
|
||||
$condition['first_day'] = ($condition['day'] === 1);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['last_day']))
|
||||
{
|
||||
// Last day of month
|
||||
$condition['last_day'] = ($condition['day'] === (int) date('t', $timestamp));
|
||||
}
|
||||
|
||||
if (isset($this->conditions['occurrence']))
|
||||
{
|
||||
// Get the occurance of the current day
|
||||
$condition['occurrence'] = $this->day_occurrence($timestamp);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['last_occurrence']))
|
||||
{
|
||||
// Test if the next occurance of this date is next month
|
||||
$condition['last_occurrence'] = ((int) date('n', $timestamp + 604800) !== $condition['month']);
|
||||
}
|
||||
|
||||
if (isset($this->conditions['easter']))
|
||||
{
|
||||
if ($condition['month'] === 3 OR $condition['month'] === 4)
|
||||
{
|
||||
// This algorithm is from Practical Astronomy With Your Calculator, 2nd Edition by Peter
|
||||
// Duffett-Smith. It was originally from Butcher's Ecclesiastical Calendar, published in
|
||||
// 1876. This algorithm has also been published in the 1922 book General Astronomy by
|
||||
// Spencer Jones; in The Journal of the British Astronomical Association (Vol.88, page
|
||||
// 91, December 1977); and in Astronomical Algorithms (1991) by Jean Meeus.
|
||||
|
||||
$a = $condition['year'] % 19;
|
||||
$b = (int) ($condition['year'] / 100);
|
||||
$c = $condition['year'] % 100;
|
||||
$d = (int) ($b / 4);
|
||||
$e = $b % 4;
|
||||
$f = (int) (($b + 8) / 25);
|
||||
$g = (int) (($b - $f + 1) / 3);
|
||||
$h = (19 * $a + $b - $d - $g + 15) % 30;
|
||||
$i = (int) ($c / 4);
|
||||
$k = $c % 4;
|
||||
$l = (32 + 2 * $e + 2 * $i - $h - $k) % 7;
|
||||
$m = (int) (($a + 11 * $h + 22 * $l) / 451);
|
||||
$p = ($h + $l - 7 * $m + 114) % 31;
|
||||
|
||||
$month = (int) (($h + $l - 7 * $m + 114) / 31);
|
||||
$day = $p + 1;
|
||||
|
||||
$condition['easter'] = ($condition['month'] === $month AND $condition['day'] === $day);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Easter can only happen in March or April
|
||||
$condition['easter'] = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->conditions['callback']))
|
||||
{
|
||||
// Use a callback to determine validity
|
||||
$condition['callback'] = call_user_func($this->conditions['callback'], $condition, $this);
|
||||
}
|
||||
|
||||
$conditions = array_diff_key($this->conditions, $tested);
|
||||
|
||||
foreach ($conditions as $key => $value)
|
||||
{
|
||||
if ($key === 'callback')
|
||||
{
|
||||
// Callbacks are tested on a TRUE/FALSE basis
|
||||
$value = TRUE;
|
||||
}
|
||||
|
||||
// Test advanced conditions
|
||||
if ($condition[$key] !== $value)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->caller->add_data(array
|
||||
(
|
||||
'classes' => $this->classes,
|
||||
'output' => $this->output,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the week day occurrence for a specific timestamp. The occurrence is
|
||||
* relative to the current month. For example, the second Saturday of any
|
||||
* given month will return "2" as the occurrence. This is used in combination
|
||||
* with the "occurrence" condition.
|
||||
*
|
||||
* @param integer UNIX timestamp
|
||||
* @return integer
|
||||
*/
|
||||
protected function day_occurrence($timestamp)
|
||||
{
|
||||
// Get the current month for the timestamp
|
||||
$month = date('m', $timestamp);
|
||||
|
||||
// Default occurrence is one
|
||||
$occurrence = 1;
|
||||
|
||||
// Reduce the timestamp by one week for each loop. This has the added
|
||||
// benefit of preventing an infinite loop.
|
||||
while ($timestamp -= 604800)
|
||||
{
|
||||
if (date('m', $timestamp) !== $month)
|
||||
{
|
||||
// Once the timestamp has gone into the previous month, the
|
||||
// proper occurrence has been found.
|
||||
return $occurrence;
|
||||
}
|
||||
|
||||
// Increment the occurrence
|
||||
$occurrence++;
|
||||
}
|
||||
}
|
||||
|
||||
} // End Calendar Event
|
3
modules/calendarview/module.info
Normal file
3
modules/calendarview/module.info
Normal file
@ -0,0 +1,3 @@
|
||||
name = "CalendarView"
|
||||
description = "View your photos by the date they were taken."
|
||||
version = 1
|
184
modules/calendarview/views/calendarview_year.html.php
Normal file
184
modules/calendarview/views/calendarview_year.html.php
Normal file
@ -0,0 +1,184 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<h1 align="center"><?=t($calendar_year) ?></h1>
|
||||
<?= $calendar_user_year_form ?>
|
||||
|
||||
<?
|
||||
print "<table><tr>";
|
||||
$counter_months = 1;
|
||||
// Loop through each month in the current year.
|
||||
while ($counter_months <12) {
|
||||
print "<td>";
|
||||
$calendar = new Calendar($counter_months, $calendar_year);
|
||||
|
||||
// Figure out if any photos were taken for the current month.
|
||||
if ($calendar_user == "-1") {
|
||||
$month_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$month_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, $counter_months+1, 1, $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
|
||||
// If there are photos, loop through each day in the month and display links on the correct dates.
|
||||
if ($month_count > 0) {
|
||||
$curr_day = 1;
|
||||
$MAX_DAYS = date('t', mktime(00, 00, 00, $counter_months, 1, $calendar_year));
|
||||
while ($curr_day < $MAX_DAYS) {
|
||||
if ($calendar_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $curr_day)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day), $day_count)));
|
||||
}
|
||||
$curr_day++;
|
||||
}
|
||||
|
||||
// Do the last day of the month seperately, because the mktime code is different.
|
||||
if ($calendar_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, ($counter_months + 1), 1, $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $MAX_DAYS)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS), $day_count)));
|
||||
}
|
||||
}
|
||||
echo $calendar->render();
|
||||
print "</td>";
|
||||
if (($counter_months == 3) || ($counter_months == 6) || ($counter_months == 9)) {
|
||||
print "</tr><tr>";
|
||||
}
|
||||
$counter_months++;
|
||||
}
|
||||
|
||||
// Do December seperately, because the mktime code is different.
|
||||
print "<td>";
|
||||
$calendar = new Calendar($counter_months, $calendar_year);
|
||||
if ($calendar_user == "-1") {
|
||||
$month_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$month_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, 1, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, 1, 1, ($calendar_year + 1)))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
if ($month_count > 0) {
|
||||
$curr_day = 1;
|
||||
$MAX_DAYS = date('t', mktime(00, 00, 00, $counter_months, 1, $calendar_year));
|
||||
while ($curr_day < $MAX_DAYS) {
|
||||
if ($calendar_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $curr_day, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, $counter_months, ($curr_day + 1), $calendar_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $curr_day)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $curr_day), $day_count)));
|
||||
}
|
||||
$curr_day++;
|
||||
}
|
||||
if ($calendar_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, 1, 1, $calendar_year+1))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $calendar_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $counter_months, $MAX_DAYS, $calendar_year))
|
||||
->where("captured <", mktime(0, 0, 0, 1, 1, $calendar_year+1))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
if ($day_count > 0) {
|
||||
$calendar -> attach($calendar -> event()
|
||||
-> condition('year', $calendar_year)
|
||||
-> condition('month', $counter_months)
|
||||
-> condition('day', $MAX_DAYS)
|
||||
-> output(html::anchor(url::site("calendarview/day/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/" . $MAX_DAYS), $day_count)));
|
||||
|
||||
}
|
||||
}
|
||||
$counter_months++;
|
||||
echo $calendar->render();
|
||||
print "</td></tr></table>";
|
||||
?>
|
56
modules/calendarview/views/kohana_calendar.php
Normal file
56
modules/calendarview/views/kohana_calendar.php
Normal file
@ -0,0 +1,56 @@
|
||||
<?php defined('SYSPATH') OR die('No direct access allowed.');
|
||||
|
||||
// Get the day names
|
||||
$days = Calendar::days(2);
|
||||
|
||||
// Previous and next month timestamps
|
||||
$next = mktime(0, 0, 0, $month + 1, 1, $year);
|
||||
$prev = mktime(0, 0, 0, $month - 1, 1, $year);
|
||||
|
||||
// Import the GET query array locally and remove the day
|
||||
$qs = $_GET;
|
||||
unset($qs['day']);
|
||||
|
||||
// Previous and next month query URIs
|
||||
$prev = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $prev), 'year' => date('Y', $prev))));
|
||||
$next = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month' => date('n', $next), 'year' => date('Y', $next))));
|
||||
|
||||
?>
|
||||
<table class="calendar">
|
||||
<tr class="controls">
|
||||
<td class="title" colspan="7" align="center">
|
||||
<a href="<? print url::site("calendarview/month/" . $year . "/" . $calendar_user . "/" . $month ) ?>"><?php print t(strftime('%B', mktime(0, 0, 0, $month, 1, $year))) . " " . t(strftime('%Y', mktime(0, 0, 0, $month, 1, $year))) ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php foreach ($days as $day): ?>
|
||||
<th><?php echo t($day) ?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php foreach ($weeks as $week): ?>
|
||||
<tr>
|
||||
<?php foreach ($week as $day):
|
||||
|
||||
list ($number, $current, $data) = $day;
|
||||
|
||||
if (is_array($data))
|
||||
{
|
||||
$classes = $data['classes'];
|
||||
$output = empty($data['output']) ? '' : '<ul class="output"><li>'.implode('</li><li>', $data['output']).'</li></ul>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$classes = array();
|
||||
$output = '';
|
||||
}
|
||||
|
||||
?>
|
||||
<? if ($day[1] == true) { ?>
|
||||
<td class="<?php echo implode(' ', $classes) ?>"><span class="day"><?php echo $day[0] ?></span><?php echo $output ?></td>
|
||||
<? } else { ?>
|
||||
<td></td>
|
||||
<? } ?>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
@ -67,7 +67,7 @@ class Admin_ContactOwner_Controller extends Admin_Controller {
|
||||
private function _get_admin_form() {
|
||||
// Make a new Form.
|
||||
$form = new Forge("admin/contactowner/saveprefs", "", "post",
|
||||
array("id" => "gContactOwnerAdminForm"));
|
||||
array("id" => "g-contact-owner-adminForm"));
|
||||
|
||||
// Make an array for the different types of link codes.
|
||||
$add_contactlinks = $form->group("contactOwnerLinks");
|
||||
|
@ -28,10 +28,11 @@ class ContactOwner_Controller extends Controller {
|
||||
|
||||
// Make a new form with a couple of text boxes.
|
||||
$form = new Forge("contactowner/sendemail", "", "post",
|
||||
array("id" => "gContactOwnerSendForm"));
|
||||
array("id" => "g-contact-owner-send-form"));
|
||||
$sendmail_fields = $form->group("contactOwner");
|
||||
$sendmail_fields->input("email_to")->label(t("To:"))->value(module::get_var("contactowner", "contact_owner_name"));
|
||||
$sendmail_fields->input("email_from")->label(t("From:"))->value(user::active()->email);
|
||||
$sendmail_fields->input("email_from")->label(t("From:"))->value(identity::active_user()->email);
|
||||
|
||||
$sendmail_fields->input("email_subject")->label(t("Subject:"))->value("");
|
||||
$sendmail_fields->textarea("email_body")->label(t("Message:"))->value("");
|
||||
$sendmail_fields->hidden("email_to_id")->value("-1");
|
||||
@ -40,7 +41,7 @@ class ContactOwner_Controller extends Controller {
|
||||
$sendmail_fields->submit("SendMessage")->value(t("Send"));
|
||||
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("page.html", "Contact");
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = $form;
|
||||
print $template;
|
||||
@ -62,10 +63,10 @@ class ContactOwner_Controller extends Controller {
|
||||
|
||||
// Make a new form with a couple of text boxes.
|
||||
$form = new Forge("contactowner/sendemail", "", "post",
|
||||
array("id" => "gContactOwnerSendForm"));
|
||||
array("id" => "g-contact-owner-send-form"));
|
||||
$sendmail_fields = $form->group("contactOwner");
|
||||
$sendmail_fields->input("email_to")->label(t("To:"))->value($userDetails[0]->name);
|
||||
$sendmail_fields->input("email_from")->label(t("From:"))->value(user::active()->email);
|
||||
$sendmail_fields->input("email_from")->label(t("From:"))->value(identity::active_user()->email);
|
||||
$sendmail_fields->input("email_subject")->label(t("Subject:"))->value("");
|
||||
$sendmail_fields->textarea("email_body")->label(t("Message:"))->value("");
|
||||
$sendmail_fields->hidden("email_to_id")->value($user_id);
|
||||
@ -74,7 +75,7 @@ class ContactOwner_Controller extends Controller {
|
||||
$sendmail_fields->submit("SendMessage")->value(t("Send"));
|
||||
|
||||
// Set up and display the actual page.
|
||||
$template = new Theme_View("page.html", "Contact");
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = $form;
|
||||
print $template;
|
||||
@ -121,7 +122,7 @@ class ContactOwner_Controller extends Controller {
|
||||
->send();
|
||||
|
||||
// Display a message telling the visitor that their email has been sent.
|
||||
$template = new Theme_View("page.html", "Contact");
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
$template->content = new View("contactowner_emailform.html");
|
||||
$template->content->sendmail_form = t("Your Message Has Been Sent.");
|
||||
print $template;
|
||||
|
78
modules/contactowner/helpers/contactowner_block.php
Normal file
78
modules/contactowner/helpers/contactowner_block.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?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 contactowner_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("contact_owner" => t("Contact Owner"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$block = "";
|
||||
|
||||
switch ($block_id) {
|
||||
case "contact_owner":
|
||||
|
||||
// Create a new block to display the links in.
|
||||
$block = new Block();
|
||||
$block->css_id = "g-contact-owner";
|
||||
$block->title = t("Contact");
|
||||
$block->content = new View("contactowner_block.html");
|
||||
|
||||
// if $displayBlock is true, this block will be displayed,
|
||||
// if there aren't any links to put in the block for whatever reason
|
||||
// then $displayBlock will rename set to false and the
|
||||
// block will not be displayed.
|
||||
$displayBlock = false;
|
||||
|
||||
if ($theme->item()) {
|
||||
// Locate the record for the user that created the current item.
|
||||
// Their name will be displayed as part of the contact link.
|
||||
$userDetails = ORM::factory("user")
|
||||
->where("id", $theme->item->owner_id)
|
||||
->find_all();
|
||||
|
||||
// Figure out if the contact item owner email link should be displayed.
|
||||
// only display it if the current owner has an email address and
|
||||
// the option for allowing item owners to be contacted is set to true.
|
||||
if ((count($userDetails) > 0) && ($userDetails[0]->email != "") &&
|
||||
(module::get_var("contactowner", "contact_user_link") == true)) {
|
||||
$block->content->userLink = "<a href=\"" . url::site("contactowner/emailid/" .
|
||||
$theme->item->owner_id) . "\">" . t("Contact") . " " .
|
||||
$userDetails[0]->name . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Figure out if the contact site owner link should be displayed.
|
||||
if (module::get_var("contactowner", "contact_owner_link")) {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if ($displayBlock) {
|
||||
return $block;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
<?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 contactowner_theme_Core {
|
||||
|
||||
static function sidebar_blocks($theme) {
|
||||
// Display links in the Gallery sidebar to allow a
|
||||
// visitor to send an email.
|
||||
|
||||
// Make sure the current page belongs to an item.
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Locate the record for the user that created the current item.
|
||||
// Their name will be displayed as part of the contact link.
|
||||
$userDetails = ORM::factory("user")
|
||||
->where("id", $theme->item->owner_id)
|
||||
->find_all();
|
||||
|
||||
// Create a new block to display the links in.
|
||||
$block = new Block();
|
||||
$block->css_id = "gContactOwner";
|
||||
$block->title = t("Contact:");
|
||||
$block->content = new View("contactowner_block.html");
|
||||
|
||||
// if $displayBlock is true, this block will be displayed,
|
||||
// if there aren't any links to put in the block for whatever reason
|
||||
// then $displayBlock will rename set to false and the
|
||||
// block will not be displayed.
|
||||
$displayBlock = false;
|
||||
|
||||
// Figure out if the contact item owner email link should be displayed.
|
||||
// only display it if the current owner has an email address and
|
||||
// the option for allowing item owners to be contacted is set to true.
|
||||
if ((count($userDetails) > 0) && ($userDetails[0]->email != "") &&
|
||||
(module::get_var("contactowner", "contact_user_link") == true)) {
|
||||
$block->content->userLink = "<a href=\"" . url::site("contactowner/emailid/" .
|
||||
$theme->item->owner_id) . "\">" . t("Contact") . " " . $userDetails[0]->name . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
|
||||
// Figure out if the contact site owner link should be displayed.
|
||||
if (module::get_var("contactowner", "contact_owner_link")) {
|
||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
||||
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
|
||||
$displayBlock = true;
|
||||
}
|
||||
|
||||
if ($displayBlock) {
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
name = ContactOwner
|
||||
description = Allows visitors to send the website owner an email.
|
||||
name = "ContactOwner"
|
||||
description = "Allows visitors to send the website owner an email."
|
||||
version = 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gContactOwnerAdmin">
|
||||
<div id="g-contact-owner-admin">
|
||||
<h2> <?= t("Contact Owner Settings") ?> </h2>
|
||||
<?= $contactowner_form ?>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul id="gContactOwner">
|
||||
<ul id="g-contact-owner">
|
||||
<? if ($ownerLink != "") { ?>
|
||||
<li style="clear: both;">
|
||||
<? print ($ownerLink); ?>
|
||||
|
@ -49,9 +49,9 @@ $config["methods"] = array(
|
||||
"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"),
|
||||
"event" => array("admin_menu" => t("Add an admin menu element"),
|
||||
"album_menu" => t("Add an album menu element"),
|
||||
"batch_complete" => t("Batch completion"),
|
||||
"comment_add_form" => t("Comment add form creation"),
|
||||
"comment_created" => t("Comment created"),
|
||||
"comment_updated" => t("Comment updated"),
|
||||
@ -62,8 +62,9 @@ $config["methods"] = array(
|
||||
"item_related_update" => t("Photo meta data update"),
|
||||
"item_related_update_batch" => t("Photo meta data update"),
|
||||
"item_updated" => t("Album or photo update"),
|
||||
"photo_menu" => t("Add a photo menu element"),
|
||||
"site_menu" => t("Add a site menu element"),
|
||||
"user_before_delete" => t("Before user deletion"),
|
||||
"user_created" => t("User created"),
|
||||
"user_login" => t("User login"),
|
||||
"user_logout" => t("User logout")));
|
||||
|
@ -49,6 +49,7 @@ class Admin_Developer_Controller extends Admin_Controller {
|
||||
|
||||
$post = new Validation($_POST);
|
||||
$post->add_rules("name", "required");
|
||||
$post->add_rules("display_name", "required");
|
||||
$post->add_rules("description", "required");
|
||||
$post->add_callbacks("name", array($this, "_is_module_defined"));
|
||||
|
||||
@ -195,7 +196,8 @@ class Admin_Developer_Controller extends Admin_Controller {
|
||||
$data = "digraph G {\n";
|
||||
foreach ($items as $item) {
|
||||
$data .= " $item->parent_id -> $item->id\n";
|
||||
$data .= " $item->id [label=\"$item->id [$item->level] <$item->left, $item->right>\"]\n";
|
||||
$data .=
|
||||
" $item->id [label=\"$item->id [$item->level] <$item->left_ptr, $item->right_ptr>\"]\n";
|
||||
}
|
||||
$data .= "}\n";
|
||||
return $data;
|
||||
@ -215,7 +217,7 @@ class Admin_Developer_Controller extends Admin_Controller {
|
||||
}
|
||||
|
||||
private function _get_module_form() {
|
||||
$form = array("name" => "", "description" => "", "theme[]" => array(), "menu[]" => array(),
|
||||
$form = array("name" => "", "display_name" => "", "description" => "", "theme[]" => array(),
|
||||
"event[]" => array());
|
||||
$errors = array_fill_keys(array_keys($form), "");
|
||||
|
||||
@ -230,7 +232,6 @@ class Admin_Developer_Controller extends Admin_Controller {
|
||||
$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;
|
||||
|
@ -21,21 +21,21 @@ class developer_event_Core {
|
||||
static function admin_menu($menu, $theme) {
|
||||
$developer_menu = Menu::factory("submenu")
|
||||
->id("developer_menu")
|
||||
->label(t("Developer Tools"));
|
||||
->label(t("Developer tools"));
|
||||
$menu->append($developer_menu);
|
||||
|
||||
$developer_menu
|
||||
->append(Menu::factory("link")
|
||||
->id("generate_menu")
|
||||
->label(t("Generate Module"))
|
||||
->label(t("Generate module"))
|
||||
->url(url::site("admin/developer/module")))
|
||||
->append(Menu::factory("link")
|
||||
->id("generate_data")
|
||||
->label(t("Generate Test Data"))
|
||||
->label(t("Generate test data"))
|
||||
->url(url::site("admin/developer/test_data")))
|
||||
->append(Menu::factory("link")
|
||||
->id("mptt_tree_menu")
|
||||
->label(t("MPTT Tree"))
|
||||
->label(t("MPTT tree"))
|
||||
->url(url::site("admin/developer/mptt")));
|
||||
|
||||
$csrf = access::csrf_token();
|
||||
@ -43,13 +43,13 @@ class developer_event_Core {
|
||||
$developer_menu->append(
|
||||
Menu::factory("link")
|
||||
->id("scaffold_profiler")
|
||||
->label("Profiling off")
|
||||
->label(t("Profiling off"))
|
||||
->url(url::site("admin/developer/session/profiler?value=0&csrf=$csrf")));
|
||||
} else {
|
||||
$developer_menu->append(
|
||||
Menu::factory("link")
|
||||
->id("scaffold_profiler")
|
||||
->label("Profiling on")
|
||||
->label(t("Profiling on"))
|
||||
->url(url::site("admin/developer/session/profiler?value=1&csrf=$csrf")));
|
||||
}
|
||||
|
||||
@ -57,13 +57,13 @@ class developer_event_Core {
|
||||
$developer_menu->append(
|
||||
Menu::factory("link")
|
||||
->id("scaffold_debugger")
|
||||
->label("Debugging off")
|
||||
->label(t("Debugging off"))
|
||||
->url(url::site("admin/developer/session/debug?value=0&csrf=$csrf")));
|
||||
} else {
|
||||
$developer_menu->append(
|
||||
Menu::factory("link")
|
||||
->id("scaffold_debugger")
|
||||
->label("Debugging on")
|
||||
->label(t("Debugging on"))
|
||||
->url(url::site("admin/developer/session/debug?value=1&csrf=$csrf")));
|
||||
}
|
||||
}
|
||||
|
@ -54,14 +54,10 @@ class developer_task_Core {
|
||||
$context["block"] = array();
|
||||
self::_render_helper_file($context, "block");
|
||||
break;
|
||||
case 4: // Generate menu helper
|
||||
$context["menu"] = !isset($context["menu"]) ? array() : $context["menu"];
|
||||
self::_render_helper_file($context, "menu");
|
||||
break;
|
||||
case 5: // Generate event helper
|
||||
case 4: // Generate event helper
|
||||
self::_render_helper_file($context, "event");
|
||||
break;
|
||||
case 6: // Generate admin controller
|
||||
case 5: // Generate admin controller
|
||||
$file = "{$context['module_path']}/controllers/admin_{$context['module']}.php";
|
||||
ob_start();
|
||||
$v = new View("admin_controller.txt");
|
||||
@ -72,7 +68,7 @@ class developer_task_Core {
|
||||
file_put_contents($file, ob_get_contents());
|
||||
ob_end_clean();
|
||||
break;
|
||||
case 7: // Generate admin form
|
||||
case 6: // Generate admin form
|
||||
$file = "{$context['module_path']}/views/admin_{$context['module']}.html.php";
|
||||
ob_start();
|
||||
$v = new View("admin_html.txt");
|
||||
@ -83,7 +79,7 @@ class developer_task_Core {
|
||||
file_put_contents($file, ob_get_contents());
|
||||
ob_end_clean();
|
||||
break;
|
||||
case 8: // Generate controller
|
||||
case 7: // Generate controller
|
||||
$file = "{$context['module_path']}/controllers/{$context['module']}.php";
|
||||
ob_start();
|
||||
$v = new View("controller.txt");
|
||||
@ -95,7 +91,7 @@ class developer_task_Core {
|
||||
file_put_contents($file, ob_get_contents());
|
||||
ob_end_clean();
|
||||
break;
|
||||
case 9: // Generate sidebar block view
|
||||
case 8: // Generate sidebar block view
|
||||
$file = "{$context['module_path']}/views/{$context['module']}_block.html.php";
|
||||
ob_start();
|
||||
$v = new View("block_html.txt");
|
||||
@ -107,11 +103,11 @@ class developer_task_Core {
|
||||
file_put_contents($file, ob_get_contents());
|
||||
ob_end_clean();
|
||||
break;
|
||||
case 10: // Generate module.info (do last)
|
||||
case 9: // 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_name = $context["display_name"];
|
||||
$v->module_description = $context["description"];
|
||||
print $v->render();
|
||||
file_put_contents($file, ob_get_contents());
|
||||
|
@ -1,6 +1,6 @@
|
||||
var module_success = function(data) {
|
||||
$("#gDeveloperAdmin").append('<div id="gModuleProgress" style="margin-top: 1em;"></div>');
|
||||
$("#gModuleProgress").progressbar();
|
||||
$("#g-developer-admin").append('<div id="g-module-progress" style="margin-top: 1em;"></div>');
|
||||
$("#g-module-progress").progressbar();
|
||||
|
||||
var task = data.task;
|
||||
var url = data.url;
|
||||
@ -10,7 +10,7 @@ var module_success = function(data) {
|
||||
while (!done) {
|
||||
$.ajax({async: false,
|
||||
success: function(data, textStatus) {
|
||||
$("#gModuleProgress").progressbar("value", data.task.percent_complete);
|
||||
$("#g-module-progress").progressbar("value", data.task.percent_complete);
|
||||
done = data.task.done;
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
|
@ -47,7 +47,7 @@ class Admin_<?= $class_name ?>_Controller extends Admin_Controller {
|
||||
|
||||
private function _get_form() {
|
||||
$form = new Forge("admin/<?= $module ?>/handler", "", "post",
|
||||
array("id" => "gAdminForm"));
|
||||
array("id" => "g-adminForm"));
|
||||
$group = $form->group("group");
|
||||
$group->input("text")->label(t("Text"))->rules("required");
|
||||
$group->submit("submit")->value(t("Submit"));
|
||||
|
@ -1,14 +1,13 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?= html::script("modules/developer/js/developer.js") ?>
|
||||
<script>
|
||||
$("#gDeveloperForm").ready(function() {
|
||||
ajaxify_developer_form("#gDeveloperForm form", module_success);
|
||||
<script type="text/javascript">
|
||||
$("#g-developer-form").ready(function() {
|
||||
ajaxify_developer_form("#g-developer-form form", module_success);
|
||||
});
|
||||
|
||||
</script>
|
||||
<div id="gDeveloperAdmin">
|
||||
<div id="g-developer-admin">
|
||||
<h2><?= $title ?></h2>
|
||||
<div id="gDeveloperForm" >
|
||||
<div id="g-developer-form" >
|
||||
<?= $developer_content ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,92 +1,92 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script>
|
||||
$("#gGenerateTestData").ready(function() {
|
||||
$(".gGenerateCheckbox").click(function() {
|
||||
<script type="text/javascript">
|
||||
$("#g-generate-test-data").ready(function() {
|
||||
$(".g-generate-checkbox").click(function() {
|
||||
var buttons = $(this).val();
|
||||
$(buttons).attr("disabled", !this.checked);
|
||||
});
|
||||
<? if (!empty($form["generate_albums"])): ?>
|
||||
$("#gGenerateAlbums").click();
|
||||
$("#g-generate-albums").click();
|
||||
<? endif ?>
|
||||
<? if (!empty($form["generate_photos"])): ?>
|
||||
$("#gGeneratePhotos").click();
|
||||
$("#g-generate-photos").click();
|
||||
<? endif ?>
|
||||
<? if (!empty($form["generate_comments"])): ?>
|
||||
$("#gGenerateCommentss").click();
|
||||
$("#g-generate-comments").click();
|
||||
<? endif ?>
|
||||
<? if (!empty($form["generate_tags"])): ?>
|
||||
$("#gGenerateTags").click();
|
||||
$("#g-generate-tags").click();
|
||||
<? endif ?>
|
||||
});
|
||||
</script>
|
||||
<?= form::open($action, array("method" => "post", "id" => "gGenerateTestData"), $hidden) ?>
|
||||
<?= form::open($action, array("method" => "post", "id" => "g-generate-test-data"), $hidden) ?>
|
||||
<? if (!empty($album_count)): ?>
|
||||
<p><?= t("Currently:") ?><br />
|
||||
|
||||
|
||||
<i>(<?= $album_count ?>, <?= $photo_count ?>, <?= $comment_count ?>, <?= $tag_count ?>)</i>
|
||||
</p>
|
||||
<? endif ?>
|
||||
|
||||
<fieldset>
|
||||
<ul>
|
||||
<li <? if (!empty($errors["albums"])): ?> class="gError"<? endif ?>>
|
||||
<li <? if (!empty($errors["albums"])): ?> class="g-error"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGenerateAlbums", t("Generate Albums")) ?>
|
||||
<?= form::checkbox(array("id" => "gGenerateAlbums", "name" => "generate_albums", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_albums"])), ".gRadioAlbum") ?>
|
||||
<?= form::label("g-generate-albums", t("Generate Albums")) ?>
|
||||
<?= form::checkbox(array("id" => "g-generate-albums", "name" => "generate_albums", "class" => "g-generate-checkbox", "style" => "display:inline", "checked" => !empty($form["generate_albums"])), ".g-radio-album") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("album_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "album_$number", "name" => "albums", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioAlbum"), $number) ?></span>
|
||||
<?= form::radio(array("id" => "album_$number", "name" => "albums", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "g-radio-album"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["albums"]) && $errors["albums"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<p class="g-error"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li <? if (!empty($errors["photos"])): ?> class="gError"<? endif ?>>
|
||||
<li <? if (!empty($errors["photos"])): ?> class="g-error"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGeneratePhotos", t("Generate Photos and Albums")) ?>
|
||||
<?= form::checkbox(array("id" => "gGeneratePhotos", "name" => "generate_photos", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_photos"])), ".gRadioPhoto") ?>
|
||||
<?= form::label("g-generate-photos", t("Generate Photos and Albums")) ?>
|
||||
<?= form::checkbox(array("id" => "g-generate-photos", "name" => "generate_photos", "class" => "g-generate-checkbox", "style" => "display:inline", "checked" => !empty($form["generate_photos"])), ".g-radio-photo") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("photo_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "photo_$number", "name" => "photos", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioPhoto"), $number) ?></span>
|
||||
<?= form::radio(array("id" => "photo_$number", "name" => "photos", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "g-radio-photo"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["photos"]) && $errors["photos"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<p class="g-error"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li
|
||||
</li>
|
||||
<? if(!empty($comment_installed)): ?>
|
||||
<li <? if (!empty($errors["comments"])): ?> class="gError"<? endif ?>>
|
||||
<li <? if (!empty($errors["comments"])): ?> class="g-error"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGenerateComments", t("Generate Comments")) ?>
|
||||
<?= form::checkbox(array("id" => "gGenerateComments", "name" => "generate_comments", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_comments"])), ".gRadioComment") ?>
|
||||
<?= form::label("g-generate-comments", t("Generate Comments")) ?>
|
||||
<?= form::checkbox(array("id" => "g-generate-comments", "name" => "generate_comments", "class" => "g-generate-checkbox", "style" => "display:inline", "checked" => !empty($form["generate_comments"])), ".g-radio-comment") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("comment_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "comment_$number", "name" => "comments", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioComment"), $number) ?></span>
|
||||
<?= form::radio(array("id" => "comment_$number", "name" => "comments", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "g-radio-comment"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["comments"]) && $errors["comments"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<p class="g-error"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<? if(!empty($tag_installed)): ?>
|
||||
<li <? if (!empty($errors["tags"])): ?> class="gError"<? endif ?>>
|
||||
<li <? if (!empty($errors["tags"])): ?> class="g-error"<? endif ?>>
|
||||
<fieldset>
|
||||
<?= form::label("gGenerateTags", t("Generate Tags")) ?>
|
||||
<?= form::checkbox(array("id" => "gGenerateTags", "name" => "generate_tags", "class" => "gGenerateCheckbox", "style" => "display:inline", "checked" => !empty($form["generate_tags"])), ".gRadioTag") ?>
|
||||
<?= form::label("g-generate-tags", t("Generate Tags")) ?>
|
||||
<?= form::checkbox(array("id" => "g-generate-tags", "name" => "generate_tags", "class" => "g-generate-checkbox", "style" => "display:inline", "checked" => !empty($form["generate_tags"])), ".g-radio-tag") ?>
|
||||
<? foreach (array(1, 10, 50, 100, 500, 1000) as $number): ?>
|
||||
<span style="float:left;padding-right: .5em;"><?= form::label("tag_$number", "$number") ?>
|
||||
<?= form::radio(array("id" => "tag_$number", "name" => "tags", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "gRadioTag"), $number) ?></span>
|
||||
<?= form::radio(array("id" => "tag_$number", "name" => "tags", "style" => "display:inline", "checked" => $number == 10, "disabled" => true, "class" => "g-radio-tag"), $number) ?></span>
|
||||
<? endforeach ?>
|
||||
</fieldset>
|
||||
<? if (!empty($errors["tags"]) && $errors["tags"] == "numeric"): ?>
|
||||
<p class="gError"><?= t("Number to create must be numeric") ?></p>
|
||||
<p class="g-error"><?= t("Number to create must be numeric") ?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<? endif ?>
|
||||
<li>
|
||||
<?= form::submit(array("id" => "gGenerateData", "name" => "generate", "class" => "submit", "style" => "clear:both!important"), t("Generate")) ?>
|
||||
<?= form::submit(array("id" => "g-generate-data", "name" => "generate", "class" => "submit", "style" => "clear:both!important"), t("Generate")) ?>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\") ?>" ?>
|
||||
|
||||
<div id="gAdmin<?= $css_id ?>">
|
||||
<div id="g-admin-<?= $css_id ?>">
|
||||
<h2>
|
||||
<?= "<?= t(\"$name Adminstration\") ?>" ?>
|
||||
</h2>
|
||||
|
@ -1,5 +1,6 @@
|
||||
<?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-2009 Bharat Mediratta
|
||||
@ -19,20 +20,34 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class <?= $module ?>_block {
|
||||
static function get($block_id) {
|
||||
static function get_site_list() {
|
||||
return array(
|
||||
"<?= "{$module}_site" ?>" => t("<?= $name ?> Sidebar Block"));
|
||||
}
|
||||
|
||||
static function get_admin_list() {
|
||||
return array(
|
||||
"<?= "{$module}_admin" ?>" => t("<?= $name ?> Dashboard Block"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$block = new Block();
|
||||
if ($block_id == "<?= $module ?>") {
|
||||
$block->css_id = "g<?= $css_id ?>Admin";
|
||||
switch ($block_id) {
|
||||
case "<?= "{$module}_admin" ?>":
|
||||
$block->css_id = "g-<?= $css_id ?>-admin";
|
||||
$block->title = t("<?= $module ?> Dashboard Block");
|
||||
$block->content = new View("<?= $module ?>block.html");
|
||||
$block->content = new View("admin_<?= $module ?>_block.html");
|
||||
|
||||
$block->content->item = ORM::factory("item", 1);
|
||||
break;
|
||||
case "<?= "{$module}_site" ?>":
|
||||
$block->css_id = "g-<?= $css_id ?>-site";
|
||||
$block->title = t("<?= $module ?> Sidebar Block");
|
||||
$block->content = new View("<?= $module ?>_block.html");
|
||||
|
||||
$block->content->item = ORM::factory("item", 1);
|
||||
break;
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
|
||||
static function get_list() {
|
||||
return array(
|
||||
"<?= $module ?>" => t("<?= $name ?> Dashboard Block"));
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +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">
|
||||
<div class="g-<?= $css_id ?>-block">
|
||||
<?= "<a href=\"<?= \$item->url() ?>\">" ?>
|
||||
|
||||
<?= "<?= \$item->thumb_tag(array(\"class\" => \"gThumbnail\")) ?>" ?>
|
||||
<?= "<?= \$item->thumb_tag(array(\"class\" => \"g-thumbnail\")) ?>" ?>
|
||||
|
||||
</a>
|
||||
</div>
|
||||
|
@ -43,7 +43,7 @@ class <?= $class_name ?>_Controller extends Controller {
|
||||
|
||||
private function _get_form() {
|
||||
$form = new Forge("<?= $module ?>/handler", "", "post",
|
||||
array("id" => "g<?= $css_id ?>Form"));
|
||||
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"));
|
||||
|
@ -3,41 +3,44 @@
|
||||
<?= form::open($action, array("method" => "post"), $hidden) ?>
|
||||
<fieldset>
|
||||
<ul>
|
||||
<li <? if (!empty($errors["name"])): ?> class="gError"<? endif ?>>
|
||||
<li <? if (!empty($errors["name"])): ?> class="g-error"<? 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>
|
||||
<p class="g-error"><?= t("Module name is required") ?></p>
|
||||
<? endif ?>
|
||||
<? if (!empty($errors["name"]) && $errors["name"] == "module_exists"): ?>
|
||||
<p class="gError"><?= t("Module is already implemented") ?></p>
|
||||
<p class="g-error"><?= t("Module is already implemented") ?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li <? if (!empty($errors["description"])): ?> class="gError"<? endif ?>>
|
||||
<li <? if (!empty($errors["display_name"])): ?> class="g-error"<? endif ?>>
|
||||
<?= form::label("display_name", t("Display name")) ?>
|
||||
<?= form::input("display_name", $form["display_name"]) ?>
|
||||
<? if (!empty($errors["display_name"]) && $errors["display_name"] == "required"): ?>
|
||||
<p class="g-error"><?= t("Module display_name is required")?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li <? if (!empty($errors["description"])): ?> class="g-error"<? 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>
|
||||
<p class="g-error"><?= t("Module description is required")?></p>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li>
|
||||
<ul>
|
||||
<li>
|
||||
<?= form::label("theme[]", t("Theme Callbacks")) ?>
|
||||
<?= 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::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", "style" => "clear:both!important"), t("Generate")) ?>
|
||||
<?= form::submit(array("id" => "g-generate-module", "name" => "generate", "class" => "submit", "style" => "clear:both!important"), t("Generate")) ?>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
@ -19,75 +19,95 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class <?= $module ?>_event {
|
||||
<? if (!empty($callbacks["admin_menu"])): ?>
|
||||
static function admin_menu($menu, $theme) {
|
||||
}
|
||||
|
||||
<? endif ?>
|
||||
<? if (!empty($callbacks["album_menu"])): ?>
|
||||
static function album_menu($menu, $theme) {
|
||||
}
|
||||
|
||||
<? endif ?>
|
||||
<? 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["photo_menu"])): ?>
|
||||
static function photo_menu($menu, $theme) {
|
||||
}
|
||||
|
||||
<? endif ?>
|
||||
<? if (!empty($callbacks["site_menu"])): ?>
|
||||
static function site_menu($menu, $theme) {
|
||||
}
|
||||
|
||||
<? 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) {
|
||||
|
@ -1,51 +0,0 @@
|
||||
<?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-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 <?= $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")));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,9 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gMPTTTree">
|
||||
<div id="g-mptt-tree">
|
||||
<h2>
|
||||
<?= t("MPTT Tree Visualizer") ?>
|
||||
</h2>
|
||||
<div id="gMPTT">
|
||||
<div id="g-mptt">
|
||||
<? if (empty($url)): ?>
|
||||
<pre><?= $tree ?></pre>
|
||||
<? else: ?>
|
||||
|
@ -19,150 +19,139 @@
|
||||
* 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 ?>
|
||||
}
|
||||
|
54
modules/displaytags/helpers/displaytags_block.php
Normal file
54
modules/displaytags/helpers/displaytags_block.php
Normal file
@ -0,0 +1,54 @@
|
||||
<?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 displaytags_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("display_tags" => t("Display Tags"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$block = "";
|
||||
|
||||
// Make sure the current page belongs to an item.
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($block_id) {
|
||||
case "display_tags":
|
||||
// Create an array of all the tags for the current item.
|
||||
$tagsItem = ORM::factory("tag")
|
||||
->join("items_tags", "tags.id", "items_tags.tag_id")
|
||||
->where("items_tags.item_id", $theme->item->id)
|
||||
->find_all();
|
||||
|
||||
// If the current item has at least one tag, display it/them.
|
||||
if (count($tagsItem) > 0) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-display-tags";
|
||||
$block->title = t("Tags");
|
||||
$block->content = new View("displaytags_block.html");
|
||||
$block->content->tags = $tagsItem;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
}
|
@ -1,3 +1,3 @@
|
||||
name = DisplayTags
|
||||
description = Display all tags for the current photo/album.
|
||||
name = "DisplayTags"
|
||||
description = "Display all tags for the current photo/album."
|
||||
version = 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div class="gDisplayTagsBlock">
|
||||
<div class="g-display-tags-block">
|
||||
<? for ($counter=0; $counter<count($tags); $counter++) { ?>
|
||||
<? if ($counter < count($tags)-1) { ?>
|
||||
<a href="<?= url::site("tags/$tags[$counter]") ?>"><?= html::clean($tags[$counter]->name) ?></a>,
|
||||
|
@ -71,7 +71,7 @@ class Admin_DownloadFullsize_Controller extends Admin_Controller {
|
||||
private function _get_admin_form() {
|
||||
// Make a new Form.
|
||||
$form = new Forge("admin/downloadfullsize/saveprefs", "", "post",
|
||||
array("id" => "gDownloadFullsizeAdminForm"));
|
||||
array("id" => "g-download-fullsize-adminForm"));
|
||||
|
||||
// Make an array for the different types of download links.
|
||||
$linkOptions["fButton"] = array(t("Show Floppy Disk Link"), module::get_var("downloadfullsize", "fButton"));
|
||||
|
@ -1,3 +1,3 @@
|
||||
#gViewMenu #gDownloadFullsizeLink {
|
||||
#g-view-menu #g-download-fullsize-link {
|
||||
background-image: url('../images/ico-view-downloadfullsize.png');
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class downloadfullsize_event_Core {
|
||||
->id("downloadfullsize")
|
||||
->label(t("Download Fullsize Image"))
|
||||
->url($downloadLink)
|
||||
->css_id("gDownloadFullsizeLink"));
|
||||
->css_id("g-download-fullsize-link"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -41,7 +41,7 @@ class downloadfullsize_event_Core {
|
||||
->id("downloadfullsize")
|
||||
->label(t("Download Video"))
|
||||
->url($downloadLink)
|
||||
->css_id("gDownloadFullsizeLink"));
|
||||
->css_id("g-download-fullsize-link"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,9 @@
|
||||
*/
|
||||
class downloadfullsize_theme {
|
||||
static function head($theme) {
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
if ($theme->item && access::can("view_full", $theme->item)) {
|
||||
$theme->css("downloadfullsize_menu.css");
|
||||
}
|
||||
|
||||
return new View("downloadfullsize_header_block.html");
|
||||
}
|
||||
|
||||
static function sidebar_blocks($theme) {
|
||||
@ -31,7 +29,7 @@ class downloadfullsize_theme {
|
||||
if ($item && $item->is_movie() && access::can("view_full", $item)) {
|
||||
if (module::get_var("downloadfullsize", "tButton")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "gDownloadFullsize";
|
||||
$block->css_id = "g-download-fullsize";
|
||||
$block->title = t("Download");
|
||||
$block->content = new View("downloadfullsize_block.html");
|
||||
|
||||
@ -44,7 +42,7 @@ class downloadfullsize_theme {
|
||||
if ($item && $item->is_photo() && access::can("view_full", $item)) {
|
||||
if (module::get_var("downloadfullsize", "tButton")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "gDownloadFullsize";
|
||||
$block->css_id = "g-download-fullsize";
|
||||
$block->title = t("Download");
|
||||
$block->content = new View("downloadfullsize_block.html");
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
name = DownloadFullsize
|
||||
description = Displays a link to download the fullsize version of the current photo.
|
||||
name = "DownloadFullsize"
|
||||
description = "Displays a link to download the fullsize version of the current photo."
|
||||
version = 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gDownloadFullsizeAdmin">
|
||||
<div id="g-download-fullsize-admin">
|
||||
<h2> <?= t("Download Fullsize Links") ?> </h2>
|
||||
<?= $downloadlinks_form ?>
|
||||
</div>
|
||||
|
@ -1,18 +1,18 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<? if ($theme->item->is_photo()) { ?>
|
||||
<div class="gDownloadFullsizeBlock">
|
||||
<div class="g-download-fullsize-block">
|
||||
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
|
||||
title="<?= t("Download Photo") ?>"
|
||||
class="gButtonLink ui-icon-left ui-state-default ui-corner-all"><?= t("Download Fullsize Image") ?></a>
|
||||
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Fullsize Image") ?></a>
|
||||
</div>
|
||||
<? } ?>
|
||||
|
||||
<? if ($theme->item->is_movie()) { ?>
|
||||
<div class="gDownloadFullsizeBlock">
|
||||
<div class="g-download-fullsize-block">
|
||||
<a href="<?= url::site("downloadfullsize/send/$theme->item") ?>"
|
||||
title="<?= t("Download Video") ?>"
|
||||
class="gButtonLink ui-icon-left ui-state-default ui-corner-all"><?= t("Download Video") ?></a>
|
||||
class="g-button ui-icon-left ui-state-default ui-corner-all"><?= t("Download Video") ?></a>
|
||||
</div>
|
||||
<? } ?>
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="<?= url::file("modules/downloadfullsize/css/downloadfullsize_menu.css") ?>" />
|
@ -54,7 +54,7 @@ class Admin_Dynamic_Controller extends Admin_Controller {
|
||||
private function _get_form() {
|
||||
|
||||
$form = new Forge("admin/dynamic/handler", "", "post",
|
||||
array("id" => "gAdminForm"));
|
||||
array("id" => "g-admin-form"));
|
||||
|
||||
foreach (array("updates", "popular") as $album) {
|
||||
$album_defn = unserialize(module::get_var("dynamic", $album));
|
||||
|
@ -47,7 +47,7 @@ class Dynamic_Controller extends Controller {
|
||||
Kohana::show_404();
|
||||
}
|
||||
|
||||
$template = new Theme_View("page.html", "dynamic");
|
||||
$template = new Theme_View("page.html", "other", "dynamic");
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
|
@ -27,7 +27,7 @@ class dynamic_theme {
|
||||
}
|
||||
if (!empty($albums)) {
|
||||
$block = new Block();
|
||||
$block->css_id = "gDynamic";
|
||||
$block->css_id = "g-dynamic";
|
||||
$block->title = t("Dynamic Albums");
|
||||
$block->content = new View("dynamic_block.html");
|
||||
$block->content->albums = $albums;
|
||||
|
@ -1,5 +1,8 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gAdminDynamic">
|
||||
<h2> <?= t("Dynamic Albums") ?> </h2>
|
||||
<div id="g-dyanmic-block" class="g-block ui-helper-clearfix">
|
||||
<h1> <?= t("Dynamic Albums") ?> </h1>
|
||||
|
||||
<div class="g-block-content">
|
||||
<?= $form ?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div class="gDynamicBlock">
|
||||
<div class="g-dynamic-block">
|
||||
<ul>
|
||||
<? foreach ($albums as $album => $text): ?>
|
||||
<li>
|
||||
|
3
modules/editcreation/css/editcreation.css
Normal file
3
modules/editcreation/css/editcreation.css
Normal file
@ -0,0 +1,3 @@
|
||||
select {
|
||||
display: inline;
|
||||
}
|
@ -21,10 +21,7 @@ class editcreation_event_Core {
|
||||
static function item_edit_form($item, $form) {
|
||||
// Add a couple of drop-down boxes to allow the user to edit the date
|
||||
// that $item was created on.
|
||||
|
||||
// Inject some css to make everything look right.
|
||||
print ("<style>\nselect {\ndisplay: inline;\n}\n</style>\n");
|
||||
|
||||
|
||||
// Add the datecreated element to the form.
|
||||
$form->edit_item->dateselect("datecreated")
|
||||
->label(t("Created"))
|
||||
|
@ -17,23 +17,15 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class latestupdates_theme_Core {
|
||||
|
||||
static function sidebar_blocks($theme) {
|
||||
|
||||
class editcreation_theme_Core {
|
||||
static function head($theme) {
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
$albumID = $theme->item->is_album() ? $theme->item->id : $theme->item->parent_id;
|
||||
|
||||
$block = new Block();
|
||||
$block->css_id = "gUpdatesBlock";
|
||||
$block->title = t("Updates");
|
||||
$block->content = new View("latestupdates_block.html");
|
||||
$block->content->update_links = array(
|
||||
"Entire Gallery" => url::site("latestupdates/updates"),
|
||||
"This Album" => url::site("latestupdates/albums/$albumID")
|
||||
);
|
||||
|
||||
return $block;
|
||||
$item = $theme->item();
|
||||
if ( $item && access::can("edit", $item) ) {
|
||||
$theme->css("editcreation.css");
|
||||
}
|
||||
}
|
||||
}
|
@ -79,7 +79,7 @@ class Admin_EmbedLinks_Controller extends Admin_Controller {
|
||||
private function _get_admin_form() {
|
||||
// Make a new Form.
|
||||
$form = new Forge("admin/embedlinks/saveprefs", "", "post",
|
||||
array("id" => "gEmbedLinksAdminForm"));
|
||||
array("id" => "g-embed-links-adminForm"));
|
||||
|
||||
// Make an array for the different types of link codes.
|
||||
$linkCodes["HTMLCode"] = array(t("Show HTML Links"), module::get_var("embedlinks", "HTMLCode"));
|
||||
|
59
modules/embedlinks/helpers/embedlinks_block.php
Normal file
59
modules/embedlinks/helpers/embedlinks_block.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?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 embedlinks_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("embed_links_dialog" => t("Embed Links Dialog"), "embed_links_album" => t("Embed Links Album"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$block = "";
|
||||
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($block_id) {
|
||||
case "embed_links_dialog":
|
||||
// If displaying links in a dialog box is enabled then
|
||||
// insert buttons into the bottom of the side bar
|
||||
// to open up the dialog window.
|
||||
if (module::get_var("embedlinks", "DialogLinks") && $theme->item()) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-embed-links-sidebar";
|
||||
$block->title = t("Link To This Page");
|
||||
$block->content = new View("embedlinks_sidebar.html");
|
||||
}
|
||||
break;
|
||||
|
||||
case "embed_links_album":
|
||||
// If the current item is an album and if "In Page" links are enabled then
|
||||
// display links to the current album in the theme sidebar.
|
||||
if ($theme->item()->is_album() && module::get_var("embedlinks", "InPageLinks")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-embed-links-album-sidebar";
|
||||
$block->title = t("Links");
|
||||
$block->content = new View("embedlinks_album_block.html");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return $block;
|
||||
}
|
||||
}
|
@ -18,38 +18,13 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class embedlinks_theme_Core {
|
||||
static function sidebar_blocks($theme) {
|
||||
// If the current item is an album and if "In Page" links are enabled then
|
||||
// display links to the current album in the theme sidebar.
|
||||
if ($theme->item()->is_album() && module::get_var("embedlinks", "InPageLinks")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "gMetadata";
|
||||
$block->title = t("Links");
|
||||
$block->content = new View("embedlinks_album_block.html");
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
|
||||
static function sidebar_bottom($theme) {
|
||||
// If displaying links in a dialog box is enabled then
|
||||
// insert buttons into the bottom of the side bar
|
||||
// to open up the dialog window.
|
||||
if (module::get_var("embedlinks", "DialogLinks")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "gMetadata";
|
||||
$block->title = t("Link To This Page:");
|
||||
$block->content = new View("embedlinks_sidebar.html");
|
||||
return $block;
|
||||
}
|
||||
}
|
||||
|
||||
static function photo_bottom($theme) {
|
||||
// If the current item is a photo and displaying "In Page" links
|
||||
// is enabled, then insert HTML/BBCode links into the bottom
|
||||
// of the page.
|
||||
if (module::get_var("embedlinks", "InPageLinks")) {
|
||||
$block = new Block();
|
||||
$block->css_id = "gMetadata";
|
||||
$block->css_id = "g-metadata";
|
||||
$block->title = t("Links");
|
||||
$block->content = new View("embedlinks_photo_block.html");
|
||||
return $block;
|
||||
|
@ -1,3 +1,3 @@
|
||||
name = EmbedLinks
|
||||
description = Display BBCode and HTML code to embed links to albums/images into other web pages.
|
||||
name = "EmbedLinks"
|
||||
description = "Display BBCode and HTML code to embed links to albums/images into other web pages."
|
||||
version = 1
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gEmbedLinksAdmin">
|
||||
<div id="g-embed-links-admin">
|
||||
<h2> <?= t("EmbedLinks") ?> </h2>
|
||||
<?= $embedlinks_form ?>
|
||||
</div>
|
||||
|
@ -5,7 +5,7 @@ input[type="text"] {
|
||||
}
|
||||
</style>
|
||||
<? if (module::get_var("embedlinks", "HTMLCode")) { ?>
|
||||
<table class="gEmbedLinks">
|
||||
<table class="g-embed-links">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="2"><?= t("HTML Links:") ?></th>
|
||||
@ -25,7 +25,7 @@ input[type="text"] {
|
||||
<? } ?>
|
||||
|
||||
<? if (module::get_var("embedlinks", "BBCode")) { ?>
|
||||
<table class="gEmbedLinks">
|
||||
<table class="g-embed-links">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="2"><?= t("BBCode Links:") ?></th>
|
||||
@ -45,7 +45,7 @@ input[type="text"] {
|
||||
<? } ?>
|
||||
|
||||
<? if (module::get_var("embedlinks", "FullURL")) { ?>
|
||||
<table class="gEmbedLinks">
|
||||
<table class="g-embed-links">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="2"><?= t("URLs:") ?></th>
|
||||
|
@ -5,10 +5,10 @@ input[type="text"] {
|
||||
}
|
||||
</style>
|
||||
<h1 style="display: none;"><?= t("BBCode") ?></h1>
|
||||
<div id="gEmbedLinksBBCodeData">
|
||||
<div id="g-embed-links-bbcode-data">
|
||||
<? $counter = 0; ?>
|
||||
<? for ($i = 0; $i < count($titles); $i++): ?>
|
||||
<table class="gLinksBBCode" >
|
||||
<table class="g-links-bbcode" >
|
||||
<thead><tr><th colspan="2"><?= t($titles[$i][0]) ?></th></thead>
|
||||
<tbody>
|
||||
<? for ($j = $counter; $j < $titles[$i][1]+$counter; $j++): ?>
|
||||
|
@ -5,10 +5,10 @@ input[type="text"] {
|
||||
}
|
||||
</style>
|
||||
<h1 style="display: none;"><?= t("URLs") ?></h1>
|
||||
<div id="gEmbedLinksFullURLData">
|
||||
<div id="g-embed-links-full-url-data">
|
||||
<? $counter = 0; ?>
|
||||
<? for ($i = 0; $i < count($titles); $i++): ?>
|
||||
<table class="gLinksFullURL" >
|
||||
<table class="g-links-full-url" >
|
||||
<thead><tr><th colspan="2"><?= t($titles[$i][0]) ?></th></thead>
|
||||
<tbody>
|
||||
<? for ($j = $counter; $j < $titles[$i][1]+$counter; $j++): ?>
|
||||
|
@ -5,10 +5,10 @@ input[type="text"] {
|
||||
}
|
||||
</style>
|
||||
<h1 style="display: none;"><?= t("HTML Code") ?></h1>
|
||||
<div id="gEmbedLinksHTMLData">
|
||||
<div id="g-embed-links-html-data">
|
||||
<? $counter = 0; ?>
|
||||
<? for ($i = 0; $i < count($titles); $i++): ?>
|
||||
<table class="gLinksHTML" >
|
||||
<table class="g-links-html" >
|
||||
<thead><tr><th colspan="2"><?= t($titles[$i][0]) ?></th></thead>
|
||||
<tbody>
|
||||
<? for ($j = $counter; $j < $titles[$i][1]+$counter; $j++): ?>
|
||||
|
@ -7,7 +7,7 @@ input[type="text"] {
|
||||
|
||||
<? if (module::get_var("embedlinks", "HTMLCode")) { ?>
|
||||
<h3 align="center"><?= t("HTML Links")?></h3>
|
||||
<table class="gEmbedLink">
|
||||
<table class="g-embed-links">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="2"><?= t("Link To This Page:") ?></th>
|
||||
@ -90,7 +90,7 @@ input[type="text"] {
|
||||
|
||||
<? if (module::get_var("embedlinks", "BBCode")) { ?>
|
||||
<h3 align="center"><?= t("BBCode Links")?></h3>
|
||||
<table class="gEmbedLinks">
|
||||
<table class="g-embed-links">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th colspan="2"><?= t("Link To This Page:") ?></th>
|
||||
@ -166,7 +166,7 @@ input[type="text"] {
|
||||
|
||||
<? if (module::get_var("embedlinks", "FullURL")) { ?>
|
||||
<h3 align="center"><?= t("URLs")?></h3>
|
||||
<table class="gEmbedLinks">
|
||||
<table class="g-embed-links">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th><?= t("This Page:") ?></th>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? if (module::get_var("embedlinks", "HTMLCode")) { ?>
|
||||
<a href="<?= url::site("embedlinks/showhtml/{$item->id}") ?>" title="<?= t("HTML Links") ?>"
|
||||
class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all">
|
||||
class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-info"></span>
|
||||
<?= t("Show HTML Code") ?>
|
||||
</a><br />
|
||||
@ -9,7 +9,7 @@
|
||||
|
||||
<? if (module::get_var("embedlinks", "BBCode")) { ?>
|
||||
<a href="<?= url::site("embedlinks/showbbcode/{$item->id}") ?>" title="<?= t("BBCode Links") ?>"
|
||||
class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all">
|
||||
class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-info"></span>
|
||||
<?= t("Show BBCode") ?>
|
||||
</a>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
<? if (module::get_var("embedlinks", "FullURL")) { ?>
|
||||
<a href="<?= url::site("embedlinks/showfullurl/{$item->id}") ?>" title="<?= t("URLs") ?>"
|
||||
class="gDialogLink gButtonLink ui-icon-left ui-state-default ui-corner-all">
|
||||
class="g-dialog-link g-button ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-info"></span>
|
||||
<?= t("Show URLs") ?>
|
||||
</a>
|
||||
|
@ -21,7 +21,7 @@ class gmaps_theme_Core {
|
||||
static function sidebar_blocks($theme) {
|
||||
if ($theme->item()) {
|
||||
$block = new Block();
|
||||
$block->css_id = "gMaps";
|
||||
$block->css_id = "g-maps";
|
||||
$block->title = t("Location");
|
||||
$block->content = new View("gmaps_block.html");
|
||||
return $block;
|
||||
|
@ -43,7 +43,7 @@ class Admin_Google_Analytics_Controller extends Admin_Controller {
|
||||
}
|
||||
|
||||
private function _get_form() {
|
||||
$form = new Forge("admin/google_analytics/handler", "", "post", array("id" => "gAdminForm"));
|
||||
$form = new Forge("admin/google_analytics/handler", "", "post", array("id" => "g-admin-form"));
|
||||
$group = $form->group("google_analytics_code");
|
||||
$group->input("analytics_code")->label(t('Enter the <a href="http://www.google.com/support/googleanalytics/bin/answer.py?answer=113500" target="_blank">Web-Property-ID</a> given by Google.'))->rules("required")->value(module::get_var("google_analytics", "code"));
|
||||
$group->submit("submit")->value(t("Save"));
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gAdminGoogleAnalytics">
|
||||
<div id="g-admin-google-analytics">
|
||||
<h2>
|
||||
<?= t("Google Analytics Adminstration") ?> </h2>
|
||||
<?= $form ?>
|
||||
|
11
modules/gwtorganise/.classpath
Normal file
11
modules/gwtorganise/.classpath
Normal file
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="C:/Users/User/code/gwt-dnd/gwt-dnd-2.6.5.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/User/code/gwt-dnd/gwt-dnd-2.6.5-javadoc.jar"/>
|
||||
<classpathentry kind="lib" path="C:/Users/User/code/gwt-gears/gwt-gears.jar"/>
|
||||
<classpathentry kind="output" path="war/WEB-INF/classes"/>
|
||||
</classpath>
|
40
modules/gwtorganise/.project
Normal file
40
modules/gwtorganise/.project
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>gwtorganise</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gwt.eclipse.core.gwtProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.appengine.eclipse.core.enhancerbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.appengine.eclipse.core.projectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.google.gdt.eclipse.core.webAppProjectValidator</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>com.google.appengine.eclipse.core.gaeNature</nature>
|
||||
<nature>com.google.gwt.eclipse.core.gwtNature</nature>
|
||||
<nature>com.google.gdt.eclipse.core.webAppNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,3 @@
|
||||
#Sun Aug 30 20:30:24 NZST 2009
|
||||
eclipse.preferences.version=1
|
||||
filesCopiedToWebInfLib=appengine-api-1.0-sdk-1.2.2.jar|datanucleus-appengine-1.0.2.final.jar|datanucleus-core-1.1.4-gae.jar|datanucleus-jpa-1.1.4.jar|geronimo-jpa_3.0_spec-1.1.1.jar|geronimo-jta_1.1_spec-1.1.1.jar|jdo2-api-2.3-ea.jar
|
@ -0,0 +1,4 @@
|
||||
#Thu Sep 24 11:47:04 NZST 2009
|
||||
eclipse.preferences.version=1
|
||||
filesCopiedToWebInfLib=gwt-servlet.jar
|
||||
gwtCompileSettings=PGd3dC1jb21waWxlLXNldHRpbmdzPjxsb2ctbGV2ZWw+SU5GTzwvbG9nLWxldmVsPjxvdXRwdXQtc3R5bGU+T0JGVVNDQVRFRDwvb3V0cHV0LXN0eWxlPjxleHRyYS1hcmdzPjwhW0NEQVRBW11dPjwvZXh0cmEtYXJncz48dm0tYXJncz48IVtDREFUQVstWG14NTEybV1dPjwvdm0tYXJncz48L2d3dC1jb21waWxlLXNldHRpbmdzPg\=\=
|
26
modules/gwtorganise/controllers/admin_gwtorganise.php
Normal file
26
modules/gwtorganise/controllers/admin_gwtorganise.php
Normal file
@ -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 Admin_GWTOrganise_Controller extends Controller {
|
||||
public function index() {
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("gwtorganise_view.html");
|
||||
print $view;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user