Merge branch 'master' of github.com:gallery/gallery3-contrib
@ -33,6 +33,7 @@ class CalendarView_Controller extends Controller {
|
||||
// Draw the page.
|
||||
$template = new Theme_View("page.html", "other", "CalendarView");
|
||||
$template->css("calendarview_calendar.css");
|
||||
$template->set_global("calendar_user", $display_user);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
$template->content = new View("calendarview_year.html");
|
||||
$template->content->calendar_year = $display_year;
|
||||
@ -45,6 +46,7 @@ class CalendarView_Controller extends Controller {
|
||||
// Display all images for the specified day.
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = 0;
|
||||
if ($display_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
@ -66,19 +68,21 @@ class CalendarView_Controller extends Controller {
|
||||
|
||||
// Figure out paging stuff.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
$page = $this->input->get("page", "1");
|
||||
$page = (int) $this->input->get("page", "1");
|
||||
$offset = ($page-1) * $page_size;
|
||||
$max_pages = ceil($day_count / $page_size);
|
||||
$max_pages = max(ceil($day_count / $page_size), 1);
|
||||
|
||||
// Make sure that the page references a valid offset
|
||||
if ($page < 1 || ($day_count && $page > ceil($day_count / $page_size))) {
|
||||
if (($page < 1) || ($page > $max_pages)) {
|
||||
Kohana::show_404();
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
$template = new Theme_View("page.html", "other", "CalendarDayView");
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
$template = new Theme_View("page.html", "collection", "CalendarDayView");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
if ($display_user == "-1") {
|
||||
@ -100,10 +104,92 @@ class CalendarView_Controller extends Controller {
|
||||
->find_all($page_size, $offset));
|
||||
}
|
||||
|
||||
// Set up breadcrumbs
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$calendar_breadcrumbs[1] = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))), url::site("calendarview/month/" . $display_year . "/" . $display_user . "/" . $display_month));
|
||||
$fake_item = new Calendar_Breadcrumb($display_day, "");
|
||||
$template->set_global("item", $fake_item);
|
||||
$template->set_global("parents", $calendar_breadcrumbs);
|
||||
|
||||
// Finish setting up and then display the page.
|
||||
$template->set_global("children_count", $day_count);
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = t("Photos From ") . date("d F Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
$template->content->title = t("Photos From ") . date("d", mktime(0, 0, 0, $display_month, $display_day, $display_year)) . " " . t(date("F", mktime(0, 0, 0, $display_month, $display_day, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, $display_day, $display_year));
|
||||
print $template;
|
||||
}
|
||||
|
||||
public function month($display_year, $display_user, $display_month) {
|
||||
// Display all images for the specified month.
|
||||
|
||||
// Figure out the total number of photos to display.
|
||||
$day_count = 0;
|
||||
if ($display_user == "-1") {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
} else {
|
||||
$day_count = ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->find_all()
|
||||
->count();
|
||||
}
|
||||
|
||||
// Figure out paging stuff.
|
||||
$page_size = module::get_var("gallery", "page_size", 9);
|
||||
$page = (int) $this->input->get("page", "1");
|
||||
$offset = ($page-1) * $page_size;
|
||||
$max_pages = max(ceil($day_count / $page_size), 1);
|
||||
|
||||
// Make sure that the page references a valid offset
|
||||
if (($page < 1) || ($page > $max_pages)) {
|
||||
Kohana::show_404();
|
||||
}
|
||||
|
||||
// Set up the page.
|
||||
$template = new Theme_View("page.html", "collection", "CalendarMonthView");
|
||||
$template->set_global("page", $page);
|
||||
$template->set_global("max_pages", $max_pages);
|
||||
$template->set_global("page_size", $page_size);
|
||||
$template->page_title = t("Gallery :: Calendar");
|
||||
|
||||
// Figure out which photos go on this page.
|
||||
if ($display_user == "-1") {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->orderby("captured", "ASC")
|
||||
->find_all($page_size, $offset));
|
||||
} else {
|
||||
$template->set_global("children", ORM::factory("item")
|
||||
->viewable()
|
||||
->where("owner_id", $display_user)
|
||||
->where("type !=", "album")
|
||||
->where("captured >=", mktime(0, 0, 0, $display_month, 1, $display_year))
|
||||
->where("captured <", mktime(0, 0, 0, $display_month+1, 1, $display_year))
|
||||
->orderby("captured", "ASC")
|
||||
->find_all($page_size, $offset));
|
||||
}
|
||||
|
||||
// Set up breadcrumbs for this page.
|
||||
$calendar_breadcrumbs[0] = new Calendar_Breadcrumb($display_year, url::site("calendarview/calendar/" . $display_year . "/" . $display_user));
|
||||
$fake_item = new Calendar_Breadcrumb(t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))), "");
|
||||
$template->set_global("item", $fake_item);
|
||||
$template->set_global("parents", $calendar_breadcrumbs);
|
||||
|
||||
// Finish setting up and then display the page.
|
||||
$template->set_global("children_count", $day_count);
|
||||
$template->content = new View("dynamic.html");
|
||||
$template->content->title = t("Photos From ") . t(date("F", mktime(0, 0, 0, $display_month, 1, $display_year))) . " " . date("Y", mktime(0, 0, 0, $display_month, 1, $display_year));
|
||||
print $template;
|
||||
}
|
||||
|
||||
|
28
themes/3nids_theme/modules/tagsmap/models/tags_gps.php → modules/calendarview/libraries/Calendar_Breadcrumb.php
Executable file → Normal file
@ -17,5 +17,31 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Tags_GPS_Model extends ORM {
|
||||
class Calendar_Breadcrumb_Core {
|
||||
// Creates a class to maintain a single breadcrumb.
|
||||
// Multiple breadcrumbs can be achieved by createing an array of this class type.
|
||||
public $title = "";
|
||||
public $id = 0;
|
||||
public $url = "";
|
||||
|
||||
public function __construct($new_title, $new_url) {
|
||||
$this->title = $new_title;
|
||||
$this->url = $new_url;
|
||||
}
|
||||
|
||||
public function url($query=null) {
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
public function parent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function is_album() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function is_photo() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<h1 align="center"><?=$calendar_year ?></h1>
|
||||
<h1 align="center"><?=t($calendar_year) ?></h1>
|
||||
<?= $calendar_user_year_form ?>
|
||||
|
||||
<?
|
||||
|
@ -18,11 +18,13 @@ $next = Router::$current_uri.'?'.http_build_query(array_merge($qs, array('month'
|
||||
?>
|
||||
<table class="calendar">
|
||||
<tr class="controls">
|
||||
<td class="title" colspan="7" align="center"><?php echo strftime('%B %Y', mktime(0, 0, 0, $month, 1, $year)) ?></td>
|
||||
<td class="title" colspan="7" align="center">
|
||||
<a href="<? print url::site("calendarview/month/" . $year . "/" . $calendar_user . "/" . $month ) ?>"><?php print t(strftime('%B', mktime(0, 0, 0, $month, 1, $year))) . " " . t(strftime('%Y', mktime(0, 0, 0, $month, 1, $year))) ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<?php foreach ($days as $day): ?>
|
||||
<th><?php echo $day ?></th>
|
||||
<th><?php echo t($day) ?></th>
|
||||
<?php endforeach ?>
|
||||
</tr>
|
||||
<?php foreach ($weeks as $week): ?>
|
||||
|
@ -1,48 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // @todo Set hover on AlbumGrid list items for guest users ?>
|
||||
<div id="g-info">
|
||||
<?= $theme->album_top() ?>
|
||||
<h1><?= html::purify($item->title) ?></h1>
|
||||
<div class="g-description"><?= nl2br(html::purify($item->description)) ?></div>
|
||||
</div>
|
||||
<? $children_all = $item->viewable()->children();
|
||||
$theme->pagination = new Pagination();
|
||||
$theme->pagination->initialize(array("query_string" => "page","total_items" => $children_count,"items_per_page" => $page_size,"style" => "classic"));
|
||||
$children_offset = ($theme->pagination->current_page -1) * $page_size ; ?>
|
||||
|
||||
|
||||
<ul id="g-album-grid" class="ui-helper-clearfix">
|
||||
<? if (count($children)): ?>
|
||||
<? for($i=0;$i<$children_offset;$i++): ?>
|
||||
<? $child = $children_all[$i] ?>
|
||||
<?= theme_3nids::fancylink($child,"header") ?>
|
||||
<? endfor ?>
|
||||
<? foreach ($children as $i => $child): ?>
|
||||
<? $item_class = "g-photo"; ?>
|
||||
<? if ($child->is_album()): ?>
|
||||
<? $item_class = "g-album"; ?>
|
||||
<? endif ?>
|
||||
<li id="g-item-id-<?= $child->id ?>" class="g-item <?= $item_class ?>">
|
||||
<?= $theme->thumb_top($child) ?>
|
||||
<?= theme_3nids::fancylink($child,"album") ?>
|
||||
<?= $theme->thumb_bottom($child) ?>
|
||||
<?= $theme->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail") ?>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
<? for($i=$children_offset+$page_size;$i<$children_count;$i++): ?>
|
||||
<? $child = $children_all[$i] ?>
|
||||
<?= theme_3nids::fancylink($child,"header") ?>
|
||||
<? endfor ?>
|
||||
<? else: ?>
|
||||
<? if ($user->admin || access::can("add", $item)): ?>
|
||||
<? $addurl = url::file("index.php/simple_uploader/app/$item->id") ?>
|
||||
<li><?= t("There aren't any photos here yet! <a %attrs>Add some</a>.",
|
||||
array("attrs" => html::mark_clean("href=\"$addurl\" class=\"g-dialog-link\""))) ?></li>
|
||||
<? else: ?>
|
||||
<li><?= t("There aren't any photos here yet!") ?></li>
|
||||
<? endif; ?>
|
||||
<? endif; ?>
|
||||
</ul>
|
||||
<?= $theme->album_bottom() ?>
|
||||
|
||||
<?= $theme->pager() ?>
|
@ -1,58 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<?= $theme->css("yui/reset-fonts-grids.css") ?>
|
||||
<?= $theme->css("superfish/css/superfish.css") ?>
|
||||
<?= $theme->css("themeroller/ui.base.css") ?>
|
||||
<?= $theme->css("gallery.common.css") ?>
|
||||
<?= $theme->css("jquery.fancybox.css") ?>
|
||||
<?= $theme->css("screen.css") ?>
|
||||
<?= $theme->css("3nids.css") ?>
|
||||
<?= $theme->script("jquery.js") ?>
|
||||
<?= $theme->script("jquery.form.js") ?>
|
||||
<?= $theme->script("jquery-ui.js") ?>
|
||||
<?= $theme->script("gallery.common.js") ?>
|
||||
<? /* MSG_CANCEL is required by gallery.dialog.js */ ?>
|
||||
<script type="text/javascript">
|
||||
var MSG_CANCEL = <?= t('Cancel')->for_js() ?>;
|
||||
</script>
|
||||
<?= $theme->script("gallery.ajax.js") ?>
|
||||
<?= $theme->script("gallery.dialog.js") ?>
|
||||
<?= $theme->script("superfish/js/superfish.js") ?>
|
||||
<?= $theme->script("jquery.localscroll.js") ?>
|
||||
<?= $theme->script("jquery.easing.js") ?>
|
||||
<?= $theme->script("jquery.fancybox.js") ?>
|
||||
<?= $theme->script("ui.init.js") ?>
|
||||
<?= $theme->head() ?>
|
||||
</head>
|
||||
<body class="g-fancy-iframe-body">
|
||||
<div class="g-comment-thumb"> <img src="<?=$thumb?>"></div>
|
||||
<a href="<?= url::site("form/add/comments_3nids/{$item_id}") ?>" id="g-admin-comment-button"
|
||||
class="g-button ui-corner-all ui-icon-left ui-state-default right">
|
||||
<span class="ui-icon ui-icon-comment"></span>
|
||||
<?= t("Add a comment") ?>
|
||||
</a>
|
||||
<div id="g-comment-detail">
|
||||
<? if (!$comments->count()): ?>
|
||||
<p id="g-NoCommentsYet">
|
||||
<?= t("No comments yet.") ?>
|
||||
</p>
|
||||
<? endif ?>
|
||||
<ul>
|
||||
<? foreach ($comments as $comment): ?>
|
||||
<li id="g-Comment-<?= $comment->id ?>" class="g-comment-box">
|
||||
<?= t('<b>%name</b> <small>%date</small>: ',
|
||||
array("date" => date(module::get_var("gallery", "date_time_format", "Y-M-d H:i:s"), $comment->created),
|
||||
"name" => html::clean($comment->author_name()))); ?>
|
||||
<div class="g-comment">
|
||||
<?= nl2br(html::purify($comment->text)) ?>
|
||||
</div>
|
||||
</li>
|
||||
<? endforeach ?>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,3 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<?= theme_3nids::fancylink($item, "dynamic", false, false, "h4") ?>
|
@ -1,39 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="g-item">
|
||||
<?= $theme->photo_top() ?>
|
||||
<? /*
|
||||
|
||||
<ul class="g-pager">
|
||||
<li>
|
||||
<? if ($previous_item): ?>
|
||||
<a href="<?= $previous_item->url() ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-w"></span><?= t("previous") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-w"></span><?= t("previous") ?></a>
|
||||
<? endif; ?>
|
||||
</li>
|
||||
<li class="g-info"><?= t("%position of %total", array("position" => $position, "total" => $sibling_count)) ?></li>
|
||||
<li class="g-text-right">
|
||||
<? if ($next_item): ?>
|
||||
<a href="<?= $next_item->url() ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-e"></span><?= t("next") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-icon-right ui-state-disabled ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-e"></span><?= t("next") ?></a>
|
||||
<? endif ?>
|
||||
</li>
|
||||
</ul>
|
||||
*/ ?>
|
||||
|
||||
|
||||
<?= $item->movie_img(array("class" => "g-movie", "id" => "g-movie-id-{$item->id}")) ?>
|
||||
|
||||
<div id="g-info">
|
||||
<h1><?= html::purify($item->title) ?></h1>
|
||||
<div><?= nl2br(html::purify($item->description)) ?></div>
|
||||
</div>
|
||||
|
||||
<?= $theme->photo_bottom() ?>
|
||||
<?= $theme->context_menu($item, "#g-movie-id-{$item->id}") ?>
|
||||
</div>
|
@ -1,43 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<? // See http://docs.kohanaphp.com/libraries/pagination ?>
|
||||
<ul class="g-pager ui-helper-clearfix">
|
||||
<? /* @todo This message isn't easily localizable */
|
||||
$from_to_msg = t2("%current_page / %total_pages",
|
||||
"%current_page / %total_pages",
|
||||
$total_items,
|
||||
array("total_pages" => $total_pages,
|
||||
"current_page" => $current_page)) ?>
|
||||
<li>
|
||||
<? if ($first_page): ?>
|
||||
<a href="<?= str_replace('{page}', 1, $url) ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-first"></span><?= t("first") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-first"></span><?= t("first") ?></a>
|
||||
<? endif ?>
|
||||
<? if ($previous_page): ?>
|
||||
<a href="<?= str_replace('{page}', $previous_page, $url) ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-prev"></span><?= t("previous") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-prev"></span><?= t("previous") ?></a>
|
||||
<? endif ?>
|
||||
</li>
|
||||
<li class="g-info"><?= $from_to_msg ?></li>
|
||||
<li class="g-text-right">
|
||||
<? if ($next_page): ?>
|
||||
<a href="<?= str_replace('{page}', $next_page, $url) ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-next"></span><?= t("next") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-state-disabled ui-icon-right ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-next"></span><?= t("next") ?></a>
|
||||
<? endif ?>
|
||||
<? if ($last_page): ?>
|
||||
<a href="<?= str_replace('{page}', $last_page, $url) ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-end"></span><?= t("last") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-state-disabled ui-icon-right ui-corner-all">
|
||||
<span class="ui-icon ui-icon-seek-end"></span><?= t("last") ?></a>
|
||||
<? endif ?>
|
||||
</li>
|
||||
</ul>
|
@ -1,59 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<? if (access::can("view_full", $theme->item())): ?>
|
||||
<!-- Use javascript to show the full size as an overlay on the current page -->
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function() {
|
||||
$(".g-fullsize-link").click(function() {
|
||||
$.gallery_show_full_size(<?= html::js_string($theme->item()->file_url()) ?>, "<?= $theme->item()->width ?>", "<?= $theme->item()->height ?>");
|
||||
return false;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<? endif ?>
|
||||
|
||||
<div id="g-item">
|
||||
<?= $theme->photo_top() ?>
|
||||
|
||||
<ul class="g-pager ui-helper-clearfix">
|
||||
<li>
|
||||
<? if ($previous_item): ?>
|
||||
<a href="<?= $previous_item->url() ?>" class="g-button ui-icon-left ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-w"></span><?= t("previous") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-icon-left ui-state-disabled ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-w"></span><?= t("previous") ?></a>
|
||||
<? endif; ?>
|
||||
</li>
|
||||
<li class="g-info"><?= t("%position of %total", array("position" => $position, "total" => $sibling_count)) ?></li>
|
||||
<li class="g-text-right">
|
||||
<? if ($next_item): ?>
|
||||
<a href="<?= $next_item->url() ?>" class="g-button ui-icon-right ui-state-default ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-e"></span><?= t("next") ?></a>
|
||||
<? else: ?>
|
||||
<a class="g-button ui-icon-right ui-state-disabled ui-corner-all">
|
||||
<span class="ui-icon ui-icon-triangle-1-e"></span><?= t("next") ?></a>
|
||||
<? endif ?>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div id="g-photo">
|
||||
<?= $theme->resize_top($item) ?>
|
||||
<? if (access::can("view_full", $item)): ?>
|
||||
<a href="<?= $item->file_url() ?>" class="g-fullsize-link" title="<?= t("View full size")->for_html_attr() ?>">
|
||||
<? endif ?>
|
||||
<?= $item->resize_img(array("id" => "g-photo-id-{$item->id}", "class" => "g-resize")) ?>
|
||||
<? if (access::can("view_full", $item)): ?>
|
||||
</a>
|
||||
<? endif ?>
|
||||
<?= $theme->resize_bottom($item) ?>
|
||||
<?= $theme->context_menu($item, "#g-photo-id-{$item->id}") ?>
|
||||
</div>
|
||||
|
||||
<div id="g-info">
|
||||
<h1><?= html::purify($item->title) ?></h1>
|
||||
<div><?= nl2br(html::purify($item->description)) ?></div>
|
||||
</div>
|
||||
|
||||
<?= $theme->photo_bottom() ?>
|
||||
</div>
|
@ -1 +0,0 @@
|
||||
Admin config for item title
|
@ -1,238 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
class Admin_TagsMap_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
// Generate a new admin page.
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_tagsmap.html");
|
||||
|
||||
// Generate a form for Google Maps Settings.
|
||||
$view->content->googlemaps_form = $this->_get_googlemaps_form();
|
||||
|
||||
// Generate a list of tags to display.
|
||||
$query = ORM::factory("tag");
|
||||
$view->content->tags = $query->orderby("name", "ASC")->find_all();
|
||||
|
||||
// Display the page.
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function edit_gps($tag_id) {
|
||||
// Generate a new admin page to edit gps data for the tag specified by $tag_id.
|
||||
|
||||
// Determine the name of the tag.
|
||||
$tagName = ORM::factory("tag")
|
||||
->where("id", $tag_id)
|
||||
->find_all();
|
||||
|
||||
// Set up the admin page.
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_tagsmap_edit.html");
|
||||
$view->content->tagsmapedit_form = $this->_get_tagsgpsedit_form($tag_id);
|
||||
$view->content->tag_name = $tagName[0]->name;
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function orphaned_tags() {
|
||||
// Locate and delete any orphaned GPS data.
|
||||
$int_deleted_records = 0;
|
||||
|
||||
// Generate a list of all tags with GPS data.
|
||||
$existingGPS = ORM::factory("tags_gps")
|
||||
->find_all();
|
||||
|
||||
// Loop through each record and see if a corresponding tag exists.
|
||||
foreach ($existingGPS as $oneGPS) {
|
||||
$oneTag = ORM::factory("tag")
|
||||
->where("id", $oneGPS->tag_id)
|
||||
->find_all();
|
||||
|
||||
// If the tag no longer exists then delete the record.
|
||||
if (count($oneTag) == 0) {
|
||||
// Delete the record.
|
||||
ORM::factory("tags_gps")
|
||||
->where("tag_id", $oneGPS->tag_id)
|
||||
->delete_all();
|
||||
$int_deleted_records++;
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect back to the main screen and display a "success" message.
|
||||
message::success($int_deleted_records . t(" Orphaned Record(s) have been deleted."));
|
||||
url::redirect("admin/tagsmap");
|
||||
}
|
||||
|
||||
public function confirm_delete_gps($tag_id) {
|
||||
// Make sure the user meant to hit the delete button.
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_tagsmap_delete.html");
|
||||
$view->content->tag_id = $tag_id;
|
||||
|
||||
// Determine the name of the tag.
|
||||
$tagName = ORM::factory("tag")
|
||||
->where("id", $tag_id)
|
||||
->find_all();
|
||||
$view->content->tag_name = $tagName[0]->name;
|
||||
|
||||
print $view;
|
||||
}
|
||||
|
||||
public function delete_gps($tag_id) {
|
||||
// Delete the GSP data associated with a tag.
|
||||
|
||||
// Delete the record.
|
||||
ORM::factory("tags_gps")
|
||||
->where("tag_id", $tag_id)
|
||||
->delete_all();
|
||||
|
||||
// Redirect back to the main screen and display a "success" message.
|
||||
message::success(t("Your Settings Have Been Saved."));
|
||||
url::redirect("admin/tagsmap");
|
||||
}
|
||||
|
||||
private function _get_tagsgpsedit_form($tag_id) {
|
||||
// Make a new form for editing GPS data associated with a tag ($tag_id).
|
||||
$form = new Forge("admin/tagsmap/savegps", "", "post",
|
||||
array("id" => "gTagsMapAdminForm"));
|
||||
|
||||
// Add a few input boxes for GPS and Description
|
||||
$tagsgps_group = $form->group("TagsMapGPS");
|
||||
$tagsgps_group->hidden("tag_id")->value($tag_id);
|
||||
|
||||
// Check and see if this ID already has GPS data, then create
|
||||
// input boxes to either update it or enter in new information.
|
||||
$existingGPS = ORM::factory("tags_gps")
|
||||
->where("tag_id", $tag_id)
|
||||
->find_all();
|
||||
if (count($existingGPS) == 0) {
|
||||
$tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value();
|
||||
$tagsgps_group->input("gps_longitude")->label(t("Longitude"))->value();
|
||||
$tagsgps_group->textarea("gps_description")->label(t("Description"))->value();
|
||||
} else {
|
||||
$tagsgps_group->input("gps_latitude")->label(t("Latitude"))->value($existingGPS[0]->latitude);
|
||||
$tagsgps_group->input("gps_longitude")->label(t("Longitude"))->value($existingGPS[0]->longitude);
|
||||
$tagsgps_group->textarea("gps_description")->label(t("Description"))->value($existingGPS[0]->description);
|
||||
}
|
||||
|
||||
// Add a save button to the form.
|
||||
$tagsgps_group->submit("SaveGPS")->value(t("Save"));
|
||||
|
||||
// Return the newly generated form.
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function savegps() {
|
||||
// Save the GPS coordinates to the database.
|
||||
|
||||
// Prevent Cross Site Request Forgery
|
||||
access::verify_csrf();
|
||||
|
||||
// Figure out the values of the text boxes
|
||||
$str_tagid = Input::instance()->post("tag_id");
|
||||
$str_latitude = Input::instance()->post("gps_latitude");
|
||||
$str_longitude = Input::instance()->post("gps_longitude");
|
||||
$str_description = Input::instance()->post("gps_description");
|
||||
|
||||
// Save to database.
|
||||
// Check and see if this ID already has GPS data,
|
||||
// Update it if it does, create a new record if it doesn't.
|
||||
$existingGPS = ORM::factory("tags_gps")
|
||||
->where("tag_id", $str_tagid)
|
||||
->find_all();
|
||||
if (count($existingGPS) == 0) {
|
||||
$newgps = ORM::factory("tags_gps");
|
||||
$newgps->tag_id = $str_tagid;
|
||||
$newgps->latitude = $str_latitude;
|
||||
$newgps->longitude = $str_longitude;
|
||||
$newgps->description = $str_description;
|
||||
$newgps->save();
|
||||
} else {
|
||||
$updatedGPS = ORM::factory("tags_gps", $existingGPS[0]->id);
|
||||
$updatedGPS->tag_id = $str_tagid;
|
||||
$updatedGPS->latitude = $str_latitude;
|
||||
$updatedGPS->longitude = $str_longitude;
|
||||
$updatedGPS->description = $str_description;
|
||||
$updatedGPS->save();
|
||||
}
|
||||
|
||||
// Redirect back to the main screen and display a "success" message.
|
||||
message::success(t("Your Settings Have Been Saved."));
|
||||
url::redirect("admin/tagsmap");
|
||||
}
|
||||
|
||||
private function _get_googlemaps_form() {
|
||||
// Make a new form for inputing information associated with google maps.
|
||||
$form = new Forge("admin/tagsmap/savemapprefs", "", "post",
|
||||
array("id" => "gTagsMapAdminForm"));
|
||||
|
||||
// Input box for the Maps API Key
|
||||
$googlemap_group = $form->group("GoogleMapsKey");
|
||||
$googlemap_group->input("google_api_key")
|
||||
->label(t("Google Maps API Key"))
|
||||
->value(module::get_var("tagsmap", "googlemap_api_key"));
|
||||
|
||||
// Input boxes for the Maps starting location map type and zoom.
|
||||
$startingmap_group = $form->group("GoogleMapsPos");
|
||||
$startingmap_group->input("google_starting_latitude")
|
||||
->label(t("Starting Latitude"))
|
||||
->value(module::get_var("tagsmap", "googlemap_latitude"));
|
||||
$startingmap_group->input("google_starting_longitude")
|
||||
->label(t("Starting Longitude"))
|
||||
->value(module::get_var("tagsmap", "googlemap_longitude"));
|
||||
$startingmap_group->input("google_default_zoom")
|
||||
->label(t("Default Zoom Level"))
|
||||
->value(module::get_var("tagsmap", "googlemap_zoom"));
|
||||
$startingmap_group->input("google_default_type")
|
||||
->label(t("Default Map Type") . " (G_NORMAL_MAP, G_SATELLITE_MAP, G_HYBRID_MAP, G_PHYSICAL_MAP, G_SATELLITE_3D_MAP)")
|
||||
->value(module::get_var("tagsmap", "googlemap_type"));
|
||||
|
||||
// Add a save button to the form.
|
||||
$form->submit("SaveSettings")->value(t("Save"));
|
||||
|
||||
// Return the newly generated form.
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function savemapprefs() {
|
||||
// Save information associated with Google Maps to the database.
|
||||
|
||||
// Prevent Cross Site Request Forgery
|
||||
access::verify_csrf();
|
||||
|
||||
// Figure out the values of the text boxes
|
||||
$str_googlekey = Input::instance()->post("google_api_key");
|
||||
$str_googlelatitude = Input::instance()->post("google_starting_latitude");
|
||||
$str_googlelongitude = Input::instance()->post("google_starting_longitude");
|
||||
$str_googlezoom = Input::instance()->post("google_default_zoom");
|
||||
$str_googlemaptype = Input::instance()->post("google_default_type");
|
||||
|
||||
// Save Settings.
|
||||
module::set_var("tagsmap", "googlemap_api_key", $str_googlekey);
|
||||
module::set_var("tagsmap", "googlemap_latitude", $str_googlelatitude);
|
||||
module::set_var("tagsmap", "googlemap_longitude", $str_googlelongitude);
|
||||
module::set_var("tagsmap", "googlemap_zoom", $str_googlezoom);
|
||||
module::set_var("tagsmap", "googlemap_type", $str_googlemaptype);
|
||||
|
||||
// Display a success message and redirect back to the TagsMap admin page.
|
||||
message::success(t("Your Settings Have Been Saved."));
|
||||
url::redirect("admin/tagsmap");
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class TagsMap_Controller extends Controller {
|
||||
public function googlemap($fullsize) {
|
||||
// Display all tags with GPS coordinates on a google map.
|
||||
|
||||
// Generate a list of GPS coordinates.
|
||||
$tagsGPS = ORM::factory("tags_gps")->find_all();
|
||||
|
||||
// Set up and display the actual page.
|
||||
// If fullsize is true, allow the map to take up the entire browser window,
|
||||
// if not, then display the map in the gallery theme.
|
||||
if ($fullsize == true) {
|
||||
$view = new View("tagsmap_googlemap.html");
|
||||
$view->map_fullsize = true;
|
||||
|
||||
// Load in module preferences.
|
||||
$view->tags_gps = $tagsGPS;
|
||||
$view->google_map_key = module::get_var("tagsmap", "googlemap_api_key");
|
||||
$view->google_map_latitude = module::get_var("tagsmap", "googlemap_latitude");
|
||||
$view->google_map_longitude = module::get_var("tagsmap", "googlemap_longitude");
|
||||
$view->google_map_zoom = module::get_var("tagsmap", "googlemap_zoom");
|
||||
$view->google_map_type = module::get_var("tagsmap", "googlemap_type");
|
||||
|
||||
print $view;
|
||||
} else {
|
||||
$template = new Theme_View("page.html", "other", "Contact");
|
||||
//$template->body_attributes("onload=\"GLoad\" onunload=\"Gunload\"");
|
||||
$template->page_title = t("Gallery :: map");
|
||||
$template->content = new View("tagsmap_googlemap.html");
|
||||
|
||||
// Load in module preferences.
|
||||
$template->content->tags_gps = $tagsGPS;
|
||||
$template->content->google_map_key = module::get_var("tagsmap", "googlemap_api_key");
|
||||
$template->content->google_map_latitude = module::get_var("tagsmap", "googlemap_latitude");
|
||||
$template->content->google_map_longitude = module::get_var("tagsmap", "googlemap_longitude");
|
||||
$template->content->google_map_zoom = module::get_var("tagsmap", "googlemap_zoom");
|
||||
$template->content->google_map_type = module::get_var("tagsmap", "googlemap_type");
|
||||
|
||||
print $template;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,97 +0,0 @@
|
||||
.tooltip{
|
||||
position: absolute;
|
||||
left: 10px;
|
||||
top: 10px;
|
||||
width: 150px;
|
||||
background-color: #777;
|
||||
color: #ffffcc;
|
||||
border: 1px solid #f9db01;
|
||||
font: bold 13px "Trebuchet MS", Verdana, Arial, sans-serif;
|
||||
padding: 4px;
|
||||
z-index: 20;
|
||||
-moz-border-radius: 10px;
|
||||
-moz-opacity: .87;
|
||||
filter:alpha(opacity=87);
|
||||
opacity:.87;
|
||||
}
|
||||
|
||||
.g-map-thumb-table{
|
||||
width:200px;
|
||||
height: 80px;
|
||||
font-size: 0.9em;
|
||||
font-style: normal;
|
||||
color: #FFFFCC;
|
||||
}
|
||||
.g-map-thumb-img{
|
||||
overflow:auto;
|
||||
position: relative;
|
||||
height:125px;
|
||||
}
|
||||
.g-map-thumb-link{
|
||||
height: 15px;
|
||||
}
|
||||
.g-map-thumb-td{
|
||||
padding: 0;
|
||||
text-align: center;
|
||||
}
|
||||
.gMapThumbnail{
|
||||
height: 80px;
|
||||
}
|
||||
#gmInfo{
|
||||
width: 230px;
|
||||
}
|
||||
#gmInfo_contents{
|
||||
background: #3d3d3d;
|
||||
}
|
||||
#gmInfo_contents div{
|
||||
font-style: italic;
|
||||
vertical-align: middle;
|
||||
margin: 0 10px;
|
||||
}
|
||||
#gmInfo_tl{
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background: url('../images/gmInfo_tl.png') top left no-repeat transparent;
|
||||
}
|
||||
#gmInfo_t{
|
||||
background: url('../images/gmInfo_t.png') top left repeat-x transparent;
|
||||
}
|
||||
#gmInfo_tr{
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background: url('../images/gmInfo_tr.png') top left no-repeat transparent;
|
||||
}
|
||||
#gmInfo_l{
|
||||
width: 14px;
|
||||
background: url('../images/gmInfo_l.png') top left repeat-y transparent;
|
||||
}
|
||||
#gmInfo_r{
|
||||
width: 14px;
|
||||
background: url('../images/gmInfo_r.png') top right repeat-y transparent;
|
||||
}
|
||||
#gmInfo_bl{
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background: url('../images/gmInfo_bl.png') top left no-repeat transparent;
|
||||
}
|
||||
#gmInfo_b{
|
||||
background: url('../images/gmInfo_b.png') top left repeat-x transparent;
|
||||
}
|
||||
#gmInfo_br{
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
background: url('../images/gmInfo_br.png') top left no-repeat transparent;
|
||||
}
|
||||
#gmInfo_close{
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
background: url('../images/gmInfo_close.png') top left no-repeat transparent;
|
||||
margin: -10px 0 0 10px;
|
||||
cursor: pointer;
|
||||
}
|
||||
#gmInfo_beak{
|
||||
width: 27px;
|
||||
height: 33px;
|
||||
background: url('../images/gmInfo_beak.png') top left no-repeat transparent;
|
||||
}
|
||||
|
@ -1,43 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class tagsmap_event_Core {
|
||||
static function module_change($changes) {
|
||||
// See if the Tags module is installed,
|
||||
// tell the user to install it if it isn't.
|
||||
if (!module::is_active("tag") || in_array("tag", $changes->deactivate)) {
|
||||
site_status::warning(
|
||||
t("The TagsMap module requires the Tags module. " .
|
||||
"<a href=\"%url\">Activate the Tags module now</a>",
|
||||
array("url" => url::site("admin/modules"))),
|
||||
"tagsmap_needs_tag");
|
||||
} else {
|
||||
site_status::clear("tagsmap_needs_tag");
|
||||
}
|
||||
}
|
||||
|
||||
static function admin_menu($menu, $theme) {
|
||||
// Add a link to the TagsMap admin page to the Content menu.
|
||||
$menu->get("content_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("tagsmap")
|
||||
->label(t("TagsMap Settings"))
|
||||
->url(url::site("admin/tagsmap")));
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class tagsmap_installer {
|
||||
static function install() {
|
||||
// Create a table to store GPS data in.
|
||||
$db = Database::instance();
|
||||
$db->query("CREATE TABLE IF NOT EXISTS {tags_gpses} (
|
||||
`id` int(9) NOT NULL auto_increment,
|
||||
`tag_id` int(9) NOT NULL,
|
||||
`latitude` varchar(128) NOT NULL,
|
||||
`longitude` varchar(128) NOT NULL,
|
||||
`description` varchar(2048) default NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY(`tag_id`, `id`))
|
||||
DEFAULT CHARSET=utf8;");
|
||||
|
||||
// Set the module's version number.
|
||||
module::set_version("tagsmap", 1);
|
||||
}
|
||||
|
||||
static function deactivate() {
|
||||
site_status::clear("tagsmap_needs_tag");
|
||||
}
|
||||
|
||||
static function uninstall() {
|
||||
// Delete the GPS table before uninstalling.
|
||||
$db = Database::instance();
|
||||
$db->query("DROP TABLE IF EXISTS {tags_gpses};");
|
||||
module::delete("tagsmap");
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.9 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 2.8 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 436 B |
Before Width: | Height: | Size: 605 B |
Before Width: | Height: | Size: 604 B |
@ -1,610 +0,0 @@
|
||||
/*
|
||||
* ExtInfoWindow Class, v1.0
|
||||
* Copyright (c) 2007, Joe Monahan (http://www.seejoecode.com)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* This class lets you add an info window to the map which mimics GInfoWindow
|
||||
* and allows for users to skin it via CSS. Additionally it has options to
|
||||
* pull in HTML content from an ajax request, triggered when a user clicks on
|
||||
* the associated marker.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new ExtInfoWindow that will initialize by reading styles from css
|
||||
*
|
||||
* @constructor
|
||||
* @param {GMarker} marker The marker associated with the info window
|
||||
* @param {String} windowId The DOM Id we will use to reference the info window
|
||||
* @param {String} html The HTML contents
|
||||
* @param {Object} opt_opts A contianer for optional arguments:
|
||||
* {String} ajaxUrl The Url to hit on the server to request some contents
|
||||
* {Number} paddingX The padding size in pixels that the info window will leave on
|
||||
* the left and right sides of the map when panning is involved.
|
||||
* {Number} paddingY The padding size in pixels that the info window will leave on
|
||||
* the top and bottom sides of the map when panning is involved.
|
||||
* {Number} beakOffset The repositioning offset for when aligning the beak element.
|
||||
* This is used to make sure the beak lines up correcting if the
|
||||
* info window styling containers a border.
|
||||
*/
|
||||
function ExtInfoWindow(marker, windowId, html, opt_opts) {
|
||||
this.html_ = html;
|
||||
this.marker_ = marker;
|
||||
this.infoWindowId_ = windowId;
|
||||
|
||||
this.options_ = opt_opts == null ? {} : opt_opts;
|
||||
this.ajaxUrl_ = this.options_.ajaxUrl == null ? null : this.options_.ajaxUrl;
|
||||
this.callback_ = this.options_.ajaxCallback == null ? null : this.options_.ajaxCallback;
|
||||
|
||||
this.borderSize_ = this.options_.beakOffset == null ? 0 : this.options_.beakOffset;
|
||||
this.paddingX_ = this.options_.paddingX == null ? 0 + this.borderSize_ : this.options_.paddingX + this.borderSize_;
|
||||
this.paddingY_ = this.options_.paddingY == null ? 0 + this.borderSize_ : this.options_.paddingY + this.borderSize_;
|
||||
|
||||
this.map_ = null;
|
||||
|
||||
this.container_ = document.createElement('div');
|
||||
this.container_.style.position = 'relative';
|
||||
this.container_.style.display = 'none';
|
||||
|
||||
this.contentDiv_ = document.createElement('div');
|
||||
this.contentDiv_.id = this.infoWindowId_ + '_contents';
|
||||
this.contentDiv_.innerHTML = this.html_;
|
||||
this.contentDiv_.style.display = 'block';
|
||||
this.contentDiv_.style.visibility = 'hidden';
|
||||
|
||||
this.wrapperDiv_ = document.createElement('div');
|
||||
};
|
||||
|
||||
//use the GOverlay class
|
||||
ExtInfoWindow.prototype = new GOverlay();
|
||||
|
||||
/**
|
||||
* Called by GMap2's addOverlay method. Creates the wrapping div for our info window and adds
|
||||
* it to the relevant map pane. Also binds mousedown event to a private function so that they
|
||||
* are not passed to the underlying map. Finally, performs ajax request if set up to use ajax
|
||||
* in the constructor.
|
||||
* @param {GMap2} map The map that has had this extInfoWindow is added to it.
|
||||
*/
|
||||
ExtInfoWindow.prototype.initialize = function(map) {
|
||||
this.map_ = map;
|
||||
|
||||
this.defaultStyles = {
|
||||
containerWidth: this.map_.getSize().width / 2,
|
||||
borderSize: 1
|
||||
};
|
||||
|
||||
this.wrapperParts = {
|
||||
tl:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
t:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
tr:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
l:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
r:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
bl:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
b:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
br:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
beak:{t:0, l:0, w:0, h:0, domElement: null},
|
||||
close:{t:0, l:0, w:0, h:0, domElement: null}
|
||||
};
|
||||
|
||||
for (var i in this.wrapperParts ) {
|
||||
var tempElement = document.createElement('div');
|
||||
tempElement.id = this.infoWindowId_ + '_' + i;
|
||||
tempElement.style.visibility = 'hidden';
|
||||
document.body.appendChild(tempElement);
|
||||
tempElement = document.getElementById(this.infoWindowId_ + '_' + i);
|
||||
var tempWrapperPart = eval('this.wrapperParts.' + i);
|
||||
tempWrapperPart.w = parseInt(this.getStyle_(tempElement, 'width'));
|
||||
tempWrapperPart.h = parseInt(this.getStyle_(tempElement, 'height'));
|
||||
document.body.removeChild(tempElement);
|
||||
}
|
||||
for (var i in this.wrapperParts) {
|
||||
if (i == 'close' ) {
|
||||
//first append the content so the close button is layered above it
|
||||
this.wrapperDiv_.appendChild(this.contentDiv_);
|
||||
}
|
||||
var wrapperPartsDiv = null;
|
||||
if (this.wrapperParts[i].domElement == null) {
|
||||
wrapperPartsDiv = document.createElement('div');
|
||||
this.wrapperDiv_.appendChild(wrapperPartsDiv);
|
||||
} else {
|
||||
wrapperPartsDiv = this.wrapperParts[i].domElement;
|
||||
}
|
||||
wrapperPartsDiv.id = this.infoWindowId_ + '_' + i;
|
||||
wrapperPartsDiv.style.position = 'absolute';
|
||||
wrapperPartsDiv.style.width = this.wrapperParts[i].w + 'px';
|
||||
wrapperPartsDiv.style.height = this.wrapperParts[i].h + 'px';
|
||||
wrapperPartsDiv.style.top = this.wrapperParts[i].t + 'px';
|
||||
wrapperPartsDiv.style.left = this.wrapperParts[i].l + 'px';
|
||||
this.wrapperParts[i].domElement = wrapperPartsDiv;
|
||||
}
|
||||
|
||||
this.map_.getPane(G_MAP_FLOAT_PANE).appendChild(this.container_);
|
||||
this.container_.id = this.infoWindowId_;
|
||||
var containerWidth = this.getStyle_(document.getElementById(this.infoWindowId_), 'width');
|
||||
this.container_.style.width = (containerWidth == null ? this.defaultStyles.containerWidth : containerWidth);
|
||||
|
||||
this.map_.getContainer().appendChild(this.contentDiv_);
|
||||
this.contentWidth = this.getDimensions_(this.container_).width;
|
||||
this.contentDiv_.style.width = this.contentWidth + 'px';
|
||||
this.contentDiv_.style.position = 'absolute';
|
||||
|
||||
this.container_.appendChild(this.wrapperDiv_);
|
||||
|
||||
GEvent.bindDom(this.container_, 'mousedown', this,this.onClick_);
|
||||
GEvent.bindDom(this.container_, 'dblclick', this,this.onClick_);
|
||||
GEvent.bindDom(this.container_, 'DOMMouseScroll', this, this.onClick_);
|
||||
|
||||
|
||||
GEvent.trigger(this.map_, 'extinfowindowopen');
|
||||
if (this.ajaxUrl_ != null ) {
|
||||
this.ajaxRequest_(this.ajaxUrl_);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Private function to steal mouse click events to prevent it from returning to the map.
|
||||
* Without this links in the ExtInfoWindow would not work, and you could click to zoom or drag
|
||||
* the map behind it.
|
||||
* @private
|
||||
* @param {MouseEvent} e The mouse event caught by this function
|
||||
*/
|
||||
ExtInfoWindow.prototype.onClick_ = function(e) {
|
||||
if(navigator.userAgent.toLowerCase().indexOf('msie') != -1 && document.all) {
|
||||
window.event.cancelBubble = true;
|
||||
window.event.returnValue = false;
|
||||
} else {
|
||||
//e.preventDefault();
|
||||
e.stopPropagation();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the extInfoWindow container from the map pane.
|
||||
*/
|
||||
ExtInfoWindow.prototype.remove = function() {
|
||||
if (this.map_.getExtInfoWindow() != null) {
|
||||
GEvent.trigger(this.map_, 'extinfowindowbeforeclose');
|
||||
|
||||
GEvent.clearInstanceListeners(this.container_);
|
||||
if (this.container_.outerHTML) {
|
||||
this.container_.outerHTML = ''; //prevent pseudo-leak in IE
|
||||
}
|
||||
if (this.container_.parentNode) {
|
||||
this.container_.parentNode.removeChild(this.container_);
|
||||
}
|
||||
this.container_ = null;
|
||||
GEvent.trigger(this.map_, 'extinfowindowclose');
|
||||
this.map_.setExtInfoWindow_(null);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Return a copy of this overlay, for the parent Map to duplicate itself in full. This
|
||||
* is part of the Overlay interface and is used, for example, to copy everything in the
|
||||
* main view into the mini-map.
|
||||
* @return {GOverlay}
|
||||
*/
|
||||
ExtInfoWindow.prototype.copy = function() {
|
||||
return new ExtInfoWindow(this.marker_, this.infoWindowId_, this.html_, this.options_);
|
||||
};
|
||||
|
||||
/**
|
||||
* Draw extInfoWindow and wrapping decorators onto the map. Resize and reposition
|
||||
* the map as necessary.
|
||||
* @param {Boolean} force Will be true when pixel coordinates need to be recomputed.
|
||||
*/
|
||||
ExtInfoWindow.prototype.redraw = function(force) {
|
||||
if (!force || this.container_ == null) return;
|
||||
|
||||
//set the content section's height, needed so browser font resizing does not affect the window's dimensions
|
||||
var contentHeight = this.contentDiv_.offsetHeight;
|
||||
this.contentDiv_.style.height = contentHeight + 'px';
|
||||
|
||||
//reposition contents depending on wrapper parts.
|
||||
//this is necessary for content that is pulled in via ajax
|
||||
this.contentDiv_.style.left = this.wrapperParts.l.w + 'px';
|
||||
this.contentDiv_.style.top = this.wrapperParts.tl.h + 'px';
|
||||
this.contentDiv_.style.visibility = 'visible';
|
||||
|
||||
//Finish configuring wrapper parts that were not set in initialization
|
||||
this.wrapperParts.tl.t = 0;
|
||||
this.wrapperParts.tl.l = 0;
|
||||
this.wrapperParts.t.l = this.wrapperParts.tl.w;
|
||||
this.wrapperParts.t.w = (this.wrapperParts.l.w + this.contentWidth + this.wrapperParts.r.w) - this.wrapperParts.tl.w - this.wrapperParts.tr.w;
|
||||
this.wrapperParts.t.h = this.wrapperParts.tl.h;
|
||||
this.wrapperParts.tr.l = this.wrapperParts.t.w + this.wrapperParts.tl.w;
|
||||
this.wrapperParts.l.t = this.wrapperParts.tl.h;
|
||||
this.wrapperParts.l.h = contentHeight;
|
||||
this.wrapperParts.r.l = this.contentWidth + this.wrapperParts.l.w;
|
||||
this.wrapperParts.r.t = this.wrapperParts.tr.h;
|
||||
this.wrapperParts.r.h = contentHeight;
|
||||
this.wrapperParts.bl.t = contentHeight + this.wrapperParts.tl.h;
|
||||
this.wrapperParts.b.l = this.wrapperParts.bl.w;
|
||||
this.wrapperParts.b.t = contentHeight + this.wrapperParts.tl.h;
|
||||
this.wrapperParts.b.w = (this.wrapperParts.l.w + this.contentWidth + this.wrapperParts.r.w) - this.wrapperParts.bl.w - this.wrapperParts.br.w;
|
||||
this.wrapperParts.b.h = this.wrapperParts.bl.h;
|
||||
this.wrapperParts.br.l = this.wrapperParts.b.w + this.wrapperParts.bl.w;
|
||||
this.wrapperParts.br.t = contentHeight + this.wrapperParts.tr.h;
|
||||
this.wrapperParts.close.l = this.wrapperParts.tr.l +this.wrapperParts.tr.w - this.wrapperParts.close.w - this.borderSize_;
|
||||
this.wrapperParts.close.t = this.borderSize_;
|
||||
this.wrapperParts.beak.l = this.borderSize_ + (this.contentWidth / 2) - (this.wrapperParts.beak.w / 2);
|
||||
this.wrapperParts.beak.t = this.wrapperParts.bl.t + this.wrapperParts.bl.h - this.borderSize_;
|
||||
|
||||
//create the decoration wrapper DOM objects
|
||||
//append the styled info window to the container
|
||||
for (var i in this.wrapperParts) {
|
||||
if (i == 'close' ) {
|
||||
//first append the content so the close button is layered above it
|
||||
this.wrapperDiv_.insertBefore(this.contentDiv_, this.wrapperParts[i].domElement);
|
||||
}
|
||||
var wrapperPartsDiv = null;
|
||||
if (this.wrapperParts[i].domElement == null) {
|
||||
wrapperPartsDiv = document.createElement('div');
|
||||
this.wrapperDiv_.appendChild(wrapperPartsDiv);
|
||||
} else {
|
||||
wrapperPartsDiv = this.wrapperParts[i].domElement;
|
||||
}
|
||||
wrapperPartsDiv.id = this.infoWindowId_ + '_' + i;
|
||||
wrapperPartsDiv.style.position='absolute';
|
||||
wrapperPartsDiv.style.width = this.wrapperParts[i].w + 'px';
|
||||
wrapperPartsDiv.style.height = this.wrapperParts[i].h + 'px';
|
||||
wrapperPartsDiv.style.top = this.wrapperParts[i].t + 'px';
|
||||
wrapperPartsDiv.style.left = this.wrapperParts[i].l + 'px';
|
||||
this.wrapperParts[i].domElement = wrapperPartsDiv;
|
||||
}
|
||||
|
||||
//add event handler for the close box
|
||||
var currentMarker = this.marker_;
|
||||
var thisMap = this.map_;
|
||||
GEvent.addDomListener(this.wrapperParts.close.domElement, 'click',
|
||||
function() {
|
||||
thisMap.closeExtInfoWindow();
|
||||
}
|
||||
);
|
||||
|
||||
//position the container on the map, over the marker
|
||||
var pixelLocation = this.map_.fromLatLngToDivPixel(this.marker_.getPoint());
|
||||
this.container_.style.position = 'absolute';
|
||||
var markerIcon = this.marker_.getIcon();
|
||||
this.container_.style.left = (pixelLocation.x
|
||||
- (this.contentWidth / 2)
|
||||
- markerIcon.iconAnchor.x
|
||||
+ markerIcon.infoWindowAnchor.x
|
||||
) + 'px';
|
||||
|
||||
this.container_.style.top = (pixelLocation.y
|
||||
- this.wrapperParts.bl.h
|
||||
- contentHeight
|
||||
- this.wrapperParts.tl.h
|
||||
- this.wrapperParts.beak.h
|
||||
- markerIcon.iconAnchor.y
|
||||
+ markerIcon.infoWindowAnchor.y
|
||||
+ this.borderSize_
|
||||
) + 'px';
|
||||
|
||||
this.container_.style.display = 'block';
|
||||
|
||||
if(this.map_.getExtInfoWindow() != null) {
|
||||
this.repositionMap_();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine the dimensions of the contents to recalculate and reposition the
|
||||
* wrapping decorator elements accordingly.
|
||||
*/
|
||||
ExtInfoWindow.prototype.resize = function(){
|
||||
|
||||
//Create temporary DOM node for new contents to get new height
|
||||
//This is done because if you manipulate this.contentDiv_ directly it causes visual errors in IE6
|
||||
var tempElement = this.contentDiv_.cloneNode(true);
|
||||
tempElement.id = this.infoWindowId_ + '_tempContents';
|
||||
tempElement.style.visibility = 'hidden';
|
||||
tempElement.style.height = 'auto';
|
||||
document.body.appendChild(tempElement);
|
||||
tempElement = document.getElementById(this.infoWindowId_ + '_tempContents');
|
||||
var contentHeight = tempElement.offsetHeight;
|
||||
document.body.removeChild(tempElement);
|
||||
|
||||
//Set the new height to eliminate visual defects that can be caused by font resizing in browser
|
||||
this.contentDiv_.style.height = contentHeight + 'px';
|
||||
|
||||
var contentWidth = this.contentDiv_.offsetWidth;
|
||||
var pixelLocation = this.map_.fromLatLngToDivPixel(this.marker_.getPoint());
|
||||
|
||||
var oldWindowHeight = this.wrapperParts.t.domElement.offsetHeight + this.wrapperParts.l.domElement.offsetHeight + this.wrapperParts.b.domElement.offsetHeight;
|
||||
var oldWindowPosTop = this.wrapperParts.t.domElement.offsetTop;
|
||||
|
||||
//resize info window to look correct for new height
|
||||
this.wrapperParts.l.domElement.style.height = contentHeight + 'px';
|
||||
this.wrapperParts.r.domElement.style.height = contentHeight + 'px';
|
||||
var newPosTop = this.wrapperParts.b.domElement.offsetTop - contentHeight;
|
||||
this.wrapperParts.l.domElement.style.top = newPosTop + 'px';
|
||||
this.wrapperParts.r.domElement.style.top = newPosTop + 'px';
|
||||
this.contentDiv_.style.top = newPosTop + 'px';
|
||||
windowTHeight = parseInt(this.wrapperParts.t.domElement.style.height);
|
||||
newPosTop -= windowTHeight;
|
||||
this.wrapperParts.close.domElement.style.top = newPosTop + this.borderSize_ + 'px';
|
||||
this.wrapperParts.tl.domElement.style.top = newPosTop + 'px';
|
||||
this.wrapperParts.t.domElement.style.top = newPosTop + 'px';
|
||||
this.wrapperParts.tr.domElement.style.top = newPosTop + 'px';
|
||||
|
||||
this.repositionMap_();
|
||||
};
|
||||
|
||||
/**
|
||||
* Check to see if the displayed extInfoWindow is positioned off the viewable
|
||||
* map region and by how much. Use that information to pan the map so that
|
||||
* the extInfoWindow is completely displayed.
|
||||
* @private
|
||||
*/
|
||||
ExtInfoWindow.prototype.repositionMap_ = function(){
|
||||
//pan if necessary so it shows on the screen
|
||||
var mapNE = this.map_.fromLatLngToDivPixel(
|
||||
this.map_.getBounds().getNorthEast()
|
||||
);
|
||||
var mapSW = this.map_.fromLatLngToDivPixel(
|
||||
this.map_.getBounds().getSouthWest()
|
||||
);
|
||||
var markerPosition = this.map_.fromLatLngToDivPixel(
|
||||
this.marker_.getPoint()
|
||||
);
|
||||
|
||||
var panX = 0;
|
||||
var panY = 0;
|
||||
var paddingX = this.paddingX_;
|
||||
var paddingY = this.paddingY_;
|
||||
var infoWindowAnchor = this.marker_.getIcon().infoWindowAnchor;
|
||||
var iconAnchor = this.marker_.getIcon().iconAnchor;
|
||||
|
||||
//test top of screen
|
||||
var windowT = this.wrapperParts.t.domElement;
|
||||
var windowL = this.wrapperParts.l.domElement;
|
||||
var windowB = this.wrapperParts.b.domElement;
|
||||
var windowR = this.wrapperParts.r.domElement;
|
||||
var windowBeak = this.wrapperParts.beak.domElement;
|
||||
|
||||
var offsetTop = markerPosition.y - ( -infoWindowAnchor.y + iconAnchor.y + this.getDimensions_(windowBeak).height + this.getDimensions_(windowB).height + this.getDimensions_(windowL).height + this.getDimensions_(windowT).height + this.paddingY_);
|
||||
if (offsetTop < mapNE.y) {
|
||||
panY = mapNE.y - offsetTop;
|
||||
} else {
|
||||
//test bottom of screen
|
||||
var offsetBottom = markerPosition.y + this.paddingY_;
|
||||
if (offsetBottom >= mapSW.y) {
|
||||
panY = -(offsetBottom - mapSW.y);
|
||||
}
|
||||
}
|
||||
|
||||
//test right of screen
|
||||
var offsetRight = Math.round(markerPosition.x + this.getDimensions_(this.container_).width/2 + this.getDimensions_(windowR).width + this.paddingX_ + infoWindowAnchor.x - iconAnchor.x);
|
||||
if (offsetRight > mapNE.x) {
|
||||
panX = -( offsetRight - mapNE.x);
|
||||
} else {
|
||||
//test left of screen
|
||||
var offsetLeft = - (Math.round( (this.getDimensions_(this.container_).width/2 - this.marker_.getIcon().iconSize.width/2) + this.getDimensions_(windowL).width + this.borderSize_ + this.paddingX_) - markerPosition.x - infoWindowAnchor.x + iconAnchor.x);
|
||||
if( offsetLeft < mapSW.x) {
|
||||
panX = mapSW.x - offsetLeft;
|
||||
}
|
||||
}
|
||||
|
||||
if (panX != 0 || panY != 0 && this.map_.getExtInfoWindow() != null ) {
|
||||
this.map_.panBy(new GSize(panX,panY));
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Private function that handles performing an ajax request to the server. The response
|
||||
* information is assumed to be HTML and is placed inside this extInfoWindow's contents region.
|
||||
* Last, check to see if the height has changed, and resize the extInfoWindow accordingly.
|
||||
* @private
|
||||
* @param {String} url The Url of where to make the ajax request on the server
|
||||
*/
|
||||
ExtInfoWindow.prototype.ajaxRequest_ = function(url){
|
||||
var thisMap = this.map_;
|
||||
var thisCallback = this.callback_;
|
||||
GDownloadUrl(url, function(response, status){
|
||||
var infoWindow = document.getElementById(thisMap.getExtInfoWindow().infoWindowId_ + '_contents');
|
||||
if (response == null || status == -1 ) {
|
||||
infoWindow.innerHTML = '<span class="error">ERROR: The Ajax request failed to get HTML content from "' + url + '"</span>';
|
||||
} else {
|
||||
infoWindow.innerHTML = response;
|
||||
}
|
||||
if (thisCallback != null ) {
|
||||
thisCallback();
|
||||
}
|
||||
thisMap.getExtInfoWindow().resize();
|
||||
GEvent.trigger(thisMap, 'extinfowindowupdate');
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Private function derived from Prototype.js to get a given element's
|
||||
* height and width
|
||||
* @private
|
||||
* @param {Object} element The DOM element that will have height and
|
||||
* width will be calculated for it.
|
||||
* @return {Object} Object with keys: width, height
|
||||
*/
|
||||
ExtInfoWindow.prototype.getDimensions_ = function(element) {
|
||||
var display = this.getStyle_(element, 'display');
|
||||
if (display != 'none' && display != null) { // Safari bug
|
||||
return {width: element.offsetWidth, height: element.offsetHeight};
|
||||
}
|
||||
|
||||
// All *Width and *Height properties give 0 on elements with display none,
|
||||
// so enable the element temporarily
|
||||
var els = element.style;
|
||||
var originalVisibility = els.visibility;
|
||||
var originalPosition = els.position;
|
||||
var originalDisplay = els.display;
|
||||
els.visibility = 'hidden';
|
||||
els.position = 'absolute';
|
||||
els.display = 'block';
|
||||
var originalWidth = element.clientWidth;
|
||||
var originalHeight = element.clientHeight;
|
||||
els.display = originalDisplay;
|
||||
els.position = originalPosition;
|
||||
els.visibility = originalVisibility;
|
||||
return {width: originalWidth, height: originalHeight};
|
||||
};
|
||||
|
||||
/**
|
||||
* Private function derived from Prototype.js to get a given element's
|
||||
* value that is associated with the passed style
|
||||
* @private
|
||||
* @param {Object} element The DOM element that will be checked.
|
||||
* @param {String} style The style name that will be have it's value returned.
|
||||
* @return {Object}
|
||||
*/
|
||||
ExtInfoWindow.prototype.getStyle_ = function(element, style) {
|
||||
var found = false;
|
||||
style = this.camelize_(style);
|
||||
var value = element.style[style];
|
||||
if (!value) {
|
||||
if (document.defaultView && document.defaultView.getComputedStyle) {
|
||||
var css = document.defaultView.getComputedStyle(element, null);
|
||||
value = css ? css[style] : null;
|
||||
} else if (element.currentStyle) {
|
||||
value = element.currentStyle[style];
|
||||
}
|
||||
}
|
||||
if((value == 'auto') && (style == 'width' || style == 'height') && (this.getStyle_(element, 'display') != 'none')) {
|
||||
if( style == 'width' ) {
|
||||
value = element.offsetWidth;
|
||||
}else {
|
||||
value = element.offsetHeight;
|
||||
}
|
||||
}
|
||||
return (value == 'auto') ? null : value;
|
||||
};
|
||||
|
||||
/**
|
||||
* Private function pulled from Prototype.js that will change a hyphened
|
||||
* style name into camel case.
|
||||
* @private
|
||||
* @param {String} element The string that will be parsed and made into camel case
|
||||
* @return {String}
|
||||
*/
|
||||
ExtInfoWindow.prototype.camelize_ = function(element) {
|
||||
var parts = element.split('-'), len = parts.length;
|
||||
if (len == 1) return parts[0];
|
||||
var camelized = element.charAt(0) == '-'
|
||||
? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
|
||||
: parts[0];
|
||||
|
||||
for (var i = 1; i < len; i++) {
|
||||
camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
|
||||
}
|
||||
return camelized;
|
||||
};
|
||||
|
||||
GMap.prototype.ExtInfoWindowInstance_ = null;
|
||||
GMap.prototype.ClickListener_ = null;
|
||||
GMap.prototype.InfoWindowListener_ = null;
|
||||
|
||||
/**
|
||||
* Creates a new instance of ExtInfoWindow for the GMarker. Register the newly created
|
||||
* instance with the map, ensuring only one window is open at a time. If this is the first
|
||||
* ExtInfoWindow ever opened, add event listeners to the map to close the ExtInfoWindow on
|
||||
* zoom and click, to mimic the default GInfoWindow behavior.
|
||||
*
|
||||
* @param {GMap} map The GMap2 object where the ExtInfoWindow will open
|
||||
* @param {String} cssId The id we will use to reference the info window
|
||||
* @param {String} html The HTML contents
|
||||
* @param {Object} opt_opts A contianer for optional arguments:
|
||||
* {String} ajaxUrl The Url to hit on the server to request some contents
|
||||
* {Number} paddingX The padding size in pixels that the info window will leave on
|
||||
* the left and right sides of the map when panning is involved.
|
||||
* {Number} paddingX The padding size in pixels that the info window will leave on
|
||||
* the top and bottom sides of the map when panning is involved.
|
||||
* {Number} beakOffset The repositioning offset for when aligning the beak element.
|
||||
* This is used to make sure the beak lines up correcting if the
|
||||
* info window styling containers a border.
|
||||
*/
|
||||
GMarker.prototype.openExtInfoWindow = function(map, cssId, html, opt_opts) {
|
||||
if (map == null) {
|
||||
throw 'Error in GMarker.openExtInfoWindow: map cannot be null';
|
||||
return false;
|
||||
}
|
||||
if (cssId == null || cssId == '') {
|
||||
throw 'Error in GMarker.openExtInfoWindow: must specify a cssId';
|
||||
return false;
|
||||
}
|
||||
|
||||
map.closeInfoWindow();
|
||||
if (map.getExtInfoWindow() != null) {
|
||||
map.closeExtInfoWindow();
|
||||
}
|
||||
if (map.getExtInfoWindow() == null) {
|
||||
map.setExtInfoWindow_( new ExtInfoWindow(
|
||||
this,
|
||||
cssId,
|
||||
html,
|
||||
opt_opts
|
||||
) );
|
||||
if (map.ClickListener_ == null) {
|
||||
//listen for map click, close ExtInfoWindow if open
|
||||
map.ClickListener_ = GEvent.addListener(map, 'click',
|
||||
function(event) {
|
||||
if( !event && map.getExtInfoWindow() != null ){
|
||||
map.closeExtInfoWindow();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
if (map.InfoWindowListener_ == null) {
|
||||
//listen for default info window open, close ExtInfoWindow if open
|
||||
map.InfoWindowListener_ = GEvent.addListener(map, 'infowindowopen',
|
||||
function(event) {
|
||||
if (map.getExtInfoWindow() != null) {
|
||||
map.closeExtInfoWindow();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
map.addOverlay(map.getExtInfoWindow());
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove the ExtInfoWindow instance
|
||||
* @param {GMap2} map The map where the GMarker and ExtInfoWindow exist
|
||||
*/
|
||||
GMarker.prototype.closeExtInfoWindow = function(map) {
|
||||
if( map.getExtInfWindow() != null ){
|
||||
map.closeExtInfoWindow();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Get the ExtInfoWindow instance from the map
|
||||
*/
|
||||
GMap2.prototype.getExtInfoWindow = function(){
|
||||
return this.ExtInfoWindowInstance_;
|
||||
};
|
||||
/**
|
||||
* Set the ExtInfoWindow instance for the map
|
||||
* @private
|
||||
*/
|
||||
GMap2.prototype.setExtInfoWindow_ = function( extInfoWindow ){
|
||||
this.ExtInfoWindowInstance_ = extInfoWindow;
|
||||
}
|
||||
/**
|
||||
* Remove the ExtInfoWindow from the map
|
||||
*/
|
||||
GMap2.prototype.closeExtInfoWindow = function(){
|
||||
if( this.getExtInfoWindow() != null ){
|
||||
this.ExtInfoWindowInstance_.remove();
|
||||
}
|
||||
};
|
@ -1,3 +0,0 @@
|
||||
name = TagsMap
|
||||
description = Assign GPS coordinates to existing tags and display them on a map.
|
||||
version = 1
|
@ -1,88 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h2>
|
||||
<?= t("TagsMap Admin") ?>
|
||||
</h2>
|
||||
<div class="g-block">
|
||||
<h3>
|
||||
<?= t("Google Maps Settings") ?>
|
||||
</h3>
|
||||
<br/><div>You may sign up for a Google Maps API key <a href="http://code.google.com/apis/maps/signup.html" target="_new">here</a>.</div><br/>
|
||||
<?= $googlemaps_form ?>
|
||||
</div>
|
||||
|
||||
<div class="g-block">
|
||||
<h3>
|
||||
<?= t("Assign GPS Coordinates") ?>
|
||||
</h3>
|
||||
<? $tags_per_column = $tags->count()/5 ?>
|
||||
<? $column_tag_count = 0 ?>
|
||||
|
||||
<table id="g-gps-tag-admin" class="g-block-content">
|
||||
<caption class="understate">
|
||||
<?= t2("There is one tag", "There are %count tags", $tags->count()) ?>
|
||||
</caption>
|
||||
<tr>
|
||||
<td>
|
||||
<? foreach ($tags as $i => $tag): ?>
|
||||
<? $current_letter = strtoupper(mb_substr($tag->name, 0, 1)) ?>
|
||||
|
||||
<? if ($i == 0): /* first letter */ ?>
|
||||
<strong><?= $current_letter ?></strong>
|
||||
<ul>
|
||||
<? elseif ($last_letter != $current_letter): /* new letter */ ?>
|
||||
<? if ($column_tag_count > $tags_per_column): /* new column */ ?>
|
||||
</td>
|
||||
<td>
|
||||
<? $column_tag_count = 0 ?>
|
||||
<? endif ?>
|
||||
|
||||
</ul>
|
||||
<strong><?= $current_letter ?></strong>
|
||||
<ul>
|
||||
<? endif ?>
|
||||
|
||||
<li>
|
||||
<? // Check and see if this ID already has GPS data, display a delete button if it does.
|
||||
$existingGPS = ORM::factory("tags_gps")
|
||||
->where("tag_id", $tag->id)
|
||||
->find_all();
|
||||
?>
|
||||
<? if (count($existingGPS) == 0) { ?>
|
||||
<i>
|
||||
<? } ?>
|
||||
<?= html::purify($tag->name) ?>
|
||||
<span class="understate">(<?= $tag->count ?>)</span>
|
||||
|
||||
<a href="<?= url::site("admin/tagsmap/edit_gps/$tag->id") ?>"><?= t("Edit GPS") ?></a>
|
||||
|
||||
<? if (count($existingGPS) > 0) { ?>
|
||||
| <a href="<?= url::site("admin/tagsmap/confirm_delete_gps/$tag->id") ?>"><?= t("Delete GPS") ?></a>
|
||||
<?
|
||||
}
|
||||
?>
|
||||
<? if (count($existingGPS) == 0) { ?>
|
||||
</i>
|
||||
<? } ?>
|
||||
</li>
|
||||
|
||||
<? $column_tag_count++ ?>
|
||||
<? $last_letter = $current_letter ?>
|
||||
<? endforeach /* $tags */ ?>
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="g-block">
|
||||
<h3>
|
||||
<?= t("Remove Orphaned GPS Data") ?>
|
||||
</h3>
|
||||
<table id="g-orphaned-tag-admin" class="g-block-content">
|
||||
<tr><td>
|
||||
<a href="<?= url::site("admin/tagsmap/orphaned_tags") ?>">
|
||||
<?= t("Search For and Delete Orphaned Data") ?>
|
||||
</a>
|
||||
</td></tr>
|
||||
</table>
|
||||
</div>
|
@ -1,9 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gTagsMapDeleteAdmin">
|
||||
<h2> <?= t("Delete GPS Data For Tag ") . $tag_name . "?" ?> </h2>
|
||||
<?= t("Are you sure you wish to delete all GPS data associated with this tag?") ?> <br/><br/>
|
||||
<a href="<?= url::site("admin/tagsmap/delete_gps/" . $tag_id) ?>">Delete</a>
|
||||
<a href="<?= url::site("admin/tagsmap") ?>">Cancel</a>
|
||||
<?= $tagsmapdelete_form ?>
|
||||
</div>
|
||||
|
@ -1,56 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<div id="gTagsMapEditAdmin">
|
||||
<h2> <?= t("Edit GPS Data for Tag ") . $tag_name ?> </h2>
|
||||
<?= $tagsmapedit_form ?>
|
||||
</div>
|
||||
<script src="http://www.google.com/jsapi?key=<?= module::get_var("tagsmap", "googlemap_api_key") ?>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
google.load("maps", "2");
|
||||
var lat = document.getElementById("gps_latitude").value;
|
||||
var lon = document.getElementById("gps_longitude").value;
|
||||
|
||||
|
||||
var map;
|
||||
function Gload() {
|
||||
if (GBrowserIsCompatible()) {
|
||||
map = new GMap2(document.getElementById("map"));
|
||||
map.addMapType(G_PHYSICAL_MAP);
|
||||
map.setMapType(G_PHYSICAL_MAP);
|
||||
map.enableScrollWheelZoom();
|
||||
map.setCenter(new GLatLng(46.552656, 6.682645), 6);
|
||||
map.addControl(new GSmallMapControl()); // affiche le curseur de zoom
|
||||
//map.addControl(new GLargeMapControl()); // affiche le curseur de zoom
|
||||
map.addControl(new GMapTypeControl()); // affiche le curseur de déplacement
|
||||
map.addControl(new GScaleControl()); // affiche lechelle
|
||||
//map.addControl(new GOverviewMapControl()); // affiche le mini
|
||||
GEvent.addListener(map,"dblclick",function(overlay, latlng) {
|
||||
document.getElementById("gps_longitude").value = latlng.x;
|
||||
document.getElementById("gps_latitude").value = latlng.y;
|
||||
var markeri = new GMarker(latlng, {draggable: true});
|
||||
map.addOverlay(markeri);
|
||||
GEvent.addListener(markeri, "dragend", function(point){
|
||||
document.getElementById("gps_longitude").value = point.x;
|
||||
document.getElementById("gps_latitude").value = point.y;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (lon != '' && lat != ''){
|
||||
var point = new GLatLng(lat,lon);
|
||||
map.setCenter(point, 8);
|
||||
var marker = new GMarker(point, {draggable: true});
|
||||
map.addOverlay(marker);
|
||||
GEvent.addListener(marker, "dragend", function(point){
|
||||
document.getElementById("gps_longitude").value = point.x;
|
||||
document.getElementById("gps_latitude").value = point.y;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
google.setOnLoadCallback(Gload);
|
||||
</script>
|
||||
<div ID="map" STYLE="width: 800px; height: 400px"></div>
|
||||
|
@ -1,143 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
|
||||
<? if ($map_fullsize == true) { ?>
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title><?= t("Gallery :: Map") ?></title>
|
||||
</head>
|
||||
<body>
|
||||
<? } ?>
|
||||
|
||||
<script src="http://www.google.com/jsapi?key=<?=$google_map_key ?>" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
google.load("maps", "2");
|
||||
</script>
|
||||
<script src="/modules/tagsmap/js/extinfowindow.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var map;
|
||||
function Gload() {
|
||||
if (GBrowserIsCompatible()) {
|
||||
map = new GMap2(document.getElementById("g-map-canva"));
|
||||
|
||||
// Make Google Earth an Option.
|
||||
map.addMapType(G_SATELLITE_3D_MAP);
|
||||
var mapControl = new GMapTypeControl();
|
||||
map.addControl(mapControl);
|
||||
|
||||
// Set map defaults.
|
||||
map.setCenter(new GLatLng(<?=$google_map_latitude ?>,
|
||||
<?=$google_map_longitude ?>));
|
||||
map.setZoom(<?=$google_map_zoom ?>);
|
||||
map.setUIToDefault();
|
||||
map.setMapType(<?=$google_map_type ?>);
|
||||
|
||||
tooltip = document.createElement("div");
|
||||
map.getPane(G_MAP_FLOAT_PANE).appendChild(tooltip);
|
||||
tooltip.style.visibility="hidden";
|
||||
|
||||
|
||||
// Function for making the clickable markers.
|
||||
var BaseIcon = new GIcon();
|
||||
BaseIcon.shadow = '<?= url::file("modules/tagsmap/images/marker_shadow.png") ?>';
|
||||
BaseIcon.iconSize = new GSize(12,20);
|
||||
BaseIcon.shadowSize = new GSize(12+15,20);
|
||||
BaseIcon.iconAnchor = new GPoint(6, 20);
|
||||
BaseIcon.infoWindowAnchor = new GPoint(5, 1);
|
||||
BaseIcon.image = '<?= url::file("modules/tagsmap/images/markery.png") ?>';
|
||||
BaseIcon.iconSize = new GSize(12,20);
|
||||
BaseIcon.shadowSize = new GSize(12+15,20);
|
||||
BaseIcon.iconAnchor = new GPoint(12/2, 20);
|
||||
|
||||
var icon = new GIcon();
|
||||
icon.image = '<?= url::file("modules/tagsmap/images/landscape16.png") ?>';
|
||||
icon.iconSize = new GSize(20, 20);
|
||||
icon.iconAnchor = new GPoint(10, 10);
|
||||
icon.infoWindowAnchor = new GPoint(5, 1);
|
||||
|
||||
|
||||
function createMarker(point, html_thumb, tagURL, tagName) {
|
||||
var marker = new GMarker(point,BaseIcon);
|
||||
marker.tooltip = '<div class="tooltip">'+tagName+'<\/div>';
|
||||
|
||||
GEvent.addListener(marker, "click", function() {
|
||||
//var myHtml = "<a href=\"" + tagURL + "\">" + tagName + "</a><br>" + html_thumb;
|
||||
marker.openExtInfoWindow(
|
||||
map,
|
||||
"gmInfo",
|
||||
html_thumb,
|
||||
{beakOffset: 3}
|
||||
);
|
||||
});
|
||||
GEvent.addListener(marker,"mouseover", function() {
|
||||
showTooltip(marker);
|
||||
});
|
||||
GEvent.addListener(marker,"mouseout", function() {
|
||||
tooltip.style.visibility="hidden"
|
||||
});
|
||||
GEvent.addListener(marker, "click", function() {
|
||||
tooltip.style.visibility="hidden"
|
||||
});
|
||||
return marker;
|
||||
}
|
||||
|
||||
// Create markers for each tag with GPS coordinates.
|
||||
<? $counter = 0; ?>
|
||||
<? foreach ($tags_gps as $oneGPS): ?>
|
||||
var myGeographicCoordinates<?=$counter; ?> = new GLatLng(<?= $oneGPS->latitude ?>,
|
||||
<?= $oneGPS->longitude ?>);
|
||||
|
||||
<? //$tagitems = $oneGPS->tagitems(); ?>
|
||||
<? $html_thumb = "<div id=\"g-map-div-$counter\" class=\"g-map-thumb-link\"></div><div class=\"g-map-thumb-img\"><table class=\"g-map-thumb-table\"><tr>";
|
||||
$tagitems = tagsmap::tagitems($oneGPS);
|
||||
foreach ($tagitems as $tagchild){
|
||||
$html_thumb .= "<td class=\"g-map-thumb-td\"><a href=\"" . $tagchild->url() . "\" onMouseOver=\"ThumbLink('g-map-div-$counter','" . html::purify($tagchild->title) . "')\" onMouseOut=\"ThumbLink('g-map-div-$counter','')\"><img src=\"" . $tagchild->thumb_url() . "\" class=\"gMapThumbnail\"></a></td>";
|
||||
}
|
||||
$html_thumb .= "</tr></table></div>";
|
||||
?>
|
||||
|
||||
map.addOverlay(createMarker(myGeographicCoordinates<?=$counter; ?>,
|
||||
"<?= addcslashes($html_thumb,'"') ?>",
|
||||
"<?= url::site("tags/$oneGPS->tag_id")?>",
|
||||
"<?= str_replace("map.","",ORM::factory("tag", $oneGPS->tag_id)->name) ?>"
|
||||
));
|
||||
<? $counter++; ?>
|
||||
<? endforeach ?>
|
||||
}
|
||||
}
|
||||
|
||||
google.setOnLoadCallback(Gload);
|
||||
|
||||
|
||||
function ThumbLink(divid,html){
|
||||
document.getElementById(divid).innerHTML = html;
|
||||
}
|
||||
|
||||
|
||||
function showTooltip(marker) {
|
||||
tooltip.innerHTML = marker.tooltip;
|
||||
var point=map.getCurrentMapType().getProjection().fromLatLngToPixel(map.fromDivPixelToLatLng(new GLatLng(0,0),true),map.getZoom());
|
||||
var offset=map.getCurrentMapType().getProjection().fromLatLngToPixel(marker.getPoint(),map.getZoom());
|
||||
var anchor=marker.getIcon().iconAnchor;
|
||||
var width=marker.getIcon().iconSize.width;
|
||||
var height=tooltip.clientHeight;
|
||||
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new GSize(offset.x - point.x - anchor.x + width, offset.y - point.y -anchor.y -height));
|
||||
pos.apply(tooltip);
|
||||
tooltip.style.visibility="visible";
|
||||
}
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<? if ($map_fullsize == true) { ?>
|
||||
<div id="g-map-canva" style="width: 100%; height: 100%"></div>
|
||||
</body></html>
|
||||
<? } else { ?>
|
||||
<div id="g-map-canva" style="width: 660px; height: 550px"></div> <br/>
|
||||
<!--<a href="<?= url::site("tagsmap/googlemap/fullsize/1")?>">
|
||||
<?= t("View Fullsize")?>
|
||||
</a><br/><br/>!-->
|
||||
<? } ?>
|
@ -1,192 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Comments_3nids_Controller extends REST_Controller {
|
||||
protected $resource_type = "comment";
|
||||
|
||||
|
||||
/**
|
||||
* Display comments based on criteria.
|
||||
* @see REST_Controller::_index()
|
||||
*/
|
||||
public function _index() {
|
||||
$item_id = $this->input->get('item_id');
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
|
||||
$comments = ORM::factory("comment")
|
||||
->where("item_id", $item->id)
|
||||
->where("state", "published")
|
||||
->orderby("created", "ASC")
|
||||
->find_all();
|
||||
|
||||
switch (rest::output_format()) {
|
||||
case "json":
|
||||
foreach ($comments as $comment) {
|
||||
$data[] = array(
|
||||
"id" => $comment->id,
|
||||
"author_name" => html::clean($comment->author_name()),
|
||||
"created" => $comment->created,
|
||||
"text" => nl2br(html::purify($comment->text)));
|
||||
}
|
||||
print json_encode($data);
|
||||
break;
|
||||
|
||||
case "html":
|
||||
$view = new Theme_View("comments.html", "other", "page");
|
||||
$view->comments = $comments;
|
||||
$view->item_id = $item_id;
|
||||
$view->thumb = $item->thumb_url();
|
||||
print $view;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a new comment to the collection.
|
||||
* @see REST_Controller::_create($resource)
|
||||
*/
|
||||
public function _create($comment) {
|
||||
$item = ORM::factory("item", $this->input->post("item_id"));
|
||||
access::required("view", $item);
|
||||
|
||||
$form = comment_3nids::get_add_form($item);
|
||||
$valid = $form->validate();
|
||||
if ($valid) {
|
||||
if (user::active()->guest && !$form->add_comment->inputs["name"]->value) {
|
||||
$form->add_comment->inputs["name"]->add_error("missing", 1);
|
||||
$valid = false;
|
||||
}
|
||||
|
||||
if (!$form->add_comment->text->value) {
|
||||
$form->add_comment->text->add_error("missing", 1);
|
||||
$valid = false;
|
||||
}
|
||||
}
|
||||
|
||||
if ($valid) {
|
||||
$comment = comment::create(
|
||||
$item, user::active(),
|
||||
$form->add_comment->text->value,
|
||||
$form->add_comment->inputs["name"]->value,
|
||||
$form->add_comment->email->value,
|
||||
$form->add_comment->url->value);
|
||||
|
||||
$active = user::active();
|
||||
if ($active->guest) {
|
||||
$form->add_comment->inputs["name"]->value("");
|
||||
$form->add_comment->email->value("");
|
||||
$form->add_comment->url->value("");
|
||||
} else {
|
||||
$form->add_comment->inputs["name"]->value($active->full_name);
|
||||
$form->add_comment->email->value($active->email);
|
||||
$form->add_comment->url->value($active->url);
|
||||
}
|
||||
}
|
||||
url::redirect(url::site("comments_3nids?item_id=".$item->id));
|
||||
}
|
||||
/**
|
||||
* Display an existing comment.
|
||||
* @todo Set proper Content-Type in a central place (REST_Controller::dispatch?).
|
||||
* @see REST_Controller::_show($resource)
|
||||
*/
|
||||
public function _show($comment) {
|
||||
$item = ORM::factory("item", $comment->item_id);
|
||||
access::required("view", $item);
|
||||
if ($comment->state != "published") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (rest::output_format() == "json") {
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
"data" => array(
|
||||
"id" => $comment->id,
|
||||
"author_name" => html::clean($comment->author_name()),
|
||||
"created" => $comment->created,
|
||||
"text" => nl2br(html::purify($comment->text)))));
|
||||
} else {
|
||||
$view = new Theme_View("comment.html", "other", "fragment");
|
||||
$view->comment = $comment;
|
||||
print $view;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change an existing comment.
|
||||
* @see REST_Controller::_update($resource)
|
||||
*/
|
||||
public function _update($comment) {
|
||||
$item = ORM::factory("item", $comment->item_id);
|
||||
access::required("view", $item);
|
||||
access::required("edit", $item);
|
||||
|
||||
$form = comment_3nids::get_edit_form($comment);
|
||||
if ($form->validate()) {
|
||||
$comment->guest_name = $form->edit_comment->inputs["name"]->value;
|
||||
$comment->guest_email = $form->edit_comment->email->value;
|
||||
$comment->url = $form->edit_comment->url->value;
|
||||
$comment->text = $form->edit_comment->text->value;
|
||||
$comment->save();
|
||||
|
||||
print json_encode(
|
||||
array("result" => "success",
|
||||
"resource" => url::site("comments/{$comment->id}")));
|
||||
} else {
|
||||
print json_encode(
|
||||
array("result" => "error",
|
||||
"html" => $form->__toString()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete existing comment.
|
||||
* @see REST_Controller::_delete($resource)
|
||||
*/
|
||||
public function _delete($comment) {
|
||||
$item = ORM::factory("item", $comment->item_id);
|
||||
access::required("view", $item);
|
||||
access::required("edit", $item);
|
||||
|
||||
$comment->delete();
|
||||
print json_encode(array("result" => "success"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Present a form for adding a new comment to this item or editing an existing comment.
|
||||
* @see REST_Controller::form_add($resource)
|
||||
*/
|
||||
public function _form_add($item_id) {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
|
||||
print comment_3nids::get_add_form($item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Present a form for editing an existing comment.
|
||||
* @see REST_Controller::form_edit($resource)
|
||||
*/
|
||||
public function _form_edit($comment) {
|
||||
if (!user::active()->admin) {
|
||||
access::forbidden();
|
||||
}
|
||||
print comment_3nids::get_edit_form($comment);
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Movie_3nids_Controller extends REST_Controller {
|
||||
protected $resource_type = "movie_3nids";
|
||||
|
||||
|
||||
/**
|
||||
* Display comments based on criteria.
|
||||
* @see REST_Controller::_index()
|
||||
*/
|
||||
public function show($item_id) {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
|
||||
$view = new Theme_View("movie_3nids.html", "other", "page");
|
||||
$view->item = $item;
|
||||
$view->attrs = array("class" => "g-movie", "id" => "g-movie-id-{$item->id}", "style" => "display:block;width:{$item->width}px;height:{$item->height}px");
|
||||
print $view;
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class Photo_3nids_Controller extends REST_Controller {
|
||||
protected $resource_type = "photo_3nids";
|
||||
|
||||
|
||||
/**
|
||||
* Display comments based on criteria.
|
||||
* @see REST_Controller::_index()
|
||||
*/
|
||||
public function show($item_id) {
|
||||
$item = ORM::factory("item", $item_id);
|
||||
access::required("view", $item);
|
||||
|
||||
$view = new Theme_View("photo_3nids.html", "other", "page");
|
||||
$view->item = $item;
|
||||
$photo_size = module::get_var("theme_3nids","photo_size");
|
||||
if ($photo_size == "full"){
|
||||
$view->item_url = $item->file_url();
|
||||
}else{
|
||||
$view->item_url = $item->resize_url();
|
||||
}
|
||||
print $view;
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the API for handling comments.
|
||||
*
|
||||
* Note: by design, this class does not do any permission checking.
|
||||
*/
|
||||
class comment_3nids_Core {
|
||||
|
||||
public function count($item) {
|
||||
access::required("view", $item);
|
||||
|
||||
$comments = ORM::factory("comment")
|
||||
->where("item_id", $item->id)
|
||||
->where("state", "published")
|
||||
->orderby("created", "DESC")
|
||||
->find_all();
|
||||
|
||||
return $comments->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new comment.
|
||||
* @param Item_MOdel $item the parent item
|
||||
* @param User_Model $author the author User_Model
|
||||
* @param string $text comment body
|
||||
* @param string $guest_name guest's name (if the author is a guest user, default empty)
|
||||
* @param string $guest_email guest's email (if the author is a guest user, default empty)
|
||||
* @param string $guest_url guest's url (if the author is a guest user, default empty)
|
||||
* @return Comment_Model
|
||||
*/
|
||||
static function create($item, $author, $text, $guest_name=null,
|
||||
$guest_email=null, $guest_url=null) {
|
||||
$comment = ORM::factory("comment");
|
||||
$comment->author_id = $author->id;
|
||||
$comment->guest_email = $guest_email;
|
||||
$comment->guest_name = $guest_name;
|
||||
$comment->guest_url = $guest_url;
|
||||
$comment->item_id = $item->id;
|
||||
$comment->text = $text;
|
||||
$comment->state = "published";
|
||||
|
||||
// These values are useful for spam fighting, so save them with the comment.
|
||||
$input = Input::instance();
|
||||
$comment->server_http_accept = substr($input->server("HTTP_ACCEPT"), 0, 128);
|
||||
$comment->server_http_accept_charset = substr($input->server("HTTP_ACCEPT_CHARSET"), 0, 64);
|
||||
$comment->server_http_accept_encoding = substr($input->server("HTTP_ACCEPT_ENCODING"), 0, 64);
|
||||
$comment->server_http_accept_language = substr($input->server("HTTP_ACCEPT_LANGUAGE"), 0, 64);
|
||||
$comment->server_http_connection = substr($input->server("HTTP_CONNECTION"), 0, 64);
|
||||
$comment->server_http_host = substr($input->server("HTTP_HOST"), 0, 64);
|
||||
$comment->server_http_referer = substr($input->server("HTTP_REFERER"), 0, 255);
|
||||
$comment->server_http_user_agent = substr($input->server("HTTP_USER_AGENT"), 0, 128);
|
||||
$comment->server_query_string = substr($input->server("QUERY_STRING"), 0, 64);
|
||||
$comment->server_remote_addr = substr($input->server("REMOTE_ADDR"), 0, 32);
|
||||
$comment->server_remote_host = substr($input->server("REMOTE_HOST"), 0, 64);
|
||||
$comment->server_remote_port = substr($input->server("REMOTE_PORT"), 0, 16);
|
||||
$comment->save();
|
||||
|
||||
return $comment;
|
||||
}
|
||||
|
||||
static function get_add_form($item) {
|
||||
$form = new Forge("comments_3nids?item_id=".$item->id, "", "post", array("id" => "gAddCommentForm"));
|
||||
$group = $form->group("add_comment")->label(t("Add comment"));
|
||||
$group->input("name") ->label(t("Name")) ->id("gAuthor");
|
||||
$group->input("email") ->label(t("Email (hidden)")) ->id("gEmail");
|
||||
$group->input("url") ->label(t("Website (hidden)"))->id("gUrl");
|
||||
$group->textarea("text")->label(t("Comment")) ->id("gText");
|
||||
$group->hidden("item_id")->value($item->id);
|
||||
module::event("comment_add_form", $form);
|
||||
$group->submit("")->value(t("Add")) ->class("gButtonLink ui-corner-all ui-icon-left ui-state-default");
|
||||
|
||||
$active = user::active();
|
||||
if (!$active->guest) {
|
||||
$group->inputs["name"]->value($active->full_name)->disabled("disabled");
|
||||
$group->email->value($active->email)->disabled("disabled");
|
||||
$group->url->value($active->url)->disabled("disabled");
|
||||
} else {
|
||||
$group->inputs["name"]->error_messages("missing", t("You must provide a name"));
|
||||
}
|
||||
$group->text->error_messages("missing", t("You must provide a comment"));
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
static function get_edit_form($comment) {
|
||||
$form = new Forge("comments/{$comment->id}?_method=put", "", "post",
|
||||
array("id" => "gEditCommentForm"));
|
||||
$group = $form->group("edit_comment")->label(t("Edit comment"));
|
||||
$group->input("name") ->label(t("Author")) ->id("gAuthor");
|
||||
$group->input("email") ->label(t("Email (hidden)")) ->id("gEmail");
|
||||
$group->input("url") ->label(t("Website (hidden)"))->id("gUrl");
|
||||
$group->textarea("text")->label(t("Comment")) ->id("gText");
|
||||
$group->submit("")->value(t("Edit"));
|
||||
|
||||
$group->text = $comment->text;
|
||||
$author = $comment->author();
|
||||
if ($author->guest) {
|
||||
$group->inputs["name"]->value = $comment->guest_name;
|
||||
$group->email = $comment->guest_email;
|
||||
$group->url = $comment->guest_url;
|
||||
} else {
|
||||
$group->inputs["name"]->value($author->full_name)->disabled("disabled");
|
||||
$group->email->value($author->email)->disabled("disabled");
|
||||
$group->url->value($author->url)->disabled("disabled");
|
||||
}
|
||||
return $form;
|
||||
}
|
||||
}
|
||||
|
@ -1,101 +0,0 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2009 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/**
|
||||
* This is the API for handling comments.
|
||||
*
|
||||
* Note: by design, this class does not do any permission checking.
|
||||
*/
|
||||
class theme_3nids_Core {
|
||||
|
||||
public function fancylink($item, $viewtype="album", $groupImg = true, $displayComment = true, $parentTitleClass = "h2") {
|
||||
//viewtype = album || dynamic || header
|
||||
$link = "";
|
||||
access::required("view", $item);
|
||||
|
||||
$photo_size = module::get_var("theme_3nids","photo_size");
|
||||
if ($photo_size == "full"){
|
||||
$width = $item->width;
|
||||
$height = $item->height;
|
||||
}else{
|
||||
$width = $item->resize_width;
|
||||
$height = $item->resize_height;
|
||||
}
|
||||
|
||||
$desriptionMode = module::get_var("theme_3nids", "description");
|
||||
$description = "";
|
||||
$tags = tag::item_tags($item);
|
||||
if(count($tags) && $desriptionMode == "tags"){
|
||||
$description = " || " . implode(", ", $tags);
|
||||
}elseif($desriptionMode == "item" && $item->description != ""){
|
||||
$description = " || " . str_replace("\"",""",$item->description);
|
||||
}elseif (($desriptionMode == "parent" || $desriptionMode == "item") && $item->parent()->description != ""){
|
||||
$description = " || " . str_replace("\"",""",$item->parent()->description);
|
||||
}
|
||||
|
||||
$titleMode = module::get_var("theme_3nids", "title");
|
||||
if ($titleMode == "parent"){
|
||||
$title = html::clean($item->parent()->title);
|
||||
}else{
|
||||
$title = html::clean($item->title);
|
||||
}
|
||||
|
||||
$rel = "";
|
||||
if ($groupImg == true) {$rel = " rel=\"fancygroup\" ";}
|
||||
|
||||
if ($item->is_photo() || ($item->is_movie()) && module::is_active("theme_3nids")){
|
||||
$fancymodule = "";
|
||||
if (module::is_active("exif")){
|
||||
$fancymodule .= "exif::" . url::site("exif/show/{$item->id}") . ";;";}
|
||||
if (module::is_active("comment") && module::is_active("theme_3nids")){
|
||||
$fancymodule .= "comment::" . url::site("comments_3nids?item_id={$item->id}") . ";;comment_count::" . comment_3nids::count($item) . ";;" ;}
|
||||
if ($item->is_photo()){
|
||||
$link .= "<a href=\"" . url::site("photo_3nids/show/{$item->id}") ."/?w=" . $width . "xewx&h=" . $height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $title . $description ."\" name=\"" . $fancymodule . " \">";
|
||||
}else{
|
||||
$link .= "<a href=\"" . url::site("movie_3nids/show/{$item->id}") . "/?w=" . strval(20+($width)) . "xewx&h=" . strval(50+($height)) . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description ."\" name=\"" . $fancymodule . " \">";
|
||||
}
|
||||
} elseif( $item->is_album() && $viewtype != "header"){
|
||||
$link .= "<a href=\"" . $item->url() . "\">";
|
||||
}
|
||||
|
||||
if($viewtype != "header"){
|
||||
$link .= $item->thumb_img(array("class" => "g-thumbnail")) . "</a>";
|
||||
if( $item->is_album() && $viewtype == "album" ){
|
||||
$link .= "<a href=\"" . $item->url() . "?show=" . $item->id . "\"><$parentTitleClass><span></span>" . html::clean($item->title) . "</$parentTitleClass></a>";
|
||||
} elseif ( !($item->is_album()) && $viewtype == "dynamic") {
|
||||
$link .= "<a href=\"" . $item->parent()->url() . "?show=" . $item->id . "\" class=\"g-parent-album\"><$parentTitleClass><span></span>" . html::clean($item->parent()->title) . "</$parentTitleClass></a>";
|
||||
}
|
||||
|
||||
if (($item->is_photo() || $item->is_movie()) && $displayComment==true && module::is_active("comment") && module::is_active("theme_3nids")) {
|
||||
$link .= "<ul class=\"g-metadata\"><li><a href=\"" . url::site("comments_3nids?item_id={$item->id}") ."\" class=\"iframe fancyclass g-hidden\">" . comment_3nids::count($item) . " " . t("comments") . "</a></li></ul>";
|
||||
}
|
||||
}else{
|
||||
$link .= "</a>";
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -1,3 +0,0 @@
|
||||
name = "3nids theme"
|
||||
description = "Module needed to display correctly 3nids theme (especialy videos and comments)"
|
||||
version = 1
|
13
themes/3nids_theme/README → themes/three_nids/README
Executable file → Normal file
@ -1,5 +1,5 @@
|
||||
This is a theme for gallery3.
|
||||
It uses jquery lightbox slideshow (fancybox) to display images, and includes a tagsmap module (originally from rWatcher).
|
||||
It uses jquery lightbox slideshow (fancybox) to display images.
|
||||
|
||||
*********
|
||||
Demo @ http://gallery.3nids.ch
|
||||
@ -7,15 +7,14 @@ Demo @ http://gallery.3nids.ch
|
||||
*********
|
||||
Requirements:
|
||||
- Gallery 3 last experimental version @ http://github.com/gallery/gallery3
|
||||
- Tag module activated (if want to use tagsmap)
|
||||
- theme_3nids module must be activated to display properly the theme.
|
||||
- Tag and tagsmap modules activated (optional)
|
||||
|
||||
*********
|
||||
Installation:
|
||||
|
||||
1. Copy the theme folder (3nids) into gallery3/themes directory.
|
||||
2. Copy modules folder into gallery3 directory. It includes tagsmap and theme_3nids modules.
|
||||
3. Activate tagsmap and theme_3nids module.
|
||||
1. Copy the theme folder (three_nids) into gallery3/themes directory.
|
||||
2. Copy the tagsmap module into the gallery3/modules folder.
|
||||
3. Activate tagsmap module and three_nids theme.
|
||||
|
||||
*********
|
||||
Configuration:
|
||||
@ -24,7 +23,7 @@ Go to admin -> content -> Theme 3nids settings to configure the theme properly.
|
||||
*********
|
||||
Use:
|
||||
This theme displays full size images. So be carefull to upload not too large images!
|
||||
The theme uses the tagsmap module which has been enhanced.
|
||||
The theme optionally uses the tagsmap module.
|
||||
|
||||
For advanced users:
|
||||
If you want to separate geotag from others, name those with the "map." prefix., the "map." prefix will not be displayed on the map.
|
28
themes/3nids_theme/modules/theme_3nids/controllers/admin_theme_3nids.php → themes/three_nids/admin/controllers/admin_three_nids.php
Executable file → Normal file
@ -18,36 +18,34 @@
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
class Admin_theme_3nids_Controller extends Admin_Controller {
|
||||
class Admin_Three_Nids_Controller extends Admin_Controller {
|
||||
public function index() {
|
||||
// Generate a new admin page.
|
||||
$view = new Admin_View("admin.html");
|
||||
$view->content = new View("admin_theme_3nids.html");
|
||||
$view->content = new View("admin_three_nids.html");
|
||||
|
||||
// Generate a form for Google Maps Settings.
|
||||
$view->content->theme_form = $this->_get_3nids_form();
|
||||
|
||||
$view->content->theme_form = $this->_get_three_nids_form();
|
||||
|
||||
// Display the page.
|
||||
print $view;
|
||||
}
|
||||
|
||||
|
||||
private function _get_3nids_form() {
|
||||
private function _get_three_nids_form() {
|
||||
// Make a new form for inputing information associated with google maps.
|
||||
$form = new Forge("admin/theme_3nids/save3nidsprefs", "", "post",
|
||||
$form = new Forge("admin/three_nids/savethree_nidsprefs", "", "post",
|
||||
array("id" => "gTagsMapAdminForm"));
|
||||
|
||||
// Input box for the Maps API Key
|
||||
$form->input("title")
|
||||
->label(t("item title : parent or item."))
|
||||
->value(module::get_var("theme_3nids", "title"));
|
||||
->value(module::get_var("three_nids", "title"));
|
||||
$form->input("description")
|
||||
->label(t("item description : tags or item or parent or nothing. If item description chosen and not available, then parent description is used."))
|
||||
->value(module::get_var("theme_3nids", "description"));
|
||||
->value(module::get_var("three_nids", "description"));
|
||||
$form->input("photo_size")
|
||||
->label(t("Photo size: resize or full."))
|
||||
->value(module::get_var("theme_3nids", "photo_size"));
|
||||
->value(module::get_var("three_nids", "photo_size"));
|
||||
|
||||
// Add a save button to the form.
|
||||
$form->submit("SaveSettings")->value(t("Save"));
|
||||
@ -56,7 +54,7 @@ class Admin_theme_3nids_Controller extends Admin_Controller {
|
||||
return $form;
|
||||
}
|
||||
|
||||
public function save3nidsprefs() {
|
||||
public function savethree_nidsprefs() {
|
||||
// Save information associated with Google Maps to the database.
|
||||
|
||||
// Prevent Cross Site Request Forgery
|
||||
@ -68,12 +66,12 @@ class Admin_theme_3nids_Controller extends Admin_Controller {
|
||||
$photo_size = Input::instance()->post("photo_size");
|
||||
|
||||
// Save Settings.
|
||||
module::set_var("theme_3nids", "description", $description);
|
||||
module::set_var("theme_3nids", "title", $title);
|
||||
module::set_var("theme_3nids", "photo_size", $photo_size);
|
||||
module::set_var("three_nids", "description", $description);
|
||||
module::set_var("three_nids", "title", $title);
|
||||
module::set_var("three_nids", "photo_size", $photo_size);
|
||||
|
||||
// Display a success message and redirect back to the TagsMap admin page.
|
||||
message::success(t("Your Settings Have Been Saved."));
|
||||
url::redirect("admin/theme_3nids");
|
||||
url::redirect("admin/three_nids");
|
||||
}
|
||||
}
|
12
themes/3nids_theme/modules/theme_3nids/helpers/theme_3nids_event.php → themes/three_nids/admin/helpers/three_nids_event.php
Executable file → Normal file
@ -17,13 +17,13 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class theme_3nids_event_Core {
|
||||
class three_nids_event_Core {
|
||||
static function admin_menu($menu, $theme) {
|
||||
// Add a link to the TagsMap admin page to the Content menu.
|
||||
$menu->get("content_menu")
|
||||
// Add a link to the three_nids admin page to the Content menu.
|
||||
$menu->get("appearance_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("theme_3nids")
|
||||
->label(t("Theme 3nids Settings"))
|
||||
->url(url::site("admin/theme_3nids")));
|
||||
->id("three_nids")
|
||||
->label(t("3nids settings"))
|
||||
->url(url::site("admin/three_nids")));
|
||||
}
|
||||
}
|
@ -1,11 +1,8 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.") ?>
|
||||
<h2>
|
||||
<?= t("TagsMap Admin") ?>
|
||||
</h2>
|
||||
<h2>
|
||||
<?= t("3nids Theme Settings") ?>
|
||||
</h2>
|
||||
<div class="g-block">
|
||||
<h3>
|
||||
<?= t("3nids theme Settings") ?>
|
||||
</h3>
|
||||
<?= $theme_form ?>
|
||||
</div>
|
||||
|
29
themes/3nids_theme/modules/tagsmap/helpers/tagsmap.php → themes/three_nids/controllers/three_nids.php
Executable file → Normal file
@ -17,23 +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);
|
||||
|
||||
/**
|
||||
* This is the API for handling comments.
|
||||
*
|
||||
* Note: by design, this class does not do any permission checking.
|
||||
*/
|
||||
class tagsmap_Core {
|
||||
|
||||
public function tagitems($tag) {
|
||||
$tagitems = ORM::factory("item")
|
||||
->viewable()
|
||||
->join("items_tags", "items.id", "items_tags.item_id")
|
||||
->where("items_tags.tag_id", $tag->tag_id)
|
||||
->orderby("items.name", "DESC")
|
||||
$comments = ORM::factory("comment")
|
||||
->where("item_id", $item->id)
|
||||
->where("state", "published")
|
||||
->orderby("created", "ASC")
|
||||
->find_all();
|
||||
return $tagitems;
|
||||
|
||||
$v = new Theme_View("comments.html", "other", "comment-fragment");
|
||||
$v->comments = $comments;
|
||||
$v->item = $item;
|
||||
print $v;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
0
themes/3nids_theme/3nids/css/fix-ie.css → themes/three_nids/css/fix-ie.css
Executable file → Normal file
0
themes/3nids_theme/3nids/css/jquery.fancybox.css → themes/three_nids/css/jquery.fancybox.css
vendored
Executable file → Normal file
0
themes/3nids_theme/3nids/css/screen.css → themes/three_nids/css/screen.css
Executable file → Normal file
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 178 B After Width: | Height: | Size: 178 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 211 B After Width: | Height: | Size: 211 B |
Before Width: | Height: | Size: 180 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 182 B After Width: | Height: | Size: 182 B |
Before Width: | Height: | Size: 119 B After Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 122 B After Width: | Height: | Size: 122 B |
Before Width: | Height: | Size: 95 B After Width: | Height: | Size: 95 B |
Before Width: | Height: | Size: 115 B After Width: | Height: | Size: 115 B |
Before Width: | Height: | Size: 145 B After Width: | Height: | Size: 145 B |
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 106 B |
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
0
themes/3nids_theme/3nids/css/themeroller/ui.base.css → themes/three_nids/css/themeroller/ui.base.css
Executable file → Normal file
0
themes/3nids_theme/3nids/css/3nids.css → themes/three_nids/css/three_nids.css
Executable file → Normal file
125
themes/three_nids/helpers/three_nids.php
Normal file
@ -0,0 +1,125 @@
|
||||
<?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 three_nids_Core {
|
||||
public function fancylink($item, $view_type="album", $group_img = true,
|
||||
$display_comment = true, $parent_title_class = "h2") {
|
||||
// view_type = album || dynamic || header
|
||||
$link = "";
|
||||
access::required("view", $item);
|
||||
|
||||
$photo_size = module::get_var("three_nids", "photo_size");
|
||||
if ($photo_size == "full" || $item->is_movie()){
|
||||
$width = $item->width;
|
||||
$height = $item->height;
|
||||
}else{
|
||||
$width = $item->resize_width;
|
||||
$height = $item->resize_height;
|
||||
}
|
||||
|
||||
$description_mode = module::get_var("three_nids", "description");
|
||||
$description = "";
|
||||
$tags = tag::item_tags($item);
|
||||
if(count($tags) && $description_mode == "tags"){
|
||||
$description = " || " . implode(", ", $tags);
|
||||
} else if ($description_mode == "item" && $item->description != ""){
|
||||
$description = " || " . str_replace("\"",""",$item->description);
|
||||
} else if (($description_mode == "parent" ||
|
||||
$description_mode == "item") && $item->parent()->description != ""){
|
||||
$description = " || " . str_replace("\"", """, $item->parent()->description);
|
||||
}
|
||||
|
||||
$title_mode = module::get_var("three_nids", "title");
|
||||
if ($title_mode == "parent"){
|
||||
$title = html::clean($item->parent()->title);
|
||||
} else {
|
||||
$title = html::clean($item->title);
|
||||
}
|
||||
|
||||
$rel = "";
|
||||
if ($group_img == true) {
|
||||
$rel = " rel=\"fancygroup\" ";
|
||||
}
|
||||
|
||||
if ($item->is_photo() || $item->is_movie()){
|
||||
$fancymodule = "";
|
||||
if (module::is_active("exif")) {
|
||||
$fancymodule .= "exif::" . url::site("exif/show/{$item->id}") . ";;";
|
||||
}
|
||||
if (module::is_active("comment")) {
|
||||
$fancymodule .= "comment::" . url::site("three_nids/show_comments/{$item->id}") .
|
||||
";;comment_count::" . three_nids::comment_count($item) . ";;";
|
||||
}
|
||||
if ($item->is_photo()){
|
||||
$link .= "<a href=\"" . url::site("photos/{$item->id}") ."/?w=" . $width .
|
||||
"xewx&h=" . $height . "xehx\" " . $rel . " class=\"fancyclass iframe\" title=\"" .
|
||||
$title . $description ."\" name=\"" . $fancymodule . " \">";
|
||||
} else {
|
||||
$link .= "<a href=\"" . url::site("movies/{$item->id}") . "/?w=" .
|
||||
strval(20 + $width) . "xewx&h=" . strval(50 + $height) . "xehx\" " . $rel .
|
||||
" class=\"fancyclass iframe\" title=\"" . $item->parent()->title . $description .
|
||||
"\" name=\"" . $fancymodule . " \">";
|
||||
}
|
||||
} else if ($item->is_album() && $view_type != "header") {
|
||||
$link .= "<a href=\"" . $item->url() . "\">";
|
||||
} else {
|
||||
// NOTE: we don't want to open an <a> here because $view_type is "header", but lower down
|
||||
// we're going to close one, so that's going to generate a mismatch. For now, just open a
|
||||
// link anyway.
|
||||
// @todo: figure out what we really should be doing here.
|
||||
$link .= "<a href=\"" . $item->url() . "\">";
|
||||
}
|
||||
|
||||
if ($view_type != "header") {
|
||||
$link .= $item->thumb_img(array("class" => "g-thumbnail")) . "</a>";
|
||||
if ($item->is_album() && $view_type == "album") {
|
||||
$link .= "<a href=\"" . $item->url() . "?show=" . $item->id .
|
||||
"\"><$parent_title_class><span></span>" . html::clean($item->title) .
|
||||
"</$parent_title_class></a>";
|
||||
} else if (!($item->is_album()) && $view_type == "dynamic") {
|
||||
$link .= "<a href=\"" . $item->parent()->url() . "?show=" . $item->id .
|
||||
"\" class=\"g-parent-album\"><$parent_title_class><span></span>" .
|
||||
html::clean($item->parent()->title) . "</$parent_title_class></a>";
|
||||
}
|
||||
|
||||
if (($item->is_photo() || $item->is_movie()) && $display_comment &&
|
||||
module::is_active("comment")) {
|
||||
$link .= "<ul class=\"g-metadata\"><li><a href=\"" .
|
||||
url::site("three_nids/show_comments/{$item->id}") .
|
||||
"\" class=\"iframe fancyclass g-hidden\">" . three_nids::comment_count($item) .
|
||||
" " . t("comments") . "</a></li></ul>";
|
||||
}
|
||||
} else {
|
||||
$link .= "</a>";
|
||||
}
|
||||
return $link;
|
||||
}
|
||||
|
||||
public function comment_count($item) {
|
||||
access::required("view", $item);
|
||||
|
||||
return ORM::factory("comment")
|
||||
->where("item_id", $item->id)
|
||||
->where("state", "published")
|
||||
->orderby("created", "DESC")
|
||||
->count_all();
|
||||
}
|
||||
}
|
||||
?>
|
11
themes/3nids_theme/modules/tagsmap/helpers/tagsmap_theme.php → themes/three_nids/helpers/three_nids_event.php
Executable file → Normal file
@ -17,8 +17,13 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class tagsmap_theme {
|
||||
static function head($theme) {
|
||||
$theme->css("tagsmap.css");
|
||||
class three_nids_event_Core {
|
||||
static function admin_menu($menu, $theme) {
|
||||
// Add a link to the three_nids admin page to the Content menu.
|
||||
$menu->get("appearance_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("three_nids")
|
||||
->label(t("3nids settings"))
|
||||
->url(url::site("admin/three_nids")));
|
||||
}
|
||||
}
|
6
themes/3nids_theme/modules/theme_3nids/helpers/theme_3nids_theme.php → themes/three_nids/helpers/three_nids_theme.php
Executable file → Normal file
@ -16,11 +16,9 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class theme_3nids_theme {
|
||||
|
||||
class three_nids_theme {
|
||||
static function credits($theme) {
|
||||
return "<a href=\"http://codex.gallery2.org/Gallery3:Themes:3nids\">3nids theme</a>";
|
||||
return "<a href=\"http://codex.gallery2.org/Gallery3:Themes:three_nids\">three_nids theme</a>";
|
||||
}
|
||||
|
||||
}
|
||||
|
0
themes/3nids_theme/3nids/images/avatar.jpg → themes/three_nids/images/avatar.jpg
Executable file → Normal file
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
0
themes/3nids_theme/3nids/images/fancy_closebox.png → themes/three_nids/images/fancy_closebox.png
Executable file → Normal file
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
0
themes/3nids_theme/3nids/images/fancy_left.png → themes/three_nids/images/fancy_left.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
themes/3nids_theme/3nids/images/fancy_progress.png → themes/three_nids/images/fancy_progress.png
Executable file → Normal file
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
themes/3nids_theme/3nids/images/fancy_right.png → themes/three_nids/images/fancy_right.png
Executable file → Normal file
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
0
themes/3nids_theme/3nids/images/fancy_shadow_e.png → themes/three_nids/images/fancy_shadow_e.png
Executable file → Normal file
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
0
themes/3nids_theme/3nids/images/fancy_shadow_n.png → themes/three_nids/images/fancy_shadow_n.png
Executable file → Normal file
Before Width: | Height: | Size: 129 B After Width: | Height: | Size: 129 B |
0
themes/3nids_theme/3nids/images/fancy_shadow_ne.png → themes/three_nids/images/fancy_shadow_ne.png
Executable file → Normal file
Before Width: | Height: | Size: 245 B After Width: | Height: | Size: 245 B |
0
themes/3nids_theme/3nids/images/fancy_shadow_nw.png → themes/three_nids/images/fancy_shadow_nw.png
Executable file → Normal file
Before Width: | Height: | Size: 207 B After Width: | Height: | Size: 207 B |
0
themes/3nids_theme/3nids/images/fancy_shadow_s.png → themes/three_nids/images/fancy_shadow_s.png
Executable file → Normal file
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 136 B |
0
themes/3nids_theme/3nids/images/fancy_shadow_se.png → themes/three_nids/images/fancy_shadow_se.png
Executable file → Normal file
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 239 B |
0
themes/3nids_theme/3nids/images/fancy_shadow_sw.png → themes/three_nids/images/fancy_shadow_sw.png
Executable file → Normal file
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 221 B |
0
themes/3nids_theme/3nids/images/fancy_shadow_w.png → themes/three_nids/images/fancy_shadow_w.png
Executable file → Normal file
Before Width: | Height: | Size: 140 B After Width: | Height: | Size: 140 B |
0
themes/3nids_theme/3nids/images/fancy_title_left.png → themes/three_nids/images/fancy_title_left.png
Executable file → Normal file
Before Width: | Height: | Size: 556 B After Width: | Height: | Size: 556 B |
0
themes/3nids_theme/3nids/images/fancy_title_main.png → themes/three_nids/images/fancy_title_main.png
Executable file → Normal file
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 149 B |
0
themes/3nids_theme/3nids/images/fancy_title_right.png → themes/three_nids/images/fancy_title_right.png
Executable file → Normal file
Before Width: | Height: | Size: 559 B After Width: | Height: | Size: 559 B |
0
themes/3nids_theme/3nids/images/ico-album.png → themes/three_nids/images/ico-album.png
Executable file → Normal file
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 3.5 KiB |
0
themes/3nids_theme/3nids/images/ico-help.png → themes/three_nids/images/ico-help.png
Executable file → Normal file
Before Width: | Height: | Size: 786 B After Width: | Height: | Size: 786 B |
0
themes/3nids_theme/3nids/images/ico-print.png → themes/three_nids/images/ico-print.png
Executable file → Normal file
Before Width: | Height: | Size: 989 B After Width: | Height: | Size: 989 B |