Merge git://github.com/gallery/gallery3-contrib into remote
This commit is contained in:
commit
e952c1002e
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -19,7 +19,6 @@
|
|||||||
*/
|
*/
|
||||||
include("Mail.php");
|
include("Mail.php");
|
||||||
include("Mail/mime.php");
|
include("Mail/mime.php");
|
||||||
include("HTTP/Request.php");
|
|
||||||
|
|
||||||
class Gallery3 {
|
class Gallery3 {
|
||||||
var $url;
|
var $url;
|
||||||
@ -64,6 +63,7 @@ class Gallery3 {
|
|||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct() {
|
||||||
$this->data = new stdClass();
|
$this->data = new stdClass();
|
||||||
|
$this->data->entity = new stdClass();
|
||||||
$this->token = null;
|
$this->token = null;
|
||||||
$this->url = null;
|
$this->url = null;
|
||||||
}
|
}
|
||||||
@ -169,7 +169,55 @@ class Gallery3 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class Gallery3_Helper {
|
class Gallery3_Helper {
|
||||||
|
static $instance = null;
|
||||||
|
|
||||||
static function request($method, $url, $token=null, $params=array(), $file=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 = new HTTP_Request($url);
|
||||||
$req->setMethod($method == "get" ? HTTP_REQUEST_METHOD_GET : HTTP_REQUEST_METHOD_POST);
|
$req->setMethod($method == "get" ? HTTP_REQUEST_METHOD_GET : HTTP_REQUEST_METHOD_POST);
|
||||||
$req->addHeader("X-Gallery-Request-Method", $method);
|
$req->addHeader("X-Gallery-Request-Method", $method);
|
||||||
|
@ -22,7 +22,16 @@ __all__ = ['Album' , 'Image' , 'LocalImage' , 'RemoteImage' , 'LocalMovie' ,
|
|||||||
'RemoteMovie' , 'getItemFromResp' , 'getItemsFromResp']
|
'RemoteMovie' , 'getItemFromResp' , 'getItemsFromResp']
|
||||||
|
|
||||||
from datetime import datetime
|
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):
|
class BaseRemote(object):
|
||||||
def __init__(self , respObj , weakGalObj , weakParent=None):
|
def __init__(self , respObj , weakGalObj , weakParent=None):
|
||||||
|
@ -26,7 +26,15 @@ from G3Items import getItemFromResp , getItemsFromResp , BaseRemote , Album , \
|
|||||||
RemoteImage , Tag
|
RemoteImage , Tag
|
||||||
from urllib import quote , urlencode
|
from urllib import quote , urlencode
|
||||||
from uuid import uuid4
|
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):
|
class Gallery3(object):
|
||||||
"""
|
"""
|
||||||
@ -129,7 +137,6 @@ class Gallery3(object):
|
|||||||
uri(str) : The uri string defining the resource on the defined host
|
uri(str) : The uri string defining the resource on the defined host
|
||||||
"""
|
"""
|
||||||
url = self._buildUrl(uri , kwargs)
|
url = self._buildUrl(uri , kwargs)
|
||||||
print url
|
|
||||||
return self.getRespFromUrl(url)
|
return self.getRespFromUrl(url)
|
||||||
|
|
||||||
def addAlbum(self , parent , albumName , title , description=''):
|
def addAlbum(self , parent , albumName , title , description=''):
|
||||||
|
@ -21,4 +21,4 @@
|
|||||||
from G3Items import *
|
from G3Items import *
|
||||||
from Gallery3 import *
|
from Gallery3 import *
|
||||||
|
|
||||||
__version__ = '0.1.4'
|
__version__ = '0.1.5'
|
||||||
|
@ -4,3 +4,4 @@ author_name = "floridave"
|
|||||||
author_url = "http://codex.gallery2.org/User:Floridave"
|
author_url = "http://codex.gallery2.org/User:Floridave"
|
||||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:about"
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:about"
|
||||||
discuss_url = "http://gallery.menalto.com/forum_module_about"
|
discuss_url = "http://gallery.menalto.com/forum_module_about"
|
||||||
|
version = 1
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -109,7 +109,7 @@ class albumpassword_Controller extends Controller {
|
|||||||
|
|
||||||
// Display a success message and close the dialog.
|
// Display a success message and close the dialog.
|
||||||
message::success(t("Password saved."));
|
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() {
|
public function logout() {
|
||||||
@ -139,10 +139,10 @@ class albumpassword_Controller extends Controller {
|
|||||||
cookie::delete("g3_albumpassword_id");
|
cookie::delete("g3_albumpassword_id");
|
||||||
cookie::set("g3_albumpassword", $album_password);
|
cookie::set("g3_albumpassword", $album_password);
|
||||||
message::success(t("Password Accepted."));
|
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 {
|
} else {
|
||||||
message::error(t("Password Rejected."));
|
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"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -20,7 +20,7 @@
|
|||||||
class albumtree_installer {
|
class albumtree_installer {
|
||||||
static function install() {
|
static function install() {
|
||||||
module::set_var("albumtree", "style", "select");
|
module::set_var("albumtree", "style", "select");
|
||||||
module::set_version("albumtree", 2);
|
module::set_version("albumtree", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function upgrade($version) {
|
static function upgrade($version) {
|
||||||
|
@ -398,7 +398,7 @@ albumTree.config.cookieDomain = '';
|
|||||||
<?
|
<?
|
||||||
function addtree($album){
|
function addtree($album){
|
||||||
?>
|
?>
|
||||||
albumTree.add(<?= $album->id -1 ?>, <?= $album->parent_id -1 ?>, "<?= $album->title ?>", pf+'<?= $album->relative_url_cache ?>');
|
albumTree.add(<?= $album->id -1 ?>, <?= $album->parent_id -1 ?>, "<?= html::purify($album->title) ?>", pf+'<?= $album->relative_url() ?>');
|
||||||
<?
|
<?
|
||||||
foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child){
|
foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child){
|
||||||
addtree($child);
|
addtree($child);
|
||||||
|
@ -15,7 +15,7 @@ function makelist($album,$level){
|
|||||||
//print out the list item
|
//print out the list item
|
||||||
?>
|
?>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?= item::root()->url() ?><?= $album->relative_url_cache ?>"><?= str_repeat(" ", $level) ?><?= $album->title ?></a>
|
<a href="<?= item::root()->url() ?><?= $album->relative_url() ?>"><?= str_repeat(" ", $level) ?><?= html::purify($album->title) ?></a>
|
||||||
</li>
|
</li>
|
||||||
<?
|
<?
|
||||||
//recurse over the children, and print their list items as well
|
//recurse over the children, and print their list items as well
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
function makeselect($album, $level){
|
function makeselect($album, $level){
|
||||||
//print out the list item as a select option
|
//print out the list item as a select option
|
||||||
?>
|
?>
|
||||||
<option value="<?= item::root()->url() ?><?= $album->relative_url_cache ?>"><?= str_repeat(" ", $level) ?><?= $album->title ?></option>
|
<option value="<?= item::root()->url() ?><?= $album->relative_url() ?>"><?= str_repeat(" ", $level) ?><?= html::purify($album->title) ?></option>
|
||||||
<?
|
<?
|
||||||
//recurse over the children, and print their list items as well
|
//recurse over the children, and print their list items as well
|
||||||
foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child){
|
foreach ($album->viewable()->children(null, null, array(array("type", "=", "album"))) as $child){
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,13 +17,10 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
|
class arrow_nav_theme {
|
||||||
class minislideshow_theme_Core {
|
function head($theme) {
|
||||||
static function head($theme) {
|
if($theme->page_subtype == "photo") {
|
||||||
if (!$theme->item()) {
|
return $theme->script("arrow_nav.js");
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return new View("minislideshow_header_block.html");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
16
3.0/modules/arrow_nav/js/arrow_nav.js
Normal file
16
3.0/modules/arrow_nav/js/arrow_nav.js
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
$(document).keydown(function(e) {
|
||||||
|
var url;
|
||||||
|
|
||||||
|
if (e.keyCode == 37) {
|
||||||
|
// Left key pressed
|
||||||
|
url = $('.g-paginator .g-first a').attr("href");
|
||||||
|
// Right key pressed
|
||||||
|
} else if (e.keyCode == 39) {
|
||||||
|
url = $('.g-paginator .g-text-right a').attr("href");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(url != undefined) {
|
||||||
|
window.location = url;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
3
3.0/modules/arrow_nav/module.info
Normal file
3
3.0/modules/arrow_nav/module.info
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
name = "Arrow Navigation"
|
||||||
|
description = "Use the left/right arrow keys to go to the previous/next photo"
|
||||||
|
version = 1
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name = "BatchTag"
|
name = "BatchTag"
|
||||||
description = "Automatically apply a tag to the entire contents of an album."
|
description = "Automatically apply a tag to the entire contents of an album."
|
||||||
version = 1
|
version = 1
|
||||||
author_name = ""
|
author_name = "rWatcher"
|
||||||
author_url = ""
|
author_url = "http://codex.gallery2.org/User:RWatcher"
|
||||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:batchtag"
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:batchtag"
|
||||||
discuss_url = "http://gallery.menalto.com/forum_module_batchtag"
|
discuss_url = "http://gallery.menalto.com/node/101076"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,57 +18,44 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class CalendarView_Controller extends Controller {
|
class CalendarView_Controller extends Controller {
|
||||||
public function calendar($display_year="", $display_user="") {
|
public function calendar($display_year="", $display_user="-1") {
|
||||||
// Draw a calendar for the year specified by $display_year.
|
// Draw a calendar for the year specified by $display_year.
|
||||||
|
|
||||||
// Make sure the function parameters aren't null,
|
// Display the current year by default if a year wasn't provided.
|
||||||
// give them default values if they are.
|
|
||||||
if ($display_year == "") {
|
if ($display_year == "") {
|
||||||
$display_year = date('Y');
|
$display_year = date('Y');
|
||||||
}
|
}
|
||||||
if ($display_user == "") {
|
|
||||||
$display_user = "-1";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw the page.
|
// Draw the page.
|
||||||
$template = new Theme_View("calpage.html", "other", "CalendarView");
|
$root = item::root();
|
||||||
$template->set_global("calendar_user", $display_user);
|
$template = new Theme_View("page.html", "other", "CalendarView");
|
||||||
|
$template->set_global(
|
||||||
|
array("calendar_user" => $display_user,
|
||||||
|
"breadcrumbs" => array(
|
||||||
|
Breadcrumb::instance($root->title, $root->url())->set_first(),
|
||||||
|
Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year))->set_last())));
|
||||||
$template->page_title = t("Gallery :: Calendar");
|
$template->page_title = t("Gallery :: Calendar");
|
||||||
$template->content = new View("calendarview_year.html");
|
$template->content = new View("calendarview_year.html");
|
||||||
$template->content->calendar_year = $display_year;
|
$template->content->calendar_year = $display_year;
|
||||||
$template->content->calendar_user = $display_user;
|
$template->content->calendar_user = $display_user;
|
||||||
$template->content->calendar_user_year_form = $this->_get_calenderprefs_form($display_year, $display_user);
|
$template->content->calendar_user_year_form = $this->_get_calenderprefs_form($display_year, $display_user);
|
||||||
$template->content->title = t("Calendar") . ": " . $display_year;
|
$template->content->title = t("Calendar") . ": " . $display_year;
|
||||||
// Set up breadcrumbs
|
|
||||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb(item::root()->title, item::root()->url());
|
|
||||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb($display_year, "");
|
|
||||||
$template->set_global("breadcrumbs", $calendar_breadcrumbs);
|
|
||||||
print $template;
|
print $template;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function day($display_year, $display_user, $display_month, $display_day) {
|
public function day($display_year, $display_user, $display_month, $display_day) {
|
||||||
// Display all images for the specified day.
|
// Display all images for the specified day.
|
||||||
|
|
||||||
// Figure out the total number of photos to display.
|
// Set up default search conditions for retrieving all photos from the specified day.
|
||||||
$day_count = 0;
|
$where = array(array("type", "!=", "album"));
|
||||||
if ($display_user == "-1") {
|
if ($display_user != "-1") {
|
||||||
$day_count = ORM::factory("item")
|
$where[] = array("owner_id", "=", $display_user);
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $display_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
}
|
||||||
|
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||||
|
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year));
|
||||||
|
|
||||||
|
// Figure out the total number of photos to display.
|
||||||
|
$day_count = calendarview::get_items_count($where);
|
||||||
|
|
||||||
// Figure out paging stuff.
|
// Figure out paging stuff.
|
||||||
$page_size = module::get_var("gallery", "page_size", 9);
|
$page_size = module::get_var("gallery", "page_size", 9);
|
||||||
@ -81,70 +68,67 @@ class CalendarView_Controller extends Controller {
|
|||||||
throw new Kohana_404_Exception();
|
throw new Kohana_404_Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the page.
|
|
||||||
$template = new Theme_View("calpage.html", "collection", "CalendarDayView");
|
|
||||||
$template->set_global("page", $page);
|
|
||||||
$template->set_global("max_pages", $max_pages);
|
|
||||||
$template->set_global("page_size", $page_size);
|
|
||||||
$template->page_title = t("Gallery :: Calendar");
|
|
||||||
|
|
||||||
// Figure out which photos go on this page.
|
// Figure out which photos go on this page.
|
||||||
if ($display_user == "-1") {
|
$children = calendarview::get_items($page_size, $offset, $where);
|
||||||
$template->set_global("children", ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
|
||||||
->order_by("captured", "ASC")
|
|
||||||
->find_all($page_size, $offset));
|
|
||||||
} else {
|
|
||||||
$template->set_global("children", ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $display_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year))
|
|
||||||
->order_by("captured", "ASC")
|
|
||||||
->find_all($page_size, $offset));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up breadcrumbs
|
// Create and display the page.
|
||||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb(item::root()->title, item::root()->url());
|
$root = item::root();
|
||||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
$template = new Theme_View("page.html", "collection", "CalendarDayView");
|
||||||
$calendar_breadcrumbs[2] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month));
|
$template->set_global(
|
||||||
$calendar_breadcrumbs[3] = new Calendar_Breadcrumb($display_day, "");
|
array("page" => $page,
|
||||||
$template->set_global("breadcrumbs", $calendar_breadcrumbs);
|
"max_pages" => $max_pages,
|
||||||
|
"page_size" => $page_size,
|
||||||
// Finish setting up and then display the page.
|
"children" => $children,
|
||||||
$template->set_global("children_count", $day_count);
|
"breadcrumbs" => array(
|
||||||
|
Breadcrumb::instance($root->title, $root->url())->set_first(),
|
||||||
|
Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user)),
|
||||||
|
Breadcrumb::instance(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month)),
|
||||||
|
Breadcrumb::instance($display_day, url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month . "/" . $display_day))->set_last()),
|
||||||
|
"children_count" => $day_count));
|
||||||
|
$template->page_title = t("Gallery :: Calendar");
|
||||||
$template->content = new View("dynamic.html");
|
$template->content = new View("dynamic.html");
|
||||||
$template->content->title = t("Photos From ") . date("d", mktime(0, 0, 0, $display_month, $display_day, $display_year)) . " " . t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
$template->content->title = t("Photos From ") . date("d", mktime(0, 0, 0, $display_month, $display_day, $display_year)) . " " . t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||||
print $template;
|
print $template;
|
||||||
|
|
||||||
|
// Set breadcrumbs on the photo pages to point back to the calendar day view.
|
||||||
|
item::set_display_context_callback("CalendarView_Controller::get_display_day_context", $display_user, $display_year, $display_month, $display_day);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_display_day_context($item, $display_user, $display_year, $display_month, $display_day) {
|
||||||
|
// Set up default search conditions for retrieving all photos from the specified day.
|
||||||
|
$where = array(array("type", "!=", "album"));
|
||||||
|
if ($display_user != "-1") {
|
||||||
|
$where[] = array("owner_id", "=", $display_user);
|
||||||
|
}
|
||||||
|
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||||
|
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month, ($display_day + 1), $display_year));
|
||||||
|
|
||||||
|
// Generate breadcrumbs for the photo page.
|
||||||
|
$root = item::root();
|
||||||
|
$breadcrumbs = array(
|
||||||
|
Breadcrumb::instance($root->title, $root->url())->set_first(),
|
||||||
|
Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user)),
|
||||||
|
Breadcrumb::instance(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month)),
|
||||||
|
Breadcrumb::instance($display_day, url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month . "/" . $display_day)),
|
||||||
|
Breadcrumb::instance($item->title, $item->url())->set_last()
|
||||||
|
);
|
||||||
|
|
||||||
|
return CalendarView_Controller::get_display_context($item, $where, $breadcrumbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function month($display_year, $display_user, $display_month) {
|
public function month($display_year, $display_user, $display_month) {
|
||||||
// Display all images for the specified month.
|
// Display all images for the specified month.
|
||||||
|
|
||||||
// Figure out the total number of photos to display.
|
// Set up default search conditions for retrieving all photos from the specified month.
|
||||||
$day_count = 0;
|
$where = array(array("type", "!=", "album"));
|
||||||
if ($display_user == "-1") {
|
if ($display_user != "-1") {
|
||||||
$day_count = ORM::factory("item")
|
$where[] = array("owner_id", "=", $display_user);
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
} else {
|
|
||||||
$day_count = ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $display_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
|
||||||
->find_all()
|
|
||||||
->count();
|
|
||||||
}
|
}
|
||||||
|
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||||
|
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year));
|
||||||
|
|
||||||
|
// Figure out the total number of photos to display.
|
||||||
|
$day_count = calendarview::get_items_count($where);
|
||||||
|
|
||||||
// Figure out paging stuff.
|
// Figure out paging stuff.
|
||||||
$page_size = module::get_var("gallery", "page_size", 9);
|
$page_size = module::get_var("gallery", "page_size", 9);
|
||||||
@ -157,44 +141,73 @@ class CalendarView_Controller extends Controller {
|
|||||||
throw new Kohana_404_Exception();
|
throw new Kohana_404_Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the page.
|
|
||||||
$template = new Theme_View("calpage.html", "collection", "CalendarMonthView");
|
|
||||||
$template->set_global("page", $page);
|
|
||||||
$template->set_global("max_pages", $max_pages);
|
|
||||||
$template->set_global("page_size", $page_size);
|
|
||||||
$template->page_title = t("Gallery :: Calendar");
|
|
||||||
|
|
||||||
// Figure out which photos go on this page.
|
// Figure out which photos go on this page.
|
||||||
if ($display_user == "-1") {
|
$children = calendarview::get_items($page_size, $offset, $where);
|
||||||
$template->set_global("children", ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
|
||||||
->order_by("captured", "ASC")
|
|
||||||
->find_all($page_size, $offset));
|
|
||||||
} else {
|
|
||||||
$template->set_global("children", ORM::factory("item")
|
|
||||||
->viewable()
|
|
||||||
->where("owner_id", "=", $display_user)
|
|
||||||
->where("type", "!=", "album")
|
|
||||||
->where("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
|
||||||
->where("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
|
||||||
->order_by("captured", "ASC")
|
|
||||||
->find_all($page_size, $offset));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up breadcrumbs
|
// Create and display the page.
|
||||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb(item::root()->title, item::root()->url());
|
$root = item::root();
|
||||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
$template = new Theme_View("page.html", "collection", "CalendarMonthView");
|
||||||
$calendar_breadcrumbs[2] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), "");
|
$template->set_global(
|
||||||
$template->set_global("breadcrumbs", $calendar_breadcrumbs);
|
array("page" => $page,
|
||||||
|
"max_pages" => $max_pages,
|
||||||
// Finish setting up and then display the page.
|
"page_size" => $page_size,
|
||||||
$template->set_global("children_count", $day_count);
|
"breadcrumbs" => array(
|
||||||
|
Breadcrumb::instance($root->title, $root->url())->set_first(),
|
||||||
|
Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user)),
|
||||||
|
Breadcrumb::instance(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month))->set_last()),
|
||||||
|
"children" => $children,
|
||||||
|
"children_count" => $day_count));
|
||||||
|
$template->page_title = t("Gallery :: Calendar");
|
||||||
$template->content = new View("dynamic.html");
|
$template->content = new View("dynamic.html");
|
||||||
$template->content->title = t("Photos From ") . t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, 1, $display_year));
|
$template->content->title = t("Photos From ") . t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||||
print $template;
|
print $template;
|
||||||
|
|
||||||
|
// Set up breadcrumbs for the photo pages to point back to the calendar month view.
|
||||||
|
item::set_display_context_callback("CalendarView_Controller::get_display_month_context", $display_user, $display_year, $display_month);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_display_month_context($item, $display_user, $display_year, $display_month) {
|
||||||
|
// Set up default search conditions for retrieving all photos from the specified month.
|
||||||
|
$where = array(array("type", "!=", "album"));
|
||||||
|
if ($display_user != "-1") {
|
||||||
|
$where[] = array("owner_id", "=", $display_user);
|
||||||
|
}
|
||||||
|
$where[] = array("captured", ">=", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||||
|
$where[] = array("captured", "<", mktime(0, 0, 0, $display_month+1, 1, $display_year));
|
||||||
|
|
||||||
|
// Generate breadcrumbs for the photo page.
|
||||||
|
$root = item::root();
|
||||||
|
$breadcrumbs = array(
|
||||||
|
Breadcrumb::instance($root->title, $root->url())->set_first(),
|
||||||
|
Breadcrumb::instance($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user)),
|
||||||
|
Breadcrumb::instance(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month)),
|
||||||
|
Breadcrumb::instance($item->title, $item->url())->set_last()
|
||||||
|
);
|
||||||
|
|
||||||
|
return CalendarView_Controller::get_display_context($item, $where, $breadcrumbs);
|
||||||
|
}
|
||||||
|
|
||||||
|
private function get_display_context($item, $where=array(), $breadcrumbs=array()) {
|
||||||
|
// Set up previous / next / breadcrumbs / etc to point to CalendarView instead of the album.
|
||||||
|
|
||||||
|
// Figure out the photo's position.
|
||||||
|
$position = calendarview::get_position($item, $where);
|
||||||
|
|
||||||
|
// Figure out the previous and next items.
|
||||||
|
if ($position > 1) {
|
||||||
|
list ($previous_item, $ignore, $next_item) = calendarview::get_items(3, $position - 2, $where);
|
||||||
|
} else {
|
||||||
|
list ($next_item) = calendarview::get_items(1, $position, $where);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Figure out the total number of photos.
|
||||||
|
$sibling_count = calendarview::get_items_count($where);
|
||||||
|
|
||||||
|
return array("position" => $position,
|
||||||
|
"previous_item" => $previous_item,
|
||||||
|
"next_item" => $next_item,
|
||||||
|
"sibling_count" => $sibling_count,
|
||||||
|
"breadcrumbs" => $breadcrumbs);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _get_calenderprefs_form($display_year, $display_user) {
|
private function _get_calenderprefs_form($display_year, $display_user) {
|
||||||
@ -221,9 +234,9 @@ class CalendarView_Controller extends Controller {
|
|||||||
// Generate a list of years, starting with the year the earliest photo was
|
// Generate a list of years, starting with the year the earliest photo was
|
||||||
// taken, and ending with the year of the most recent photo.
|
// taken, and ending with the year of the most recent photo.
|
||||||
$valid_years = Array();
|
$valid_years = Array();
|
||||||
|
if ($display_user == -1) {
|
||||||
$all_photos = ORM::factory("item")
|
$all_photos = ORM::factory("item")
|
||||||
->viewable()
|
->viewable()
|
||||||
//->where("owner_id", "=", $one_user->id)
|
|
||||||
->where("type", "!=", "album")
|
->where("type", "!=", "album")
|
||||||
->where("captured", "!=", "")
|
->where("captured", "!=", "")
|
||||||
->order_by("captured", "DESC")
|
->order_by("captured", "DESC")
|
||||||
@ -233,6 +246,20 @@ class CalendarView_Controller extends Controller {
|
|||||||
$valid_years[$counter] = $counter;
|
$valid_years[$counter] = $counter;
|
||||||
$counter++;
|
$counter++;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$all_photos = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", "!=", "")
|
||||||
|
->where("owner_id", "=", $display_user)
|
||||||
|
->order_by("captured", "DESC")
|
||||||
|
->find_all();
|
||||||
|
$counter = date('Y', $all_photos[count($all_photos)-1]->captured);
|
||||||
|
while ($counter <= date('Y', $all_photos[0]->captured)) {
|
||||||
|
$valid_years[$counter] = $counter;
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create the form.
|
// Create the form.
|
||||||
$calendar_group->dropdown('cal_user')
|
$calendar_group->dropdown('cal_user')
|
||||||
|
@ -8,6 +8,15 @@
|
|||||||
margin: 10px 10px 10px 10px;
|
margin: 10px 10px 10px 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#g-calendar-profile-grid {
|
||||||
|
position: relative;
|
||||||
|
align: center;
|
||||||
|
float: left;
|
||||||
|
width: 200px;
|
||||||
|
height: 145px;
|
||||||
|
margin: 10px 10px 10px 10px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Search form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
/* Search form ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
|
||||||
#cal_user {
|
#cal_user {
|
||||||
top: 0px;
|
top: 0px;
|
||||||
|
48
3.0/modules/calendarview/helpers/calendarview.php
Normal file
48
3.0/modules/calendarview/helpers/calendarview.php
Normal 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-2012 Bharat Mediratta
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or (at
|
||||||
|
* your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*/
|
||||||
|
class calendarview_Core {
|
||||||
|
static function get_items_count($where=array()) {
|
||||||
|
// Returns the number of viewable items identified by $where.
|
||||||
|
return ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->merge_where($where)
|
||||||
|
->order_by("captured", "ASC")
|
||||||
|
->count_all();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_items($limit=null, $offset=null, $where=array()) {
|
||||||
|
// Returns the items identified by $where, up to $limit, and starting at $offset.
|
||||||
|
return ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->merge_where($where)
|
||||||
|
->order_by("captured", "ASC")
|
||||||
|
->find_all($limit, $offset);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_position($item, $where=array()) {
|
||||||
|
// Get's $item's position within $where.
|
||||||
|
return ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->merge_where($where)
|
||||||
|
->where("items.id", "<=", $item->id)
|
||||||
|
->order_by("captured", "ASC")
|
||||||
|
->count_all();
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -69,4 +69,31 @@ class calendarview_event_Core {
|
|||||||
site_status::clear("calendarview_needs_exif");
|
site_status::clear("calendarview_needs_exif");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function show_user_profile($data) {
|
||||||
|
// Display a few months on the user profile screen.
|
||||||
|
$v = new View("user_profile_calendarview.html");
|
||||||
|
$v->user_id = $data->user->id;
|
||||||
|
|
||||||
|
// Figure out what month the users newest photo was taken it.
|
||||||
|
// Make that the last month to display.
|
||||||
|
// If a user hasn't uploaded anything, make the current month
|
||||||
|
// the last to be displayed.
|
||||||
|
$latest_photo = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", "!=", "")
|
||||||
|
->where("owner_id", "=", $data->user->id)
|
||||||
|
->order_by("captured", "DESC")
|
||||||
|
->find_all(1);
|
||||||
|
if (count($latest_photo) > 0) {
|
||||||
|
$v->user_year = date('Y', $latest_photo[0]->captured);
|
||||||
|
$v->user_month = date('n', $latest_photo[0]->captured);
|
||||||
|
} else {
|
||||||
|
$v->user_year = date('Y');
|
||||||
|
$v->user_month = date('n');
|
||||||
|
}
|
||||||
|
|
||||||
|
$data->content[] = (object) array("title" => t("User calendar"), "view" => $v);
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,9 +18,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class calendarview_theme_Core {
|
class calendarview_theme_Core {
|
||||||
|
|
||||||
static function head($theme) {
|
static function head($theme) {
|
||||||
|
return $theme->css("calendarview_calendar.css") .
|
||||||
$theme->css("calendarview_menu.css");
|
$theme->css("calendarview_menu.css");
|
||||||
return $theme->css("calendarview_calendar.css");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name = "CalendarView"
|
name = "CalendarView"
|
||||||
description = "View your photos by the date they were taken."
|
description = "View your photos by the date they were taken."
|
||||||
version = 1
|
version = 1
|
||||||
author_name = ""
|
author_name = "rWatcher"
|
||||||
author_url = ""
|
author_url = "http://codex.gallery2.org/User:RWatcher"
|
||||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:calendarview"
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:calendarview"
|
||||||
discuss_url = "http://gallery.menalto.com/forum_module_calendarview"
|
discuss_url = "http://gallery.menalto.com/node/92405"
|
||||||
|
@ -1,164 +0,0 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en">
|
|
||||||
<head>
|
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
||||||
<? $theme->start_combining("script,css") ?>
|
|
||||||
<title>
|
|
||||||
<? if ($page_title): ?>
|
|
||||||
<?= $page_title ?>
|
|
||||||
<? else: ?>
|
|
||||||
<? if ($theme->item()): ?>
|
|
||||||
<?= $theme->item()->title ?>
|
|
||||||
<? elseif ($theme->tag()): ?>
|
|
||||||
<?= t("Photos tagged with %tag_title", array("tag_title" => $theme->tag()->name)) ?>
|
|
||||||
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
|
|
||||||
<?= item::root()->title ?>
|
|
||||||
<? endif ?>
|
|
||||||
<? endif ?>
|
|
||||||
</title>
|
|
||||||
<link rel="shortcut icon"
|
|
||||||
href="<?= url::file(module::get_var("gallery", "favicon_url")) ?>"
|
|
||||||
type="image/x-icon" />
|
|
||||||
|
|
||||||
<? if ($theme->page_type == "collection"): ?>
|
|
||||||
<? if ($thumb_proportion != 1): ?>
|
|
||||||
<? $new_width = round($thumb_proportion * 213) ?>
|
|
||||||
<? $new_height = round($thumb_proportion * 240) ?>
|
|
||||||
<style type="text/css">
|
|
||||||
.g-view #g-content #g-album-grid .g-item {
|
|
||||||
width: <?= $new_width ?>px;
|
|
||||||
height: <?= $new_height ?>px;
|
|
||||||
/* <?= $thumb_proportion ?> */
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<? endif ?>
|
|
||||||
<? endif ?>
|
|
||||||
|
|
||||||
<?= $theme->script("json2-min.js") ?>
|
|
||||||
<?= $theme->script("jquery.js") ?>
|
|
||||||
<?= $theme->script("jquery.form.js") ?>
|
|
||||||
<?= $theme->script("jquery-ui.js") ?>
|
|
||||||
<?= $theme->script("gallery.common.js") ?>
|
|
||||||
<? /* MSG_CANCEL is required by gallery.dialog.js */ ?>
|
|
||||||
<script type="text/javascript">
|
|
||||||
var MSG_CANCEL = <?= t('Cancel')->for_js() ?>;
|
|
||||||
</script>
|
|
||||||
<?= $theme->script("gallery.ajax.js") ?>
|
|
||||||
<?= $theme->script("gallery.dialog.js") ?>
|
|
||||||
<?= $theme->script("superfish/js/superfish.js") ?>
|
|
||||||
<?= $theme->script("jquery.localscroll.js") ?>
|
|
||||||
|
|
||||||
<? /* These are page specific but they get combined */ ?>
|
|
||||||
<? if ($theme->page_subtype == "photo"): ?>
|
|
||||||
<?= $theme->script("jquery.scrollTo.js") ?>
|
|
||||||
<?= $theme->script("gallery.show_full_size.js") ?>
|
|
||||||
<? elseif ($theme->page_subtype == "movie"): ?>
|
|
||||||
<?= $theme->script("flowplayer.js") ?>
|
|
||||||
<? endif ?>
|
|
||||||
|
|
||||||
<?= $theme->head() ?>
|
|
||||||
|
|
||||||
<? /* Theme specific CSS/JS goes last so that it can override module CSS/JS */ ?>
|
|
||||||
<?= $theme->script("ui.init.js") ?>
|
|
||||||
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
|
||||||
<?= $theme->css("superfish/css/superfish.css") ?>
|
|
||||||
<?= $theme->css("themeroller/ui.base.css") ?>
|
|
||||||
<?= $theme->css("screen.css") ?>
|
|
||||||
<!--[if lte IE 8]>
|
|
||||||
<link rel="stylesheet" type="text/css" href="<?= $theme->url("css/fix-ie.css") ?>"
|
|
||||||
media="screen,print,projection" />
|
|
||||||
<![endif]-->
|
|
||||||
|
|
||||||
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
|
|
||||||
<?= $theme->get_combined("script") ?>
|
|
||||||
|
|
||||||
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
|
|
||||||
<?= $theme->get_combined("css") ?>
|
|
||||||
</head>
|
|
||||||
|
|
||||||
<body <?= $theme->body_attributes() ?>>
|
|
||||||
<?= $theme->page_top() ?>
|
|
||||||
<div id="doc4" class="yui-t5 g-view">
|
|
||||||
<?= $theme->site_status() ?>
|
|
||||||
<div id="g-header" class="ui-helper-clearfix">
|
|
||||||
<div id="g-banner">
|
|
||||||
<? if ($header_text = module::get_var("gallery", "header_text")): ?>
|
|
||||||
<?= $header_text ?>
|
|
||||||
<? else: ?>
|
|
||||||
<a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
|
|
||||||
<img width="107" height="48" alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= url::file("lib/images/logo.png") ?>" />
|
|
||||||
</a>
|
|
||||||
<? endif ?>
|
|
||||||
<?= $theme->user_menu() ?>
|
|
||||||
<?= $theme->header_top() ?>
|
|
||||||
|
|
||||||
<!-- hide the menu until after the page has loaded, to minimize menu flicker -->
|
|
||||||
<div id="g-site-menu" style="visibility: hidden">
|
|
||||||
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
|
|
||||||
</div>
|
|
||||||
<script type="text/javascript"> $(document).ready(function() { $("#g-site-menu").css("visibility", "visible"); }) </script>
|
|
||||||
|
|
||||||
<?= $theme->header_bottom() ?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<? // The following code was modifed to allow module-defined breadcrumbs.
|
|
||||||
// Everything else in this file is a copy of the default page.html.php file.
|
|
||||||
?>
|
|
||||||
<? if (!empty($breadcrumbs)): ?>
|
|
||||||
<ul class="g-breadcrumbs">
|
|
||||||
<? $i = 0 ?>
|
|
||||||
<? foreach ($breadcrumbs as $breadcrumb): ?>
|
|
||||||
<li<? if ($i == 0) print " class=\"g-first\"" ?>>
|
|
||||||
<!-- Adding ?show=<id> causes Gallery3 to display the page
|
|
||||||
containing that photo. For now, we just do it for
|
|
||||||
the immediate parent so that when you go back up a
|
|
||||||
level you're on the right page. -->
|
|
||||||
<? if ($breadcrumb->url) : ?>
|
|
||||||
<a href="<?= $breadcrumb->url ?>"><?= html::purify($breadcrumb->title) ?></a>
|
|
||||||
<? else : ?>
|
|
||||||
<?= html::purify($breadcrumb->title) ?>
|
|
||||||
<? endif ?>
|
|
||||||
</li>
|
|
||||||
<? $i++ ?>
|
|
||||||
<? endforeach ?>
|
|
||||||
</ul>
|
|
||||||
<? endif ?>
|
|
||||||
<? // End modified code ?>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
|
||||||
<div id="bd">
|
|
||||||
<div id="yui-main">
|
|
||||||
<div class="yui-b">
|
|
||||||
<div id="g-content" class="yui-g">
|
|
||||||
<?= $theme->messages() ?>
|
|
||||||
<?= $content ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="g-sidebar" class="yui-b">
|
|
||||||
<? if ($theme->page_subtype != "login"): ?>
|
|
||||||
<?= new View("sidebar.html") ?>
|
|
||||||
<? endif ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="g-footer" class="ui-helper-clearfix">
|
|
||||||
<?= $theme->footer() ?>
|
|
||||||
<? if ($footer_text = module::get_var("gallery", "footer_text")): ?>
|
|
||||||
<?= $footer_text ?>
|
|
||||||
<? endif ?>
|
|
||||||
|
|
||||||
<? if (module::get_var("gallery", "show_credits")): ?>
|
|
||||||
<ul id="g-credits" class="g-inline">
|
|
||||||
<?= $theme->credits() ?>
|
|
||||||
</ul>
|
|
||||||
<? endif ?>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<?= $theme->page_bottom() ?>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -0,0 +1,86 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<?
|
||||||
|
// Generate a list of items within the specified 3 month time-frame.
|
||||||
|
$items = ORM::factory("item")
|
||||||
|
->viewable()
|
||||||
|
->where("owner_id", "=", $user_id)
|
||||||
|
->where("type", "!=", "album")
|
||||||
|
->where("captured", ">=", mktime(0, 0, 0, $user_month-2, 1, $user_year))
|
||||||
|
->where("captured", "<", mktime(0, 0, 0, $user_month+1, 1, ($user_year)))
|
||||||
|
->order_by("captured")
|
||||||
|
->find_all();
|
||||||
|
|
||||||
|
// Set up some initial variables.
|
||||||
|
$calendar_year = $user_year;
|
||||||
|
$counter_months = $user_month - 2;
|
||||||
|
if ($counter_months < 1) {
|
||||||
|
$counter_months += 12;
|
||||||
|
$calendar_year--;
|
||||||
|
}
|
||||||
|
$counter_days = 0;
|
||||||
|
$counter = 0;
|
||||||
|
|
||||||
|
// Print the first month.
|
||||||
|
print "<div id=\"g-calendar-profile-grid\">";
|
||||||
|
if ((count($items) > 0) && (date("n", $items[$counter]->captured) == $counter_months)) {
|
||||||
|
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $user_id . "/" . $counter_months . "/");
|
||||||
|
} else {
|
||||||
|
$month_url = "";
|
||||||
|
}
|
||||||
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
|
|
||||||
|
// Loop through each photo taken during the 3 month time frame, and see what month and day they were taken on.
|
||||||
|
// Make the corresponding dates on the calendars into clickable links.
|
||||||
|
while ($counter < (count($items))) {
|
||||||
|
|
||||||
|
// Check and see if we've switched to a new month.
|
||||||
|
// If so, render the current calendar and set up a new one.
|
||||||
|
// Continue printing empty months until we reach the next photo or the last month.
|
||||||
|
while (date("n", $items[$counter]->captured) != $counter_months) {
|
||||||
|
echo $calendar->render();
|
||||||
|
print "</div>";
|
||||||
|
$counter_months++;
|
||||||
|
if ($counter_months == 13) {
|
||||||
|
$counter_months = 1;
|
||||||
|
$calendar_year++;
|
||||||
|
}
|
||||||
|
$counter_days = 0;
|
||||||
|
print "<div id=\"g-calendar-profile-grid\">";
|
||||||
|
if (date("n", $items[$counter]->captured) == $counter_months) {
|
||||||
|
$month_url = url::site("calendarview/month/" . $calendar_year . "/" . $user_id . "/" . $counter_months . "/");
|
||||||
|
} else {
|
||||||
|
$month_url = "";
|
||||||
|
}
|
||||||
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the day of the current photo is different then the day of the previous photo,
|
||||||
|
// then add a link to the calendar for this date and set the current day to this day.
|
||||||
|
if (date("j", $items[$counter]->captured) > $counter_days) {
|
||||||
|
$counter_days = date("j", $items[$counter]->captured);
|
||||||
|
$calendar->event($counter_days, url::site("calendarview/day/" . $calendar_year . "/" . $user_id . "/" . $counter_months . "/" . $counter_days));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Move onto the next photo.
|
||||||
|
$counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Print out the last calendar to be generated.
|
||||||
|
echo $calendar->render();
|
||||||
|
print "</div>";
|
||||||
|
$counter_months++;
|
||||||
|
|
||||||
|
// If the calendar that was previously rendered was not the final month,
|
||||||
|
// then print out a few empty months to fill the remaining space.
|
||||||
|
while ($counter_months < $user_month + 1) {
|
||||||
|
print "<div id=\"g-calendar-profile-grid\">";
|
||||||
|
$month_url = "";
|
||||||
|
$calendar = new PHPCalendar($counter_months, $calendar_year, $month_url);
|
||||||
|
echo $calendar->render();
|
||||||
|
print "</div>";
|
||||||
|
$counter_months++;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<br clear="all" /><br /><br />
|
||||||
|
<div align="right"><a href="<?=url::site("calendarview/calendar/{$user_year}/{$user_id}"); ?>"><?=t("View full calendar"); ?> >></a></div>
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
});
|
});
|
||||||
$('form input[name^=title]').change(function() {
|
$('form input[name^=title]').change(function() {
|
||||||
var title = $(this).val();
|
var title = $(this).val();
|
||||||
slug = slug.replace(/^\'/, "");
|
slug = title.replace(/^\'/, "");
|
||||||
var slug = title.replace(/[^A-Za-z0-9-_]+/g, "-");
|
var slug = title.replace(/[^A-Za-z0-9-_]+/g, "-");
|
||||||
slug = slug.replace(/^-/, "");
|
slug = slug.replace(/^-/, "");
|
||||||
slug = slug.replace(/-$/, "");
|
slug = slug.replace(/-$/, "");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -18,7 +18,7 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class ContactOwner_Controller extends Controller {
|
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.
|
// Determine name of the person the message is going to.
|
||||||
$str_to_name = "";
|
$str_to_name = "";
|
||||||
if ($user_id == -1) {
|
if ($user_id == -1) {
|
||||||
@ -34,7 +34,7 @@ class ContactOwner_Controller extends Controller {
|
|||||||
|
|
||||||
// If item_id is set, include a link to the item.
|
// If item_id is set, include a link to the item.
|
||||||
$email_body = "";
|
$email_body = "";
|
||||||
if ($item_id <> "") {
|
if (!empty($item_id)) {
|
||||||
$item = ORM::factory("item", $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>.";
|
$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.
|
// Set up and display the actual page.
|
||||||
$template = new Theme_View("page.html", "other", "Contact");
|
$view = new View("contactowner_emailform.html");
|
||||||
$template->content = new View("contactowner_emailform.html");
|
$view->sendmail_form = $this->get_email_form("-1", $item_id);
|
||||||
$template->content->sendmail_form = $this->get_email_form("-1", $item_id);
|
|
||||||
print $template;
|
print $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function emailid($user_id, $item_id) {
|
public function emailid($user_id, $item_id) {
|
||||||
@ -98,10 +98,11 @@ class ContactOwner_Controller extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set up and display the actual page.
|
// Set up and display the actual page.
|
||||||
$template = new Theme_View("page.html", "other", "Contact");
|
// Set up and display the actual page.
|
||||||
$template->content = new View("contactowner_emailform.html");
|
$view = new View("contactowner_emailform.html");
|
||||||
$template->content->sendmail_form = $this->get_email_form($user_id, $item_id);
|
$view->sendmail_form = $this->get_email_form($user_id, $item_id);
|
||||||
print $template;
|
|
||||||
|
print $view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendemail($user_id) {
|
public function sendemail($user_id) {
|
||||||
@ -154,18 +155,12 @@ class ContactOwner_Controller extends Controller {
|
|||||||
->message($str_emailbody)
|
->message($str_emailbody)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
// Display a message telling the visitor that their email has been sent.
|
message::info(t("Your Message Has Been Sent."));
|
||||||
$template = new Theme_View("page.html", "other", "Contact");
|
json::reply(array("result" => "success"));
|
||||||
$template->content = new View("contactowner_emailform.html");
|
|
||||||
$template->content->sendmail_form = t("Your Message Has Been Sent.");
|
|
||||||
print $template;
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// Set up and display the actual page.
|
// Set up and display the actual page.
|
||||||
$template = new Theme_View("page.html", "other", "Contact");
|
json::reply(array("result" => "error", "html" => (string) $form));
|
||||||
$template->content = new View("contactowner_emailform.html");
|
|
||||||
$template->content->sendmail_form = $form;
|
|
||||||
print $template;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -53,7 +53,7 @@ class contactowner_block_Core {
|
|||||||
if ((count($userDetails) > 0) && ($userDetails[0]->email != "") &&
|
if ((count($userDetails) > 0) && ($userDetails[0]->email != "") &&
|
||||||
(module::get_var("contactowner", "contact_user_link") == true)) {
|
(module::get_var("contactowner", "contact_user_link") == true)) {
|
||||||
$block->content->userLink = "<a href=\"" . url::site("contactowner/emailid/" .
|
$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>";
|
$userDetails[0]->name . "</a>";
|
||||||
$displayBlock = true;
|
$displayBlock = true;
|
||||||
}
|
}
|
||||||
@ -63,10 +63,10 @@ class contactowner_block_Core {
|
|||||||
if (module::get_var("contactowner", "contact_owner_link")) {
|
if (module::get_var("contactowner", "contact_owner_link")) {
|
||||||
if ($theme->item()) {
|
if ($theme->item()) {
|
||||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") . "/" . $theme->item->id .
|
$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 {
|
} else {
|
||||||
$block->content->ownerLink = "<a href=\"" . url::site("contactowner/emailowner") .
|
$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;
|
$displayBlock = true;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");/**
|
<?php defined("SYSPATH") or die("No direct script access.");/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -16,9 +16,11 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class three_nids_theme {
|
class Content_Warning_Controller extends Controller {
|
||||||
static function credits($theme) {
|
public function index() {
|
||||||
return "<a href=\"http://codex.gallery2.org/Gallery3:Themes:three_nids\">three_nids theme</a>";
|
if(isset($_GET['cw'])) {
|
||||||
|
setcookie('cw_agree', '1', time() + (60 * 60 * 24), '/');
|
||||||
|
url::redirect(item::root()->abs_url());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
65
3.0/modules/content_warning/css/jqModal.css
Normal file
65
3.0/modules/content_warning/css/jqModal.css
Normal 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;
|
||||||
|
}
|
@ -17,6 +17,13 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class Item_Product_Model extends ORM {
|
class content_warning_event_Core {
|
||||||
protected $belongs_to= array('product_override');
|
|
||||||
|
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")));
|
||||||
|
}
|
||||||
}
|
}
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
@ -17,10 +17,15 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class Postage_Band_Model extends ORM {
|
class content_warning_theme {
|
||||||
var $rules = array(
|
static function head($theme) {
|
||||||
"name" => "length[1,32]");
|
$theme->css("jqModal.css");
|
||||||
|
$theme->script("jqModal.js");
|
||||||
protected $has_many=array('products');
|
}
|
||||||
|
|
||||||
|
static function page_top($theme) {
|
||||||
|
if(!isset($_COOKIE['cw_agree'])) {
|
||||||
|
return new View("content_warning_page_top.html");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
69
3.0/modules/content_warning/js/jqModal.js
Normal file
69
3.0/modules/content_warning/js/jqModal.js
Normal 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);
|
7
3.0/modules/content_warning/module.info
Normal file
7
3.0/modules/content_warning/module.info
Normal 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/"
|
@ -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>
|
@ -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>
|
254
3.0/modules/custom_menus/controllers/admin_custom_menus.php
Normal file
254
3.0/modules/custom_menus/controllers/admin_custom_menus.php
Normal file
@ -0,0 +1,254 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2012 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_Custom_Menus_Controller extends Admin_Controller {
|
||||||
|
public function index() {
|
||||||
|
// Display the admin page, which contains a list of existing menu items.
|
||||||
|
$view = new Admin_View("admin.html");
|
||||||
|
$view->page_title = t("Manage menus");
|
||||||
|
$view->content = new View("admin_custom_menus.html");
|
||||||
|
$view->content->menu_list = $this->get_html_list(0);
|
||||||
|
print $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form_create($id) {
|
||||||
|
// Display the create new menu form.
|
||||||
|
print $this->get_new_menu_form($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form_edit($id) {
|
||||||
|
// Display the edit menu form.
|
||||||
|
print $this->get_edit_menu_form($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_new_menu_form($id) {
|
||||||
|
// Generate the create new menu form.
|
||||||
|
$form = new Forge("admin/custom_menus/create/$id", "", "post", array("id" => "g-create-menu-form"));
|
||||||
|
$group = $form->group("create_menu")
|
||||||
|
->label(t("Add new menu"));
|
||||||
|
$group->input("menu_title")
|
||||||
|
->label(t("Title"));
|
||||||
|
$group->input("menu_url")
|
||||||
|
->label(t("URL (Leave blank if this menu will have sub-menus)"));
|
||||||
|
$group->submit("")->value(t("Create menu"));
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_edit_menu_form($id) {
|
||||||
|
// Generate the edit menu form.
|
||||||
|
$existing_menu = ORM::factory("custom_menu", $id);
|
||||||
|
$form = new Forge("admin/custom_menus/edit/$id", "", "post", array("id" => "g-edit-menu-form"));
|
||||||
|
$group = $form->group("edit_menu")
|
||||||
|
->label(t("Edit menu"));
|
||||||
|
$group->input("menu_title")
|
||||||
|
->label(t("Title"))
|
||||||
|
->value($existing_menu->title);
|
||||||
|
$group->input("menu_url")
|
||||||
|
->label(t("URL (Leave blank if this menu will have sub-menus)"))
|
||||||
|
->value($existing_menu->url);
|
||||||
|
$group->submit("")->value(t("Save changes"));
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create($id) {
|
||||||
|
// Save a new menu to the database.
|
||||||
|
|
||||||
|
access::verify_csrf();
|
||||||
|
|
||||||
|
// Save form variables to the database.
|
||||||
|
$new_menu = ORM::factory("custom_menu");
|
||||||
|
$new_menu->title = Input::instance()->post("menu_title");
|
||||||
|
$new_menu->url = Input::instance()->post("menu_url");
|
||||||
|
$new_menu->parent_id = $id;
|
||||||
|
|
||||||
|
// Set menu's location to the last position.
|
||||||
|
$existing_menu = ORM::factory("custom_menu")
|
||||||
|
->where("parent_id", "=", $id)
|
||||||
|
->order_by("order_by", "DESC")
|
||||||
|
->find_all(1);
|
||||||
|
if (count($existing_menu) > 0) {
|
||||||
|
$int_position = $existing_menu[0]->order_by;
|
||||||
|
$int_position++;
|
||||||
|
$new_menu->order_by = $int_position;
|
||||||
|
} else {
|
||||||
|
$new_menu->order_by = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Save new menu to the database.
|
||||||
|
$new_menu->save();
|
||||||
|
message::success(t("Menu %menu_name created", array("menu_name" => $new_menu->title)));
|
||||||
|
log::success("custom_menus", t("Menu %menu_name created", array("menu_name" => $new_menu->title)));
|
||||||
|
json::reply(array("result" => "success"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id) {
|
||||||
|
// Save a new menu to the database.
|
||||||
|
|
||||||
|
access::verify_csrf();
|
||||||
|
|
||||||
|
// Load the existing menu and save changes.
|
||||||
|
$existing_menu = ORM::factory("custom_menu", $id);
|
||||||
|
if ($existing_menu->loaded()) {
|
||||||
|
$existing_menu->title = Input::instance()->post("menu_title");
|
||||||
|
$existing_menu->url = Input::instance()->post("menu_url");
|
||||||
|
$existing_menu->save();
|
||||||
|
message::success(t("Menu %menu_name saved", array("menu_name" => $existing_menu->title)));
|
||||||
|
log::success("custom_menus", t("Menu %menu_name saved", array("menu_name" => $existing_menu->title)));
|
||||||
|
json::reply(array("result" => "success"));
|
||||||
|
} else {
|
||||||
|
message::error(t("Unable to load menu %menu_id", array("menu_id" => $id)));
|
||||||
|
log::success("custom_menus", t("Unable to load menu %menu_id", array("menu_id" => $id)));
|
||||||
|
json::reply(array("result" => "success"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_html_list($parent_id) {
|
||||||
|
// Generate an HTML list of existing menu items.
|
||||||
|
$existing_menu = ORM::factory("custom_menu")
|
||||||
|
->where("parent_id", "=", $parent_id)
|
||||||
|
->order_by("order_by", "ASC")
|
||||||
|
->find_all();
|
||||||
|
$str_html = "";
|
||||||
|
if (count($existing_menu) > 0) {
|
||||||
|
$str_html = "<ul style=\"margin-bottom: 0em; margin-left: 2.5em;\">\n";
|
||||||
|
foreach ($existing_menu as $one_menu) {
|
||||||
|
$str_html .= "<li style=\"list-style:disc outside none; margin: 1em; line-height: 1em;\">" . $one_menu->title .
|
||||||
|
" <a href=\"" . url::site("admin/custom_menus/form_create/" . $one_menu->id) .
|
||||||
|
"\" class=\"g-dialog-link ui-icon-plus g-button ui-icon-left\" title=\"" . t("Add sub menu") .
|
||||||
|
"\"><span class=\"ui-icon ui-icon-plus\"></span></a>" .
|
||||||
|
" <a href=\"" . url::site("admin/custom_menus/form_edit/" . $one_menu->id) .
|
||||||
|
"\" class=\"g-dialog-link ui-icon-pencil g-button ui-icon-left\" title=\"" . t("Edit menu") .
|
||||||
|
"\"><span class=\"ui-icon ui-icon-pencil\"></span></a>" .
|
||||||
|
" <a href=\"" . url::site("admin/custom_menus/form_delete/" . $one_menu->id) .
|
||||||
|
"\" class=\"g-dialog-link ui-icon-trash g-button ui-icon-left\" title=\"" . t("Delete menu") .
|
||||||
|
"\"><span class=\"ui-icon ui-icon-trash\"></span></a>" .
|
||||||
|
" <a href=\"" . url::site("admin/custom_menus/move_menu_up/" . $one_menu->id) .
|
||||||
|
"\" class=\"g-button ui-icon-left\" title=\"" . t("Move menu up") .
|
||||||
|
"\">^</a>" .
|
||||||
|
" <a href=\"" . url::site("admin/custom_menus/move_menu_down/" . $one_menu->id) .
|
||||||
|
"\" class=\"g-button ui-icon-left\" title=\"" . t("Move menu down") .
|
||||||
|
"\">v</a>" .
|
||||||
|
"</li>\n";
|
||||||
|
$str_html .= $this->get_html_list($one_menu->id);
|
||||||
|
}
|
||||||
|
$str_html .= "</ul>\n";
|
||||||
|
}
|
||||||
|
return $str_html;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function form_delete($id) {
|
||||||
|
// Display a form asking the user if they want to delete a menu.
|
||||||
|
$one_menu = ORM::factory("custom_menu", $id);
|
||||||
|
if ($one_menu->loaded()) {
|
||||||
|
print $this->get_delete_form($one_menu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete($id) {
|
||||||
|
// Delete the specified menu.
|
||||||
|
|
||||||
|
access::verify_csrf();
|
||||||
|
|
||||||
|
// Make sure $id belongs to an actual menu.
|
||||||
|
$one_menu = ORM::factory("custom_menu", $id);
|
||||||
|
if (!$one_menu->loaded()) {
|
||||||
|
throw new Kohana_404_Exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the form validates, delete the specified menu.
|
||||||
|
$form = $this->get_delete_form($one_menu);
|
||||||
|
if ($form->validate()) {
|
||||||
|
$name = $one_menu->title;
|
||||||
|
$this->delete_sub_menus($one_menu->id);
|
||||||
|
$one_menu->delete();
|
||||||
|
message::success(t("Deleted menu %menu_name", array("menu_name" => $name)));
|
||||||
|
log::success("custom_menus", t("Deleted menu %menu_name", array("menu_name" => $name)));
|
||||||
|
json::reply(array("result" => "success", "location" => url::site("admin/custom_menus")));
|
||||||
|
} else {
|
||||||
|
print $form;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete_sub_menus($parent_id) {
|
||||||
|
// Delete all sub menus associated with $parent_id.
|
||||||
|
$existing_menu = ORM::factory("custom_menu")
|
||||||
|
->where("parent_id", "=", $parent_id)
|
||||||
|
->order_by("title", "ASC")
|
||||||
|
->find_all();
|
||||||
|
foreach ($existing_menu as $one_menu) {
|
||||||
|
$this->delete_sub_menus($one_menu->id);
|
||||||
|
$one_menu->delete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static function get_delete_form($one_menu) {
|
||||||
|
// Generate a new form asking the user if they want to delete a menu.
|
||||||
|
$form = new Forge("admin/custom_menus/delete/$one_menu->id", "", "post", array("id" => "g-delete-menu-form"));
|
||||||
|
$group = $form->group("delete_menu")
|
||||||
|
->label(t("Really delete menu %menu_name & sub-menus?", array("menu_name" => $one_menu->title)));
|
||||||
|
$group->submit("")->value(t("Delete Menu"));
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function move_menu_up($id) {
|
||||||
|
// Move the specified menu item up one position.
|
||||||
|
$one_menu = ORM::factory("custom_menu", $id);
|
||||||
|
if ($one_menu->loaded()) {
|
||||||
|
$existing_menu = ORM::factory("custom_menu")
|
||||||
|
->where("parent_id", "=", $one_menu->parent_id)
|
||||||
|
->where("order_by", "<", $one_menu->order_by)
|
||||||
|
->order_by("order_by", "DESC")
|
||||||
|
->find_all(1);
|
||||||
|
if (count($existing_menu) > 0) {
|
||||||
|
$second_menu = ORM::factory("custom_menu", $existing_menu[0]->id);
|
||||||
|
$temp_position = $one_menu->order_by;
|
||||||
|
$one_menu->order_by = $second_menu->order_by;
|
||||||
|
$second_menu->order_by = $temp_position;
|
||||||
|
$one_menu->save();
|
||||||
|
$second_menu->save();
|
||||||
|
message::success(t("Menu %menu_title moved up", array("menu_title" => $one_menu->title)));
|
||||||
|
log::success("custom_menus", t("Menu %menu_title moved up", array("menu_title" => $one_menu->title)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url::redirect("admin/custom_menus");
|
||||||
|
}
|
||||||
|
|
||||||
|
public function move_menu_down($id) {
|
||||||
|
// Move the specified menu item down one position.
|
||||||
|
$one_menu = ORM::factory("custom_menu", $id);
|
||||||
|
if ($one_menu->loaded()) {
|
||||||
|
$existing_menu = ORM::factory("custom_menu")
|
||||||
|
->where("parent_id", "=", $one_menu->parent_id)
|
||||||
|
->where("order_by", ">", $one_menu->order_by)
|
||||||
|
->order_by("order_by", "ASC")
|
||||||
|
->find_all(1);
|
||||||
|
if (count($existing_menu) > 0) {
|
||||||
|
$second_menu = ORM::factory("custom_menu", $existing_menu[0]->id);
|
||||||
|
$temp_position = $one_menu->order_by;
|
||||||
|
$one_menu->order_by = $second_menu->order_by;
|
||||||
|
$second_menu->order_by = $temp_position;
|
||||||
|
$one_menu->save();
|
||||||
|
$second_menu->save();
|
||||||
|
message::success(t("Menu %menu_title moved down", array("menu_title" => $one_menu->title)));
|
||||||
|
log::success("custom_menus", t("Menu %menu_title moved down", array("menu_title" => $one_menu->title)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
url::redirect("admin/custom_menus");
|
||||||
|
}
|
||||||
|
}
|
75
3.0/modules/custom_menus/helpers/custom_menus_event.php
Normal file
75
3.0/modules/custom_menus/helpers/custom_menus_event.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
/**
|
||||||
|
* Gallery - a web based photo album viewer and editor
|
||||||
|
* Copyright (C) 2000-2012 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 custom_menus_event_Core {
|
||||||
|
static function admin_menu($menu, $theme) {
|
||||||
|
// Add a settings link to the admin menu.
|
||||||
|
$menu->get("content_menu")
|
||||||
|
->append(Menu::factory("link")
|
||||||
|
->id("custom_menus")
|
||||||
|
->label(t("Custom Menus Manager"))
|
||||||
|
->url(url::site("admin/custom_menus")));
|
||||||
|
}
|
||||||
|
|
||||||
|
static function site_menu($menu, $theme) {
|
||||||
|
// Add user definied menu and sub-menu items to the site menu.
|
||||||
|
$existing_menu = ORM::factory("custom_menu")
|
||||||
|
->where("parent_id", "=", "0")
|
||||||
|
->order_by("order_by", "DESC")
|
||||||
|
->find_all();
|
||||||
|
if (count($existing_menu) > 0) {
|
||||||
|
foreach ($existing_menu as $one_menu) {
|
||||||
|
if ($one_menu->url == "") {
|
||||||
|
$menu->add_after("home", $new_menu = Menu::factory("submenu")
|
||||||
|
->id("custom_menus-" . $one_menu->id)
|
||||||
|
->label(t($one_menu->title)));
|
||||||
|
custom_menus_event::add_sub_menus($one_menu->id, $new_menu);
|
||||||
|
} else {
|
||||||
|
$menu->add_after("home", Menu::factory("link")
|
||||||
|
->id("custom_menus-" . $one_menu->id)
|
||||||
|
->label(t($one_menu->title))
|
||||||
|
->url($one_menu->url));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_sub_menus($parent_id, $parent_menu) {
|
||||||
|
// Populate the menu bar with any sub-menu items on the current menu ($parent_menu).
|
||||||
|
$existing_menu = ORM::factory("custom_menu")
|
||||||
|
->where("parent_id", "=", $parent_id)
|
||||||
|
->order_by("order_by", "ASC")
|
||||||
|
->find_all();
|
||||||
|
if (count($existing_menu) > 0) {
|
||||||
|
foreach ($existing_menu as $one_menu) {
|
||||||
|
if ($one_menu->url == "") {
|
||||||
|
$parent_menu->append($new_menu = Menu::factory("submenu")
|
||||||
|
->id("custom_menus-" . $one_menu->id)
|
||||||
|
->label(t($one_menu->title)));
|
||||||
|
custom_menus_event::add_sub_menus($one_menu->id, $new_menu);
|
||||||
|
} else {
|
||||||
|
$parent_menu->append(Menu::factory("link")
|
||||||
|
->id("custom_menus-" . $one_menu->id)
|
||||||
|
->label(t($one_menu->title))
|
||||||
|
->url($one_menu->url));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,22 +17,21 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class bitly_installer {
|
class custom_menus_installer {
|
||||||
|
|
||||||
static function install() {
|
static function install() {
|
||||||
Database::instance()
|
// Create a table to store menu info in.
|
||||||
->query("CREATE TABLE {bitly_links} (
|
$db = Database::instance();
|
||||||
`id` int(9) NOT NULL AUTO_INCREMENT,
|
$db->query("CREATE TABLE IF NOT EXISTS {custom_menus} (
|
||||||
`item_id` int(9) NOT NULL,
|
`id` int(9) NOT NULL auto_increment,
|
||||||
`hash` char(6) NOT NULL,
|
`title` varchar(255) default NULL,
|
||||||
`global_hash` char(6) NOT NULL,
|
`url` text default NULL,
|
||||||
PRIMARY KEY (`id`))
|
`parent_id` int(9) NOT NULL default 0,
|
||||||
|
`order_by` int(9) NOT NULL default 0,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY(`id`))
|
||||||
DEFAULT CHARSET=utf8;");
|
DEFAULT CHARSET=utf8;");
|
||||||
module::set_version("bitly", 1);
|
|
||||||
bitly::check_config();
|
|
||||||
}
|
|
||||||
|
|
||||||
static function deactivate() {
|
// Set the module version number.
|
||||||
site_status::clear("bitly_config");
|
module::set_version("custom_menus", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -17,5 +17,5 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
*/
|
*/
|
||||||
class Bitly_link_Model extends ORM {
|
class Custom_Menu_Model extends ORM {
|
||||||
}
|
}
|
7
3.0/modules/custom_menus/module.info
Normal file
7
3.0/modules/custom_menus/module.info
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
name = "Custom Menus"
|
||||||
|
description = "Allows Gallery admins to create additional menu and sub-menu items."
|
||||||
|
version = 1
|
||||||
|
author_name = "rWatcher"
|
||||||
|
author_url = "http://codex.gallery2.org/User:RWatcher"
|
||||||
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:custom_menus"
|
||||||
|
discuss_url = "http://gallery.menalto.com/node/102814"
|
@ -0,0 +1,8 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
<div class="g-block">
|
||||||
|
<h1> <?= t("Manage menus") ?> </h1>
|
||||||
|
<div class="g-block-content">
|
||||||
|
<a href="<?= url::site("admin/custom_menus/form_create/0") ?>" class="g-dialog-link g-create-link"><?= t("Add new menu") ?></a>
|
||||||
|
<?= $menu_list ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name = "Database Info"
|
name = "Database Info"
|
||||||
description = "View information about your Gallery 3 database on the admin dashboard."
|
description = "View information about your Gallery 3 database on the admin dashboard."
|
||||||
version = 1
|
version = 1
|
||||||
author_name = ""
|
author_name = "rWatcher"
|
||||||
author_url = ""
|
author_url = "http://codex.gallery2.org/User:RWatcher"
|
||||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:database_info"
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:database_info"
|
||||||
discuss_url = "http://gallery.menalto.com/forum_module_database_info"
|
discuss_url = "http://gallery.menalto.com/node/95320"
|
||||||
|
56
3.0/modules/default_sort/controllers/admin_default_sort.php
Normal file
56
3.0/modules/default_sort/controllers/admin_default_sort.php
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?><?php
|
||||||
|
|
||||||
|
class Admin_Default_Sort_Controller extends Admin_Controller {
|
||||||
|
public function index() {
|
||||||
|
$form = $this->_get_form();
|
||||||
|
|
||||||
|
if (request::method() == "post") {
|
||||||
|
access::verify_csrf();
|
||||||
|
|
||||||
|
if ($form->validate()) {
|
||||||
|
module::set_var("default_sort", "default_sort_column", $_POST['sort_column']);
|
||||||
|
module::set_var("default_sort", "default_sort_direction", $_POST['sort_direction']);
|
||||||
|
|
||||||
|
message::success(t("Settings have been saved"));
|
||||||
|
url::redirect("admin/default_sort");
|
||||||
|
} else {
|
||||||
|
message::error(t("There was a problem with the submitted form. Please check your values and try again."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print $this->_get_view();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _get_view($form = null) {
|
||||||
|
$v = new Admin_View("admin.html");
|
||||||
|
$v->page_title = t("Gallery 3 :: Set Default Sort Order for New Albums");
|
||||||
|
|
||||||
|
$v->content = new View("admin_default_sort.html");
|
||||||
|
$v->content->form = empty($form) ? $this->_get_form() : $form;
|
||||||
|
|
||||||
|
return $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function _get_form() {
|
||||||
|
$form = new Forge("admin/default_sort", "", "post", array("id" => "g-admin-default_sort-form"));
|
||||||
|
|
||||||
|
$group = $form->group("sort_order")->label(t("Sort Order"));
|
||||||
|
|
||||||
|
$group ->dropdown("sort_column")
|
||||||
|
->id(t("sort_column"))
|
||||||
|
->label(t("Sort by"))
|
||||||
|
->options(array_merge(array("none" => t("None")), album::get_sort_order_options()))
|
||||||
|
->selected(module::get_var("default_sort", "default_sort_column", "none"));
|
||||||
|
|
||||||
|
$group ->dropdown("sort_direction")
|
||||||
|
->id(t("sort_direction"))
|
||||||
|
->label(t("Sort by"))
|
||||||
|
->options(array("none" => t("None"), "ASC" => t("Ascending"), "DESC" => t("Descending")))
|
||||||
|
->selected(module::get_var("default_sort", "default_sort_direction", "none"));
|
||||||
|
|
||||||
|
$form->submit("submit")->value(t("Save"));
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab:
|
6
3.0/modules/default_sort/helpers/default_sort.php
Normal file
6
3.0/modules/default_sort/helpers/default_sort.php
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
|
||||||
|
class default_sort_Core {
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab:
|
26
3.0/modules/default_sort/helpers/default_sort_event.php
Normal file
26
3.0/modules/default_sort/helpers/default_sort_event.php
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
|
||||||
|
class default_sort_event_Core {
|
||||||
|
static function admin_menu($menu, $theme) {
|
||||||
|
$menu
|
||||||
|
->get("settings_menu")
|
||||||
|
->append(Menu::factory("link")
|
||||||
|
->id("default_sort_menu")
|
||||||
|
->label(t("Default Sort Order"))
|
||||||
|
->url(url::site("admin/default_sort")));
|
||||||
|
}
|
||||||
|
|
||||||
|
static function item_created($item) {
|
||||||
|
if ($item->is_album()) {
|
||||||
|
if (($s = module::get_var("default_sort", "default_sort_column", "")))
|
||||||
|
$item->sort_column = $s;
|
||||||
|
|
||||||
|
if (($s = module::get_var("default_sort", "default_sort_direction", "")))
|
||||||
|
$item->sort_order = $s;
|
||||||
|
|
||||||
|
$item->save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab:
|
29
3.0/modules/default_sort/helpers/default_sort_installer.php
Normal file
29
3.0/modules/default_sort/helpers/default_sort_installer.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
|
|
||||||
|
class default_sort_installer {
|
||||||
|
private static function getversion() { return 1; }
|
||||||
|
private static function setversion() { module::set_version("default_sort", self::getversion()); }
|
||||||
|
|
||||||
|
static function install() {
|
||||||
|
self::setversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function upgrade($version) {
|
||||||
|
if ($version < self::getversion())
|
||||||
|
self::setversion();
|
||||||
|
}
|
||||||
|
|
||||||
|
static function can_activate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static function activate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static function deactivate() {
|
||||||
|
}
|
||||||
|
|
||||||
|
static function uninstall() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
# vim: tabstop=4 softtabstop=4 shiftwidth=4 expandtab:
|
7
3.0/modules/default_sort/module.info
Normal file
7
3.0/modules/default_sort/module.info
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
name = "Default Sort Order"
|
||||||
|
description = "Set default sort order for newly-created albums."
|
||||||
|
version = 1
|
||||||
|
author_name = "jingai"
|
||||||
|
author_url = ""
|
||||||
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:default_sort"
|
||||||
|
discuss_url = "http://gallery.menalto.com/forum_module_default_sort"
|
11
3.0/modules/default_sort/views/admin_default_sort.html.php
Normal file
11
3.0/modules/default_sort/views/admin_default_sort.html.php
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||||
|
|
||||||
|
<div id="g-admin-code-block">
|
||||||
|
<h2><?= t("Default Sort Order") ?></h2>
|
||||||
|
|
||||||
|
<p><?= t("Set default sort order and column for newly-created albums."); ?></p>
|
||||||
|
|
||||||
|
<div class="g-block-content">
|
||||||
|
<?php echo $form; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
<?= "<?php defined(\"SYSPATH\") or die(\"No direct script access.\");" ?>
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
name = "DisplayTags"
|
name = "DisplayTags"
|
||||||
description = "Display all tags for the current photo/album."
|
description = "Display all tags for the current photo/album."
|
||||||
version = 1
|
version = 1
|
||||||
author_name = ""
|
author_name = "rWatcher"
|
||||||
author_url = ""
|
author_url = "http://codex.gallery2.org/User:RWatcher"
|
||||||
info_url = "http://codex.gallery2.org/Gallery3:Modules:displaytags"
|
info_url = "http://codex.gallery2.org/Gallery3:Modules:displaytags"
|
||||||
discuss_url = "http://gallery.menalto.com/forum_module_displaytags"
|
discuss_url = "http://gallery.menalto.com/node/89093"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php defined("SYSPATH") or die("No direct script access.");
|
<?php defined("SYSPATH") or die("No direct script access.");
|
||||||
/**
|
/**
|
||||||
* Gallery - a web based photo album viewer and editor
|
* Gallery - a web based photo album viewer and editor
|
||||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
* Copyright (C) 2000-2012 Bharat Mediratta
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user