1
0

Context menu of videos and photos inside the Lightbox theme!

This commit is contained in:
3nids 2009-10-26 09:04:17 +01:00
parent 5cf9132b6e
commit eec915b887
9 changed files with 114 additions and 17 deletions

View File

@ -19,6 +19,7 @@
.g-fancy-iframe-body{
background-color: #333333;
height: auto;
}
#mod_frame{

View File

@ -128,14 +128,14 @@
});
}
} else if (href.match("iframe") || opts.itemArray[opts.itemCurrent].fancyclass.indexOf("iframe") >= 0) {
if (href.match('width=') && href.match('height=')){
var ifrWidth = parseInt(href.substring(href.indexOf('width=')+6,href.indexOf('endwidth')))+20;
var ifrHeight = parseInt(href.substring(href.indexOf('height=')+7,href.indexOf('endheight')))+50;
if (href.match('w=') && href.match('h=')){
var ifrWidth = parseInt(href.substring(href.indexOf('w=')+2,href.indexOf('xewx')));
var ifrHeight = parseInt(href.substring(href.indexOf('h=')+2,href.indexOf('xehx')));
}else{
var ifrWidth= opts.frameWidth;
var ifrHeight= opts.frameHeight;
}
$("#fancy_content").empty();
_set_content('<iframe id="fancy_frame" onload="$.fn.fancybox.showIframe()" name="fancy_iframe' + Math.round(Math.random()*1000) + '" frameborder="0" hspace="0" src="' + href + '"></iframe>', ifrWidth, ifrHeight);
} else {
@ -181,7 +181,14 @@
};
function _set_content(value, width, height) {
busy = true;
var w = $.fn.fancybox.getViewport();
var r = Math.min(Math.min(w[0]-36, width) / width, Math.min(w[1]-50, height )/ height);
var width = Math.round(r * width);
var height = Math.round(r * height);
var pad = opts.padding;
@ -214,7 +221,7 @@
'right' : 0,
'bottom' : 0,
'left' : 0,
'width' : '100%',
'width' : '100%',
'height' : '100%'
});
}
@ -228,8 +235,7 @@
return;
}
var w = $.fn.fancybox.getViewport();
var itemLeft = (width + 36) > w[0] ? w[2] : (w[2] + Math.round((w[0] - width - 36) / 2));
var itemTop = (height + 50) > w[1] ? w[3] : (w[3] + Math.round((w[1] - height - 50) / 2));
@ -420,6 +426,17 @@
$.fn.fancybox.showIframe = function() {
$(".fancy_loading").hide();
$("#fancy_frame").show();
var w = $.fn.fancybox.getViewport();
var img = $("#fancy_frame").contents().find("#g-item-img");
if (img.length){
var width = img.width();
var height = img.height();
var ir = Math.min(Math.min(w[0]-36, width) / width, Math.min(w[1]-50, height) / height);
var width = Math.round(ir * width);
var height = Math.round(ir * height);
$("#fancy_frame").contents().find("#g-item-img").width(width);
$("#fancy_frame").contents().find("#g-item-img").height(height);
}
};
$.fn.fancybox.getViewport = function() {
@ -460,6 +477,7 @@
}
$("#fancy_close, .fancy_loading, #fancy_left, #fancy_right, #fancy_title, #fancy_modules").hide();
$("#fancy_content").empty();
if (opts.centerOnScroll) {
$(window).unbind("resize scroll");

View File

@ -91,6 +91,12 @@ $(document).ready(function() {
}
);
}
// Photo/Item item view lightbox
if ($("#g-item-box").length) {
$(this).gallery_context_menu();
}
// Photo/Item item view
if ($("#g-item").length) {

View File

@ -31,7 +31,7 @@
</head>
<body class="g-fancy-iframe-body">
<center>
<div id="g-item">
<div id="g-item-box" width="<?=20+($item->width)?>" height="<?=50+($item->height)?>">
<?= html::anchor($item->file_url(true), "", $attrs) ?>
<script>
@ -55,6 +55,7 @@
)
</script>
<?= $theme->context_menu($item, "#g-movie-id-{$item->id}") ?>
<div id="g-info">
<h1><?= html::purify($item->title) ?></h1>

View File

@ -0,0 +1,38 @@
<?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 id="g-item-box">
<img src="<?=$item->file_url()?>" id="g-item-img">
<?= $theme->context_menu($item, "#g-item-id-{$item->id}") ?>
</div>
</body>
</html>

View File

@ -1 +1 @@
updated README
Context menu of videos and photos inside the Lightbox theme!

View File

@ -25,9 +25,8 @@ class Movie_3nids_Controller extends REST_Controller {
* 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);
public function show($item_id) {
$item = ORM::factory("item", $item_id);
access::required("view", $item);
$view = new Theme_View("movie_3nids.html", "page");

View File

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

View File

@ -39,9 +39,9 @@ class theme_3nids_Core {
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=\"" . $item->file_url() ."\" rel=\"fancygroup\" class=\"fancyclass\" title=\"" . $item->parent()->title .", " . $item->parent()->description ."\" name=\"" . $fancymodule . " \">";
$link .= "<a href=\"" . url::site("photo_3nids/show/{$item->id}") ."/?w=" . $item->width . "xewx&h=" . $item->height . "xehx\" rel=\"fancygroup\" class=\"fancyclass iframe\" title=\"" . $item->parent()->title .", " . $item->parent()->description ."\" name=\"" . $fancymodule . " \">";
}else{
$link .= "<a href=\"" . url::site("movie_3nids?item_id={$item->id}") . "&width=" . $item->width . "endwidth&height=" . $item->height . "endheight\" rel=\"fancygroup\" class=\"fancyclass iframe\" title=\"" . $item->parent()->title .", " . $item->parent()->description ."\" name=\"" . $fancymodule . " \">";
$link .= "<a href=\"" . url::site("movie_3nids/show/{$item->id}") . "/?w=" . strval(20+($item->width)) . "xewx&h=" . strval(50+($item->height)) . "xehx\" rel=\"fancygroup\" class=\"fancyclass iframe\" title=\"" . $item->parent()->title .", " . $item->parent()->description ."\" name=\"" . $fancymodule . " \">";
}
} elseif( $item->is_album() && $viewtype != "header"){
$link .= "<a href=\"" . $item->url() . "\">";
@ -54,9 +54,6 @@ class theme_3nids_Core {
} elseif ( !($item->is_album()) && $viewtype == "dynamic") {
$link .= "<a href=\"" . $item->parent()->url() . "?show=" . $item->id . "\"><h2><span></span>" . html::clean($item->parent()->title) . "</h2></a>";
}
if ( !($item->is_album()) && $user->admin) {
$link .= "<a href=\"" . $item->url() ."\">edit</a>";
}
if (($item->is_photo() || $item->is_movie()) && 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\">" . comment_3nids::count($item) . t("comments") . "</a></li></ul>";