From 9f9e6704f78b961bb82bf2e7ca387a9c4b87f6aa Mon Sep 17 00:00:00 2001 From: Yana Date: Fri, 16 Dec 2016 11:00:37 +0300 Subject: [PATCH 1/5] First Release --- .../elements/tv/galleryalbumview.input.tpl | 29 +++++++++++++++++++ .../tv/input/galleryalbumview.class.php | 9 ++++++ 2 files changed, 38 insertions(+) create mode 100644 core/components/gallery/elements/tv/galleryalbumview.input.tpl create mode 100644 core/components/gallery/elements/tv/input/galleryalbumview.class.php diff --git a/core/components/gallery/elements/tv/galleryalbumview.input.tpl b/core/components/gallery/elements/tv/galleryalbumview.input.tpl new file mode 100644 index 0000000..eb5b6e7 --- /dev/null +++ b/core/components/gallery/elements/tv/galleryalbumview.input.tpl @@ -0,0 +1,29 @@ + +
+ +{if $tv->value ne ''} +{literal} + +{/literal} +{else} +

Пожалуйста, сохраните документ и обновите страницу перед созданием галереи

+{/if} \ No newline at end of file diff --git a/core/components/gallery/elements/tv/input/galleryalbumview.class.php b/core/components/gallery/elements/tv/input/galleryalbumview.class.php new file mode 100644 index 0000000..5b3b50a --- /dev/null +++ b/core/components/gallery/elements/tv/input/galleryalbumview.class.php @@ -0,0 +1,9 @@ +modx->getOption('gallery.core_path',null, $this->modx->getOption('core_path').'components/gallery/').'elements/tv/galleryalbumview.input.tpl'; + } +} +return 'GalleryAlbumViewInputRender'; +?> \ No newline at end of file From 72999cac91a802a5b39e548fce993e5cd8630978 Mon Sep 17 00:00:00 2001 From: Yana Date: Fri, 16 Dec 2016 11:04:34 +0300 Subject: [PATCH 2/5] First Release --- _build/build.transport.php | 11 ++++ _build/data/events/events.gallerycustomtv.php | 2 + .../js/mgr/widgets/album/album.panel.js | 16 +++--- .../plugins/gallerycustomtv.plugin.php | 56 +++++++++++++++++++ 4 files changed, 78 insertions(+), 7 deletions(-) diff --git a/_build/build.transport.php b/_build/build.transport.php index 90b1168..c0fde31 100644 --- a/_build/build.transport.php +++ b/_build/build.transport.php @@ -97,12 +97,23 @@ /* add tv plugin */ $plugin= $modx->newObject('modPlugin'); +$properties = array( + array( + 'name' => 'tmplvarid', + 'desc' => 'TV id of Gallery', + 'type' => 'number', + 'options' => '', + 'value' => 0, + )); + $plugin->fromArray(array( 'id' => 1, 'name' => 'GalleryCustomTV', 'description' => '', 'plugincode' => getSnippetContent($sources['plugins'] . 'gallerycustomtv.plugin.php'), + ),'',true,true); +$plugin->setProperties($properties); $events = include $sources['data'].'events/events.gallerycustomtv.php'; if (is_array($events) && !empty($events)) { $modx->log(modX::LOG_LEVEL_INFO,'Added '.count($events).' events to GalleryCustomTV plugin.'); diff --git a/_build/data/events/events.gallerycustomtv.php b/_build/data/events/events.gallerycustomtv.php index 76abcf6..e023011 100644 --- a/_build/data/events/events.gallerycustomtv.php +++ b/_build/data/events/events.gallerycustomtv.php @@ -29,6 +29,8 @@ $events = array(); $evs = array( + 'OnResourceDuplicate', + 'OnDocFormSave', 'OnTVInputRenderList', 'OnTVInputPropertiesList', 'OnTVOutputRenderList', diff --git a/assets/components/gallery/js/mgr/widgets/album/album.panel.js b/assets/components/gallery/js/mgr/widgets/album/album.panel.js index d9c0e0a..df250dc 100644 --- a/assets/components/gallery/js/mgr/widgets/album/album.panel.js +++ b/assets/components/gallery/js/mgr/widgets/album/album.panel.js @@ -1,3 +1,4 @@ +// assets/components/gallery/js/mgr/widgets/album/album.panel.js GAL.panel.Album = function(config) { config = config || {}; @@ -70,17 +71,18 @@ GAL.panel.Album = function(config) { ,columnWidth: .6 },{ xtype:'hidden' - ,'name':'cover_filename_url' + ,name:'cover_filename_url' ,id:'cover_filename_url' },{ xtype:'button' ,text: _('gallery.upload_cover') - ,height: 39 + ,cls: 'primary-button' + // ,height: 39 ,handler: this.updateCover },{ xtype:'button' ,text: _('gallery.delete_cover') - ,height: 39 + // ,height: 39 ,handler:function() { var panel=Ext.getCmp('gal-panel-album').getForm(); panel.findField('cover_filename').setValue(''); @@ -299,7 +301,7 @@ GAL.panel.AlbumItems = function(config) { ,text: _('gallery.multi_item_upload') ,handler: this.uploadMultiItems ,scope: this - },'-',{ + }/*,'-',{ xtype: 'button' ,text: _('gallery.batch_upload') ,handler: this.batchUpload @@ -309,7 +311,7 @@ GAL.panel.AlbumItems = function(config) { ,text: _('gallery.zip_upload') ,handler: this.zipUpload ,scope: this - }] + }*/] },this.view] ,bbar: [this.view.pagingBar] },{ @@ -318,9 +320,9 @@ GAL.panel.AlbumItems = function(config) { ,region: 'east' ,split: true ,autoScroll: true - ,width: '20%' + ,width: '25%' ,minWidth: 150 - ,maxWidth: 250 + // ,maxWidth: 250 ,height: 450 ,border: false }] diff --git a/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php b/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php index ba7f63e..3b15788 100644 --- a/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php +++ b/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php @@ -1,11 +1,63 @@ getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/'); switch ($modx->event->name) { + case 'OnResourceDuplicate': + $newResource = $modx->event->params['newResource']; + $id=$newResource->get('id'); + $tv = $modx->getObject('modTemplateVarResource',array ('tmplvarid'=>$tmplvarid,'contentid' => $id)); + if (isset($tv)) { + $tv->remove(); + } + break; + case 'OnDocFormSave': + $GalleryProcessorPath = $modx->getOption('gallery.core_path',$config,$modx->getOption('core_path').'components/gallery/').'processors/'; + $options = array('processors_path'=>$GalleryProcessorPath); + $galleryName = $resource->get('pagetitle'); + + //Получаем все TV текущего ресурса + $tvs = $resource->getTemplateVars(); + foreach($tvs as $tv) { + //нам нужны только TV с типом galleryalbumview + if ($tv->get('type')=='galleryalbumview') { + $tvvalue = $tv->getValue($id); + if (empty($tvvalue)) { + //Параметры TV + $tv_prop = $tv->get('properties'); + //Создаем альбом + $album = array( + 'name' => $galleryName, + 'parent' => isset($tv_prop['galParentId']['value'])?$tv_prop['galParentId']['value']:0, + 'description' => '', + 'active' => 1, + 'prominent' => 0 + ); + $resp = $modx->runProcessor('mgr/album/create',$album,$options); + if (!$resp->isError()) { + $album = $resp->getObject(); + $tv->setValue($id,$album['id']); + $tv->save(); + } + + } else { + // TV уже есть, обновим название альбома + $resp = $modx->runProcessor('mgr/album/get',array('id'=>$tvvalue),$options); + if (!$resp->isError()) { + $album = $resp->getObject(); + $album['name'] = $galleryName; + $modx->runProcessor('mgr/album/update',$album,$options); + } + + } + } + } + break; + case 'OnTVInputRenderList': $modx->event->output($corePath.'elements/tv/input/'); break; @@ -68,7 +120,11 @@ $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/widgets/album/album.tree.js'); $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/gal.browser.js'); $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/galtv.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/utils/ddview.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/utils/fileuploader.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/widgets/album/album.panel.js'); $modx->controller->addCss($gallery->config['cssUrl'].'mgr.css'); + $modx->controller->addCss($gallery->config['cssUrl'].'fileuploader.css'); break; } return; \ No newline at end of file From cc9c787bb2db63c759f96e848fea9a640746c6ce Mon Sep 17 00:00:00 2001 From: Yana Date: Fri, 16 Dec 2016 11:47:05 +0300 Subject: [PATCH 3/5] Fix Release --- _build/build.config.sample.php | 38 ---------------------------------- _build/build.transport.php | 10 ++++++--- 2 files changed, 7 insertions(+), 41 deletions(-) delete mode 100644 _build/build.config.sample.php diff --git a/_build/build.config.sample.php b/_build/build.config.sample.php deleted file mode 100644 index a15fff5..0000000 --- a/_build/build.config.sample.php +++ /dev/null @@ -1,38 +0,0 @@ - - * - * Gallery is free software; you can redistribute it and/or modify it under the - * terms of the GNU General Public License as published by the Free Software - * Foundation; either version 2 of the License, or (at your option) any later - * version. - * - * Gallery is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR - * A PARTICULAR PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along with - * Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - * - * @package gallery - */ -/** - * Define the MODX path constants necessary for installation - * - * @package gallery - * @subpackage build - */ -define('MODX_BASE_PATH','/path/to/modx/'); -define('MODX_CORE_PATH', MODX_BASE_PATH . 'core/'); -define('MODX_MANAGER_PATH', MODX_BASE_PATH . 'manager/'); -define('MODX_CONNECTORS_PATH', MODX_BASE_PATH . 'connectors/'); -define('MODX_ASSETS_PATH', MODX_BASE_PATH . 'assets/'); - -define('MODX_BASE_URL','/modx/'); -define('MODX_CORE_URL', MODX_BASE_URL . 'core/'); -define('MODX_MANAGER_URL', MODX_BASE_URL . 'manager/'); -define('MODX_CONNECTORS_URL', MODX_BASE_URL . 'connectors/'); -define('MODX_ASSETS_URL', MODX_BASE_URL . 'assets/'); \ No newline at end of file diff --git a/_build/build.transport.php b/_build/build.transport.php index c0fde31..fc5b3fc 100644 --- a/_build/build.transport.php +++ b/_build/build.transport.php @@ -34,8 +34,8 @@ /* define package */ define('PKG_NAME','Gallery'); define('PKG_NAME_LOWER','gallery'); -define('PKG_VERSION','1.5.3'); -define('PKG_RELEASE','a2'); +define('PKG_VERSION','1.7.0'); +define('PKG_RELEASE','beta1'); /* define sources */ $root = dirname(dirname(__FILE__)).'/'; @@ -74,7 +74,7 @@ /* create category */ $category= $modx->newObject('modCategory'); -$category->set('id',1); +//$category->set('id',1); $category->set('category',PKG_NAME); /* add snippets */ @@ -113,12 +113,16 @@ 'plugincode' => getSnippetContent($sources['plugins'] . 'gallerycustomtv.plugin.php'), ),'',true,true); + $plugin->setProperties($properties); $events = include $sources['data'].'events/events.gallerycustomtv.php'; + if (is_array($events) && !empty($events)) { $modx->log(modX::LOG_LEVEL_INFO,'Added '.count($events).' events to GalleryCustomTV plugin.'); $plugin->addMany($events); } +$category->addMany($plugin); // added + $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($plugin).' plugin.'); unset($events); $attributes = array ( xPDOTransport::PRESERVE_KEYS => false, From 1ac01810f1020e6a115bf21a1aba354e9fa33806 Mon Sep 17 00:00:00 2001 From: wax100 Date: Thu, 8 Feb 2018 13:40:08 +0300 Subject: [PATCH 4/5] Gallery TV album view --- _build/build.config.sample.php | 38 +++++ _build/build.transport.php | 21 +-- _build/data/events/events.gallerycustomtv.php | 2 +- assets/components/gallery/connector.php | 3 +- .../components/gallery/css/fileuploader.css | 12 ++ assets/components/gallery/css/mgr.css | 23 ++- assets/components/gallery/images/.DS_Store | Bin 0 -> 6148 bytes assets/components/gallery/js/mgr/gallery.js | 56 +++++--- .../gallery/js/mgr/sections/album/update.js | 5 +- .../gallery/js/mgr/sections/home.js | 4 - .../gallery/js/mgr/utils/fileuploader.js | 2 +- .../js/mgr/widgets/album/album.items.view.js | 17 ++- .../js/mgr/widgets/album/album.panel.js | 5 +- .../js/mgr/widgets/album/album.tree.js | 1 + .../js/mgr/widgets/album/albums.grid.js | 11 +- .../controllers/album/update.class.php | 4 +- .../gallery/controllers/home.class.php | 1 + core/components/gallery/docs/changelog.txt | 37 +++++ .../plugins/gallerycustomtv.plugin.php_ | 74 ++++++++++ .../elements/snippets/snippet.gallery.php | 33 ++++- .../gallery/model/gallery/galalbum.class.php | 43 +++--- .../gallery/model/gallery/galitem.class.php | 68 ++++++++- .../gallery/model/gallery/gallery.class.php | 9 ++ .../gallery/import/galzipimport.class.php | 8 +- .../processors/mgr/album/getnodes.class.php | 9 +- .../processors/mgr/item/ajaxupload.php | 56 +++++--- .../processors/mgr/item/batchupload.php | 24 +--- .../gallery/processors/mgr/item/sort.php | 6 +- .../gallery/processors/web/phpthumb.php | 135 +++++++++++------- 29 files changed, 506 insertions(+), 201 deletions(-) create mode 100644 _build/build.config.sample.php create mode 100644 assets/components/gallery/images/.DS_Store create mode 100644 core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ diff --git a/_build/build.config.sample.php b/_build/build.config.sample.php new file mode 100644 index 0000000..a15fff5 --- /dev/null +++ b/_build/build.config.sample.php @@ -0,0 +1,38 @@ + + * + * Gallery is free software; you can redistribute it and/or modify it under the + * terms of the GNU General Public License as published by the Free Software + * Foundation; either version 2 of the License, or (at your option) any later + * version. + * + * Gallery is distributed in the hope that it will be useful, but WITHOUT ANY + * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + * A PARTICULAR PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along with + * Gallery; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + * + * @package gallery + */ +/** + * Define the MODX path constants necessary for installation + * + * @package gallery + * @subpackage build + */ +define('MODX_BASE_PATH','/path/to/modx/'); +define('MODX_CORE_PATH', MODX_BASE_PATH . 'core/'); +define('MODX_MANAGER_PATH', MODX_BASE_PATH . 'manager/'); +define('MODX_CONNECTORS_PATH', MODX_BASE_PATH . 'connectors/'); +define('MODX_ASSETS_PATH', MODX_BASE_PATH . 'assets/'); + +define('MODX_BASE_URL','/modx/'); +define('MODX_CORE_URL', MODX_BASE_URL . 'core/'); +define('MODX_MANAGER_URL', MODX_BASE_URL . 'manager/'); +define('MODX_CONNECTORS_URL', MODX_BASE_URL . 'connectors/'); +define('MODX_ASSETS_URL', MODX_BASE_URL . 'assets/'); \ No newline at end of file diff --git a/_build/build.transport.php b/_build/build.transport.php index fc5b3fc..90b1168 100644 --- a/_build/build.transport.php +++ b/_build/build.transport.php @@ -34,8 +34,8 @@ /* define package */ define('PKG_NAME','Gallery'); define('PKG_NAME_LOWER','gallery'); -define('PKG_VERSION','1.7.0'); -define('PKG_RELEASE','beta1'); +define('PKG_VERSION','1.5.3'); +define('PKG_RELEASE','a2'); /* define sources */ $root = dirname(dirname(__FILE__)).'/'; @@ -74,7 +74,7 @@ /* create category */ $category= $modx->newObject('modCategory'); -//$category->set('id',1); +$category->set('id',1); $category->set('category',PKG_NAME); /* add snippets */ @@ -97,32 +97,17 @@ /* add tv plugin */ $plugin= $modx->newObject('modPlugin'); -$properties = array( - array( - 'name' => 'tmplvarid', - 'desc' => 'TV id of Gallery', - 'type' => 'number', - 'options' => '', - 'value' => 0, - )); - $plugin->fromArray(array( 'id' => 1, 'name' => 'GalleryCustomTV', 'description' => '', 'plugincode' => getSnippetContent($sources['plugins'] . 'gallerycustomtv.plugin.php'), - ),'',true,true); - -$plugin->setProperties($properties); $events = include $sources['data'].'events/events.gallerycustomtv.php'; - if (is_array($events) && !empty($events)) { $modx->log(modX::LOG_LEVEL_INFO,'Added '.count($events).' events to GalleryCustomTV plugin.'); $plugin->addMany($events); } -$category->addMany($plugin); // added - $modx->log(modX::LOG_LEVEL_INFO,'Packaged in '.count($plugin).' plugin.'); unset($events); $attributes = array ( xPDOTransport::PRESERVE_KEYS => false, diff --git a/_build/data/events/events.gallerycustomtv.php b/_build/data/events/events.gallerycustomtv.php index e023011..565296e 100644 --- a/_build/data/events/events.gallerycustomtv.php +++ b/_build/data/events/events.gallerycustomtv.php @@ -29,8 +29,8 @@ $events = array(); $evs = array( - 'OnResourceDuplicate', 'OnDocFormSave', + 'OnResourceDuplicate', 'OnTVInputRenderList', 'OnTVInputPropertiesList', 'OnTVOutputRenderList', diff --git a/assets/components/gallery/connector.php b/assets/components/gallery/connector.php index 8086d71..958ac59 100644 --- a/assets/components/gallery/connector.php +++ b/assets/components/gallery/connector.php @@ -47,7 +47,6 @@ if ($modx->user->hasSessionContext($modx->context->get('key'))) { $_SERVER['HTTP_MODAUTH'] = $_SESSION["modx.{$modx->context->get('key')}.user.token"]; } else { - $_SESSION["modx.{$modx->context->get('key')}.user.token"] = 0; $_SERVER['HTTP_MODAUTH'] = 0; } } else { @@ -61,4 +60,4 @@ $modx->request->handleRequest(array( 'processors_path' => $path, 'location' => '', -)); \ No newline at end of file +)); diff --git a/assets/components/gallery/css/fileuploader.css b/assets/components/gallery/css/fileuploader.css index 0625faf..0bae5d2 100644 --- a/assets/components/gallery/css/fileuploader.css +++ b/assets/components/gallery/css/fileuploader.css @@ -1,5 +1,11 @@ .qq-uploader { position:relative; width: 100%;} +.qq-uploader a { + display: inline-block; + margin-top: 10px; + text-decoration: none; +} + .qq-upload-button { display:block; /* or inline-block */ padding: 7px 0; @@ -11,6 +17,12 @@ margin-top: 10px; font-weight: bold; } +/* 2.3 style fixes */ +.qq-upload-button.x-btn { + border: 0; + padding: 10px 15px; + text-shadow: none; +} .qq-upload-button-hover {background:#5C7F17;} .qq-upload-button-focus {outline:1px dotted black;} diff --git a/assets/components/gallery/css/mgr.css b/assets/components/gallery/css/mgr.css index ac91c7d..892f230 100644 --- a/assets/components/gallery/css/mgr.css +++ b/assets/components/gallery/css/mgr.css @@ -6,25 +6,38 @@ .gal-item-inactive { opacity: 0.5; } -.green { color: green; } -.red { color: red; } +/* unnecessary as defined in default styles */ +/*.green { color: green; } +.red { color: red; }*/ .gal-detail-active { float: right; } .gal-view-item-albums { overflow:auto; - border-top: 1px solid #d4d4d4; - margin-top: 4px; + border-top: 1px solid #E4E4E4; + margin-top: 7px; } .gal-item-thumb { border: 1px solid #ddd; - padding: 5px 5px 3px; + padding: 5px; } .gal-item-update-preview { margin: 0 auto; text-align: center; padding: 2px; +} + +#gal-album-items-detail { + border-left: 1px solid #E4E4E4; + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + margin-left: 0 !important; /* override default modx theme styles for .x-column */ +} + +.modx-browser-thumb-wrap .gal-item-thumb { + height: 100px; } \ No newline at end of file diff --git a/assets/components/gallery/images/.DS_Store b/assets/components/gallery/images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..5008ddfcf53c02e82d7eee2e57c38e5672ef89f6 GIT binary patch literal 6148 zcmeH~Jr2S!425mzP>H1@V-^m;4Wg<&0T*E43hX&L&p$$qDprKhvt+--jT7}7np#A3 zem<@ulZcFPQ@L2!n>{z**++&mCkOWA81W14cNZlEfg7;MkzE(HCqgga^y>{tEnwC%0;vJ&^%eQ zLs35+`xjp>T0' + '
' + _('gallery.dropfileshere') + '
' + - '
' + _('file_upload') + '
' + + '
' + _('file_upload') + '
' + '

' + _('gallery.clearsuccessful') + ' | ' + '' + _('gallery.clearfailure') + '

' + '
    ' + diff --git a/assets/components/gallery/js/mgr/widgets/album/album.items.view.js b/assets/components/gallery/js/mgr/widgets/album/album.items.view.js index e9331b7..31bb242 100644 --- a/assets/components/gallery/js/mgr/widgets/album/album.items.view.js +++ b/assets/components/gallery/js/mgr/widgets/album/album.items.view.js @@ -15,7 +15,11 @@ GAL.view.AlbumItems = function(config) { ,tpl: this.templates.thumb ,enableDD: true ,multiSelect: true - ,listeners: {} + ,itemSelector: 'div.modx-browser-thumb-wrap' + ,listeners: { + 'selectionchange': {fn:this.showDetails, scope:this, buffer:100} + ,'dblclick': config.onSelect || {fn:Ext.emptyFn,scope:this} + } ,prepareData: this.formatData.createDelegate(this) }); GAL.view.AlbumItems.superclass.constructor.call(this,config); @@ -186,8 +190,8 @@ Ext.extend(GAL.view.AlbumItems,MODx.DataView,{ ,_initTemplates: function() { this.templates.thumb = new Ext.XTemplate( '' - ,'
    gal-item-inactive" id="gal-item-{id}">' - ,'
    ' + ,'
    gal-item-inactive" id="gal-item-{id}">' + ,'
    ' ,'' ,'
    ' ,'{shortName}' @@ -200,8 +204,8 @@ Ext.extend(GAL.view.AlbumItems,MODx.DataView,{ this.templates.details = new Ext.XTemplate( '
    ' ,'' - ,'
    {shortName}
    ' - ,'
    ' + ,'
    {shortName}
    ' + ,'
    ' ,'' ,''+_('gallery.active')+'' ,''+_('gallery.inactive')+'' @@ -232,7 +236,7 @@ Ext.extend(GAL.view.AlbumItems,MODx.DataView,{ ,plain: true ,items: [{ id: 'gal-item-ss' - ,html: '' + ,html: '' }] ,buttons: [{ text: _('close') @@ -286,4 +290,3 @@ Ext.extend(GAL.view.AlbumItems,MODx.DataView,{ }); Ext.reg('gal-view-album-items',GAL.view.AlbumItems); - diff --git a/assets/components/gallery/js/mgr/widgets/album/album.panel.js b/assets/components/gallery/js/mgr/widgets/album/album.panel.js index df250dc..f10ef9a 100644 --- a/assets/components/gallery/js/mgr/widgets/album/album.panel.js +++ b/assets/components/gallery/js/mgr/widgets/album/album.panel.js @@ -1,4 +1,3 @@ -// assets/components/gallery/js/mgr/widgets/album/album.panel.js GAL.panel.Album = function(config) { config = config || {}; @@ -301,7 +300,7 @@ GAL.panel.AlbumItems = function(config) { ,text: _('gallery.multi_item_upload') ,handler: this.uploadMultiItems ,scope: this - }/*,'-',{ + },'-',{ xtype: 'button' ,text: _('gallery.batch_upload') ,handler: this.batchUpload @@ -311,7 +310,7 @@ GAL.panel.AlbumItems = function(config) { ,text: _('gallery.zip_upload') ,handler: this.zipUpload ,scope: this - }*/] + }] },this.view] ,bbar: [this.view.pagingBar] },{ diff --git a/assets/components/gallery/js/mgr/widgets/album/album.tree.js b/assets/components/gallery/js/mgr/widgets/album/album.tree.js index 0cdb245..ca29059 100644 --- a/assets/components/gallery/js/mgr/widgets/album/album.tree.js +++ b/assets/components/gallery/js/mgr/widgets/album/album.tree.js @@ -7,6 +7,7 @@ GAL.tree.Album = function(config) { ,action: 'mgr/album/getNodes' ,tbar: [{ text: _('gallery.album_create') + ,cls: 'primary-button' ,handler: function(btn,e) { this.createAlbum(btn,e,true); } ,scope: this },'-',{ diff --git a/assets/components/gallery/js/mgr/widgets/album/albums.grid.js b/assets/components/gallery/js/mgr/widgets/album/albums.grid.js index d71a942..ecb98a8 100644 --- a/assets/components/gallery/js/mgr/widgets/album/albums.grid.js +++ b/assets/components/gallery/js/mgr/widgets/album/albums.grid.js @@ -30,6 +30,7 @@ GAL.grid.Albums = function(config) { }] ,tbar: [{ text: _('gallery.album_create') + ,cls: 'primary-button' ,handler: this.createAlbum ,scope: this }] @@ -85,8 +86,8 @@ GAL.window.CreateAlbum = function(config) { Ext.applyIf(config,{ title: _('gallery.album_create') ,id: this.ident - ,height: 150 - ,width: 475 + // ,height: 150 + // ,width: 475 ,url: GAL.config.connector_url ,action: 'mgr/album/create' ,fields: [{ @@ -101,6 +102,12 @@ GAL.window.CreateAlbum = function(config) { ,name: 'description' ,id: 'gal-'+this.ident+'-description' ,width: 300 + },{ + xtype: 'textfield' + ,fieldLabel: _('gallery.year') + ,name: 'year' + ,anchor: '100%' + ,allowBlank: true },{ xtype: 'checkbox' ,fieldLabel: _('gallery.active') diff --git a/core/components/gallery/controllers/album/update.class.php b/core/components/gallery/controllers/album/update.class.php index ffa23bc..24d8458 100644 --- a/core/components/gallery/controllers/album/update.class.php +++ b/core/components/gallery/controllers/album/update.class.php @@ -37,9 +37,9 @@ public function loadCustomCssJs() { $this->addJavascript($this->gallery->config['jsUrl'].'mgr/widgets/album/album.panel.js'); $this->addLastJavascript($this->gallery->config['jsUrl'].'mgr/sections/album/update.js'); $this->addCss($this->gallery->config['cssUrl'].'fileuploader.css'); - + $this->addHtml(""); + $this->checkForTinyMCE(); - } public function getTemplateFile() { return $this->gallery->config['templatesPath'].'album/update.tpl'; } diff --git a/core/components/gallery/controllers/home.class.php b/core/components/gallery/controllers/home.class.php index afe16ff..c8a6df4 100644 --- a/core/components/gallery/controllers/home.class.php +++ b/core/components/gallery/controllers/home.class.php @@ -31,6 +31,7 @@ public function loadCustomCssJs() { $this->addJavascript($this->gallery->config['jsUrl'].'mgr/widgets/album/album.tree.js'); $this->addJavascript($this->gallery->config['jsUrl'].'mgr/widgets/home.panel.js'); $this->addLastJavascript($this->gallery->config['jsUrl'].'mgr/sections/home.js'); + $this->addHtml(""); } public function getTemplateFile() { return $this->gallery->config['templatesPath'].'home.tpl'; } } \ No newline at end of file diff --git a/core/components/gallery/docs/changelog.txt b/core/components/gallery/docs/changelog.txt index b4d704e..dd3b740 100755 --- a/core/components/gallery/docs/changelog.txt +++ b/core/components/gallery/docs/changelog.txt @@ -1,5 +1,42 @@ Changelog for Gallery. +Gallery 1.7.0 +==================================== +- Fixed showAll parameter in galAlbum +- Fixed album tree icon +- Fixed undefined index: Year +- Updated phpthumb-processor +- Add browser caching support to phpthumb processor +- Move Ext.onReady into controllers +- Add support for &thumbTpl_N tpl in Gallery snippet +- More 2.3 Fixes +- Modx 2.3 Compatibility Fixes + +Gallery 1.6.1 +==================================== + - [#13][#12] Backwards Compatibility Fix + +Gallery 1.6.0 +==================================== +- [#271] [GalleryAlbums] Added image_absolute placeholder +- [#270] [GalleryAlbums] Added containerTpl (with navigation placeholders) and totalVar placeholder +- [#266] Add support for selection of album cover. +- [#259] Do not cache in getList() when $sort = RAND() +- [#252] Database Optimization +- [#248] Fix getPage support in Gallery snippet +- [#246] Batch import sorts by filename. +- [#235] show all childs and subchilds of selected parent album by new TV option +- [#233] Fix property itemCls from being assigned activeCls's value +- [#226] German localization +- [#151] Needed to show links to next/prev albums +- [#91] Allow false boolean +- [#258] Bug fix with random sorting when cached +- Bug fixes + +Gallery 1.5.3 +==================================== +- [#9] Fixes Access Denied issue when using Manager / Gallery + Gallery 1.5.2 ==================================== - [#219] Ensure that GalleryAlbums custom TV marks resource edit form dirty and enables save button diff --git a/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ b/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ new file mode 100644 index 0000000..ba7f63e --- /dev/null +++ b/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ @@ -0,0 +1,74 @@ +getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/'); +switch ($modx->event->name) { + case 'OnTVInputRenderList': + $modx->event->output($corePath.'elements/tv/input/'); + break; + case 'OnTVOutputRenderList': + $modx->event->output($corePath.'elements/tv/output/'); + break; + case 'OnTVInputPropertiesList': + $modx->event->output($corePath.'elements/tv/inputoptions/'); + break; + case 'OnTVOutputRenderPropertiesList': + $modx->event->output($corePath.'elements/tv/properties/'); + break; + case 'OnManagerPageBeforeRender': + $gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties); + if (!($gallery instanceof Gallery)) return ''; + + $snippetIds = ''; + $gallerySnippet = $modx->getObject('modSnippet',array('name' => 'Gallery')); + if ($gallerySnippet) { + $snippetIds .= 'GAL.snippetGallery = "'.$gallerySnippet->get('id').'";'."\n"; + } + $galleryItemSnippet = $modx->getObject('modSnippet',array('name' => 'GalleryItem')); + if ($galleryItemSnippet) { + $snippetIds .= 'GAL.snippetGalleryItem = "'.$galleryItemSnippet->get('id').'";'."\n"; + } + + $jsDir = $modx->getOption('gallery.assets_url',null,$modx->getOption('assets_url').'components/gallery/').'js/mgr/'; + $modx->controller->addLexiconTopic('gallery:default'); + $modx->controller->addJavascript($jsDir.'gallery.js'); + $modx->controller->addJavascript($jsDir.'tree.js'); + $modx->controller->addHtml(''); + break; + case 'OnDocFormPrerender': + $gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties); + if (!($gallery instanceof Gallery)) return ''; + + /* assign gallery lang to JS */ + $modx->controller->addLexiconTopic('gallery:tv'); + + /* @var modAction $action */ + $action = $modx->getObject('modAction',array( + 'namespace' => 'gallery', + 'controller' => 'index', + )); + $modx->controller->addHtml(''); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/Spotlight.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/gallery.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/widgets/album/album.items.view.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/widgets/album/album.tree.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/gal.browser.js'); + $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/galtv.js'); + $modx->controller->addCss($gallery->config['cssUrl'].'mgr.css'); + break; +} +return; \ No newline at end of file diff --git a/core/components/gallery/elements/snippets/snippet.gallery.php b/core/components/gallery/elements/snippets/snippet.gallery.php index 33dc490..9e84ebf 100644 --- a/core/components/gallery/elements/snippets/snippet.gallery.php +++ b/core/components/gallery/elements/snippets/snippet.gallery.php @@ -99,10 +99,23 @@ $linkToImage = $modx->getOption('linkToImage',$scriptProperties,false); $activeCls = $modx->getOption('activeCls',$scriptProperties,'gal-item-active'); $highlightItem = $modx->getOption($imageGetParam,$_REQUEST,false); +$defaultThumbTpl = $modx->getOption('thumbTpl',$scriptProperties,'galItemThumb'); + /** @var galItem $item */ if (!is_array($data)) return ''; +// prep for &thumbTpl_N +$keys = array_keys($scriptProperties); +$nthTpls = array(); +foreach($keys as $key) { + $keyBits = $gallery->explodeAndClean($key, '_'); + if (isset($keyBits[0]) && $keyBits[0] === 'thumbTpl') { + if ($i = (int) $keyBits[1]) $nthTpls[$i] = $scriptProperties[$key]; + } +} +ksort($nthTpls); + foreach ($data['items'] as $item) { $itemArray = $item->toArray(); $itemArray['idx'] = $idx; @@ -111,7 +124,7 @@ $itemArray['cls'] .= ' '.$activeCls; } $itemArray['filename'] = basename($item->get('filename')); - $itemArray['image_absolute'] = $filesUrl.$item->get('filename'); + $itemArray['image_absolute'] = $item->get('base_url').$filesUrl.$item->get('filename'); $itemArray['fileurl'] = $itemArray['image_absolute']; $itemArray['filepath'] = $filesPath.$item->get('filename'); $itemArray['filesize'] = $item->get('filesize'); @@ -131,7 +144,17 @@ $plugin->renderItem($itemArray); } - $output[] = $gallery->getChunk($modx->getOption('thumbTpl',$scriptProperties,'galItemThumb'),$itemArray); + $thumbTpl = $defaultThumbTpl; + if (isset($nthTpls[$idx])) { + $thumbTpl = $nthTpls[$idx]; + } else { + foreach ($nthTpls as $int => $tpl) { + if ( ($idx % $int) === 0 ) $thumbTpl = $tpl; + } + } + + $output[] = $gallery->getChunk($thumbTpl,$itemArray); + $idx++; } $output = implode("\n",$output); @@ -143,7 +166,7 @@ 'thumbnails' => $output, 'album_name' => $data['album']['name'], 'album_description' => $data['album']['description'], - 'album_year' => $data['album']['year'], + 'album_year' => isset($data['album']['year']) ? $data['album']['year'] : '', 'albumRequestVar' => $albumRequestVar, 'albumId' => $data['album']['id'], )); @@ -157,7 +180,7 @@ $toPlaceholder => $output, $toPlaceholder.'.id' => $data['album']['id'], $toPlaceholder.'.name' => $data['album']['name'], - $toPlaceholder.'.year' => $data['album']['year'], + $toPlaceholder.'.year' => isset($data['album']['year']) ? $data['album']['year'] : '', $toPlaceholder.'.description' => $data['album']['description'], $toPlaceholder.'.total' => $data['total'], $toPlaceholder.'.next' => $data['album']['id'] + 1, @@ -168,7 +191,7 @@ $modx->toPlaceholders(array( $placeholderPrefix.'id' => $data['album']['id'], $placeholderPrefix.'name' => $data['album']['name'], - $placeholderPrefix.'year' => $data['album']['year'], + $placeholderPrefix.'year' => isset($data['album']['year']) ? $data['album']['year'] : '', $placeholderPrefix.'description' => $data['album']['description'], $placeholderPrefix.'total' => $data['total'], $placeholderPrefix.'next' => $data['album']['id'] + 1, diff --git a/core/components/gallery/model/gallery/galalbum.class.php b/core/components/gallery/model/gallery/galalbum.class.php index 4625f41..32be371 100644 --- a/core/components/gallery/model/gallery/galalbum.class.php +++ b/core/components/gallery/model/gallery/galalbum.class.php @@ -195,36 +195,44 @@ public function ensurePathExists() { return $exists; } - public function uploadItem(galItem $item,$filePath,$name) { + public function uploadItem(galItem $item,$filePath,$name,$mediaSource) { $fileName = false; $albumDir = $this->getPath(false); - $targetDir = $this->getPath(); + $targetDir = str_ireplace(MODX_BASE_PATH, '', $this->getPath()); /* if directory doesnt exist, create it */ - if (!$this->ensurePathExists()) { - $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not create directory: '.$targetDir); - return $fileName; - } - if (!$this->isPathWritable()) { - $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not write to directory: '.$targetDir); - return $fileName; + if (!$mediaSource->createContainer($targetDir,'/')) { + $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not create directory (possibly already exists?): '.$targetDir); } /* upload the file */ + $extension = pathinfo($name,PATHINFO_EXTENSION); $shortName = $item->get('id').'.'.$extension; $relativePath = $albumDir.$shortName; $absolutePath = $targetDir.$shortName; - if (@file_exists($absolutePath)) { - @unlink($absolutePath); - } - if (!@move_uploaded_file($filePath,$absolutePath)) { - $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] An error occurred while trying to upload the file: '.$filePath.' to '.$absolutePath); + $fileName = str_replace(' ','',$relativePath); + + $file = array("name" => $shortName, "tmp_name" => $filePath,"error" => "0"); // emulate a $_FILES object + + $success = true; + // modFileMediaSource class uses move_uploaded_file - because we create a local file - we cannot use this function and we use streams instead + if(!is_uploaded_file($filePath) && get_class($mediaSource) == 'modFileMediaSource_mysql') { + $input = fopen($filePath, "r"); + $target = fopen($this->getPath(true).$shortName, "w"); + $bytes = stream_copy_to_stream($input, $target); + fclose($input); + fclose($target); } else { - $fileName = str_replace(' ','',$relativePath); + $success = $mediaSource->uploadObjectsToContainer($targetDir,array($file)); } + + // if(!$success) { + // $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] An error occurred while trying to upload the file: '.$filePath.' to '.$absolutePath); + // return false; + // } return $fileName; } @@ -418,7 +426,8 @@ public static function getList(modX &$modx,array $scriptProperties = array()) { $limit = $modx->getOption('limit',$scriptProperties,10); $start = $modx->getOption('start',$scriptProperties,0); $parent = $modx->getOption('parent',$scriptProperties,0); - $id = $modx->getOption('id',$scriptProperties,false); + $showAll = $modx->getOption('showAll',$scriptProperties, false); + $id = $modx->getOption('id',$scriptProperties,false); $showInactive = $modx->getOption('showInactive',$scriptProperties,false); $prominentOnly = $modx->getOption('prominentOnly',$scriptProperties,true); @@ -444,7 +453,7 @@ public static function getList(modX &$modx,array $scriptProperties = array()) { 'prominent' => true, )); } - if (empty($showAll)) { + if ($showAll == false) { $c->where(array( 'parent' => $parent, )); diff --git a/core/components/gallery/model/gallery/galitem.class.php b/core/components/gallery/model/gallery/galitem.class.php index 61e85e8..597b12d 100644 --- a/core/components/gallery/model/gallery/galitem.class.php +++ b/core/components/gallery/model/gallery/galitem.class.php @@ -23,6 +23,24 @@ * @package gallery */ class galItem extends xPDOSimpleObject { + private $mediaSource = false; + + private function getMediaSource() { + if($this->mediaSource) return $this->mediaSource; + //get modMediaSource + $mediaSource = $this->xpdo->getOption('gallery.mediaSource',null,1); + + $def = $this->xpdo->getObject('sources.modMediaSource',array( + 'id' => $mediaSource, + )); + + $def->initialize(); + + $this->mediaSource = $def; + + return $this->mediaSource; + } + public function get($k, $format = null, $formatTemplate= null) { switch ($k) { case 'thumbnail': @@ -35,6 +53,12 @@ public function get($k, $format = null, $formatTemplate= null) { $format['src'] = $this->getSiteUrl(); $format['src'] .= $this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$filename; } + + $ms = $this->getMediaSource(); + if($ms->getBaseUrl() != '/') { + $format['src'] = $ms->getBaseUrl().$this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$filename; + } + $url = $value.'&'.http_build_query($format,'','&'); if ($this->xpdo->getOption('xhtml_urls',null,false)) { $value = str_replace('&','&',$url); @@ -52,12 +76,24 @@ public function get($k, $format = null, $formatTemplate= null) { $format['src'] = $this->getSiteUrl(); $format['src'] .= $this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$filename; } + + $ms = $this->getMediaSource(); + if($ms->getBaseUrl() != '/') { + $format['src'] = $ms->getBaseUrl().$this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$filename; + } + $value = $this->getPhpThumbUrl().'&'.http_build_query($format,'','&'); $value = $this->xpdo->getOption('xhtml_urls',null,false) ? str_replace('&','&',$value) : $value; break; case 'absoluteImage': $siteUrl = $this->getSiteUrl(); $value = $siteUrl.$this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$this->get('filename'); + + // $ms = $this->getMediaSource(); + // if($ms->getBaseUrl() != '/') { + // $value = $ms->getBaseUrl().$this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$filename; + // } + break; case 'relativeImage': $baseUrl = $this->getOption('base_url'); @@ -67,6 +103,12 @@ public function get($k, $format = null, $formatTemplate= null) { } else { $value = str_replace($baseUrl,'',$path); } + + // $ms = $this->getMediaSource(); // for absolute + relative the link NEEDS the http:// domain + // if($ms->getBaseUrl() != '/') { + // $value = $ms->getBaseUrl().$this->xpdo->call('galAlbum','getFilesUrl',array(&$this->xpdo)).$baseUrl; + // } + break; case 'filesize': $filename = $this->xpdo->call('galAlbum','getFilesPath',array(&$this->xpdo)).$this->get('filename'); @@ -75,6 +117,14 @@ public function get($k, $format = null, $formatTemplate= null) { break; case 'image_path': $value = $this->xpdo->call('galAlbum','getFilesPath',array(&$this->xpdo)).$this->get('filename'); + break; + case 'base_url': + $ms = $this->getMediaSource(); + $value=''; + if($ms->getBaseUrl() != '/') { + $value = $ms->getBaseUrl(); + } + break; default: $value = parent::get($k,$format,$formatTemplate); @@ -93,7 +143,7 @@ public function getPath($absolute = true) { public function getPhpThumbUrl() { $assetsUrl = $this->xpdo->getOption('gallery.assets_url',null,$this->xpdo->getOption('assets_url',null,MODX_ASSETS_URL).'components/gallery/'); - $assetsUrl .= 'connector.php?action=web/phpthumb'; + $assetsUrl .= 'connector.php?action=web/phpthumb&ctx='.$this->xpdo->context->get('key'); return $assetsUrl; } @@ -136,7 +186,7 @@ public function upload($file,$albumId) { $album = $this->xpdo->getObject('galAlbum',$albumId); if (empty($album)) return false; - $fileName = $album->uploadItem($this,$file['tmp_name'],$file['name']); + $fileName = $album->uploadItem($this,$file['tmp_name'], $file['name'], $this->getMediaSource()); if (empty($fileName)) { return false; } @@ -168,7 +218,9 @@ public function remove(array $ancestors = array()) { $filename = $this->get('filename'); if (!empty($filename)) { $filename = $this->xpdo->call('galAlbum','getFilesPath',array(&$this->xpdo)).$filename; - if (!@unlink($filename)) { + $filename = str_ireplace(MODX_BASE_PATH, '', $filename); + $ms = $this->getMediaSource(); + if (!@$ms->removeObject($filename)) { $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] An error occurred while trying to remove the attachment file at: '.$filename); } } @@ -243,6 +295,7 @@ public function move($album) { } public static function getList(modX &$modx,array $scriptProperties = array()) { + $sort = $modx->getOption('sort',$scriptProperties,'rank'); $cacheKey = 'gallery/item/list/'.md5(serialize($scriptProperties)); if ($modx->getCacheManager() && $cache = $modx->cacheManager->get($cacheKey)) { $items = array(); @@ -252,8 +305,12 @@ public static function getList(modX &$modx,array $scriptProperties = array()) { $item->fromArray($data,'',true,true); $items[] = $item; } - - $data = array( + + if (in_array(strtolower($sort),array('random','rand()','rand'))) { + shuffle($items); + } + + $data = array( 'items' => $items, 'total' => $cache['total'], 'album' => $cache['album'], @@ -267,7 +324,6 @@ public static function getList(modX &$modx,array $scriptProperties = array()) { /* Fix to make it work with getPage which uses "offset" instead of "start" */ $offset = $modx->getOption('offset',$scriptProperties,0); if ($offset > 0) { $start = $offset; } - $sort = $modx->getOption('sort',$scriptProperties,'rank'); $sortAlias = $modx->getOption('sortAlias',$scriptProperties,'galItem'); if ($sort == 'rank') $sortAlias = 'AlbumItems'; $dir = $modx->getOption('dir',$scriptProperties,'ASC'); diff --git a/core/components/gallery/model/gallery/gallery.class.php b/core/components/gallery/model/gallery/gallery.class.php index 62ead5a..5d6bc36 100644 --- a/core/components/gallery/model/gallery/gallery.class.php +++ b/core/components/gallery/model/gallery/gallery.class.php @@ -382,4 +382,13 @@ public function getAllChilds($album, &$albumsWithSubs, $sort, $dir, $deep){ $this->getAllChilds($subAlbum, $albumsWithSubs, $sort, $dir, $deep+1); } } + + public function explodeAndClean($array, $delimiter = ',') { + $array = explode($delimiter, $array); // Explode fields to array + $array = array_map('trim', $array); // Trim array's values + $array = array_keys(array_flip($array)); // Remove duplicate fields + $array = array_filter($array); // Remove empty values from array + + return $array; + } } \ No newline at end of file diff --git a/core/components/gallery/model/gallery/import/galzipimport.class.php b/core/components/gallery/model/gallery/import/galzipimport.class.php index c733d02..3e6c75f 100644 --- a/core/components/gallery/model/gallery/import/galzipimport.class.php +++ b/core/components/gallery/model/gallery/import/galzipimport.class.php @@ -120,10 +120,10 @@ public function importFile($file,array $options = array()) { $newRelativePath = $this->albumId.'/'.$newFileName; $newAbsolutePath = $this->target.'/'.$newFileName; - if (@file_exists($newAbsolutePath)) { - @unlink($newAbsolutePath); - } - if (!@copy($filePathName,$newAbsolutePath)) { + $file = array("name" => $newRelativePath, "tmp_name" => $filePathName, "error" => "0"); // emulate a $_FILES object + + $success = $item->upload($file,$options['album']); + if(!$success) { $errors[] = $this->modx->lexicon('gallery.file_err_move',array( 'file' => $newFileName, 'target' => $newAbsolutePath, diff --git a/core/components/gallery/processors/mgr/album/getnodes.class.php b/core/components/gallery/processors/mgr/album/getnodes.class.php index 3b956c6..8c86152 100644 --- a/core/components/gallery/processors/mgr/album/getnodes.class.php +++ b/core/components/gallery/processors/mgr/album/getnodes.class.php @@ -47,7 +47,14 @@ public function getAlbums($id) { $albumArray['text'] = $album->get('name').' ('.$album->get('id').')'; $albumArray['leaf'] = false; $albumArray['parent'] = 0; - $albumArray['cls'] = 'icon-tiff'.($album->get('active') ? '' : ' gal-item-inactive'); + + $version = $this->modx->getVersionData(); + if ($version['major_version'] < 3) { + $albumArray['cls'] = 'icon-tiff'.($album->get('active') ? '' : ' gal-item-inactive'); + } else { + $albumArray['iconCls'] = 'icon icon-tiff'.($album->get('active') ? '' : ' gal-item-inactive'); + } + $albumArray['classKey'] = 'galAlbum'; if (!empty($action)) { $albumArray['page'] = '?a='.$action->get('id').'&album='.$album->get('id').'&action=album/update'; diff --git a/core/components/gallery/processors/mgr/item/ajaxupload.php b/core/components/gallery/processors/mgr/item/ajaxupload.php index c52fd29..90eb498 100644 --- a/core/components/gallery/processors/mgr/item/ajaxupload.php +++ b/core/components/gallery/processors/mgr/item/ajaxupload.php @@ -28,29 +28,26 @@ $albumDir = $album.'/'; $targetDir = $modx->call('galAlbum','getFilesPath',array(&$modx)).$albumDir; -$cacheManager = $modx->getCacheManager(); -/* if directory doesnt exist, create it */ -if (!file_exists($targetDir) || !is_dir($targetDir)) { - if (!$cacheManager->writeTree($targetDir)) { - $modx->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not create directory: '.$targetDir); - return $modx->toJSON(array('error' => 'Could not create directory: ' . $targetDir)); - } -} -/* make sure directory is readable/writable */ -if (!is_readable($targetDir) || !is_writable($targetDir)) { - $modx->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not write to directory: '.$targetDir); - return $modx->toJSON(array('error' => 'Could not write to directory: ' . $targetDir)); -} +// $cacheManager = $modx->getCacheManager(); +// /* if directory doesnt exist, create it */ +// if (!file_exists($targetDir) || !is_dir($targetDir)) { +// if (!$cacheManager->writeTree($targetDir)) { +// $modx->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not create directory: '.$targetDir); +// return $modx->toJSON(array('error' => 'Could not create directory: ' . $targetDir)); +// } +// } +// /* make sure directory is readable/writable */ +// if (!is_readable($targetDir) || !is_writable($targetDir)) { +// $modx->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not write to directory: '.$targetDir); +// return $modx->toJSON(array('error' => 'Could not write to directory: ' . $targetDir)); +// } /* upload the file */ -$extension = end(explode('.', $filenm)); +$extension = @end(explode('.', $filenm)); $filename = $item->get('id').'.'.$extension; $relativePath = $albumDir.$filename; $absolutePath = $targetDir.$filename; -if (@file_exists($absolutePath)) { - @unlink($absolutePath); -} if (!empty($_FILES['qqfile'])) { if (!$item->upload($_FILES['qqfile'],$scriptProperties['album'])) { @@ -58,20 +55,35 @@ return $modx->error->failure($modx->lexicon('gallery.item_err_upload')); } } else { - /* Using AJAX upload */ + + $length = 10; + $tmpDir = MODX_CORE_PATH."cache/gallery-tmp/"; + + if(!file_exists($tmpDir)) mkdir($tmpDir); + + $randomFilename = $tmpDir.substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length).".$extension"; + + /* Using AJAX upload - to tmp file then use the correct media source to upload */ $input = fopen("php://input", "r"); - $target = fopen($absolutePath, "w"); + $target = fopen($randomFilename, "w"); $bytes = stream_copy_to_stream($input, $target); fclose($input); fclose($target); - - if ($bytes == 0) { + + $file = array("name" => $relativePath, "tmp_name" => $randomFilename, "error" => "0"); // emulate a $_FILES object + + $modx->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Album Type: '.$scriptProperties['album']); + + + if ($bytes == 0 || !$item->upload($file,$scriptProperties['album'])) { $modx->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] An error occurred while trying to upload the file to '.$absolutePath); $item->remove(); return $modx->toJSON(array('error' => 'gallery.item_err_upload')); } else { $item->set('filename',str_replace(' ','',$relativePath)); } + + @unlink($randomFilename); } $item->save(); @@ -105,4 +117,4 @@ /* output to browser */ return $modx->toJSON(array('success' => true)); -?> \ No newline at end of file +?> diff --git a/core/components/gallery/processors/mgr/item/batchupload.php b/core/components/gallery/processors/mgr/item/batchupload.php index 69d7900..32b7249 100644 --- a/core/components/gallery/processors/mgr/item/batchupload.php +++ b/core/components/gallery/processors/mgr/item/batchupload.php @@ -56,20 +56,6 @@ $targetDir = $modx->call('galAlbum','getFilesPath',array(&$modx)).$scriptProperties['album'].'/'; -$cacheManager = $modx->getCacheManager(); -/* if directory doesnt exist, create it */ -if (!file_exists($targetDir) || !is_dir($targetDir)) { - if (!$cacheManager->writeTree($targetDir)) { - $modx->log(modX::LOG_LEVEL_ERROR,'[Gallery] Could not create directory: '.$targetDir); - return $modx->error->failure($modx->lexicon('gallery.directory_err_create',array('directory' => $targetDir))); - } -} -/* make sure directory is readable/writable */ -if (!is_readable($targetDir) || !is_writable($targetDir)) { - $modx->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] Could not write to directory: '.$targetDir); - return $modx->error->failure($modx->lexicon('gallery.directory_err_write',array('directory' => $targetDir))); -} - $imagesExts = array('jpg','jpeg','png','gif','bmp'); $use_multibyte = $modx->getOption('use_multibyte',null,false); $encoding = $modx->getOption('modx_charset',null,'UTF-8'); @@ -108,11 +94,11 @@ $newFileName = $item->get('id').'.'.$fileExtension; $newRelativePath = $scriptProperties['album'].'/'.$newFileName; $newAbsolutePath = $targetDir.'/'.$newFileName; - - if (@file_exists($newAbsolutePath)) { - @unlink($newAbsolutePath); - } - if (!@copy($filePathName,$newAbsolutePath)) { + + $file = array("name" => $newRelativePath, "tmp_name" => $filePathName, "error" => "0"); // emulate a $_FILES object + + $success = $item->upload($file,$scriptProperties['album']); + if(!$success) { $errors[] = $modx->lexicon('gallery.file_err_move',array( 'file' => $newFileName, 'target' => $newAbsolutePath, diff --git a/core/components/gallery/processors/mgr/item/sort.php b/core/components/gallery/processors/mgr/item/sort.php index 6f13021..3ce8880 100644 --- a/core/components/gallery/processors/mgr/item/sort.php +++ b/core/components/gallery/processors/mgr/item/sort.php @@ -43,11 +43,11 @@ SET rank = rank - 1 WHERE album = ".$scriptProperties['album']." - AND rank <= {$target->get('rank')} + AND rank < {$target->get('rank')} AND rank > {$source->get('rank')} AND rank > 0 "); - $newRank = $target->get('rank'); + $newRank = $target->get('rank')-1; } else { $modx->exec(" UPDATE {$modx->getTableName('galAlbumItem')} @@ -62,4 +62,4 @@ $source->set('rank',$newRank); $source->save(); -return $modx->error->success(); \ No newline at end of file +return $modx->error->success(); diff --git a/core/components/gallery/processors/web/phpthumb.php b/core/components/gallery/processors/web/phpthumb.php index 08912b5..892f1a6 100644 --- a/core/components/gallery/processors/web/phpthumb.php +++ b/core/components/gallery/processors/web/phpthumb.php @@ -1,4 +1,5 @@ loadClass('modPhpThumb',$modx->getOption('core_path').'model/phpthumb/',true,true)) { - $modx->log(modX::LOG_LEVEL_ERROR,'[phpThumbOf] Could not load modPhpThumb class.'); - return ''; + + +if (!class_exists('phpthumb', false)) { + if (!$modx->loadClass('phpthumb', MODX_CORE_PATH . 'model/phpthumb/', true, true)) { + $modx->log(modX::LOG_LEVEL_ERROR, '[phpThumbOf] Could not load modPhpThumb class.'); + return ''; + } } -$debug = $modx->getOption('debug',$scriptProperties,false); -$src = $modx->getOption('src',$scriptProperties,''); -$src = str_replace('+','%27',urldecode($src)); + + +$debug = $modx->getOption('debug', $scriptProperties, false); + +$src = $modx->getOption('src', $scriptProperties, ''); +$src = str_replace('+', '%27', urldecode($src)); /* explode tag options */ $ptOptions = $scriptProperties; -if (empty($ptOptions['f'])){ +if (empty($ptOptions['f'])) { $ext = pathinfo($src, PATHINFO_EXTENSION); $ext = strtolower($ext); switch ($ext) { @@ -37,55 +45,66 @@ } /* load phpthumb */ -$assetsPath = $modx->getOption('gallery.assets_path',$scriptProperties,$modx->getOption('assets_path').'components/gallery/'); -$phpThumb = new modPhpThumb($modx,$ptOptions); -$cacheDir = $assetsPath.'cache/'; +$assetsPath = $modx->getOption('gallery.assets_path', $scriptProperties, $modx->getOption('assets_path') . 'components/gallery/'); +$cacheDir = $assetsPath . 'cache/'; /* check to make sure cache dir is writable */ if (!is_writable($cacheDir)) { if (!$modx->cacheManager->writeTree($cacheDir)) { - $modx->log(modX::LOG_LEVEL_ERROR,'[phpThumbOf] Cache dir not writable: '.$assetsPath.'cache/'); + $modx->log(modX::LOG_LEVEL_ERROR, '[phpThumbOf] Cache dir not writable: ' . $assetsPath . 'cache/'); return ''; } } -/* do initial setup */ -$phpThumb->initialize(); -$phpThumb->setParameter('config_cache_directory',$assetsPath.'cache/'); -$phpThumb->setParameter('config_allow_src_above_phpthumb',true); -$phpThumb->setParameter('allow_local_http_src',true); -$phpThumb->setParameter('config_document_root', $modx->getOption('base_path',null,MODX_BASE_PATH)); -$phpThumb->setCacheDirectory(); - /* get absolute url of image */ -if (strpos($src,'/') != 0 && strpos($src,'http') != 0) { - $src = $modx->getOption('base_url').$src; +if (strpos($src, '/') != 0 && strpos($src, 'http') != 0) { + $src = $modx->getOption('base_url') . $src; } else { $src = urldecode($src); } /* auto-prepend base path if not a URL */ -if (strpos($src,'http') === false) { - $basePath = $modx->getOption('base_path',null,MODX_BASE_PATH); +if (strpos($src, 'http') === false) { + $basePath = $modx->getOption('base_path', null, MODX_BASE_PATH); if ($basePath != '/') { - $src = str_replace(basename($basePath),'',$src); - $src = ltrim($src,'/'); - $src = $basePath.$src; + $src = str_replace(basename($basePath), '', $src); + $src = ltrim($src, '/'); + $src = $basePath . $src; } } -/* set source */ -$phpThumb->set($src); + +if (!isset($config['modphpthumb'])) { // make sure we get a few relevant system settings + $config['modphpthumb'] = array(); + $config['modphpthumb']['config_allow_src_above_docroot'] = (boolean)$modx->getOption('phpthumb_allow_src_above_docroot', null, false); + $config['modphpthumb']['zc'] = $modx->getOption('phpthumb_zoomcrop', null, 0); + $config['modphpthumb']['far'] = $modx->getOption('phpthumb_far', null, 'C'); + $config['modphpthumb']['config_ttf_directory'] = MODX_CORE_PATH . 'model/phpthumb/fonts/'; + $config['modphpthumb']['config_document_root'] = $modx->getOption('phpthumb_document_root', null, ''); +} +$phpThumb = new phpthumb(); // unfortunately we have to create a new object for each image! +foreach ($config['modphpthumb'] as $param => $value) { // add MODX system settings + $phpThumb->$param = $value; +} +foreach ($ptOptions as $param => $value) { // add options passed to the snippet + $phpThumb->setParameter($param, $value); +} +// try to avert problems when $_SERVER['DOCUMENT_ROOT'] is different than MODX_BASE_PATH +if (!$phpThumb->config_document_root) { + $phpThumb->config_document_root = MODX_BASE_PATH; // default if nothing set from system settings +} +$phpThumb->config_cache_directory = $assetsPath . 'cache/'; // doesn't matter, but saves phpThumb some frustration +$phpThumb->setSourceFilename($src); /* setup cache filename that is unique to this tag */ -$inputSanitized = str_replace(array(':','/'),'_',$src); +$inputSanitized = str_replace(array(':', '/'), '_', $src); $cacheFilename = $inputSanitized; -$cacheFilename .= '.'.md5(serialize($scriptProperties)); +$cacheFilename .= '.' . md5(serialize($scriptProperties)); $cacheFilename .= '.' . (!empty($ptOptions['f']) ? $ptOptions['f'] : 'png'); -$cacheKey = $assetsPath.'cache/'.$cacheFilename; +$cacheKey = $assetsPath . 'cache/' . $cacheFilename; /* get cache Url */ -$assetsUrl = $modx->getOption('gallery.assets_url',$scriptProperties,$modx->getOption('assets_url').'components/gallery/'); -$cacheUrl = $assetsUrl.'cache/'.str_replace($cacheDir,'',$cacheKey); -$cacheUrl = str_replace('//','/',$cacheUrl); +$assetsUrl = $modx->getOption('gallery.assets_url', $scriptProperties, $modx->getOption('assets_url') . 'components/gallery/'); +$cacheUrl = $assetsUrl . 'cache/' . str_replace($cacheDir, '', $cacheKey); +$cacheUrl = str_replace('//', '/', $cacheUrl); /* ensure we have an accurate and clean cache directory */ $phpThumb->CleanUpCacheDirectory(); @@ -101,7 +120,7 @@ $oldLogTarget = $modx->getLogTarget(); $oldLogLevel = $modx->getLogLevel(); $modx->setLogLevel(modX::LOG_LEVEL_DEBUG); - $logTarget = $modx->getOption('debugTarget',$scriptProperties,''); + $logTarget = $modx->getOption('debugTarget', $scriptProperties, ''); if (!empty($logTarget)) { $modx->setLogTarget(); } @@ -109,42 +128,54 @@ /* ensure file has proper permissions */ if (!empty($cacheKey)) { - $filePerm = (int)$modx->getOption('new_file_permissions',$scriptProperties,'0664'); + $filePerm = (int)$modx->getOption('new_file_permissions', $scriptProperties, '0664'); @chmod($cacheKey, octdec($filePerm)); } if ($debug) { - $mtime= microtime(); - $mtime= explode(" ", $mtime); - $mtime= $mtime[1] + $mtime[0]; - $tend= $mtime; - $totalTime= ($tend - $tstart); - $totalTime= sprintf("%2.4f s", $totalTime); - - $modx->log(modX::LOG_LEVEL_DEBUG,"\n
    Execution time: {$totalTime}\n
    "); + $mtime = microtime(); + $mtime = explode(" ", $mtime); + $mtime = $mtime[1] + $mtime[0]; + $tend = $mtime; + $totalTime = ($tend - $tstart); + $totalTime = sprintf("%2.4f s", $totalTime); + + $modx->log(modX::LOG_LEVEL_DEBUG, "\n
    Execution time: {$totalTime}\n
    "); $modx->setLogLevel($oldLogLevel); $modx->setLogTarget($oldLogTarget); } -$output = ''; +$output = $assetsUrl; + + /* check to see if there's a cached file of this already */ if (file_exists($cacheKey)) { - $modx->log(modX::LOG_LEVEL_DEBUG,'[phpThumbOf] Using cached file found for thumb: '.$cacheKey); - $output = str_replace(' ','%20',$cacheUrl); + $modx->log(modX::LOG_LEVEL_DEBUG, '[phpThumbOf] Using cached file found for thumb: ' . $cacheKey); + $output = str_replace(' ', '%20', $cacheUrl); } else { /* actually make the thumbnail */ + //return $cacheKey; if ($phpThumb->GenerateThumbnail()) { // this line is VERY important, do not remove it! if ($phpThumb->RenderToFile($cacheKey)) { - $output = str_replace(' ','%20',$cacheUrl); + $output = str_replace(' ', '%20', $cacheUrl); } else { - $modx->log(modX::LOG_LEVEL_ERROR,'[phpThumbOf] Could not cache thumb "'.$src.'" to file at: '.$cacheKey.' - Debug: '.print_r($phpThumb->debugmessages,true)); + $modx->log(modX::LOG_LEVEL_ERROR, '[phpThumbOf] Could not cache thumb "' . $src . '" to file at: ' . $cacheKey . ' - Debug: ' . print_r($phpThumb->debugmessages, true)); } } else { - $modx->log(modX::LOG_LEVEL_ERROR,'[phpThumbOf] Could not generate thumbnail: '.$src.' - Debug: '.print_r($phpThumb->debugmessages,true)); + $modx->log(modX::LOG_LEVEL_ERROR, '[phpThumbOf] Could not generate thumbnail: ' . $src . ' - Debug: ' . print_r($phpThumb->debugmessages, true)); } } if (!headers_sent()) { - $phpThumb->setOutputFormat(); + $headers = $modx->request->getHeaders(); + $mtime = filemtime($cacheKey); + if (isset($headers['If-Modified-Since']) && strtotime($headers['If-Modified-Since']) == $mtime) { + // cache is good, send 304 + header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime).' GMT', true, 304); + exit(); + } + header('Last-Modified: '.gmdate('D, d M Y H:i:s', $mtime).' GMT', true, 200); + $phpThumb->setOutputFormat(); header('Content-Type: '.phpthumb_functions::ImageTypeToMIMEtype($phpThumb->thumbnailFormat)); header('Content-Disposition: inline; filename="'.basename($src).'"'); } -return file_get_contents($cacheKey); \ No newline at end of file + +return file_get_contents($cacheKey); From a69f7b927d74b03c3a33054c30edcd7d6a171091 Mon Sep 17 00:00:00 2001 From: wax100 Date: Thu, 8 Feb 2018 14:03:05 +0300 Subject: [PATCH 5/5] Add comments translation --- .../plugins/gallerycustomtv.plugin.php | 10 +-- .../plugins/gallerycustomtv.plugin.php_ | 74 ------------------- readme.md | 2 + 3 files changed, 7 insertions(+), 79 deletions(-) delete mode 100644 core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ diff --git a/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php b/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php index 3b15788..56987ee 100644 --- a/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php +++ b/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php @@ -3,7 +3,7 @@ * Handles plugin events for Gallery's Custom TV * need to add plugin property tmplvarid * - * @package gallery + * @package gallery */ $corePath = $modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/'); switch ($modx->event->name) { @@ -20,16 +20,16 @@ $options = array('processors_path'=>$GalleryProcessorPath); $galleryName = $resource->get('pagetitle'); - //Получаем все TV текущего ресурса + //Get all TV of current resource $tvs = $resource->getTemplateVars(); foreach($tvs as $tv) { //нам нужны только TV с типом galleryalbumview if ($tv->get('type')=='galleryalbumview') { $tvvalue = $tv->getValue($id); if (empty($tvvalue)) { - //Параметры TV + //tv params $tv_prop = $tv->get('properties'); - //Создаем альбом + //create album $album = array( 'name' => $galleryName, 'parent' => isset($tv_prop['galParentId']['value'])?$tv_prop['galParentId']['value']:0, @@ -45,7 +45,7 @@ } } else { - // TV уже есть, обновим название альбома + // if TV exists, update album title $resp = $modx->runProcessor('mgr/album/get',array('id'=>$tvvalue),$options); if (!$resp->isError()) { $album = $resp->getObject(); diff --git a/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ b/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ deleted file mode 100644 index ba7f63e..0000000 --- a/core/components/gallery/elements/plugins/gallerycustomtv.plugin.php_ +++ /dev/null @@ -1,74 +0,0 @@ -getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/'); -switch ($modx->event->name) { - case 'OnTVInputRenderList': - $modx->event->output($corePath.'elements/tv/input/'); - break; - case 'OnTVOutputRenderList': - $modx->event->output($corePath.'elements/tv/output/'); - break; - case 'OnTVInputPropertiesList': - $modx->event->output($corePath.'elements/tv/inputoptions/'); - break; - case 'OnTVOutputRenderPropertiesList': - $modx->event->output($corePath.'elements/tv/properties/'); - break; - case 'OnManagerPageBeforeRender': - $gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties); - if (!($gallery instanceof Gallery)) return ''; - - $snippetIds = ''; - $gallerySnippet = $modx->getObject('modSnippet',array('name' => 'Gallery')); - if ($gallerySnippet) { - $snippetIds .= 'GAL.snippetGallery = "'.$gallerySnippet->get('id').'";'."\n"; - } - $galleryItemSnippet = $modx->getObject('modSnippet',array('name' => 'GalleryItem')); - if ($galleryItemSnippet) { - $snippetIds .= 'GAL.snippetGalleryItem = "'.$galleryItemSnippet->get('id').'";'."\n"; - } - - $jsDir = $modx->getOption('gallery.assets_url',null,$modx->getOption('assets_url').'components/gallery/').'js/mgr/'; - $modx->controller->addLexiconTopic('gallery:default'); - $modx->controller->addJavascript($jsDir.'gallery.js'); - $modx->controller->addJavascript($jsDir.'tree.js'); - $modx->controller->addHtml(''); - break; - case 'OnDocFormPrerender': - $gallery = $modx->getService('gallery','Gallery',$modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/gallery/',$scriptProperties); - if (!($gallery instanceof Gallery)) return ''; - - /* assign gallery lang to JS */ - $modx->controller->addLexiconTopic('gallery:tv'); - - /* @var modAction $action */ - $action = $modx->getObject('modAction',array( - 'namespace' => 'gallery', - 'controller' => 'index', - )); - $modx->controller->addHtml(''); - $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/Spotlight.js'); - $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/gallery.js'); - $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/widgets/album/album.items.view.js'); - $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/widgets/album/album.tree.js'); - $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/gal.browser.js'); - $modx->controller->addJavascript($gallery->config['assetsUrl'].'js/mgr/tv/galtv.js'); - $modx->controller->addCss($gallery->config['cssUrl'].'mgr.css'); - break; -} -return; \ No newline at end of file diff --git a/readme.md b/readme.md index a66b98c..93ccaf8 100644 --- a/readme.md +++ b/readme.md @@ -15,8 +15,10 @@ Simply download through Package Management, and install. For setting up the custom TV, create a TV with Input and Output types of 'galleryitem'. +Added custom TV called 'galleryitemview'. Documentation ============= Please see the official documentation at: http://rtfm.modx.com/display/ADDON/Gallery/ + \ No newline at end of file