1
0

Merge branch 'master' of github.com:gallery/gallery3-contrib

This commit is contained in:
Bharat Mediratta 2012-01-21 17:15:28 -08:00
commit 60f1a289e1
748 changed files with 34981 additions and 3984 deletions

View File

@ -19,7 +19,6 @@
*/
include("Mail.php");
include("Mail/mime.php");
include("HTTP/Request.php");
class Gallery3 {
var $url;
@ -64,6 +63,7 @@ class Gallery3 {
*/
public function __construct() {
$this->data = new stdClass();
$this->data->entity = new stdClass();
$this->token = null;
$this->url = null;
}
@ -169,7 +169,55 @@ class Gallery3 {
}
class Gallery3_Helper {
static $instance = null;
static function request($method, $url, $token=null, $params=array(), $file=null) {
if (!isset(self::$instance)) {
@include("HTTP/Request2.php");
if (class_exists("HTTP_Request2")) {
self::$instance = new Gallery3_Helper_HTTP_Request2();
} else {
include("HTTP/Request.php");
self::$instance = new Gallery3_Helper_HTTP_Request();
}
}
return self::$instance->request($method, $url, $token, $params, $file);
}
}
class Gallery3_Helper_HTTP_Request2 {
function request($method, $url, $token, $params, $file) {
$req = new HTTP_Request2($url);
$req->setMethod($method == "get" ? 'GET' : 'POST');
$req->setHeader("X-Gallery-Request-Method", $method);
if ($token) {
$req->setHeader("X-Gallery-Request-Key", $token);
}
foreach ($params as $key => $value) {
$req->addPostParameter($key, is_string($value) ? $value : json_encode($value));
}
if ($file) {
$req->addUpload("file", $file, basename($file), mime_content_type($file));
}
$response = $req->send();
$status = $response->getStatus();
switch ($status) {
case 200:
case 201:
return json_decode($response->getBody());
case 403:
throw new Gallery3_Forbidden_Exception($response->getBody(),$status);
default:
throw new Gallery3_Exception($response->getBody(),$status);
}
}
}
class Gallery3_Helper_HTTP_Request {
function request($method, $url, $token, $params, $file) {
$req = new HTTP_Request($url);
$req->setMethod($method == "get" ? HTTP_REQUEST_METHOD_GET : HTTP_REQUEST_METHOD_POST);
$req->addHeader("X-Gallery-Request-Method", $method);

View File

@ -22,7 +22,16 @@ __all__ = ['Album' , 'Image' , 'LocalImage' , 'RemoteImage' , 'LocalMovie' ,
'RemoteMovie' , 'getItemFromResp' , 'getItemsFromResp']
from datetime import datetime
import json , weakref , types , os , mimetypes , re
import weakref , types , os , mimetypes , re
try:
import json
except:
try:
import simplejson
except ImportError , e:
raise ImportError('You must have either the "json" or "simplejson"'
'library installed!')
class BaseRemote(object):
def __init__(self , respObj , weakGalObj , weakParent=None):

View File

@ -26,7 +26,15 @@ from G3Items import getItemFromResp , getItemsFromResp , BaseRemote , Album , \
RemoteImage , Tag
from urllib import quote , urlencode
from uuid import uuid4
import urllib2 , os , json
import urllib2 , os
try:
import json
except:
try:
import simplejson
except ImportError , e:
raise ImportError('You must have either the "json" or "simplejson"'
'library installed!')
class Gallery3(object):
"""
@ -129,7 +137,6 @@ class Gallery3(object):
uri(str) : The uri string defining the resource on the defined host
"""
url = self._buildUrl(uri , kwargs)
print url
return self.getRespFromUrl(url)
def addAlbum(self , parent , albumName , title , description=''):

View File

@ -21,4 +21,4 @@
from G3Items import *
from Gallery3 import *
__version__ = '0.1.4'
__version__ = '0.1.5'

View File

@ -0,0 +1,28 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class About_Controller extends Controller {
public function index() {
$template = new Theme_View("page.html", "other", "About");
$template->css("about.css");
$template->page_title = t("Gallery :: About");
$template->content = new View("about.html");
print $template;
}
}

View File

@ -0,0 +1,61 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Admin_About_Controller extends Admin_Controller {
public function index() {
print $this->_get_view();
}
public function handler() {
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate()) {
module::set_var(
"about", "code", $form->about->about_code->value);
module::set_var(
"about", "title", $form->about->about_title->value);
module::set_var (
"about", "hidden", $form->about->about_hidden->value);
message::success(t("Your settings have been saved."));
url::redirect("admin/about");
}
print $this->_get_view($form);
}
private function _get_view($form=null) {
$v = new Admin_View("admin.html");
$v->content = new View("admin_about.html");
$v->content->form = empty($form) ? $this->_get_form() : $form;
return $v;
}
private function _get_form() {
$form = new Forge("admin/about/handler", "", "post", array("id" => "g-admin-form"));
$group = $form->group("about");
$group->input("about_title")->label(t('Enter the headline.'))->value(module::get_var("about", "title"));
$group->textarea("about_code")->label(t('Enter the standard HTML code you want on the page.'))->value(module::get_var("about", "code"));
$group->checkbox("about_hidden")->label(t("Hide link"))
->checked(module::get_var("about", "hidden", false) == 1);
$group->submit("submit")->value(t("Save"));
return $form;
}
}

View File

@ -0,0 +1,2 @@
table.about { text-align: center; width:500px; }
table.about caption { font-size: 1.5em; padding: 0.2em; }

View File

@ -0,0 +1,39 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class about_block_Core {
static function get_site_list() {
return array("about" => t("About page"));
}
static function get($block_id, $theme) {
$block = "";
switch ($block_id) {
case "about":
if ($theme->item()) {
$block = new Block();
$block->css_id = "g-metadata";
$block->title = module::get_var("about", "title");
$block->content = new View("about_block.html");
}
break;
}
return $block;
}
}

View File

@ -0,0 +1,37 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class about_event_Core {
static function admin_menu($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("about_menu")
->label(t("About page"))
->url(url::site("admin/about")));
}
static function site_menu($menu, $theme) {
if (module::get_var("about", "hidden") != true) {
$menu->add_after("home", Menu::factory("link")
->id("about")
->label(t("About"))
->url(url::site("about/")));
}
}
}

View 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 about_installer {
static function deactivate() {
module::clear_var("about", "title");
module::clear_var("about", "code");
module::clear_var("about", "hidden");
}
}

View File

@ -0,0 +1,7 @@
name = "About"
description = "About page and detail."
author_name = "floridave"
author_url = "http://codex.gallery2.org/User:Floridave"
info_url = "http://codex.gallery2.org/Gallery3:Modules:about"
discuss_url = "http://gallery.menalto.com/forum_module_about"
version = 1

View File

@ -0,0 +1,3 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<h1><?= module::get_var("about", "title"); ?></h1>
<?= module::get_var("about", "code"); ?>

View File

@ -0,0 +1,2 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?= module::get_var("about", "code"); ?>

View File

@ -0,0 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="g-admin-code-block">
<h2><?= t("About Page Administration") ?></h2>
<?= $form ?>
</div>

View File

@ -1,3 +1,7 @@
name = "About this Album"
description = "Show some simple, specific and useful info about a given album"
version = 1
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:about_this_album"
discuss_url = "http://gallery.menalto.com/forum_module_about_this_album"

View File

@ -1,3 +1,7 @@
name = "About this Photo"
description = "Show some simple, specific and useful info about a given photo"
version = 3
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:about_this_photo"
discuss_url = "http://gallery.menalto.com/forum_module_about_this_photo"

View File

@ -0,0 +1,29 @@
<?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.
*/
/**
* PHP Mail Configuration parameters
* from => email address that appears as the from address
* line-length => word wrap length (PHP documentations suggest no larger tha 70 characters
* reply-to => what goes into the reply to header
*/
$config["ranges"] = array(
"Addthis1" => array("low" => "65.249.152.0", "high" => "65.249.159.255"),
"Addthis2" => array("low" => "208.122.55.0", "high" => "208.122.55.255")
);

View File

@ -0,0 +1,123 @@
<?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 Addthis_Controller extends Controller {
public function print_photo($id) {
access::verify_csrf();
$item = ORM::factory("item", $id);
access::required("view", $item);
if (access::group_can(identity::everybody(), "view_full", $item)) {
$full_url = $item->file_url(true);
$thumb_url = $item->thumb_url(true);
} else {
$proxy = ORM::factory("addthis_proxy");
$proxy->uuid = md5(rand());
$proxy->item_id = $item->id;
$proxy->save();
$full_url = url::abs_site("addthis/print_proxy/full/$proxy->uuid");
$thumb_url = url::abs_site("addthis/print_proxy/thumb/$proxy->uuid");
}
$v = new View("addthis_form.html");
$v->order_parms = array(
"addthis_api_version" => "100",
"company_id" => module::get_var("addthis", "company_id"),
"event_id" => module::get_var("addthis", "event_id"),
"cmd" => "addimg",
"partner_code" => "69",
"return_url" => url::abs_site("addthis/close_window"),
"num_images" => "1",
"image_1" => $full_url,
"thumb_1" => $thumb_url,
"image_height_1" => $item->height,
"image_width_1" => $item->width,
"thumb_height_1" => $item->thumb_height,
"thumb_width_1" => $item->thumb_width,
"title_1" => html::purify($item->title));
print $v;
}
public function print_proxy($type, $id) {
// If its a request for the full size then make sure we are coming from an
// authorized address
if ($type == "full") {
$remote_addr = ip2long($this->input->server("REMOTE_ADDR"));
if ($remote_addr === false) {
Kohana::show_404();
}
$config = Kohana::config("addthis");
$authorized = false;
foreach ($config["ranges"] as $ip_range) {
$low = ip2long($ip_range["low"]);
$high = ip2long($ip_range["high"]);
$authorized = $low !== false && $high !== false &&
$low <= $remote_addr && $remote_addr <= $high;
if ($authorized) {
break;
}
}
if (!$authorized) {
Kohana::show_404();
}
}
$proxy = ORM::factory("addthis_proxy", array("uuid" => $id));
if (!$proxy->loaded || !$proxy->item->loaded) {
Kohana::show_404();
}
$file = $type == "full" ? $proxy->item->file_path() : $proxy->item->thumb_path();
if (!file_exists($file)) {
kohana::show_404();
}
// We don't need to save the session for this request
Session::abort_save();
if (!TEST_MODE) {
// Dump out the image
header("Content-Type: $proxy->item->mime_type");
Kohana::close_buffers(false);
$fd = fopen($file, "rb");
fpassthru($fd);
fclose($fd);
// If the request was for the image and not the thumb, then delete the proxy.
if ($type == "full") {
$proxy->delete();
}
}
$this->_clean_expired();
}
public function close_window() {
print "<script type=\"text/javascript\">window.close();</script>";
}
private function _clean_expired() {
Database::instance()->query(
"DELETE FROM {addthis_proxies} " .
"WHERE request_date <= (CURDATE() - INTERVAL 10 DAY) " .
"LIMIT 20");
}
}

View 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_Addthis_Controller extends Admin_Controller {
public function index() {
$v = new Admin_View("admin.html");
$v->content = new View("admin_addthis.html");
print $v;
}
}

View File

@ -0,0 +1,3 @@
#g-view-menu #g-addthis-link {
background-image: url('../images/addthis_logo.png');
}

View File

@ -0,0 +1,48 @@
<?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 addthis_event_Core {
static function admin_menu($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("addthis_menu")
->label(t("AddThis"))
->url(url::site("admin/addthis")));
}
static function photo_menu($menu, $theme) {
$item = $theme->item();
$menu->append(Menu::factory("link")
->id("addthis")
->label(t("Bookmark and Share: $item->title"))
->url("")
->css_id("g-addthis-link")
->css_class("addthis_button"));
}
static function album_menu($menu, $theme) {
$item = $theme->item();
$menu->append(Menu::factory("link")
->id("addthis")
->label(t("Bookmark and Share: $item->title"))
->url("")
->css_id("g-addthis-link")
->css_class("addthis_button"));
}
}

