Permalink
Browse files

make it work with 5.7

  • Loading branch information...
Remo committed Sep 13, 2014
1 parent ed0be07 commit fa0895081b62fbbb53d8e79c00858619fcec1fd4
@@ -1,10 +1,16 @@
<?php
Loader::block('library_file');
namespace Concrete\Package\ZoomImage\Block\ZoomImage;
use \Concrete\Core\Block\BlockType\BlockType,
\Concrete\Core\Block\BlockController,
\Concrete\Core\File\File,
\Concrete\Core\View\View,
Loader;
defined('C5_EXECUTE') or die(_("Access Denied."));
class ZoomImageBlockController extends BlockController {
class Controller extends BlockController {
protected $btInterfaceWidth = 450;
protected $btInterfaceHeight = 500;
@@ -38,8 +44,8 @@ public function on_page_view() {
$uh = Loader::helper('concrete/urls');
$v->addHeaderItem('<script type="text/javascript" src="' . $uh->getBlockTypeAssetsURL($bt) . '/fancyzoom.min.js"></script>', 'CONTROLLER');
$v->addHeaderItem('<script type="text/javascript">$(document).ready(function() { $("a.zoomImage").fancyZoom({scaleImg: true, closeOnClick: true, directory:"' . $uh->getBlockTypeAssetsURL($bt) . '/images"}); });</script>', 'CONTROLLER');
$v->addFooterItem('<script type="text/javascript" src="' . $uh->getBlockTypeAssetsURL($bt) . '/fancyzoom.min.js"></script>');
$v->addFooterItem('<script type="text/javascript">$(document).ready(function() { $("a.zoomImage").fancyZoom({scaleImg: true, closeOnClick: true, directory:"' . $uh->getBlockTypeAssetsURL($bt) . '/images"}); });</script>');
}
function getFileID() {
@@ -65,6 +71,18 @@ public function save($args) {
$args['limitMaxZoom'] = empty($args['limitMaxZoom']) ? 0 : 1;
parent::save($args);
}
public function view() {
$ih = Loader::helper('image');
$fileObject = $this->getFileObject();
$fileName = $fileObject->getRelativePath();
$thumbnail = $ih->getThumbnail($fileObject, intval($this->thumbnailWidth), intval($this->thumbnailHeight));
$this->set('fileName', $fileName);
$this->set('thumbnail', $thumbnail);
}
}
@@ -102,7 +102,6 @@ function show(e) {
height: '1px'
});
fixBackgroundsForIE();
zoom_close.hide();
if (options.closeOnClick) {
@@ -131,7 +130,6 @@ function show(e) {
if (options.scaleImg != true) {
zoom_content.html(content_div.html());
}
unfixBackgroundsForIE();
zoom_close.show();
zooming = false;
}
@@ -149,7 +147,6 @@ function hide() {
}
zooming = true;
$('#zoom').unbind('click');
fixBackgroundsForIE();
if (zoom_close.attr('scaleImg') != 'true') {
zoom_content.html('');
}
@@ -168,7 +165,6 @@ function hide() {
if (zoom_close.attr('scaleImg') == 'true') {
zoom_content.html('');
}
unfixBackgroundsForIE();
zooming = false;
if(current_zoom.data('hide-original-on-zoom') === 'yes') {
current_zoom.css('visibility', current_zoom.data('fancyzoom.initial-visibility'));
@@ -189,16 +185,4 @@ function switchBackgroundImagesTo(to) {
close_img.attr('src', new_img);
}
function fixBackgroundsForIE() {
if ($.browser.msie && parseFloat($.browser.version) >= 7) {
switchBackgroundImagesTo('gif');
}
}
function unfixBackgroundsForIE() {
if ($.browser.msie && $.browser.version >= 7) {
switchBackgroundImagesTo('png');
}
}
};

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,34 +1,17 @@
<?php
defined('C5_EXECUTE') or die('Access Denied.');
$version_arr = explode('.', APP_VERSION);
if ($version_arr[1] < 2)
die("This block doesn't support concrete" . APP_VERSION);
if ($version_arr[1] == 2) {
$fo = $controller->getAssetFileObject();
$fileName = $fo->getFileRelativePath();
$thumbnail = $fo->getThumbnail(intval($controller->thumbnailWidth), intval($controller->thumbnailHeight));
} else {
$ih = Loader::helper('image');
$fo = $controller->getFileObject();
$fileName = $fo->getRelativePath();
$thumbnail = $ih->getThumbnail($fo, intval($controller->thumbnailWidth), intval($controller->thumbnailHeight));
}
?>
<a class="zoomImage" href="#zoomImage<?php echo $bID;?>"<?php echo empty($hideOriginalOnZoom) ? '' : ' data-hide-original-on-zoom="yes"'; ?><?php echo empty($limitMaxZoom) ? '' : ' data-limit-max-zoom="yes"'; ?>>
<img src="<?php echo $thumbnail->src;?>"
alt="<?php echo $controller->altText;?>"
alt="<?php echo $altText;?>"
width="<?php echo $thumbnail->width;?>"
height="<?php echo $thumbnail->height;?>"/>
height="<?php echo $thumbnail->height;?>"/>
</a>
<div id="zoomImage<?php echo $bID;?>" style="display:none;">
<img src="<?php echo $fileName;?>" alt="<?php echo $controller->altText;?>"/>
<?php if ($controller->displayCaption):?>
<p id="zoomImage<?php echo $bID;?>_caption"><?php echo $controller->altText;?></p>
<img src="<?php echo $fileName;?>" alt="<?php echo $altText;?>"/>
<?php if ($displayCaption):?>
<p id="zoomImage<?php echo $bID;?>_caption"><?php echo $altText;?></p>
<?php endif;?>
</div>
View
@@ -1,12 +1,16 @@
<?php
defined('C5_EXECUTE') or die(_("Access Denied."));
namespace Concrete\Package\ZoomImage;
class ZoomImagePackage extends Package {
use Concrete\Core\Block\BlockType\BlockType;
defined('C5_EXECUTE') or die('Access Denied.');
class Controller extends \Concrete\Core\Package\Package {
protected $pkgHandle = 'zoom_image';
protected $appVersionRequired = '5.2.0';
protected $pkgVersion = '1.0.7';
protected $pkgVersion = '2.0.0';
public function getPackageDescription() {
return t("Adds images and onstates from the library to pages.");
@@ -23,12 +27,5 @@ public function install() {
BlockType::installBlockTypeFromPackage('zoom_image', $pkg);
}
public function upgrade() {
parent::upgrade();
$bt = BlockType::getByHandle('zoom_image');
if(is_object($bt)) {
$bt->refresh();
}
}
}

0 comments on commit fa08950

Please sign in to comment.