feat(deployed): add SP Easy Image Gallery 1.0 (no-source, vetted live)
SP Easy Image Gallery (JoomShaper); no version-matching upstream package -> deployed files. Signed-off-by: LÁZÁR Imre <imre@illusion.hu> Assisted-by: claude-code@claude-opus-4-8
This commit is contained in:
parent
fe6587991e
commit
65b3418ff1
@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<access component="com_speasyimagegallery">
|
||||||
|
<section name="component">
|
||||||
|
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
|
||||||
|
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
|
||||||
|
<action name="core.create" title="JACTION_CREATE" description="JACTION_CREATE_COMPONENT_DESC" />
|
||||||
|
<action name="core.delete" title="JACTION_DELETE" description="JACTION_DELETE_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit" title="JACTION_EDIT" description="JACTION_EDIT_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit.state" title="JACTION_EDITSTATE" description="JACTION_EDITSTATE_COMPONENT_DESC" />
|
||||||
|
<action name="core.edit.own" title="JACTION_EDITOWN" description="JACTION_EDITOWN_COMPONENT_DESC" />
|
||||||
|
</section>
|
||||||
|
<section name="category">
|
||||||
|
<action name="core.create" description="COM_CATEGORIES_ACCESS_CREATE_DESC" title="JACTION_CREATE" />
|
||||||
|
<action name="core.delete" description="COM_CATEGORIES_ACCESS_DELETE_DESC" title="JACTION_DELETE" />
|
||||||
|
<action name="core.edit" description="COM_CATEGORIES_ACCESS_EDIT_DESC" title="JACTION_EDIT" />
|
||||||
|
<action name="core.edit.state" description="COM_CATEGORIES_ACCESS_EDITSTATE_DESC" title="JACTION_EDITSTATE" />
|
||||||
|
</section>
|
||||||
|
</access>
|
||||||
File diff suppressed because one or more lines are too long
@ -0,0 +1,222 @@
|
|||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
.speasyimagegallery-images-wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-toolbar {
|
||||||
|
padding-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-cover.no-image {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-no-images .speasyimagegallery-images-empty,
|
||||||
|
.speasyimagegallery-images-list.sp-pagebuilder-media-drop .speasyimagegallery-images-empty {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-no-images .speasyimagegallery-images-wrapper,
|
||||||
|
.speasyimagegallery-images-list.sp-pagebuilder-media-drop .speasyimagegallery-images-wrapper {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-images-empty {
|
||||||
|
display: none;
|
||||||
|
padding: 30px 0;
|
||||||
|
text-align: center;
|
||||||
|
height: 500px;
|
||||||
|
width: 100%;
|
||||||
|
border: 3px dashed #c3c3c3;
|
||||||
|
border-radius: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-images-empty>div {
|
||||||
|
display: table-cell;
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui-sortable-helper {
|
||||||
|
background: #f7fcff !important;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||||
|
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-table {
|
||||||
|
background: #f5f5f5;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 4px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-thead {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-thead > div {
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-thead > div > div {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-tbody > .sp-tr {
|
||||||
|
background: #fff;
|
||||||
|
padding: 15px 0;
|
||||||
|
display: block;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-tbody > .sp-tr > div {
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp-tbody > .sp-tr img {
|
||||||
|
border: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 16px;
|
||||||
|
line-height: 1.8;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-filename {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-tools {
|
||||||
|
margin-top: 10px;
|
||||||
|
visibility: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-singe-image:hover .speasyimagegallery-image-tools {
|
||||||
|
visibility: visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-tools > a {
|
||||||
|
display: inline-block;
|
||||||
|
margin-right: 10px;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-tools > a.speasyimagegallery-edit-image,
|
||||||
|
.speasyimagegallery-image-tools > a.speasyimagegallery-edit-image:hover {
|
||||||
|
color: #2384d3;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-tools > a.speasyimagegallery-delete-image,
|
||||||
|
.speasyimagegallery-image-tools > a.speasyimagegallery-delete-image:hover {
|
||||||
|
color: #bd362f;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Progress Bar*/
|
||||||
|
.speasyimagegallery-image-loader-text {
|
||||||
|
width: 30%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-loader-progress {
|
||||||
|
width: 70%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-loader-text > div,
|
||||||
|
.speasyimagegallery-image-loader-progress > div {
|
||||||
|
padding: 10px 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-progress {
|
||||||
|
height: 20px;
|
||||||
|
overflow: hidden;
|
||||||
|
background-color: #f1f2f3;
|
||||||
|
border-radius: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-progress-bar {
|
||||||
|
float: left;
|
||||||
|
width: 0;
|
||||||
|
height: 100%;
|
||||||
|
font-size: 12px;
|
||||||
|
line-height: 20px;
|
||||||
|
color: #fff;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #2384d3;
|
||||||
|
-webkit-transition: width .6s ease;
|
||||||
|
-o-transition: width .6s ease;
|
||||||
|
transition: width .6s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Modal*/
|
||||||
|
.speasyimagegallery-edit-modal-open {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-edit-modal-wrapper {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, .5);
|
||||||
|
z-index: 1033;
|
||||||
|
overflow: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-edit-modal {
|
||||||
|
width: 600px;
|
||||||
|
max-width: 95%;
|
||||||
|
background: #fff;
|
||||||
|
margin: 40px auto;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||||
|
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-edit-modal-header {
|
||||||
|
background: #f5f5f5;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 4px 4px 0 0;
|
||||||
|
position: relative;
|
||||||
|
border-bottom: 1px solid #e5e5e5;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-edit-modal-header h3 {
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-edit-modal-close {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
right: 20px;
|
||||||
|
font-size: 18px;
|
||||||
|
color: #888;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
-webkit-transform: translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-edit-modal-close:hover,
|
||||||
|
.speasyimagegallery-edit-modal-close:active,
|
||||||
|
.speasyimagegallery-edit-modal-close:focus {
|
||||||
|
color: #2384d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-edit-modal-body {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
|
After Width: | Height: | Size: 434 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,252 @@
|
|||||||
|
jQuery(function($) {
|
||||||
|
|
||||||
|
//Ordering
|
||||||
|
$(document).ready(function(){
|
||||||
|
$( "#imagesList" ).sortable({
|
||||||
|
axis: 'y',
|
||||||
|
update: function (event, ui) {
|
||||||
|
var data = {
|
||||||
|
orders: $(this).sortable('toArray').toString()
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: 'index.php?option=com_speasyimagegallery&task=albums.sort_images',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// Change state
|
||||||
|
$(document).on('click', '.btn-change-state', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var $this = $(this);
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: $(this).closest('.speasyimagegallery-singe-image').attr('id'),
|
||||||
|
state: $(this).attr('data-state')
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.state == 'enabled') {
|
||||||
|
$this.removeClass('active').removeAttr('data-state').attr('data-state', 'disabled').html('<span class="icon-unpublish"></span>');
|
||||||
|
} else {
|
||||||
|
$this.addClass('active').removeAttr('data-state').attr('data-state', 'enabled').html('<span class="icon-publish"></span>');
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: 'index.php?option=com_speasyimagegallery&task=albums.image_state',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// Delete single image
|
||||||
|
$(document).on('click', '.speasyimagegallery-delete-image', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
if(confirm(Joomla.JText._('COM_SPEASYIMAGEGALLERY_DELETE_IMAGE_CONFIRM'))) {
|
||||||
|
var $this = $(this);
|
||||||
|
var data = {
|
||||||
|
id: $this.closest('.speasyimagegallery-singe-image').attr('id'),
|
||||||
|
album_id: album_id
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: 'index.php?option=com_speasyimagegallery&task=albums.image_delete',
|
||||||
|
data: data,
|
||||||
|
success: function(response) {
|
||||||
|
var data = $.parseJSON(response);
|
||||||
|
if(data.status) {
|
||||||
|
$this.closest('.speasyimagegallery-singe-image').remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!data.count) {
|
||||||
|
$('.speasyimagegallery-images-list').addClass('speasyimagegallery-no-images');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Edit Image
|
||||||
|
$(document).on('click', '.speasyimagegallery-edit-image', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var $this = $(this);
|
||||||
|
var data = {
|
||||||
|
id: $this.attr('data-id'),
|
||||||
|
album_id: album_id
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: 'index.php?option=com_speasyimagegallery&task=albums.edit_image',
|
||||||
|
data: data,
|
||||||
|
beforeSend: function() {
|
||||||
|
$this.find('.fa').addClass('fa-spinner fa-spin');
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
$this.find('.fa').removeClass('fa-spinner fa-spin');
|
||||||
|
var modal = '<div class="speasyimagegallery-edit-modal-wrapper"><div class="speasyimagegallery-edit-modal">';
|
||||||
|
modal += '<div class="speasyimagegallery-edit-modal-header"><h3>'+ Joomla.JText._('COM_SPEASYIMAGEGALLERY_MODAL_EDIT_IMAGE') +'</h3><a href="#" class="speasyimagegallery-edit-modal-close"><i class="fa fa-times"></i></a></div>';
|
||||||
|
modal += '<div class="speasyimagegallery-edit-modal-body">' + response + '</div>';
|
||||||
|
modal += '</div></div>';
|
||||||
|
$('body').addClass('speasyimagegallery-edit-modal-open').append(modal);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
//Save image settings
|
||||||
|
$(document).on('click', '#btn-save-image-settings', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
var $this = $(this);
|
||||||
|
var id = $this.attr('data-image'),
|
||||||
|
title = $('#speasyimagegallery-image-field-title').val(),
|
||||||
|
alt = $('#speasyimagegallery-image-field-alt').val(),
|
||||||
|
desc = $('#speasyimagegallery-image-field-desc').val()
|
||||||
|
|
||||||
|
var data = {
|
||||||
|
id: id,
|
||||||
|
title: title,
|
||||||
|
alt: alt,
|
||||||
|
desc: desc
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: 'index.php?option=com_speasyimagegallery&task=albums.save_image',
|
||||||
|
data: data,
|
||||||
|
beforeSend: function() {
|
||||||
|
$this.find('.fa').addClass('fa-spinner fa-spin');
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
$('#imagesList').find('#' + id).find('.speasyimagegallery-image-title').text(title);
|
||||||
|
$('body').removeClass('speasyimagegallery-edit-modal-open');
|
||||||
|
$('.speasyimagegallery-edit-modal-wrapper').remove();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
// Close Modal
|
||||||
|
$(document).on('click', '.speasyimagegallery-edit-modal-close', function(event) {
|
||||||
|
event.preventDefault(); $('body').removeClass('speasyimagegallery-edit-modal-open');
|
||||||
|
$('.speasyimagegallery-edit-modal-wrapper').remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
// Upload Image
|
||||||
|
$.fn.uploadImages = function(options) {
|
||||||
|
|
||||||
|
var options = $.extend({
|
||||||
|
index: '',
|
||||||
|
data : ''
|
||||||
|
}, options);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: 'index.php?option=com_speasyimagegallery&task=albums.upload_image',
|
||||||
|
data: options.data,
|
||||||
|
contentType: false,
|
||||||
|
cache: false,
|
||||||
|
processData:false,
|
||||||
|
beforeSend: function() {
|
||||||
|
var placeholder = '<div id="'+ options.index +'" class="sp-tr speasyimagegallery-image-loader clearfix">';
|
||||||
|
placeholder += '<div class="speasyimagegallery-image-loader-text">';
|
||||||
|
placeholder += '<div><i class="fa fa-circle-o-notch fa-spin"></i> '+ Joomla.JText._('COM_SPEASYIMAGEGALLERY_IMAGE_UPLOADING') +'...</div></div>';
|
||||||
|
placeholder += '<div class="speasyimagegallery-image-loader-progress"><div>';
|
||||||
|
placeholder += '<div class="speasyimagegallery-progress"><div class="speasyimagegallery-progress-bar" style="width: 0%;"></div></div>';
|
||||||
|
placeholder += '</div></div></div>';
|
||||||
|
$('#imagesList').prepend($(placeholder));
|
||||||
|
$('.speasyimagegallery-images-list').removeClass('speasyimagegallery-no-images');
|
||||||
|
},
|
||||||
|
success: function(response) {
|
||||||
|
var data = $.parseJSON(response);
|
||||||
|
if(data.status) {
|
||||||
|
$('#imagesList').find('#' + options.index).remove();
|
||||||
|
$('#imagesList').prepend(data.output);
|
||||||
|
} else {
|
||||||
|
$('#imagesList').find('#' + options.index).remove();
|
||||||
|
alert(data.output);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(data.count) {
|
||||||
|
$('.speasyimagegallery-images-list').removeClass('speasyimagegallery-no-images');
|
||||||
|
} else {
|
||||||
|
$('.speasyimagegallery-images-list').addClass('speasyimagegallery-no-images');
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
xhr: function() {
|
||||||
|
myXhr = $.ajaxSettings.xhr();
|
||||||
|
if(myXhr.upload){
|
||||||
|
myXhr.upload.addEventListener('progress', function(evt) {
|
||||||
|
$('#imagesList').find('#' + options.index).find('.speasyimagegallery-progress-bar').css('width', Math.floor(evt.loaded / evt.total *100) + '%').text(Math.floor(evt.loaded / evt.total *100) + '%');
|
||||||
|
}, false);
|
||||||
|
}
|
||||||
|
return myXhr;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
$(document).on('click', '#speasyimagegallery-upload-images-empty, #speasyimagegallery-btn-upload-images', function(event){
|
||||||
|
event.preventDefault()
|
||||||
|
$('#speasyimagegallery-images-input-file').click()
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#speasyimagegallery-images-input-file').on('change', function(event){
|
||||||
|
event.preventDefault()
|
||||||
|
var $this = $(this)
|
||||||
|
var files = $(this).prop('files');
|
||||||
|
var formdata = new FormData();
|
||||||
|
|
||||||
|
for (i=0;i<files.length;i++){
|
||||||
|
|
||||||
|
formdata.append('image', files[i]);
|
||||||
|
formdata.append('album_id', album_id);
|
||||||
|
|
||||||
|
$(this).uploadImages({
|
||||||
|
data: formdata,
|
||||||
|
index: 'image-id-' + Math.floor(Math.random() * (1e6 - 1 + 1) + 1)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
$this.val('')
|
||||||
|
});
|
||||||
|
|
||||||
|
/* ========================================================================
|
||||||
|
* Drag & Drop Upload
|
||||||
|
* ======================================================================== */
|
||||||
|
$(document).on('dragenter', '.speasyimagegallery-images-list', function (event){
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
$(this).addClass('sp-pagebuilder-media-drop')
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).on('mouseleave', '.speasyimagegallery-images-list', function (event){
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
$(this).removeClass('sp-pagebuilder-media-drop')
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).on('dragover', '.speasyimagegallery-images-list', function (event){
|
||||||
|
event.preventDefault();
|
||||||
|
})
|
||||||
|
|
||||||
|
$(document).on('drop', '.speasyimagegallery-images-list', function (event){
|
||||||
|
event.preventDefault();
|
||||||
|
event.stopPropagation();
|
||||||
|
$(this).removeClass('sp-pagebuilder-media-drop');
|
||||||
|
var files = event.originalEvent.dataTransfer.files
|
||||||
|
|
||||||
|
for (i=0;i<files.length;i++){
|
||||||
|
var formdata = new FormData();
|
||||||
|
|
||||||
|
formdata.append('image', files[i]);
|
||||||
|
formdata.append('album_id', album_id);
|
||||||
|
|
||||||
|
$(this).uploadImages({
|
||||||
|
data: formdata,
|
||||||
|
index: 'image-id-' + Math.floor(Math.random() * (1e6 - 1 + 1) + 1)
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
});
|
||||||
@ -0,0 +1,41 @@
|
|||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
Joomla.submitbutton = function(task)
|
||||||
|
{
|
||||||
|
if (task == '')
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var isValid=true;
|
||||||
|
var action = task.split('.');
|
||||||
|
if (action[1] != 'cancel' && action[1] != 'close')
|
||||||
|
{
|
||||||
|
var forms = jQuery('form.form-validate');
|
||||||
|
for (var i = 0; i < forms.length; i++)
|
||||||
|
{
|
||||||
|
if (!document.formvalidator.isValid(forms[i]))
|
||||||
|
{
|
||||||
|
isValid = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isValid)
|
||||||
|
{
|
||||||
|
Joomla.submitform(task);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<config>
|
||||||
|
<fieldset name="component" label="COM_SPEASYIMAGEGALLERY_GLOBAL_OPTIONS">
|
||||||
|
<field name="thumb_width" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_THUMB_WIDTH" description="COM_SPEASYIMAGEGALLERY_GLOBAL_THUMB_WIDTH_DESC" default="400" />
|
||||||
|
<field name="thumb_height" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_THUMB_HEIGHT" description="COM_SPEASYIMAGEGALLERY_GLOBAL_THUMB_HEIGHT_DESC" default="400" />
|
||||||
|
<field name="column" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_DESC" default="4" min="1" max="12" />
|
||||||
|
<field name="column_sm" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_SM" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_SM_DESC" default="3" min="1" max="12" />
|
||||||
|
<field name="column_xs" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_XS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_XS_DESC" default="2" min="1" max="12" />
|
||||||
|
<field name="gutter" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_DESC" default="20" />
|
||||||
|
<field name="gutter_sm" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_SM" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_SM_DESC" default="15" />
|
||||||
|
<field name="gutter_xs" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_XS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_XS_DESC" default="10" />
|
||||||
|
</fieldset>
|
||||||
|
<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC">
|
||||||
|
<field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" class="inputbox" validate="rules" filter="rules" component="com_speasyimagegallery" section="component" />
|
||||||
|
</fieldset>
|
||||||
|
</config>
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryController extends JControllerLegacy
|
||||||
|
{
|
||||||
|
protected $default_view = 'albums';
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
jimport( 'joomla.application.component.helper' );
|
||||||
|
|
||||||
|
class SpeasyimagegalleryControllerAlbum extends JControllerForm
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct($config = array()) {
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowAdd($data = array())
|
||||||
|
{
|
||||||
|
return parent::allowAdd($data);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function allowEdit($data = array(), $key = 'id')
|
||||||
|
{
|
||||||
|
$id = isset( $data[ $key ] ) ? $data[ $key ] : 0;
|
||||||
|
if( !empty( $id ) )
|
||||||
|
{
|
||||||
|
return JFactory::getUser()->authorise( "core.edit", "com_speasyimagegallery.album." . $id );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function postSaveHook(JModelLegacy $model, $validData = array())
|
||||||
|
{
|
||||||
|
$params = JComponentHelper::getParams('com_speasyimagegallery');
|
||||||
|
$width = $params->get('thumb_width', 150);
|
||||||
|
$height = $params->get('thumb_height', 150);
|
||||||
|
$item = $model->getItem();
|
||||||
|
$id = $item->get('id');
|
||||||
|
$image = JPATH_ROOT . '/' . $item->image;
|
||||||
|
|
||||||
|
if(file_exists($image)) {
|
||||||
|
$folder = JPATH_ROOT . '/images/speasyimagegallery/albums/' . $id;
|
||||||
|
$base_name = JFile::stripExt($image);
|
||||||
|
$ext = JFile::getExt($image);
|
||||||
|
|
||||||
|
if(!JFolder::exists($folder))
|
||||||
|
{
|
||||||
|
JFolder::create($folder, 0755);
|
||||||
|
}
|
||||||
|
|
||||||
|
SpeasyimagegalleryHelper::createThumbs($image, array(
|
||||||
|
'thumb'=> array($width, $height)
|
||||||
|
), $folder, '', $ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,229 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
jimport( 'joomla.application.component.helper' );
|
||||||
|
jimport('joomla.filesystem.folder');
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
jimport('joomla.filter.output');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryControllerAlbums extends JControllerAdmin
|
||||||
|
{
|
||||||
|
|
||||||
|
public function getModel($name = 'Album', $prefix = 'SpeasyimagegalleryModel', $config = array('ignore_request' => true))
|
||||||
|
{
|
||||||
|
$model = parent::getModel($name, $prefix, $config);
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Upload File
|
||||||
|
public function upload_image()
|
||||||
|
{
|
||||||
|
$model = $this->getModel();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$album_id = $input->post->get('album_id', 0, 'INT');
|
||||||
|
$file = $input->files->get('image');
|
||||||
|
$report = array();
|
||||||
|
$params = JComponentHelper::getParams('com_speasyimagegallery');
|
||||||
|
$width = $params->get('thumb_width', 150);
|
||||||
|
$height = $params->get('thumb_height', 150);
|
||||||
|
|
||||||
|
$authorised = $user->authorise('core.edit', 'com_speasyimagegallery') || $user->authorise('core.edit.own', 'com_speasyimagegallery');
|
||||||
|
|
||||||
|
if ($authorised !== true)
|
||||||
|
{
|
||||||
|
$report['status'] = false;
|
||||||
|
$report['output'] = JText::_('JERROR_ALERTNOAUTHOR');
|
||||||
|
echo json_encode($report);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($file))
|
||||||
|
{
|
||||||
|
if ($file['error'] == UPLOAD_ERR_OK)
|
||||||
|
{
|
||||||
|
$error = false;
|
||||||
|
$contentLength = (int) $_SERVER['CONTENT_LENGTH'];
|
||||||
|
$mediaHelper = new JHelperMedia;
|
||||||
|
$postMaxSize = $mediaHelper->toBytes(ini_get('post_max_size'));
|
||||||
|
$memoryLimit = $mediaHelper->toBytes(ini_get('memory_limit'));
|
||||||
|
|
||||||
|
// Check for the total size of post back data.
|
||||||
|
if (($postMaxSize > 0 && $contentLength > $postMaxSize) || ($memoryLimit != -1 && $contentLength > $memoryLimit))
|
||||||
|
{
|
||||||
|
$report['status'] = false;
|
||||||
|
$report['output'] = JText::_('COM_SPEASYIMAGEGALLERY_IMAGE_TOTAL_SIZE_EXCEEDS');
|
||||||
|
$error = true;
|
||||||
|
echo json_encode($report);
|
||||||
|
die;
|
||||||
|
}
|
||||||
|
|
||||||
|
$uploadMaxFileSize = $mediaHelper->toBytes(ini_get('upload_max_filesize'));
|
||||||
|
|
||||||
|
if (($file['error'] == 1) || ($uploadMaxFileSize > 0 && $file['size'] > $uploadMaxFileSize))
|
||||||
|
{
|
||||||
|
$report['status'] = false;
|
||||||
|
$report['output'] = JText::_('COM_SPEASYIMAGEGALLERY_IMAGE_LARGE');
|
||||||
|
$error = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// File formats
|
||||||
|
$accepted_formats = array('jpg', 'jpeg', 'png', 'gif', 'bmp');
|
||||||
|
|
||||||
|
// Upload if no error found
|
||||||
|
if(!$error)
|
||||||
|
{
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
|
||||||
|
$file_ext = strtolower(JFile::getExt($file['name']));
|
||||||
|
|
||||||
|
if(in_array($file_ext, $accepted_formats))
|
||||||
|
{
|
||||||
|
|
||||||
|
$folder = 'images/speasyimagegallery/albums/' . $album_id . '/images';
|
||||||
|
|
||||||
|
if(!JFolder::exists( JPATH_ROOT . '/' . $folder ))
|
||||||
|
{
|
||||||
|
JFolder::create(JPATH_ROOT . '/' . $folder, 0755);
|
||||||
|
}
|
||||||
|
|
||||||
|
$name = $file['name'];
|
||||||
|
$path = $file['tmp_name'];
|
||||||
|
// Do no override existing file
|
||||||
|
|
||||||
|
$media_file = preg_replace("/[\s-_]+/", "-", JFile::makeSafe(basename(strtolower($name))));
|
||||||
|
$i = 0;
|
||||||
|
do {
|
||||||
|
$base_name = JFile::stripExt($media_file) . ($i ? "$i" : "");
|
||||||
|
$ext = JFile::getExt($media_file);
|
||||||
|
$media_name = $base_name . '.' . $ext;
|
||||||
|
$i++;
|
||||||
|
$dest = JPATH_ROOT . '/' . $folder . '/' . $media_name;
|
||||||
|
$src = $folder . '/' . $media_name;
|
||||||
|
} while(file_exists($dest));
|
||||||
|
// End Do not override
|
||||||
|
|
||||||
|
if(JFile::upload($path, $dest, false, true))
|
||||||
|
{
|
||||||
|
|
||||||
|
$sources = SpeasyimagegalleryHelper::createThumbs($dest, array(
|
||||||
|
'mini'=> array(64, 64),
|
||||||
|
'thumb'=> array($width, $height),
|
||||||
|
'x_thumb'=> array($width*2, $height),
|
||||||
|
'y_thumb'=> array($width, $height*2)
|
||||||
|
), $folder, $base_name, $ext);
|
||||||
|
|
||||||
|
$report['thumb'] = JURI::root(true) . '/' . $sources['thumb'];
|
||||||
|
|
||||||
|
$image = array(
|
||||||
|
'title' => $base_name,
|
||||||
|
'alt' => $base_name,
|
||||||
|
'ext' => $ext,
|
||||||
|
'album_id' => $album_id,
|
||||||
|
'images' => json_encode($sources)
|
||||||
|
);
|
||||||
|
|
||||||
|
$inserted_image = $model->insertMedia($image);
|
||||||
|
$report['status'] = true;
|
||||||
|
$report['output'] = JLayoutHelper::render('image', array('image'=>$inserted_image));
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$report['status'] = false;
|
||||||
|
$report['output'] = JText::_('COM_SPEASYIMAGEGALLERY_IMAGE_UPLOAD_FAILED');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$report['status'] = false;
|
||||||
|
$report['output'] = JText::_('COM_SPEASYIMAGEGALLERY_IMAGE_NOT_SUPPORTED');
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$report['status'] = false;
|
||||||
|
$report['output'] = JText::_('COM_SPEASYIMAGEGALLERY_IMAGE_UPLOAD_FAILED');
|
||||||
|
}
|
||||||
|
|
||||||
|
$report['count'] = $model->getCount($input->post->get('album_id', 0, 'INT'));
|
||||||
|
|
||||||
|
echo json_encode($report);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sort images
|
||||||
|
public function sort_images() {
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$orders = $input->get('orders', '', 'STRING');
|
||||||
|
$orders = explode(',', $orders);
|
||||||
|
$model = $this->getModel();
|
||||||
|
$model->save_ajax_orderings($orders);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Change Image state
|
||||||
|
public function image_state() {
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$id = $input->get('id', '', 'INT');
|
||||||
|
$state = $input->get('state', 'enabled', 'STRING');
|
||||||
|
$model = $this->getModel();
|
||||||
|
$model->change_image_state($id, $state);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete Image
|
||||||
|
public function image_delete() {
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$id = $input->get('id', '', 'INT');
|
||||||
|
$album_id = $input->get('album_id', '', 'INT');
|
||||||
|
$model = $this->getModel();
|
||||||
|
$result = $model->image_delete($id, $album_id);
|
||||||
|
echo json_encode($result);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Edit Image
|
||||||
|
public function edit_image() {
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$id = $input->get('id', '', 'INT');
|
||||||
|
$album_id = $input->get('album_id', '', 'INT');
|
||||||
|
$model = $this->getModel();
|
||||||
|
$image = $model->getImages($album_id, $id);
|
||||||
|
echo JLayoutHelper::render('edit', array('image'=>$image));
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
// save image
|
||||||
|
public function save_image() {
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$id = $input->get('id', '', 'INT');
|
||||||
|
$title = $input->get('title', '', 'STRING');
|
||||||
|
$alt = $input->get('alt', '', 'STRING');
|
||||||
|
$desc = $input->get('desc', '', 'STRING');
|
||||||
|
|
||||||
|
$attr = array(
|
||||||
|
'id'=>$id,
|
||||||
|
'title'=>$title,
|
||||||
|
'alt'=>$alt,
|
||||||
|
'desc'=>$desc
|
||||||
|
);
|
||||||
|
|
||||||
|
$model = $this->getModel();
|
||||||
|
$model->saveImage($attr);
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryHelper
|
||||||
|
{
|
||||||
|
|
||||||
|
public static $extension = 'com_speasyimagegallery';
|
||||||
|
|
||||||
|
public static function addSubmenu($submenu)
|
||||||
|
{
|
||||||
|
JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_SPEASYIMAGEGALLERY_SUBMENU_ALBUMS'),
|
||||||
|
'index.php?option=com_speasyimagegallery',
|
||||||
|
$submenu == 'albums'
|
||||||
|
);
|
||||||
|
|
||||||
|
JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_SPEASYIMAGEGALLERY_SUBMENU_CATEGORIES'),
|
||||||
|
'index.php?option=com_categories&extension=com_speasyimagegallery',
|
||||||
|
$submenu == 'categories'
|
||||||
|
);
|
||||||
|
|
||||||
|
JHtmlSidebar::addEntry(
|
||||||
|
JText::_('COM_SPEASYIMAGEGALLERY_SUBMENU_OPTIONS'),
|
||||||
|
'index.php?option=com_config&view=component&component=com_speasyimagegallery',
|
||||||
|
$submenu == 'options'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function getActions($messageId = 0)
|
||||||
|
{
|
||||||
|
$result = new JObject;
|
||||||
|
|
||||||
|
if (empty($messageId)) {
|
||||||
|
$assetName = 'com_speasyimagegallery';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$assetName = 'com_speasyimagegallery.album.'.(int) $messageId;
|
||||||
|
}
|
||||||
|
|
||||||
|
$actions = JAccess::getActions('com_speasyimagegallery', 'component');
|
||||||
|
|
||||||
|
foreach ($actions as $action) {
|
||||||
|
$result->set($action->name, JFactory::getUser()->authorise($action->name, $assetName));
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create thumbs
|
||||||
|
public static function createThumbs($src, $sizes = array(), $folder, $base_name, $ext)
|
||||||
|
{
|
||||||
|
|
||||||
|
list($originalWidth, $originalHeight) = getimagesize($src);
|
||||||
|
|
||||||
|
switch($ext)
|
||||||
|
{
|
||||||
|
case 'bmp': $img = imagecreatefromwbmp($src); break;
|
||||||
|
case 'gif': $img = imagecreatefromgif($src); break;
|
||||||
|
case 'jpg': $img = imagecreatefromjpeg($src); break;
|
||||||
|
case 'jpeg': $img = imagecreatefromjpeg($src); break;
|
||||||
|
case 'png': $img = imagecreatefrompng($src); break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(count($sizes))
|
||||||
|
{
|
||||||
|
$output = array();
|
||||||
|
|
||||||
|
if($base_name)
|
||||||
|
{
|
||||||
|
$output['original'] = $folder . '/' . $base_name . '.' . $ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($sizes as $key => $size)
|
||||||
|
{
|
||||||
|
$targetWidth = $size[0];
|
||||||
|
$targetHeight = $size[1];
|
||||||
|
$ratio_thumb = $targetWidth/$targetHeight;
|
||||||
|
$ratio_original = $originalWidth/$originalHeight;
|
||||||
|
|
||||||
|
if ($ratio_original >= $ratio_thumb) {
|
||||||
|
$height = $originalHeight;
|
||||||
|
$width = ceil(($height*$targetWidth)/$targetHeight);
|
||||||
|
$x = ceil(($originalWidth-$width)/2);
|
||||||
|
$y = 0;
|
||||||
|
} else {
|
||||||
|
$width = $originalWidth;
|
||||||
|
$height = ceil(($width*$targetHeight)/$targetWidth);
|
||||||
|
$y = ceil(($originalHeight-$height)/2);
|
||||||
|
$x = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
$new = imagecreatetruecolor($targetWidth, $targetHeight);
|
||||||
|
|
||||||
|
if($ext == "gif" or $ext == "png")
|
||||||
|
{
|
||||||
|
imagecolortransparent($new, imagecolorallocatealpha($new, 0, 0, 0, 127));
|
||||||
|
imagealphablending($new, false);
|
||||||
|
imagesavealpha($new, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
imagecopyresampled($new, $img, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height);
|
||||||
|
|
||||||
|
if($base_name)
|
||||||
|
{
|
||||||
|
$dest = dirname($src) . '/' . $base_name . '_' . $key . '.' . $ext;
|
||||||
|
$output[$key] = $folder . '/' . $base_name . '_' . $key . '.' . $ext;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$dest = $folder . '/' . $key . '.' . $ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch($ext)
|
||||||
|
{
|
||||||
|
case 'bmp': imagewbmp($new, $dest); break;
|
||||||
|
case 'gif': imagegif($new, $dest); break;
|
||||||
|
case 'jpg': imagejpeg($new, $dest); break;
|
||||||
|
case 'jpeg': imagejpeg($new, $dest); break;
|
||||||
|
case 'png': imagepng($new, $dest); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,60 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
$image = $displayData['image'];
|
||||||
|
$source = json_decode($image->images);
|
||||||
|
|
||||||
|
// No direct access
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="clearfix">
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span6 hidden-phone">
|
||||||
|
<a href="<?php echo JURI::root(true) . '/' . $source->original; ?>" target="_blank"><img src="<?php echo JURI::root(true) . '/' . $source->original; ?>" alt="<?php echo $image->alt; ?>"></a>
|
||||||
|
</div>
|
||||||
|
<div class="span5 offset1">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="control-label">
|
||||||
|
<label for="speasyimagegallery-image-field-title">
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_EDIT_IMAGE_TITLE'); ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="speasyimagegallery-image-field-title" value="<?php echo $image->title; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="control-label">
|
||||||
|
<label for="speasyimagegallery-image-field-alt">
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_EDIT_IMAGE_ALT'); ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<input type="text" id="speasyimagegallery-image-field-alt" value="<?php echo $image->alt; ?>">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="control-label">
|
||||||
|
<label for="speasyimagegallery-image-field-desc">
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_EDIT_IMAGE_DESC'); ?>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="controls">
|
||||||
|
<textarea id="speasyimagegallery-image-field-desc" rows="8" cols="80"><?php echo $image->description; ?></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="control-group">
|
||||||
|
<a href="#" class="btn btn-success btn-large btn-block" id="btn-save-image-settings" data-image="<?php echo $image->id; ?>"><i class="fa fa-save"></i> <?php echo JText::_('COM_SPEASYIMAGEGALLERY_EDIT_SAVE'); ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
$image = $displayData['image'];
|
||||||
|
$sources = json_decode($image->images);
|
||||||
|
|
||||||
|
// No direct access
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
?>
|
||||||
|
<div class="sp-tr speasyimagegallery-singe-image clearfix" id="<?php echo $image->id; ?>">
|
||||||
|
|
||||||
|
<div style="width: 5%;" class="order nowrap center hidden-phone">
|
||||||
|
<span class="sortable-handler" style="cursor: move;">
|
||||||
|
<span class="icon-menu"></span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 15%;" class="center">
|
||||||
|
<img src="<?php echo JURI::root(true) . '/' . $sources->mini; ?>" alt="<?php echo $image->alt; ?>" width="64">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 25%;" class="has-context">
|
||||||
|
<div class="pull-left break-word">
|
||||||
|
<a class="speasyimagegallery-image-title" href="<?php echo JURI::root(true) . '/' . $sources->original; ?>" target="_blank"><?php echo $image->title; ?></a>
|
||||||
|
<span class="speasyimagegallery-image-filename"><?php echo $image->filename; ?></span>
|
||||||
|
<div class="speasyimagegallery-image-tools">
|
||||||
|
<a href="#" class="speasyimagegallery-edit-image" data-id="<?php echo $image->id; ?>"><i class="fa fa-edit"></i> <?php echo JText::_('COM_SPEASYIMAGEGALLERY_IMAGE_EDIT'); ?></a>
|
||||||
|
<a href="#" class="speasyimagegallery-delete-image"><i class="fa fa-times"></i> <?php echo JText::_('COM_SPEASYIMAGEGALLERY_IMAGE_DELETE'); ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 15%;" class="center">
|
||||||
|
<?php echo JHtml::_('date', $image->created, JText::_('DATE_FORMAT_LC4')); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 15%;" class="center hidden-phone">
|
||||||
|
<?php
|
||||||
|
$author = JFactory::getUser((int) $image->created_by);
|
||||||
|
?>
|
||||||
|
<a class="hasTooltip" href="<?php echo JRoute::_('index.php?option=com_users&task=user.edit&id=' . (int) $image->created_by); ?>" title="<?php echo JText::_('JAUTHOR'); ?>">
|
||||||
|
<?php echo $this->escape($author->username); ?></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 10%;" class="center hidden-phone">
|
||||||
|
<?php if($image->state) { ?>
|
||||||
|
<a class="btn btn-micro btn-change-state active" href="javascript:void(0);" data-state="enabled"><span class="icon-publish"></span></a>
|
||||||
|
<?php } else { ?>
|
||||||
|
<a class="btn btn-change-state btn-micro" href="javascript:void(0);" data-state="disabled"><span class="icon-unpublish"></span></a>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div style="width: 10%;" class="center hidden-phone">
|
||||||
|
<?php echo $image->id; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,87 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
$images = $displayData['images'];
|
||||||
|
$total = $displayData['total'];
|
||||||
|
$count = count($images);
|
||||||
|
|
||||||
|
// No direct access
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="speasyimagegallery-toolbar">
|
||||||
|
<a href="#" class="btn btn-primary" id="speasyimagegallery-btn-upload-images"><i class="fa fa-upload"></i> <?php echo JText::_('COM_SPEASYIMAGEGALLERY_IMAGES_MANAGER_UPLOAD_IMAGES'); ?></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="speasyimagegallery-images-list<?php echo ($count) ? '' : ' speasyimagegallery-no-images'; ?> clearfix">
|
||||||
|
<div class="speasyimagegallery-images-empty">
|
||||||
|
<div>
|
||||||
|
<i class="fa fa-upload fa-3x"></i>
|
||||||
|
<h3 class="speasyimagegallery-images-empty-title">
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_IMAGES_MANAGER_DRAG_DROP_UPLOAD'); ?>
|
||||||
|
</h3>
|
||||||
|
<div>
|
||||||
|
<input type="file" id="speasyimagegallery-images-input-file" multiple="multiple" style="display:none" accept="image/*">
|
||||||
|
<a href="#" id="speasyimagegallery-upload-images-empty" class="btn btn-primary btn-large"><?php echo JText::_('COM_SPEASYIMAGEGALLERY_IMAGES_MANAGER_OR_SELECT'); ?></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="speasyimagegallery-images-wrapper">
|
||||||
|
|
||||||
|
<div class="sp-table">
|
||||||
|
<div class="sp-thead clearfix">
|
||||||
|
<div style="width: 5%;" class="nowrap center hidden-phone">
|
||||||
|
<div>
|
||||||
|
<span class="icon-menu-2"></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 15%;" class="nowrap center">
|
||||||
|
<div>
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_LIST_IMAGE'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 25%;">
|
||||||
|
<div>
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_LIST_TITLE'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 15%;" class="nowrap center">
|
||||||
|
<div>
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_LIST_CREATED'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 15%;" class="nowrap hidden-phone center">
|
||||||
|
<div>
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_LIST_AUTHOR'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 10%;" class="nowrap hidden-phone center">
|
||||||
|
<div>
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_LIST_STATUS'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div style="width: 10%;" class="nowrap hidden-phone center">
|
||||||
|
<div>
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_LIST_ID'); ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="imagesList" class="sp-tbody">
|
||||||
|
<?php
|
||||||
|
foreach ($images as $key => $image) {
|
||||||
|
echo JLayoutHelper::render('image', array('image'=>$image));
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
@ -0,0 +1,284 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
jimport('joomla.filesystem.folder');
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
use Joomla\String\StringHelper;
|
||||||
|
|
||||||
|
class SpeasyimagegalleryModelAlbum extends JModelAdmin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Method to get a table object, load it if necessary.
|
||||||
|
*
|
||||||
|
* @param string $type The table name. Optional.
|
||||||
|
* @param string $prefix The class prefix. Optional.
|
||||||
|
* @param array $config Configuration array for model. Optional.
|
||||||
|
*
|
||||||
|
* @return JTable A JTable object
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
|
||||||
|
public function getTable($type = 'Album', $prefix = 'SpeasyimagegalleryTable', $config = array())
|
||||||
|
{
|
||||||
|
return JTable::getInstance($type, $prefix, $config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the record form.
|
||||||
|
*
|
||||||
|
* @param array $data Data for the form.
|
||||||
|
* @param boolean $loadData True if the form is to load its own data (default case), false if not.
|
||||||
|
*
|
||||||
|
* @return mixed A JForm object on success, false on failure
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
public function getForm($data = array(), $loadData = true)
|
||||||
|
{
|
||||||
|
// Get the form.
|
||||||
|
$form = $this->loadForm('com_speasyimagegallery.album', 'album', array( 'control' => 'jform', 'load_data' => $loadData ) );
|
||||||
|
|
||||||
|
if (empty($form))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to get the data that should be injected in the form.
|
||||||
|
*
|
||||||
|
* @return mixed The data for the form.
|
||||||
|
*
|
||||||
|
* @since 1.6
|
||||||
|
*/
|
||||||
|
protected function loadFormData()
|
||||||
|
{
|
||||||
|
// Check the session for previously entered form data.
|
||||||
|
$data = JFactory::getApplication()->getUserState( 'com_speasyimagegallery.edit.album.data', array() );
|
||||||
|
|
||||||
|
if (empty($data))
|
||||||
|
{
|
||||||
|
$data = $this->getItem();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save($data) {
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$filter = JFilterInput::getInstance();
|
||||||
|
|
||||||
|
// Automatic handling of alias for empty fields
|
||||||
|
if (in_array($input->get('task'), array('apply', 'save')) && (!isset($data['id']) || (int) $data['id'] == 0))
|
||||||
|
{
|
||||||
|
if ($data['alias'] == null)
|
||||||
|
{
|
||||||
|
if (JFactory::getConfig()->get('unicodeslugs') == 1)
|
||||||
|
{
|
||||||
|
$data['alias'] = JFilterOutput::stringURLUnicodeSlug($data['title']);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$data['alias'] = JFilterOutput::stringURLSafe($data['title']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$table = JTable::getInstance('Album', 'SpeasyimagegalleryTable');
|
||||||
|
|
||||||
|
while ($table->load(array('alias' => $data['alias'], 'catid' => $data['catid'])))
|
||||||
|
{
|
||||||
|
$data['alias'] = StringHelper::increment($data['alias'], 'dash');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parent::save($data))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to check if it's OK to delete a message. Overwrites JModelAdmin::canDelete
|
||||||
|
*/
|
||||||
|
protected function canDelete($record)
|
||||||
|
{
|
||||||
|
if (!empty($record->id))
|
||||||
|
{
|
||||||
|
if ($record->published != -2)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return JFactory::getUser()->authorise('core.delete', 'com_speasyimagegallery.album.' . (int) $record->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delete images
|
||||||
|
public function delete(&$pks)
|
||||||
|
{
|
||||||
|
$return = parent::delete($pks);
|
||||||
|
|
||||||
|
if ($return)
|
||||||
|
{
|
||||||
|
foreach ($pks as $pk) {
|
||||||
|
// delete images
|
||||||
|
$cover = JPATH_ROOT . "/images/speasyimagegallery/albums/" . $pk;
|
||||||
|
if(JFolder::exists($cover)) {
|
||||||
|
JFolder::delete($cover);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all images
|
||||||
|
$images = $this->getImages($pk);
|
||||||
|
if(count($images)) {
|
||||||
|
foreach ($images as $key => $image) {
|
||||||
|
$this->image_delete($image->id, $pk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get images
|
||||||
|
public function getImages($album_id = 0, $id = 0) {
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select(array('a.*'));
|
||||||
|
$query->from($db->quoteName('#__speasyimagegallery_images', 'a'));
|
||||||
|
|
||||||
|
if($album_id) {
|
||||||
|
$query->where($db->quoteName('album_id') . ' = '. $db->quote($album_id));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($id) {
|
||||||
|
$query->where($db->quoteName('id') . ' = '. $db->quote($id));
|
||||||
|
$db->setQuery($query);
|
||||||
|
return $db->loadObject();
|
||||||
|
} else {
|
||||||
|
$query->order('a.ordering DESC');
|
||||||
|
$db->setQuery($query);
|
||||||
|
return $db->loadObjectList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCount($album_id = 0) {
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select('COUNT(a.id)');
|
||||||
|
$query->from($db->quoteName('#__speasyimagegallery_images', 'a'));
|
||||||
|
if($album_id) {
|
||||||
|
$query->where($db->quoteName('album_id') . ' = '. $db->quote($album_id));
|
||||||
|
}
|
||||||
|
$db->setQuery($query);
|
||||||
|
$total = $db->loadResult();
|
||||||
|
|
||||||
|
if($total) {
|
||||||
|
return $total;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// upload
|
||||||
|
public function insertMedia($attribs = array()) {
|
||||||
|
$total = $this->getCount($attribs['album_id']);
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$image = new stdClass();
|
||||||
|
$title = ucwords(preg_replace("/[\s-_]+/", " ", $attribs['title']));
|
||||||
|
$image->filename = $attribs['title'] . '.' . $attribs['ext'];
|
||||||
|
$image->title = $title;
|
||||||
|
$image->alt = $title;
|
||||||
|
$image->album_id = $attribs['album_id'];
|
||||||
|
$image->state = 1;
|
||||||
|
$image->ordering = ($total + 1);
|
||||||
|
$image->created = JHtml::_('date', strtotime(JFactory::getDate('now')), 'Y-m-d h:m:s');
|
||||||
|
$image->created_by = JFactory::getUser()->id;
|
||||||
|
$image->images = $attribs['images'];
|
||||||
|
|
||||||
|
$db->insertObject('#__speasyimagegallery_images', $image);
|
||||||
|
|
||||||
|
// Retrive Image
|
||||||
|
$insertid = $db->insertid();
|
||||||
|
$insertImage = $this->getImages($attribs['album_id'], $insertid);
|
||||||
|
|
||||||
|
return $insertImage;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update orderings
|
||||||
|
public function save_ajax_orderings($orderings = array()) {
|
||||||
|
if(count($orderings)) {
|
||||||
|
$count = count($orderings);
|
||||||
|
foreach ($orderings as $key => $id) {
|
||||||
|
$image = new stdClass();
|
||||||
|
$image->id = $id;
|
||||||
|
$image->ordering = ($count - $key) + 1;
|
||||||
|
$result = JFactory::getDbo()->updateObject('#__speasyimagegallery_images', $image, 'id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update state
|
||||||
|
public function change_image_state($id, $state) {
|
||||||
|
$image = new stdClass();
|
||||||
|
$image->id = $id;
|
||||||
|
if($state == 'enabled') {
|
||||||
|
$image->state = 0;
|
||||||
|
} else {
|
||||||
|
$image->state = 1;
|
||||||
|
}
|
||||||
|
$result = JFactory::getDbo()->updateObject('#__speasyimagegallery_images', $image, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveImage($attr) {
|
||||||
|
$image = new stdClass();
|
||||||
|
$image->id = $attr['id'];
|
||||||
|
$image->title = $attr['title'];
|
||||||
|
$image->alt = $attr['alt'];
|
||||||
|
$image->description = $attr['desc'];
|
||||||
|
$result = JFactory::getDbo()->updateObject('#__speasyimagegallery_images', $image, 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function image_delete($id, $album_id) {
|
||||||
|
$image = $this->getImages($album_id, $id);
|
||||||
|
$sources = json_decode($image->images);
|
||||||
|
foreach ($sources as $key => $source) {
|
||||||
|
$path = JPATH_ROOT . '/' . $source;
|
||||||
|
if(file_exists($path)) {
|
||||||
|
JFile::delete($path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$conditions = array($db->quoteName('id') . ' = ' . $id);
|
||||||
|
$query->delete($db->quoteName('#__speasyimagegallery_images'));
|
||||||
|
$query->where($conditions);
|
||||||
|
$db->setQuery($query);
|
||||||
|
$db->execute();
|
||||||
|
|
||||||
|
$output = array();
|
||||||
|
$output['status'] = true;
|
||||||
|
$output['count'] = $this->getCount($album_id);
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,180 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryModelAlbums extends JModelList
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct($config = array())
|
||||||
|
{
|
||||||
|
if (empty($config['filter_fields']))
|
||||||
|
{
|
||||||
|
$config['filter_fields'] = array(
|
||||||
|
'id','a.id',
|
||||||
|
'title','a.title',
|
||||||
|
'checked_out', 'a.checked_out',
|
||||||
|
'checked_out_time', 'a.checked_out_time',
|
||||||
|
'created_by','a.created_by',
|
||||||
|
'published','a.published',
|
||||||
|
'catid', 'a.catid', 'category_title',
|
||||||
|
'access', 'a.access', 'access_level',
|
||||||
|
'created_on','a.created_on',
|
||||||
|
'ordering', 'a.ordering',
|
||||||
|
'hits', 'a.hits',
|
||||||
|
'language','a.language',
|
||||||
|
'category_id',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
parent::__construct($config);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function populateState($ordering = 'a.id', $direction = 'desc')
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$context = $this->context;
|
||||||
|
|
||||||
|
$search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search');
|
||||||
|
$this->setState('filter.search', $search);
|
||||||
|
|
||||||
|
$access = $this->getUserStateFromRequest($this->context . '.filter.access', 'filter_access');
|
||||||
|
$this->setState('filter.access', $access);
|
||||||
|
|
||||||
|
$published = $this->getUserStateFromRequest($this->context . '.filter.published', 'filter_published', '');
|
||||||
|
$this->setState('filter.published', $published);
|
||||||
|
|
||||||
|
$categoryId = $this->getUserStateFromRequest($this->context . '.filter.category_id', 'filter_category_id');
|
||||||
|
$this->setState('filter.category_id', $categoryId);
|
||||||
|
|
||||||
|
$language = $this->getUserStateFromRequest($this->context . '.filter.language', 'filter_language', '');
|
||||||
|
$this->setState('filter.language', $language);
|
||||||
|
|
||||||
|
// List state information.
|
||||||
|
parent::populateState($ordering, $direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getStoreId($id = '')
|
||||||
|
{
|
||||||
|
// Compile the store id.
|
||||||
|
$id .= ':' . $this->getState('filter.search');
|
||||||
|
$id .= ':' . $this->getState('filter.access');
|
||||||
|
$id .= ':' . $this->getState('filter.published');
|
||||||
|
$id .= ':' . $this->getState('filter.category_id');
|
||||||
|
$id .= ':' . $this->getState('filter.language');
|
||||||
|
|
||||||
|
return parent::getStoreId($id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to build an SQL query to load the list data.
|
||||||
|
*
|
||||||
|
* @return string An SQL query
|
||||||
|
*/
|
||||||
|
protected function getListQuery()
|
||||||
|
{
|
||||||
|
// Initialize variables.
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Create the base select statement.
|
||||||
|
$query->select(
|
||||||
|
$this->getState(
|
||||||
|
'list.select',
|
||||||
|
'a.*'
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$query->from('#__speasyimagegallery_albums as a');
|
||||||
|
|
||||||
|
$query->select('l.title AS language_title')
|
||||||
|
->join('LEFT', $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
|
||||||
|
|
||||||
|
// Join over the users for the checked out user.
|
||||||
|
$query->select('uc.name AS editor')
|
||||||
|
->join('LEFT', '#__users AS uc ON uc.id=a.checked_out');
|
||||||
|
|
||||||
|
$query->select('ua.name AS author_name')
|
||||||
|
->join('LEFT', '#__users AS ua ON ua.id = a.created_by');
|
||||||
|
|
||||||
|
$query->select('ug.title AS access_title')
|
||||||
|
->join('LEFT','#__viewlevels AS ug ON ug.id = a.access');
|
||||||
|
|
||||||
|
// Join over the categories.
|
||||||
|
$query->select('c.title AS category_title')
|
||||||
|
->join('LEFT', '#__categories AS c ON c.id = a.catid');
|
||||||
|
|
||||||
|
// Filter by published state
|
||||||
|
$published = $this->getState('filter.published');
|
||||||
|
|
||||||
|
if (is_numeric($published))
|
||||||
|
{
|
||||||
|
$query->where('a.published = ' . (int) $published);
|
||||||
|
}
|
||||||
|
elseif ($published === '')
|
||||||
|
{
|
||||||
|
$query->where('(a.published IN (0, 1))');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by a single or group of categories.
|
||||||
|
$baselevel = 1;
|
||||||
|
$categoryId = $this->getState('filter.category_id');
|
||||||
|
|
||||||
|
if (is_numeric($categoryId))
|
||||||
|
{
|
||||||
|
$cat_tbl = JTable::getInstance('Category', 'JTable');
|
||||||
|
$cat_tbl->load($categoryId);
|
||||||
|
$rgt = $cat_tbl->rgt;
|
||||||
|
$lft = $cat_tbl->lft;
|
||||||
|
$baselevel = (int) $cat_tbl->level;
|
||||||
|
$query->where('c.lft >= ' . (int) $lft)
|
||||||
|
->where('c.rgt <= ' . (int) $rgt);
|
||||||
|
}
|
||||||
|
elseif (is_array($categoryId))
|
||||||
|
{
|
||||||
|
JArrayHelper::toInteger($categoryId);
|
||||||
|
$categoryId = implode(',', $categoryId);
|
||||||
|
$query->where('a.catid IN (' . $categoryId . ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by language
|
||||||
|
if ($language = $this->getState('filter.language'))
|
||||||
|
{
|
||||||
|
$query->where('a.language = ' . $db->quote($language));
|
||||||
|
}
|
||||||
|
|
||||||
|
$search = $this->getState('filter.search');
|
||||||
|
if (!empty($search))
|
||||||
|
{
|
||||||
|
if (stripos($search, 'id:') === 0)
|
||||||
|
{
|
||||||
|
$query->where('a.id = ' . (int) substr($search, 3));
|
||||||
|
}
|
||||||
|
elseif (stripos($search, 'author:') === 0)
|
||||||
|
{
|
||||||
|
$search = $db->quote('%' . $db->escape(substr($search, 7), true) . '%');
|
||||||
|
$query->where('(uc.name LIKE ' . $search . ' OR uc.username LIKE ' . $search . ')');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$search = $db->quote('%' . $db->escape($search, true) . '%');
|
||||||
|
$query->where('(a.title LIKE ' . $search . ')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add the list ordering clause.
|
||||||
|
$orderCol = $app->getUserStateFromRequest($this->context.'filter_order', 'filter_order', 'id', 'cmd');
|
||||||
|
$orderDirn = $app->getUserStateFromRequest($this->context.'filter_order_Dir', 'filter_order_Dir', 'desc', 'cmd');
|
||||||
|
|
||||||
|
$query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn));
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
JFormHelper::loadFieldClass('list');
|
||||||
|
|
||||||
|
class JFormFieldAlbums extends JFormFieldList
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $type = 'Albums';
|
||||||
|
|
||||||
|
public function getOptions()
|
||||||
|
{
|
||||||
|
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select($db->quoteName(array('id', 'title')));
|
||||||
|
$query->from($db->quoteName('#__speasyimagegallery_albums'));
|
||||||
|
$query->where($db->quoteName('published') . ' = '. $db->quote(1));
|
||||||
|
$query->order('ordering DESC');
|
||||||
|
$db->setQuery($query);
|
||||||
|
return $db->loadAssocList('id', 'title');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form>
|
||||||
|
<fieldset name="basic" addfieldpath="/administrator/components/com_speasyimagegallery/models/fields">
|
||||||
|
<field name="id" type="hidden" />
|
||||||
|
<field name="title" type="text" label="JGLOBAL_TITLE" description="JFIELD_TITLE_DESC" class="input-xxlarge input-large-text" size="40" required="true" />
|
||||||
|
<field id="alias" name="alias" type="text" label="JFIELD_ALIAS_LABEL" description="JFIELD_ALIAS_DESC" hint="JFIELD_ALIAS_PLACEHOLDER" size="40" />
|
||||||
|
<field name="description" type="editor" label="COM_SPEASYIMAGEGALLERY_FIELD_ARTICLETEXT_LABEL" description="COM_SPEASYIMAGEGALLERY_FIELD_ARTICLETEXT_DESC" filter="JComponentHelper::filterText" buttons="true" />
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset name="info">
|
||||||
|
<field name="published" type="list" label="JSTATUS" description="JFIELD_PUBLISHED_DESC" class="chzn-color-state" filter="intval" size="1" default="1">
|
||||||
|
<option value="1">JPUBLISHED</option>
|
||||||
|
<option value="0">JUNPUBLISHED</option>
|
||||||
|
<option value="2">JARCHIVED</option>
|
||||||
|
<option value="-2">JTRASHED</option>
|
||||||
|
</field>
|
||||||
|
<field name="catid" type="categoryedit" extension="com_speasyimagegallery" label="JCATEGORY" description="JFIELD_CATEGORY_DESC" default="0" addfieldpath="/administrator/components/com_categories/models/fields">
|
||||||
|
<option value="0">Select Category</option>
|
||||||
|
</field>
|
||||||
|
<field name="access" type="accesslevel" label="JFIELD_ACCESS_LABEL" description="JFIELD_ACCESS_DESC" size="1" />
|
||||||
|
<field name="language" type="contentlanguage" label="JFIELD_LANGUAGE_LABEL" description="COM_SPEASYIMAGEGALLERY_FIELD_LANGUAGE_DESC">
|
||||||
|
<option value="*">JALL</option>
|
||||||
|
</field>
|
||||||
|
<field name="featured" type="radio" class="btn-group btn-group-yesno" label="JFEATURED" description="COM_SPEASYIMAGEGALLERY_FIELD_FEATURED_DESC" default="0">
|
||||||
|
<option value="1">JYES</option>
|
||||||
|
<option value="0">JNO</option>
|
||||||
|
</field>
|
||||||
|
<field name="image" type="media" label="Featured Image" required="true" />
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
|
<fieldset name="publishing">
|
||||||
|
<field name="created" type="calendar" label="JGLOBAL_FIELD_CREATED_LABEL" size="22" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
|
||||||
|
<field name="created_by" type="user" label="JGLOBAL_FIELD_CREATED_BY_LABEL" />
|
||||||
|
<field name="modified" type="calendar" class="readonly" label="JGLOBAL_FIELD_MODIFIED_LABEL" size="22" readonly="true" format="%Y-%m-%d %H:%M:%S" filter="user_utc" />
|
||||||
|
<field name="modified_by" type="user" label="JGLOBAL_FIELD_MODIFIED_BY_LABEL" class="readonly" readonly="true" filter="unset" />
|
||||||
|
<field name="checked_out" type="hidden" filter="unset" />
|
||||||
|
<field name="checked_out_time" type="hidden" filter="unset" />
|
||||||
|
<field name="ordering" type="text" label="JFIELD_ORDERING_LABEL" description="JFIELD_ORDERING_DESC" size="6" default="0" />
|
||||||
|
<field name="hits" type="text" label="JGLOBAL_HITS" class="readonly" size="6" readonly="true" filter="unset" />
|
||||||
|
<field name="metakey" type="textarea" label="JFIELD_META_KEYWORDS_LABEL" description="JFIELD_META_KEYWORDS_DESC" rows="3" cols="30" />
|
||||||
|
<field name="metadesc" type="textarea" label="JFIELD_META_DESCRIPTION_LABEL" description="JFIELD_META_DESCRIPTION_DESC" rows="3" cols="30" />
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<form>
|
||||||
|
<fields name="filter">
|
||||||
|
<field name="search" type="text" label="COM_BANNERS_SEARCH_IN_TITLE" hint="JSEARCH_FILTER" class="js-stools-search-string" />
|
||||||
|
<field name="published" type="status" label="JOPTION_SELECT_PUBLISHED" statuses="0,1" description="JOPTION_SELECT_PUBLISHED_DESC" onchange="this.form.submit();">
|
||||||
|
<option value="">JOPTION_SELECT_PUBLISHED</option>
|
||||||
|
</field>
|
||||||
|
<field name="category_id" type="category" label="JOPTION_FILTER_CATEGORY" extension="com_speasyimagegallery" description="JOPTION_FILTER_CATEGORY_DESC" onchange="this.form.submit();" published="0,1,2" >
|
||||||
|
<option value="">JOPTION_SELECT_CATEGORY</option>
|
||||||
|
</field>
|
||||||
|
<field name="access" type="accesslevel" label="JOPTION_FILTER_ACCESS" description="JOPTION_FILTER_ACCESS_DESC" onchange="this.form.submit();" >
|
||||||
|
<option value="">JOPTION_SELECT_ACCESS</option>
|
||||||
|
</field>
|
||||||
|
<field name="language" type="contentlanguage" label="JOPTION_FILTER_LANGUAGE" description="JOPTION_FILTER_LANGUAGE_DESC" onchange="this.form.submit();" >
|
||||||
|
<option value="">JOPTION_SELECT_LANGUAGE</option>
|
||||||
|
<option value="*">JALL</option>
|
||||||
|
</field>
|
||||||
|
</fields>
|
||||||
|
<fields name="list">
|
||||||
|
<field name="limit" type="limitbox" class="input-mini" default="25" label="COM_CONTENT_LIST_LIMIT" description="COM_HELLOWORLD_LIST_LIMIT_DESC" onchange="this.form.submit();" />
|
||||||
|
</fields>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
// Access check: is this user allowed to access the backend of this component?
|
||||||
|
if (!JFactory::getUser()->authorise('core.manage', 'com_speasyimagegallery'))
|
||||||
|
{
|
||||||
|
throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Require helper file
|
||||||
|
JLoader::register('SpeasyimagegalleryHelper', JPATH_COMPONENT . '/helpers/speasyimagegallery.php');
|
||||||
|
$controller = JControllerLegacy::getInstance('Speasyimagegallery');
|
||||||
|
$controller->execute(JFactory::getApplication()->input->get('task'));
|
||||||
|
$controller->redirect();
|
||||||
@ -0,0 +1,63 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<extension type="component" version="3.6" method="upgrade">
|
||||||
|
<name>COM_SPEASYIMAGEGALLERY</name>
|
||||||
|
<creationDate>Mar 2016</creationDate>
|
||||||
|
<author>JoomShaper</author>
|
||||||
|
<authorEmail>support@joomshaper.com</authorEmail>
|
||||||
|
<authorUrl>http://www.joomshaper.com</authorUrl>
|
||||||
|
<copyright>@JoomShaper 2010 - 2017. All rights reserved.</copyright>
|
||||||
|
<license>GNU General Public License version 2 or later</license>
|
||||||
|
<version>1.0</version>
|
||||||
|
<description>A simple image gallery component for Joomla.</description>
|
||||||
|
|
||||||
|
<updateservers>
|
||||||
|
<server type="extension" priority="1" name="SP Easy Image Gallery">https://www.joomshaper.com/updates/com-speasyimagegallery.xml</server>
|
||||||
|
</updateservers>
|
||||||
|
|
||||||
|
<install> <!-- Runs on install -->
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">sql/install.mysql.utf8.sql</file>
|
||||||
|
</sql>
|
||||||
|
</install>
|
||||||
|
|
||||||
|
<uninstall> <!-- Runs on uninstall -->
|
||||||
|
<sql>
|
||||||
|
<file driver="mysql" charset="utf8">sql/uninstall.mysql.utf8.sql</file>
|
||||||
|
</sql>
|
||||||
|
</uninstall>
|
||||||
|
|
||||||
|
<files folder="site">
|
||||||
|
<filename>speasyimagegallery.php</filename>
|
||||||
|
<filename>controller.php</filename>
|
||||||
|
<filename>router.php</filename>
|
||||||
|
<folder>views</folder>
|
||||||
|
<folder>models</folder>
|
||||||
|
<folder>assets</folder>
|
||||||
|
</files>
|
||||||
|
<languages folder="language/site">
|
||||||
|
<language tag="en-GB">en-GB/en-GB.com_speasyimagegallery.ini</language>
|
||||||
|
</languages>
|
||||||
|
|
||||||
|
<administration>
|
||||||
|
<menu link='index.php?option=com_speasyimagegallery'>COM_SPEASYIMAGEGALLERY</menu>
|
||||||
|
<files folder="admin">
|
||||||
|
<filename>speasyimagegallery.php</filename>
|
||||||
|
<filename>config.xml</filename>
|
||||||
|
<filename>controller.php</filename>
|
||||||
|
<filename>access.xml</filename>
|
||||||
|
<folder>assets</folder>
|
||||||
|
<folder>controllers</folder>
|
||||||
|
<folder>helpers</folder>
|
||||||
|
<folder>layouts</folder>
|
||||||
|
<folder>models</folder>
|
||||||
|
<folder>sql</folder>
|
||||||
|
<folder>tables</folder>
|
||||||
|
<folder>views</folder>
|
||||||
|
</files>
|
||||||
|
<languages folder="language/admin">
|
||||||
|
<language tag="en-GB">en-GB/en-GB.com_speasyimagegallery.ini</language>
|
||||||
|
<language tag="en-GB">en-GB/en-GB.com_speasyimagegallery.sys.ini</language>
|
||||||
|
</languages>
|
||||||
|
</administration>
|
||||||
|
|
||||||
|
</extension>
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS `#__speasyimagegallery_albums` (
|
||||||
|
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`asset_id` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to the #__assets table.',
|
||||||
|
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||||
|
`alias` varchar(400) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '',
|
||||||
|
`image` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`published` tinyint(3) NOT NULL DEFAULT '0',
|
||||||
|
`catid` int(10) NOT NULL DEFAULT '0',
|
||||||
|
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`created_by` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`modified_by` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`checked_out` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`attribs` varchar(5120) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`metakey` text COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`metadesc` text COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`access` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`hits` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`metadata` text COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`featured` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'Set if item is featured.',
|
||||||
|
`language` char(7) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The language code for the article.',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS `#__speasyimagegallery_images` (
|
||||||
|
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`asset_id` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT 'FK to the #__assets table.',
|
||||||
|
`album_id` int(10) NOT NULL DEFAULT '0',
|
||||||
|
`title` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||||
|
`alt` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
|
||||||
|
`filename` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`description` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`state` tinyint(3) NOT NULL DEFAULT '0',
|
||||||
|
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`created_by` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`modified` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`modified_by` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`checked_out` int(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`checked_out_time` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
||||||
|
`images` varchar(5120) COLLATE utf8mb4_unicode_ci NOT NULL,
|
||||||
|
`ordering` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`language` char(7) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'The language code for the article.',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 DEFAULT COLLATE=utf8mb4_unicode_ci;
|
||||||
@ -0,0 +1,74 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryTableAlbum extends JTable
|
||||||
|
{
|
||||||
|
|
||||||
|
public function __construct(&$db)
|
||||||
|
{
|
||||||
|
parent::__construct('#__speasyimagegallery_albums', 'id', $db);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store($updateNulls = false)
|
||||||
|
{
|
||||||
|
$date = JFactory::getDate();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
if ($this->id) {
|
||||||
|
$this->modified = $date->toSql();
|
||||||
|
$this->modified_by = $user->get('id');
|
||||||
|
} else {
|
||||||
|
if (!(int) $this->created) {
|
||||||
|
$this->created = $date->toSql();
|
||||||
|
}
|
||||||
|
if (empty($this->created_by)) {
|
||||||
|
$this->created_by = $user->get('id');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that the alias is unique
|
||||||
|
$table = JTable::getInstance('Album', 'SpeasyimagegalleryTable');
|
||||||
|
|
||||||
|
if ($table->load(array('alias' => $this->alias)) && ($table->id != $this->id || $this->id == 0))
|
||||||
|
{
|
||||||
|
$this->setError(JText::_('COM_SPEASYIMAGEGALLERY_ERROR_UNIQUE_ALIAS'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return parent::store($updateNulls);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function check()
|
||||||
|
{
|
||||||
|
// Check for valid name.
|
||||||
|
if (trim($this->title) == '')
|
||||||
|
{
|
||||||
|
throw new UnexpectedValueException(sprintf('The title is empty'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($this->alias))
|
||||||
|
{
|
||||||
|
$this->alias = $this->title;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->alias = JApplicationHelper::stringURLSafe($this->alias, $this->language);
|
||||||
|
|
||||||
|
if (trim(str_replace('-', '', $this->alias)) == '')
|
||||||
|
{
|
||||||
|
$this->alias = JFactory::getDate()->format('Y-m-d-H-i-s');
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,82 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
$doc = JFactory::getDocument();
|
||||||
|
JHtml::_('behavior.formvalidator');
|
||||||
|
JHtml::_('behavior.keepalive');
|
||||||
|
JHtml::_('formbehavior.chosen', 'select', null, array('disable_search_threshold' => 0 ));
|
||||||
|
JHtml::_('jquery.ui', array('core', 'sortable'));
|
||||||
|
|
||||||
|
$doc->addStylesheet(jURI::base(true) . '/components/com_speasyimagegallery/assets/css/font-awesome.min.css');
|
||||||
|
$doc->addStylesheet(jURI::base(true) . '/components/com_speasyimagegallery/assets/css/style.css');
|
||||||
|
$doc->addScript(jURI::base(true) . '/components/com_speasyimagegallery/assets/js/validation.js');
|
||||||
|
$doc->addScript(jURI::base(true) . '/components/com_speasyimagegallery/assets/js/script.js');
|
||||||
|
|
||||||
|
// Language strings
|
||||||
|
JText::script('COM_SPEASYIMAGEGALLERY_DELETE_IMAGE_CONFIRM');
|
||||||
|
JText::script('COM_SPEASYIMAGEGALLERY_IMAGE_UPLOADING');
|
||||||
|
JText::script('COM_SPEASYIMAGEGALLERY_MODAL_EDIT_IMAGE');
|
||||||
|
|
||||||
|
if($this->item->id) {
|
||||||
|
$doc->addScriptdeclaration('var album_id = '. $this->item->id .';');
|
||||||
|
} else {
|
||||||
|
$doc->addScriptdeclaration('var album_id = 0;');
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
<form action="<?php echo JRoute::_('index.php?option=com_speasyimagegallery&layout=edit&id=' . (int) $this->item->id); ?>"
|
||||||
|
method="post" name="adminForm" id="adminForm" class="form-validate">
|
||||||
|
<?php echo JLayoutHelper::render('joomla.edit.title_alias', $this); ?>
|
||||||
|
|
||||||
|
<div class="form-horizontal">
|
||||||
|
|
||||||
|
<div class="row-fluid">
|
||||||
|
<div class="span9">
|
||||||
|
<?php
|
||||||
|
if($this->item->id)
|
||||||
|
{
|
||||||
|
echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'images'));
|
||||||
|
echo JHtml::_('bootstrap.addTab', 'myTab', 'images', 'Images');
|
||||||
|
echo JLayoutHelper::render('images', array('total'=>$this->total, 'images'=>$this->images));
|
||||||
|
echo JHtml::_('bootstrap.endTab');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo JHtml::_('bootstrap.startTabSet', 'myTab', array('active' => 'description'));
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'description', 'Description'); ?>
|
||||||
|
<div>
|
||||||
|
<?php echo $this->form->getInput('description'); ?>
|
||||||
|
</div>
|
||||||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||||
|
|
||||||
|
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'publishing', 'Publishing'); ?>
|
||||||
|
<div>
|
||||||
|
<?php echo $this->form->renderFieldset('publishing'); ?>
|
||||||
|
</div>
|
||||||
|
<?php echo JHtml::_('bootstrap.endTab'); ?>
|
||||||
|
|
||||||
|
<?php echo JHtml::_('bootstrap.endTabSet'); ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span3">
|
||||||
|
<fieldset class="form-vertical">
|
||||||
|
<?php echo $this->form->renderFieldset('info'); ?>
|
||||||
|
</fieldset>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="task" value="album.edit" />
|
||||||
|
<?php echo JHtml::_('form.token'); ?>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryViewAlbum extends JViewLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $form;
|
||||||
|
protected $item;
|
||||||
|
protected $canDo;
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
public function display($tpl = null)
|
||||||
|
{
|
||||||
|
// Get the Data
|
||||||
|
$model = $this->getModel('Album');
|
||||||
|
$this->form = $this->get('Form');
|
||||||
|
$this->item = $this->get('Item');
|
||||||
|
$this->id = $this->item->id;
|
||||||
|
|
||||||
|
$this->images = array();
|
||||||
|
$this->total = 0;
|
||||||
|
if(isset($this->id) && $this->id) {
|
||||||
|
$this->images = $model->getImages($this->id);
|
||||||
|
$this->total = $model->getCount($this->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->canDo = SpeasyimagegalleryHelper::getActions($this->item->id);
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
JError::raiseError(500, implode('<br />', $errors));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->addToolBar();
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addToolBar()
|
||||||
|
{
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
|
||||||
|
// Hide Joomla Administrator Main menu
|
||||||
|
$input->set('hidemainmenu', true);
|
||||||
|
|
||||||
|
$isNew = ($this->item->id == 0);
|
||||||
|
|
||||||
|
JToolBarHelper::title(JText::_('COM_SPEASYIMAGEGALLERY_MANAGER') . ($isNew ? JText::_('COM_SPEASYIMAGEGALLERY_ALBUM_NEW') : JText::_('COM_SPEASYIMAGEGALLERY_ALBUM_EDIT')), 'pictures');
|
||||||
|
|
||||||
|
if ($isNew)
|
||||||
|
{
|
||||||
|
// For new records, check the create permission.
|
||||||
|
if ($this->canDo->get('core.create'))
|
||||||
|
{
|
||||||
|
JToolBarHelper::apply('album.apply', 'JTOOLBAR_APPLY');
|
||||||
|
}
|
||||||
|
JToolBarHelper::cancel('album.cancel', 'JTOOLBAR_CANCEL');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($this->canDo->get('core.edit'))
|
||||||
|
{
|
||||||
|
// We can save the new record
|
||||||
|
JToolBarHelper::apply('album.apply', 'JTOOLBAR_APPLY');
|
||||||
|
JToolBarHelper::save('album.save', 'JTOOLBAR_SAVE');
|
||||||
|
}
|
||||||
|
JToolBarHelper::cancel('album.cancel', 'JTOOLBAR_CLOSE');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,210 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted Access');
|
||||||
|
|
||||||
|
JHtml::_('formbehavior.chosen', 'select');
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$userId = $user->get('id');
|
||||||
|
|
||||||
|
$listOrder = $this->escape($this->filter_order);
|
||||||
|
$listDirn = $this->escape($this->filter_order_Dir);
|
||||||
|
$saveOrder = $listOrder == 'a.ordering';
|
||||||
|
|
||||||
|
if ($saveOrder) {
|
||||||
|
$saveOrderingUrl = 'index.php?option=com_speasyimagegallery&task=albums.saveOrderAjax&tmpl=component';
|
||||||
|
JHtml::_('sortablelist.sortable', 'albumList', 'adminForm', strtolower($listDirn), $saveOrderingUrl, false, true);
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
Joomla.orderTable = function() {
|
||||||
|
table = document.getElementById("sortTable");
|
||||||
|
direction = document.getElementById("directionTable");
|
||||||
|
order = table.options[table.selectedIndex].value;
|
||||||
|
if (order != '<?php echo $listOrder; ?>')
|
||||||
|
{
|
||||||
|
dirn = 'asc';
|
||||||
|
} else {
|
||||||
|
dirn = direction.options[direction.selectedIndex].value;
|
||||||
|
}
|
||||||
|
Joomla.tableOrdering(order, dirn, '');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<form action="<?php echo JRoute::_('index.php?option=com_speasyimagegallery&view=albums'); ?>" method="post" id="adminForm" name="adminForm">
|
||||||
|
<?php if (!empty( $this->sidebar)) : ?>
|
||||||
|
<div id="j-sidebar-container" class="span2">
|
||||||
|
<?php echo $this->sidebar; ?>
|
||||||
|
</div>
|
||||||
|
<div id="j-main-container" class="span10">
|
||||||
|
<?php else : ?>
|
||||||
|
<div id="j-main-container">
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?>
|
||||||
|
|
||||||
|
<?php if (empty($this->items)) : ?>
|
||||||
|
<div class="alert alert-no-items">
|
||||||
|
<?php echo JText::_('JGLOBAL_NO_MATCHING_RESULTS'); ?>
|
||||||
|
</div>
|
||||||
|
<?php else : ?>
|
||||||
|
<table class="table table-striped" id="albumList">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th width="2%" class="nowrap center hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.sort', '<i class="icon-menu-2"></i>', 'a.ordering', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="2%" class="hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.checkall'); ?>
|
||||||
|
</th>
|
||||||
|
<th width="10%">
|
||||||
|
<?php echo JText::_('COM_SPEASYIMAGEGALLERY_HEADING_IMAGE'); ?>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<?php echo JHtml::_('grid.sort', 'JGLOBAL_TITLE', 'a.title', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="10%" class="nowrap hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ACCESS', 'a.access', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="10%" class="nowrap hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.sort', 'JAUTHOR', 'a.created_by', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="10%" class="nowrap hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.sort', 'COM_SPEASYIMAGEGALLERY_HEADING_DATE_CREATED', 'a.created', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="5%" class="nowrap hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_LANGUAGE', 'a.language', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="1%" class="nowrap hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.sort', 'JGLOBAL_HITS', 'a.hits', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="1%" class="nowrap center">
|
||||||
|
<?php echo JHtml::_('grid.sort', 'JSTATUS', 'a.published', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
<th width="1%" class="nowrap hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.sort', 'JGRID_HEADING_ID', 'a.id', $listDirn, $listOrder); ?>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="12">
|
||||||
|
<?php echo $this->pagination->getListFooter(); ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
<?php if (!empty($this->items)) : ?>
|
||||||
|
<?php foreach ($this->items as $i => $item) :
|
||||||
|
$item->max_ordering = 0;
|
||||||
|
$ordering = ($listOrder == 'a.ordering');
|
||||||
|
$canEdit = $user->authorise('core.edit', 'com_sppagebuilder.page.' . $item->id) || ($user->authorise('core.edit.own', 'com_speasyimagegallery.album.' . $item->id) && $item->created_by == $userId);
|
||||||
|
$canCheckin = $user->authorise('core.manage', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0;
|
||||||
|
$canChange = $user->authorise('core.edit.state', 'com_sppagebuilder.page.' . $item->id) && $canCheckin;
|
||||||
|
$link = JRoute::_('index.php?option=com_speasyimagegallery&task=album.edit&id=' . $item->id);
|
||||||
|
?>
|
||||||
|
<tr class="row<?php echo $i % 2; ?>" sortable-group-id="<?php echo $item->catid; ?>">
|
||||||
|
<td class="order nowrap center hidden-phone">
|
||||||
|
<?php
|
||||||
|
$iconClass = '';
|
||||||
|
if (!$canChange)
|
||||||
|
{
|
||||||
|
$iconClass = ' inactive';
|
||||||
|
}
|
||||||
|
elseif (!$saveOrder)
|
||||||
|
{
|
||||||
|
$iconClass = ' inactive tip-top hasTooltip" title="' . JHtml::tooltipText('JORDERINGDISABLED');
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<span class="sortable-handler<?php echo $iconClass ?>">
|
||||||
|
<span class="icon-menu"></span>
|
||||||
|
</span>
|
||||||
|
<?php if ($canChange && $saveOrder) : ?>
|
||||||
|
<input type="text" style="display:none" name="order[]" size="5" value="<?php echo $item->ordering; ?>" class="width-20 text-area-order " />
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td class="hidden-phone">
|
||||||
|
<?php echo JHtml::_('grid.id', $i, $item->id); ?>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<img src="<?php echo JURI::root(true) . '/images/speasyimagegallery/albums/' . $item->id . '/thumb.' . JFile::getExt(basename($item->image)); ?>" alt="" style="width: 64px; height: 64px; border: 1px solid #e5e5e5; background-color: #f5f5f5;">
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<?php if ($item->checked_out) : ?>
|
||||||
|
<?php echo JHtml::_('jgrid.checkedout', $i, $item->editor, $item->checked_out_time, 'albums.', $canCheckin); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if ($canEdit) : ?>
|
||||||
|
<a class="sp-pagebuilder-page-title" href="<?php echo JRoute::_('index.php?option=com_speasyimagegallery&task=album.edit&id='.$item->id);?>">
|
||||||
|
<?php echo $this->escape($item->title); ?>
|
||||||
|
</a>
|
||||||
|
<?php else : ?>
|
||||||
|
<?php echo $this->escape($item->title); ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<span class="small break-word">
|
||||||
|
<?php echo JText::sprintf('JGLOBAL_LIST_ALIAS', $this->escape($item->alias)); ?>
|
||||||
|
</span>
|
||||||
|
<?php if($item->catid) : ?>
|
||||||
|
<div class="small">
|
||||||
|
<?php echo JText::_('JCATEGORY') . ': ' . $this->escape($item->category_title); ?>
|
||||||
|
</div>
|
||||||
|
<?php endif; ?>
|
||||||
|
</td>
|
||||||
|
<td class="hidden-phone">
|
||||||
|
<?php echo $this->escape($item->access_title); ?>
|
||||||
|
</td>
|
||||||
|
<td class="small hidden-phone">
|
||||||
|
<a class="hasTooltip" href="<?php echo JRoute::_('index.php?option=com_users&task=user.edit&id=' . (int) $item->created_by); ?>" title="<?php echo JText::_('JAUTHOR'); ?>">
|
||||||
|
<?php echo $this->escape($item->author_name); ?></a>
|
||||||
|
</td>
|
||||||
|
<td class="nowrap small hidden-phone">
|
||||||
|
<?php
|
||||||
|
echo $item->created > 0 ? JHtml::_('date', $item->created, JText::_('DATE_FORMAT_LC4')) : '-';
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
<td class="small nowrap hidden-phone">
|
||||||
|
<?php if ($item->language == '*') : ?>
|
||||||
|
<?php echo JText::alt('JALL', 'language'); ?>
|
||||||
|
<?php else:?>
|
||||||
|
<?php echo $item->language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?>
|
||||||
|
<?php endif;?>
|
||||||
|
</td>
|
||||||
|
<td class="center hidden-phone">
|
||||||
|
<span class="badge badge-info">
|
||||||
|
<?php echo (int) $item->hits; ?>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="center">
|
||||||
|
<?php echo JHtml::_('jgrid.published', $item->published, $i, 'albums.', $canChange);?>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td align="center" class="hidden-phone">
|
||||||
|
<?php echo $item->id; ?>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<?php endif; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<input type="hidden" name="task" value="" />
|
||||||
|
<input type="hidden" name="boxchecked" value="0" />
|
||||||
|
<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
|
||||||
|
<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
|
||||||
|
<?php echo JHtml::_('form.token'); ?>
|
||||||
|
</form>
|
||||||
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryViewAlbums extends JViewLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $items;
|
||||||
|
protected $pagination;
|
||||||
|
protected $state;
|
||||||
|
public $filterForm;
|
||||||
|
public $activeFilters;
|
||||||
|
protected $sidebar;
|
||||||
|
|
||||||
|
function display($tpl = null)
|
||||||
|
{
|
||||||
|
|
||||||
|
// Get application
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$context = "com_speasyimagegallery.albums";
|
||||||
|
|
||||||
|
// Get data from the model
|
||||||
|
$this->items = $this->get('Items');
|
||||||
|
$this->pagination = $this->get('Pagination');
|
||||||
|
$this->state = $this->get('State');
|
||||||
|
$this->filter_order = $app->getUserStateFromRequest($context.'filter_order', 'filter_order', 'id', 'cmd');
|
||||||
|
$this->filter_order_Dir = $app->getUserStateFromRequest($context.'filter_order_Dir', 'filter_order_Dir', 'desc', 'cmd');
|
||||||
|
$this->filterForm = $this->get('FilterForm');
|
||||||
|
$this->activeFilters = $this->get('ActiveFilters');
|
||||||
|
|
||||||
|
$this->canDo = SpeasyimagegalleryHelper::getActions();
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
JError::raiseError(500, implode('<br />', $errors));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the submenu
|
||||||
|
SpeasyimagegalleryHelper::addSubmenu('albums');
|
||||||
|
$this->addToolBar();
|
||||||
|
$this->sidebar = JHtmlSidebar::render();
|
||||||
|
|
||||||
|
return parent::display($tpl);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function addToolBar()
|
||||||
|
{
|
||||||
|
JToolBarHelper::title(JText::_('COM_SPEASYIMAGEGALLERY_MANAGER') . JText::_('COM_SPEASYIMAGEGALLERY_MANAGER_ALBUMS'), 'pictures');
|
||||||
|
|
||||||
|
if ($this->canDo->get('core.create'))
|
||||||
|
{
|
||||||
|
JToolBarHelper::addNew('album.add', 'JTOOLBAR_NEW');
|
||||||
|
}
|
||||||
|
if ($this->canDo->get('core.edit'))
|
||||||
|
{
|
||||||
|
JToolBarHelper::editList('album.edit', 'JTOOLBAR_EDIT');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->state->get('filter.published') == -2 && $this->canDo->get('core.delete')) {
|
||||||
|
JToolbarHelper::deleteList('', 'albums.delete', 'JTOOLBAR_EMPTY_TRASH');
|
||||||
|
} elseif ($this->canDo->get('core.edit.state')) {
|
||||||
|
JToolbarHelper::trash('albums.trash');
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->canDo->get('core.admin'))
|
||||||
|
{
|
||||||
|
JToolBarHelper::divider();
|
||||||
|
JToolBarHelper::preferences('com_speasyimagegallery');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
7
deployed/speasyimagegallery/components/com_speasyimagegallery/assets/css/style-min.css
vendored
Normal file
7
deployed/speasyimagegallery/components/com_speasyimagegallery/assets/css/style-min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -0,0 +1,412 @@
|
|||||||
|
/**
|
||||||
|
* @package com_spsimplephotogallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
.clearfix {
|
||||||
|
*zoom: 1;
|
||||||
|
}
|
||||||
|
.clearfix:before,
|
||||||
|
.clearfix:after {
|
||||||
|
display: table;
|
||||||
|
content: "";
|
||||||
|
line-height: 0;
|
||||||
|
}
|
||||||
|
.clearfix:after {
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Album List*/
|
||||||
|
.speasyimagegallery-album {
|
||||||
|
float: left;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-description {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.4;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album > div > a {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album > div img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album > div > a:after {
|
||||||
|
content: " ";
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%);
|
||||||
|
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%);
|
||||||
|
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,1) 100%);
|
||||||
|
opacity: .5;
|
||||||
|
-webkit-transition: opacity 400ms;
|
||||||
|
transition: opacity 400ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-info {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
padding: 20px;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-title {
|
||||||
|
display: block;
|
||||||
|
font-size: 18px;
|
||||||
|
line-height: 1;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
color: rgba(255, 255, 255, .9);
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0 0 5px;
|
||||||
|
outline: 0;
|
||||||
|
-webkit-transition: color 400ms;
|
||||||
|
transition: color 400ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-title:hover,
|
||||||
|
.speasyimagegallery-album-title:focus,
|
||||||
|
.speasyimagegallery-album-title:active {
|
||||||
|
outline: 0;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-meta {
|
||||||
|
display: block;
|
||||||
|
margin: -5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-meta > span {
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
margin: 5px;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
color: rgba(255, 255, 255, .6);
|
||||||
|
-webkit-transition: color 400ms;
|
||||||
|
transition: color 400ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album-meta > span:hover,
|
||||||
|
.speasyimagegallery-album-meta > span:active,
|
||||||
|
.speasyimagegallery-album-meta > span:focus {
|
||||||
|
outline: 0;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album:hover > div > a:after {
|
||||||
|
opacity: .7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album:hover .speasyimagegallery-album-title {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album:hover .speasyimagegallery-album-meta > span {
|
||||||
|
color: rgba(255, 255, 255, .8);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Gallery */
|
||||||
|
.speasyimagegallery-gallery {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
.speasyimagegallery-gallery-item {
|
||||||
|
cursor: zoom-in;
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-item img {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-item > div {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-item > div:after {
|
||||||
|
content: " ";
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
top: 0;
|
||||||
|
z-index: 1;
|
||||||
|
background: -moz-linear-gradient(top, rgba(0,0,0,0) 0%, rgba(0,0,0,.3) 100%);
|
||||||
|
background: -webkit-linear-gradient(top, rgba(0,0,0,0) 0%,rgba(0,0,0,.3) 100%);
|
||||||
|
background: linear-gradient(to bottom, rgba(0,0,0,0) 0%,rgba(0,0,0,.3) 100%);
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: opacity 400ms;
|
||||||
|
transition: opacity 400ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-item:hover > div:after {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-item-content {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: 10px;
|
||||||
|
z-index: 2;
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: opacity 400ms;
|
||||||
|
transition: opacity 400ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-item:hover .speasyimagegallery-gallery-item-content {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-item-title {
|
||||||
|
display: block;
|
||||||
|
color: #fff;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
font-size: 13px;
|
||||||
|
line-height: 1.2;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*Modal*/
|
||||||
|
.speasyimagegallery-modal-open {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-modal-wrapper {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 1033;
|
||||||
|
background: rgba(0, 0, 0, 0.8);
|
||||||
|
overflow: hidden;
|
||||||
|
text-align: center;
|
||||||
|
cursor: zoom-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-modal {
|
||||||
|
position: fixed;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
background: #000;
|
||||||
|
z-index: 1034;
|
||||||
|
max-width: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||||
|
-webkit-box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
|
||||||
|
-webkit-transform: translate(-50%, -50%);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-next,
|
||||||
|
.speasyimagegallery-prev {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
width: 40px;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transition: opacity 300ms;
|
||||||
|
transition: opacity 300ms;
|
||||||
|
}
|
||||||
|
.speasyimagegallery-next {
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-prev {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-modal-wrapper:hover .speasyimagegallery-next,
|
||||||
|
.speasyimagegallery-modal-wrapper:hover .speasyimagegallery-prev {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-next > span,
|
||||||
|
.speasyimagegallery-prev > span {
|
||||||
|
display: block;
|
||||||
|
position: relative;
|
||||||
|
top: 50%;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
border-top: 5px solid #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-next > span {
|
||||||
|
left: -3px;
|
||||||
|
border-right: 5px solid #fff;
|
||||||
|
transform: rotate(45deg) translateY(-50%);
|
||||||
|
-webkit-transform: rotate(45deg) translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-prev > span {
|
||||||
|
left: 22px;
|
||||||
|
border-left: 5px solid #fff;
|
||||||
|
transform: rotate(-45deg) translateY(-50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-hidden,
|
||||||
|
.speasyimagegallery-close.speasyimagegallery-hidden {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-close,
|
||||||
|
.speasyimagegallery-close:hover,
|
||||||
|
.speasyimagegallery-close:active,
|
||||||
|
.speasyimagegallery-close:focus {
|
||||||
|
display: block;
|
||||||
|
font-size: 30px;
|
||||||
|
height: 36px;
|
||||||
|
width: 36px;
|
||||||
|
line-height: 36px;
|
||||||
|
color: rgba(255, 255, 255, .8);
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
position: absolute;
|
||||||
|
top: -36px;
|
||||||
|
right: -10px;
|
||||||
|
text-decoration: none;
|
||||||
|
outline: none;
|
||||||
|
-webkit-transition: color 300ms;
|
||||||
|
transition: color 300ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-close:hover {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-modal-close:hover,
|
||||||
|
.speasyimagegallery-modal-close:active,
|
||||||
|
.speasyimagegallery-modal-close:focus {
|
||||||
|
color: #2384d3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-wrapper {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-modal-body {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-content {
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
background: rgba(0, 0,0, .8);
|
||||||
|
color: #fff;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 24px;
|
||||||
|
padding: 10px;
|
||||||
|
text-align: left;
|
||||||
|
-webkit-animation: fadeInUp 300ms;
|
||||||
|
animation: fadeInUp 300ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-image-title {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: bold;
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-stat {
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 13px;
|
||||||
|
color: rgba(255, 255, 255, 0.5);
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery-loading {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
margin-left: -12px;
|
||||||
|
margin-top: -12px;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
border: 0.25rem solid rgba(255, 255, 255, .2);
|
||||||
|
border-top-color: #fff;
|
||||||
|
-webkit-animation: spin 1s infinite linear;
|
||||||
|
animation: spin 1s infinite linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes spin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes spin {
|
||||||
|
0% {
|
||||||
|
-webkit-transform: rotate(0deg);
|
||||||
|
transform: rotate(0deg);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
-webkit-transform: rotate(360deg);
|
||||||
|
transform: rotate(360deg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@-webkit-keyframes pulse {
|
||||||
|
50% {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@keyframes pulse {
|
||||||
|
50% {
|
||||||
|
background: white;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@-webkit-keyframes fadeInUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transform: translate3d(0, 100%, 0);
|
||||||
|
transform: translate3d(0, 100%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
-webkit-transform: none;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes fadeInUp {
|
||||||
|
from {
|
||||||
|
opacity: 0;
|
||||||
|
-webkit-transform: translate3d(0, 100%, 0);
|
||||||
|
transform: translate3d(0, 100%, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
opacity: 1;
|
||||||
|
-webkit-transform: none;
|
||||||
|
transform: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
7
deployed/speasyimagegallery/components/com_speasyimagegallery/assets/js/script-min.js
vendored
Normal file
7
deployed/speasyimagegallery/components/com_speasyimagegallery/assets/js/script-min.js
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
!function(a){a.fn.speasyimagegallery=function(b){var c={showCounter:!0,showTitle:!0,showDescription:!0};this.each(function(){b&&a.extend(c,b);var d=this,e=function(){this.items=a(d).parent().children(),this.count=this.items.length-1,this.index=this.items.index(d),this.navPrev="",this.navNext="",this.loaded=!1,this.naturalWidth=0,this.naturalHeight=0,this.init=function(){this.modal(),this.goto(this.index);var b=this;this.navNext.on("click",function(a){a.preventDefault(),b.next()}),a(document).on("click",".speasyimagegallery-image",function(a){a.preventDefault(),b.next()}),a(document).on("click",".speasyimagegallery-modal-wrapper, .speasyimagegallery-close",function(a){a.target===this&&(a.preventDefault(),b.close())}),a(document).on("keyup",function(a){39==a.keyCode&&(a.preventDefault(),b.next()),37==a.keyCode&&(a.preventDefault(),b.prev()),27==a.keyCode&&(a.preventDefault(),b.close())}),this.navPrev.on("click",function(a){a.preventDefault(),b.prev()}),a(window).on("resize",function(){var c=b.resize();a(".speasyimagegallery-modal").css({width:c.width,height:c.height})})},this.modal=function(){a('<div id="speasyimagegallery-modal" class="speasyimagegallery-modal-wrapper"><a href="#" class="speasyimagegallery-prev"><span></span></a><a href="#" class="speasyimagegallery-next"><span></span></a><div class="speasyimagegallery-modal"><a href="#" class="speasyimagegallery-close speasyimagegallery-hidden">×</a><div class="speasyimagegallery-modal-body"></div></div></div>').appendTo(a("body").addClass("speasyimagegallery-modal-open")),this.modal=a("#speasyimagegallery-modal"),this.navNext=this.modal.find(".speasyimagegallery-next"),this.navPrev=this.modal.find(".speasyimagegallery-prev")},this.close=function(){this.index=0,this.loaded=!0,this.naturalWidth=0,this.naturalHeight=0,a("#speasyimagegallery-modal").fadeOut(function(){a(this).remove()}),a(".speasyimagegallery-modal").animate({width:100,height:100},300,function(){a(this).remove(),a("body").removeClass("speasyimagegallery-modal-open")})},this.resize=function(){var b=a(window).width()-80,c=a(window).height()-80,d=0,e=this.naturalWidth,f=this.naturalHeight;return e>b&&(d=b/e,f*=d,e*=d),f>c&&(d=c/f,e*=d,f*=d),{width:e,height:f}},this.next=function(){this.index<this.count?this.index=this.index+1:this.index=0,this.goto(this.index)},this.prev=function(){this.index>0?this.index=this.index-1:this.index=this.count,this.goto(this.index)},this.goto=function(b){if(this.loaded===!1){var d=this,e=a(this.items[b]);d.loaded=!0,a(".speasyimagegallery-modal-body").html('<div class="speasyimagegallery-gallery-loading"></div>');var f=a("<img />").attr("src",e.attr("href")).on("load",function(){if(this.complete&&"undefined"!=typeof this.naturalWidth&&0!=this.naturalWidth){d.naturalWidth=this.naturalWidth,d.naturalHeight=this.naturalHeight;var b=d.resize();a(".speasyimagegallery-modal").animate({width:b.width,height:b.height},300,function(){var b='<div class="speasyimagegallery-image-wrapper">';b+='<img class="speasyimagegallery-image img-responsive" src="'+f[0].src+'" alt="'+e.attr("data-alt")+'">',(c.showCounter||c.showTitle&&e.attr("data-title")||c.showDescription&&e.attr("data-desc"))&&(e.attr("data-title")||e.attr("data-description"))&&(b+='<div class="speasyimagegallery-image-content">',c.showCounter&&(b+='<span class="speasyimagegallery-gallery-stat">'+(d.index+1)+" of "+(d.count+1)+"</span>"),c.showTitle&&e.attr("data-title")&&(b+='<span class="speasyimagegallery-image-title">'+e.attr("data-title")+"</span>"),c.showDescription&&e.attr("data-desc")&&(b+='<div class="speasyimagegallery-image-description">'+e.attr("data-desc")+"</div>"),b+="</div>"),b+="</div>",a(".speasyimagegallery-modal-body").html(b),d.modal.find(".speasyimagegallery-hidden").removeClass("speasyimagegallery-hidden"),d.loaded=!1})}else;})}}};(new e).init()})}}(jQuery);
|
||||||
@ -0,0 +1,228 @@
|
|||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
;(function($){
|
||||||
|
|
||||||
|
$.fn.speasyimagegallery = function(options) {
|
||||||
|
|
||||||
|
var settings = {
|
||||||
|
'showCounter': true,
|
||||||
|
'showTitle': true,
|
||||||
|
'showDescription': true
|
||||||
|
};
|
||||||
|
|
||||||
|
this.each(function() {
|
||||||
|
|
||||||
|
if (options) {
|
||||||
|
$.extend(settings, options);
|
||||||
|
}
|
||||||
|
|
||||||
|
var item = this;
|
||||||
|
|
||||||
|
var speasyimagegallery = function(){
|
||||||
|
|
||||||
|
this.items = $(item).parent().children();
|
||||||
|
this.count = (this.items.length) - 1;
|
||||||
|
this.index = this.items.index(item);
|
||||||
|
this.navPrev = '';
|
||||||
|
this.navNext = '';
|
||||||
|
this.loaded = false;
|
||||||
|
this.naturalWidth = 0;
|
||||||
|
this.naturalHeight = 0;
|
||||||
|
|
||||||
|
this.init = function() {
|
||||||
|
this.modal();
|
||||||
|
this.goto(this.index);
|
||||||
|
var that = this;
|
||||||
|
|
||||||
|
this.navNext.on('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
that.next();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.speasyimagegallery-image', function(event){
|
||||||
|
event.preventDefault();
|
||||||
|
that.next();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('click', '.speasyimagegallery-modal-wrapper, .speasyimagegallery-close', function(event){
|
||||||
|
if (event.target !== this) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.preventDefault();
|
||||||
|
that.close();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(document).on('keyup', function(event) {
|
||||||
|
if(event.keyCode == 39) {
|
||||||
|
event.preventDefault();
|
||||||
|
that.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event.keyCode == 37) {
|
||||||
|
event.preventDefault();
|
||||||
|
that.prev();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(event.keyCode == 27) {
|
||||||
|
event.preventDefault();
|
||||||
|
that.close();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
this.navPrev.on('click', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
that.prev();
|
||||||
|
});
|
||||||
|
|
||||||
|
$(window).on('resize', function() {
|
||||||
|
var dimension = that.resize();
|
||||||
|
$('.speasyimagegallery-modal').css({
|
||||||
|
width: dimension.width,
|
||||||
|
height: dimension.height
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
this.modal = function() {
|
||||||
|
$('<div id="speasyimagegallery-modal" class="speasyimagegallery-modal-wrapper"><a href="#" class="speasyimagegallery-prev"><span></span></a><a href="#" class="speasyimagegallery-next"><span></span></a><div class="speasyimagegallery-modal"><a href="#" class="speasyimagegallery-close speasyimagegallery-hidden">×</a><div class="speasyimagegallery-modal-body"></div></div></div>').appendTo($('body').addClass('speasyimagegallery-modal-open'));
|
||||||
|
this.modal = $('#speasyimagegallery-modal');
|
||||||
|
this.navNext = this.modal.find('.speasyimagegallery-next');
|
||||||
|
this.navPrev = this.modal.find('.speasyimagegallery-prev');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.close = function() {
|
||||||
|
this.index = 0;
|
||||||
|
this.loaded = true;
|
||||||
|
this.naturalWidth = 0;
|
||||||
|
this.naturalHeight = 0;
|
||||||
|
|
||||||
|
$('#speasyimagegallery-modal').fadeOut(function() {
|
||||||
|
$(this).remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.speasyimagegallery-modal').animate({
|
||||||
|
width: 100,
|
||||||
|
height: 100
|
||||||
|
}, 300, function() {
|
||||||
|
$(this).remove();
|
||||||
|
$('body').removeClass('speasyimagegallery-modal-open')
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resize modal window
|
||||||
|
this.resize = function() {
|
||||||
|
var maxWidth = ($(window).width()) - 80;
|
||||||
|
var maxHeight = ($(window).height()) - 80;
|
||||||
|
var ratio = 0;
|
||||||
|
var width = this.naturalWidth;
|
||||||
|
var height = this.naturalHeight;
|
||||||
|
|
||||||
|
if(width > maxWidth){
|
||||||
|
ratio = maxWidth / width;
|
||||||
|
height = height * ratio;
|
||||||
|
width = width * ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(height > maxHeight){
|
||||||
|
ratio = maxHeight / height;
|
||||||
|
width = width * ratio;
|
||||||
|
height = height * ratio;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
'width': width,
|
||||||
|
'height': height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go to next
|
||||||
|
this.next = function() {
|
||||||
|
if (this.index < this.count) {
|
||||||
|
this.index = this.index + 1;
|
||||||
|
} else {
|
||||||
|
this.index = 0;
|
||||||
|
}
|
||||||
|
this.goto(this.index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go to Prev
|
||||||
|
this.prev = function() {
|
||||||
|
if (this.index > 0) {
|
||||||
|
this.index = this.index -1;
|
||||||
|
} else {
|
||||||
|
this.index = this.count;
|
||||||
|
}
|
||||||
|
this.goto(this.index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Go to index
|
||||||
|
this.goto = function(index) {
|
||||||
|
|
||||||
|
if(this.loaded === false) {
|
||||||
|
var that = this;
|
||||||
|
var $item = $(this.items[index]);
|
||||||
|
that.loaded = true;
|
||||||
|
|
||||||
|
$('.speasyimagegallery-modal-body').html('<div class="speasyimagegallery-gallery-loading"></div>');
|
||||||
|
|
||||||
|
var img = $("<img />").attr('src', $item.attr('href')).on('load', function() {
|
||||||
|
if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
that.naturalWidth = this.naturalWidth;
|
||||||
|
that.naturalHeight = this.naturalHeight;
|
||||||
|
|
||||||
|
var dimension = that.resize();
|
||||||
|
|
||||||
|
$('.speasyimagegallery-modal').animate({
|
||||||
|
width: dimension.width,
|
||||||
|
height: dimension.height
|
||||||
|
}, 300, function() {
|
||||||
|
var galleryHtml = '<div class="speasyimagegallery-image-wrapper">';
|
||||||
|
galleryHtml += '<img class="speasyimagegallery-image img-responsive" src="'+ img[0].src +'" alt="'+ $item.attr('data-alt') +'">';
|
||||||
|
|
||||||
|
if((settings.showCounter) || (settings.showTitle && $item.attr('data-title')) || (settings.showDescription && $item.attr('data-desc'))) {
|
||||||
|
if($item.attr('data-title') || $item.attr('data-description')) {
|
||||||
|
galleryHtml += '<div class="speasyimagegallery-image-content">';
|
||||||
|
|
||||||
|
if(settings.showCounter){
|
||||||
|
galleryHtml += '<span class="speasyimagegallery-gallery-stat">'+ (that.index + 1) + ' of ' + (that.count + 1) +'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.showTitle && $item.attr('data-title')) {
|
||||||
|
galleryHtml += '<span class="speasyimagegallery-image-title">'+ $item.attr('data-title') +'</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings.showDescription && $item.attr('data-desc')) {
|
||||||
|
galleryHtml += '<div class="speasyimagegallery-image-description">'+ $item.attr('data-desc') +'</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
galleryHtml += '</div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
galleryHtml += '</div>'
|
||||||
|
|
||||||
|
$('.speasyimagegallery-modal-body').html(galleryHtml);
|
||||||
|
that.modal.find('.speasyimagegallery-hidden').removeClass('speasyimagegallery-hidden');
|
||||||
|
that.loaded = false;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
new speasyimagegallery().init();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryController extends JControllerLegacy
|
||||||
|
{
|
||||||
|
}
|
||||||
@ -0,0 +1,122 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryModelAlbum extends JModelItem
|
||||||
|
{
|
||||||
|
protected $_context = 'com_speasyimagegallery.album';
|
||||||
|
|
||||||
|
protected function populateState()
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication('site');
|
||||||
|
|
||||||
|
$albumId = $app->input->getInt('id');
|
||||||
|
$this->setState('album.id', $albumId);
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
$this->setState('filter.language', JLanguageMultilang::isEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getItem( $albumId = null )
|
||||||
|
{
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
|
||||||
|
$albumId = (!empty($albumId))? $albumId : (int)$this->getState('album.id');
|
||||||
|
|
||||||
|
if ( $this->_item == null )
|
||||||
|
{
|
||||||
|
$this->_item = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($this->_item[$albumId]))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
$db = $this->getDbo();
|
||||||
|
$query = $db->getQuery(true)
|
||||||
|
->select('a.*')
|
||||||
|
->from('#__speasyimagegallery_albums as a')
|
||||||
|
->where('a.id = ' . (int) $albumId);
|
||||||
|
|
||||||
|
$query->select('l.title AS language_title')
|
||||||
|
->leftJoin( $db->quoteName('#__languages') . ' AS l ON l.lang_code = a.language');
|
||||||
|
|
||||||
|
$query->select('ua.name AS author_name')
|
||||||
|
->leftJoin('#__users AS ua ON ua.id = a.created_by');
|
||||||
|
|
||||||
|
// Filter by published state.
|
||||||
|
$query->where('a.published = 1');
|
||||||
|
|
||||||
|
if ($this->getState('filter.language'))
|
||||||
|
{
|
||||||
|
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||||
|
}
|
||||||
|
|
||||||
|
$db->setQuery($query);
|
||||||
|
$data = $db->loadObject();
|
||||||
|
|
||||||
|
if(isset($data->id) && $data->id) {
|
||||||
|
$data->images = $this->getImages($data->id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty($data)) {
|
||||||
|
return JError::raiseError(404, JText::_('COM_SPEASYIMAGEGALLERY_ERROR_ALBUM_NOT_FOUND'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$groups = $user->getAuthorisedViewLevels();
|
||||||
|
if(!in_array($data->access, $groups)) {
|
||||||
|
return JError::raiseError(404, JText::_('COM_SPEASYIMAGEGALLERY_ERROR_ALBUM_NOT_AUTHORISED'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_item[$albumId] = $data;
|
||||||
|
}
|
||||||
|
catch (Exception $e)
|
||||||
|
{
|
||||||
|
if ($e->getCode() == 404 )
|
||||||
|
{
|
||||||
|
JError::raiseError(404, $e->getMessage());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->setError($e);
|
||||||
|
$this->_item[$albumId] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->_item[$albumId];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getImages($album_id) {
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
$query->select(array('a.*'));
|
||||||
|
$query->from($db->quoteName('#__speasyimagegallery_images', 'a'));
|
||||||
|
$query->where($db->quoteName('album_id') . ' = '. $db->quote($album_id));
|
||||||
|
$query->where($db->quoteName('state') . ' = '. $db->quote(1));
|
||||||
|
$query->order('a.ordering DESC');
|
||||||
|
$db->setQuery($query);
|
||||||
|
return $db->loadObjectList();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function hit($pk = 0)
|
||||||
|
{
|
||||||
|
$pk = (!empty($pk)) ? $pk : (int) $this->getState('album.id');
|
||||||
|
$table = JTable::getInstance('Album', 'SpeasyimagegalleryTable');
|
||||||
|
$table->load($pk);
|
||||||
|
$table->hit($pk);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryModelAlbums extends JModelList
|
||||||
|
{
|
||||||
|
|
||||||
|
protected function getListQuery()
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$user = JFactory::getUser();
|
||||||
|
$catid = $app->input->get('catid', 0, 'INT');
|
||||||
|
|
||||||
|
// Create a new query object.
|
||||||
|
$db = $this->getDbo();
|
||||||
|
$query = $db->getQuery(true);
|
||||||
|
|
||||||
|
// Select the required fields from the table.
|
||||||
|
$query->select('a.*');
|
||||||
|
$query->from($db->quoteName('#__speasyimagegallery_albums', 'a'));
|
||||||
|
|
||||||
|
// Join over the categories.
|
||||||
|
$query->select('c.title AS category_title, c.alias AS category_alias')
|
||||||
|
->join('LEFT', '#__categories AS c ON c.id = a.catid');
|
||||||
|
|
||||||
|
// Images count
|
||||||
|
$query->select('CASE WHEN c.count IS NULL THEN 0 ELSE c.count END as count')->join('LEFT', '( SELECT b.album_id, COUNT(b.album_id) as count FROM '. $db->quoteName('#__speasyimagegallery_images', 'b') . ' WHERE b.state = 1 GROUP BY b.album_id ) AS c ON c.album_id = a.id');
|
||||||
|
|
||||||
|
//Authorised
|
||||||
|
$groups = implode(',', $user->getAuthorisedViewLevels());
|
||||||
|
$query->where('a.access IN (' . $groups . ')');
|
||||||
|
|
||||||
|
// Filter category
|
||||||
|
if($catid) {
|
||||||
|
$query->where('a.catid = ' . $catid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter by language
|
||||||
|
$query->where('a.language in (' . $db->quote(JFactory::getLanguage()->getTag()) . ',' . $db->quote('*') . ')');
|
||||||
|
$query->where('a.published = 1');
|
||||||
|
$query->order('a.ordering ASC');
|
||||||
|
|
||||||
|
return $query;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,158 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryRouter extends JComponentRouterBase
|
||||||
|
{
|
||||||
|
public function build(&$query)
|
||||||
|
{
|
||||||
|
$segments = array();
|
||||||
|
|
||||||
|
// We need a menu item. Either the one specified in the query, or the current active one if none specified
|
||||||
|
if (empty($query['Itemid']))
|
||||||
|
{
|
||||||
|
$menuItem = $this->menu->getActive();
|
||||||
|
$menuItemGiven = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$menuItem = $this->menu->getItem($query['Itemid']);
|
||||||
|
$menuItemGiven = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check again
|
||||||
|
if ($menuItemGiven && isset($menuItem) && $menuItem->component != 'com_speasyimagegallery')
|
||||||
|
{
|
||||||
|
$menuItemGiven = false;
|
||||||
|
unset($query['Itemid']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($query['view']))
|
||||||
|
{
|
||||||
|
$view = $query['view'];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We need to have a view in the query or it is an invalid URL
|
||||||
|
return $segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Are we dealing with an album that is attached to a menu item?
|
||||||
|
if (($menuItem instanceof stdClass)
|
||||||
|
&& $menuItem->query['view'] == $query['view']
|
||||||
|
&& isset($query['id'])
|
||||||
|
&& $menuItem->query['id'] == (int) $query['id'])
|
||||||
|
{
|
||||||
|
|
||||||
|
unset($query['view']);
|
||||||
|
unset($query['id']);
|
||||||
|
|
||||||
|
return $segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($view == 'album')
|
||||||
|
{
|
||||||
|
if (!$menuItemGiven)
|
||||||
|
{
|
||||||
|
$segments[] = $view;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($query['view']);
|
||||||
|
|
||||||
|
if ($view == 'album')
|
||||||
|
{
|
||||||
|
if (isset($query['id']))
|
||||||
|
{
|
||||||
|
// Make sure we have the id and the alias
|
||||||
|
if (strpos($query['id'], ':') === false)
|
||||||
|
{
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$dbQuery = $db->getQuery(true)
|
||||||
|
->select('alias')
|
||||||
|
->from('#__speasyimagegallery_albums')
|
||||||
|
->where('id=' . (int) $query['id']);
|
||||||
|
$db->setQuery($dbQuery);
|
||||||
|
$alias = $db->loadResult();
|
||||||
|
$query['id'] = $query['id'] . ':' . $alias;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $segments;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return $segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($view == 'album')
|
||||||
|
{
|
||||||
|
list($tmp, $id) = explode(':', $query['id'], 2);
|
||||||
|
$segments[] = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
unset($query['id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$total = count($segments);
|
||||||
|
|
||||||
|
for ($i = 0; $i < $total; $i++)
|
||||||
|
{
|
||||||
|
$segments[$i] = str_replace(':', '-', $segments[$i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $segments;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public function parse(&$segments)
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menu = $app->getMenu();
|
||||||
|
$item = $menu->getActive();
|
||||||
|
$count = count($segments);
|
||||||
|
|
||||||
|
$vars = array();
|
||||||
|
$vars['view'] = 'album';
|
||||||
|
|
||||||
|
if (!isset($item))
|
||||||
|
{
|
||||||
|
$alias = $segments[$count - 1];
|
||||||
|
} else {
|
||||||
|
$alias = $segments[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = JFactory::getDbo();
|
||||||
|
$dbquery = $db->getQuery(true);
|
||||||
|
$dbquery->select($dbquery->qn('id'))
|
||||||
|
->from($dbquery->qn('#__speasyimagegallery_albums'))
|
||||||
|
->where('alias = ' . $dbquery->q($alias));
|
||||||
|
$db->setQuery($dbquery);
|
||||||
|
|
||||||
|
$vars['id'] = $db->loadResult();
|
||||||
|
|
||||||
|
return $vars;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function speasyimagegalleryBuildRoute(&$query)
|
||||||
|
{
|
||||||
|
$router = new SpeasyimagegalleryRouter;
|
||||||
|
|
||||||
|
return $router->build($query);
|
||||||
|
}
|
||||||
|
|
||||||
|
function speasyimagegalleryParseRoute($segments)
|
||||||
|
{
|
||||||
|
$router = new SpeasyimagegalleryRouter;
|
||||||
|
|
||||||
|
return $router->parse($segments);
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
$controller = JControllerLegacy::getInstance('Speasyimagegallery');
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
$controller->execute($input->getCmd('task'));
|
||||||
|
$controller->redirect();
|
||||||
@ -0,0 +1,153 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
JHtml::_('jquery.framework');
|
||||||
|
$doc = JFactory::getDocument();
|
||||||
|
$doc->addStylesheet(JURI::base(true) . '/components/com_speasyimagegallery/assets/css/style-min.css');
|
||||||
|
$doc->addScript(JURI::base(true) . '/components/com_speasyimagegallery/assets/js/script-min.js');
|
||||||
|
|
||||||
|
$column = $this->params->get('column', 4);
|
||||||
|
if ($column > 12) {
|
||||||
|
$column = 12;
|
||||||
|
}
|
||||||
|
$width = round(100 / $column, 4);
|
||||||
|
$gutter = round($this->params->get('gutter', 20) / 2);
|
||||||
|
|
||||||
|
// Tablet
|
||||||
|
$column_sm = $this->params->get('column_sm', 3);
|
||||||
|
if ($column_sm > 12) {
|
||||||
|
$column_sm = 12;
|
||||||
|
}
|
||||||
|
$width_sm = round(100 / $column_sm, 4);
|
||||||
|
$gutter_sm = round($this->params->get('gutter_sm', 15) / 2);
|
||||||
|
|
||||||
|
// Mobile
|
||||||
|
$column_xs = $this->params->get('column_xs', 2);
|
||||||
|
if ($column_xs > 12) {
|
||||||
|
$column_xs = 12;
|
||||||
|
}
|
||||||
|
$width_xs = round(100 / $column_xs, 4);
|
||||||
|
$gutter_xs = round($this->params->get('gutter_xs', 10) / 2);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
jQuery(function($) {
|
||||||
|
$(document).on('click', '.speasyimagegallery-gallery-item', function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
$(this).speasyimagegallery({
|
||||||
|
showCounter: true,
|
||||||
|
showTitle: true,
|
||||||
|
showDescription: true
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.custom-btn {
|
||||||
|
color: black !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-btn:hover {
|
||||||
|
color: black !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-btn:visited {
|
||||||
|
color: black !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.custom-clearfix {
|
||||||
|
color: black !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery {
|
||||||
|
margin: -<?php echo $gutter; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery>.speasyimagegallery-gallery-item {
|
||||||
|
width: <?php echo $width; ?>%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery>.speasyimagegallery-gallery-item>div {
|
||||||
|
margin: <?php echo $gutter; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.antracit {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width : 767px) {
|
||||||
|
.speasyimagegallery-gallery {
|
||||||
|
margin: -<?php echo $gutter_sm; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery>.speasyimagegallery-gallery-item {
|
||||||
|
width: <?php echo $width_sm; ?>%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery>.speasyimagegallery-gallery-item>div {
|
||||||
|
margin: <?php echo $gutter_sm; ?>px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width : 479px) {
|
||||||
|
.speasyimagegallery-gallery {
|
||||||
|
margin: -<?php echo $gutter_xs; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery>.speasyimagegallery-gallery-item {
|
||||||
|
width: <?php echo $width_xs; ?>%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-gallery>.speasyimagegallery-gallery-item>div {
|
||||||
|
margin: <?php echo $gutter_xs; ?>px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<?php if ($this->params->get('show_page_heading', 1)) : ?>
|
||||||
|
<h1 class="antracit"><?php echo $this->escape($this->params->get('page_heading')); ?></h1>
|
||||||
|
<br />
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($this->item->description) : ?>
|
||||||
|
<div class="speasyimagegallery-album-description"><?php echo $this->item->description; ?></div>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
if (count($this->item->images)) {
|
||||||
|
?>
|
||||||
|
<div class="speasyimagegallery-gallery clearfix">
|
||||||
|
<?php
|
||||||
|
foreach ($this->item->images as $key => $this->item->image) {
|
||||||
|
$source = json_decode($this->item->image->images);
|
||||||
|
?>
|
||||||
|
<a class="speasyimagegallery-gallery-item" target="_blank" href="<?php echo $source->original; ?>" data-title="<?php echo $this->item->image->title; ?>" data-alt="<?php echo $this->item->image->alt; ?>" data-desc="<?php echo strip_tags($this->item->image->description); ?>">
|
||||||
|
<div>
|
||||||
|
<img src="<?php echo $source->thumb; ?>" title="<?php echo $this->item->image->title; ?>" alt="<?php echo $this->item->image->alt; ?>">
|
||||||
|
<div class="speasyimagegallery-gallery-item-content">
|
||||||
|
<span class="speasyimagegallery-gallery-item-title"><?php echo $this->item->image->title; ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert">' . JText::_('COM_SPEASYIMAGEGALLERY_NO_IMAGES') . '</div>';
|
||||||
|
} ?>
|
||||||
|
</div>
|
||||||
|
<div class="row"> </div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<layout title="COM_SPEASYIMAGEGALLERY_VIEW_ALBUM_TITLE">
|
||||||
|
</layout>
|
||||||
|
<fields name="request" addfieldpath="/administrator/components/com_speasyimagegallery/models/fields">
|
||||||
|
<fieldset name="request">
|
||||||
|
<field name="id" type="albums" label="COM_SPEASYIMAGEGALLERY_CHOOSE_ALBUM" description="COM_SPEASYIMAGEGALLERY_CHOOSE_ALBUM_DESC" required="required">
|
||||||
|
</field>
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset name="basic" label="COM_SPEASYIMAGEGALLERY_OPTIONS">
|
||||||
|
<field name="column" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_DESC" default="4" min="1" max="12" />
|
||||||
|
<field name="column_sm" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_SM" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_SM_DESC" default="3" min="1" max="12" />
|
||||||
|
<field name="column_xs" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_XS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_XS_DESC" default="2" min="1" max="12" />
|
||||||
|
<field name="gutter" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_DESC" default="20" />
|
||||||
|
<field name="gutter_sm" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_SM" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_SM_DESC" default="15" />
|
||||||
|
<field name="gutter_xs" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_XS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_XS_DESC" default="10" />
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1,89 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
jimport('joomla.application.component.helper');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryViewAlbum extends JViewLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $item;
|
||||||
|
protected $params;
|
||||||
|
|
||||||
|
function display($tpl = null)
|
||||||
|
{
|
||||||
|
// Assign data to the view
|
||||||
|
$this->item = $this->get('Item');
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$this->params = $app->getParams();
|
||||||
|
$menus = JFactory::getApplication()->getMenu();
|
||||||
|
$menu = $menus->getActive();
|
||||||
|
|
||||||
|
if($menu) {
|
||||||
|
$this->params->merge($menu->params);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
JError::raiseWarning(500, implode("\n", $errors));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$model = $this->getModel();
|
||||||
|
$model->hit();
|
||||||
|
|
||||||
|
$this->_prepareDocument($this->item);
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _prepareDocument($item)
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$title = null;
|
||||||
|
|
||||||
|
// Because the application sets a default page title,
|
||||||
|
$this->params->def('page_heading', $item->title);
|
||||||
|
$title = $item->title;
|
||||||
|
|
||||||
|
if (empty($title))
|
||||||
|
{
|
||||||
|
$title = $app->get('sitename');
|
||||||
|
}
|
||||||
|
elseif ($app->get('sitename_pagetitles', 0) == 1)
|
||||||
|
{
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
|
||||||
|
}
|
||||||
|
elseif ($app->get('sitename_pagetitles', 0) == 2)
|
||||||
|
{
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->document->setTitle($title);
|
||||||
|
|
||||||
|
if (isset($this->item->metadesc) && $this->item->metadesc)
|
||||||
|
{
|
||||||
|
$this->document->setDescription($this->item->metadesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->item->metakey) && $this->item->metakey)
|
||||||
|
{
|
||||||
|
$this->document->setMetadata('keywords', $this->item->metakey);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->params->get('robots'))
|
||||||
|
{
|
||||||
|
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
$doc = JFactory::getDocument();
|
||||||
|
$doc->addStylesheet( JURI::base(true) . '/components/com_speasyimagegallery/assets/css/style-min.css' );
|
||||||
|
$input = JFactory::getApplication()->input;
|
||||||
|
|
||||||
|
$column = $this->params->get('column', 4);
|
||||||
|
if($column > 12) {
|
||||||
|
$column = 12;
|
||||||
|
}
|
||||||
|
$width = round(100/$column, 4);
|
||||||
|
$gutter = round($this->params->get('gutter', 20)/2);
|
||||||
|
|
||||||
|
// Tablet
|
||||||
|
$column_sm = $this->params->get('column_sm', 3);
|
||||||
|
if($column_sm > 12) {
|
||||||
|
$column_sm = 12;
|
||||||
|
}
|
||||||
|
$width_sm = round(100/$column_sm, 4);
|
||||||
|
$gutter_sm = round($this->params->get('gutter_sm', 15)/2);
|
||||||
|
|
||||||
|
// Mobile
|
||||||
|
$column_xs = $this->params->get('column_xs', 2);
|
||||||
|
if($column_xs > 12) {
|
||||||
|
$column_xs = 12;
|
||||||
|
}
|
||||||
|
$width_xs = round(100/$column_xs, 4);
|
||||||
|
$gutter_xs = round($this->params->get('gutter_xs', 10)/2);
|
||||||
|
?>
|
||||||
|
|
||||||
|
<style type="text/css">
|
||||||
|
.speasyimagegallery-albums {
|
||||||
|
margin: -<?php echo $gutter; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album {
|
||||||
|
width: <?php echo $width; ?>%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album > div {
|
||||||
|
margin: <?php echo $gutter; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width : 767px) {
|
||||||
|
.speasyimagegallery-albums {
|
||||||
|
margin: -<?php echo $gutter_sm; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album {
|
||||||
|
width: <?php echo $width_sm; ?>%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album > div {
|
||||||
|
margin: <?php echo $gutter_sm; ?>px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@media only screen and (max-width : 479px) {
|
||||||
|
.speasyimagegallery-albums {
|
||||||
|
margin: -<?php echo $gutter_xs; ?>px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album {
|
||||||
|
width: <?php echo $width_xs; ?>%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.speasyimagegallery-album > div {
|
||||||
|
margin: <?php echo $gutter_xs; ?>px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<?php if ($this->params->get('show_page_heading', 1)) : ?>
|
||||||
|
<h1 class="antracit"><?php echo $this->escape($this->params->get('page_heading')); ?></h1>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
<?php if(count($this->items)) { ?>
|
||||||
|
<div class="speasyimagegallery-albums clearfix">
|
||||||
|
<?php foreach ($this->items as $key => $this->item) { ?>
|
||||||
|
<?php
|
||||||
|
$cover = 'thumb.' . JFile::getExt(basename($this->item->image));
|
||||||
|
$Itemid = ($input->get('Itemid', 0, 'INT'))? '&Itemid=' . $input->get('Itemid', 0, 'INT') : '';
|
||||||
|
$link = 'index.php?option=com_speasyimagegallery&view=album&id=' . $this->item->id . ':' . $this->item->alias . $Itemid;
|
||||||
|
?>
|
||||||
|
<div class="speasyimagegallery-album">
|
||||||
|
<div>
|
||||||
|
<a href="<?php echo JText::_($link); ?>">
|
||||||
|
<img src="images/speasyimagegallery/albums/<?php echo $this->item->id; ?>/<?php echo $cover; ?>" alt="<?php echo $this->item->title; ?>">
|
||||||
|
<div class="speasyimagegallery-album-info">
|
||||||
|
<span class="speasyimagegallery-album-title"><?php echo $this->item->title; ?></span>
|
||||||
|
<div class="speasyimagegallery-album-meta clearfix">
|
||||||
|
<span class="speasyimagegallery-album-meta-count"><?php echo $this->item->count; ?> <?php echo ($this->item->count > 1) ? 'Photos' : 'Photo'; ?></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
} else {
|
||||||
|
echo '<div class="alert">' . JText::_('COM_SPEASYIMAGEGALLERY_NO_ALBUMS') . '</div>';
|
||||||
|
}?>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="row"> </div>
|
||||||
|
</div>
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<metadata>
|
||||||
|
<layout title="COM_SPEASYIMAGEGALLERY_VIEW_DEFAULT_TITLE">
|
||||||
|
</layout>
|
||||||
|
<fields name="request">
|
||||||
|
<fieldset name="request">
|
||||||
|
<field name="catid" type="category" label="COM_SPEASYIMAGEGALLERY_CHOOSE_ALBUM_CATEGORY" description="COM_SPEASYIMAGEGALLERY_CHOOSE_ALBUM_CATEGORY_DESC" extension="com_speasyimagegallery">
|
||||||
|
<option value="">COM_SPEASYIMAGEGALLERY_SELECT_CATEGORY</option>
|
||||||
|
</field>
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
<fields name="params">
|
||||||
|
<fieldset name="basic" label="COM_SPEASYIMAGEGALLERY_OPTIONS">
|
||||||
|
<field name="column" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_DESC" default="4" min="1" max="12" />
|
||||||
|
<field name="column_sm" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_SM" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_SM_DESC" default="3" min="1" max="12" />
|
||||||
|
<field name="column_xs" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_XS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_COLUMNS_XS_DESC" default="2" min="1" max="12" />
|
||||||
|
<field name="gutter" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_DESC" default="20" />
|
||||||
|
<field name="gutter_sm" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_SM" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_SM_DESC" default="15" />
|
||||||
|
<field name="gutter_xs" type="number" label="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_XS" description="COM_SPEASYIMAGEGALLERY_GLOBAL_GUTTER_XS_DESC" default="10" />
|
||||||
|
</fieldset>
|
||||||
|
</fields>
|
||||||
|
</metadata>
|
||||||
@ -0,0 +1,97 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @package com_speasyimagegallery
|
||||||
|
* @author JoomShaper http://www.joomshaper.com
|
||||||
|
* @copyright Copyright (c) 2010 - 2017 JoomShaper
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or later
|
||||||
|
*/
|
||||||
|
|
||||||
|
// No direct access to this file
|
||||||
|
defined('_JEXEC') or die('Restricted access');
|
||||||
|
|
||||||
|
jimport('joomla.filesystem.file');
|
||||||
|
jimport('joomla.application.component.helper');
|
||||||
|
|
||||||
|
class SpeasyimagegalleryViewAlbums extends JViewLegacy
|
||||||
|
{
|
||||||
|
|
||||||
|
protected $items;
|
||||||
|
protected $params;
|
||||||
|
|
||||||
|
function display($tpl = null)
|
||||||
|
{
|
||||||
|
// Assign data to the view
|
||||||
|
$this->items = $this->get('Items');
|
||||||
|
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$this->params = $app->getParams();
|
||||||
|
$menus = JFactory::getApplication()->getMenu();
|
||||||
|
$menu = $menus->getActive();
|
||||||
|
|
||||||
|
if($menu) {
|
||||||
|
$this->params->merge($menu->params);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for errors.
|
||||||
|
if (count($errors = $this->get('Errors')))
|
||||||
|
{
|
||||||
|
JLog::add(implode('<br />', $errors), JLog::WARNING, 'jerror');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->_prepareDocument();
|
||||||
|
parent::display($tpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _prepareDocument()
|
||||||
|
{
|
||||||
|
$app = JFactory::getApplication();
|
||||||
|
$menus = $app->getMenu();
|
||||||
|
$title = null;
|
||||||
|
|
||||||
|
// Because the application sets a default page title,
|
||||||
|
// we need to get it from the menu item itself
|
||||||
|
$menu = $menus->getActive();
|
||||||
|
|
||||||
|
if ($menu)
|
||||||
|
{
|
||||||
|
$this->params->def('page_heading', $this->params->get('page_title', $menu->title));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->params->def('page_heading', JText::_('COM_SPEASYIMAGEGALLERY_DEFAULT_PAGE_TITLE'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$title = $this->params->get('page_title', '');
|
||||||
|
|
||||||
|
if (empty($title))
|
||||||
|
{
|
||||||
|
$title = $app->get('sitename');
|
||||||
|
}
|
||||||
|
elseif ($app->get('sitename_pagetitles', 0) == 1)
|
||||||
|
{
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
|
||||||
|
}
|
||||||
|
elseif ($app->get('sitename_pagetitles', 0) == 2)
|
||||||
|
{
|
||||||
|
$title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->document->setTitle($title);
|
||||||
|
|
||||||
|
if ($this->params->get('menu-meta_description'))
|
||||||
|
{
|
||||||
|
$this->document->setDescription($this->params->get('menu-meta_description'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->params->get('menu-meta_keywords'))
|
||||||
|
{
|
||||||
|
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->params->get('robots'))
|
||||||
|
{
|
||||||
|
$this->document->setMetadata('robots', $this->params->get('robots'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user