View File

@ -0,0 +1,45 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-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 addthis_installer {
static function install() {
Database::instance()
->query("CREATE TABLE {addthis_proxies} (
`id` int(9) NOT NULL AUTO_INCREMENT,
`uuid` char(32) NOT NULL,
`request_date` TIMESTAMP NOT NULL DEFAULT current_timestamp,
`item_id` int(9) NOT NULL,
PRIMARY KEY (`id`))
DEFAULT CHARSET=utf8;");
module::set_var("addthis", "username", "");
module::set_version("addthis", 1);
}
static function upgrade($version) {
if ($version == 1) {
module::set_version("addthis", $version = 1);
}
}
static function uninstall() {
Database::instance()->query("DROP TABLE IF EXISTS {addthis_proxies}");
module::delete("addthis");
}
}

View File

@ -0,0 +1,29 @@
<?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 addthis_theme_Core {
static function head($theme) {
$addthisuser = module::get_var("addthis", "username");
$theme->css("addthis_menu.css");
return "<script type=\"text/javascript\" src=\"http://s7.addthis.com/js/250/addthis_widget.js#username=$addthisuser\"></script>\n" .
"<script type=\"text/javascript\">" .
"var addthis_config = {ui_header_color: \"#ffffff\",ui_header_background: \"#000000\",ui_offset_top: -15,ui_offset_left: 0" .
"}</script>";
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,22 @@
<?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 Addthis_Proxy_Model extends ORM {
protected $has_one = array("item");
}

View File

@ -0,0 +1,3 @@
name = "AddThis"
description = "Social bookmarking button from: http://www.addthis.com/"
version = 1

View File

@ -0,0 +1,22 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="g-block">
<img src="<?= url::file("modules/addthis/images/addthis_logo.png") ?>" alt="Add This logo" class="g-right"/>
<h1> <?= t("Add This Social bookmarking") ?> </h1>
<div class="g-block-content">
<p>
<?= t("A collection of all the services and destinations available through AddThis. Some are for sharing and bookmarking, others are 'utilities' like printing and translation.<br/>
AddThis uses services to provide an intelligent, optimized sharing menu that is designed to offer the right options at the right time and maximize distribution of your content - everywhere.") ?>
</p>
<ul>
<li class="g-module-status g-success">
<?= t("You're ready to share your content!") ?>
</li>
</ul>
<p>
<?= t("You don't need an account with Add This, but if you <a href=\"%signup_url\">register with Add This</a> and enter your addthis username in the <a href=\"%advanced_settings_url\">Advanced Settings</a> page you can get Analytics. Example data below.",
array("signup_url" => "http://www.addthis.com/register",
"advanced_settings_url" => html::mark_clean(url::site("admin/advanced_settings")))) ?>
</p>
<center><img src="http://cache.addthiscdn.com/www/q0039/style/images/dashboard/bkg-myaccount-sample.jpg"></center>
</div>
</div>

View File

@ -1,3 +1,7 @@
name = "Adsense"
description = "Display Google Adsense ads"
version = 1
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:adsense"
discuss_url = "http://gallery.menalto.com/forum_module_adsense"

View File

@ -71,7 +71,7 @@ class albumpassword_Controller extends Controller {
// Convert submitted data to local variables.
$album_id = Input::instance()->post("item_id");
$album_password = Input::instance()->post("assignpassword_password");
$album_password = strtolower(Input::instance()->post("assignpassword_password"));
// Check for, and remove, any existing passwords and cached ids.
$existing_password = ORM::factory("items_albumpassword")->where("album_id", "=", $album_id)->find_all();
@ -109,7 +109,7 @@ class albumpassword_Controller extends Controller {
// Display a success message and close the dialog.
message::success(t("Password saved."));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
json::reply(array("result" => "success"));
}
public function logout() {
@ -126,7 +126,7 @@ class albumpassword_Controller extends Controller {
access::verify_csrf();
// Convert submitted data to local variables.
$album_password = Input::instance()->post("albumpassword_password");
$album_password = strtolower(Input::instance()->post("albumpassword_password"));
// See if the submitted password matches any in the database.
$existing_password = ORM::factory("items_albumpassword")
@ -139,10 +139,10 @@ class albumpassword_Controller extends Controller {
cookie::delete("g3_albumpassword_id");
cookie::set("g3_albumpassword", $album_password);
message::success(t("Password Accepted."));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
json::reply(array("result" => "success"));
} else {
message::error(t("Password Rejected."));
print "<html>\n<body>\n<script type=\"text/javascript\">\n$(\"#g-dialog\").dialog(\"close\");\nwindow.location.reload();\n</script>\n</body>\n</html>\n";
json::reply(array("result" => "success"));
}
}

View File

@ -34,7 +34,7 @@ class albumpassword_event_Core {
->id("albumpassword_login")
->css_id("g-album-password-login")
->url(url::site("albumpassword/login"))
->label(t("Enter password")));
->label(t("Unlock albums")));
} else {
// If a password has been entered already
// display the log out link, and links to the protected albums

View File

@ -26,11 +26,70 @@ class albumpassword_task_Core {
->join("albumpassword_idcaches", "items_albumpasswords.id", "albumpassword_idcaches.password_id", "LEFT OUTER")
->and_where("albumpassword_idcaches.password_id", "IS", NULL)->count_all();
return array(Task_Definition::factory()
->callback("albumpassword_task::update_idcaches")
->name(t("Rebuild Album Password ID Caches DB"))
->description(t("Logs the contents of all protected albums into the db."))
->severity($bad_albums ? log::WARNING : log::SUCCESS));
$tasks = array();
$tasks[] = Task_Definition::factory()
->callback("albumpassword_task::update_idcaches")
->name(t("Rebuild Album Password ID Caches DB"))
->description(t("Logs the contents of all protected albums into the db."))
->severity($bad_albums ? log::WARNING : log::SUCCESS);
$tasks[] = Task_Definition::factory()
->callback("albumpassword_task::lowercase_passwords")
->name(t("Fix Password DB Casing"))
->description(t("Fixes case sensitivity issues."))
->severity(log::SUCCESS);
return $tasks;
}
static function lowercase_passwords($task) {
// Converts all passwords to lower case.
$start = microtime(true);
$total = $task->get("total");
$existing_passwords = ORM::factory("items_albumpassword")->find_all();
if (empty($total)) {
// Set the initial values for all variables.
$task->set("total", count($existing_passwords));
$total = $task->get("total");
$task->set("last_password_id", 0);
$task->set("completed_passwords", 0);
}
// Retrieve the values for variables from the last time this
// function was run.
$last_password_id = $task->get("last_password_id");
$completed_passwords = $task->get("completed_passwords");
foreach (ORM::factory("items_albumpassword")
->where("id", ">", $last_password_id)
->order_by("id")
->find_all(100) as $one_password) {
$one_password->password = strtolower($one_password->password);
$one_password->save();
$last_password_id = $one_password->id;
$completed_passwords++;
if ($completed_passwords == count($existing_passwords) || microtime(true) - $start > 1.5) {
break;
}
}
$task->set("last_password_id", $last_password_id);
$task->set("completed_passwords", $completed_passwords);
if ($completed_passwords == count($existing_passwords)) {
$task->done = true;
$task->state = "success";
$task->percent_complete = 100;
} else {
$task->percent_complete = round(100 * $completed_passwords / count($existing_passwords));
}
$task->status = t2("One password fixed", "%count / %total passwords fixed", $completed_passwords,
array("total" => count($existing_passwords)));
}
static function update_idcaches($task) {

View File

@ -1,3 +1,7 @@
name = "Album Password"
description = "Restrict access to individual albums."
version = 3
author_name = "rWatcher"
author_url = "http://codex.gallery2.org/User:RWatcher"
info_url = "http://codex.gallery2.org/Gallery3:Modules:albumpassword"
discuss_url = "http://gallery.menalto.com/node/98856"

View File

@ -20,7 +20,7 @@
class albumtree_installer {
static function install() {
module::set_var("albumtree", "style", "select");
module::set_version("albumtree", 2);
module::set_version("albumtree", 3);
}
static function upgrade($version) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 67 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 861 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 870 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 B

View File

@ -1,3 +1,7 @@
name = "Album Tree"
description = "Provides a block in the sidebar with quick links to all other albums."
version = 2
version = 3
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:albumtree"
discuss_url = "http://gallery.menalto.com/forum_module_albumtree"

View File

@ -0,0 +1,414 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript">
/*--------------------------------------------------|
| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
|---------------------------------------------------|
| Copyright (c) 2002-2003 Geir Landrö |
| |
| This script can be used freely as long as all |
| copyright messages are intact. |
| |
| Updated: 17.04.2003 |
|--------------------------------------------------*/
// Node object
function Node(id, pid, name, url, title, target, icon, iconOpen, open) {
this.id = id;
this.pid = pid;
this.name = name;
this.url = url;
this.title = title;
this.target = target;
this.icon = icon;
this.iconOpen = iconOpen;
this._io = open || false;
this._is = false;
this._ls = false;
this._hc = false;
this._ai = 0;
this._p;
};
// Tree object
function dTree(objName) {
this.config = {
target : null,
folderLinks : true,
useSelection : true,
useCookies : true,
useLines : true,
useIcons : false,
useStatusText : false,
closeSameLevel : false,
inOrder : false,
cookiePath : null,
cookieDomain : null
}
this.obj = objName;
this.aNodes = [];
this.aIndent = [];
this.root = new Node(-1);
this.selectedNode = null;
this.selectedFound = false;
this.completed = false;
};
// Adds a new node to the node array
dTree.prototype.add = function(id, pid, name, url, title, target, icon, iconOpen, open) {
this.aNodes[this.aNodes.length] = new Node(id, pid, name, url, title, target, icon, iconOpen, open);
};
// Open/close all nodes
dTree.prototype.openAll = function() {
this.oAll(true);
};
dTree.prototype.closeAll = function() {
this.oAll(false);
};
// Outputs the tree to the page
dTree.prototype.toString = function() {
var str = '<div class="dtree">\n';
if (document.getElementById) {
if (this.config.useCookies) this.selectedNode = this.getSelected();
str += this.addNode(this.root);
} else str += 'Browser not supported.';
str += '</div>';
if (!this.selectedFound) this.selectedNode = null;
this.completed = true;
return str;
};
// Creates the tree structure
dTree.prototype.addNode = function(pNode) {
var str = '';
var n=0;
if (this.config.inOrder) n = pNode._ai;
for (n; n<this.aNodes.length; n++) {
if (this.aNodes[n].pid == pNode.id) {
var cn = this.aNodes[n];
cn._p = pNode;
cn._ai = n;
this.setCS(cn);
if (!cn.target && this.config.target) cn.target = this.config.target;
if (cn._hc && !cn._io && this.config.useCookies) cn._io = this.isOpen(cn.id);
if (!this.config.folderLinks && cn._hc) cn.url = null;
if (this.config.useSelection && cn.id == this.selectedNode && !this.selectedFound) {
cn._is = true;
this.selectedNode = n;
this.selectedFound = true;
}
str += this.node(cn, n);
if (cn._ls) break;
}
}
return str;
};
// Creates the node icon, url and text
dTree.prototype.node = function(node, nodeId) {
var str = '<div class="dTreeNode" title="' + node.name + '">' + this.indent(node, nodeId);
if (this.config.useIcons) {
if (!node.icon) node.icon = (this.root.id == node.pid) ? this.icon.root : ((node._hc) ? this.icon.folder : this.icon.node);
if (!node.iconOpen) node.iconOpen = (node._hc) ? this.icon.folderOpen : this.icon.node;
if (this.root.id == node.pid) {
node.icon = this.icon.root;
node.iconOpen = this.icon.root;
}
str += '<img id="i' + this.obj + nodeId + '" src="' + ((node._io) ? node.iconOpen : node.icon) + '" alt="" />';
}
if (node.url) {
str += '<a id="s' + this.obj + nodeId + '" class="' + ((this.config.useSelection) ? ((node._is ? 'nodeSel' : 'node')) : 'node') + '" href="' + node.url + '"';
if (node.title) str += ' title="' + node.title + '"';
if (node.target) str += ' target="' + node.target + '"';
if (this.config.useStatusText) str += ' onmouseover="window.status=\'' + node.name + '\';return true;" onmouseout="window.status=\'\';return true;" ';
if (this.config.useSelection && ((node._hc && this.config.folderLinks) || !node._hc))
str += ' onclick="' + this.obj + '.s(' + nodeId + ');"';
str += '>';
}
else if ((!this.config.folderLinks || !node.url) && node._hc && node.pid != this.root.id)
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');" class="node">';
str += node.name;
if (node.url || ((!this.config.folderLinks || !node.url) && node._hc)) str += '</a>';
str += '</div>';
if (node._hc) {
str += '<div id="d' + this.obj + nodeId + '" class="clip" style="display:' + ((this.root.id == node.pid || node._io) ? 'block' : 'none') + ';">';
str += this.addNode(node);
str += '</div>';
}
this.aIndent.pop();
return str;
};
// Adds the empty and line icons
dTree.prototype.indent = function(node, nodeId) {
var str = '';
if (this.root.id != node.pid) {
for (var n=0; n<this.aIndent.length; n++)
str += '<img src="' + ( (this.aIndent[n] == 1 && this.config.useLines) ? this.icon.line : this.icon.empty ) + '" alt="" />';
(node._ls) ? this.aIndent.push(0) : this.aIndent.push(1);
if (node._hc) {
str += '<a href="javascript: ' + this.obj + '.o(' + nodeId + ');"><img id="j' + this.obj + nodeId + '" src="';
if (!this.config.useLines) str += (node._io) ? this.icon.nlMinus : this.icon.nlPlus;
else str += ( (node._io) ? ((node._ls && this.config.useLines) ? this.icon.minusBottom : this.icon.minus) : ((node._ls && this.config.useLines) ? this.icon.plusBottom : this.icon.plus ) );
str += '" alt="" /></a>';
} else str += '<img src="' + ( (this.config.useLines) ? ((node._ls) ? this.icon.joinBottom : this.icon.join ) : this.icon.empty) + '" alt="" />';
}
return str;
};
// Checks if a node has any children and if it is the last sibling
dTree.prototype.setCS = function(node) {
var lastId;
for (var n=0; n<this.aNodes.length; n++) {
if (this.aNodes[n].pid == node.id) node._hc = true;
if (this.aNodes[n].pid == node.pid) lastId = this.aNodes[n].id;
}
if (lastId==node.id) node._ls = true;
};
// Returns the selected node
dTree.prototype.getSelected = function() {
var sn = this.getCookie('cs' + this.obj);
return (sn) ? sn : null;
};
// Highlights the selected node
dTree.prototype.s = function(id) {
if (!this.config.useSelection) return;
var cn = this.aNodes[id];
if (cn._hc && !this.config.folderLinks) return;
if (this.selectedNode != id) {
if (this.selectedNode || this.selectedNode==0) {
eOld = document.getElementById("s" + this.obj + this.selectedNode);
eOld.className = "node";
}
eNew = document.getElementById("s" + this.obj + id);
eNew.className = "nodeSel";
this.selectedNode = id;
if (this.config.useCookies) this.setCookie('cs' + this.obj, cn.id);
}
};
// Toggle Open or close
dTree.prototype.o = function(id) {
var cn = this.aNodes[id];
this.nodeStatus(!cn._io, id, cn._ls);
cn._io = !cn._io;
if (this.config.closeSameLevel) this.closeLevel(cn);
if (this.config.useCookies) this.updateCookie();
};
// Open or close all nodes
dTree.prototype.oAll = function(status) {
for (var n=0; n<this.aNodes.length; n++) {
if (this.aNodes[n]._hc && this.aNodes[n].pid != this.root.id) {
this.nodeStatus(status, n, this.aNodes[n]._ls)
this.aNodes[n]._io = status;
}
}
if (this.config.useCookies) this.updateCookie();
};
// Opens the tree to a specific node
dTree.prototype.openTo = function(nId, bSelect, bFirst) {
if (!bFirst) {
for (var n=0; n<this.aNodes.length; n++) {
if (this.aNodes[n].id == nId) {
nId=n;
break;
}
}
}
var cn=this.aNodes[nId];
if (cn.pid==this.root.id || !cn._p) return;
cn._io = true;
cn._is = bSelect;
if (this.completed && cn._hc) this.nodeStatus(true, cn._ai, cn._ls);
if (this.completed && bSelect) this.s(cn._ai);
else if (bSelect) this._sn=cn._ai;
this.openTo(cn._p._ai, false, true);
};
// Closes all nodes on the same level as certain node
dTree.prototype.closeLevel = function(node) {
for (var n=0; n<this.aNodes.length; n++) {
if (this.aNodes[n].pid == node.pid && this.aNodes[n].id != node.id && this.aNodes[n]._hc) {
this.nodeStatus(false, n, this.aNodes[n]._ls);
this.aNodes[n]._io = false;
this.closeAllChildren(this.aNodes[n]);
}
}
}
// Closes all children of a node
dTree.prototype.closeAllChildren = function(node) {
for (var n=0; n<this.aNodes.length; n++) {
if (this.aNodes[n].pid == node.id && this.aNodes[n]._hc) {
if (this.aNodes[n]._io) this.nodeStatus(false, n, this.aNodes[n]._ls);
this.aNodes[n]._io = false;
this.closeAllChildren(this.aNodes[n]);
}
}
}
// Change the status of a node(open or closed)
dTree.prototype.nodeStatus = function(status, id, bottom) {
eDiv = document.getElementById('d' + this.obj + id);
eJoin = document.getElementById('j' + this.obj + id);
if (this.config.useIcons) {
eIcon = document.getElementById('i' + this.obj + id);
eIcon.src = (status) ? this.aNodes[id].iconOpen : this.aNodes[id].icon;
}
eJoin.src = (this.config.useLines)?
((status)?((bottom)?this.icon.minusBottom:this.icon.minus):((bottom)?this.icon.plusBottom:this.icon.plus)):
((status)?this.icon.nlMinus:this.icon.nlPlus);
eDiv.style.display = (status) ? 'block': 'none';
};
// [Cookie] Clears a cookie
dTree.prototype.clearCookie = function() {
var now = new Date();
var yesterday = new Date(now.getTime() - 1000 * 60 * 60 * 24);
this.setCookie('co'+this.obj, 'cookieValue', yesterday);
this.setCookie('cs'+this.obj, 'cookieValue', yesterday);
};
// [Cookie] Sets value in a cookie
dTree.prototype.setCookie = function(cookieName, cookieValue, expires, path, domain, secure) {
path = path || this.config.cookiePath;
domain = domain || this.config.cookieDomain;
document.cookie =
escape(cookieName) + '=' + escape(cookieValue)
+ (expires ? '; expires=' + expires.toGMTString() : '')
+ (path ? '; path=' + path : '')
+ (domain ? '; domain=' + domain : '')
+ (secure ? '; secure' : '');
};
// [Cookie] Gets a value from a cookie
dTree.prototype.getCookie = function(cookieName) {
var cookieValue = '';
var posName = document.cookie.indexOf(escape(cookieName) + '=');
if (posName != -1) {
var posValue = posName + (escape(cookieName) + '=').length;
var endPos = document.cookie.indexOf(';', posValue);
if (endPos != -1) cookieValue = unescape(document.cookie.substring(posValue, endPos));
else cookieValue = unescape(document.cookie.substring(posValue));
}
return (cookieValue);
};
// [Cookie] Returns ids of open nodes as a string
dTree.prototype.updateCookie = function() {
var str = '';
for (var n=0; n<this.aNodes.length; n++) {
if (this.aNodes[n]._io && this.aNodes[n].pid != this.root.id) {
if (str) str += '.';
str += this.aNodes[n].id;
}
}
this.setCookie('co' + this.obj, str);
};
// [Cookie] Checks if a node id is in a cookie
dTree.prototype.isOpen = function(id) {
var aOpen = this.getCookie('co' + this.obj).split('.');
for (var n=0; n<aOpen.length; n++)
if (aOpen[n] == id) return true;
return false;
};
// If Push and pop is not implemented by the browser
if (!Array.prototype.push) {
Array.prototype.push = function array_push() {
for(var i=0;i<arguments.length;i++)
this[this.length]=arguments[i];
return this.length;
}
};
if (!Array.prototype.pop) {
Array.prototype.pop = function array_pop() {
lastElement = this[this.length-1];
this.length = Math.max(this.length-1,0);
return lastElement;
}
};
</script>
<style type="text/css">
/*--------------------------------------------------|
| dTree 2.05 | www.destroydrop.com/javascript/tree/ |
|---------------------------------------------------|
| Copyright (c) 2002-2003 Geir Landrö |
|--------------------------------------------------*/
.dtree {
font-size: 1.05em;
white-space: nowrap;
}
.dtree img {
border: 0px;
vertical-align: middle;
}
.dtree a.node, .dtree a.nodeSel {
white-space: nowrap;
padding: 1px 2px 1px 2px;
}
.dtree a.nodeSel {
font-style: italic;
}
.dtree .clip {
overflow: hidden;
}
</style>
<div class="block-albumselect-AlbumTree gbBlock">
<div class="dtree">
<script type="text/javascript">
// <![CDATA[
function albumSelect_goToNode(nodeId) {
document.location = new String('main.php?g2_itemId=__ID__').replace('__ID__', nodeId);
}
var albumTree = new dTree('albumTree');
var albumTree_images = '<?= item::root()->url() ?>modules/albumtree/images/'
albumTree.icon = {
root : albumTree_images + 'base.gif',
folder : albumTree_images + 'folder.gif',
folderOpen : albumTree_images + 'imgfolder.gif',
node : albumTree_images + 'imgfolder.gif',
empty : albumTree_images + 'empty.gif',
line : albumTree_images + 'line.gif',
join : albumTree_images + 'join.gif',
joinBottom : albumTree_images + 'joinbottom.gif',
plus : albumTree_images + 'plus.gif',
plusBottom : albumTree_images + 'plusbottom.gif',
minus : albumTree_images + 'minus.gif',
minusBottom : albumTree_images + 'minusbottom.gif',
nlPlus : albumTree_images + 'nolines_plus.gif',
nlMinus : albumTree_images + 'nolines_minus.gif'
};
albumTree.config.useLines = true;
albumTree.config.useIcons = false;
albumTree.config.useCookies = false;
albumTree.config.closeSameLevel = false;
albumTree.config.cookiePath = '<?= item::root()->url() ?>';
albumTree.config.cookieDomain = '';
{ var pf = '<?= item::root()->url() ?>';
<?
function addtree($album){
?>
albumTree.add(<?= $album->id -1 ?>, <?= $album->parent_id -1 ?>, "<?= $album->title ?>", pf+'<?= $album->relative_url() ?>');
<?
foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child){
addtree($child);
}
}
addtree($root);
?>
}
document.write(albumTree);
// ]]>
</script>
</div>
</div>

View File

@ -10,29 +10,21 @@
</style>
<ul class="treealbumnav">
<? // We'll keep track of the list of items that we want to display in a stack ?>
<? $stack = array(array(0, $root)) ?>
<? // While there are still items to show, pick the next one and show it ?>
<? while ($stack): ?>
<? list($level, $album) = array_pop($stack) ?>
<?
function makelist($album,$level){
//print out the list item
?>
<li>
<a href="/index.php/items/<?= $album->id ?>"><?= str_repeat("&nbsp;&nbsp;", $level) ?><?= $album->title ?>
<a href="<?= item::root()->url() ?><?= $album->relative_url() ?>"><?= str_repeat("&nbsp;&nbsp;", $level) ?><?= $album->title ?></a>
</li>
<? // Then take all of that album's children and put them next on the stack. ?>
<? $tmp = array(); ?>
<? foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child): ?>
<? $tmp[] = array($level + 1, $child) ?>
<? endforeach ?>
<? // Since we'll pull them off the stack in the opposite order that we put them on, ?>
<? // and the order that we put them on is the order in which we want to display them, ?>
<? // We need to reverse the order of the children on the stack ?>
<? if ($tmp): ?>
<? $stack = array_merge($stack, array_reverse($tmp)) ?>
<? endif ?>
<? endwhile ?>
<?
//recurse over the children, and print their list items as well
foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child){
makelist($child,$level+1);
}
}
makelist($root,0);
?>
</ul>

View File

@ -1,24 +1,16 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<select onchange="window.location='<?= url::site("items/__ID__")?>'.replace('__ID__', this.value)">
<? // We'll keep track of the list of items that we want to display in a stack ?>
<? $stack = array(array(0, $root)) ?>
<? // While there are still items to show, pick the next one and show it ?>
<? while ($stack): ?>
<? list($level, $album) = array_pop($stack) ?>
<option value="<?= $album->id ?>"><?= str_repeat("&nbsp;&nbsp;", $level) ?><?= $album->title ?></option>
<? // Then take all of that album's children and put them next on the stack. ?>
<? $tmp = array(); ?>
<? foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child): ?>
<? $tmp[] = array($level + 1, $child) ?>
<? endforeach ?>
<? // Since we'll pull them off the stack in the opposite order that we put them on, ?>
<? // and the order that we put them on is the order in which we want to display them, ?>
<? // We need to reverse the order of the children on the stack ?>
<? if ($tmp): ?>
<? $stack = array_merge($stack, array_reverse($tmp)) ?>
<? endif ?>
<? endwhile ?>
<select onchange="window.location=this.value">
<?
function makeselect($album, $level){
//print out the list item as a select option
?>
<option value="<?= item::root()->url() ?><?= $album->relative_url() ?>"><?= str_repeat("&nbsp;&nbsp;", $level) ?><?= $album->title ?></option>
<?
//recurse over the children, and print their list items as well
foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child){
makeselect($child,$level+1);
}
}
makeselect($root,0);
?>
</select>

View File

@ -0,0 +1,56 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-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 All_Tags_Controller extends Controller {
public function index() {
$template = new Theme_View("page.html", "other", "All Tags");
$template->css("all_tags.css");
$template->page_title = t("Gallery :: All Tags");
$template->content = new View("all_tags.html");
$filter = Input::instance()->get("filter");
$template->content->filter = $filter;
$query = ORM::factory("tag");
if ($filter) {
$query->like("name", $filter);
}
$template->content->tags = $query->order_by("name", "ASC")->find_all();
print $template;
}
}
/*
public function index() {
$filter = Input::instance()->get("filter");
$view = new Admin_View("admin.html");
$view->page_title = t("Manage tags");
$view->content = new View("admin_tags.html");
$view->content->filter = $filter;
$query = ORM::factory("tag");
if ($filter) {
$query->like("name", $filter);
}
$view->content->tags = $query->order_by("name", "ASC")->find_all();
print $view;
}
*/

View File

@ -0,0 +1,2 @@
table.all_tags { text-align: center; width:500px; }
table.all_tags caption { font-size: 1.5em; padding: 0.2em; }

View File

@ -0,0 +1,29 @@
<?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 all_tags_event_Core {
static function site_menu($menu, $theme) {
if (module::get_var("all_tags", "hidden") != true) {
$menu->add_after("home", Menu::factory("link")
->id("all_tags")
->label(t("All Tags"))
->url(url::site("all_tags/")));
}
}
}

View File

@ -0,0 +1,24 @@
<?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 all_tags_theme_Core {
static function head($theme) {
return $theme->css("all_tags.css");
}
}

View File

@ -0,0 +1,7 @@
name = "All Tags"
description = "All Tags page and menu item."
version = 2
author_name = "Undagiga"
author_url = "http://codex.gallery2.org/User:Undagiga"
info_url = "http://codex.gallery2.org/Gallery3:Modules:all_tags"
discuss_url = "http://gallery.menalto.com/forum_module_all_tags"

View File

@ -0,0 +1,44 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? $tags_per_column = $tags->count()/5 ?>
<? $column_tag_count = 0 ?>
<div class="g-block">
<h1> <?= t("All Tags in the Gallery") ?> </h1>
<div class="g-block-content">
<table id="g-tag-admin">
<caption>
<?= t2("There is one tag", "There are %count tags", $tags->count()) ?>
</caption>
<tr>
<td>
<? foreach ($tags as $i => $tag): ?>
<? $current_letter = strtoupper(mb_substr($tag->name, 0, 1)) ?>
<? if ($i == 0): /* first letter */ ?>
<strong><?= html::clean($current_letter) ?></strong>
<ul>
<? elseif ($last_letter != $current_letter): /* new letter */ ?>
</ul>
<? if ($column_tag_count > $tags_per_column): /* new column */ ?>
<? $column_tag_count = 0 ?>
</td>
<td>
<? endif ?>
<strong><?= html::clean($current_letter) ?></strong>
<ul>
<? endif ?>
<li>
<span class="g-editable g-tag-name" rel="<?= $tag->id ?>"><a href="<?= $tag->url() ?>"><?= html::clean($tag->name) ?></a></span>
<span class="g-understate">(<?= $tag->count ?>)</span>
</li>
<? $column_tag_count++ ?>
<? $last_letter = $current_letter ?>
<? endforeach ?>
</ul>
</td>
</tr>
</table>
</div>
</div>

View File

@ -1,3 +1,7 @@
name = "Atom"
description = "Enable Atom feeds in your Gallery"
version = 1
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:atom"
discuss_url = "http://gallery.menalto.com/forum_module_atom"

View File

@ -1,3 +1,7 @@
name = "Author"
description = "Allows for the display and modification of the Author/Photographer/Byline data in photos."
version = 2
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:author"
discuss_url = "http://gallery.menalto.com/forum_module_author"

View File

@ -1,3 +1,7 @@
name = "Autorotate"
description = "Rotate an image automatically on upload based on EXIF data"
version = 2
version = 2
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:autorotate"
discuss_url = "http://gallery.menalto.com/forum_module_autorotate"

View File

@ -1,3 +1,7 @@
name = "Amazon S3"
description = "Seamlessly transfer your Gallery data to Amazon S3 CDN for a lightning fast gallery"
version = 2
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:aws_s3"
discuss_url = "http://gallery.menalto.com/forum_module_aws_s3"

View File

@ -1,3 +1,7 @@
name = "Shopping Basket"
description = "Provides a simple shopping basket and checkout with paypal integration"
version = 5
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:basket"
discuss_url = "http://gallery.menalto.com/forum_module_basket"

View File

@ -1,3 +1,7 @@
name = "BatchTag"
description = "Automatically apply a tag to the entire contents of an album."
version = 1
author_name = "rWatcher"
author_url = "http://codex.gallery2.org/User:RWatcher"
info_url = "http://codex.gallery2.org/Gallery3:Modules:batchtag"
discuss_url = "http://gallery.menalto.com/node/101076"

View File

@ -1,3 +1,7 @@
name = "CalendarView"
description = "View your photos by the date they were taken."
version = 1
version = 1
author_name = "rWatcher"
author_url = "http://codex.gallery2.org/User:RWatcher"
info_url = "http://codex.gallery2.org/Gallery3:Modules:calendarview"
discuss_url = "http://gallery.menalto.com/node/92405"

View File

@ -38,7 +38,7 @@
// Check and see if any photos were taken in January,
// If so, make the month title into a clickable link.
print "<div id=\"g-calendar-grid\">";
if (date("n", $items_for_year[$counter]->captured) == 1) {
if ((count($items_for_year) > 0) && (date("n", $items_for_year[$counter]->captured) == 1)) {
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $calendar_user . "/" . $counter_months . "/");
} else {
$month_url = "";

View File

@ -1,3 +1,7 @@
name = "Captionator"
description = "Caption all photos, movies and albums in an album at once."
version = 1
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:captionator"
discuss_url = "http://gallery.menalto.com/forum_module_captionator"

View File

@ -34,7 +34,7 @@
<ul>
<li>
<label for="title[<?= $child->id ?>]"> <?= t("Title") ?> </label>
<input type="text" name="title[<?= $child->id ?>]" value="<?= htmlspecialchars($child->title, ENT_QUOTES, Kohana::CHARSET) ?>"/>
<input type="text" name="title[<?= $child->id ?>]" value="<?= html::chars($child->title) ?>"/>
</li>
<li>
<label for="description[<?= $child->id ?>]"> <?= t("Description") ?> </label>
@ -43,16 +43,16 @@
<? if ($enable_tags): ?>
<li>
<label for="tags[<?= $child->id ?>]"> <?= t("Tags (comma separated)") ?> </label>
<input type="text" name="tags[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= htmlspecialchars($tags[$child->id], ENT_QUOTES, Kohana::CHARSET) ?>"/>
<input type="text" name="tags[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= html::chars($tags[$child->id]) ?>"/>
</li>
<? endif ?>
<li>
<label for="filename[<?= $child->id ?>]"> <?= t("Filename") ?> </label>
<input type="text" name="filename[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= htmlspecialchars($child->name, ENT_QUOTES, Kohana::CHARSET) ?>"/>
<input type="text" name="filename[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= html::chars($child->name) ?>"/>
</li>
<li>
<label for="internetaddress[<?= $child->id ?>]"> <?= t("Internet Address") ?> </label>
<input type="text" name="internetaddress[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= htmlspecialchars($child->slug, ENT_QUOTES, Kohana::CHARSET) ?>"/>
<input type="text" name="internetaddress[<?= $child->id ?>]" class="ac_input" autocomplete="off" value="<?= html::chars($child->slug) ?>"/>
</li>
</ul>
</td>

View File

@ -0,0 +1,183 @@
<?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_Carousel_Controller extends Admin_Controller {
public function index() {
print $this->_get_view();
}
public function handler() {
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate()) {
module::set_var(
"carousel", "circular", $form->carousel->circular->value);
module::set_var(
"carousel", "autoscroll", $form->carousel->autoscroll->value);
module::set_var(
"carousel", "autostart", $form->carousel->autostart->value);
module::set_var(
"carousel", "speed", $form->carousel->speed->value);
module::set_var(
"carousel", "mousewheel", $form->carousel->mousewheel->value);
module::set_var(
"carousel", "title2", $form->recent->title2->value);
module::set_var(
"carousel", "thumbsize2", $form->recent->thumbsize2->value);
module::set_var(
"carousel", "visible2", $form->recent->visible2->value);
module::set_var(
"carousel", "quantity2", $form->recent->quantity2->value);
module::set_var(
"carousel", "onphoto2", $form->recent->onphoto2->value);
module::set_var(
"carousel", "onalbum2", $form->recent->onalbum2->value);
module::set_var(
"carousel", "title3", $form->popular->title3->value);
module::set_var(
"carousel", "thumbsize3", $form->popular->thumbsize3->value);
module::set_var(
"carousel", "visible3", $form->popular->visible3->value);
module::set_var(
"carousel", "quantity3", $form->popular->quantity3->value);
module::set_var(
"carousel", "onphoto3", $form->popular->onphoto3->value);
module::set_var(
"carousel", "onalbum3", $form->popular->onalbum3->value);
module::set_var(
"carousel", "title", $form->random->title->value);
module::set_var(
"carousel", "thumbsize", $form->random->thumbsize->value);
module::set_var(
"carousel", "visible", $form->random->visible->value);
module::set_var(
"carousel", "quantity", $form->random->quantity->value);
module::set_var(
"carousel", "onphoto", $form->random->onphoto->value);
module::set_var(
"carousel", "onalbum", $form->random->onalbum->value);
message::success(t("Your settings have been saved."));
url::redirect("admin/carousel");
}
print $this->_get_view($form);
}
private function _get_view($form=null) {
$v = new Admin_View("admin.html");
$v->content = new View("admin_carousel.html");
$v->content->form = empty($form) ? $this->_get_form() : $form;
return $v;
}
private function _get_form() {
for ($i = 5; $i <= 50; $i+=5) {
$range[$i] = "$i";
}
$shortrange = array();
for ($i = 1; $i < 21; $i++) {
$key=((float)$i / 2);
$shortrange["$key"] = sprintf("%.1f", (float)$i / 2);
}
if (module::get_var("carousel", "autoscroll") == true) {
$disableme == "false";
} else {
$disableme == "true";
}
$form = new Forge("admin/carousel/handler", "", "post", array("id" => "g-admin-form"));
$group = $form->group("carousel")->label(t("General carousel settings"));
$group->checkbox("circular")->label(t('Enable the carousel to be circular so it starts over again from the beggining.'))
->checked(module::get_var("carousel", "circular", "0"));
$group->checkbox("autoscroll")->label(t('Carousel should auto scroll. Toggle value to change settings below.'))
->onClick("toggle()")
->id("autoscroll")
->checked(module::get_var("carousel", "autoscroll", "0"));
$group->input("autostart")->label(t("Enter the value of the auto start. (800)"))
->value(module::get_var("carousel", "autostart", "800"))
->id("auto")
->disabled("false")
->rules("valid_numeric|length[1,5]");
$group->input("speed")->label(t('Enter the scrolling speed of the carousel. (1000)'))
->value(module::get_var("carousel", "speed", "1000"))
->id("speed")
->disabled($disableme)
->rules("valid_numeric|length[1,5]");
$group->checkbox("mousewheel")->label(t('Enable mouse wheel. Allows for mouse wheel to scroll items.'))
->checked(module::get_var("carousel", "mousewheel", "0"));
$group = $form->group("recent")->label(t("Recent carousel block"));
$group->input("title2")->label(t('Enter the title of the recent block.'))
->value(module::get_var("carousel", "title2", "Recent items"));
$group->input("thumbsize2")->label(t('Enter the size of the thumbs. (pixels)'))
->value(module::get_var("carousel", "thumbsize2", "200"))
->rules("valid_numeric|length[2,3]");
$group->dropdown("visible2")->label(t('Enter number of thumbs to show. (height of carousel)'))
->options($shortrange)
->selected(module::get_var("carousel", "visible2", "1"));
$group->dropdown("quantity2")->label(t("Choose the toal quantity of thumbs in recent carousel."))
->options($range)
->selected(module::get_var("carousel", "quantity2", "25"));
$group->checkbox("onalbum2")->label(t("Show on album & collection pages"))
->checked(module::get_var("carousel", "onalbum2", "0"));
$group->checkbox("onphoto2")->label(t("Show on photo pages"))
->checked(module::get_var("carousel", "onphoto2", "0"));
$group = $form->group("popular")->label(t("Popular carousel block"));
$group->input("title3")->label(t('Enter the title of the popular block.'))
->value(module::get_var("carousel", "title3", "Popular items"));
$group->input("thumbsize3")->label(t('Enter the thumb size. (pixels)'))
->value(module::get_var("carousel", "thumbsize3", "200"))
->rules("valid_numeric|length[2,3]");
$group->dropdown("visible3")->label(t('Enter number of thumbs to show. (height of carousel)'))
->options($shortrange)
->selected(module::get_var("carousel", "visible3", "1"));
$group->dropdown("quantity3")->label(t("Choose the toal quantity of thumbs in popular carousel."))
->options($range)
->selected(module::get_var("carousel", "quantity3", "25"));
$group->checkbox("onalbum3")->label(t("Show on album & collection pages"))
->checked(module::get_var("carousel", "onalbum3", "0"));
$group->checkbox("onphoto3")->label(t("Show on photo pages"))
->checked(module::get_var("carousel", "onphoto3", "0"));
$group = $form->group("random")->label(t("Random carousel block. Some issues with smaller galleries."));
$group->input("title")->label(t('Enter the title of the random block.'))
->value(module::get_var("carousel", "title", "Random items"));
$group->input("thumbsize")->label(t('Enter the thumb size. (pixels)'))
->value(module::get_var("carousel", "thumbsize", "200"))
->rules("valid_numeric|length[2,3]");
$group->dropdown("visible")->label(t('Enter number of thumbs to show. (height of carousel)'))
->options($shortrange)
->selected(module::get_var("carousel", "visible", "1"));
$group->dropdown("quantity")->label(t("Choose the toal quantity of thumbs in random carousel."))
->options($range)
->selected(module::get_var("carousel", "quantity", "25"));
$group->checkbox("onalbum")->label(t("Show on album & collection pages"))
->checked(module::get_var("carousel", "onalbum", "0"));
$group->checkbox("onphoto")->label(t("Show on photo pages"))
->checked(module::get_var("carousel", "onphoto", "0"));
$form->submit("submit")->value(t("Save"));
return $form;
}
}

View File

@ -0,0 +1,30 @@
.jcarousel-container {
-moz-border-radius: 10px;
background: #F0F6F9;
border: 1px solid #346F97;
}
.jcarousel-container-vertical {
width: 75px;
height: 245px;
padding: 40px 20px;
}
.jcarousel-clip-vertical {
width: 75px;
height: 245px;
}
.jcarousel-item {
width: 75px;
height: 75px;
}
.jcarousel-item-vertical {
margin-bottom: 10px;
}
.jcarousel-item-placeholder {
background: #fff;
color: #000;
}

View File

@ -0,0 +1,61 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class carousel_block_Core {
static function get_site_list() {
return array(
"carousel_recent" => t("Recent items carousel"),
"carousel_popular" => t("Popular items carousel"),
"carousel_random" => t("Random items carousel"));
}
static function get($block_id, $theme) {
$block = "";
switch ($block_id) {
case "carousel_recent":
if (module::get_var("carousel", "onalbum2") && $theme->page_type == "collection" ||
module::get_var("carousel", "onphoto2") && $theme->page_type == "item") {
$block = new Block();
$block->css_id = "g-carousel-rec";
$block->title = module::get_var("carousel", "title2", "Recent items");
$block->content = new View("carousel_recent.html");
}
break;
case "carousel_popular":
if (module::get_var("carousel", "onalbum3") && $theme->page_type == "collection" ||
module::get_var("carousel", "onphoto3") && $theme->page_type == "item") {
$block = new Block();
$block->css_id = "g-carousel-pop";
$block->title = module::get_var("carousel", "title3", "Popular items");
$block->content = new View("carousel_popular.html");
}
break;
case "carousel_random":
if (module::get_var("carousel", "onalbum") && $theme->page_type == "collection" ||
module::get_var("carousel", "onphoto") && $theme->page_type == "item") {
$block = new Block();
$block->css_id = "g-carousel-ran";
$block->title = module::get_var("carousel", "title", "Random items");
$block->content = new View("carousel_random.html");
}
break;
}
return $block;
}
}

View File

@ -0,0 +1,28 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2009 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class carousel_event_Core {
static function admin_menu($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("carousel_menu")
->label(t("Carousel"))
->url(url::site("admin/carousel")));
}
}

