Merge remote branch 'gallery3-contrib/master'
This commit is contained in:
commit
fecd7c8087
4
.gitignore
vendored
Normal file
4
.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
.DS_Store
|
||||
tmp
|
||||
*~
|
||||
*.swp
|
@ -111,6 +111,10 @@ class Gallery3 {
|
||||
* @return object Gallery3
|
||||
*/
|
||||
public function create($url, $token) {
|
||||
if (!is_string($url)) {
|
||||
throw new Gallery3_Exception("Invalid url: " . var_export($url));
|
||||
}
|
||||
|
||||
$response = Gallery3_Helper::request(
|
||||
"post", $url, $token, array("entity" => $this->data->entity), $this->file);
|
||||
$this->url = $response->url;
|
||||
@ -153,7 +157,7 @@ class Gallery3 {
|
||||
public function load() {
|
||||
$response = Gallery3_Helper::request("get", $this->url, $this->token);
|
||||
$this->data = $response;
|
||||
$this->original_entity = (array)$response->entity;
|
||||
$this->original_entity = isset($response->entity) ? (array)$response->entity : null;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ alert("Connect to $SITE_URL");
|
||||
$auth = Gallery3::login($SITE_URL, $USER, $PASSWORD);
|
||||
$root = Gallery3::factory("$SITE_URL/item/1", $auth);
|
||||
$tags = Gallery3::factory("$SITE_URL/tags", $auth);
|
||||
$comments = Gallery3::factory("$SITE_URL/comments", $auth);
|
||||
|
||||
$tag = Gallery3::factory()
|
||||
->set("name", "My Tag")
|
||||
@ -45,6 +46,13 @@ for ($i = 0; $i < 2; $i++) {
|
||||
$album->load();
|
||||
alert("Album members: <b>" . join(", ", $album->data->members) . "</b>");
|
||||
|
||||
$comment = Gallery3::factory()
|
||||
->set("item", $album->data->members[0])
|
||||
->set("type", "comment")
|
||||
->set("text", "This is a random comment-- whee!")
|
||||
->create($comments->url, $auth);
|
||||
alert("Comment: <b>{$comment->url}</b>");
|
||||
|
||||
alert("Reorder the album");
|
||||
$album
|
||||
->set_members(array($album->data->members[1], $album->data->members[0]))
|
||||
@ -93,7 +101,7 @@ $tag->delete();
|
||||
alert("Done!");
|
||||
|
||||
function alert($msg) {
|
||||
print "$msg <br/>";
|
||||
print "$msg <br/>\n";
|
||||
flush();
|
||||
}
|
||||
?>
|
@ -265,7 +265,6 @@ class CalendarView_Controller extends Controller {
|
||||
$str_year_id = Input::instance()->post("cal_year");
|
||||
|
||||
// redirect to the currect page.
|
||||
url::redirect(url::site("calendarview/calendar/" . $str_year_id . "/" . $str_user_id));
|
||||
|
||||
url::redirect(url::site("calendarview/calendar/" . $str_year_id . "/" . $str_user_id, request::protocol()));
|
||||
}
|
||||
}
|
@ -37,7 +37,6 @@ table.calendar caption {
|
||||
|
||||
table.calendar th, table.calendar td {
|
||||
padding: 0.2em;
|
||||
background: #ffffff;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
|
@ -38,14 +38,32 @@ class calendarview_block_Core {
|
||||
$display_date = $item->created;
|
||||
}
|
||||
|
||||
// Make sure there are photo's to display.
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, date("n", $display_date), date("j", $display_date), date("Y", $display_date)))
|
||||
->where("captured", "<", mktime(0, 0, 0, date("n", $display_date), date("j", $display_date)+1, date("Y", $display_date)))
|
||||
->find_all()
|
||||
->count();
|
||||
$month_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type", "!=", "album")
|
||||
->where("captured", ">=", mktime(0, 0, 0, date("n", $display_date), 1, date("Y", $display_date)))
|
||||
->where("captured", "<", mktime(0, 0, 0, date("n", $display_date)+1, 1, date("Y", $display_date)))
|
||||
->find_all()
|
||||
->count();
|
||||
|
||||
switch ($block_id) {
|
||||
case "calendarview_photo":
|
||||
if ($display_date != "") {
|
||||
if ( ($display_date != "") && (($day_count > 0) || ($month_count > 0)) ) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-calendarview-sidebar";
|
||||
$block->title = t("Calendar");
|
||||
$block->content = new View("calendarview_sidebar.html");
|
||||
$block->content->date = $display_date;
|
||||
$block->content->day_count = $day_count;
|
||||
$block->content->month_count = $month_count;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1,5 +1,9 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul>
|
||||
<? if ($day_count > 0): ?>
|
||||
<li><a href="<?=url::site("calendarview/day/" . date("Y", $date) . "/-1/" . date("n", $date) . "/" . date("j", $date)); ?>"><?=t("More from"); ?> <?=date("F", $date); ?> <?=date("j", $date); ?><?=date("S", $date); ?></a></li>
|
||||
<? endif ?>
|
||||
<? if ($month_count > 0): ?>
|
||||
<li><a href="<?=url::site("calendarview/month/" . date("Y", $date) . "/-1/" . date("n", $date)); ?>"><?=t("More from"); ?> <?=date("F", $date); ?></a></li>
|
||||
<? endif ?>
|
||||
</ul>
|
@ -17,20 +17,20 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Three_Nids_Controller extends Controller {
|
||||
public function show_comments($id) {
|
||||
$item = ORM::factory("item", $id);
|
||||
access::required("view", $item);
|
||||
class database_info_block_Core {
|
||||
static function get_admin_list() {
|
||||
return array("database_info" => t("Database info"));
|
||||
}
|
||||
|
||||
$comments = ORM::factory("comment")
|
||||
->where("item_id", "=", $item->id)
|
||||
->where("state", "=", "published")
|
||||
->order_by("created", "ASC")
|
||||
->find_all();
|
||||
|
||||
$v = new Theme_View("comments.html", "other", "comment-fragment");
|
||||
$v->comments = $comments;
|
||||
$v->item = $item;
|
||||
print $v;
|
||||
static function get($block_id) {
|
||||
$block = new Block();
|
||||
switch ($block_id) {
|
||||
case "database_info":
|
||||
$block->css_id = "g-database-info";
|
||||
$block->title = t("Database information");
|
||||
$block->content = new View("admin_block_db.html");
|
||||
break;
|
||||
}
|
||||
return $block;
|
||||
}
|
||||
}
|
3
modules/database_info/module.info
Normal file
3
modules/database_info/module.info
Normal file
@ -0,0 +1,3 @@
|
||||
name = "Database Info"
|
||||
description = "View information about your Gallery 3 database on the admin dashboard."
|
||||
version = 1
|
18
modules/database_info/views/admin_block_db.html.php
Normal file
18
modules/database_info/views/admin_block_db.html.php
Normal file
@ -0,0 +1,18 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<?
|
||||
$db = Database::instance();
|
||||
$tables = $db->query("SHOW TABLE STATUS");
|
||||
$database_size = 0;
|
||||
foreach($tables as $table) {
|
||||
$database_size += ($table->Data_length + $table->Index_length);
|
||||
}
|
||||
$database_size = $database_size / 1024 / 1024;
|
||||
?>
|
||||
<ul>
|
||||
<li>
|
||||
<?= t("Database size: %dbsize MB", array("dbsize" => number_format($database_size, 2))) ?>
|
||||
</li>
|
||||
<li>
|
||||
<?= t("Number of tables: %dbtables", array("dbtables" => count($tables))) ?>
|
||||
</li>
|
||||
</ul>
|
258
modules/downloadalbum/controllers/downloadalbum.php
Normal file
258
modules/downloadalbum/controllers/downloadalbum.php
Normal file
@ -0,0 +1,258 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class downloadalbum_Controller extends Controller {
|
||||
|
||||
/**
|
||||
* Generate a ZIP on-the-fly.
|
||||
*/
|
||||
public function zip($id) {
|
||||
$album = $this->init($id);
|
||||
$files = $this->getFilesList($album);
|
||||
|
||||
// Calculate ZIP size (look behind for details)
|
||||
$zipsize = 22;
|
||||
foreach($files as $f) {
|
||||
$zipsize += 76 + 2*strlen($f) + filesize($f);
|
||||
}
|
||||
|
||||
// Send headers
|
||||
$this->prepareOutput();
|
||||
$this->sendHeaders($album->name.'.zip', $zipsize);
|
||||
|
||||
// Generate and send ZIP file
|
||||
// http://www.pkware.com/documents/casestudies/APPNOTE.TXT (v6.3.2)
|
||||
$lfh_offset = 0;
|
||||
$cds = '';
|
||||
$cds_offset = 0;
|
||||
foreach($files as $f) {
|
||||
$f_namelen = strlen($f);
|
||||
$f_size = filesize($f);
|
||||
$f_mtime = $this->unix2dostime(filemtime($f));
|
||||
$f_crc32 = hexdec(hash_file('crc32b', $f, false));
|
||||
|
||||
// Local file header
|
||||
echo pack('VvvvVVVVvva' . $f_namelen,
|
||||
0x04034b50, // local file header signature (4 bytes)
|
||||
0x0a, // version needed to extract (2 bytes) => 1.0
|
||||
0x0800, // general purpose bit flag (2 bytes) => UTF-8
|
||||
0x00, // compression method (2 bytes) => store
|
||||
$f_mtime, // last mod file time and date (4 bytes)
|
||||
$f_crc32, // crc-32 (4 bytes)
|
||||
$f_size, // compressed size (4 bytes)
|
||||
$f_size, // uncompressed size (4 bytes)
|
||||
$f_namelen, // file name length (2 bytes)
|
||||
0, // extra field length (2 bytes)
|
||||
|
||||
$f // file name (variable size)
|
||||
// extra field (variable size) => n/a
|
||||
);
|
||||
|
||||
// File data
|
||||
readfile($f);
|
||||
|
||||
// Data descriptor (n/a)
|
||||
|
||||
// Central directory structure: File header
|
||||
$cds .= pack('VvvvvVVVVvvvvvVVa' . $f_namelen,
|
||||
0x02014b50, // central file header signature (4 bytes)
|
||||
0x031e, // version made by (2 bytes) => v3 / Unix
|
||||
0x0a, // version needed to extract (2 bytes) => 1.0
|
||||
0x0800, // general purpose bit flag (2 bytes) => UTF-8
|
||||
0x00, // compression method (2 bytes) => store
|
||||
$f_mtime, // last mod file time and date (4 bytes)
|
||||
$f_crc32, // crc-32 (4 bytes)
|
||||
$f_size, // compressed size (4 bytes)
|
||||
$f_size, // uncompressed size (4 bytes)
|
||||
$f_namelen, // file name length (2 bytes)
|
||||
0, // extra field length (2 bytes)
|
||||
0, // file comment length (2 bytes)
|
||||
0, // disk number start (2 bytes)
|
||||
0, // internal file attributes (2 bytes)
|
||||
0x81b40000, // external file attributes (4 bytes) => chmod 664
|
||||
$lfh_offset, // relative offset of local header (4 bytes)
|
||||
|
||||
$f // file name (variable size)
|
||||
// extra field (variable size) => n/a
|
||||
// file comment (variable size) => n/a
|
||||
);
|
||||
|
||||
// Update local file header/central directory structure offset
|
||||
$cds_offset = $lfh_offset += 30 + $f_namelen + $f_size;
|
||||
}
|
||||
|
||||
// Archive decryption header (n/a)
|
||||
// Archive extra data record (n/a)
|
||||
|
||||
// Central directory structure: Digital signature (n/a)
|
||||
echo $cds; // send Central directory structure
|
||||
|
||||
// Zip64 end of central directory record (n/a)
|
||||
// Zip64 end of central directory locator (n/a)
|
||||
|
||||
// End of central directory record
|
||||
$numfile = count($files);
|
||||
$cds_len = strlen($cds);
|
||||
echo pack('VvvvvVVv',
|
||||
0x06054b50, // end of central dir signature (4 bytes)
|
||||
0, // number of this disk (2 bytes)
|
||||
0, // number of the disk with the start of
|
||||
// the central directory (2 bytes)
|
||||
$numfile, // total number of entries in the
|
||||
// central directory on this disk (2 bytes)
|
||||
$numfile, // total number of entries in the
|
||||
// central directory (2 bytes)
|
||||
$cds_len, // size of the central directory (4 bytes)
|
||||
$cds_offset, // offset of start of central directory
|
||||
// with respect to the
|
||||
// starting disk number (4 bytes)
|
||||
0 // .ZIP file comment length (2 bytes)
|
||||
// .ZIP file comment (variable size)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
private function init($id) {
|
||||
$item = ORM::factory("item", $id);
|
||||
|
||||
// Only send an album
|
||||
if (!$item->is_album()) {
|
||||
// @todo: throw an exception?
|
||||
Kohana::log('error', 'item is not an album: '.$item->relative_path());
|
||||
exit;
|
||||
}
|
||||
|
||||
// Must have view_full to download the originals files
|
||||
access::required("view_full", $item);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the files that must be included in the archive.
|
||||
*/
|
||||
private function getFilesList($album) {
|
||||
$files = array();
|
||||
|
||||
// Go to the parent of album so the ZIP will not contains all the
|
||||
// server hierarchy
|
||||
if (!chdir($album->file_path().'/../')) {
|
||||
// @todo: throw an exception?
|
||||
Kohana::log('error', 'unable to chdir('.$item->file_path().'/../)');
|
||||
exit;
|
||||
}
|
||||
$cwd = getcwd();
|
||||
|
||||
$items = $album->viewable()
|
||||
->descendants(null, null, array(array("type", "<>", "album")));
|
||||
foreach($items as $i) {
|
||||
if (!access::can('view_full', $i)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$relative_path = str_replace($cwd.'/', '', realpath($i->file_path()));
|
||||
if (!is_readable($relative_path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$files[] = $relative_path;
|
||||
}
|
||||
|
||||
if (count($files) === 0) {
|
||||
// @todo: throw an exception?
|
||||
Kohana::log('error', 'no zippable files in ['.$album->relative_path().']');
|
||||
exit;
|
||||
}
|
||||
|
||||
return $files;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* See system/helpers/download.php
|
||||
*/
|
||||
private function prepareOutput() {
|
||||
// Close output buffers
|
||||
Kohana::close_buffers(FALSE);
|
||||
// Clear any output
|
||||
Event::add('system.display', create_function('', 'Kohana::$output = "";'));
|
||||
}
|
||||
|
||||
/**
|
||||
* See system/helpers/download.php
|
||||
*/
|
||||
private function sendHeaders($filename, $filesize = null) {
|
||||
if (!is_null($filesize)) {
|
||||
header('Content-Length: '.$filesize);
|
||||
}
|
||||
|
||||
// Retrieve MIME type by extension
|
||||
$mime = Kohana::config('mimes.'.strtolower(substr(strrchr($filename, '.'), 1)));
|
||||
$mime = empty($mime) ? 'application/octet-stream' : $mime[0];
|
||||
header("Content-Type: $mime");
|
||||
header('Content-Transfer-Encoding: binary');
|
||||
|
||||
// Send headers necessary to invoke a "Save As" dialog
|
||||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||||
|
||||
// Prevent caching
|
||||
header('Expires: Thu, 01 Jan 1970 00:00:00 GMT');
|
||||
|
||||
if (request::user_agent('browser') === 'Internet Explorer'
|
||||
AND request::user_agent('version') <= '6.0')
|
||||
{
|
||||
// HTTP 1.0
|
||||
header('Pragma:');
|
||||
|
||||
// HTTP 1.1 with IE extensions
|
||||
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
|
||||
}
|
||||
else
|
||||
{
|
||||
// HTTP 1.0
|
||||
header('Pragma: no-cache');
|
||||
|
||||
// HTTP 1.1
|
||||
header('Cache-Control: no-cache, max-age=0');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return integer DOS date and time
|
||||
* @param integer _timestamp Unix timestamp
|
||||
* @desc returns DOS date and time of the timestamp
|
||||
*/
|
||||
private function unix2dostime($timestamp)
|
||||
{
|
||||
$timebit = getdate($timestamp);
|
||||
|
||||
if ($timebit['year'] < 1980) {
|
||||
return (1 << 21 | 1 << 16);
|
||||
}
|
||||
|
||||
$timebit['year'] -= 1980;
|
||||
|
||||
return ($timebit['year'] << 25 | $timebit['mon'] << 21 |
|
||||
$timebit['mday'] << 16 | $timebit['hours'] << 11 |
|
||||
$timebit['minutes'] << 5 | $timebit['seconds'] >> 1);
|
||||
}
|
||||
}
|
3
modules/downloadalbum/css/downloadalbum_menu.css
Normal file
3
modules/downloadalbum/css/downloadalbum_menu.css
Normal file
@ -0,0 +1,3 @@
|
||||
#g-view-menu #g-download-album-link {
|
||||
background-image: url('../images/ico-view-downloadalbum.png');
|
||||
}
|
32
modules/downloadalbum/helpers/downloadalbum_event.php
Normal file
32
modules/downloadalbum/helpers/downloadalbum_event.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class downloadalbum_event_Core {
|
||||
static function album_menu($menu, $theme) {
|
||||
if (access::can("view_full", $theme->item)) {
|
||||
$downloadLink = url::site("downloadalbum/zip/{$theme->item->id}");
|
||||
$menu
|
||||
->append(Menu::factory("link")
|
||||
->id("downloadalbum")
|
||||
->label(t("Download Album"))
|
||||
->url($downloadLink)
|
||||
->css_id("g-download-album-link"));
|
||||
}
|
||||
}
|
||||
}
|
26
modules/downloadalbum/helpers/downloadalbum_theme.php
Normal file
26
modules/downloadalbum/helpers/downloadalbum_theme.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class downloadalbum_theme {
|
||||
static function head($theme) {
|
||||
if ($theme->item && access::can("view_full", $theme->item)) {
|
||||
$theme->css("downloadalbum_menu.css");
|
||||
}
|
||||
}
|
||||
}
|
BIN
modules/downloadalbum/images/ico-view-downloadalbum.png
Normal file
BIN
modules/downloadalbum/images/ico-view-downloadalbum.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
3
modules/downloadalbum/module.info
Normal file
3
modules/downloadalbum/module.info
Normal file
@ -0,0 +1,3 @@
|
||||
name = "DownloadAlbum"
|
||||
description = "Displays a link to download a ZIP archive of the current album."
|
||||
version = 1
|
129
modules/exif_gps/controllers/admin_exif_gps.php
Normal file
129
modules/exif_gps/controllers/admin_exif_gps.php
Normal file
@ -0,0 +1,129 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
class Admin_EXIF_GPS_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
// Generate a new admin page.
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_exif_gps.html");
|
||||
$view->content->exifgps_form = $this->_get_admin_form();
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function saveprefs() {
|
||||
// Save user preferences to the database.
|
||||
|
||||
// Prevent Cross Site Request Forgery
|
||||
access::verify_csrf();
|
||||
|
||||
// Make sure the user filled out the form properly.
|
||||
$form = $this->_get_admin_form();
|
||||
if ($form->validate()) {
|
||||
Kohana_Log::add("error",print_r($form,1));
|
||||
|
||||
// Save settings to Gallery's database.
|
||||
module::set_var("exif_gps", "googlemap_api_key", $form->Global->google_api_key->value);
|
||||
module::set_var("exif_gps", "googlemap_max_autozoom", $form->Global->max_auto_zoom_level->value);
|
||||
module::set_var("exif_gps", "sidebar_zoom", $form->Sidebar->sidebar_default_zoom->value);
|
||||
module::set_var("exif_gps", "sidebar_mapformat", $form->Sidebar->sidebar_mapformat->value);
|
||||
module::set_var("exif_gps", "sidebar_maptype", $form->Sidebar->sidebar_maptype->value);
|
||||
module::set_var("exif_gps", "largemap_maptype", $form->LargeMap->largemap_maptype->value);
|
||||
$checkbox_album = false;
|
||||
$checkbox_user = false;
|
||||
for ($i = 0; $i < count($form->Global->toolbar_map_album); $i++) {
|
||||
if ($form->Global->toolbar_map_album->value[$i] == "checkbox_album") {
|
||||
$checkbox_album = true;
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < count($form->Global->toolbar_map_user); $i++) {
|
||||
if ($form->Global->toolbar_map_user->value[$i] == "checkbox_user") {
|
||||
$checkbox_user = true;
|
||||
}
|
||||
}
|
||||
module::set_var("exif_gps", "toolbar_map_album", $checkbox_album);
|
||||
module::set_var("exif_gps", "toolbar_map_user", $checkbox_user);
|
||||
|
||||
// Display a success message and redirect back to the TagsMap admin page.
|
||||
message::success(t("Your settings have been saved."));
|
||||
url::redirect("admin/exif_gps");
|
||||
}
|
||||
|
||||
// Else show the page with errors
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_exif_gps.html");
|
||||
$view->content->exifgps_form = $form;
|
||||
print $view;
|
||||
}
|
||||
|
||||
private function _get_admin_form() {
|
||||
// Make a new Form.
|
||||
$form = new Forge("admin/exif_gps/saveprefs", "", "post",
|
||||
array("id" => "g-exif-gps-adminForm"));
|
||||
|
||||
// Create group for global settings, like the Maps API Key
|
||||
$gps_global_group = $form->group("Global")
|
||||
->label(t("Global Settings"));
|
||||
$gps_global_group->input("google_api_key")
|
||||
->label(t("Google Maps API Key"))
|
||||
->value(module::get_var("exif_gps", "googlemap_api_key"))
|
||||
->rules("required");
|
||||
$gps_global_group->input("max_auto_zoom_level")
|
||||
->label(t("Maximum Auto-Zoom Level:"))
|
||||
->value(module::get_var("exif_gps", "googlemap_max_autozoom"));
|
||||
$checkbox_user["checkbox_user"] = array(t("Show \"Map this user\" icon?"), module::get_var("exif_gps", "toolbar_map_user"));
|
||||
$checkbox_album["checkbox_album"] = array(t("Show \"Map this album\" icon?"), module::get_var("exif_gps", "toolbar_map_album"));
|
||||
$gps_global_group->checklist("toolbar_map_album")
|
||||
->options($checkbox_album);
|
||||
$gps_global_group->checklist("toolbar_map_user")
|
||||
->options($checkbox_user);
|
||||
|
||||
// Create a group for sidebar settings
|
||||
$gps_sidebar = $form->group("Sidebar")
|
||||
->label(t("Sidebar Settings"));
|
||||
$gps_sidebar->input("sidebar_default_zoom")
|
||||
->label(t("Default Zoom Level"))
|
||||
->value(module::get_var("exif_gps", "sidebar_zoom"))
|
||||
->rules("required");
|
||||
$gps_sidebar->dropdown("sidebar_mapformat")
|
||||
->label(t("Map Interface"))
|
||||
->options(array(t("Static"), t("Interactive")))
|
||||
->selected(module::get_var("exif_gps", "sidebar_mapformat"));
|
||||
$gps_sidebar->dropdown("sidebar_maptype")
|
||||
->label(t("Default Map Type"))
|
||||
->options(array(t("Map"), t("Satellite"),
|
||||
t("Hybrid"), t("Terrain")))
|
||||
->selected(module::get_var("exif_gps", "sidebar_maptype"));
|
||||
|
||||
// Create a group for map album/user settings
|
||||
$gps_large_map_group = $form->group("LargeMap")
|
||||
->label(t("Map Album/User Settings"));
|
||||
$gps_large_map_group->dropdown("largemap_maptype")
|
||||
->label(t("Default Map Type"))
|
||||
->options(array(t("Map"), t("Satellite"),
|
||||
t("Hybrid"), t("Terrain")))
|
||||
->selected(module::get_var("exif_gps", "largemap_maptype"));
|
||||
|
||||
// Add a save button to the form.
|
||||
$form->submit("SaveSettings")->value(t("Save"));
|
||||
|
||||
// Return the newly generated form.
|
||||
return $form;
|
||||
}
|
||||
}
|
78
modules/exif_gps/controllers/exif_gps.php
Normal file
78
modules/exif_gps/controllers/exif_gps.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class EXIF_GPS_Controller extends Controller {
|
||||
public function map($map_type, $type_id) {
|
||||
// Map all items in the specified album or user.
|
||||
|
||||
$map_title = "";
|
||||
if ($map_type == "album") {
|
||||
// Generate an array of all items in the current album that have exif gps
|
||||
// coordinates and order by latitude (to group items w/ the same
|
||||
// coordinates together).
|
||||
$items = ORM::factory("item", $type_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants();
|
||||
$curr_album = ORM::factory("item")->where("id", "=", $type_id)->find_all();
|
||||
$map_title = $curr_album[0]->name;
|
||||
} elseif ($map_type == "user") {
|
||||
// Generate an array of all items uploaded by the current user that
|
||||
// have exif gps coordinates and order by latitude (to group items
|
||||
// w/ the same coordinates together).
|
||||
$items = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $type_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->find_all();
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $type_id)->find_all();
|
||||
$map_title = $curr_user[0]->full_name . "'s " . t("Photos");
|
||||
}
|
||||
|
||||
// Make a new page.
|
||||
$template = new Theme_View("page.html", "other", "EXIFMap");
|
||||
$template->page_title = t("Gallery :: Map");
|
||||
$template->content = new View("exif_gps_map.html");
|
||||
if ($map_title == "") {
|
||||
$template->content->title = t("Map");
|
||||
} else {
|
||||
$template->content->title = t("Map of") . " " . $map_title;
|
||||
}
|
||||
|
||||
// Figure out default map type.
|
||||
$int_map_type = module::get_var("exif_gps", "largemap_maptype");
|
||||
if ($int_map_type == 0) $map_type = "ROADMAP";
|
||||
if ($int_map_type == 1) $map_type = "SATELLITE";
|
||||
if ($int_map_type == 2) $map_type = "HYBRID";
|
||||
if ($int_map_type == 3) $map_type = "TERRAIN";
|
||||
$template->content->map_type = $map_type;
|
||||
|
||||
// When mapping an album, generate a "return to album" link.
|
||||
if (isset($curr_album)) $template->content->return_url = url::abs_site("{$curr_album[0]->type}s/{$curr_album[0]->id}");
|
||||
|
||||
// Load in module preferences.
|
||||
$template->content->items = $items;
|
||||
$template->content->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
|
||||
|
||||
// Display the page.
|
||||
print $template;
|
||||
}
|
||||
}
|
6
modules/exif_gps/css/exif_gps_menu.css
Normal file
6
modules/exif_gps/css/exif_gps_menu.css
Normal file
@ -0,0 +1,6 @@
|
||||
#g-view-menu #g-exif-gps-album-link {
|
||||
background-image: url('../images/ico-view-exif_gps_album.png');
|
||||
}
|
||||
#g-view-menu #g-exif-gps-user-link {
|
||||
background-image: url('../images/ico-view-exif_gps_user.png');
|
||||
}
|
@ -17,12 +17,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the API for handling exif data.
|
||||
*/
|
||||
class exif_gps_Core {
|
||||
|
||||
protected static $exif_keys;
|
||||
|
||||
static function extract($item) {
|
||||
@ -52,10 +47,10 @@ class exif_gps_Core {
|
||||
$record->latitude = str_replace(",", ".", $keys["Latitude"]);
|
||||
$record->longitude = str_replace(",", ".", $keys["Longitude"]);
|
||||
// Represent N/S/E/W as postive and negative numbers
|
||||
if ($keys["Latitude Reference"] == "S") {
|
||||
if (substr(strtoupper($keys["Latitude Reference"]), 0, 1) == "S") {
|
||||
$record->latitude = "-" . $record->latitude;
|
||||
}
|
||||
if ($keys["Longitude Reference"] == "W") {
|
||||
if (substr(strtoupper($keys["Longitude Reference"]), 0, 1) == "W") {
|
||||
$record->longitude = "-" . $record->longitude;
|
||||
}
|
||||
$record->save();
|
||||
|
@ -19,48 +19,130 @@
|
||||
*/
|
||||
class exif_gps_block_Core {
|
||||
static function get_site_list() {
|
||||
return array("exif_gps_map" => t("EXIF GPS Map"));
|
||||
return array("exif_gps_location" => t("EXIF GPS Location"),
|
||||
"exif_gps_maps" => t("EXIF GPS Maps"));
|
||||
}
|
||||
|
||||
static function get($block_id, $theme) {
|
||||
$block = "";
|
||||
|
||||
// Make sure the current page belongs to an item.
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch ($block_id) {
|
||||
case "exif_gps_map":
|
||||
// Check and see if the item has exif coordinates associated with it.
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $theme->item->id)->find();
|
||||
if ($record->loaded()) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-sidebar";
|
||||
$block->title = t("Location");
|
||||
$block->content = new View("exif_gps_sidebar.html");
|
||||
$block->content->latitude = $record->latitude;
|
||||
$block->content->longitude = $record->longitude;
|
||||
} elseif (module::is_active("tagsmap") && module::is_active("tag")) {
|
||||
// If there are no exif coordinates, check for tagsmap coordinates instead.
|
||||
$tagsItem = ORM::factory("tag")
|
||||
->join("items_tags", "tags.id", "items_tags.tag_id")
|
||||
->where("items_tags.item_id", "=", $theme->item->id)
|
||||
->find_all();
|
||||
if (count($tagsItem) > 0) {
|
||||
foreach ($tagsItem as $oneTag) {
|
||||
$tagsGPS = ORM::factory("tags_gps")->where("tag_id", "=", $oneTag->id)->find();
|
||||
if ($tagsGPS->loaded()) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-sidebar";
|
||||
$block->title = t("Location");
|
||||
$block->content = new View("exif_gps_sidebar.html");
|
||||
$block->content->latitude = $tagsGPS->latitude;
|
||||
$block->content->longitude = $tagsGPS->longitude;
|
||||
break;
|
||||
case "exif_gps_maps":
|
||||
// Display links to a map of the current album and
|
||||
// a map of the current user.
|
||||
if ($theme->item()) {
|
||||
$album_id = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
} else {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
$user_items_count = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $item->owner_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
|
||||
if (($album_items_count > 0) || ($user_items_count > 0)) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-maps";
|
||||
$block->title = t("Maps");
|
||||
$block->content = new View("exif_gps_maps_sidebar.html");
|
||||
$block->content->album_id = $album_id;
|
||||
$block->content->user_id = $item->owner_id;
|
||||
$block->content->user_name = $user_name;
|
||||
$block->content->album_items = $album_items_count;
|
||||
$block->content->user_items = $user_items_count;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "exif_gps_location":
|
||||
// Look for coordinates to display.
|
||||
$latitude = "";
|
||||
$longitude = "";
|
||||
if ($theme->item()) {
|
||||
// Check and see if the item has exif coordinates associated with it.
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $theme->item->id)->find();
|
||||
if ($record->loaded()) {
|
||||
$latitude = $record->latitude;
|
||||
$longitude = $record->longitude;
|
||||
} elseif (module::is_active("tagsmap") && module::is_active("tag")) {
|
||||
// If there are no exif coordinates, check for tagsmap coordinates instead.
|
||||
$tagsItem = ORM::factory("tag")
|
||||
->join("items_tags", "tags.id", "items_tags.tag_id")
|
||||
->where("items_tags.item_id", "=", $theme->item->id)
|
||||
->find_all();
|
||||
if (count($tagsItem) > 0) {
|
||||
foreach ($tagsItem as $oneTag) {
|
||||
$tagsGPS = ORM::factory("tags_gps")->where("tag_id", "=", $oneTag->id)->find();
|
||||
if ($tagsGPS->loaded()) {
|
||||
$latitude = $tagsGPS->latitude;
|
||||
$longitude = $tagsGPS->longitude;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ( ($theme->tag()) && (module::is_active("tagsmap") && module::is_active("tag")) ) {
|
||||
// If the current page belongs to a tag, check and see if the tag has GPS coordinates.
|
||||
$tagsGPS = ORM::factory("tags_gps")->where("tag_id", "=", $theme->tag()->id)->find();
|
||||
if ($tagsGPS->loaded()) {
|
||||
$latitude = $tagsGPS->latitude;
|
||||
$longitude = $tagsGPS->longitude;
|
||||
}
|
||||
}
|
||||
|
||||
// If coordinates were found, create the block.
|
||||
if ($latitude != "" && $longitude != "") {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-location";
|
||||
$block->title = t("Location");
|
||||
if (module::get_var("exif_gps", "sidebar_mapformat") == 1) {
|
||||
$block->content = new View("exif_gps_dynamic_sidebar.html");
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 0) $block->content->sidebar_map_type = "ROADMAP";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 1) $block->content->sidebar_map_type = "SATELLITE";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 2) $block->content->sidebar_map_type = "HYBRID";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 3) $block->content->sidebar_map_type = "TERRAIN";
|
||||
} else {
|
||||
$block->content = new View("exif_gps_static_sidebar.html");
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 0) $block->content->sidebar_map_type = "roadmap";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 1) $block->content->sidebar_map_type = "satellite";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 2) $block->content->sidebar_map_type = "hybrid";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 3) $block->content->sidebar_map_type = "terrain";
|
||||
}
|
||||
$block->content->latitude = $latitude;
|
||||
$block->content->longitude = $longitude;
|
||||
} elseif (($theme->item()) && ($theme->item->is_album() && (module::get_var("exif_gps", "sidebar_mapformat") == 1))) {
|
||||
// If coordinates were NOT found, and this is an album with a dynamic map, then map the contents of the album.
|
||||
$items = ORM::factory("item", $theme->item->id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants();
|
||||
if (count($items) > 0) {
|
||||
$block = new Block();
|
||||
$block->css_id = "g-exif-gps-location";
|
||||
$block->title = t("Location");
|
||||
$block->content = new View("exif_gps_dynamic2_sidebar.html");
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 0) $block->content->sidebar_map_type = "ROADMAP";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 1) $block->content->sidebar_map_type = "SATELLITE";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 2) $block->content->sidebar_map_type = "HYBRID";
|
||||
if (module::get_var("exif_gps", "sidebar_maptype") == 3) $block->content->sidebar_map_type = "TERRAIN";
|
||||
$block->content->items = $items;
|
||||
$block->content->google_map_key = module::get_var("exif_gps", "googlemap_api_key");
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -56,14 +56,15 @@ class exif_gps_event_Core {
|
||||
static function item_edit_form($item, $form) {
|
||||
// Allow users to set / edit the GPS coordinates associated with the current item.
|
||||
$record = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find();
|
||||
$gpsdata = $form->edit_item->group("gps_data")->label("GPS Data");
|
||||
if ($record->loaded()) {
|
||||
$form->edit_item->input("latitude")->label(t("Latitude"))
|
||||
$gpsdata->input("latitude")->label(t("Latitude"))
|
||||
->value($record->latitude);
|
||||
$form->edit_item->input("longitude")->label(t("Longitude"))
|
||||
$gpsdata->input("longitude")->label(t("Longitude"))
|
||||
->value($record->longitude);
|
||||
} else {
|
||||
$form->edit_item->input("latitude")->label(t("Latitude"));
|
||||
$form->edit_item->input("longitude")->label(t("Longitude"));
|
||||
$gpsdata->input("latitude")->label(t("Latitude"));
|
||||
$gpsdata->input("longitude")->label(t("Longitude"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -72,7 +73,7 @@ class exif_gps_event_Core {
|
||||
|
||||
// Require a set of coordinates (both latitude and longitude).
|
||||
// If one or both fields are blank, completely delete any coordinates associated with this item.
|
||||
if (($form->edit_item->latitude->value == "") || ($form->edit_item->longitude->value == "")) {
|
||||
if (($form->edit_item->gps_data->latitude->value == "") || ($form->edit_item->gps_data->longitude->value == "")) {
|
||||
db::build()
|
||||
->delete("exif_coordinates")
|
||||
->where("item_id", "=", $item->id)
|
||||
@ -82,9 +83,138 @@ class exif_gps_event_Core {
|
||||
if (!$record->loaded()) {
|
||||
$record->item_id = $item->id;
|
||||
}
|
||||
$record->latitude = $form->edit_item->latitude->value;
|
||||
$record->longitude = $form->edit_item->longitude->value;
|
||||
$record->latitude = $form->edit_item->gps_data->latitude->value;
|
||||
$record->longitude = $form->edit_item->gps_data->longitude->value;
|
||||
$record->save();
|
||||
}
|
||||
}
|
||||
|
||||
static function admin_menu($menu, $theme) {
|
||||
// Add a link to the EXIF_GPS admin page to the Settings menu.
|
||||
$menu->get("settings_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("exif_gps")
|
||||
->label(t("EXIF_GPS Settings"))
|
||||
->url(url::site("admin/exif_gps")));
|
||||
}
|
||||
|
||||
static function photo_menu($menu, $theme) {
|
||||
$album_id = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
} else {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
$user_items_count = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $item->owner_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
|
||||
if (($album_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_album") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_album")
|
||||
->label(t("Map this album"))
|
||||
->url(url::site("exif_gps/map/album/" . $album_id))
|
||||
->css_id("g-exif-gps-album-link"));
|
||||
}
|
||||
if (($user_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_user") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_user")
|
||||
->label(t("Map ") . $user_name . t("'s photos"))
|
||||
->url(url::site("exif_gps/map/user/" . $item->owner_id))
|
||||
->css_id("g-exif-gps-user-link"));
|
||||
}
|
||||
}
|
||||
|
||||
static function movie_menu($menu, $theme) {
|
||||
$album_id = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
} else {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
$user_items_count = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $item->owner_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
|
||||
if (($album_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_album") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_album")
|
||||
->label(t("Map this album"))
|
||||
->url(url::site("exif_gps/map/album/" . $album_id))
|
||||
->css_id("g-exif-gps-album-link"));
|
||||
}
|
||||
if (($user_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_user") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_user")
|
||||
->label(t("Map ") . $user_name . t("'s photos"))
|
||||
->url(url::site("exif_gps/map/user/" . $item->owner_id))
|
||||
->css_id("g-exif-gps-user-link"));
|
||||
}
|
||||
}
|
||||
|
||||
static function album_menu($menu, $theme) {
|
||||
$album_id = "";
|
||||
$item = $theme->item;
|
||||
if ($item->is_album()) {
|
||||
$album_id = $item->id;
|
||||
} else {
|
||||
$album_id = $item->parent_id;
|
||||
}
|
||||
$curr_user = ORM::factory("user")->where("id", "=", $item->owner_id)->find_all();
|
||||
$user_name = $curr_user[0]->full_name;
|
||||
|
||||
// Make sure there are actually map-able items to display.
|
||||
$album_items_count = ORM::factory("item", $album_id)
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->descendants_count();
|
||||
$user_items_count = ORM::factory("item")
|
||||
->join("exif_coordinates", "items.id", "exif_coordinates.item_id")
|
||||
->where("items.owner_id", "=", $item->owner_id)
|
||||
->viewable()
|
||||
->order_by("exif_coordinates.latitude", "ASC")
|
||||
->count_all();
|
||||
|
||||
if (($album_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_album") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_album")
|
||||
->label(t("Map this album"))
|
||||
->url(url::site("exif_gps/map/album/" . $album_id))
|
||||
->css_id("g-exif-gps-album-link"));
|
||||
}
|
||||
if (($user_items_count > 0) && (module::get_var("exif_gps", "toolbar_map_user") == true)) {
|
||||
$menu->append(Menu::factory("link")
|
||||
->id("exif_gps_user")
|
||||
->label(t("Map ") . $user_name . t("'s photos"))
|
||||
->url(url::site("exif_gps/map/user/" . $item->owner_id))
|
||||
->css_id("g-exif-gps-user-link"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,35 @@ class exif_gps_installer {
|
||||
KEY(`item_id`, `id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
module::set_version("exif_gps", 1);
|
||||
// If tagsmap is installed, copy the API key over.
|
||||
if (module::is_active("tagsmap")) {
|
||||
module::set_var("exif_gps", "googlemap_api_key", module::get_var("tagsmap", "googlemap_api_key"));
|
||||
}
|
||||
|
||||
// Set some default values.
|
||||
module::set_var("exif_gps", "sidebar_zoom", "14");
|
||||
module::set_var("exif_gps", "sidebar_mapformat", "1");
|
||||
module::set_var("exif_gps", "sidebar_maptype", "1");
|
||||
module::set_var("exif_gps", "largemap_maptype", "2");
|
||||
|
||||
// Set the module version number.
|
||||
module::set_version("exif_gps", 2);
|
||||
}
|
||||
|
||||
static function upgrade($version) {
|
||||
if ($version == 1) {
|
||||
// If tagsmap is installed, copy the API key over.
|
||||
if (module::is_active("tagsmap")) {
|
||||
module::set_var("exif_gps", "googlemap_api_key", module::get_var("tagsmap", "googlemap_api_key"));
|
||||
}
|
||||
|
||||
// Set some default values.
|
||||
module::set_var("exif_gps", "sidebar_zoom", "14");
|
||||
module::set_var("exif_gps", "sidebar_mapformat", "1");
|
||||
module::set_var("exif_gps", "sidebar_maptype", "1");
|
||||
module::set_var("exif_gps", "largemap_maptype", "2");
|
||||
module::set_version("exif_gps", 2);
|
||||
}
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
|
24
modules/exif_gps/helpers/exif_gps_theme.php
Normal file
24
modules/exif_gps/helpers/exif_gps_theme.php
Normal file
@ -0,0 +1,24 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2010 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class exif_gps_theme_Core {
|
||||
static function head($theme) {
|
||||
$theme->css("exif_gps_menu.css");
|
||||
}
|
||||
}
|
BIN
modules/exif_gps/images/ico-view-exif_gps_album.png
Normal file
BIN
modules/exif_gps/images/ico-view-exif_gps_album.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
BIN
modules/exif_gps/images/ico-view-exif_gps_user.png
Normal file
BIN
modules/exif_gps/images/ico-view-exif_gps_user.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.8 KiB |
@ -1,3 +1,3 @@
|
||||
name = "Exif GPS Data"
|
||||
description = "Extract Exif GPS data from photos."
|
||||
version = 1
|
||||
version = 2
|
||||
|
7
modules/exif_gps/views/admin_exif_gps.html.php
Normal file
7
modules/exif_gps/views/admin_exif_gps.html.php
Normal file
@ -0,0 +1,7 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-exif-gps-admin">
|
||||
<h2> <?= t("EXIF GPS Settings") ?> </h2>
|
||||
<br /><div><?=t("You may sign up for a Google Maps API key at"); ?> <a href="http://code.google.com/apis/maps/signup.html" target="_new">http://code.google.com/apis/maps/signup.html</a>.<br /></div>
|
||||
<?= $exifgps_form ?>
|
||||
<br /><br /><div><strong><?=t("Default Zoom Level:"); ?></strong> <?=t("This value represents how far zoomed in or out the map will start out at. A value of 0 (the coarsest) will zoom the map all of the way out, while higher numbers will zoom the map further in. Depending on the map type, the highest zoom value you can use will be around 19-23."); ?></div>
|
||||
</div>
|
59
modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php
Normal file
59
modules/exif_gps/views/exif_gps_dynamic2_sidebar.html.php
Normal file
@ -0,0 +1,59 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?= module::get_var("exif_gps", "googlemap_api_key"); ?>"></script>
|
||||
<script type="text/javascript">
|
||||
google.load("maps", "3",{"other_params":"sensor=false"});
|
||||
var google_zoom_hack = false;
|
||||
|
||||
function initialize() {
|
||||
var latlng = new google.maps.LatLng(0,0);
|
||||
var myOptions = {
|
||||
zoom: 1,
|
||||
center: latlng,
|
||||
mapTypeId: google.maps.MapTypeId.<?=$sidebar_map_type; ?>
|
||||
};
|
||||
var map = new google.maps.Map(document.getElementById("sidebar_map_canvas"), myOptions);
|
||||
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
|
||||
<? $counter = 1; ?>
|
||||
<? foreach ($items as $item) { ?>
|
||||
<? $item_coordinates = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find(); ?>
|
||||
glatlngbounds.extend(new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>));
|
||||
<? if (!isset($currLat)) { ?>
|
||||
<? $currLat = $item_coordinates->latitude; ?>
|
||||
<? $currLong = $item_coordinates->longitude; ?>
|
||||
var marker<?=$counter; ?> = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
|
||||
map: map
|
||||
});
|
||||
<? } elseif (($currLat != $item_coordinates->latitude) && ($currLong != $item_coordinates->longitude)) { ?>
|
||||
<? $counter++; ?>
|
||||
<? $currLat = $item_coordinates->latitude; ?>
|
||||
<? $currLong = $item_coordinates->longitude; ?>
|
||||
var marker<?=$counter; ?> = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
|
||||
map: map
|
||||
});
|
||||
<? } else { ?>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
<? if (module::get_var("exif_gps", "googlemap_max_autozoom") != "") : ?>
|
||||
// If there is a maximum auto-zoom value, then set up an event to check the zoom
|
||||
// level the first time it is changed, and adjust it if necessary.
|
||||
// (if we call map.getZoom right after .fitBounds, getZoom will return the initial
|
||||
// zoom level, not the auto zoom level, this way we get the auto zoomed value).
|
||||
google.maps.event.addListener(map, 'zoom_changed', function() {
|
||||
if (google_zoom_hack) {
|
||||
if (map.getZoom() > 18) map.setZoom(18);
|
||||
google_zoom_hack = false;
|
||||
}
|
||||
});
|
||||
<? endif ?>
|
||||
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
}
|
||||
|
||||
google.setOnLoadCallback(initialize);
|
||||
|
||||
</script>
|
||||
|
||||
<div id="sidebar_map_canvas" style="width:205px; height:214px"></div>
|
22
modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php
Normal file
22
modules/exif_gps/views/exif_gps_dynamic_sidebar.html.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?= module::get_var("exif_gps", "googlemap_api_key"); ?>"></script>
|
||||
<script type="text/javascript">
|
||||
google.load("maps", "3",{"other_params":"sensor=false"});
|
||||
function initialize() {
|
||||
var latlng = new google.maps.LatLng(<?=$latitude; ?>,<?=$longitude; ?>);
|
||||
var myOptions = {
|
||||
zoom: <?= module::get_var("exif_gps", "sidebar_zoom"); ?>,
|
||||
center: latlng,
|
||||
mapTypeId: google.maps.MapTypeId.<?=$sidebar_map_type ?>
|
||||
};
|
||||
var map = new google.maps.Map(document.getElementById("sidebar_map_canvas"), myOptions);
|
||||
var marker = new google.maps.Marker({
|
||||
position: latlng,
|
||||
map: map
|
||||
});
|
||||
}
|
||||
|
||||
google.setOnLoadCallback(initialize);
|
||||
|
||||
</script>
|
||||
<div id="sidebar_map_canvas" style="width:205px; height:214px"></div>
|
96
modules/exif_gps/views/exif_gps_map.html.php
Normal file
96
modules/exif_gps/views/exif_gps_map.html.php
Normal file
@ -0,0 +1,96 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<script type="text/javascript" src="http://www.google.com/jsapi?key=<?= module::get_var("exif_gps", "googlemap_api_key"); ?>"></script>
|
||||
<script type="text/javascript">
|
||||
google.load("maps", "3",{"other_params":"sensor=false"});
|
||||
var google_zoom_hack = false;
|
||||
|
||||
function initialize() {
|
||||
var latlng = new google.maps.LatLng(0,0);
|
||||
var myOptions = {
|
||||
zoom: 1,
|
||||
center: latlng,
|
||||
mapTypeId: google.maps.MapTypeId.<?=$map_type; ?>
|
||||
};
|
||||
var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
|
||||
var glatlngbounds = new google.maps.LatLngBounds( ); // This is so we can auto center the map.
|
||||
<? $counter = 1; ?>
|
||||
<? foreach ($items as $item) { ?>
|
||||
<? $item_coordinates = ORM::factory("exif_coordinate")->where("item_id", "=", $item->id)->find(); ?>
|
||||
glatlngbounds.extend(new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>));
|
||||
<? if (!isset($currLat)) { ?>
|
||||
<? $currLat = $item_coordinates->latitude; ?>
|
||||
<? $currLong = $item_coordinates->longitude; ?>
|
||||
var marker<?=$counter; ?> = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
|
||||
map: map
|
||||
});
|
||||
<? $windowContent = "<div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
|
||||
$item->url() . "\\\">" .
|
||||
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
|
||||
"</a></div>"; ?>
|
||||
<? } elseif (($currLat != $item_coordinates->latitude) && ($currLong != $item_coordinates->longitude)) { ?>
|
||||
var infowindow<?=$counter; ?> = new google.maps.InfoWindow({
|
||||
content: "<?=$windowContent; ?>",
|
||||
size: new google.maps.Size(50,50)
|
||||
});
|
||||
google.maps.event.addListener(marker<?=$counter; ?>, 'click', function() {
|
||||
infowindow<?=$counter; ?>.open(map,marker<?=$counter; ?>);
|
||||
});
|
||||
<? $counter++; ?>
|
||||
<? $currLat = $item_coordinates->latitude; ?>
|
||||
<? $currLong = $item_coordinates->longitude; ?>
|
||||
var marker<?=$counter; ?> = new google.maps.Marker({
|
||||
position: new google.maps.LatLng(<?=$item_coordinates->latitude; ?>,<?=$item_coordinates->longitude; ?>),
|
||||
map: map
|
||||
});
|
||||
<? $windowContent = "<div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
|
||||
$item->url() . "\\\">" .
|
||||
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
|
||||
"</a></div>"; ?>
|
||||
<? } else { ?>
|
||||
<? $windowContent = $windowContent . " <div class=\\\"g-exif-gps-thumb\\\"><a href=\\\"" .
|
||||
$item->url() . "\\\">" .
|
||||
str_replace("\"", "\\\"", $item->thumb_img(array("class" => "g-exif-gps-thumbnail"))) .
|
||||
"</a></div>"; ?>
|
||||
<? } ?>
|
||||
<? } ?>
|
||||
var infowindow<?=$counter; ?> = new google.maps.InfoWindow({
|
||||
content: "<?=$windowContent; ?>",
|
||||
size: new google.maps.Size(50,50)
|
||||
});
|
||||
google.maps.event.addListener(marker<?=$counter; ?>, 'click', function() {
|
||||
infowindow<?=$counter; ?>.open(map,marker<?=$counter; ?>);
|
||||
});
|
||||
|
||||
<? if (module::get_var("exif_gps", "googlemap_max_autozoom") != "") : ?>
|
||||
// If there is a maximum auto-zoom value, then set up an event to check the zoom
|
||||
// level the first time it is changed, and adjust it if necessary.
|
||||
// (if we call map.getZoom right after .fitBounds, getZoom will return the initial
|
||||
// zoom level, not the auto zoom level, this way we get the auto zoomed value).
|
||||
google.maps.event.addListener(map, 'zoom_changed', function() {
|
||||
if (google_zoom_hack) {
|
||||
if (map.getZoom() > 18) map.setZoom(18);
|
||||
google_zoom_hack = false;
|
||||
}
|
||||
});
|
||||
<? endif ?>
|
||||
|
||||
google_zoom_hack = true;
|
||||
map.fitBounds(glatlngbounds);
|
||||
}
|
||||
|
||||
google.setOnLoadCallback(initialize);
|
||||
</script>
|
||||
|
||||
<div id="g-exif-map-header">
|
||||
<div id="g-exif-map-header-buttons">
|
||||
<?= $theme->dynamic_top() ?>
|
||||
</div>
|
||||
<h1><?= html::clean($title) ?></h1>
|
||||
</div>
|
||||
<br />
|
||||
<div id="map_canvas" style="width:600px; height:480px;"></div>
|
||||
<? if ($return_url != ""): ?>
|
||||
<br /><a href="<?=$return_url; ?>"><?=t("Return to album"); ?></a>
|
||||
<? endif ?>
|
||||
<?= $theme->dynamic_bottom() ?>
|
9
modules/exif_gps/views/exif_gps_maps_sidebar.html.php
Normal file
9
modules/exif_gps/views/exif_gps_maps_sidebar.html.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<ul>
|
||||
<? if ($album_items > 0): ?>
|
||||
<li><a href="<?=url::site("exif_gps/map/album/" . $album_id) ?>"><?=t("Map this album"); ?></a></li>
|
||||
<? endif ?>
|
||||
<? if ($user_items > 0): ?>
|
||||
<li><a href="<?=url::site("exif_gps/map/user/" . $user_id) ?>"><?=t("Map"); ?> <?=$user_name; ?><?=t("'s photos"); ?></a></li>
|
||||
<? endif ?>
|
||||
</ul>
|
@ -1,3 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<img src="http://maps.google.com/maps/api/staticmap?center=<?=$latitude; ?>,<?=$longitude; ?>&zoom=14&size=205x214&maptype=roadmap&markers=color:red|color:red|<?=$latitude; ?>,<?=$longitude; ?>&sensor=false">
|
||||
|
2
modules/exif_gps/views/exif_gps_static_sidebar.html.php
Normal file
2
modules/exif_gps/views/exif_gps_static_sidebar.html.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<img src="http://maps.google.com/maps/api/staticmap?center=<?=$latitude; ?>,<?=$longitude; ?>&zoom=<?= module::get_var("exif_gps", "sidebar_zoom"); ?>&size=205x214&maptype=<?=$sidebar_map_type ?>&markers=color:red|color:red|<?=$latitude; ?>,<?=$longitude; ?>&sensor=false">
|
@ -0,0 +1,50 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-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_Favourites_Configure_Controller extends Controller
|
||||
{
|
||||
/**
|
||||
* the index page of the user homes admin
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$form = favourites_configuration::get_configure_form();
|
||||
if (request::method() == "post") {
|
||||
access::verify_csrf();
|
||||
|
||||
if ($form->validate()) {
|
||||
|
||||
favourites_configuration::extractForm($form);
|
||||
message::success(t("Favourites Module Configured!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
favourites_configuration::populateForm($form);
|
||||
}
|
||||
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_favourites_configure.html");
|
||||
|
||||
$view->content->form = $form;
|
||||
|
||||
print $view;
|
||||
}
|
||||
}
|
206
modules/favourites/controllers/favourites.php
Normal file
206
modules/favourites/controllers/favourites.php
Normal file
@ -0,0 +1,206 @@
|
||||
<?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 Favourites_Controller extends Controller {
|
||||
public function index() {
|
||||
|
||||
if (favourites_configuration::isUsersOnly() && identity::active_user()->name =="guest"){
|
||||
//login required.
|
||||
url::redirect("login/html");
|
||||
return;
|
||||
}
|
||||
|
||||
$album = Favourites::getOrCreate()->get_as_album();
|
||||
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
$input = Input::instance();
|
||||
$show = $input->get("show");
|
||||
|
||||
if ($show) {
|
||||
$child = ORM::factory("item", $show);
|
||||
$index = $album->get_position($child);
|
||||
if ($index) {
|
||||
$page = ceil($index / $page_size);
|
||||
if ($page == 1) {
|
||||
//url::redirect("favourites");
|
||||
} else {
|
||||
//url::redirect("favourites?page=$page");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$page = $input->get("page", "1");
|
||||
$children_count = $album->viewable()->children_count();
|
||||
$offset = ($page - 1) * $page_size;
|
||||
$max_pages = max(ceil($children_count / $page_size), 1);
|
||||
|
||||
|
||||
// Make sure that the page references a valid offset
|
||||
if ($page < 1) {
|
||||
//url::redirect($album->abs_url());
|
||||
} else if ($page > $max_pages) {
|
||||
//url::redirect($album->abs_url("page=$max_pages"));
|
||||
}
|
||||
|
||||
|
||||
|
||||
$template = new Theme_View("page.html", "collection", "favourites");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("page_title", null);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->set_global("children", $album->viewable()->children($page_size, $offset));
|
||||
$template->set_global("children_count", $children_count);
|
||||
$template->content = new View("dynamic.html");
|
||||
|
||||
print $template;
|
||||
}
|
||||
|
||||
public function view(){
|
||||
if (favourites_configuration::isUsersOnly() && identity::active_user()->name =="guest"){
|
||||
//login required.
|
||||
Session::instance()->set("continue_url", url::current(true));
|
||||
$template = new Theme_View("page.html", "collection", "album");
|
||||
$template->content = new View("login_required.html");
|
||||
$template->content->login_form = new View("login_ajax.html");
|
||||
$template->content->login_form->form = auth::get_login_form("login/auth_html");
|
||||
print $template;
|
||||
return;
|
||||
}
|
||||
|
||||
// extract details from url
|
||||
$favourites = Favourites::getOrCreate();
|
||||
$favourites->clear();
|
||||
$array = func_get_args();
|
||||
foreach($array as $i=>$item){
|
||||
$favourites->toggle($item);
|
||||
}
|
||||
url::redirect("favourites");
|
||||
}
|
||||
|
||||
private function getSaveForm(){
|
||||
|
||||
$form = new Forge("favourites/save_favourites", "", "post", array("id" => "gAddToBasketForm"));
|
||||
$group = $form->group("save")->label(t("Save Favourites"));
|
||||
$group->hidden("id");
|
||||
$group->input("fullname")->label(t("Name"))->id("gname")
|
||||
->error_messages("required", t("You must provide your name"))
|
||||
->error_messages("not_logged_in", t("You must be logged in to send favourites."))
|
||||
->rules("required");
|
||||
$group->input("email")->label(t("Email Address"))->id("gemail")
|
||||
->error_messages("required", t("You must provide an email address"))
|
||||
->error_messages("valid_email", t("You must provide a valid email address"))
|
||||
->rules("valid_email")
|
||||
->rules("required");
|
||||
$group->textarea("details")->label(t("Comments"))->id("gdetails");
|
||||
|
||||
$group->submit("")->value(t("save"));
|
||||
return $form;
|
||||
}
|
||||
public function save(){
|
||||
$view = new View("save_dialog.html");
|
||||
|
||||
// get the basket to add to
|
||||
$form = self::getSaveForm();
|
||||
$view->form = $form;
|
||||
|
||||
print $view;
|
||||
|
||||
}
|
||||
|
||||
public function save_favourites($id){
|
||||
|
||||
access::verify_csrf();
|
||||
|
||||
$form = self::getSaveForm();
|
||||
$valid = $form->validate();
|
||||
$name = $form->save->fullname->value;
|
||||
$email_address = $form->save->email->value;
|
||||
$comments = $form->save->details->value;
|
||||
|
||||
|
||||
if (!isset($email_address ) || strlen($email_address) == 0) {
|
||||
$valid=false;
|
||||
$form->save->email->add_error("required", 1);
|
||||
}
|
||||
|
||||
if (!isset($name ) || strlen($name) == 0) {
|
||||
$valid=false;
|
||||
$form->save->fullname->add_error("required", 1);
|
||||
}
|
||||
|
||||
if (favourites_configuration::isUsersOnly() && identity::active_user()->name =="guest"){
|
||||
$valid=false;
|
||||
$form->save->fullname->add_error("not_logged_in", 1);
|
||||
}
|
||||
|
||||
if ($valid){
|
||||
|
||||
$favourites = Favourites::getOrCreate();
|
||||
|
||||
$from = "From: ".favourites_configuration::getFromEmailAddress();
|
||||
|
||||
if (favourites_configuration::isEmailAdmin())
|
||||
{
|
||||
$admin_email = $name." has chosen following photo as his or her favourites.\n";
|
||||
|
||||
// create the order items
|
||||
$items = ORM::factory("item")->where("id","in", $favourites->contents)->find_all();
|
||||
foreach ($items->contents as $id=>$item){
|
||||
$admin_email = $admin_email."
|
||||
".$item->title." - ".$item->url()."";
|
||||
}
|
||||
$admin_email = $admin_email."\n you can view this favourite list at \n".$favourites->getUrl()
|
||||
."\n\n He or she has included the additional comments. \n".$comments
|
||||
."\n You can e-mail him or her with the following e-mail address ".$email_address;
|
||||
|
||||
mail(favourites_configuration::getEmailAddress(), $name."'s favourites.", $admin_email, $from);
|
||||
}
|
||||
|
||||
$email = favourites_configuration::replaceStrings(
|
||||
favourites_configuration::getEmailTemplate(),
|
||||
Array(
|
||||
"name"=>$name,
|
||||
"comments"=>$comments,
|
||||
"url"=>$favourites->getUrl(),
|
||||
"owner"=>favourites_configuration::getOwner()));
|
||||
|
||||
mail($email_address,$name."'s Favourites",$email, $from);
|
||||
|
||||
print json_encode(array("result" => "success","location" => url::site("favourites")));
|
||||
return;
|
||||
}
|
||||
print json_encode(array("result" => "error", "form" => (string) $form));
|
||||
}
|
||||
|
||||
public function toggle_favourites($id){
|
||||
$favourites = Favourites::getOrCreate();
|
||||
$infavour = $favourites ->toggle($id);
|
||||
$title = $infavour?t("Remove from favourites"):t("Add to favourites");
|
||||
print json_encode(array("result" => "success",
|
||||
"favourite" => $infavour,
|
||||
"hasfavourites" => $favourites->hasFavourites(),
|
||||
"title" => (string)$title));
|
||||
}
|
||||
|
||||
public function clear_favourites(){
|
||||
Favourites::getOrCreate()->clear();
|
||||
}
|
||||
}
|
15
modules/favourites/css/favourites.css
Normal file
15
modules/favourites/css/favourites.css
Normal file
@ -0,0 +1,15 @@
|
||||
.icon-f{width:32px; height:32px; display:inline-block; background-image: url(../images/faves.png); position:absolute; top:20px; left:0; z-index:20}
|
||||
.icon-f:hover{background-position: 0 -64px ;}
|
||||
.icon-f.f-selected{background-position: 0 -32px ;}
|
||||
.icon-f.f-working{background-position: 0 -96px ;}
|
||||
#f-view-link {float:right;position:relative; width:50px; height:50px;}
|
||||
#f-view-link a{width:64px; height:64px; display:inline-block;background-position: -96px 0px;background-image: url(../images/faves.png); position:absolute; top:15px; right:0;}
|
||||
#f-view-link a:hover{background-position: -96px -64px ;}
|
||||
#f-save-link {float:right;position:relative; width:64px; height:64px;}
|
||||
#f-save-link a{width:64px; height:64px; display:inline-block;background-position: -32px 0px;background-image: url(../images/faves.png); position:absolute; top:15px; right:0;}
|
||||
#f-save-link a:hover{background-position: -32px -64px ;}
|
||||
.rtl .icon-f{right:0;left:auto;}
|
||||
.rtl #f-view-link{float:left;}
|
||||
.rtl #f-view-link a{left:0;right:auto;}
|
||||
.rtl #f-save-link{float:left;}
|
||||
.rtl #f-save-link a{left:0;right:auto;}
|
144
modules/favourites/helpers/favourites_configuration.php
Normal file
144
modules/favourites/helpers/favourites_configuration.php
Normal file
@ -0,0 +1,144 @@
|
||||
<?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 favourites_configuration
|
||||
{
|
||||
static function get_configure_form() {
|
||||
$form = new Forge("admin/favourites_configure", "", "post", array("id" => "g-configure-form"));
|
||||
|
||||
$group = $form->group("configure")->label(t("Configure Favourites"));
|
||||
$group->dropdown("select_allow")
|
||||
->label(t("Please choose what a user can select as a favourite"))
|
||||
->options(Array(1=>t("Items only"), 2=>"albums only", 3=>"Both"));
|
||||
$group->input("fromemail")->label(t("From Email address for site emails"))->id("g-from-email-address");
|
||||
$group->checkbox("email_admin")->label(t("Email site owner every saved favourites list"))->id("g-email-admin");
|
||||
$group->input("email")->label(t("Email address of Site Owner"))->id("g-owner-email-address");
|
||||
$group->input("owner")->label(t("Site Owners name"))->id("g-owner-name");
|
||||
$group->checkbox("users_only")->label(t("Only Registered users can create favourites"))->id("g-users-only");
|
||||
$group->textarea("email_template")->label(t("Email Template"))->id("g-email-template");
|
||||
$group->submit("")->value(t("Save"));
|
||||
return $form;
|
||||
}
|
||||
|
||||
static function populateForm($form){
|
||||
$form->configure->email->value(favourites_configuration::getEmailAddress());
|
||||
$form->configure->fromemail->value(favourites_configuration::getFromEmailAddress());
|
||||
$form->configure->email_admin->checked(favourites_configuration::isEmailAdmin());
|
||||
$form->configure->users_only->checked(favourites_configuration::isUsersOnly());
|
||||
$form->configure->owner->value(favourites_configuration::getOwner());
|
||||
$form->configure->email_template->value(favourites_configuration::getEmailTemplate());
|
||||
$form->configure->select_allow->selected(favourites_configuration::getSelectAllow());
|
||||
}
|
||||
|
||||
static function extractForm($form){
|
||||
$email = $form->configure->email->value;
|
||||
$emailfrom = $form->configure->fromemail->value;
|
||||
$owner = $form->configure->owner->value;
|
||||
$is_email_admin = $form->configure->email_admin->value;
|
||||
$is_users_only = $form->configure->users_only->value;
|
||||
$email_template = $form->configure->email_template->value;
|
||||
$select_from = $form->configure->select_allow->selected;
|
||||
favourites_configuration::setEmailAddress($email);
|
||||
favourites_configuration::setEmailAdmin($is_email_admin);
|
||||
favourites_configuration::setFromEmailAddress($emailfrom);
|
||||
favourites_configuration::setOwner($owner);
|
||||
favourites_configuration::setUsersOnly($is_users_only);
|
||||
favourites_configuration::setEmailTemplate($email_template);
|
||||
favourites_configuration::setSelectAllow($select_from);
|
||||
}
|
||||
|
||||
static function replaceStrings($string, $key_values) {
|
||||
// Replace x_y before replacing x.
|
||||
krsort($key_values, SORT_STRING);
|
||||
|
||||
$keys = array();
|
||||
$values = array();
|
||||
foreach ($key_values as $key => $value) {
|
||||
$keys[] = "%$key";
|
||||
$values[] = $value;
|
||||
}
|
||||
return str_replace($keys, $values, $string);
|
||||
}
|
||||
|
||||
static function getEmailAddress(){
|
||||
return module::get_var("favourites","email");
|
||||
}
|
||||
|
||||
static function setEmailAddress($email){
|
||||
module::set_var("favourites","email",$email);
|
||||
}
|
||||
|
||||
static function getOwner(){
|
||||
return module::get_var("favourites","owner");
|
||||
}
|
||||
|
||||
static function setOwner($owner){
|
||||
module::set_var("favourites","owner",$owner);
|
||||
}
|
||||
|
||||
static function getFromEmailAddress(){
|
||||
return module::get_var("favourites","from_email");
|
||||
}
|
||||
|
||||
static function setFromEmailAddress($fromemail){
|
||||
module::set_var("favourites","from_email",$fromemail);
|
||||
}
|
||||
|
||||
static function isEmailAdmin(){
|
||||
return module::get_var("favourites","email_admin");
|
||||
}
|
||||
|
||||
static function setEmailAdmin($email_admin){
|
||||
module::set_var("favourites","email_admin",$email_admin);
|
||||
}
|
||||
|
||||
static function isUsersOnly(){
|
||||
return module::get_var("favourites","users_only");
|
||||
}
|
||||
|
||||
static function setUsersOnly($users_only){
|
||||
module::set_var("favourites","users_only",$users_only);
|
||||
}
|
||||
|
||||
static function getSelectAllow(){
|
||||
return module::get_var("favourites","select_from",1);
|
||||
}
|
||||
|
||||
static function setSelectAllow($select_from){
|
||||
module::set_var("favourites","select_from",$select_from);
|
||||
}
|
||||
|
||||
static function getEmailTemplate(){
|
||||
return module::get_var("favourites","email_template");
|
||||
}
|
||||
|
||||
static function setEmailTemplate($email_template){
|
||||
module::set_var("favourites","email_template",$email_template);
|
||||
}
|
||||
|
||||
static function canSelectAlbums(){
|
||||
return self::getSelectAllow()!=1;
|
||||
}
|
||||
|
||||
static function canSelectItems(){
|
||||
return self::getSelectAllow()!=2;
|
||||
}
|
||||
|
||||
}
|
34
modules/favourites/helpers/favourites_event.php
Normal file
34
modules/favourites/helpers/favourites_event.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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 favourites_event_Core{
|
||||
/**
|
||||
* adds the shopping basket administration controls to the admin menu
|
||||
*/
|
||||
static function admin_menu($menu, $theme){
|
||||
|
||||
$menu->add_after("users_groups",
|
||||
Menu::factory("link")
|
||||
->id("configure_favourites")
|
||||
->label(t("Favourites"))
|
||||
->url(url::site("admin/favourites_configure")));
|
||||
}
|
||||
|
||||
}
|
37
modules/favourites/helpers/favourites_installer.php
Normal file
37
modules/favourites/helpers/favourites_installer.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
class favourites_installer
|
||||
{
|
||||
static function install(){
|
||||
module::set_version("favourites", 1);
|
||||
favourites_configuration::setEmailTemplate("Hi %name,
|
||||
|
||||
This is an automated e-mail. Your list of favourites and comments have been emailed to %owner. To view your list of favourites use the following link.
|
||||
|
||||
%url
|
||||
|
||||
Thanks");
|
||||
favourites_configuration::setFromEmailAddress("website@yourdomain.com");
|
||||
favourites_configuration::setEmailAddress("username@youremailaddress.com");
|
||||
favourites_configuration::setOwner("Your Name");
|
||||
}
|
||||
|
||||
}
|
70
modules/favourites/helpers/favourites_theme.php
Normal file
70
modules/favourites/helpers/favourites_theme.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class favourites_theme_Core {
|
||||
static function head($theme) {
|
||||
$theme->css("favourites.css");
|
||||
$theme->script("favourites.js");
|
||||
}
|
||||
|
||||
static function header_top($theme) {
|
||||
|
||||
if (favourites_configuration::isUsersOnly() && identity::active_user()->name =="guest"){
|
||||
return;
|
||||
}
|
||||
|
||||
if ($theme->page_subtype=="favourites"){
|
||||
$view = new View("save_favourites.html");
|
||||
$view->favourites = Favourites::getOrCreate();
|
||||
return $view->render();
|
||||
}
|
||||
else{
|
||||
$view = new View("view_favourites.html");
|
||||
$view->favourites = Favourites::getOrCreate();
|
||||
return $view->render();
|
||||
}
|
||||
}
|
||||
|
||||
static function photo_top($theme){
|
||||
if (!favourites_configuration::canSelectItems() ||
|
||||
(favourites_configuration::isUsersOnly() && identity::active_user()->name =="guest")){
|
||||
return;
|
||||
}
|
||||
|
||||
$view = new View("add_to_favourites.html");
|
||||
$view->item = $theme->item();
|
||||
$view->favourites = Favourites::getOrCreate();
|
||||
return $view->render();
|
||||
}
|
||||
|
||||
static function thumb_top($theme, $item){
|
||||
if (favourites_configuration::isUsersOnly() && identity::active_user()->name =="guest"){
|
||||
return;
|
||||
}
|
||||
|
||||
if (($item->type=="album" && favourites_configuration::canSelectAlbums()) ||
|
||||
($item->type!="album" && favourites_configuration::canSelectItems())){
|
||||
$view = new View("add_to_favourites.html");
|
||||
$view->item = $item;
|
||||
$view->favourites = Favourites::getOrCreate();
|
||||
return $view->render();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
BIN
modules/favourites/images/faves.png
Normal file
BIN
modules/favourites/images/faves.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
30
modules/favourites/js/favourites.js
Normal file
30
modules/favourites/js/favourites.js
Normal file
@ -0,0 +1,30 @@
|
||||
$(window).load(function() {
|
||||
var favlink = $("#f-view-link");
|
||||
|
||||
$(".icon-f").each(function(){
|
||||
var elem = $(this);
|
||||
var href = elem.attr("href");
|
||||
function clickFavourite(e){
|
||||
elem.addClass("f-working");
|
||||
$.getJSON(href,function (data){
|
||||
elem.removeClass("f-working");
|
||||
if (data.favourite){
|
||||
elem.addClass("f-selected");
|
||||
elem.attr("title",data.title);
|
||||
}
|
||||
else{
|
||||
elem.removeClass("f-selected");
|
||||
elem.attr("title",data.title);
|
||||
}
|
||||
if (data.hasfavourites){
|
||||
favlink.css('display','block');
|
||||
}else{
|
||||
favlink.css('display','none');
|
||||
}
|
||||
|
||||
});
|
||||
return false;
|
||||
}
|
||||
elem.bind("click",clickFavourite);
|
||||
});
|
||||
});
|
63
modules/favourites/libraries/Favourites.php
Normal file
63
modules/favourites/libraries/Favourites.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
|
||||
|
||||
class Favourites_Core {
|
||||
public $contents = array();
|
||||
|
||||
public function toggle($id){
|
||||
foreach ($this->contents as $i => $value) {
|
||||
if ($value==$id){
|
||||
unset($this->contents[$i]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
$this->contents[]=$id;
|
||||
return true;
|
||||
}
|
||||
|
||||
public function contains($id){
|
||||
foreach ($this->contents as $i => $value){
|
||||
if ($value==$id) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function hasFavourites(){
|
||||
return !empty($this->contents);
|
||||
}
|
||||
|
||||
public function get_as_album(){
|
||||
return Pseudo_album::create($this);
|
||||
}
|
||||
|
||||
public function clear(){
|
||||
$this->contents = array();
|
||||
}
|
||||
|
||||
public function getUrl(){
|
||||
|
||||
$toReturn = url::site("favourites/view","http");
|
||||
|
||||
foreach ($this->contents as $i => $value){
|
||||
$toReturn = $toReturn."/".$value;
|
||||
}
|
||||
return $toReturn;
|
||||
}
|
||||
|
||||
public static function get(){
|
||||
return Session::instance()->get("favourites");
|
||||
}
|
||||
|
||||
|
||||
public static function getOrCreate(){
|
||||
$session = Session::instance();
|
||||
|
||||
$favourites = $session->get("favourites");
|
||||
if (!$favourites)
|
||||
{
|
||||
$favourites = new Favourites();
|
||||
$session->set("favourites", $favourites);
|
||||
}
|
||||
return $favourites;
|
||||
}
|
||||
}
|
396
modules/favourites/libraries/Pseudo_album.php
Normal file
396
modules/favourites/libraries/Pseudo_album.php
Normal file
@ -0,0 +1,396 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
|
||||
|
||||
class Pseudo_album_Core {
|
||||
|
||||
public $favourites;
|
||||
|
||||
public function __construct($favourites) {
|
||||
|
||||
$this->favourites = $favourites;
|
||||
// Set reasonable defaults
|
||||
$this->created = time();
|
||||
$this->rand_key = ((float)mt_rand()) / (float)mt_getrandmax();
|
||||
$this->thumb_dirty = 1;
|
||||
$this->resize_dirty = 1;
|
||||
$this->sort_column = "created";
|
||||
$this->sort_order = "ASC";
|
||||
$this->owner_id = identity::active_user()->id;
|
||||
$this->parent_id = 1;
|
||||
|
||||
$this->id = 1;
|
||||
$this->type="album";
|
||||
$this->title=t("Favourites");
|
||||
$this->description=t("Currently selected favourites");
|
||||
}
|
||||
|
||||
public function parent(){
|
||||
return ORM::factory("item")->where("id","=",1)->find();
|
||||
}
|
||||
|
||||
public static function create($favourites)
|
||||
{
|
||||
return new Pseudo_album($favourites);
|
||||
}
|
||||
|
||||
public function loaded(){
|
||||
return true;
|
||||
}
|
||||
|
||||
public function children_count(){
|
||||
return count($this->favourites->contents);
|
||||
}
|
||||
|
||||
public function parents(){
|
||||
return ORM::factory("item")->where("id","=", 1)->find_all();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a set of restrictions to any following queries to restrict access only to items
|
||||
* viewable by the active user.
|
||||
* @chainable
|
||||
*/
|
||||
public function viewable() {
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this item an album?
|
||||
* @return true if it's an album
|
||||
*/
|
||||
public function is_album() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this item a photo?
|
||||
* @return true if it's a photo
|
||||
*/
|
||||
public function is_photo() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this item a movie?
|
||||
* @return true if it's a movie
|
||||
*/
|
||||
public function is_movie() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function delete($ignored_id=null) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify the path to the data file associated with this item. To actually associate it,
|
||||
* you still have to call save().
|
||||
* @chainable
|
||||
*/
|
||||
public function set_data_file($data_file) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the server-relative url to this item, eg:
|
||||
* /gallery3/index.php/BobsWedding?page=2
|
||||
* /gallery3/index.php/BobsWedding/Eating-Cake.jpg
|
||||
*
|
||||
* @param string $query the query string (eg "show=3")
|
||||
*/
|
||||
public function url($query=null) {
|
||||
$url = url::site("favourites");
|
||||
if ($query) {
|
||||
$url .= "?$query";
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the full url to this item, eg:
|
||||
* http://example.com/gallery3/index.php/BobsWedding?page=2
|
||||
* http://example.com/gallery3/index.php/BobsWedding/Eating-Cake.jpg
|
||||
*
|
||||
* @param string $query the query string (eg "show=3")
|
||||
*/
|
||||
public function abs_url($query=null) {
|
||||
$url = url::abs_site("favourites");
|
||||
if ($query) {
|
||||
$url .= "?$query";
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* album: /var/albums/album1/album2
|
||||
* photo: /var/albums/album1/album2/photo.jpg
|
||||
*/
|
||||
public function file_path() {
|
||||
return VARPATH . "albums/";
|
||||
}
|
||||
|
||||
/**
|
||||
* album: http://example.com/gallery3/var/resizes/album1/
|
||||
* photo: http://example.com/gallery3/var/albums/album1/photo.jpg
|
||||
*/
|
||||
public function file_url($full_uri=false) {
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* album: /var/resizes/album1/.thumb.jpg
|
||||
* photo: /var/albums/album1/photo.thumb.jpg
|
||||
*/
|
||||
public function thumb_path() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if there is a thumbnail for this item.
|
||||
*/
|
||||
public function has_thumb() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* album: http://example.com/gallery3/var/resizes/album1/.thumb.jpg
|
||||
* photo: http://example.com/gallery3/var/albums/album1/photo.thumb.jpg
|
||||
*/
|
||||
public function thumb_url($full_uri=false) {
|
||||
}
|
||||
|
||||
/**
|
||||
* album: /var/resizes/album1/.resize.jpg
|
||||
* photo: /var/albums/album1/photo.resize.jpg
|
||||
*/
|
||||
public function resize_path() {
|
||||
}
|
||||
|
||||
/**
|
||||
* album: http://example.com/gallery3/var/resizes/album1/.resize.jpg
|
||||
* photo: http://example.com/gallery3/var/albums/album1/photo.resize.jpg
|
||||
*/
|
||||
public function resize_url($full_uri=false) {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the relative path to this item's file. Note that the components of the path are
|
||||
* urlencoded so if you want to use this as a filesystem path, you need to call urldecode
|
||||
* on it.
|
||||
* @return string
|
||||
*/
|
||||
public function relative_path() {
|
||||
if (!$this->loaded()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset($this->relative_path_cache)) {
|
||||
$this->_build_relative_caches()->save();
|
||||
}
|
||||
return $this->relative_path_cache;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the relative url to this item's file.
|
||||
* @return string
|
||||
*/
|
||||
public function relative_url() {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle any business logic necessary to create or modify an item.
|
||||
* @see ORM::save()
|
||||
*
|
||||
* @return ORM Item_Model
|
||||
*/
|
||||
public function save() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Item_Model representing the cover for this album.
|
||||
* @return Item_Model or null if there's no cover
|
||||
*/
|
||||
public function album_cover() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the position of the given child id in this album. The resulting value is 1-indexed, so
|
||||
* the first child in the album is at position 1.
|
||||
*/
|
||||
public function get_position($child, $where=array()) {
|
||||
/*
|
||||
if ($this->sort_order == "DESC") {
|
||||
$comp = ">";
|
||||
} else {
|
||||
$comp = "<";
|
||||
}
|
||||
$db = db::build();
|
||||
|
||||
// If the comparison column has NULLs in it, we can't use comparators on it and will have to
|
||||
// deal with it the hard way.
|
||||
$count = $db->from("items")
|
||||
->where("parent_id", "=", $this->id)
|
||||
->where($this->sort_column, "IS", null)
|
||||
->merge_where($where)
|
||||
->count_records();
|
||||
|
||||
if (empty($count)) {
|
||||
// There are no NULLs in the sort column, so we can just use it directly.
|
||||
$sort_column = $this->sort_column;
|
||||
|
||||
$position = $db->from("items")
|
||||
->where("parent_id", "=", $this->id)
|
||||
->where($sort_column, $comp, $child->$sort_column)
|
||||
->merge_where($where)
|
||||
->count_records();
|
||||
|
||||
// We stopped short of our target value in the sort (notice that we're using a < comparator
|
||||
// above) because it's possible that we have duplicate values in the sort column. An
|
||||
// equality check would just arbitrarily pick one of those multiple possible equivalent
|
||||
// columns, which would mean that if you choose a sort order that has duplicates, it'd pick
|
||||
// any one of them as the child's "position".
|
||||
//
|
||||
// Fix this by doing a 2nd query where we iterate over the equivalent columns and add them to
|
||||
// our base value.
|
||||
foreach ($db
|
||||
->select("id")
|
||||
->from("items")
|
||||
->where("parent_id", "=", $this->id)
|
||||
->where($sort_column, "=", $child->$sort_column)
|
||||
->merge_where($where)
|
||||
->order_by(array("id" => "ASC"))
|
||||
->execute() as $row) {
|
||||
$position++;
|
||||
if ($row->id == $child->id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// There are NULLs in the sort column, so we can't use MySQL comparators. Fall back to
|
||||
// iterating over every child row to get to the current one. This can be wildly inefficient
|
||||
// for really large albums, but it should be a rare case that the user is sorting an album
|
||||
// with null values in the sort column.
|
||||
//
|
||||
// Reproduce the children() functionality here using Database directly to avoid loading the
|
||||
// whole ORM for each row.
|
||||
$order_by = array($this->sort_column => $this->sort_order);
|
||||
// Use id as a tie breaker
|
||||
if ($this->sort_column != "id") {
|
||||
$order_by["id"] = "ASC";
|
||||
}
|
||||
|
||||
$position = 0;
|
||||
foreach ($db->select("id")
|
||||
->from("items")
|
||||
->where("parent_id", "=", $this->id)
|
||||
->merge_where($where)
|
||||
->order_by($order_by)
|
||||
->execute() as $row) {
|
||||
$position++;
|
||||
if ($row->id == $child->id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $position;*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an <img> tag for the thumbnail.
|
||||
* @param array $extra_attrs Extra attributes to add to the img tag
|
||||
* @param int (optional) $max Maximum size of the thumbnail (default: null)
|
||||
* @param boolean (optional) $center_vertically Center vertically (default: false)
|
||||
* @return string
|
||||
*/
|
||||
public function thumb_img($extra_attrs=array(), $max=null, $center_vertically=false) {
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the largest width/height that fits inside the given maximum, while preserving the
|
||||
* aspect ratio.
|
||||
* @param int $max Maximum size of the largest dimension
|
||||
* @return array
|
||||
*/
|
||||
public function scale_dimensions($max) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an <img> tag for the resize.
|
||||
* @param array $extra_attrs Extra attributes to add to the img tag
|
||||
* @return string
|
||||
*/
|
||||
public function resize_img($extra_attrs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a flowplayer <script> tag for movies
|
||||
* @param array $extra_attrs
|
||||
* @return string
|
||||
*/
|
||||
public function movie_img($extra_attrs) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all of the children of this album. Unless you specify a specific sort order, the
|
||||
* results will be ordered by this album's sort order.
|
||||
*
|
||||
* @chainable
|
||||
* @param integer SQL limit
|
||||
* @param integer SQL offset
|
||||
* @param array additional where clauses
|
||||
* @param array order_by
|
||||
* @return array ORM
|
||||
*/
|
||||
function children($limit=null, $offset=null, $where=array(), $order_by=null) {
|
||||
if (empty($this->favourites->contents)){
|
||||
return null;
|
||||
}
|
||||
return ORM::factory("item")->where("id","in", $this->favourites->contents)->find_all();
|
||||
// get childresn
|
||||
/*
|
||||
if (empty($order_by)) {
|
||||
$order_by = array($this->sort_column => $this->sort_order);
|
||||
// Use id as a tie breaker
|
||||
if ($this->sort_column != "id") {
|
||||
$order_by["id"] = "ASC";
|
||||
}
|
||||
}
|
||||
return parent::children($limit, $offset, $where, $order_by);*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the children of this album, and all of it's sub-albums. Unless you specify a specific
|
||||
* sort order, the results will be ordered by this album's sort order. Note that this
|
||||
* album's sort order is imposed on all sub-albums, regardless of their sort order.
|
||||
*
|
||||
* @chainable
|
||||
* @param integer SQL limit
|
||||
* @param integer SQL offset
|
||||
* @param array additional where clauses
|
||||
* @return object ORM_Iterator
|
||||
*/
|
||||
function descendants($limit=null, $offset=null, $where=array(), $order_by=null) {
|
||||
if (empty($this->favourites->contents)){
|
||||
return null;
|
||||
}
|
||||
return ORM::factory("item")->where("id","in", $this->favourites->contents)->find_all();
|
||||
/*
|
||||
if (empty($order_by)) {
|
||||
$order_by = array($this->sort_column => $this->sort_order);
|
||||
// Use id as a tie breaker
|
||||
if ($this->sort_column != "id") {
|
||||
$order_by["id"] = "ASC";
|
||||
}
|
||||
}
|
||||
return parent::descendants($limit, $offset, $where, $order_by);*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify our rules here so that we have access to the instance of this model.
|
||||
*/
|
||||
public function validate(Validation $array=null) {
|
||||
}
|
||||
|
||||
}
|
3
modules/favourites/module.info
Normal file
3
modules/favourites/module.info
Normal file
@ -0,0 +1,3 @@
|
||||
name = "Favourites"
|
||||
description = "Allows users and guests to create favourite lists and then e-mail them to people."
|
||||
version = 1
|
13
modules/favourites/views/add_to_favourites.html.php
Normal file
13
modules/favourites/views/add_to_favourites.html.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div class="add_to_favourites">
|
||||
<a id="favourites_<?=$item->id?>" class="icon-f<?
|
||||
$favselected = false;
|
||||
if (isset($favourites))
|
||||
{
|
||||
if($favourites->contains($item->id)){
|
||||
?> f-selected<?
|
||||
$favselected = true;
|
||||
}
|
||||
}
|
||||
?>" href="<?= url::site("favourites/toggle_favourites/$item->id") ?>" title="<?=$favselected?t("Remove from favourites"):t("Add to favourites") ?>"></a>
|
||||
</div>
|
@ -0,0 +1,8 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-admin-configure">
|
||||
<h1> <?= t("Configure Favourites Module") ?> </h1>
|
||||
<p>
|
||||
<?= t("Use this page to configure the Favourites Module.") ?>
|
||||
</p>
|
||||
<?= $form ?>
|
||||
</div>
|
4
modules/favourites/views/login_required.html.php
Normal file
4
modules/favourites/views/login_required.html.php
Normal file
@ -0,0 +1,4 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-error"><h1><?= t("Please Login")?></h1>
|
||||
<p><?= t("Login details are required to view favourites.") ?></p>
|
||||
<?= $login_form ?></div>
|
11
modules/favourites/views/save_dialog.html.php
Normal file
11
modules/favourites/views/save_dialog.html.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.")
|
||||
?><div id="g-Save">Please enter the following details. <?
|
||||
|
||||
if (favourites_configuration::isEmailAdmin()){
|
||||
|
||||
?>An e-mail will be sent to both you and <?=favourites_configuration::getOwner()?> with a link to this list.<?
|
||||
}
|
||||
else{
|
||||
?>An e-mail will be sent to you with a link to this list.<?
|
||||
}
|
||||
?><div id="basketForm"><?= $form ?></div></div>
|
6
modules/favourites/views/save_favourites.html.php
Normal file
6
modules/favourites/views/save_favourites.html.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
|
||||
?><div id="f-save-link"<?
|
||||
if (!$favourites->hasFavourites()):
|
||||
?> style="display:none"<?
|
||||
endif;?>><a href="<?= url::site("favourites/save") ?>" title="<?= t("Save Favourites") ?>" class="g-dialog-link"></a></div><?
|
10
modules/favourites/views/view_favourites.html.php
Normal file
10
modules/favourites/views/view_favourites.html.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
|
||||
if ($theme->page_type != 'favourites'):
|
||||
|
||||
?><div id="f-view-link"<?
|
||||
if (!$favourites->hasFavourites()):
|
||||
?> style="display:none"<?
|
||||
endif;?>><a href="<?= url::site("favourites") ?>" title="<?= t("View Favourites") ?>"></a></div><?
|
||||
|
||||
endif;
|
19
modules/gwtorganise/.externalToolBuilders/New_Builder.launch
Normal file
19
modules/gwtorganise/.externalToolBuilders/New_Builder.launch
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.ant.AntBuilderLaunchConfigurationType">
|
||||
<booleanAttribute key="org.eclipse.ant.ui.ATTR_TARGETS_UPDATED" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.ant.ui.DEFAULT_VM_INSTALL" value="false"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/gwtorganise/build.xml"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.ant.ui.AntClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="gwtorganise"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${workspace_loc:/gwtorganise/build.xml}"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS" value="full,incremental,"/>
|
||||
<booleanAttribute key="org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED" value="true"/>
|
||||
<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/gwtorganise}"/>
|
||||
</launchConfiguration>
|
@ -30,6 +30,16 @@
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.ui.externaltools.ExternalToolBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
<dictionary>
|
||||
<key>LaunchConfigHandle</key>
|
||||
<value><project>/.externalToolBuilders/New_Builder.launch</value>
|
||||
</dictionary>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#Thu Feb 11 15:27:06 NZDT 2010
|
||||
#Fri Mar 26 11:43:34 NZDT 2010
|
||||
eclipse.preferences.version=1
|
||||
entryPointModules=
|
||||
filesCopiedToWebInfLib=gwt-servlet.jar
|
||||
|
21
modules/gwtorganise/build.xml
Normal file
21
modules/gwtorganise/build.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generate a java class with the current svn revision number -->
|
||||
<project>
|
||||
<echo>Generate build info class...</echo>
|
||||
<tstamp>
|
||||
<format property="TODAY" pattern="EEE, d-MMMM-yyyy HH:mm:ss z" locale="ENGLISH, GERMANY"/>
|
||||
</tstamp>
|
||||
<echo>Virtual PVT Cell Revision: ${svn.revision}</echo>
|
||||
<echo>Time stamp ${TODAY}</echo>
|
||||
<echo>Write build info to file ${basedir}\helpers\BuildInfo.java</echo>
|
||||
<!-- the source code of the java class -->
|
||||
<echo file="${basedir}\helpers\revision.php">
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
class revision_Core {
|
||||
static function getTimeStamp(){
|
||||
return "${TODAY}";
|
||||
}
|
||||
}
|
||||
|
||||
</echo>
|
||||
</project>
|
@ -73,13 +73,21 @@ class Json_Album_Controller extends Controller {
|
||||
access::verify_csrf();
|
||||
|
||||
$target_album = ORM::factory("item", $target_album_id);
|
||||
access::required("view", $target_album);
|
||||
access::required("add", $target_album);
|
||||
|
||||
$source_album = null;
|
||||
|
||||
$js = json_decode($_REQUEST["sourceids"]);
|
||||
|
||||
$i = 0;
|
||||
$source_album = null;
|
||||
foreach ($js as $source_id) {
|
||||
$source = ORM::factory("item", $source_id);
|
||||
if (empty($source_album)) { // get the source_album
|
||||
$source_album = $source->parent();
|
||||
}
|
||||
if (!$source->contains($target_album)) {
|
||||
access::required("edit", $source);
|
||||
item::move($source, $target_album);
|
||||
}
|
||||
$i++;
|
||||
@ -226,12 +234,7 @@ class Json_Album_Controller extends Controller {
|
||||
print json_encode(array("result" => "success"));
|
||||
}
|
||||
|
||||
public function rotate($id, $dir) {
|
||||
access::verify_csrf();
|
||||
$item = model_cache::get("item", $id);
|
||||
access::required("view", $item);
|
||||
access::required("edit", $item);
|
||||
|
||||
public function p_rotate($item, $dir){
|
||||
$degrees = 0;
|
||||
switch($dir) {
|
||||
case "ccw":
|
||||
@ -262,6 +265,63 @@ class Json_Album_Controller extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
public function delete_many($id) {
|
||||
|
||||
access::verify_csrf();
|
||||
|
||||
$js = json_decode($_REQUEST["sourceids"]);
|
||||
|
||||
$i = 0;
|
||||
$toreturn = array();
|
||||
foreach ($js as $item_id) {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
access::required("edit", $item);
|
||||
if ($item->is_album()) {
|
||||
$msg = t("Deleted album <b>%title</b>", array("title" => html::purify($item->title)));
|
||||
} else {
|
||||
$msg = t("Deleted photo <b>%title</b>", array("title" => html::purify($item->title)));
|
||||
}
|
||||
$parent = $item->parent();
|
||||
$item->delete();
|
||||
message::success($msg);
|
||||
}
|
||||
|
||||
print json_encode(array("result" => "success"));
|
||||
|
||||
}
|
||||
|
||||
public function rotate_many($dir) {
|
||||
access::verify_csrf();
|
||||
|
||||
$js = json_decode($_REQUEST["sourceids"]);
|
||||
|
||||
$i = 0;
|
||||
$toreturn = array();
|
||||
foreach ($js as $item_id) {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
access::required("edit", $item);
|
||||
$item = $this->p_rotate($item, $dir);
|
||||
$toreturn[$item_id] = self::child_json_encode($item);
|
||||
$i++;
|
||||
}
|
||||
|
||||
print json_encode($toreturn);
|
||||
}
|
||||
|
||||
|
||||
public function rotate($id, $dir) {
|
||||
access::verify_csrf();
|
||||
$item = model_cache::get("item", $id);
|
||||
access::required("view", $item);
|
||||
access::required("edit", $item);
|
||||
|
||||
$item = $this->p_rotate($item, $dir);
|
||||
|
||||
print json_encode(self::child_json_encode($item));
|
||||
}
|
||||
|
||||
|
9
modules/gwtorganise/helpers/revision.php
Normal file
9
modules/gwtorganise/helpers/revision.php
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
class revision_Core {
|
||||
static function getTimeStamp(){
|
||||
return "Fri, 16-April-2010 14:55:28 NZST";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,8 +9,8 @@
|
||||
<entry-point class='com.gloopics.g3viewer.client.G3Viewer'/><inherits
|
||||
name="com.allen_sauer.gwt.dnd.gwt-dnd" /><inherits name="com.google.gwt.gears.Gears" />
|
||||
|
||||
<replace-with class="com.gloopics.g3viewer.client.NoGears">
|
||||
<when-type-is class="com.gloopics.g3viewer.client.G3Viewer"/>
|
||||
<replace-with class="com.gloopics.g3viewer.client.UploadControlNoGears">
|
||||
<when-type-is class="com.gloopics.g3viewer.client.UploadControl"/>
|
||||
<when-property-is name="gears.installed" value="false"/>
|
||||
</replace-with>
|
||||
|
||||
@ -30,4 +30,9 @@
|
||||
</any>
|
||||
</replace-with>
|
||||
|
||||
<replace-with class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactoryNoGears">
|
||||
<when-type-is class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactory"/>
|
||||
<when-property-is name="gears.installed" value="false"/>
|
||||
</replace-with>
|
||||
|
||||
</module>
|
||||
|
@ -27,9 +27,11 @@ import com.google.gwt.user.client.ui.MenuBar;
|
||||
import com.google.gwt.user.client.ui.MenuItem;
|
||||
import com.google.gwt.user.client.ui.PopupPanel;
|
||||
import com.google.gwt.user.client.ui.TreeItem;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* encapsulates an album
|
||||
*
|
||||
* @author User
|
||||
*
|
||||
*/
|
||||
@ -39,7 +41,6 @@ public class Album extends TreeItem {
|
||||
|
||||
private String m_Title;
|
||||
|
||||
|
||||
private final G3Viewer m_Container;
|
||||
|
||||
private final View m_View;
|
||||
@ -60,42 +61,39 @@ public class Album extends TreeItem {
|
||||
|
||||
private final UploadControl m_UploadControl;
|
||||
|
||||
public Album(JSONObject jsonObject, G3Viewer a_Container)
|
||||
{
|
||||
public Album(JSONObject jsonObject, G3Viewer a_Container) {
|
||||
m_UploadControl = a_Container.getUploadControl();
|
||||
m_ID = Utils.extractId(jsonObject.get("id"));
|
||||
m_Title = ((JSONString)jsonObject.get("title")).stringValue();
|
||||
m_Sort = ((JSONString)jsonObject.get("sort")).stringValue();
|
||||
m_Title = ((JSONString) jsonObject.get("title")).stringValue();
|
||||
m_Sort = ((JSONString) jsonObject.get("sort")).stringValue();
|
||||
|
||||
m_Container = a_Container;
|
||||
m_View = a_Container.getView();
|
||||
m_DropController = new AlbumTreeDropController(this);
|
||||
m_DropController = new AlbumTreeDropController(this);
|
||||
m_Label = initComponents();
|
||||
|
||||
}
|
||||
|
||||
public Album(G3Viewer a_Container)
|
||||
{
|
||||
public Album(G3Viewer a_Container) {
|
||||
m_UploadControl = a_Container.getUploadControl();
|
||||
m_ID = 1;
|
||||
m_Title = "Root";
|
||||
m_Container = a_Container;
|
||||
m_View = a_Container.getView();
|
||||
m_Sort = "Unknown";
|
||||
m_DropController = new AlbumTreeDropController(this);
|
||||
m_DropController = new AlbumTreeDropController(this);
|
||||
m_Label = initComponents();
|
||||
refresh();
|
||||
}
|
||||
|
||||
public void updateValues(JSONValue a_Jso){
|
||||
public void updateValues(JSONValue a_Jso) {
|
||||
JSONObject jso = a_Jso.isObject();
|
||||
if (jso != null){
|
||||
m_Title = ((JSONString)jso.get("title")).stringValue();
|
||||
if (jso != null) {
|
||||
m_Title = ((JSONString) jso.get("title")).stringValue();
|
||||
String oldSort = m_Sort;
|
||||
m_Sort = ((JSONString)jso.get("sort")).stringValue();
|
||||
if (!oldSort.equals(m_Sort)){
|
||||
if (m_View.getCurrentAlbum() == this)
|
||||
{
|
||||
m_Sort = ((JSONString) jso.get("sort")).stringValue();
|
||||
if (!oldSort.equals(m_Sort)) {
|
||||
if (m_View.getCurrentAlbum() == this) {
|
||||
select();
|
||||
}
|
||||
}
|
||||
@ -103,7 +101,7 @@ public class Album extends TreeItem {
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh(){
|
||||
public void refresh() {
|
||||
m_Container.doJSONRequest(G3Viewer.VIEW_ITEM_URL + getId(),
|
||||
new HttpSuccessHandler() {
|
||||
|
||||
@ -111,12 +109,10 @@ public class Album extends TreeItem {
|
||||
public void success(JSONValue aValue) {
|
||||
updateValues(aValue);
|
||||
}
|
||||
},false,true);
|
||||
}, false, true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void showPopupMenu(Event event){
|
||||
public void showPopupMenu(Event event) {
|
||||
m_Label.addStyleName("popped");
|
||||
final PopupPanel popupPanel = new PopupPanel(true);
|
||||
popupPanel.setAnimationEnabled(true);
|
||||
@ -126,31 +122,25 @@ public class Album extends TreeItem {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
m_Container.doDialog("index.php/form/edit/albums/" + m_ID, new HttpDialogHandler() {
|
||||
@Override
|
||||
public void success(String aResult) {
|
||||
refresh();
|
||||
m_Container.doDialog("index.php/form/edit/albums/" + m_ID,
|
||||
new HttpDialogHandler() {
|
||||
@Override
|
||||
public void success(String aResult) {
|
||||
refresh();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
popupPanel.hide();
|
||||
|
||||
}
|
||||
});
|
||||
MenuItem uploadPhotos = new MenuItem("Upload Photos", true, new Command() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
uploadFiles();
|
||||
popupPanel.hide();
|
||||
|
||||
}
|
||||
});
|
||||
MenuItem addAlbum = new MenuItem("Add Album", true, new Command() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
m_Container.doDialog("index.php/form/add/albums/" + m_ID + "?type=album", new HttpDialogHandler() {
|
||||
m_Container.doDialog("index.php/form/add/albums/" + m_ID
|
||||
+ "?type=album", new HttpDialogHandler() {
|
||||
@Override
|
||||
public void success(String aResult) {
|
||||
expand();
|
||||
@ -163,33 +153,46 @@ public class Album extends TreeItem {
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem userPermissions = new MenuItem("User Permissions", true, new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
m_Container.doDialog("index.php/permissions/browse/" + m_ID , new HttpDialogHandler() {
|
||||
MenuItem userPermissions = new MenuItem("User Permissions", true,
|
||||
new Command() {
|
||||
@Override
|
||||
public void success(String aResult) {
|
||||
public void execute() {
|
||||
m_Container.doDialog("index.php/permissions/browse/"
|
||||
+ m_ID, new HttpDialogHandler() {
|
||||
@Override
|
||||
public void success(String aResult) {
|
||||
}
|
||||
});
|
||||
|
||||
popupPanel.hide();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
popupPanel.hide();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
popupPanel.setStyleName("popup");
|
||||
editItem.addStyleName("popup-item");
|
||||
addAlbum.addStyleName("popup-item");
|
||||
uploadPhotos.addStyleName("popup-item");
|
||||
userPermissions.addStyleName("popup-item");
|
||||
|
||||
if (m_Container.isUploadEnabled()) {
|
||||
MenuItem uploadPhotos = new MenuItem("Upload Photos", true,
|
||||
new Command() {
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
uploadFiles();
|
||||
popupPanel.hide();
|
||||
|
||||
}
|
||||
});
|
||||
uploadPhotos.addStyleName("popup-item");
|
||||
popupMenuBar.addItem(uploadPhotos);
|
||||
}
|
||||
|
||||
popupMenuBar.addItem(uploadPhotos);
|
||||
popupMenuBar.addItem(editItem);
|
||||
popupMenuBar.addItem(addAlbum);
|
||||
popupMenuBar.addItem(userPermissions);
|
||||
|
||||
|
||||
popupMenuBar.setVisible(true);
|
||||
popupPanel.add(popupMenuBar);
|
||||
|
||||
@ -208,62 +211,53 @@ public class Album extends TreeItem {
|
||||
popupPanel.show();
|
||||
}
|
||||
|
||||
private Label initComponents()
|
||||
{
|
||||
private Label initComponents() {
|
||||
Label toReturn = new Label(m_Title);
|
||||
toReturn.addStyleName("Tree-Album");
|
||||
setWidget(toReturn);
|
||||
m_Container.getDragController().registerDropController(m_DropController);
|
||||
m_Container.getDragController()
|
||||
.registerDropController(m_DropController);
|
||||
expand();
|
||||
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
public int getId()
|
||||
{
|
||||
public int getId() {
|
||||
return m_ID;
|
||||
}
|
||||
|
||||
/*
|
||||
* Adds the albums in the json response
|
||||
* TreeItem.
|
||||
* Adds the albums in the json response TreeItem.
|
||||
*/
|
||||
private void addAlbums(JSONValue jsonValue)
|
||||
{
|
||||
JSONArray jsonArray = (JSONArray)jsonValue;
|
||||
Set<Integer> allAlbums = new HashSet<Integer>(m_IDtoAlbum.keySet());
|
||||
for (int i = 0; i < jsonArray.size(); ++i)
|
||||
{
|
||||
JSONObject jso = (JSONObject)jsonArray.get(i);
|
||||
private void addAlbums(JSONValue jsonValue) {
|
||||
JSONArray jsonArray = (JSONArray) jsonValue;
|
||||
Set<Integer> allAlbums = new HashSet<Integer>(m_IDtoAlbum.keySet());
|
||||
for (int i = 0; i < jsonArray.size(); ++i) {
|
||||
JSONObject jso = (JSONObject) jsonArray.get(i);
|
||||
|
||||
int id = Utils.extractId(jso.get("id"));
|
||||
|
||||
int id = Utils.extractId(jso.get("id"));
|
||||
|
||||
if (m_IDtoAlbum.containsKey(id))
|
||||
{
|
||||
if (m_IDtoAlbum.containsKey(id)) {
|
||||
m_IDtoAlbum.get(id).updateValues(jso);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
Album album = new Album(jso, m_Container);
|
||||
m_IDtoAlbum.put(id, album);
|
||||
addItem(album);
|
||||
}
|
||||
allAlbums.remove(id);
|
||||
}
|
||||
for (Integer id : allAlbums){
|
||||
Album a = m_IDtoAlbum.remove(id);
|
||||
a.cleanup();
|
||||
}
|
||||
for (Integer id : allAlbums) {
|
||||
Album a = m_IDtoAlbum.remove(id);
|
||||
a.cleanup();
|
||||
|
||||
|
||||
removeItem(a);
|
||||
}
|
||||
removeItem(a);
|
||||
}
|
||||
}
|
||||
|
||||
public void cleanup()
|
||||
{
|
||||
m_Container.getDragController().unregisterDropController(m_DropController);
|
||||
for (int i = 0; i < getChildCount(); i++){
|
||||
public void cleanup() {
|
||||
m_Container.getDragController().unregisterDropController(
|
||||
m_DropController);
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
((Album) getChild(i)).cleanup();
|
||||
}
|
||||
}
|
||||
@ -271,50 +265,47 @@ public class Album extends TreeItem {
|
||||
/**
|
||||
* moves the given array of ids to this album
|
||||
*/
|
||||
public void moveTo(JSONArray a_Ids){
|
||||
public void moveTo(JSONArray a_Ids) {
|
||||
Loading.getInstance().loading("Moving Items..");
|
||||
|
||||
m_Container.doJSONRequest(G3Viewer.MOVE_TO_ALBUM_URL + getId() + "?sourceids=" + a_Ids.toString(),
|
||||
new HttpSuccessHandler() {
|
||||
m_Container.doJSONRequest(G3Viewer.MOVE_TO_ALBUM_URL + getId()
|
||||
+ "?sourceids=" + a_Ids.toString(), new HttpSuccessHandler() {
|
||||
|
||||
@Override
|
||||
public void success(JSONValue aValue) {
|
||||
expand();
|
||||
m_View.getCurrentAlbum().expand();
|
||||
m_View.getCurrentAlbum().select();
|
||||
}
|
||||
},true,true);
|
||||
@Override
|
||||
public void success(JSONValue aValue) {
|
||||
expand();
|
||||
m_View.getCurrentAlbum().expand();
|
||||
m_View.getCurrentAlbum().select();
|
||||
}
|
||||
}, true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* rearranges the albums
|
||||
*/
|
||||
|
||||
public void rearrangeTo(JSONArray a_Ids, Item m_CompareTo, boolean m_Before){
|
||||
public void rearrangeTo(JSONArray a_Ids, Item m_CompareTo, boolean m_Before) {
|
||||
Loading.getInstance().loading("Re-arranging..");
|
||||
String bora = m_Before?"before":"after";
|
||||
String bora = m_Before ? "before" : "after";
|
||||
|
||||
m_Container.doJSONRequest(G3Viewer.REARRANGE_URL + m_CompareTo.getID() + "/" + bora
|
||||
+ "?sourceids=" + a_Ids.toString(),
|
||||
m_Container.doJSONRequest(G3Viewer.REARRANGE_URL + m_CompareTo.getID()
|
||||
+ "/" + bora + "?sourceids=" + a_Ids.toString(),
|
||||
new HttpSuccessHandler() {
|
||||
|
||||
@Override
|
||||
public void success(JSONValue aValue) {
|
||||
m_View.getCurrentAlbum().select();
|
||||
}
|
||||
},true,true);
|
||||
}, true, true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns the album with the given id
|
||||
*/
|
||||
public void selectSubAlbum(int a_Id){
|
||||
for (int i = 0; i < getChildCount(); i++)
|
||||
{
|
||||
public void selectSubAlbum(int a_Id) {
|
||||
for (int i = 0; i < getChildCount(); i++) {
|
||||
Album ab = ((Album) getChild(i));
|
||||
if (ab.m_ID == a_Id)
|
||||
{
|
||||
if (ab.m_ID == a_Id) {
|
||||
ab.select();
|
||||
m_Container.getTree().ensureSelected(ab);
|
||||
}
|
||||
@ -327,16 +318,15 @@ public class Album extends TreeItem {
|
||||
public void expand() {
|
||||
|
||||
m_Container.doJSONRequest(G3Viewer.VIEW_ALBUM_URL + getId(),
|
||||
new HttpSuccessHandler() {
|
||||
new HttpSuccessHandler() {
|
||||
|
||||
@Override
|
||||
public void success(JSONValue aValue) {
|
||||
addAlbums(aValue);
|
||||
}
|
||||
},false,true);
|
||||
@Override
|
||||
public void success(JSONValue aValue) {
|
||||
addAlbums(aValue);
|
||||
}
|
||||
}, false, true);
|
||||
}
|
||||
|
||||
|
||||
public void select() {
|
||||
Loading.getInstance().loading("Loading Contents..");
|
||||
m_Container.doJSONRequest(G3Viewer.VIEW_CHILDREN_URL + getId(),
|
||||
@ -346,142 +336,132 @@ public class Album extends TreeItem {
|
||||
public void success(JSONValue aValue) {
|
||||
viewAlbum(aValue);
|
||||
}
|
||||
},false,true);
|
||||
}, false, true);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* view Album contents
|
||||
*/
|
||||
private void viewAlbum(JSONValue a_Value){
|
||||
/*
|
||||
* view Album contents
|
||||
*/
|
||||
private void viewAlbum(JSONValue a_Value) {
|
||||
|
||||
JSONArray jsonArray = (JSONArray)a_Value;
|
||||
JSONArray jsonArray = (JSONArray) a_Value;
|
||||
|
||||
Item item = null;
|
||||
int id;
|
||||
JSONObject jso;
|
||||
Item item = null;
|
||||
int id;
|
||||
JSONObject jso;
|
||||
|
||||
m_Items.clear();
|
||||
m_Items.clear();
|
||||
|
||||
for (int i = 0; i < jsonArray.size(); ++i)
|
||||
{
|
||||
jso = (JSONObject)jsonArray.get(i);
|
||||
id = Utils.extractId(jso.get("id"));
|
||||
for (int i = 0; i < jsonArray.size(); ++i) {
|
||||
jso = (JSONObject) jsonArray.get(i);
|
||||
id = Utils.extractId(jso.get("id"));
|
||||
|
||||
if (m_IDtoItem.containsKey(id)){
|
||||
item = m_IDtoItem.get(id);
|
||||
item.updateValues(jso);
|
||||
}
|
||||
else
|
||||
{
|
||||
item =new Item(this, jso, m_Container);
|
||||
m_IDtoItem.put(id, item);
|
||||
if (m_IDtoItem.containsKey(id)) {
|
||||
item = m_IDtoItem.get(id);
|
||||
item.updateValues(jso);
|
||||
} else {
|
||||
item = new Item(this, jso, m_Container);
|
||||
m_IDtoItem.put(id, item);
|
||||
|
||||
if (item.isAlbum()){
|
||||
linkAlbum(item);
|
||||
}
|
||||
}
|
||||
m_Items.add(item);
|
||||
if (item.isAlbum()) {
|
||||
linkAlbum(item);
|
||||
}
|
||||
}
|
||||
m_Items.add(item);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
m_View.setAlbum(this);
|
||||
addPendingDownloads();
|
||||
}
|
||||
m_View.setAlbum(this);
|
||||
addPendingDownloads();
|
||||
}
|
||||
|
||||
public List<Item> getItems()
|
||||
{
|
||||
return m_Items;
|
||||
}
|
||||
public List<Item> getItems() {
|
||||
return m_Items;
|
||||
}
|
||||
|
||||
public void linkAlbum(Item a_Item){
|
||||
// link album
|
||||
int id = a_Item.getID();
|
||||
Album child;
|
||||
for (int j = 0 ; j < getChildCount(); j++){
|
||||
child = (Album) getChild(j);
|
||||
if (child.m_ID == id){
|
||||
a_Item.setLinkedAlbum(child);
|
||||
j = getChildCount();
|
||||
}
|
||||
public void linkAlbum(Item a_Item) {
|
||||
// link album
|
||||
int id = a_Item.getID();
|
||||
Album child;
|
||||
for (int j = 0; j < getChildCount(); j++) {
|
||||
child = (Album) getChild(j);
|
||||
if (child.m_ID == id) {
|
||||
a_Item.setLinkedAlbum(child);
|
||||
j = getChildCount();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isManualSort(){
|
||||
return m_Sort.equalsIgnoreCase("weight");
|
||||
}
|
||||
public boolean isManualSort() {
|
||||
return m_Sort.equalsIgnoreCase("weight");
|
||||
}
|
||||
|
||||
public void uploadFiles() {
|
||||
Desktop desktop = Factory.getInstance().createDesktop();
|
||||
|
||||
desktop.openFiles(new OpenFilesHandler() {
|
||||
desktop.openFiles(new OpenFilesHandler() {
|
||||
|
||||
public void onOpenFiles(OpenFilesEvent event) {
|
||||
uploadFiles(event.getFiles());
|
||||
}
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
public void uploadFiles(final File[] files){
|
||||
|
||||
m_Container.doJSONRequest(G3Viewer.RESIZE_DETAILS_URL, new HttpSuccessHandler() {
|
||||
|
||||
public void success(JSONValue a_Value) {
|
||||
JSONObject jso = a_Value.isObject();
|
||||
if (jso != null) {
|
||||
|
||||
ResizeOptions ro = new ResizeOptions(jso);
|
||||
UploadFile uf;
|
||||
for (File file : files){
|
||||
uf = m_UploadControl.createUploadFile(Album.this, file, ro);
|
||||
m_AllUploads.add(uf);
|
||||
m_View.addToView(uf);
|
||||
}
|
||||
m_Container.updateInformation();
|
||||
}
|
||||
public void onOpenFiles(OpenFilesEvent event) {
|
||||
uploadFiles(event.getFiles());
|
||||
}
|
||||
},false,true);
|
||||
|
||||
}, false);
|
||||
|
||||
}
|
||||
|
||||
public void removeUpload(UploadFile a_Uf)
|
||||
{
|
||||
public void uploadFiles(final File[] files) {
|
||||
|
||||
m_Container.doJSONRequest(G3Viewer.RESIZE_DETAILS_URL,
|
||||
new HttpSuccessHandler() {
|
||||
|
||||
public void success(JSONValue a_Value) {
|
||||
JSONObject jso = a_Value.isObject();
|
||||
if (jso != null) {
|
||||
|
||||
ResizeOptions ro = new ResizeOptions(jso);
|
||||
UploadFile uf;
|
||||
for (File file : files) {
|
||||
uf = m_UploadControl.createUploadFile(
|
||||
Album.this, file, ro);
|
||||
m_AllUploads.add(uf);
|
||||
m_View.addToView(uf);
|
||||
}
|
||||
m_Container.updateInformation();
|
||||
}
|
||||
}
|
||||
}, false, true);
|
||||
|
||||
}
|
||||
|
||||
public void removeUpload(UploadFile a_Uf) {
|
||||
m_AllUploads.remove(a_Uf);
|
||||
}
|
||||
|
||||
public void replaceUpload(UploadFile a_Uf, JSONValue a_Return)
|
||||
{
|
||||
public void replaceUpload(UploadFile a_Uf, JSONValue a_Return) {
|
||||
m_AllUploads.remove(a_Uf);
|
||||
|
||||
JSONObject jo = a_Return.isObject();
|
||||
|
||||
if (jo != null){
|
||||
Item item = new Item(this,jo,m_Container);
|
||||
if (jo != null) {
|
||||
Item item = new Item(this, jo, m_Container);
|
||||
m_IDtoItem.put(item.getID(), item);
|
||||
m_Items.add(item);
|
||||
|
||||
if (m_View.getCurrentAlbum() == this){
|
||||
if (m_View.getCurrentAlbum() == this) {
|
||||
m_View.replaceInView(a_Uf, item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_View.getCurrentAlbum() == this){
|
||||
} else {
|
||||
if (m_View.getCurrentAlbum() == this) {
|
||||
m_View.removeFromView(a_Uf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addPendingDownloads()
|
||||
{
|
||||
for (UploadFile uf: m_AllUploads)
|
||||
{
|
||||
public void addPendingDownloads() {
|
||||
for (UploadFile uf : m_AllUploads) {
|
||||
m_View.addToView(uf);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -28,19 +28,7 @@ public class AlbumItemDropContainer implements DropController{
|
||||
|
||||
@Override
|
||||
public void onDrop(DragContext context) {
|
||||
JSONArray jsa = new JSONArray();
|
||||
|
||||
int i = 0;
|
||||
for (Widget widget : context.selectedWidgets){
|
||||
if (widget instanceof Item){
|
||||
jsa.set(i, new JSONNumber(((Item)widget).getID()));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
m_Album.moveTo(jsa);
|
||||
// context.
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
m_Album.moveTo(Utils.extractIds(context));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,73 @@
|
||||
package com.gloopics.g3viewer.client;
|
||||
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.http.client.RequestBuilder;
|
||||
import com.google.gwt.http.client.RequestException;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
|
||||
|
||||
public class ConfirmDialogBox extends DialogBox {
|
||||
|
||||
public ConfirmCallBack m_Callback;
|
||||
private final HTML m_Dialog;
|
||||
|
||||
public interface ConfirmCallBack{
|
||||
void ok();
|
||||
}
|
||||
|
||||
public ConfirmDialogBox(G3Viewer a_Parent){
|
||||
m_Dialog = new HTML("Empty");
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public void initComponents(){
|
||||
setModal(true);
|
||||
addStyleName("dialog");
|
||||
setAnimationEnabled(true);
|
||||
setText("Confirm");
|
||||
|
||||
Button close = new Button("Cancel", new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
ConfirmDialogBox.this.hide();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button ok = new Button("ok", new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
if (m_Callback!=null)
|
||||
{
|
||||
m_Callback.ok();
|
||||
}
|
||||
|
||||
ConfirmDialogBox.this.hide();
|
||||
}
|
||||
});
|
||||
|
||||
FlowPanel fp = new FlowPanel();
|
||||
fp.add(ok);
|
||||
fp.add(close);
|
||||
fp.addStyleName("dButtons");
|
||||
DockPanel dp = new DockPanel();
|
||||
dp.add(m_Dialog , DockPanel.CENTER);
|
||||
dp.add(fp, DockPanel.SOUTH);
|
||||
dp.addStyleName("dContents");
|
||||
add(dp);
|
||||
|
||||
}
|
||||
|
||||
public void doDialog(String a_Message, ConfirmCallBack a_Callback){
|
||||
m_Callback = a_Callback;
|
||||
m_Dialog.setHTML(a_Message);
|
||||
show();
|
||||
}
|
||||
|
||||
}
|
@ -17,9 +17,10 @@ package com.gloopics.g3viewer.client;
|
||||
|
||||
|
||||
import com.allen_sauer.gwt.dnd.client.PickupDragController;
|
||||
import com.gloopics.g3viewer.client.ConfirmDialogBox.ConfirmCallBack;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Document;
|
||||
import com.google.gwt.dom.client.InputElement;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.http.client.RequestBuilder;
|
||||
@ -133,11 +134,22 @@ public class G3Viewer {
|
||||
*/
|
||||
public static final String ROTATE_URL = BASE_URL + "index.php/json_album/rotate/";
|
||||
|
||||
/**
|
||||
* rotate url
|
||||
*/
|
||||
public static final String ROTATE_ALL_URL = BASE_URL + "index.php/json_album/rotate_many/";
|
||||
|
||||
/**
|
||||
* Resize details URL
|
||||
*/
|
||||
public static final String RESIZE_DETAILS_URL = BASE_URL + "index.php/json_album/resize_config";
|
||||
|
||||
/**
|
||||
* Resize details URL
|
||||
*/
|
||||
public static final String DELETE_ALL_URL = BASE_URL + "index.php/json_album/delete_many/";
|
||||
|
||||
|
||||
/*
|
||||
* tree
|
||||
*/
|
||||
@ -158,6 +170,11 @@ public class G3Viewer {
|
||||
*/
|
||||
private final HttpDialogBox m_HttpDialogBox= new HttpDialogBox(this);
|
||||
|
||||
/**
|
||||
* the only confirmation dialog box
|
||||
*/
|
||||
private final ConfirmDialogBox m_ConfirmDialogBox = new ConfirmDialogBox(this);
|
||||
|
||||
private class SimplePanelEx extends SimplePanel
|
||||
{
|
||||
public SimplePanelEx()
|
||||
@ -223,7 +240,7 @@ public class G3Viewer {
|
||||
/**
|
||||
* the drag controller
|
||||
*/
|
||||
private final PickupDragController m_DragController;
|
||||
private final MyPickupDragController m_DragController;
|
||||
|
||||
/**
|
||||
* the upload control
|
||||
@ -235,11 +252,12 @@ public class G3Viewer {
|
||||
*/
|
||||
|
||||
public G3Viewer(){
|
||||
m_DragController = new PickupDragController(RootPanel.get(),false);
|
||||
m_DragController = new MyPickupDragController(RootPanel.get(),false);
|
||||
m_DragController.setBehaviorMultipleSelection(true);
|
||||
m_DragController.setBehaviorDragStartSensitivity(5);
|
||||
m_DragController.setBehaviorDragProxy(true);
|
||||
m_UploadControl = new UploadControl(this);
|
||||
m_UploadControl = (UploadControl)GWT.create(UploadControl.class);
|
||||
m_UploadControl.init(this);
|
||||
m_InfoBar = new InformationBar(this, m_UploadControl);
|
||||
m_Tree = new AlbumTree(this);
|
||||
|
||||
@ -252,6 +270,11 @@ public class G3Viewer {
|
||||
return m_UploadControl;
|
||||
}
|
||||
|
||||
public boolean isUploadEnabled()
|
||||
{
|
||||
return m_UploadControl.isUploadEnabled();
|
||||
}
|
||||
|
||||
public static String getCSRF()
|
||||
{
|
||||
return m_CSRF;
|
||||
@ -307,7 +330,7 @@ public class G3Viewer {
|
||||
/**
|
||||
* returns the drag controller
|
||||
*/
|
||||
public PickupDragController getDragController(){
|
||||
public MyPickupDragController getDragController(){
|
||||
return m_DragController;
|
||||
}
|
||||
|
||||
@ -328,6 +351,11 @@ public class G3Viewer {
|
||||
m_HttpDialogBox.doDialog(BASE_URL + a_Url, a_Handler);
|
||||
}
|
||||
|
||||
public void doConfirm(String a_Text, ConfirmCallBack a_Handler)
|
||||
{
|
||||
m_ConfirmDialogBox.doDialog(a_Text, a_Handler);
|
||||
}
|
||||
|
||||
public void showImage(String a_Url)
|
||||
{
|
||||
m_ImageDialogBox.doDialog( a_Url);
|
||||
|
@ -20,8 +20,9 @@ import com.google.gwt.user.client.ui.DockPanel;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.FormPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
|
||||
|
||||
public class HttpDialogBox extends DialogBox{
|
||||
public class HttpDialogBox extends DialogBox {
|
||||
|
||||
private FormPanel m_FormPanel = null;
|
||||
|
||||
@ -30,13 +31,13 @@ public class HttpDialogBox extends DialogBox{
|
||||
private final HTML m_Dialog;
|
||||
private final G3Viewer m_Parent;
|
||||
|
||||
public HttpDialogBox(G3Viewer a_Parent){
|
||||
public HttpDialogBox(G3Viewer a_Parent) {
|
||||
m_Parent = a_Parent;
|
||||
m_Dialog = new HTML("Empty");
|
||||
initComponents();
|
||||
}
|
||||
|
||||
public void initComponents(){
|
||||
public void initComponents() {
|
||||
setModal(true);
|
||||
addStyleName("dialog");
|
||||
setAnimationEnabled(true);
|
||||
@ -51,17 +52,10 @@ public class HttpDialogBox extends DialogBox{
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Button ok = new Button("ok", new ClickHandler() {
|
||||
|
||||
public void onClick(ClickEvent event) {
|
||||
if (m_FormPanel!=null)
|
||||
{
|
||||
submitForm();
|
||||
}
|
||||
|
||||
HttpDialogBox.this.hide();
|
||||
Loading.getInstance().loading("Please Wait..");
|
||||
submitForm();
|
||||
}
|
||||
});
|
||||
|
||||
@ -70,7 +64,7 @@ public class HttpDialogBox extends DialogBox{
|
||||
fp.add(close);
|
||||
fp.addStyleName("dButtons");
|
||||
DockPanel dp = new DockPanel();
|
||||
dp.add(m_Dialog , DockPanel.CENTER);
|
||||
dp.add(m_Dialog, DockPanel.CENTER);
|
||||
dp.add(fp, DockPanel.SOUTH);
|
||||
dp.addStyleName("dContents");
|
||||
add(dp);
|
||||
@ -79,58 +73,58 @@ public class HttpDialogBox extends DialogBox{
|
||||
|
||||
private class RequestCallbackImpl implements RequestCallback {
|
||||
|
||||
private static final int STATUS_CODE_OK = 200;
|
||||
private static final int STATUS_CODE_OK = 200;
|
||||
|
||||
private final String m_URL;
|
||||
private final String m_URL;
|
||||
|
||||
public RequestCallbackImpl(String a_URL){
|
||||
m_URL = a_URL;
|
||||
}
|
||||
|
||||
public void onError(Request request, Throwable exception) {
|
||||
showDialog("Could not get " + m_URL + " Exception thrown " + exception.toString());
|
||||
}
|
||||
|
||||
public void onResponseReceived(Request request, Response response) {
|
||||
if (STATUS_CODE_OK == response.getStatusCode()) {
|
||||
showDialog(response.getText());
|
||||
} else {
|
||||
showDialog(m_URL + response.getText());
|
||||
}
|
||||
}
|
||||
public RequestCallbackImpl(String a_URL) {
|
||||
m_URL = a_URL;
|
||||
}
|
||||
|
||||
public void onError(Request request, Throwable exception) {
|
||||
showDialog("Could not get " + m_URL + " Exception thrown "
|
||||
+ exception.toString());
|
||||
}
|
||||
|
||||
public void onResponseReceived(Request request, Response response) {
|
||||
if (STATUS_CODE_OK == response.getStatusCode()) {
|
||||
showDialog(response.getText());
|
||||
} else {
|
||||
showDialog(m_URL + response.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public native static String createData(Element form) /*-{
|
||||
|
||||
var fieldValue = function(el, successful) {
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (typeof successful == 'undefined') successful = true;
|
||||
var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
|
||||
if (typeof successful == 'undefined') successful = true;
|
||||
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1))
|
||||
return null;
|
||||
if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
|
||||
(t == 'checkbox' || t == 'radio') && !el.checked ||
|
||||
(t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
|
||||
tag == 'select' && el.selectedIndex == -1))
|
||||
return null;
|
||||
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) return null;
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
if (tag == 'select') {
|
||||
var index = el.selectedIndex;
|
||||
if (index < 0) return null;
|
||||
var a = [], ops = el.options;
|
||||
var one = (t == 'select-one');
|
||||
var max = (one ? index+1 : ops.length);
|
||||
for(var i=(one ? index : 0); i < max; i++) {
|
||||
var op = ops[i];
|
||||
if (op.selected) {
|
||||
var v = op.value;
|
||||
if (!v) // extra pain for IE...
|
||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
||||
if (one) return v;
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return el.value;
|
||||
v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
|
||||
if (one) return v;
|
||||
a.push(v);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
return el.value;
|
||||
};
|
||||
|
||||
|
||||
@ -140,81 +134,85 @@ public class HttpDialogBox extends DialogBox{
|
||||
{
|
||||
if(added)
|
||||
{
|
||||
a = a+"&"+str;
|
||||
a = a+"&"+str;
|
||||
}
|
||||
else
|
||||
{
|
||||
a = a+str;
|
||||
added = true;
|
||||
{
|
||||
a = a+str;
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
|
||||
var els = form.getElementsByTagName('*'); //: form.elements;
|
||||
if (!els) return a;
|
||||
for(var i=0, max=els.length; i < max; i++) {
|
||||
var el = els[i];
|
||||
var n = el.name;
|
||||
if (!n) continue;
|
||||
var els = form.getElementsByTagName('*'); //: form.elements;
|
||||
if (!els) return a;
|
||||
for(var i=0, max=els.length; i < max; i++) {
|
||||
var el = els[i];
|
||||
var n = el.name;
|
||||
if (!n) continue;
|
||||
|
||||
var v = fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(var j=0, jmax=v.length; j < jmax; j++)
|
||||
appendA(n+"="+escape(v[j]));
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
appendA(n+"="+escape(v));
|
||||
}
|
||||
|
||||
return a;
|
||||
var v = fieldValue(el, true);
|
||||
if (v && v.constructor == Array) {
|
||||
for(var j=0, jmax=v.length; j < jmax; j++)
|
||||
appendA(n+"="+escape(v[j]));
|
||||
}
|
||||
else if (v !== null && typeof v != 'undefined')
|
||||
appendA(n+"="+escape(v));
|
||||
}
|
||||
|
||||
return a;
|
||||
}-*/;
|
||||
|
||||
private void submitForm(){
|
||||
String url = m_FormPanel.getAction();
|
||||
private void submitForm() {
|
||||
if (m_FormPanel != null) {
|
||||
String url = m_FormPanel.getAction();
|
||||
|
||||
String data = createData(m_FormPanel.getElement());
|
||||
String data = createData(m_FormPanel.getElement());
|
||||
|
||||
m_Parent.doJSONRequest(url, new HttpSuccessHandler() {
|
||||
m_Parent.doJSONRequest(url, new HttpSuccessHandler() {
|
||||
|
||||
@Override
|
||||
public void success(JSONValue aValue) {
|
||||
JSONObject object = aValue.isObject();
|
||||
if (object != null) {
|
||||
JSONValue result = object.get("result");
|
||||
if (result != null) {
|
||||
if (result.isString().stringValue().equals(
|
||||
"success")) {
|
||||
m_Callback.success(aValue.toString());
|
||||
Loading.getInstance().endLoading();
|
||||
} else {
|
||||
JSONValue resul = object.get("form");
|
||||
showDialog(resul.isString().stringValue());
|
||||
}
|
||||
} else {
|
||||
G3Viewer.displayError("result was null ", aValue
|
||||
.toString());
|
||||
}
|
||||
} else {
|
||||
G3Viewer.displayError("Only JSON Value Returned ",
|
||||
aValue.toString());
|
||||
}
|
||||
}
|
||||
}, false, false, data);
|
||||
}
|
||||
|
||||
HttpDialogBox.this.hide();
|
||||
Loading.getInstance().loading("Please Wait..");
|
||||
|
||||
@Override
|
||||
public void success(JSONValue aValue) {
|
||||
JSONObject object = aValue.isObject();
|
||||
if (object != null){
|
||||
JSONValue result = object.get("result");
|
||||
if (result != null)
|
||||
{
|
||||
if (result.isString().stringValue().equals("success")){
|
||||
m_Callback.success(aValue.toString());
|
||||
Loading.getInstance().endLoading();
|
||||
}
|
||||
else{
|
||||
JSONValue resul = object.get("form");
|
||||
showDialog(resul.isString().stringValue());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
G3Viewer.displayError("result was null ", aValue.toString() );
|
||||
}
|
||||
} else {
|
||||
G3Viewer.displayError("Only JSON Value Returned ", aValue.toString() );
|
||||
}
|
||||
}
|
||||
}, false ,false, data);
|
||||
}
|
||||
|
||||
private void showDialog(String a_Text){
|
||||
private void showDialog(String a_Text) {
|
||||
|
||||
m_Dialog.setHTML(a_Text);
|
||||
|
||||
// hide all submits
|
||||
NodeList<Element> inputs = this.getElement().getElementsByTagName("input");
|
||||
NodeList<Element> inputs = this.getElement().getElementsByTagName(
|
||||
"input");
|
||||
Element input;
|
||||
for (int i = 0; i < inputs.getLength(); i++){
|
||||
for (int i = 0; i < inputs.getLength(); i++) {
|
||||
input = inputs.getItem(i);
|
||||
|
||||
if (input.getAttribute("type").equals("submit"))
|
||||
{
|
||||
if (input.getAttribute("type").equals("submit")) {
|
||||
input.setAttribute("style", "display:none");
|
||||
}
|
||||
}
|
||||
@ -223,38 +221,47 @@ public class HttpDialogBox extends DialogBox{
|
||||
show();
|
||||
|
||||
// find forms if it exists
|
||||
NodeList<Element> forms = this.getElement().getElementsByTagName("form");
|
||||
if (forms.getLength() > 0)
|
||||
{
|
||||
Element element = this.getElement().getElementsByTagName("form").getItem(0);
|
||||
setText(element.getElementsByTagName("legend").getItem(0).getInnerText());
|
||||
NodeList<Element> forms = this.getElement()
|
||||
.getElementsByTagName("form");
|
||||
if (forms.getLength() > 0) {
|
||||
Element element = this.getElement().getElementsByTagName("form")
|
||||
.getItem(0);
|
||||
setText(element.getElementsByTagName("legend").getItem(0)
|
||||
.getInnerText());
|
||||
|
||||
m_FormPanel = FormPanel.wrap(element, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setText(this.getElement().getElementsByTagName("legend").getItem(0).getInnerText());
|
||||
m_FormPanel.addSubmitHandler(new FormPanel.SubmitHandler() {
|
||||
|
||||
@Override
|
||||
public void onSubmit(SubmitEvent event) {
|
||||
event.cancel();
|
||||
submitForm();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
setText(this.getElement().getElementsByTagName("legend").getItem(0)
|
||||
.getInnerText());
|
||||
m_FormPanel = null;
|
||||
}
|
||||
|
||||
setPopupPosition(Window.getClientWidth() / 2 - this.getOffsetWidth() / 2,
|
||||
Window.getClientHeight() / 2 - this.getOffsetHeight() / 2);
|
||||
setPopupPosition(Window.getClientWidth() / 2 - this.getOffsetWidth()
|
||||
/ 2, Window.getClientHeight() / 2 - this.getOffsetHeight() / 2);
|
||||
|
||||
Timer t = new Timer(){
|
||||
public void run(){
|
||||
Timer t = new Timer() {
|
||||
public void run() {
|
||||
|
||||
// find any scripts if they exist
|
||||
NodeList<Element> scripts = HttpDialogBox.this.getElement().getElementsByTagName("script");
|
||||
for (int i = 0; i < scripts.getLength(); i++ )
|
||||
{
|
||||
Element script = scripts.getItem(i);
|
||||
script.removeFromParent();
|
||||
Element nscript = DOM.createElement("script");
|
||||
nscript.setAttribute("type", script.getAttribute("type"));
|
||||
nscript.setAttribute("src", script.getAttribute("src"));
|
||||
// find any scripts if they exist
|
||||
NodeList<Element> scripts = HttpDialogBox.this.getElement()
|
||||
.getElementsByTagName("script");
|
||||
for (int i = 0; i < scripts.getLength(); i++) {
|
||||
Element script = scripts.getItem(i);
|
||||
// script.removeFromParent();
|
||||
Element nscript = DOM.createElement("script");
|
||||
nscript.setAttribute("type", script.getAttribute("type"));
|
||||
nscript.setAttribute("src", script.getAttribute("src"));
|
||||
|
||||
getElementByTagName("head").appendChild(nscript);
|
||||
}
|
||||
getElementByTagName("head").appendChild(nscript);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
@ -264,15 +271,17 @@ public class HttpDialogBox extends DialogBox{
|
||||
/**
|
||||
* Gets an element by its tag name; handy for single elements like HTML,
|
||||
* HEAD, BODY.
|
||||
* @param tagName The name of the tag.
|
||||
*
|
||||
* @param tagName
|
||||
* The name of the tag.
|
||||
* @return The element with that tag name.
|
||||
*/
|
||||
public native static Element getElementByTagName(String tagName) /*-{
|
||||
var elem = $doc.getElementsByTagName(tagName);
|
||||
return elem ? elem[0] : null;
|
||||
var elem = $doc.getElementsByTagName(tagName);
|
||||
return elem ? elem[0] : null;
|
||||
}-*/;
|
||||
|
||||
public void doDialog(String url, HttpDialogHandler a_Callback){
|
||||
public void doDialog(String url, HttpDialogHandler a_Callback) {
|
||||
m_Callback = a_Callback;
|
||||
Loading.getInstance().loading("Please Wait");
|
||||
RequestBuilder builder = new RequestBuilder(RequestBuilder.GET, url);
|
||||
@ -280,9 +289,9 @@ public class HttpDialogBox extends DialogBox{
|
||||
try {
|
||||
builder.sendRequest(null, new RequestCallbackImpl(url));
|
||||
} catch (RequestException e) {
|
||||
showDialog("Could not call " + url + " Exception thrown " + e.toString());
|
||||
showDialog("Could not call " + url + " Exception thrown "
|
||||
+ e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.Button;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Label;
|
||||
|
||||
public class InformationBar extends FlowPanel{
|
||||
@ -26,7 +27,10 @@ public class InformationBar extends FlowPanel{
|
||||
}
|
||||
|
||||
public void initializeForm(){
|
||||
if (m_UploadControl.isUploadEnabled())
|
||||
{
|
||||
Anchor button = new Anchor("Upload Options");
|
||||
button.addStyleName("up-options");
|
||||
button.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
@ -45,6 +49,11 @@ public class InformationBar extends FlowPanel{
|
||||
|
||||
updateInformation();
|
||||
add(m_Label);
|
||||
}
|
||||
else
|
||||
{
|
||||
add(new HTML("Please install <a href=\"http://gears.google.com\">Google Gears</a> to allow upload"));
|
||||
}
|
||||
}
|
||||
|
||||
public void updateInformation()
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gloopics.g3viewer.client;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.gloopics.g3viewer.client.dnddesktop.DesktopDropFile;
|
||||
import com.gloopics.g3viewer.client.dnddesktop.DesktopDroppableWidget;
|
||||
@ -27,6 +28,7 @@ import com.google.gwt.event.logical.shared.CloseEvent;
|
||||
import com.google.gwt.event.logical.shared.CloseHandler;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.gears.client.desktop.File;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONNumber;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
import com.google.gwt.json.client.JSONString;
|
||||
@ -126,7 +128,10 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
|
||||
|
||||
if (m_IsAlbum)
|
||||
{
|
||||
((DndDesktopFactory)GWT.create(DndDesktopFactory.class)).getInstance(this);
|
||||
if (m_Container.isUploadEnabled())
|
||||
{
|
||||
((DndDesktopFactory)GWT.create(DndDesktopFactory.class)).getInstance(this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -161,7 +166,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
|
||||
}
|
||||
}
|
||||
|
||||
private void updateImages(JSONValue a_Value){
|
||||
public void updateImages(JSONValue a_Value){
|
||||
JSONObject jso = a_Value.isObject();
|
||||
|
||||
if (jso != null) {
|
||||
@ -189,19 +194,20 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
|
||||
m_LinkedAlbum = a_Album;
|
||||
}
|
||||
|
||||
public void removeLinkedAlbum()
|
||||
{
|
||||
if (m_LinkedAlbum != null){
|
||||
m_LinkedAlbum.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void showPopupMenu(ContextMenuEvent event){
|
||||
Iterator<Widget> iter = m_Container.getDragController().getSelectedWidgets().iterator();
|
||||
|
||||
// show views popup menu if items are selected
|
||||
if (iter.hasNext())
|
||||
if (m_Container.getDragController().getSelectedWidgetcount() > 1)
|
||||
{
|
||||
iter.next();
|
||||
if (iter.hasNext())
|
||||
{
|
||||
m_View.showPopupMenu(event);
|
||||
return;
|
||||
}
|
||||
|
||||
m_View.showPopupMenu(event);
|
||||
return;
|
||||
}
|
||||
|
||||
this.addStyleName("popped");
|
||||
@ -267,7 +273,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
|
||||
MenuItem rotateCW = new MenuItem("Rotate Clockwise", true, new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
m_ThumbImage.setUrl(Loading.URL);
|
||||
setLoadingThumb();
|
||||
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + m_ID + "/cw", new HttpSuccessHandler() {
|
||||
|
||||
public void success(JSONValue aValue) {
|
||||
@ -283,7 +289,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
|
||||
MenuItem rotateCCW = new MenuItem("Rotate Couter-Clockwise", true, new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
m_ThumbImage.setUrl(Loading.URL);
|
||||
setLoadingThumb();
|
||||
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + m_ID + "/ccw", new HttpSuccessHandler() {
|
||||
|
||||
public void success(JSONValue aValue) {
|
||||
@ -299,6 +305,7 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
|
||||
|
||||
|
||||
|
||||
|
||||
popupMenuBar.setVisible(true);
|
||||
popupPanel.add(popupMenuBar);
|
||||
|
||||
@ -317,6 +324,10 @@ public class Item extends Composite implements HasAllMouseHandlers, DesktopDropp
|
||||
popupPanel.show();
|
||||
}
|
||||
|
||||
public void setLoadingThumb()
|
||||
{
|
||||
m_ThumbImage.setUrl(Loading.URL);
|
||||
}
|
||||
|
||||
public boolean isAlbum(){
|
||||
return m_IsAlbum;
|
||||
|
@ -0,0 +1,31 @@
|
||||
package com.gloopics.g3viewer.client;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.allen_sauer.gwt.dnd.client.DragContext;
|
||||
import com.allen_sauer.gwt.dnd.client.PickupDragController;
|
||||
import com.google.gwt.user.client.ui.AbsolutePanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class MyPickupDragController extends PickupDragController{
|
||||
|
||||
public MyPickupDragController(AbsolutePanel boundaryPanel, boolean allowDroppingOnBoundaryPanel) {
|
||||
super(boundaryPanel, allowDroppingOnBoundaryPanel);
|
||||
}
|
||||
|
||||
public DragContext getDragContext()
|
||||
{
|
||||
return context;
|
||||
}
|
||||
|
||||
public List<Widget> getSelectedWidgets()
|
||||
{
|
||||
return context.selectedWidgets;
|
||||
}
|
||||
|
||||
public int getSelectedWidgetcount()
|
||||
{
|
||||
return context.selectedWidgets.size();
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package com.gloopics.g3viewer.client;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
public class NoGears implements EntryPoint {
|
||||
public void onModuleLoad() {
|
||||
RootPanel rootPanel = RootPanel.get("main");
|
||||
rootPanel.add(new HTML(
|
||||
"<font color=\"red\">This application requires Google Gears. To install please visit <a href=\"http://gears.google.com/\">gears.google.com</a> and follow the installation instructions.</font>"));
|
||||
}
|
||||
}
|
@ -17,9 +17,10 @@ public class UploadControl {
|
||||
private boolean m_Running = false;
|
||||
private boolean m_PrepareRunning = false;
|
||||
|
||||
private final G3Viewer m_Container;
|
||||
private G3Viewer m_Container;
|
||||
|
||||
public UploadControl(G3Viewer a_Container){
|
||||
public void init(G3Viewer a_Container)
|
||||
{
|
||||
m_Container = a_Container;
|
||||
}
|
||||
|
||||
@ -104,4 +105,8 @@ public class UploadControl {
|
||||
|
||||
}
|
||||
|
||||
public boolean isUploadEnabled(){
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,53 @@
|
||||
package com.gloopics.g3viewer.client;
|
||||
|
||||
import com.google.gwt.core.client.EntryPoint;
|
||||
import com.google.gwt.gears.client.desktop.File;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.RootPanel;
|
||||
|
||||
public class UploadControlNoGears extends UploadControl{
|
||||
public UploadFile createUploadFile(Album a_Album, File a_File, ResizeOptions a_ResizeOptions)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public void init(G3Viewer a_Container)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void cleanupUpload(UploadFile uf)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public int size()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void finishedUploadWithError(UploadFile uf)
|
||||
{
|
||||
}
|
||||
|
||||
public void finishedUpload(UploadFile uf)
|
||||
{
|
||||
}
|
||||
|
||||
private void next()
|
||||
{
|
||||
}
|
||||
|
||||
private void prepareNext()
|
||||
{
|
||||
}
|
||||
|
||||
public void finishedPrepare(UploadFile a_UploadFile)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public boolean isUploadEnabled(){
|
||||
return false;
|
||||
}
|
||||
}
|
@ -126,6 +126,7 @@ public class UploadFile extends Composite{
|
||||
{
|
||||
m_Label.setText("Upload Error");
|
||||
addStyleName("upload-error");
|
||||
G3Viewer.displayError("Error Uploading", request.getResponseText());
|
||||
}
|
||||
removeCapture(RS, m_Name);
|
||||
|
||||
|
@ -1,7 +1,10 @@
|
||||
package com.gloopics.g3viewer.client;
|
||||
|
||||
import com.allen_sauer.gwt.dnd.client.DragContext;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONNumber;
|
||||
import com.google.gwt.json.client.JSONValue;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class Utils {
|
||||
public static int extractId(JSONValue a_Value){
|
||||
@ -15,4 +18,17 @@ public class Utils {
|
||||
}
|
||||
}
|
||||
|
||||
public static JSONArray extractIds(DragContext context) {
|
||||
JSONArray jsa = new JSONArray();
|
||||
|
||||
int i = 0;
|
||||
for (Widget widget : context.selectedWidgets){
|
||||
if (widget instanceof Item){
|
||||
jsa.set(i, new JSONNumber(((Item)widget).getID()));
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return jsa;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,10 +13,13 @@ import com.google.gwt.event.dom.client.ContextMenuEvent;
|
||||
import com.google.gwt.event.logical.shared.CloseEvent;
|
||||
import com.google.gwt.event.logical.shared.CloseHandler;
|
||||
import com.google.gwt.gears.client.desktop.File;
|
||||
import com.google.gwt.json.client.JSONArray;
|
||||
import com.google.gwt.json.client.JSONObject;
|
||||
import com.google.gwt.json.client.JSONValue;
|
||||
import com.google.gwt.user.client.Command;
|
||||
import com.google.gwt.user.client.DOM;
|
||||
import com.google.gwt.user.client.Event;
|
||||
import com.google.gwt.user.client.ui.DialogBox;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.MenuBar;
|
||||
@ -42,7 +45,10 @@ public class View extends FlowPanel implements DesktopDroppableWidget{
|
||||
|
||||
public View(G3Viewer a_Container){
|
||||
m_Container = a_Container;
|
||||
((DndDesktopFactory)GWT.create(DndDesktopFactory.class)).getInstance(this);
|
||||
if (m_Container.isUploadEnabled())
|
||||
{
|
||||
((DndDesktopFactory)GWT.create(DndDesktopFactory.class)).getInstance(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -140,17 +146,26 @@ public class View extends FlowPanel implements DesktopDroppableWidget{
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
/*
|
||||
m_Container.doDialog("index.php/quick/form_delete/" + m_ID, new HttpDialogHandler() {
|
||||
public void success(String aResult) {
|
||||
m_View.removeFromView(Item.this);
|
||||
if (m_LinkedAlbum != null){
|
||||
m_LinkedAlbum.remove();
|
||||
}
|
||||
popupPanel.hide();
|
||||
|
||||
m_Container.doConfirm("Are you sure you wish to delete selected items?", new ConfirmDialogBox.ConfirmCallBack() {
|
||||
|
||||
public void ok() {
|
||||
JSONArray jsa = Utils.extractIds(m_Container.getDragController().getDragContext());
|
||||
|
||||
m_Container.doJSONRequest(G3Viewer.DELETE_ALL_URL + "?sourceids=" + jsa.toString() , new HttpSuccessHandler() {
|
||||
public void success(JSONValue aValue) {
|
||||
final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();
|
||||
Item i;
|
||||
for (Widget widget: widgets){
|
||||
i = (Item)widget;
|
||||
removeFromView(i);
|
||||
i.removeLinkedAlbum();
|
||||
}
|
||||
|
||||
}}, true, true);
|
||||
}
|
||||
});
|
||||
*/
|
||||
popupPanel.hide();
|
||||
|
||||
}
|
||||
});
|
||||
@ -160,6 +175,62 @@ public class View extends FlowPanel implements DesktopDroppableWidget{
|
||||
popupMenuBar.setVisible(true);
|
||||
popupPanel.add(popupMenuBar);
|
||||
|
||||
MenuItem rotateAllCW = new MenuItem("Rotate All Clockwise", true, new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
// change all thumbs into loading
|
||||
final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();
|
||||
|
||||
for (Widget widget: widgets){
|
||||
final Item i = ((Item)widget);
|
||||
if (i.isPhoto())
|
||||
{
|
||||
i.setLoadingThumb();
|
||||
}
|
||||
|
||||
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + i.getID() + "/cw",
|
||||
new HttpSuccessHandler() {
|
||||
|
||||
public void success(JSONValue aValue) {
|
||||
i.updateImages(aValue);
|
||||
}
|
||||
},false,true);
|
||||
}
|
||||
popupPanel.hide();
|
||||
}
|
||||
});
|
||||
|
||||
rotateAllCW.addStyleName("popup-item");
|
||||
popupMenuBar.addItem(rotateAllCW);
|
||||
|
||||
|
||||
MenuItem rotateAllCCW = new MenuItem("Rotate All Counter-Clockwise", true, new Command() {
|
||||
@Override
|
||||
public void execute() {
|
||||
// change all thumbs into loading
|
||||
final List<Widget> widgets = m_Container.getDragController().getSelectedWidgets();
|
||||
|
||||
for (Widget widget: widgets){
|
||||
final Item i = ((Item)widget);
|
||||
if (i.isPhoto())
|
||||
{
|
||||
i.setLoadingThumb();
|
||||
}
|
||||
m_Container.doJSONRequest(G3Viewer.ROTATE_URL + i.getID() + "/cw",
|
||||
new HttpSuccessHandler() {
|
||||
|
||||
public void success(JSONValue aValue) {
|
||||
i.updateImages(aValue);
|
||||
}
|
||||
},false,true);
|
||||
}
|
||||
popupPanel.hide();
|
||||
}
|
||||
});
|
||||
|
||||
rotateAllCW.addStyleName("popup-item");
|
||||
popupMenuBar.addItem(rotateAllCCW);
|
||||
|
||||
int x = DOM.eventGetClientX((Event)event.getNativeEvent());
|
||||
int y = DOM.eventGetClientY((Event)event.getNativeEvent());
|
||||
popupPanel.setPopupPosition(x, y);
|
||||
@ -167,6 +238,4 @@ public class View extends FlowPanel implements DesktopDroppableWidget{
|
||||
popupPanel.show();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
package com.gloopics.g3viewer.client.dnddesktop;
|
||||
|
||||
public interface DesktopDrop {
|
||||
|
||||
}
|
@ -6,7 +6,7 @@ import com.google.gwt.gears.client.desktop.Desktop;
|
||||
import com.google.gwt.gears.client.desktop.File;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public abstract class DesktopDropBase {
|
||||
public abstract class DesktopDropBase implements DesktopDrop{
|
||||
private final DesktopDroppableWidget m_DropFile;
|
||||
protected final Widget m_Widget;
|
||||
private final Desktop m_Desktop;
|
||||
|
@ -1,19 +1,12 @@
|
||||
package com.gloopics.g3viewer.client.dnddesktop;
|
||||
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.gears.client.Factory;
|
||||
import com.google.gwt.gears.client.desktop.Desktop;
|
||||
import com.google.gwt.gears.client.desktop.File;
|
||||
import com.google.gwt.user.client.Window.Navigator;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class DesktopDropFile extends DesktopDropBase{
|
||||
|
||||
public DesktopDropFile(DesktopDroppableWidget a_Widget){
|
||||
super(a_Widget);
|
||||
String nav = Navigator.getUserAgent().toLowerCase();
|
||||
|
||||
addDropEvents(m_Widget.getElement());
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.gloopics.g3viewer.client.dnddesktop;
|
||||
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
|
||||
public class DesktopDropFileIE extends DesktopDropBase{
|
||||
|
@ -2,7 +2,7 @@ package com.gloopics.g3viewer.client.dnddesktop;
|
||||
|
||||
public class DndDesktopFactory {
|
||||
|
||||
public DesktopDropBase getInstance(DesktopDroppableWidget a_Widget)
|
||||
public DesktopDrop getInstance(DesktopDroppableWidget a_Widget)
|
||||
{
|
||||
return new DesktopDropFile(a_Widget);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package com.gloopics.g3viewer.client.dnddesktop;
|
||||
|
||||
public class DndDesktopFactoryIE extends DndDesktopFactory{
|
||||
|
||||
public DesktopDropBase getInstance(DesktopDroppableWidget a_Widget)
|
||||
public DesktopDrop getInstance(DesktopDroppableWidget a_Widget)
|
||||
{
|
||||
return new DesktopDropFileIE(a_Widget);
|
||||
}
|
||||
|
@ -0,0 +1,8 @@
|
||||
package com.gloopics.g3viewer.client.dnddesktop;
|
||||
|
||||
public class DndDesktopFactoryNoGears extends DndDesktopFactory{
|
||||
public DesktopDrop getInstance(DesktopDroppableWidget a_Widget)
|
||||
{
|
||||
return new DesktopDrop(){};
|
||||
}
|
||||
}
|
@ -15,8 +15,8 @@
|
||||
.infobar {background-color: #fff; position: absolute; bottom:0px; border-width: 4px 4px 0 4px; border-style: solid;
|
||||
border-color: #d2e1f6; height: 15px; width: 240px; right: 50px; font-size:10px; padding: 2px 5px 1px 5px;}
|
||||
.infobar div {float:right; }
|
||||
.infobar a {float:left;}
|
||||
.loading{position:absolute; top:0px; left:0px; width:100%; height: 100%; background-color:#FFF; opacity: 0.7; filter: alpha(opacity = 70);}
|
||||
.infobar .up-options {float:left;}
|
||||
.loading{position:absolute; top:0px; left:0px; width:100%; height: 100%; background-color:#FFF; opacity: 0.7; filter: alpha(opacity=70);}
|
||||
.loading-label{z-index:10; position:absolute; width:100%; left:0px; text-align:center;}
|
||||
.loading-image{z-index:10;}
|
||||
.gwt-TreeItem-selected .Tree-Album {background-color: #333; color: #FFF;}
|
||||
@ -24,6 +24,8 @@
|
||||
.Tree-Album:hover{text-decoration:underline;}
|
||||
.drop-target{background-color: #91c0ef; color: #000;}
|
||||
|
||||
.dragdrop-selected ,.dragdrop-dragging ,.dragdrop-proxy {filter: Alpha(Opacity=30) !important;;}
|
||||
|
||||
.popup {padding: 2px; border: 1px solid #91c0ef;background-color:#FFF}
|
||||
|
||||
.dialog fieldset{ border: none; padding: 0px; margin: 0px;}
|
||||
|
@ -4,3 +4,4 @@
|
||||
?>
|
||||
<iframe src="<?=$url?>" style="width:100%; height:500px; border:8px solid #d2e1f6; margin:0; padding:0;">
|
||||
</iframe>
|
||||
GWT Organise version built on <?= revision::getTimeStamp()?>
|
9
modules/gwtorganise/war/.htaccess
Normal file
9
modules/gwtorganise/war/.htaccess
Normal file
@ -0,0 +1,9 @@
|
||||
<IfModule mod_expires.c>
|
||||
<Files *.nocache.*>
|
||||
ExpiresDefault "access"
|
||||
</Files>
|
||||
|
||||
<Files *.cache.*>
|
||||
ExpiresDefault "now plus 1 year"
|
||||
</Files>
|
||||
</IfModule>
|
@ -9,8 +9,8 @@
|
||||
<entry-point class='com.gloopics.g3viewer.client.G3Viewer'/><inherits
|
||||
name="com.allen_sauer.gwt.dnd.gwt-dnd" /><inherits name="com.google.gwt.gears.Gears" />
|
||||
|
||||
<replace-with class="com.gloopics.g3viewer.client.NoGears">
|
||||
<when-type-is class="com.gloopics.g3viewer.client.G3Viewer"/>
|
||||
<replace-with class="com.gloopics.g3viewer.client.UploadControlNoGears">
|
||||
<when-type-is class="com.gloopics.g3viewer.client.UploadControl"/>
|
||||
<when-property-is name="gears.installed" value="false"/>
|
||||
</replace-with>
|
||||
|
||||
@ -30,4 +30,9 @@
|
||||
</any>
|
||||
</replace-with>
|
||||
|
||||
<replace-with class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactoryNoGears">
|
||||
<when-type-is class="com.gloopics.g3viewer.client.dnddesktop.DndDesktopFactory"/>
|
||||
<when-property-is name="gears.installed" value="false"/>
|
||||
</replace-with>
|
||||
|
||||
</module>
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user