Commit 66e7468a authored by Robert Lyon's avatar Robert Lyon

Bug 1785938: Fixing gallery and changing slimbox2 to fancybox3

Things done with this patch:

1) Changed the 'Use photo frame' option from being a plugin variable
   to being an instance config variable

2) Added back in the css for the giving the gallery images photo frame
   borders

3) Get the non-square thumbs to render correctly spaced on load

4) Swapped the slimbox2 to fancybox3 and allowed the block itself to
control when to put content into head data

behatnotneeded

Change-Id: I397be45f2347588988b663b25b560d8ab876afe1
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 3b8a5cf8
......@@ -32,8 +32,8 @@ $string['showdescriptionsdescription'] = 'Select to caption each image with its
$string['cannotdisplayslideshow'] = 'Cannot display slideshow.';
$string['gallerysettings'] = 'Gallery settings';
$string['useslimbox2'] = 'Use Slimbox 2';
$string['useslimbox2desc2'] = 'Use Slimbox 2 in your gallery. When you click on images in your gallery, they will open in an overlay on the current page.';
$string['usefancybox'] = 'Use Fancybox 3';
$string['usefancyboxdesc'] = 'Use Fancybox 3 in your gallery. When you click on images in your gallery, they will open in an overlay on the current page.';
$string['photoframe'] = 'Use photo frame';
$string['photoframedesc2'] = 'Show a frame around the thumbnail of each photo in the gallery.';
$string['previewwidth'] = 'Maximum photo width';
......@@ -63,3 +63,16 @@ $string['picasaalbums'] = 'Picasa albums';
$string['windowslivephotoalbums'] = 'Windows Live photo gallery albums';
$string['externalnotsupported'] = 'The external URL you provided is not supported';
// Fancybox 3
$string['CLOSE'] = "Close";
$string['NEXT'] = "Next";
$string['PREV'] = "Previous";
$string['ERROR'] = "The requested content cannot be loaded. <br/> Please try again later.";
$string['PLAY_START'] = "Start slideshow";
$string['PLAY_STOP'] = "Pause slideshow";
$string['FULL_SCREEN'] = "Full screen";
$string['THUMBS'] = "Thumbnails";
$string['DOWNLOAD'] = "Download";
$string['SHARE'] = "Share";
$string['ZOOM'] = "Zoom";
\ No newline at end of file
......@@ -28,7 +28,48 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
}
public static function get_instance_javascript(BlockInstance $instance) {
return array();
$blockid = $instance->get('id');
// The initjs for the fancybox will be applied to all galleries on the page
return array(
array(
'file' => get_config('wwwroot') . 'js/fancybox/jquery.fancybox.min.js',
'initjs' => " $('[data-fancybox]').fancybox({
buttons : [
'zoom',
'slideShow',
'download',
'close'
],
loop : true,
lang : '" . current_language() . "',
i18n : {
'" . current_language() . "' : {
CLOSE: \"" . get_string('CLOSE', 'blocktype.file/gallery') . "\",
NEXT: \"" . get_string('NEXT', 'blocktype.file/gallery') . "\",
PREV: \"" . get_string('PREV', 'blocktype.file/gallery') . "\",
ERROR: \"" . get_string('ERROR', 'blocktype.file/gallery') . "\",
PLAY_START: \"" . get_string('PLAY_START', 'blocktype.file/gallery') . "\",
PLAY_STOP: \"" . get_string('PLAY_STOP', 'blocktype.file/gallery') . "\",
FULL_SCREEN: \"" . get_string('FULL_SCREEN', 'blocktype.file/gallery') . "\",
THUMBS: \"" . get_string('THUMBS', 'blocktype.file/gallery') . "\",
DOWNLOAD: \"" . get_string('DOWNLOAD', 'blocktype.file/gallery') . "\",
SHARE: \"" . get_string('SHARE', 'blocktype.file/gallery') . "\",
ZOOM: \"" . get_string('ZOOM', 'blocktype.file/gallery') . "\"
}
}
});"
),
array(
'file' => get_config('wwwroot') . 'js/masonry/masonry.min.js',
'initjs' => " $('.js-masonry.thumbnails').masonry({ itemSelector: '.thumb' });"
)
);
}
public static function get_instance_css(BlockInstance $instance) {
return array(
get_config('wwwroot') . 'js/fancybox/jquery.fancybox.min.css'
);
}
public static function get_instance_config_javascript(BlockInstance $instance) {
......@@ -58,13 +99,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
}
$images = array();
$slimbox2 = get_config_plugin('blocktype', 'gallery', 'useslimbox2');
if ($slimbox2) {
$slimbox2attr = 'lightbox_' . $instance->get('id');
}
else {
$slimbox2attr = null;
}
$fancyboxattr = get_config_plugin('blocktype', 'gallery', 'usefancybox') ? 'lightbox_' . $instance->get('id') : null;
// if we're trying to embed external gallery (thumbnails or slideshow)
if (isset($configdata['select']) && $configdata['select'] == 2) {
......@@ -136,7 +171,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'link' => str_replace($small, $big, $thumb),
'source' => $thumb,
'title' => $description,
'slimbox2' => $slimbox2attr
'fancybox' => $fancyboxattr
);
}
}
......@@ -182,7 +217,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'link' => $link,
'source' => $thumb,
'title' => $description,
'slimbox2' => $slimbox2attr
'fancybox' => $fancyboxattr
);
}
}
......@@ -223,7 +258,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'link' => $link,
'source' => $thumb,
'title' => $description,
'slimbox2' => $slimbox2attr
'fancybox' => $fancyboxattr
);
}
}
......@@ -291,7 +326,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'link' => $link,
'source' => $thumb,
'title' => $description,
'slimbox2' => $slimbox2attr
'fancybox' => $fancyboxattr
);
}
}
......@@ -321,7 +356,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'link' => str_replace(array('\x3a','\x2f','\x25','\x3fpsid\x3d1'), array(':','/','%',''), $photos[1][$i]),
'source' => str_replace(array('\x3a','\x2f','\x25','\x3fpsid\x3d1'), array(':','/','%',''), $thumbs[1][$i]),
'title' => null,
'slimbox2' => $slimbox2attr
'fancybox' => $fancyboxattr
);
}
}
......@@ -360,7 +395,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
continue;
}
if ($slimbox2) {
if ($fancyboxattr) {
$link = $src . '&maxwidth=' . get_config_plugin('blocktype', 'gallery', 'previewwidth');
}
else {
......@@ -371,7 +406,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
if ($style == 2) {
// Determine the scaling for the fitting the image in the square of $width size
// Calculate the bigger, width vs height, to work out the ratio
$configwidth = $width - (get_config_plugin('blocktype', 'gallery', 'photoframe') ? 8 : 0); // $width - photo frame padding
$configwidth = $width - (!empty($configdata['photoframe']) ? 8 : 0); // $width - photo frame padding
$imagewidth = $image->get('width');
$imageheight = $image->get('height');
if ($imagewidth > $imageheight) {
......@@ -404,7 +439,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'height' => $height,
'width' => (!empty($ratiowidth) ? $ratiowidth : null),
'title' => $image->get('description'),
'slimbox2' => $slimbox2attr,
'fancybox' => $fancyboxattr,
'squaredimensions' => $width,
'squaretop' => (!empty($topoffset) ? $topoffset : null),
);
......@@ -423,7 +458,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
if (isset($needsapikey)) {
$smarty->assign('needsapikey', $needsapikey);
}
$smarty->assign('frame', get_config_plugin('blocktype', 'gallery', 'photoframe'));
$smarty->assign('frame', !empty($configdata['photoframe']));
$smarty->assign('copyright', $copyright);
if (!empty($configdata['artefactid'])) {
$artefact = $instance->get_artefact_instance($configdata['artefactid']);
......@@ -449,17 +484,11 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'legend' => get_string('gallerysettings', 'blocktype.file/gallery'),
'collapsible' => true,
'elements' => array(
'useslimbox2' => array(
'type' => 'switchbox',
'title' => get_string('useslimbox2', 'blocktype.file/gallery'),
'description' => get_string('useslimbox2desc2', 'blocktype.file/gallery'),
'defaultvalue' => get_config_plugin('blocktype', 'gallery', 'useslimbox2'),
),
'photoframe' => array(
'usefancybox' => array(
'type' => 'switchbox',
'title' => get_string('photoframe', 'blocktype.file/gallery'),
'description' => get_string('photoframedesc2', 'blocktype.file/gallery'),
'defaultvalue' => get_config_plugin('blocktype', 'gallery', 'photoframe'),
'title' => get_string('usefancybox', 'blocktype.file/gallery'),
'description' => get_string('usefancyboxdesc', 'blocktype.file/gallery'),
'defaultvalue' => get_config_plugin('blocktype', 'gallery', 'usefancybox'),
),
'previewwidth' => array(
'type' => 'text',
......@@ -517,8 +546,7 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
}
public static function save_config_options(Pieform $form, $values) {
set_config_plugin('blocktype', 'gallery', 'useslimbox2', (int)$values['useslimbox2']);
set_config_plugin('blocktype', 'gallery', 'photoframe', (int)$values['photoframe']);
set_config_plugin('blocktype', 'gallery', 'usefancybox', (int)$values['usefancybox']);
set_config_plugin('blocktype', 'gallery', 'previewwidth', (int)$values['previewwidth']);
set_config_plugin('blocktype', 'gallery', 'flickrapikey', $values['flickrapikey']);
set_config_plugin('blocktype', 'gallery', 'pbapikey', $values['pbapikey']);
......@@ -527,9 +555,8 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
public static function postinst($prevversion) {
if ($prevversion == 0) {
set_config_plugin('blocktype', 'gallery', 'useslimbox2', 1); // Use Slimbox 2 by default
set_config_plugin('blocktype', 'gallery', 'photoframe', 1); // Show frame around photos
set_config_plugin('blocktype', 'gallery', 'previewwidth', 1024); // Maximum photo width for slimbox2 preview
set_config_plugin('blocktype', 'gallery', 'usefancybox', 1); // Use Fancybox 3 by default
set_config_plugin('blocktype', 'gallery', 'previewwidth', 1024); // Maximum photo width for fancybox preview
}
}
......@@ -596,6 +623,12 @@ class PluginBlocktypeGallery extends MaharaCoreBlocktype {
'description' => get_string('showdescriptionsdescription', 'blocktype.file/gallery'),
'defaultvalue' => !empty($configdata['showdescription']) ? true : false,
),
'photoframe' => array(
'type' => 'switchbox',
'title' => get_string('photoframe', 'blocktype.file/gallery'),
'description' => get_string('photoframedesc2', 'blocktype.file/gallery'),
'defaultvalue' => !empty($configdata['photoframe']) ? true : false,
),
'width' => array(
'type' => 'text',
'title' => get_string('width', 'blocktype.file/gallery'),
......
......@@ -188,6 +188,15 @@ abstract class PluginBlocktype extends Plugin implements IPluginBlocktype {
return array();
}
/**
* This function must be implemented in the subclass if it requires
* css file outside of sass compiled css. It returns an array of css files, either local
* or remote.
*/
public static function get_instance_css(BlockInstance $instance) {
return array();
}
/**
* Inline js to be executed when a block is rendered.
*/
......@@ -1028,7 +1037,7 @@ class BlockInstance {
$smarty->assign('row', $this->get('row'));
$smarty->assign('column', $this->get('column'));
$smarty->assign('order', $this->get('order'));
$smarty->assign('blocktype', $this->get('blocktype'));
$smarty->assign('movecontrols', $movecontrols);
$smarty->assign('configurable', call_static_method($blocktypeclass, 'has_instance_config'));
$smarty->assign('configure', $configure); // Used by the javascript to rewrite the block, wider.
......
......@@ -47,14 +47,6 @@ if ($USER->is_logged_in()) {
$skin = false;
}
// include slimbox2 js and css files, if it is enabled...
if (get_config_plugin('blocktype', 'gallery', 'useslimbox2')) {
$langdir = (get_string('thisdirection', 'langconfig') == 'rtl' ? '-rtl' : '');
$stylesheets = array_merge($stylesheets, array('<script type="application/javascript" src="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/js/slimbox2.js') . '"></script>',
'<link rel="stylesheet" type="text/css" href="' . append_version_number(get_config('wwwroot') . 'lib/slimbox2/css/slimbox2' . $langdir . '.css') . '">'
));
}
$viewcontent = $view->build_rows(); // Build content before initialising smarty in case pieform elements define headers.
$smarty = smarty(
$javascript,
......
Fancybox in Mahara
==================
Website: https://fancyapps.com/fancybox/3/
Version: 3.3.5
Installation:
* Copied the dist/jquery.fancybox.min.js and dist/jquery.fancybox.min.css to here
Changes:
* None
body.compensate-for-scrollbar{overflow:hidden}.fancybox-active{height:auto}.fancybox-is-hidden{left:-9999px;margin:0;position:absolute!important;top:-9999px;visibility:hidden}.fancybox-container{-webkit-backface-visibility:hidden;backface-visibility:hidden;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,sans-serif;height:100%;left:0;position:fixed;-webkit-tap-highlight-color:transparent;top:0;-webkit-transform:translateZ(0);transform:translateZ(0);width:100%;z-index:99992}.fancybox-container *{box-sizing:border-box}.fancybox-bg,.fancybox-inner,.fancybox-outer,.fancybox-stage{bottom:0;left:0;position:absolute;right:0;top:0}.fancybox-outer{-webkit-overflow-scrolling:touch;overflow-y:auto}.fancybox-bg{background:#1e1e1e;opacity:0;transition-duration:inherit;transition-property:opacity;transition-timing-function:cubic-bezier(.47,0,.74,.71)}.fancybox-is-open .fancybox-bg{opacity:.87;transition-timing-function:cubic-bezier(.22,.61,.36,1)}.fancybox-caption,.fancybox-infobar,.fancybox-navigation .fancybox-button,.fancybox-toolbar{direction:ltr;opacity:0;position:absolute;transition:opacity .25s,visibility 0s linear .25s;visibility:hidden;z-index:99997}.fancybox-show-caption .fancybox-caption,.fancybox-show-infobar .fancybox-infobar,.fancybox-show-nav .fancybox-navigation .fancybox-button,.fancybox-show-toolbar .fancybox-toolbar{opacity:1;transition:opacity .25s,visibility 0s;visibility:visible}.fancybox-infobar{color:#ccc;font-size:13px;-webkit-font-smoothing:subpixel-antialiased;height:44px;left:0;line-height:44px;min-width:44px;mix-blend-mode:difference;padding:0 10px;pointer-events:none;text-align:center;top:0;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.fancybox-toolbar{right:0;top:0}.fancybox-stage{direction:ltr;overflow:visible;-webkit-transform:translateZ(0);z-index:99994}.fancybox-is-open .fancybox-stage{overflow:hidden}.fancybox-slide{-webkit-backface-visibility:hidden;backface-visibility:hidden;display:none;height:100%;left:0;outline:none;overflow:auto;-webkit-overflow-scrolling:touch;padding:44px;position:absolute;text-align:center;top:0;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform;white-space:normal;width:100%;z-index:99994}.fancybox-slide:before{content:"";display:inline-block;height:100%;margin-right:-.25em;vertical-align:middle;width:0}.fancybox-is-sliding .fancybox-slide,.fancybox-slide--current,.fancybox-slide--next,.fancybox-slide--previous{display:block}.fancybox-slide--next{z-index:99995}.fancybox-slide--image{overflow:visible;padding:44px 0}.fancybox-slide--image:before{display:none}.fancybox-slide--html{padding:6px 6px 0}.fancybox-slide--iframe{padding:44px 44px 0}.fancybox-content{background:#fff;display:inline-block;margin:0 0 6px;max-width:100%;overflow:auto;padding:0;padding:24px;position:relative;text-align:left;vertical-align:middle}.fancybox-slide--image .fancybox-content{-webkit-animation-timing-function:cubic-bezier(.5,0,.14,1);animation-timing-function:cubic-bezier(.5,0,.14,1);-webkit-backface-visibility:hidden;backface-visibility:hidden;background:transparent;background-repeat:no-repeat;background-size:100% 100%;left:0;margin:0;max-width:none;overflow:visible;padding:0;position:absolute;top:0;-webkit-transform-origin:top left;transform-origin:top left;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:99995}.fancybox-can-zoomOut .fancybox-content{cursor:zoom-out}.fancybox-can-zoomIn .fancybox-content{cursor:zoom-in}.fancybox-can-drag .fancybox-content{cursor:-webkit-grab;cursor:grab}.fancybox-is-dragging .fancybox-content{cursor:-webkit-grabbing;cursor:grabbing}.fancybox-container [data-selectable=true]{cursor:text}.fancybox-image,.fancybox-spaceball{background:transparent;border:0;height:100%;left:0;margin:0;max-height:none;max-width:none;padding:0;position:absolute;top:0;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%}.fancybox-spaceball{z-index:1}.fancybox-slide--html .fancybox-content{margin-bottom:6px}.fancybox-slide--iframe .fancybox-content,.fancybox-slide--map .fancybox-content,.fancybox-slide--video .fancybox-content{height:100%;margin:0;overflow:visible;padding:0;width:100%}.fancybox-slide--video .fancybox-content{background:#000}.fancybox-slide--map .fancybox-content{background:#e5e3df}.fancybox-slide--iframe .fancybox-content{background:#fff;height:calc(100% - 44px);margin-bottom:44px}.fancybox-iframe,.fancybox-video{background:transparent;border:0;height:100%;margin:0;overflow:hidden;padding:0;width:100%}.fancybox-iframe{vertical-align:top}.fancybox-error{background:#fff;cursor:default;max-width:400px;padding:40px;width:100%}.fancybox-error p{color:#444;font-size:16px;line-height:20px;margin:0;padding:0}.fancybox-button{background:rgba(30,30,30,.6);border:0;border-radius:0;cursor:pointer;display:inline-block;height:44px;margin:0;outline:none;padding:10px;transition:color .2s;vertical-align:top;width:44px}.fancybox-button,.fancybox-button:link,.fancybox-button:visited{color:#ccc}.fancybox-button:focus,.fancybox-button:hover{color:#fff}.fancybox-button.disabled,.fancybox-button.disabled:hover,.fancybox-button[disabled],.fancybox-button[disabled]:hover{color:#888;cursor:default}.fancybox-button svg{display:block;overflow:visible;position:relative;shape-rendering:geometricPrecision}.fancybox-button svg path{fill:transparent;stroke:currentColor;stroke-linejoin:round;stroke-width:3}.fancybox-button--pause svg path:nth-child(1),.fancybox-button--play svg path:nth-child(2){display:none}.fancybox-button--play svg path,.fancybox-button--share svg path,.fancybox-button--thumbs svg path{fill:currentColor}.fancybox-button--share svg path{stroke-width:1}.fancybox-navigation .fancybox-button{height:38px;opacity:0;padding:6px;position:absolute;top:50%;width:38px}.fancybox-show-nav .fancybox-navigation .fancybox-button{transition:opacity .25s,visibility 0s,color .25s}.fancybox-navigation .fancybox-button:after{content:"";left:-25px;padding:50px;position:absolute;top:-25px}.fancybox-navigation .fancybox-button--arrow_left{left:6px}.fancybox-navigation .fancybox-button--arrow_right{right:6px}.fancybox-close-small{background:transparent;border:0;border-radius:0;color:#555;cursor:pointer;height:44px;margin:0;padding:6px;position:absolute;right:0;top:0;width:44px;z-index:10}.fancybox-close-small svg{fill:transparent;opacity:.8;stroke:currentColor;stroke-width:1.5;transition:stroke .1s}.fancybox-close-small:focus{outline:none}.fancybox-close-small:hover svg{opacity:1}.fancybox-slide--iframe .fancybox-close-small,.fancybox-slide--image .fancybox-close-small,.fancybox-slide--video .fancybox-close-small{color:#ccc;padding:5px;right:-12px;top:-44px}.fancybox-slide--iframe .fancybox-close-small:hover svg,.fancybox-slide--image .fancybox-close-small:hover svg,.fancybox-slide--video .fancybox-close-small:hover svg{background:transparent;color:#fff}.fancybox-is-scaling .fancybox-close-small,.fancybox-is-zoomable.fancybox-can-drag .fancybox-close-small{display:none}.fancybox-caption{bottom:0;color:#fff;font-size:14px;font-weight:400;left:0;line-height:1.5;padding:25px 44px;right:0}.fancybox-caption:before{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAEtCAQAAABjBcL7AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHRJREFUKM+Vk8EOgDAIQ0vj/3+xBw8qIZZueFnIKC90MCAI8DlrkHGeqqGIU6lVigrBtpCWqeRWoHDNqs0F7VNVBVxmHRlvoVqjaYkdnDIaivH2HqZ5+oZj3JUzWB+cOz4G48Bg+tsJ/tqu4dLC/4Xb+0GcF5BwBC0AA53qAAAAAElFTkSuQmCC);background-repeat:repeat-x;background-size:contain;bottom:0;content:"";display:block;left:0;pointer-events:none;position:absolute;right:0;top:-25px;z-index:-1}.fancybox-caption:after{border-bottom:1px solid hsla(0,0%,100%,.3);content:"";display:block;left:44px;position:absolute;right:44px;top:0}.fancybox-caption a,.fancybox-caption a:link,.fancybox-caption a:visited{color:#ccc;text-decoration:none}.fancybox-caption a:hover{color:#fff;text-decoration:underline}.fancybox-loading{-webkit-animation:a .8s infinite linear;animation:a .8s infinite linear;background:transparent;border:6px solid hsla(0,0%,39%,.5);border-radius:100%;border-top-color:#fff;height:60px;left:50%;margin:-30px 0 0 -30px;opacity:.6;padding:0;position:absolute;top:50%;width:60px;z-index:99999}@-webkit-keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes a{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}to{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fancybox-animated{transition-timing-function:cubic-bezier(0,0,.25,1)}.fancybox-fx-slide.fancybox-slide--previous{opacity:0;-webkit-transform:translate3d(-100%,0,0);transform:translate3d(-100%,0,0)}.fancybox-fx-slide.fancybox-slide--next{opacity:0;-webkit-transform:translate3d(100%,0,0);transform:translate3d(100%,0,0)}.fancybox-fx-slide.fancybox-slide--current{opacity:1;-webkit-transform:translateZ(0);transform:translateZ(0)}.fancybox-fx-fade.fancybox-slide--next,.fancybox-fx-fade.fancybox-slide--previous{opacity:0;transition-timing-function:cubic-bezier(.19,1,.22,1)}.fancybox-fx-fade.fancybox-slide--current{opacity:1}.fancybox-fx-zoom-in-out.fancybox-slide--previous{opacity:0;-webkit-transform:scale3d(1.5,1.5,1.5);transform:scale3d(1.5,1.5,1.5)}.fancybox-fx-zoom-in-out.fancybox-slide--next{opacity:0;-webkit-transform:scale3d(.5,.5,.5);transform:scale3d(.5,.5,.5)}.fancybox-fx-zoom-in-out.fancybox-slide--current{opacity:1;-webkit-transform:scaleX(1);transform:scaleX(1)}.fancybox-fx-rotate.fancybox-slide--previous{opacity:0;-webkit-transform:rotate(-1turn);transform:rotate(-1turn)}.fancybox-fx-rotate.fancybox-slide--next{opacity:0;-webkit-transform:rotate(1turn);transform:rotate(1turn)}.fancybox-fx-rotate.fancybox-slide--current{opacity:1;-webkit-transform:rotate(0deg);transform:rotate(0deg)}.fancybox-fx-circular.fancybox-slide--previous{opacity:0;-webkit-transform:scale3d(0,0,0) translate3d(-100%,0,0);transform:scale3d(0,0,0) translate3d(-100%,0,0)}.fancybox-fx-circular.fancybox-slide--next{opacity:0;-webkit-transform:scale3d(0,0,0) translate3d(100%,0,0);transform:scale3d(0,0,0) translate3d(100%,0,0)}.fancybox-fx-circular.fancybox-slide--current{opacity:1;-webkit-transform:scaleX(1) translateZ(0);transform:scaleX(1) translateZ(0)}.fancybox-fx-tube.fancybox-slide--previous{-webkit-transform:translate3d(-100%,0,0) scale(.1) skew(-10deg);transform:translate3d(-100%,0,0) scale(.1) skew(-10deg)}.fancybox-fx-tube.fancybox-slide--next{-webkit-transform:translate3d(100%,0,0) scale(.1) skew(10deg);transform:translate3d(100%,0,0) scale(.1) skew(10deg)}.fancybox-fx-tube.fancybox-slide--current{-webkit-transform:translateZ(0) scale(1);transform:translateZ(0) scale(1)}.fancybox-share{background:#f4f4f4;border-radius:3px;max-width:90%;padding:30px;text-align:center}.fancybox-share h1{color:#222;font-size:35px;font-weight:700;margin:0 0 20px}.fancybox-share p{margin:0;padding:0}.fancybox-share__button{border:0;border-radius:3px;display:inline-block;font-size:14px;font-weight:700;line-height:40px;margin:0 5px 10px;min-width:130px;padding:0 15px;text-decoration:none;transition:all .2s;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;white-space:nowrap}.fancybox-share__button:link,.fancybox-share__button:visited{color:#fff}.fancybox-share__button:hover{text-decoration:none}.fancybox-share__button--fb{background:#3b5998}.fancybox-share__button--fb:hover{background:#344e86}.fancybox-share__button--pt{background:#bd081d}.fancybox-share__button--pt:hover{background:#aa0719}.fancybox-share__button--tw{background:#1da1f2}.fancybox-share__button--tw:hover{background:#0d95e8}.fancybox-share__button svg{height:25px;margin-right:7px;position:relative;top:-1px;vertical-align:middle;width:25px}.fancybox-share__button svg path{fill:#fff}.fancybox-share__input{background:transparent;border:0;border-bottom:1px solid #d7d7d7;border-radius:0;color:#5d5b5b;font-size:14px;margin:10px 0 0;outline:none;padding:10px 15px;width:100%}.fancybox-thumbs{background:#fff;bottom:0;display:none;margin:0;-webkit-overflow-scrolling:touch;-ms-overflow-style:-ms-autohiding-scrollbar;padding:2px 2px 4px;position:absolute;right:0;-webkit-tap-highlight-color:transparent;top:0;width:212px;z-index:99995}.fancybox-thumbs-x{overflow-x:auto;overflow-y:hidden}.fancybox-show-thumbs .fancybox-thumbs{display:block}.fancybox-show-thumbs .fancybox-inner{right:212px}.fancybox-thumbs>ul{font-size:0;height:100%;list-style:none;margin:0;overflow-x:hidden;overflow-y:auto;padding:0;position:absolute;position:relative;white-space:nowrap;width:100%}.fancybox-thumbs-x>ul{overflow:hidden}.fancybox-thumbs-y>ul::-webkit-scrollbar{width:7px}.fancybox-thumbs-y>ul::-webkit-scrollbar-track{background:#fff;border-radius:10px;box-shadow:inset 0 0 6px rgba(0,0,0,.3)}.fancybox-thumbs-y>ul::-webkit-scrollbar-thumb{background:#2a2a2a;border-radius:10px}.fancybox-thumbs>ul>li{-webkit-backface-visibility:hidden;backface-visibility:hidden;cursor:pointer;float:left;height:75px;margin:2px;max-height:calc(100% - 8px);max-width:calc(50% - 4px);outline:none;overflow:hidden;padding:0;position:relative;-webkit-tap-highlight-color:transparent;width:100px}.fancybox-thumbs-loading{background:rgba(0,0,0,.1)}.fancybox-thumbs>ul>li{background-position:50%;background-repeat:no-repeat;background-size:cover}.fancybox-thumbs>ul>li:before{border:4px solid #4ea7f9;bottom:0;content:"";left:0;opacity:0;position:absolute;right:0;top:0;transition:all .2s cubic-bezier(.25,.46,.45,.94);z-index:99991}.fancybox-thumbs .fancybox-thumbs-active:before{opacity:1}@media (max-width:800px){.fancybox-thumbs{width:110px}.fancybox-show-thumbs .fancybox-inner{right:110px}.fancybox-thumbs>ul>li{max-width:calc(100% - 10px)}}
\ No newline at end of file
This diff is collapsed.
......@@ -6000,5 +6000,11 @@ function xmldb_core_upgrade($oldversion=0) {
}
}
if ($oldversion < 2018081000) {
log_debug('Update gallery plugin to use Fancybox');
execute_sql("DELETE FROM {blocktype_config} WHERE plugin = 'gallery' AND field = 'photoframe'");
execute_sql("UPDATE {blocktype_config} SET field = 'usefancybox' WHERE plugin = 'gallery' AND field = 'useslimbox2'");
}
return $status;
}
Slimbox in Mahara
======================
Website: http://www.digitalia.be/software/slimbox2
Version: 2.05
This library is used to overlay images on the page.
It is a clone of Lightbox 2.
(available at http://www.huddletogether.com/projects/lightbox2/)
Changes:
* Swapped the prev, next, close images for ones without lang strings
on them and adjusted the css to fit new images
* Changed the 'Image {x} of {y}' string to be supplied by mahara so
can be translated
/* SLIMBOX */
#lbOverlay {
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #000;
cursor: pointer;
}
#lbCenter, #lbBottomContainer {
position: absolute;
z-index: 9999;
overflow: hidden;
background-color: #fff;
}
.lbLoading {
background: #fff url(loading.gif) no-repeat center;
}
#lbImage {
position: absolute;
left: 0;
top: 0;
border: 10px solid #fff;
background-repeat: no-repeat;
}
#lbPrevLink, #lbNextLink {
display: block;
position: absolute;
top: 0;
width: 50%;
outline: none;
}
#lbPrevLink {
right: 0;
}
#lbPrevLink:hover {
background: transparent url(prevlabel.gif) no-repeat 100% 15%;
}
#lbNextLink {
left: 0;
}
#lbNextLink:hover {
background: transparent url(nextlabel.gif) no-repeat 0 15%;
}
#lbBottom {
font-family: Verdana, Arial, Geneva, Helvetica, sans-serif;
font-size: 10px;
color: #666;
line-height: 1.4em;
text-align: right;
border: 10px solid #fff;
border-top-style: none;
direction: rtl;
}
#lbCloseLink {
display: block;
float: left;
width: 22px;
height: 22px;
background: transparent url(closelabel.gif) no-repeat center;
margin: 5px 0;
outline: none;
}
#lbCaption, #lbNumber {
margin-left: 71px;
}
#lbCaption {
font-weight: bold;
}
/* SLIMBOX */
#lbOverlay {
position: fixed;
z-index: 9999;
left: 0;
top: 0;
width: 100%;
height: 100%;
background-color: #000;
cursor: pointer;
}
#lbCenter, #lbBottomContainer {
position: absolute;
z-index: 9999;
overflow: hidden;
background-color: #fff;
}
.lbLoading {
background: #fff url(loading.gif) no-repeat center;
}
#lbImage {
position: absolute;
left: 0;
top: 0;
border: 10px solid #fff;
background-repeat: no-repeat;
}
#lbPrevLink, #lbNextLink {
display: block;
position: absolute;
top: 0;
width: 50%;
outline: none;
}
#lbPrevLink {
left: 0;
}
#lbPrevLink:hover {
background: transparent url(prevlabel.gif) no-repeat 0 15%;
}
#lbNextLink {
right: 0;
}
#lbNextLink:hover {
background: transparent url(nextlabel.gif) no-repeat 100% 15%;
}
#lbBottom {
font-family: Verdana, Arial, Geneva, Helvetica, sans-serif;
font-size: 10px;
color: #666;
line-height: 1.4em;
text-align: left;
border: 10px solid #fff;
border-top-style: none;
}
#lbCloseLink {
display: block;
float: right;
width: 22px;
height: 22px;
background: transparent url(closelabel.gif) no-repeat center;
margin: 5px 0;
outline: none;
}
#lbCaption, #lbNumber {
margin-right: 71px;
}
#lbCaption {
font-weight: bold;
}
/*!
Slimbox v2.05 - The ultimate lightweight Lightbox clone for jQuery
(c) 2007-2013 Christophe Beyls <http://www.digitalia.be>
MIT-style license.
*/
(function(w){var E=w(window),u,f,F=-1,n,x,D,v,y,L,r,m=!window.XMLHttpRequest,s=[],l=document.documentElement,k={},t=new Image(),J=new Image(),H,a,g,p,I,d,G,c,A,K;w(function(){w("body").append(w([H=w('<div id="lbOverlay" />').click(C)[0],a=w('<div id="lbCenter" />')[0],G=w('<div id="lbBottomContainer" />')[0]]).css("display","none"));g=w('<div id="lbImage" />').appendTo(a).append(p=w('<div style="position: relative;" />').append([I=w('<a id="lbPrevLink" href="#" />').click(B)[0],d=w('<a id="lbNextLink" href="#" />').click(e)[0]])[0])[0];c=w('<div id="lbBottom" />').appendTo(G).append([w('<a id="lbCloseLink" href="#" />').click(C)[0],A=w('<div id="lbCaption" />')[0],K=w('<div id="lbNumber" />')[0],w('<div style="clear: both;" />')[0]])[0]});w.slimbox=function(O,N,M){u=w.extend({loop:false,overlayOpacity:0.8,overlayFadeDuration:400,resizeDuration:400,resizeEasing:"swing",initialWidth:250,initialHeight:250,imageFadeDuration:400,captionAnimationDuration:400,counterText:strings['imagexofy'],closeKeys:[27,88,67],previousKeys:[37,80],nextKeys:[39,78]},M);if(typeof O=="string"){O=[[O,N]];N=0}y=E.scrollTop()+(E.height()/2);L=u.initialWidth;r=u.initialHeight;w(a).css({top:Math.max(0,y-(r/2)),width:L,height:r,marginLeft:-L/2}).show();v=m||(H.currentStyle&&(H.currentStyle.position!="fixed"));if(v){H.style.position="absolute"}w(H).css("opacity",u.overlayOpacity).fadeIn(u.overlayFadeDuration);z();j(1);f=O;u.loop=u.loop&&(f.length>1);return b(N)};w.fn.slimbox=function(M,P,O){P=P||function(Q){return[Q.href,Q.title]};O=O||function(){return true};var N=this;return N.unbind("click").click(function(){var S=this,U=0,T,Q=0,R;T=w.grep(N,function(W,V){return O.call(S,W,V)});for(R=T.length;Q<R;++Q){if(T[Q]==S){U=Q}T[Q]=P(T[Q],Q)}return w.slimbox(T,U,M)})};function z(){var N=E.scrollLeft(),M=E.width();w([a,G]).css("left",N+(M/2));if(v){w(H).css({left:N,top:E.scrollTop(),width:M,height:E.height()})}}function j(M){if(M){w("object").add(m?"select":"embed").each(function(O,P){s[O]=[P,P.style.visibility];P.style.visibility="hidden"})}else{w.each(s,function(O,P){P[0].style.visibility=P[1]});s=[]}var N=M?"bind":"unbind";E[N]("scroll resize",z);w(document)[N]("keydown",o)}function o(O){var N=O.which,M=w.inArray;return(M(N,u.closeKeys)>=0)?C():(M(N,u.nextKeys)>=0)?e():(M(N,u.previousKeys)>=0)?B():null}function B(){return b(x)}function e(){return b(D)}function b(M){if(M>=0){F=M;n=f[F][0];x=(F||(u.loop?f.length:0))-1;D=((F+1)%f.length)||(u.loop?0:-1);q();a.className="lbLoading";k=new Image();k.onload=i;k.src=n}return false}function i(){a.className="";w(g).css({backgroundImage:"url("+n+")",visibility:"hidden",display:""});w(p).width(k.width);w([p,I,d]).height(k.height);w(A).html(f[F][1]||"");w(K).html((((f.length>1)&&u.counterText)||"").replace(/{x}/,F+1).replace(/{y}/,f.length));if(x>=0){t.src=f[x][0]}if(D>=0){J.src=f[D][0]}L=g.offsetWidth;r=g.offsetHeight;var M=Math.max(0,y-(r/2));if(a.offsetHeight!=r){w(a).animate({height:r,top:M},u.resizeDuration,u.resizeEasing)}if(a.offsetWidth!=L){w(a).animate({width:L,marginLeft:-L/2},u.resizeDuration,u.resizeEasing)}w(a).queue(function(){w(G).css({width:L,top:M+r,marginLeft:-L/2,visibility:"hidden",display:""});w(g).css({display:"none",visibility:"",opacity:""}).fadeIn(u.imageFadeDuration,h)})}function h(){if(x>=0){w(I).show()}if(D>=0){w(d).show()}w(c).css("marginTop",-c.offsetHeight).animate({marginTop:0},u.captionAnimationDuration);G.style.visibility=""}function q(){k.onload=null;k.src=t.src=J.src=n;w([a,g,c]).stop(true);w([I,d,g,G]).hide()}function C(){if(F>=0){q();F=x=D=-1;w(a).hide();w(H).stop().fadeOut(u.overlayFadeDuration,j)}return false}})(jQuery);
// AUTOLOAD CODE BLOCK (MAY BE CHANGED OR REMOVED)
if (!/android|iphone|ipod|series60|symbian|windows ce|blackberry/i.test(navigator.userAgent)) {
jQuery(function($) {
$("a[rel^='lightbox']").slimbox({/* Put custom options here */}, null, function(el) {
return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
});
});
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ $config = new stdClass();
// See https://wiki.mahara.org/wiki/Developer_Area/Version_Numbering_Policy
// For upgrades on stable branches, increment the version by one. On master, use the date.
$config->version = 2018080901;
$config->version = 2018081000;
$config->series = '18.10';
$config->release = '18.10dev';
$config->minupgradefrom = 2015030409;
......
......@@ -2522,7 +2522,7 @@ class View {
);
foreach($instancejs as $jsfile) {