View File

@ -0,0 +1,24 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2010 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 carousel_theme_Core {
static function head($theme) {
return $theme->script("jcarousellite.min.js");
}
}

View File

@ -0,0 +1 @@
(function($){$.fn.jCarouselLite=function(o){o=$.extend({btnPrev:null,btnNext:null,btnGo:null,mouseWheel:false,auto:null,speed:200,easing:null,vertical:false,circular:true,visible:3,start:0,scroll:1,beforeStart:null,afterEnd:null},o||{});return this.each(function(){var b=false,animCss=o.vertical?"top":"left",sizeCss=o.vertical?"height":"width";var c=$(this),ul=$("ul",c),tLi=$("li",ul),tl=tLi.size(),v=o.visible;if(o.circular){ul.prepend(tLi.slice(tl-v-1+1).clone()).append(tLi.slice(0,v).clone());o.start+=v}var f=$("li",ul),itemLength=f.size(),curr=o.start;c.css("visibility","visible");f.css({overflow:"hidden",float:o.vertical?"none":"left"});ul.css({margin:"0",padding:"0",position:"relative","list-style-type":"none","z-index":"1"});c.css({overflow:"hidden",position:"relative","z-index":"2",left:"0px"});var g=o.vertical?height(f):width(f);var h=g*itemLength;var j=g*v;f.css({width:f.width(),height:f.height()});ul.css(sizeCss,h+"px").css(animCss,-(curr*g));c.css(sizeCss,j+"px");if(o.btnPrev)$(o.btnPrev).click(function(){return go(curr-o.scroll)});if(o.btnNext)$(o.btnNext).click(function(){return go(curr+o.scroll)});if(o.btnGo)$.each(o.btnGo,function(i,a){$(a).click(function(){return go(o.circular?o.visible+i:i)})});if(o.mouseWheel&&c.mousewheel)c.mousewheel(function(e,d){return d>0?go(curr-o.scroll):go(curr+o.scroll)});if(o.auto)setInterval(function(){go(curr+o.scroll)},o.auto+o.speed);function vis(){return f.slice(curr).slice(0,v)};function go(a){if(!b){if(o.beforeStart)o.beforeStart.call(this,vis());if(o.circular){if(a<=o.start-v-1){ul.css(animCss,-((itemLength-(v*2))*g)+"px");curr=a==o.start-v-1?itemLength-(v*2)-1:itemLength-(v*2)-o.scroll}else if(a>=itemLength-v+1){ul.css(animCss,-((v)*g)+"px");curr=a==itemLength-v+1?v+1:v+o.scroll}else curr=a}else{if(a<0||a>itemLength-v)return;else curr=a}b=true;ul.animate(animCss=="left"?{left:-(curr*g)}:{top:-(curr*g)},o.speed,o.easing,function(){if(o.afterEnd)o.afterEnd.call(this,vis());b=false});if(!o.circular){$(o.btnPrev+","+o.btnNext).removeClass("disabled");$((curr-o.scroll<0&&o.btnPrev)||(curr+o.scroll>itemLength-v&&o.btnNext)||[]).addClass("disabled")}}return false}})};function css(a,b){return parseInt($.css(a[0],b))||0};function width(a){return a[0].offsetWidth+css(a,'marginLeft')+css(a,'marginRight')};function height(a){return a[0].offsetHeight+css(a,'marginTop')+css(a,'marginBottom')}})(jQuery);

View File

@ -0,0 +1,364 @@
/**
* jCarouselLite - jQuery plugin to navigate images/any content in a carousel style widget.
* @requires jQuery v1.2 or above
*
* http://gmarwaha.com/jquery/jcarousellite/
*
* Copyright (c) 2007 Ganeshji Marwaha (gmarwaha.com)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* Version: 1.0.1
* Note: Requires jquery 1.2 or above from version 1.0.1
*/
/**
* Creates a carousel-style navigation widget for images/any-content from a simple HTML markup.
*
* The HTML markup that is used to build the carousel can be as simple as...
*
* <div class="carousel">
* <ul>
* <li><img src="image/1.jpg" alt="1"></li>
* <li><img src="image/2.jpg" alt="2"></li>
* <li><img src="image/3.jpg" alt="3"></li>
* </ul>
* </div>
*
* As you can see, this snippet is nothing but a simple div containing an unordered list of images.
* You don't need any special "class" attribute, or a special "css" file for this plugin.
* I am using a class attribute just for the sake of explanation here.
*
* To navigate the elements of the carousel, you need some kind of navigation buttons.
* For example, you will need a "previous" button to go backward, and a "next" button to go forward.
* This need not be part of the carousel "div" itself. It can be any element in your page.
* Lets assume that the following elements in your document can be used as next, and prev buttons...
*
* <button class="prev">&lt;&lt;</button>
* <button class="next">&gt;&gt;</button>
*
* Now, all you need to do is call the carousel component on the div element that represents it, and pass in the
* navigation buttons as options.
*
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev"
* });
*
* That's it, you would have now converted your raw div, into a magnificient carousel.
*
* There are quite a few other options that you can use to customize it though.
* Each will be explained with an example below.
*
* @param an options object - You can specify all the options shown below as an options object param.
*
* @option btnPrev, btnNext : string - no defaults
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev"
* });
* @desc Creates a basic carousel. Clicking "btnPrev" navigates backwards and "btnNext" navigates forward.
*
* @option btnGo - array - no defaults
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* btnGo: [".0", ".1", ".2"]
* });
* @desc If you don't want next and previous buttons for navigation, instead you prefer custom navigation based on
* the item number within the carousel, you can use this option. Just supply an array of selectors for each element
* in the carousel. The index of the array represents the index of the element. What i mean is, if the
* first element in the array is ".0", it means that when the element represented by ".0" is clicked, the carousel
* will slide to the first element and so on and so forth. This feature is very powerful. For example, i made a tabbed
* interface out of it by making my navigation elements styled like tabs in css. As the carousel is capable of holding
* any content, not just images, you can have a very simple tabbed navigation in minutes without using any other plugin.
* The best part is that, the tab will "slide" based on the provided effect. :-)
*
* @option mouseWheel : boolean - default is false
* @example
* $(".carousel").jCarouselLite({
* mouseWheel: true
* });
* @desc The carousel can also be navigated using the mouse wheel interface of a scroll mouse instead of using buttons.
* To get this feature working, you have to do 2 things. First, you have to include the mouse-wheel plugin from brandon.
* Second, you will have to set the option "mouseWheel" to true. That's it, now you will be able to navigate your carousel
* using the mouse wheel. Using buttons and mouseWheel or not mutually exclusive. You can still have buttons for navigation
* as well. They complement each other. To use both together, just supply the options required for both as shown below.
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* mouseWheel: true
* });
*
* @option auto : number - default is null, meaning autoscroll is disabled by default
* @example
* $(".carousel").jCarouselLite({
* auto: 800,
* speed: 500
* });
* @desc You can make your carousel auto-navigate itself by specfying a millisecond value in this option.
* The value you specify is the amount of time between 2 slides. The default is null, and that disables auto scrolling.
* Specify this value and magically your carousel will start auto scrolling.
*
* @option speed : number - 200 is default
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* speed: 800
* });
* @desc Specifying a speed will slow-down or speed-up the sliding speed of your carousel. Try it out with
* different speeds like 800, 600, 1500 etc. Providing 0, will remove the slide effect.
*
* @option easing : string - no easing effects by default.
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* easing: "bounceout"
* });
* @desc You can specify any easing effect. Note: You need easing plugin for that. Once specified,
* the carousel will slide based on the provided easing effect.
*
* @option vertical : boolean - default is false
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* vertical: true
* });
* @desc Determines the direction of the carousel. true, means the carousel will display vertically. The next and
* prev buttons will slide the items vertically as well. The default is false, which means that the carousel will
* display horizontally. The next and prev items will slide the items from left-right in this case.
*
* @option circular : boolean - default is true
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* circular: false
* });
* @desc Setting it to true enables circular navigation. This means, if you click "next" after you reach the last
* element, you will automatically slide to the first element and vice versa. If you set circular to false, then
* if you click on the "next" button after you reach the last element, you will stay in the last element itself
* and similarly for "previous" button and first element.
*
* @option visible : number - default is 3
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* visible: 4
* });
* @desc This specifies the number of items visible at all times within the carousel. The default is 3.
* You are even free to experiment with real numbers. Eg: "3.5" will have 3 items fully visible and the
* last item half visible. This gives you the effect of showing the user that there are more images to the right.
*
* @option start : number - default is 0
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* start: 2
* });
* @desc You can specify from which item the carousel should start. Remember, the first item in the carousel
* has a start of 0, and so on.
*
* @option scrool : number - default is 1
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* scroll: 2
* });
* @desc The number of items that should scroll/slide when you click the next/prev navigation buttons. By
* default, only one item is scrolled, but you may set it to any number. Eg: setting it to "2" will scroll
* 2 items when you click the next or previous buttons.
*
* @option beforeStart, afterEnd : function - callbacks
* @example
* $(".carousel").jCarouselLite({
* btnNext: ".next",
* btnPrev: ".prev",
* beforeStart: function(a) {
* alert("Before animation starts:" + a);
* },
* afterEnd: function(a) {
* alert("After animation ends:" + a);
* }
* });
* @desc If you wanted to do some logic in your page before the slide starts and after the slide ends, you can
* register these 2 callbacks. The functions will be passed an argument that represents an array of elements that
* are visible at the time of callback.
*
*
* @cat Plugins/Image Gallery
* @author Ganeshji Marwaha/ganeshread@gmail.com
*/
(function($) { // Compliant with jquery.noConflict()
$.fn.jCarouselLite = function(o) {
o = $.extend({
btnPrev: null,
btnNext: null,
btnGo: null,
mouseWheel: false,
auto: null,
hoverPause: false,
speed: 200,
easing: null,
vertical: false,
circular: true,
visible: 3,
start: 0,
scroll: 1,
beforeStart: null,
afterEnd: null
}, o || {});
return this.each(function() { // Returns the element collection. Chainable.
var running = false, animCss=o.vertical?"top":"left", sizeCss=o.vertical?"height":"width";
var div = $(this), ul = $("ul", div), tLi = $("li", ul), tl = tLi.size(), v = o.visible;
if(o.circular) {
ul.prepend(tLi.slice(tl-v+1).clone())
.append(tLi.slice(0,o.scroll).clone());
o.start += v-1;
}
var li = $("li", ul), itemLength = li.size(), curr = o.start;
div.css("visibility", "visible");
li.css({overflow: "hidden", float: o.vertical ? "none" : "left"});
ul.css({margin: "0", padding: "0", position: "relative", "list-style-type": "none", "z-index": "1"});
div.css({overflow: "hidden", position: "relative", "z-index": "2", left: "0px"});
var liSize = o.vertical ? height(li) : width(li); // Full li size(incl margin)-Used for animation
var ulSize = liSize * itemLength; // size of full ul(total length, not just for the visible items)
var divSize = liSize * v; // size of entire div(total length for just the visible items)
li.css({width: li.width(), height: li.height()});
ul.css(sizeCss, ulSize+"px").css(animCss, -(curr*liSize));
div.css(sizeCss, divSize+"px"); // Width of the DIV. length of visible images
if(o.btnPrev) {
$(o.btnPrev).click(function() {
return go(curr-o.scroll);
});
if(o.hoverPause) {
$(o.btnPrev).hover(function(){stopAuto();}, function(){startAuto();});
}
}
if(o.btnNext) {
$(o.btnNext).click(function() {
return go(curr+o.scroll);
});
if(o.hoverPause) {
$(o.btnNext).hover(function(){stopAuto();}, function(){startAuto();});
}
}
if(o.btnGo)
$.each(o.btnGo, function(i, val) {
$(val).click(function() {
return go(o.circular ? o.visible+i : i);
});
});
if(o.mouseWheel && div.mousewheel)
div.mousewheel(function(e, d) {
return d>0 ? go(curr-o.scroll) : go(curr+o.scroll);
});
var autoInterval;
function startAuto() {
stopAuto();
autoInterval = setInterval(function() {
go(curr+o.scroll);
}, o.auto+o.speed);
};
function stopAuto() {
clearInterval(autoInterval);
};
if(o.auto) {
if(o.hoverPause) {
div.hover(function(){stopAuto();}, function(){startAuto();});
}
startAuto();
};
function vis() {
return li.slice(curr).slice(0,v);
};
function go(to) {
if(!running) {
if(o.beforeStart)
o.beforeStart.call(this, vis());
if(o.circular) { // If circular we are in first or last, then goto the other end
if(to<0) { // If before range, then go around
ul.css(animCss, -( (curr + tl) * liSize)+"px");
curr = to + tl;
} else if(to>itemLength-v) { // If beyond range, then come around
ul.css(animCss, -( (curr - tl) * liSize ) + "px" );
curr = to - tl;
} else curr = to;
} else { // If non-circular and to points to first or last, we just return.
if(to<0 || to>itemLength-v) return;
else curr = to;
} // If neither overrides it, the curr will still be "to" and we can proceed.
running = true;
ul.animate(
animCss == "left" ? { left: -(curr*liSize) } : { top: -(curr*liSize) } , o.speed, o.easing,
function() {
if(o.afterEnd)
o.afterEnd.call(this, vis());
running = false;
}
);
// Disable buttons when the carousel reaches the last/first, and enable when not
if(!o.circular) {
$(o.btnPrev + "," + o.btnNext).removeClass("disabled");
$( (curr-o.scroll<0 && o.btnPrev)
||
(curr+o.scroll > itemLength-v && o.btnNext)
||
[]
).addClass("disabled");
}
}
return false;
};
});
};
function css(el, prop) {
return parseInt($.css(el[0], prop)) || 0;
};
function width(el) {
return el[0].offsetWidth + css(el, 'marginLeft') + css(el, 'marginRight');
};
function height(el) {
return el[0].offsetHeight + css(el, 'marginTop') + css(el, 'marginBottom');
};
})(jQuery);

View File

@ -0,0 +1,11 @@
/* Copyright (c) 2009 Brandon Aaron (http://brandonaaron.net)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
*
* Version: 3.0.2
*
* Requires: 1.2.2+
*/
(function(c){var a=["DOMMouseScroll","mousewheel"];c.event.special.mousewheel={setup:function(){if(this.addEventListener){for(var d=a.length;d;){this.addEventListener(a[--d],b,false)}}else{this.onmousewheel=b}},teardown:function(){if(this.removeEventListener){for(var d=a.length;d;){this.removeEventListener(a[--d],b,false)}}else{this.onmousewheel=null}}};c.fn.extend({mousewheel:function(d){return d?this.bind("mousewheel",d):this.trigger("mousewheel")},unmousewheel:function(d){return this.unbind("mousewheel",d)}});function b(f){var d=[].slice.call(arguments,1),g=0,e=true;f=c.event.fix(f||window.event);f.type="mousewheel";if(f.wheelDelta){g=f.wheelDelta/120}if(f.detail){g=-f.detail/3}d.unshift(f,g);return c.event.handle.apply(this,d)}})(jQuery);

View File

@ -0,0 +1,7 @@
name = "Carousel"
description = "Add a vertical carousel for recent & popular items in the sidebar."
version = 1.0
author_name = "floridave"
author_url = "http://codex.gallery2.org/User:Floridave"
info_url = "http://codex.gallery2.org/Gallery3:Modules:carousel"
discuss_url = "http://gallery.menalto.com/forum_module_all_carousel"

View File

@ -0,0 +1,23 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript">
function toggle() {
var checkbox = document.getElementById('autoscroll');
var toggle = document.getElementById('auto');
var toggle1 = document.getElementById('speed');
updateToggle = checkbox.checked ? toggle.disabled=false : toggle.disabled=true;
updateToggle1 = checkbox.checked ? toggle1.disabled=false : toggle1.disabled=true;
}
window.onload=toggle;
</script>
<div id="g-admin-carousel">
<h2><?= t("Carousel Administration") ?></h2>
<p><?= t("Change settings below for the different parameters.") ?></p>
<?= $form ?>
<div class="g-block">
<hr />
<h3><?= t("Notes:") ?></h3>
<p><?= t("Navigation buttons are hard to style and clutter the user interface.<br />
Use mouse wheel to scroll thought the images.") ?></p>
</div>
</div>

View File

@ -0,0 +1,47 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?php
$circular = module::get_var("carousel", "circular", "false");
$autoscroll = module::get_var("carousel", "autoscroll", "false");
$auto = module::get_var("carousel", "autostart", "800");
$speed = module::get_var("carousel", "speed", "1000");
$quantity = module::get_var("carousel", "quantity3", "1");
$visible = module::get_var("carousel", "visible3", "1");
$thumbsize = module::get_var("carousel", "thumbsize3");
$photos = ORM::factory("item")->viewable()
->where("type", "!=", "album")
->order_by("view_count", "DESC")
->find_all($quantity);
?>
<? if (module::get_var("carousel", "mousewheel") == true) : ?>
<script type="text/javascript" src="<?= url::file("modules/carousel/js/jquery.mousewheel.min.js") ?>"></script>
<? endif ?>
<script type="text/javascript">
$(function() {
$(".carouselpop").jCarouselLite({
circular: <?= $circular ?>,
mouseWheel: true,
visible: <?= $visible ?>,
vertical: true,
<? if (module::get_var("carousel", "autoscroll") == true) : ?>
hoverPause: true,
auto: <?= $auto ?>,
speed: <?= $speed ?>
<? endif ?>
});
});
</script>
<div class="carouselpop" id="pop">
<ul>
<? foreach ($photos as $photo):
if (module::get_var("carousel", "mousewheel") == true) {
$ctitle = "Use mouse wheel to scroll!";
} else {
$ctitle = $photo->title;
}
?>
<li><a href="<?= $photo->abs_url() ?>">
<?= $photo->thumb_img(array("class" => "g-thumbnail", "title" => $ctitle), $thumbsize) ?></a>
</li>
<? endforeach ?>
</ul>
</div>

View File

@ -0,0 +1,49 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?php
$circular = module::get_var("carousel", "circular", "false");
$autoscroll = module::get_var("carousel", "autoscroll", "false");
$auto = module::get_var("carousel", "autostart", "800");
$speed = module::get_var("carousel", "speed", "1000");
$quantity = module::get_var("carousel", "quantity", "1");
$visible = module::get_var("carousel", "visible", "1");
$thumbsize = module::get_var("carousel", "thumbsize");
$photos = ORM::factory("item")->viewable()
->where("rand_key", "<", ((float)mt_rand()) / (float)mt_getrandmax())
->merge_where(NULL)
->order_by("rand_key", "DESC")
->find_all($quantity);
?>
<? if (module::get_var("carousel", "mousewheel") == true) : ?>
<script type="text/javascript" src="<?= url::file("modules/carousel/js/jquery.mousewheel.min.js") ?>"></script>
<? endif ?>
<script type="text/javascript">
$(function() {
$(".carouselran").jCarouselLite({
circular: <?= $circular ?>,
mouseWheel: true,
visible: <?= $visible ?>,
vertical: true,
<? if (module::get_var("carousel", "autoscroll") == true) : ?>
hoverPause: true,
auto: <?= $auto ?>,
speed: <?= $speed ?>
<? endif ?>
});
});
</script>
<div class="carouselran" id="rand">
<ul>
<? foreach ($photos as $photo):
if (module::get_var("carousel", "mousewheel") == true) {
$ctitle = "Use mouse wheel to scroll!";
} else {
$ctitle = $photo->title;
}
?>
<li><a href="<?= $photo->abs_url() ?>">
<?= $photo->thumb_img(array("class" => "g-thumbnail", "title" => $ctitle), $thumbsize) ?>
</a>
</li>
<? endforeach ?>
</ul>
</div>

View File

@ -0,0 +1,48 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?php
$circular = module::get_var("carousel", "circular", "false");
$autoscroll = module::get_var("carousel", "autoscroll", "false");
$auto = module::get_var("carousel", "autostart", "800");
$speed = module::get_var("carousel", "speed", "1000");
$quantity = module::get_var("carousel", "quantity2", "1");
$visible = module::get_var("carousel", "visible2", "1");
$thumbsize = module::get_var("carousel", "thumbsize2");
$photos = ORM::factory("item")->viewable()
->where("type", "!=", "album")
->order_by("created", "DESC")
->find_all($quantity);
?>
<? if (module::get_var("carousel", "mousewheel") == true) : ?>
<script type="text/javascript" src="<?= url::file("modules/carousel/js/jquery.mousewheel.min.js") ?>"></script>
<? endif ?>
<script type="text/javascript">
$(function() {
$(".carouselr").jCarouselLite({
circular: <?= $circular ?>,
mouseWheel: true,
visible: <?= $visible ?>,
vertical: true,
<? if (module::get_var("carousel", "autoscroll") == true) : ?>
hoverPause: true,
auto: <?= $auto ?>,
speed: <?= $speed ?>
<? endif ?>
});
});
</script>
<div class="carouselr" id="dyna">
<ul>
<? foreach ($photos as $photo):
if (module::get_var("carousel", "mousewheel") == true) {
$ctitle = t("Use mouse wheel to scroll!");
} else {
$ctitle = $photo->title;
}
?>
<li><a href="<?= $photo->abs_url() ?>">
<?= $photo->thumb_img(array("class" => "g-thumbnail", "title" => $ctitle), $thumbsize) ?>
</a>
</li>
<? endforeach ?>
</ul>
</div>

View File

@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class ContactOwner_Controller extends Controller {
static function get_email_form($user_id, $item_id) {
static function get_email_form($user_id, $item_id=null) {
// Determine name of the person the message is going to.
$str_to_name = "";
if ($user_id == -1) {
@ -34,7 +34,7 @@ class ContactOwner_Controller extends Controller {
// If item_id is set, include a link to the item.
$email_body = "";
if ($item_id <> "") {
if (!empty($item_id)) {
$item = ORM::factory("item", $item_id);
$email_body = "This message refers to <a href=\"" . url::abs_site("{$item->type}s/{$item->id}") . "\">this page</a>.";
}
@ -83,10 +83,10 @@ class ContactOwner_Controller extends Controller {
}
// Set up and display the actual page.
$template = new Theme_View("page.html", "other", "Contact");
$template->content = new View("contactowner_emailform.html");
$template->content->sendmail_form = $this->get_email_form("-1", $item_id);
print $template;
$view = new View("contactowner_emailform.html");
$view->sendmail_form = $this->get_email_form("-1", $item_id);
print $view;
}
public function emailid($user_id, $item_id) {
@ -98,10 +98,11 @@ class ContactOwner_Controller extends Controller {
}
// Set up and display the actual page.
$template = new Theme_View("page.html", "other", "Contact");
$template->content = new View("contactowner_emailform.html");
$template->content->sendmail_form = $this->get_email_form($user_id, $item_id);
print $template;
// Set up and display the actual page.
$view = new View("contactowner_emailform.html");
$view->sendmail_form = $this->get_email_form($user_id, $item_id);
print $view;
}
public function sendemail($user_id) {
@ -154,18 +155,12 @@ class ContactOwner_Controller extends Controller {
->message($str_emailbody)
->send();
// Display a message telling the visitor that their email has been sent.
$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;
message::info(t("Your Message Has Been Sent."));
json::reply(array("result" => "success"));
} else {
// Set up and display the actual page.
$template = new Theme_View("page.html", "other", "Contact");
$template->content = new View("contactowner_emailform.html");
$template->content->sendmail_form = $form;
print $template;
json::reply(array("result" => "error", "html" => (string) $form));
}
}
}

View File

@ -53,7 +53,7 @@ class contactowner_block_Core {
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) . "/" . $theme->item->id . "\">" . t("Contact") . " " .
$theme->item->owner_id) . "/" . $theme->item->id . "\" class='g-dialog-link'>" . t("Contact") . " " .
$userDetails[0]->name . "</a>";
$displayBlock = true;
}
@ -63,10 +63,10 @@ class contactowner_block_Core {
if (module::get_var("contactowner", "contact_owner_link")) {
if ($theme->item()) {
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") . "/" . $theme->item->id .
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
"\" class='g-dialog-link'>" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
} else {
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
"\">" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
"\" class='g-dialog-link'>" . t(module::get_var("contactowner", "contact_button_text")) . "</a>";
}
$displayBlock = true;
}

View File

@ -1,3 +1,7 @@
name = "ContactOwner"
description = "Allows visitors to send the website owner an email."
version = 2
author_name = ""
author_url = ""
info_url = "http://codex.gallery2.org/Gallery3:Modules:contactowner"
discuss_url = "http://gallery.menalto.com/forum_module_contactowner"

View File

@ -0,0 +1,62 @@
<?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_Content_Warning_Controller extends Admin_Controller {
public function index() {
print $this->_get_view();
}
public function handler() {
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate()) {
module::set_var("content_warning", "title", $form->content_warning->inputs["title"]->value);
module::set_var("content_warning", "message", $form->content_warning->inputs["message"]->value);
module::set_var("content_warning", "enter_link_text", $form->content_warning->inputs["enter_link_text"]->value);
//module::set_var("content_warning", "enter_link_url", $form->content_warning->inputs["enter_link_url"]->value);
module::set_var("content_warning", "exit_link_text", $form->content_warning->inputs["exit_link_text"]->value);
module::set_var("content_warning", "exit_link_url", $form->content_warning->inputs["exit_link_url"]->value);
url::redirect("admin/content_warning");
}
print $this->_get_view($form);
}
private function _get_view($form=null) {
$v = new Admin_View("admin.html");
$v->content = new View("admin_content_warning.html");
$v->content->form = empty($form) ? $this->_get_form() : $form;
return $v;
}
private function _get_form() {
$form = new Forge("admin/content_warning/handler", "", "post",
array("id" => "gAdminContentWerning"));
$group = $form->group("content_warning");
$group->input("title")->label(t('Title (Will be displayed within H3)'))->rules("required")->value(module::get_var("content_warning", "title"));
$group->textarea("message")->label(t('Message (you can use HTML tags)'))->rules("required")->value(module::get_var("content_warning", "message"));
$group->input("enter_link_text")->label(t('Enter Label'))->rules("required")->value(module::get_var("content_warning", "enter_link_text"));
//$group->input("enter_link_url")->label(t('Enter Url (Leave empty to redirect to the previous page)'))->value(module::get_var("content_warning", "enter_link_url"));
$group->input("exit_link_text")->label(t('Exit Label'))->rules("required")->value(module::get_var("content_warning", "exit_link_text"));
$group->input("exit_link_url")->label(t('Exit Url'))->rules("required")->value(module::get_var("content_warning", "exit_link_url"));
$group->submit("submit")->value(t("Save"));
return $form;
}
}

View 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 Content_Warning_Controller extends Controller {
public function index() {
if(isset($_GET['cw'])) {
setcookie('cw_agree', '1', time() + (60 * 60 * 24), '/');
url::redirect(item::root()->abs_url());
}
}
}

View File

@ -0,0 +1,65 @@
/* jqModal base Styling courtesy of;
Brice Burgess <bhb@iceburg.net> */
/* The Window's CSS z-index value is respected (takes priority). If none is supplied,
the Window's z-index value will be set to 3000 by default (via jqModal.js). */
.jqmWindow {
display: none;
position: fixed;
top: 5%;
left: 5%;
/*margin-left: -500px;*/
width: 90%;
height: 90%;
background-color: #EEE;
color: #333;
border: 1px solid black;
padding: 12px;
}
.jqmOverlay {
background-color: #000;
}
/* Background iframe styling for IE6. Prevents ActiveX bleed-through (<select> form elements, etc.) */
* iframe.jqm {
position:absolute;
top:0;
left:0;
z-index:-1;
width: expression(this.parentNode.offsetWidth+'px');
height: expression(this.parentNode.offsetHeight+'px');
}
/* Fixed posistioning emulation for IE6
Star selector used to hide definition from browsers other than IE6
For valid CSS, use a conditional include instead */
* html .jqmWindow {
position: absolute;
top: expression((document.documentElement.scrollTop || document.body.scrollTop) + Math.round(17 * (document.documentElement.offsetHeight || document.body.clientHeight) / 100) + 'px');
}
#cw_buttons_container {
width: 100%;
height: 200px;
text-align:center;
}
.cw_buttons {
margin:10px;
padding:10px;
width: 300px;
font-weight: bold;
}
#cw_ko {
margin-left: 100px;
border:1px solid #FF0000;
float: left;
}
#cw_ok {
margin-right: 100px;
border:1px solid #00FF00;
float:right;
}

View File

@ -0,0 +1,29 @@
<?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 content_warning_event_Core {
static function admin_menu($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("content_warning_menu")
->label(t("Content Warning"))
->url(url::site("admin/content_warning")));
}
}

View File

@ -0,0 +1,41 @@
<?php defined("SYSPATH") or die("No direct script access.");/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-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 content_warning_installer {
static function install() {
module::set_var("content_warning", "title", "Warning!");
module::set_var("content_warning", "message", "This site contains inappropriate material");
module::set_var("content_warning", "enter_link_text", "Enter");
module::set_var("content_warning", "exit_link_text", "Exit");
module::set_var("content_warning", "exit_link_url", "http://www.google.com");
module::set_version("content_warning", 1);
}
static function upgrade($version) {
//module::set_version("content_warning", 2);
}
static function uninstall() {
module::clear_var("content_warning", "title");
module::clear_var("content_warning", "message");
module::clear_var("content_warning", "enter_link_text");
module::clear_var("content_warning", "exit_link_text");
module::clear_var("content_warning", "exit_link_url");
module::delete("content_warning");
}
}

View File

@ -0,0 +1,31 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-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 content_warning_theme {
static function head($theme) {
$theme->css("jqModal.css");
$theme->script("jqModal.js");
}
static function page_top($theme) {
if(!isset($_COOKIE['cw_agree'])) {
return new View("content_warning_page_top.html");
}
}
}

View File

@ -0,0 +1,69 @@
/*
* jqModal - Minimalist Modaling with jQuery
* (http://dev.iceburg.net/jquery/jqModal/)
*
* Copyright (c) 2007,2008 Brice Burgess <bhb@iceburg.net>
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* $Version: 03/01/2009 +r14
*/
(function($) {
$.fn.jqm=function(o){
var p={
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: F,
ajaxText: '',
target: F,
modal: F,
toTop: F,
onShow: F,
onHide: F,
onLoad: F
};
return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;
H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};
if(p.trigger)$(this).jqmAddTrigger(p.trigger);
});};
$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};
$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};
$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};
$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};
$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);
if(c.modal) {if(!A[0])L('bind');A.push(s);}
else if(c.overlay > 0)h.w.jqmAddClose(o);
else o=F;
h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;
if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}
if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
r.html(c.ajaxText).load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
else if(cc)h.w.jqmAddClose($(cc,h.w));
if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);
(c.onShow)?c.onShow(h):h.w.show();e(h);return F;
},
close:function(s){var h=H[s];if(!h.a)return F;h.a=F;
if(A[0]){A.pop();if(!A[0])L('unbind');}
if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return F;
},
params:{}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),F=false,
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(_){}},
L=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,t,c){return w.each(function(){var s=this._jqm;$(t).each(function() {
if(!this[c]){this[c]=[];$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return F;});}this[c].push(s);});});};
})(jQuery);

View File

@ -0,0 +1,7 @@
name = Content Warning
description = "Display a cookie based warning to alert users about inappropriate content."
version = 1
author_name = "Manuel Sechi"
author_url = "http://www.manuelsechi.com"
info_url = "http://www.manuelsechi.com/progetti/gallery3-content-warning/"
discuss_url = "http://www.manuelsechi.com/progetti/gallery3-content-warning/"

View File

@ -0,0 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="gAdminContentWerning">
<h2><?php echo t("Content Warning Setup") ?></h2>
<?php echo $form ?>
</div>

View File

@ -0,0 +1,27 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="jqmWindow" id="content_warning_dialog">
<hr />
<h3> <?= module::get_var("content_warning", "title") ?></h3>
<br />
<p><?= nl2br(module::get_var("content_warning", "message")) ?></p>
<br />
<div id="cw_buttons_container">
<div class="cw_buttons" id="cw_ko">
<a href="<?= module::get_var("content_warning", "exit_link_url") ?>">
<?= module::get_var("content_warning", "exit_link_text") ?>
</a>
</div>
<div class="cw_buttons" id="cw_ok">
<a href="<?= url::site("content_warning?cw=1") ?>">
<?= module::get_var("content_warning", "enter_link_text") ?>
</a>
</div>
</div>
</div>
<script type="text/javascript">
$("#content_warning_dialog").ready(function($){
$("#content_warning_dialog").jqm().jqmShow({});
});
</script>

Some files were not shown because too many files have changed in this diff Show More