'
,''
@@ -202,7 +222,7 @@ Ext.extend(GAL.view.AlbumItems,MODx.DataView,{
,showScreenshot: function(id) {
var data = this.lookup['gal-item-'+id];
if (!data) return false;
-
+
if (!this.ssWin) {
this.ssWin = new Ext.Window({
layout:'fit'
@@ -240,6 +260,11 @@ Ext.extend(GAL.view.AlbumItems,MODx.DataView,{
,handler: this.updateItem
,scope: this
});
+ m.add({
+ text: _('gallery.set_as_cover')
+ ,handler: this.setAsCover
+ ,scope: this
+ });
m.add('-');
m.add({
text: _('gallery.item_delete')
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 5ffe1f1..d9c0e0a 100644
--- a/assets/components/gallery/js/mgr/widgets/album/album.panel.js
+++ b/assets/components/gallery/js/mgr/widgets/album/album.panel.js
@@ -1,6 +1,6 @@
GAL.panel.Album = function(config) {
config = config || {};
-
+
Ext.apply(config,{
id: 'gal-panel-album'
,url: GAL.config.connector_url
@@ -46,11 +46,47 @@ GAL.panel.Album = function(config) {
,name: 'name'
,anchor: '100%'
,allowBlank: false
+ },{
+ xtype: 'textfield'
+ ,fieldLabel: _('gallery.year')
+ ,name: 'year'
+ ,anchor: '100%'
+ ,allowBlank: true
},{
xtype: 'textarea'
,fieldLabel: _('description')
,name: 'description'
,anchor: '100%'
+ },{
+ layout: 'column'
+ ,border:false
+ ,fieldLabel: _('gallery.cover_filename')
+ ,items: [{
+ xtype: 'textfield'
+ ,name: 'cover_filename'
+ ,id: 'cover_filename'
+ ,readOnly: true
+ ,allowBlank: true
+ ,columnWidth: .6
+ },{
+ xtype:'hidden'
+ ,'name':'cover_filename_url'
+ ,id:'cover_filename_url'
+ },{
+ xtype:'button'
+ ,text: _('gallery.upload_cover')
+ ,height: 39
+ ,handler: this.updateCover
+ },{
+ xtype:'button'
+ ,text: _('gallery.delete_cover')
+ ,height: 39
+ ,handler:function() {
+ var panel=Ext.getCmp('gal-panel-album').getForm();
+ panel.findField('cover_filename').setValue('');
+ panel.findField('cover_filename_url').setValue('');
+ }
+ }]
}]
},{
columnWidth: .4
@@ -110,6 +146,7 @@ GAL.panel.Album = function(config) {
};
Ext.extend(GAL.panel.Album,MODx.FormPanel,{
initialized: false
+ ,windows: {}
,setup: function() {
if (!this.config.album || this.initialized) return;
MODx.Ajax.request({
@@ -132,6 +169,38 @@ Ext.extend(GAL.panel.Album,MODx.FormPanel,{
Ext.apply(o.form.baseParams,{
});
}
+ ,updateCover:function(btn,e) {
+ var form=this.findParentByType('gal-panel-album');
+ var data=form.getForm().getValues();
+ /**
+ * We'll need a "fresh" window when using Tiny for the description field,
+ * so we don't check if it exists but just load a new window.
+ */
+ form.windows.updateCover = MODx.load({
+ xtype: 'gal-window-cover-update'
+ ,listeners: {
+ 'success': function(o) {
+ if(o.a.result.object) {
+ var panel=Ext.getCmp('gal-panel-album');
+ panel.getForm().setValues(o.a.result.object);
+ }
+ this.close();
+ }
+ }
+ });
+ form.windows.updateCover.setValues(data);
+ var previewDivName=form.windows.updateCover.ident+'-preview';
+ var preview=form.windows.updateCover.find('id',previewDivName);
+ if(preview.length>0) {
+ if(data.cover_filename_url!='') {
+ var now=new Date();
+ preview[0].html='';
+ } else {
+ preview[0].setVisible(false);
+ }
+ }
+ form.windows.updateCover.show(e.target);
+ }
,success: function(o) {
Ext.getCmp('gal-btn-save').setDisabled(false);
}
@@ -142,7 +211,7 @@ Ext.reg('gal-panel-album',GAL.panel.Album);
GAL.panel.AlbumItems = function(config) {
config = config || {};
-
+
this.view = MODx.load({
id: 'gal-album-items-view'
,xtype: 'gal-view-album-items'
@@ -161,44 +230,44 @@ GAL.panel.AlbumItems = function(config) {
,autoLoad: true
,items: [
'-'
- ,_('per_page')+':'
- ,{
- xtype: 'textfield'
- ,value: config.pageSize || (parseInt(MODx.config.default_per_page) || 20)
- ,width: 40
- ,listeners: {
- 'change': {fn:function(tf,nv,ov) {
- if (Ext.isEmpty(nv)) return false;
- nv = parseInt(nv);
- this.view.pagingBar.pageSize = nv;
- this.view.store.load({params:{
- start:0
- ,limit: nv
- }});
- },scope:this}
- ,'render': {fn: function(cmp) {
- new Ext.KeyMap(cmp.getEl(), {
- key: Ext.EventObject.ENTER
- ,fn: function() {
- this.fireEvent('change',this.getValue());
- this.blur();
- return true;}
- ,scope: cmp
- });
- },scope:this}
- }
- }
- ,'-'
- ]
+ ,_('per_page')+':'
+ ,{
+ xtype: 'textfield'
+ ,value: config.pageSize || (parseInt(MODx.config.default_per_page) || 20)
+ ,width: 40
+ ,listeners: {
+ 'change': {fn:function(tf,nv,ov) {
+ if (Ext.isEmpty(nv)) return false;
+ nv = parseInt(nv);
+ this.view.pagingBar.pageSize = nv;
+ this.view.store.load({params:{
+ start:0
+ ,limit: nv
+ }});
+ },scope:this}
+ ,'render': {fn: function(cmp) {
+ new Ext.KeyMap(cmp.getEl(), {
+ key: Ext.EventObject.ENTER
+ ,fn: function() {
+ this.fireEvent('change',this.getValue());
+ this.blur();
+ return true;}
+ ,scope: cmp
+ });
+ },scope:this}
+ }
+ }
+ ,'-'
+ ]
});
var dv = this.view;
-
-
+
+
dv.on('render', function() {
dv.dragZone = new MODx.DataView.dragZone(dv);
dv.dropZone = new MODx.DataView.dropZone(dv);
});
-
+
Ext.applyIf(config,{
id: 'gal-panel-album-items'
,cls: 'browser-win'
@@ -257,7 +326,7 @@ GAL.panel.AlbumItems = function(config) {
}]
});
GAL.panel.AlbumItems.superclass.constructor.call(this,config);
-
+
};
Ext.extend(GAL.panel.AlbumItems,MODx.Panel,{
windows: {}
@@ -337,4 +406,4 @@ Ext.extend(GAL.panel.AlbumItems,MODx.Panel,{
this.windows.zipUpload.show(e.target);
}
});
-Ext.reg('gal-panel-album-items',GAL.panel.AlbumItems);
\ No newline at end of file
+Ext.reg('gal-panel-album-items',GAL.panel.AlbumItems);
diff --git a/core/components/gallery/docs/changelog.txt b/core/components/gallery/docs/changelog.txt
index 9a4fdc6..236f77e 100755
--- a/core/components/gallery/docs/changelog.txt
+++ b/core/components/gallery/docs/changelog.txt
@@ -1,5 +1,23 @@
Changelog for Gallery.
+
+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
diff --git a/core/components/gallery/elements/snippets/snippet.gallery.php b/core/components/gallery/elements/snippets/snippet.gallery.php
index 0154b5c..5ad6cf9 100644
--- a/core/components/gallery/elements/snippets/snippet.gallery.php
+++ b/core/components/gallery/elements/snippets/snippet.gallery.php
@@ -44,6 +44,8 @@
if (empty($scriptProperties['album']) && empty($scriptProperties['tag'])) return '';
$data = $modx->call('galItem','getList',array(&$modx,$scriptProperties));
+$totalVar = $modx->getOption('totalVar', $scriptProperties, 'total');
+$modx->setPlaceholder($totalVar,$data['total']);
/* load plugins */
$plugin = $modx->getOption('plugin',$scriptProperties,'');
@@ -98,6 +100,9 @@
$activeCls = $modx->getOption('activeCls',$scriptProperties,'gal-item-active');
$highlightItem = $modx->getOption($imageGetParam,$_REQUEST,false);
/** @var galItem $item */
+
+if (!is_array($data)) return '';
+
foreach ($data['items'] as $item) {
$itemArray = $item->toArray();
$itemArray['idx'] = $idx;
@@ -106,7 +111,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');
@@ -138,6 +143,7 @@
'thumbnails' => $output,
'album_name' => $data['album']['name'],
'album_description' => $data['album']['description'],
+ 'album_year' => $data['album']['year'],
'albumRequestVar' => $albumRequestVar,
'albumId' => $data['album']['id'],
));
@@ -151,17 +157,23 @@
$toPlaceholder => $output,
$toPlaceholder.'.id' => $data['album']['id'],
$toPlaceholder.'.name' => $data['album']['name'],
+ $toPlaceholder.'.year' => $data['album']['year'],
$toPlaceholder.'.description' => $data['album']['description'],
$toPlaceholder.'.total' => $data['total'],
+ $toPlaceholder.'.next' => $data['album']['id'] + 1,
+ $toPlaceholder.'.prev' => $data['album']['id'] - 1,
));
} else {
$placeholderPrefix = $modx->getOption('placeholderPrefix',$scriptProperties,'gallery.');
$modx->toPlaceholders(array(
$placeholderPrefix.'id' => $data['album']['id'],
$placeholderPrefix.'name' => $data['album']['name'],
+ $placeholderPrefix.'year' => $data['album']['year'],
$placeholderPrefix.'description' => $data['album']['description'],
$placeholderPrefix.'total' => $data['total'],
+ $placeholderPrefix.'next' => $data['album']['id'] + 1,
+ $placeholderPrefix.'prev' => $data['album']['id'] - 1,
));
return $output;
}
-return '';
\ No newline at end of file
+return '';
diff --git a/core/components/gallery/elements/snippets/snippet.galleryalbums.php b/core/components/gallery/elements/snippets/snippet.galleryalbums.php
index 5c55d2f..267dc18 100644
--- a/core/components/gallery/elements/snippets/snippet.galleryalbums.php
+++ b/core/components/gallery/elements/snippets/snippet.galleryalbums.php
@@ -39,6 +39,13 @@
$albumCoverSortDir = $modx->getOption('albumCoverSortDir',$scriptProperties,'ASC');
$showName = $modx->getOption('showName',$scriptProperties,true);
+$totalProperties = $scriptProperties;
+$totalProperties['limit'] = '0';
+$totalProperties['start'] = '0';
+$totalAlbums = $modx->call('galAlbum', 'getList', array(&$modx, $totalProperties));
+$totalVar = $modx->getOption('totalVar', $scriptProperties, 'total');
+$modx->setPlaceholder($totalVar, count($totalAlbums));
+
/* build query */
$albums = $modx->call('galAlbum','getList',array(&$modx,$scriptProperties));
@@ -57,7 +64,7 @@
$thumbProperties = array_merge(array(
'w' => (int)$modx->getOption('thumbWidth',$scriptProperties,100),
'h' => (int)$modx->getOption('thumbHeight',$scriptProperties,100),
- 'zc' => (boolean)$modx->getOption('thumbZoomCrop',$scriptProperties,1),
+ 'zc' => (string)$modx->getOption('thumbZoomCrop',$scriptProperties,1),
'far' => (string)$modx->getOption('thumbFar',$scriptProperties,'C'),
'q' => (int)$modx->getOption('thumbQuality',$scriptProperties,90),
),$thumbProperties);
@@ -65,29 +72,69 @@
/* iterate */
$output = array();
$idx = 0;
+$filesUrl = $modx->call('galAlbum','getFilesUrl',array(&$modx));
+$nav = array();
/** @var galAlbum $album */
foreach ($albums as $album) {
$albumArray = $album->toArray();
+ $classes = array($rowCls);
+ if (!isset($nav['first'])) {
+ $nav['first'] = $albumArray['id'];
+ }
+ if (!isset($nav['next']) && isset($nav['current'])) {
+ $nav['next'] = $albumArray['id'];
+ }
+ if ($_GET[$albumRequestVar] == $albumArray['id']) {
+ $nav['current'] = $albumArray['id'];
+ $nav['curIdx'] = $idx + 1;
+ $classes[] = 'current';
+ }
+ if (!isset($nav['current'])) {
+ $nav['prev'] = $albumArray['id'];
+ }
+ $nav['last'] = $albumArray['id'];
+
+ $albumArray['cls'] = implode(' ', $classes);
+ $albumArray['idx'] = $idx;
+ $albumArray['showName'] = $showName;
+ $albumArray['albumRequestVar'] = $albumRequestVar;
$coverItem = $album->getCoverItem($albumCoverSort,$albumCoverSortDir);
if ($coverItem) {
$albumArray['image'] = $coverItem->get('thumbnail',$thumbProperties);
+ $albumArray['image_absolute'] = $filesUrl.$coverItem->get('filename');
$albumArray['total'] = $coverItem->get('total');
}
- $albumArray['cls'] = $rowCls;
+ $albumArray['cls'] = implode(' ', $classes);
$albumArray['idx'] = $idx;
$albumArray['showName'] = $showName;
$albumArray['albumRequestVar'] = $albumRequestVar;
$output[] = $gallery->getChunk($rowTpl,$albumArray);
$idx++;
}
+if (!isset($nav['current'])) {
+ unset($nav['prev']);
+}
+$nav['count'] = $idx;
/* set output to placeholder or return */
$outputSeparator = $modx->getOption('outputSeparator',$scriptProperties,"\n");
$output = implode($outputSeparator,$output);
+
+/* if set, place in a container tpl */
+$containerTpl = $modx->getOption('containerTpl',$scriptProperties,false);
+if (!empty($containerTpl)) {
+ $ct = $gallery->getChunk($containerTpl,array(
+ 'albums' => $output,
+ 'nav' => $nav,
+ 'albumRequestVar' => $albumRequestVar
+ ));
+ if (!empty($ct)) $output = $ct;
+}
+
if ($toPlaceholder) {
$modx->setPlaceholder($toPlaceholder,$output);
return '';
}
-return $output;
\ No newline at end of file
+return $output;
diff --git a/core/components/gallery/elements/tv/galleryalbumlist.inputproperties.tpl b/core/components/gallery/elements/tv/galleryalbumlist.inputproperties.tpl
index 720b333..abb6a2a 100644
--- a/core/components/gallery/elements/tv/galleryalbumlist.inputproperties.tpl
+++ b/core/components/gallery/elements/tv/galleryalbumlist.inputproperties.tpl
@@ -104,6 +104,15 @@ MODx.load({
,value: params['parent'] || ''
,width: 300
,listeners: oc
+ },{
+ xtype: 'combo-boolean'
+ ,fieldLabel: '{/literal}{$gl.subchilds}{literal}'
+ ,description: '{/literal}{$gl.subchilds_desc}{literal}'
+ ,name: 'inopt_subchilds'
+ ,id: 'inopt_subchilds{/literal}{$tv}{literal}'
+ ,value: params['subchilds'] || ''
+ ,width: 300
+ ,listeners: oc
},{
xtype: 'textfield'
,fieldLabel: '{/literal}{$gl.width}{literal}'
diff --git a/core/components/gallery/elements/tv/input/galleryalbumlist.php b/core/components/gallery/elements/tv/input/galleryalbumlist.php
index c610b66..3d82879 100644
--- a/core/components/gallery/elements/tv/input/galleryalbumlist.php
+++ b/core/components/gallery/elements/tv/input/galleryalbumlist.php
@@ -41,6 +41,7 @@
$showNone = (boolean)$modx->getOption('showNone',$params,true);
$showCover = (boolean)$modx->getOption('showCover',$params,true);
$parent = $modx->getOption('parent',$params,'');
+$subchilds = $modx->getOption('subchilds',$params,false);
/* get albums */
$c = $modx->newQuery('galAlbum');
@@ -58,6 +59,17 @@
}
$albums = $modx->getCollection('galAlbum',$c);
+if(($parent != '') && ($subchilds == true)){
+ $album = $modx->getObject('galAlbum',(int)$parent);
+ if($album != null){
+ $albumsWithSubs = array();
+ $gallery = new Gallery($modx);
+ $gallery->getAllChilds($album, $albumsWithSubs, $sort, $dir, -1);
+
+ $albums = $albumsWithSubs;
+ }
+}
+
/* setup thumb properties */
$thumbProperties = array(
'w' => (int)$modx->getOption('thumbWidth',$params,40),
diff --git a/core/components/gallery/lexicon/cs/tvprops.inc.php b/core/components/gallery/lexicon/cs/tvprops.inc.php
index 3e06461..f49f05f 100644
--- a/core/components/gallery/lexicon/cs/tvprops.inc.php
+++ b/core/components/gallery/lexicon/cs/tvprops.inc.php
@@ -99,3 +99,9 @@
// $_lang['galtv.width_desc'] = 'The width of the combobox, in pixels.';
$_lang['galtv.width_desc'] = 'Šířka rozbalovací nabídky v px.';
+
+//$_lang['galtv.subchilds'] = 'Show all of parent sub childs';
+$_lang['galtv.subchilds'] = 'Zobrazit všechny potomky';
+
+//$_lang['galtv.subchilds_desc'] = 'Show all of parent childs and subchilds.';
+$_lang['galtv.subchilds_desc'] = 'Zobrazit všechny potomky od zadaného rodiče.';
\ No newline at end of file
diff --git a/core/components/gallery/lexicon/de/default.inc.php b/core/components/gallery/lexicon/de/default.inc.php
new file mode 100644
index 0000000..a095330
--- /dev/null
+++ b/core/components/gallery/lexicon/de/default.inc.php
@@ -0,0 +1,121 @@
+
+ *
+ * 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
+ */
+/**
+ * Default German Lexicon Entries for Gallery
+ * Translated by Martin Gartner (gadgetto) / bitego.com
+ *
+ * @package gallery
+ * @subpackage lexicon
+ */
+$_lang['gallery'] = 'Galerie';
+$_lang['gallery.active'] = 'Aktiviert';
+$_lang['gallery.active_desc'] = 'Wenn nicht gesetzt, ist dieses Album nicht sichtbar.';
+$_lang['gallery.album'] = 'Album';
+$_lang['gallery.album_create'] = 'Album erstellen';
+$_lang['gallery.album_err_nf'] = 'Album nicht gefunden.';
+$_lang['gallery.album_err_ns'] = 'Album nicht angegeben.';
+$_lang['gallery.album_err_ns_name'] = 'Bitte geben Sie einen gültigen Namen fr dieses Album ein.';
+$_lang['gallery.album_err_remove'] = 'Beim Entfernen dieses Albums ist ein Fehler aufgetreten.';
+$_lang['gallery.album_err_save'] = 'Beim Speichern dieses Albums ist ein Fehler aufgetreten.';
+$_lang['gallery.album_remove'] = 'Album entfernen';
+$_lang['gallery.album_remove_confirm'] = 'Sind Sie sicher, dass Sie dieses Album entfernen möchten? Alle Elemente, die nicht anderen Alben zugeordnet sind, werden ebenfalls entfernt.';
+$_lang['gallery.album_update'] = 'Album bearbeiten';
+$_lang['gallery.albums'] = 'Alben';
+$_lang['gallery.back'] = 'Zurück';
+$_lang['gallery.batch_upload'] = 'Batch Upload';
+$_lang['gallery.batch_upload_intro'] = 'Geben Sie ein Verzeichnis im Dateisystem an, das nach Bildern durchsucht werden soll. Sie koennen {base_path}, {core_path}, oder {assets_path} als Platzhalter einsetzen.';
+$_lang['gallery.batch_upload_tags'] = 'Tags die jedem Element bei einem Batch-Upload zugeordnet werden sollen (kommaseparierte Liste).';
+$_lang['gallery.bytes'] = 'Bytes';
+$_lang['gallery.comma_separated_list'] = 'Kommaseparierte Liste';
+$_lang['gallery.clearsuccessful'] = 'Erfolgreiche Uploads aufräumen';
+$_lang['gallery.clearfailure'] = 'Fehlgeschlagene Uploads aufräumen';
+$_lang['gallery.directory'] = 'Verzeichnis';
+$_lang['gallery.directory_desc'] = 'Verzeichnis, das nach Bilder durchsucht werden soll.';
+$_lang['gallery.directory_err_create'] = 'Verzeichnis kann nicht erstellt werden: [[+directory]]';
+$_lang['gallery.directory_err_nf'] = 'Verzeichnis nicht gefunden.';
+$_lang['gallery.directory_err_ns'] = 'Verzeichnis nicht angegeben.';
+$_lang['gallery.directory_err_write'] = 'Im Verzeichnis kann nicht geschrieben werden: [[+directory]]';
+$_lang['gallery.file'] = 'Datei';
+$_lang['gallery.file_err_move'] = 'Beim Verschieben der Datei ist ein Fehler aufgetreten: [[+file]] nach [[+target]]';
+$_lang['gallery.file_name'] = 'Dateiname';
+$_lang['gallery.file_size'] = 'Dateigröße';
+$_lang['gallery.height'] = 'Höhe';
+$_lang['gallery.images_selected'] = '[[+count]] Bilder ausgewählt.';
+$_lang['gallery.inactive'] = 'Deaktiviert';
+$_lang['gallery.intro_msg'] = 'Hier können Sie Ihre Alben verwalten. Rechtsklick auf ein Album für weitere Optionen.';
+$_lang['gallery.item_active_desc'] = 'Deaktivierte Elemente werden nicht in oeffentlichen Alben angezeigt.';
+$_lang['gallery.item_delete'] = 'Element löschen';
+$_lang['gallery.item_delete_confirm'] = 'Sind Sie sicher, dass Sie dieses Element entgültig entfernen möchten? Dies kann nicht rückgängig gemacht werden!';
+$_lang['gallery.item_delete_multiple'] = 'Ausgewählte Elemente löschen';
+$_lang['gallery.item_delete_multiple_confirm'] = 'Sind Sie sicher, dass Sie die ausgewählten Elemente entgültig entfernen möchten? Dies kann nicht rückgängig gemacht werden!';
+$_lang['gallery.item_err_nf'] = 'Element nicht gefunden.';
+$_lang['gallery.item_err_ns'] = 'Element nicht angegeben.';
+$_lang['gallery.item_err_ns_file'] = 'Bitte geben Sie eine Datei zum Hochladen an.';
+$_lang['gallery.item_err_remove'] = 'Beim Entfernen der Datei ist ein Fehler aufgetreten.';
+$_lang['gallery.item_err_save'] = 'Beim Speichern der Datei ist ein Fehler aufgetreten.';
+$_lang['gallery.item_err_upload'] = 'Beim Hochladen der Datei ist ein Fehler aufgetreten.';
+$_lang['gallery.item_remove'] = 'Element entfernen';
+$_lang['gallery.item_remove_album'] = 'Element aus Album entfernen';
+$_lang['gallery.item_update'] = 'Element bearbeiten';
+$_lang['gallery.item_upload'] = 'Element hochladen';
+$_lang['gallery.item_upload_file_desc'] = 'Bild-Datei die hochgeladen werden soll.';
+$_lang['gallery.item_url'] = 'URL';
+$_lang['gallery.item_url_desc'] = 'URL zu der der Benutzer weitergeleitet wird, wenn dieses Galerie Element angeklickt wird.';
+$_lang['gallery.items'] = 'Elemente';
+$_lang['gallery.loading_ellipsis'] = 'Wird geladen...';
+$_lang['gallery.menu_desc'] = 'Ein dynamisches Bildergalerie System.';
+$_lang['gallery.multi_item_upload'] = 'Multi-Upload';
+$_lang['gallery.parent'] = 'Übergeordnet';
+$_lang['gallery.prominent'] = 'Prominent';
+$_lang['gallery.prominent_desc'] = 'Wenn deaktiviert, wird das Album in allen Albenlisten verteckt. Dies kann verwendet werden, um private, oder nicht gelistete Alben zu erstellen.';
+$_lang['gallery.refresh'] = 'Aktualisieren';
+$_lang['gallery.tags'] = 'Tags';
+$_lang['gallery.title'] = 'Titel';
+$_lang['gallery.upload'] = 'Upload';
+$_lang['gallery.width'] = 'Breite';
+$_lang['gallery.xpdozip_err_nf'] = 'Klasse xPDOZip konnte nicht geladen werden.';
+$_lang['gallery.zip_err_ns'] = 'Bitte geben Sie eine ZIP Datei an.';
+$_lang['gallery.zip_err_unpack'] = 'ZIP Datei konnte nicht entpackt werden. Bitte stellen Sie sicher, dass die Datei nicht beschdigt, und der Galerie-Pfad korrekt ist.';
+$_lang['gallery.zip_file'] = 'Zip Datei';
+$_lang['gallery.zip_upload'] = 'Zip Upload';
+$_lang['gallery.zip_upload_intro'] = 'Geben Sie eine ZIP Datei an die Bilder enthaelt. Die Datei wird automatisch entpackt und die Bilder in das Album uebertragen.';
+
+
+$_lang['area_backend'] = 'Backend';
+
+$_lang['setting_gallery.backend_thumb_far'] = 'Backend Thumbnail Seitenverhältnis';
+$_lang['setting_gallery.backend_thumb_far_desc'] = 'phpThumb FAR (Seitenverhältnis) Einstellung für Thumbnails bei Verwaltung im Backend.';
+
+$_lang['setting_gallery.backend_thumb_height'] = 'Backend Thumbnail Höhe';
+$_lang['setting_gallery.backend_thumb_height_desc'] = 'Höhe der Thumbnails in Pixel - bei Verwaltung im Backend.';
+
+$_lang['setting_gallery.backend_thumb_width'] = 'Backend Thumbnail Breite';
+$_lang['setting_gallery.backend_thumb_width_desc'] = 'Breite der Thumbnails in Pixel - bei Verwaltung im Backend.';
+
+$_lang['setting_gallery.backend_thumb_zoomcrop'] = 'Backend Thumbnail Zoom/Crop';
+$_lang['setting_gallery.backend_thumb_zoomcrop_desc'] = 'Soll Zoom/Crop für Thumbnails verwendet werden - bei Verwaltung im Backend.';
+
+$_lang['setting_gallery.default_batch_upload_path'] = 'Standard Batch Upload Pfad';
+$_lang['setting_gallery.default_batch_upload_path_desc'] = 'Standard Pfad der für einen Batch-Upload verwendet werden soll.';
+
+$_lang['setting_gallery.thumbs_prepend_site_url'] = 'Thumbnails Site URL voranstellen';
+$_lang['setting_gallery.thumbs_prepend_site_url_desc'] = 'Wenn TRUE, wird die Site URL allen Thumbnails vorangestellt die an phpThumb gesendet werden.';
\ No newline at end of file
diff --git a/core/components/gallery/lexicon/de/galleriffic.inc.php b/core/components/gallery/lexicon/de/galleriffic.inc.php
new file mode 100644
index 0000000..bba0da6
--- /dev/null
+++ b/core/components/gallery/lexicon/de/galleriffic.inc.php
@@ -0,0 +1,37 @@
+
+ *
+ * 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
+ */
+/**
+ * German Lexicon Entries for Galleriffic plugin
+ * Translated by Martin Gartner (gadgetto) / bitego.com
+ *
+ * @package gallery
+ * @subpackage galleriffic
+ */
+$_lang['gallery.download_original'] = 'Original herunterladen';
+$_lang['gallery.photo_next'] = 'Nächstes Foto';
+$_lang['gallery.photo_previous'] = 'Vorheriges Foto';
+$_lang['gallery.next'] = 'Nächstes';
+$_lang['gallery.prev'] = 'Vorheriges';
+$_lang['gallery.slideshow_pause'] = 'Slideshow anhalten';
+$_lang['gallery.slideshow_play'] = 'Slideshow starten';
+$_lang['gallery.tags'] = 'Tags';
+
diff --git a/core/components/gallery/lexicon/de/properties.inc.php b/core/components/gallery/lexicon/de/properties.inc.php
new file mode 100644
index 0000000..d57e55b
--- /dev/null
+++ b/core/components/gallery/lexicon/de/properties.inc.php
@@ -0,0 +1,111 @@
+
+ *
+ * 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
+ */
+/**
+ * German Lexicon Entries
+ * Translated by Martin Gartner (gadgetto) / bitego.com
+ *
+ * @var array $_lang
+ * @package gallery
+ * @subpackage lexicon
+ */
+/* Gallery Snippet */
+$_lang['gallery.activecls_desc'] = 'The CSS class to add when the active item (the item specified in the GalleryItem snippet) is displayed.';
+$_lang['gallery.album_desc'] = 'Will load only items from this album. Can be either the name or ID of the Album.';
+$_lang['gallery.albumrequestvar_desc'] = 'If checkForRequestAlbumVar is set to true, will look for a REQUEST var with this name to select the album.';
+$_lang['gallery.checkforrequestalbumvar_desc'] = 'If 1, if a REQUEST var of "album" is found, will use that as the album property for the snippet.';
+$_lang['gallery.checkforrequesttagvar_desc'] = 'If 1, if a REQUEST var of "tag" is found, will use that as the tag property for the snippet.';
+$_lang['gallery.containertpl_desc'] = 'An optional chunk to wrap the output in.';
+$_lang['gallery.dir_desc'] = 'The direction to sort images by.';
+$_lang['gallery.imagefar_desc'] = 'The "far" value for phpThumb for the image, for aspect ratio zooming.';
+$_lang['gallery.imageheight_desc'] = 'If being used by a plugin, the height of the currently on-display image.';
+$_lang['gallery.imagegetparam_desc'] = 'The GET param to use when not linking directly to an image. Make sure this matches the getParam property in the GalleryItem snippet call.';
+$_lang['gallery.imageproperties_desc'] = 'A JSON object of parameters to pass to phpThumb as properties for the image.';
+$_lang['gallery.imagequality_desc'] = 'The "q" value for phpThumb for the image, for quality.';
+$_lang['gallery.imagewidth_desc'] = 'If being used by a plugin, the width of the currently on-display image.';
+$_lang['gallery.imagezoomcrop_desc'] = 'If being used by a plugin, whether or not the currently on-display image will be zoom-cropped.';
+$_lang['gallery.itemcls_desc'] = 'The CSS class for each thumbnail.';
+$_lang['gallery.limit_desc'] = 'If set to non-zero, will only show X number of items.';
+$_lang['gallery.linktoimage_desc'] = 'If true, will link directly to the image. If false, will append GET parameters to the URL to load the image with the GalleryItem snippet.';
+$_lang['gallery.plugin_desc'] = 'The name of a plugin to use for front-end displaying. Please see the official docs for a list of available plugins.';
+$_lang['gallery.pluginpath_desc'] = 'Could not load plugin "[[+name]]" from path: [[+path]]';
+$_lang['gallery.showinactive_desc'] = 'If 1, will also display inactive images.';
+$_lang['gallery.sort_desc'] = 'The field to sort images by.';
+$_lang['gallery.start_desc'] = 'The index to start grabbing from when limiting the number of items. Similar to an SQL order by start clause.';
+$_lang['gallery.tag_desc'] = 'Will load only items with this tag.';
+$_lang['gallery.tagrequestvar_desc'] = 'If checkForRequestTagVar is set to true, will look for a REQUEST var with this name to select the tag.';
+$_lang['gallery.toplaceholder_desc'] = 'If set, will set the output to a placeholder of this value, and the snippet call will output nothing.';
+$_lang['gallery.thumbfar_desc'] = 'The "far" value for phpThumb for the thumbnail, for aspect ratio zooming.';
+$_lang['gallery.thumbheight_desc'] = 'The height of the generated thumbnails, in pixels.';
+$_lang['gallery.thumbproperties_desc'] = 'A JSON object of parameters to pass to phpThumb as properties for the thumbnail.';
+$_lang['gallery.thumbquality_desc'] = 'The "q" value for phpThumb for the thumbnail, for quality.';
+$_lang['gallery.thumbtpl_desc'] = 'The Chunk to use as a tpl for each thumbnail.';
+$_lang['gallery.thumbwidth_desc'] = 'The width of the generated thumbnails, in pixels.';
+$_lang['gallery.thumbzoomcrop_desc'] = 'Whether or not the thumbnail will be zoom-cropped.';
+$_lang['gallery.usecss_desc'] = 'Whether or not to use the pre-provided CSS for the snippet.';
+
+/* GalleryAlbums Snippet */
+$_lang['galleryalbums.albumrequestvar_desc'] = 'If checkForRequestAlbumVar is set to true, will look for a REQUEST var with this name to select the album.';
+$_lang['galleryalbums.albumcoversort_desc'] = 'The field which to use when sorting to get the Album Cover. To get the first image, use "rank". To get a random image, use "random".';
+$_lang['galleryalbums.albumcoversortdir_desc'] = 'The direction to use when sorting to get the Album Cover. Accepts "ASC" or "DESC".';
+$_lang['galleryalbums.dir_desc'] = 'The direction to sort the results by.';
+$_lang['galleryalbums.limit_desc'] = 'If set to non-zero, will limit the number of results returned.';
+$_lang['galleryalbums.parent_desc'] = 'Grab only the albums with a parent album with this ID.';
+$_lang['galleryalbums.prominentonly_desc'] = 'If 1, will only display albums marked with a "prominent" status.';
+$_lang['galleryalbums.rowcls_desc'] = 'A CSS class to be added to each album row.';
+$_lang['galleryalbums.rowtpl_desc'] = 'The Chunk to use for each album row.';
+$_lang['galleryalbums.showall_desc'] = 'If 1, will show all albums regardless of their parent.';
+$_lang['galleryalbums.showinactive_desc'] = 'If 1, will show inactive galleries as well.';
+$_lang['galleryalbums.showall_desc'] = 'If 0, will hide the album name in the album row tpl.';
+$_lang['galleryalbums.start_desc'] = 'The index to start from in the results.';
+$_lang['galleryalbums.sort_desc'] = 'The field to sort the results by.';
+$_lang['galleryalbums.thumbfar_desc'] = 'The "far" value for phpThumb for the album cover thumbnail, for aspect ratio zooming.';
+$_lang['galleryalbums.thumbheight_desc'] = 'The height of the generated album cover thumbnail, in pixels.';
+$_lang['galleryalbums.thumbproperties_desc'] = 'A JSON object of parameters to pass to phpThumb as properties for the album thumbnail.';
+$_lang['galleryalbums.thumbquality_desc'] = 'The "q" value for phpThumb for the album cover thumbnail, for quality.';
+$_lang['galleryalbums.thumbwidth_desc'] = 'The width of the generated album cover thumbnail, in pixels.';
+$_lang['galleryalbums.thumbzoomcrop_desc'] = 'Whether or not the album coverthumbnail will be zoom-cropped.';
+$_lang['galleryalbums.toplaceholder_desc'] = 'If not empty, will set the output to a placeholder with this value.';
+
+/* GalleryItem Snippet */
+$_lang['galleryitem.albumrequestvar_desc'] = 'The REQUEST var to use when linking albums.';
+$_lang['galleryitem.albumseparator_desc'] = 'A string separator for each album listed for the Item.';
+$_lang['galleryitem.albumtpl_desc'] = 'Name of a chunk to use for each album that is listed for the Item.';
+$_lang['galleryitem.id_desc'] = 'The ID of the item to display.';
+$_lang['galleryitem.imagefar_desc'] = 'The "far" value for phpThumb for the image, for aspect ratio zooming.';
+$_lang['galleryitem.imageheight_desc'] = 'If being used by a plugin, the max height of the generated image.';
+$_lang['galleryitem.imageproperties_desc'] = 'A JSON object of parameters to pass to phpThumb as properties for the generated image.';
+$_lang['galleryitem.imagequality_desc'] = 'The "q" value for phpThumb for the image, for quality.';
+$_lang['galleryitem.imagewidth_desc'] = 'If being used by a plugin, the max width of the generated image.';
+$_lang['galleryitem.imagezoomcrop_desc'] = 'Whether or not to use zoom cropping for the image.';
+$_lang['galleryitem.tagrequestvar_desc'] = 'The REQUEST var to use when linking tags.';
+$_lang['galleryitem.tagseparator_desc'] = 'A string separator for each tag listed for the Item.';
+$_lang['galleryitem.tagsortdir_desc'] = 'A the direction to sort the tags listed for the Item.';
+$_lang['galleryitem.tagtpl_desc'] = 'Name of a chunk to use for each tag that is listed for the Item.';
+$_lang['galleryitem.toplaceholders_desc'] = 'If true, will set the properties of the Item to placeholders. If false, will use the tpl property to output a chunk.';
+$_lang['galleryitem.toplaceholdersprefix_desc'] = 'Optional. The prefix to add to placeholders set by this snippet. Only works if toPlaceholders is true.';
+$_lang['galleryitem.tpl_desc'] = 'Name of a chunk to use when toPlaceholders is set to false.';
+$_lang['galleryitem.thumbfar_desc'] = 'The "far" value for phpThumb for the thumbnail, for aspect ratio zooming.';
+$_lang['galleryitem.thumbheight_desc'] = 'The max height of the generated thumbnail, in pixels.';
+$_lang['galleryitem.thumbproperties_desc'] = 'A JSON object of parameters to pass to phpThumb as properties for the thumbnail.';
+$_lang['galleryitem.thumbquality_desc'] = 'The "q" value for phpThumb for the thumbnail, for quality.';
+$_lang['galleryitem.thumbwidth_desc'] = 'The max width of the generated thumbnail, in pixels.';
+$_lang['galleryitem.thumbzoomcrop_desc'] = 'Whether or not to use zoom cropping for the thumbnail.';
diff --git a/core/components/gallery/lexicon/de/slimbox.inc.php b/core/components/gallery/lexicon/de/slimbox.inc.php
new file mode 100644
index 0000000..267e2b6
--- /dev/null
+++ b/core/components/gallery/lexicon/de/slimbox.inc.php
@@ -0,0 +1,25 @@
+
+ *
+ * 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
+ */
+/**
+ * @package gallery
+ * @subpackage slimbox
+ */
diff --git a/core/components/gallery/lexicon/de/source.inc.php b/core/components/gallery/lexicon/de/source.inc.php
new file mode 100644
index 0000000..28e9d59
--- /dev/null
+++ b/core/components/gallery/lexicon/de/source.inc.php
@@ -0,0 +1,31 @@
+
+ *
+ * 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
+ */
+/**
+ * Media Source German Lexicon Entries for Gallery
+ * Translated by Martin Gartner (gadgetto) / bitego.com
+ *
+ * @var array $_lang
+ * @package gallery
+ * @subpackage lexicon
+ */
+$_lang['gallery.source_name'] = 'Galerie Alben';
+$_lang['gallery.source_desc'] = 'Eine Dateisystem-basierte Quelle, die Zugriff auf Ihre Galerie-Bilder am Server ermöglicht.';
\ No newline at end of file
diff --git a/core/components/gallery/lexicon/de/tv.inc.php b/core/components/gallery/lexicon/de/tv.inc.php
new file mode 100644
index 0000000..138b391
--- /dev/null
+++ b/core/components/gallery/lexicon/de/tv.inc.php
@@ -0,0 +1,65 @@
+
+ *
+ * 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
+ */
+/**
+ * Custom TV German Lexicon Entries for Gallery
+ * Translated by Martin Gartner (gadgetto) / bitego.com
+ *
+ * @package gallery
+ * @subpackage lexicon
+ */
+$_lang['gallery.active'] = 'Aktiviert';
+$_lang['gallery.alt_text'] = 'alt Text';
+$_lang['gallery.browser'] = 'Galerie Browser';
+$_lang['gallery.choose_item'] = 'Bild wählen';
+$_lang['gallery.class'] = 'CSS Klassen';
+$_lang['gallery.clear_image'] = 'Bild leeren';
+$_lang['gallery.crop_bottom'] = 'Unten';
+$_lang['gallery.crop_enable'] = 'Beschneiden aktivieren';
+$_lang['gallery.crop_left'] = 'Links';
+$_lang['gallery.crop_right'] = 'Rechts';
+$_lang['gallery.crop_top'] = 'Oben';
+$_lang['gallery.file_name'] = 'Dateiname';
+$_lang['gallery.file_size'] = 'Dateigröße';
+$_lang['gallery.height'] = 'Höhe';
+$_lang['gallery.inactive'] = 'Deaktivert';
+$_lang['gallery.other_opt'] = 'Weitere phpThumb Optionen';
+$_lang['gallery.other_opt_desc'] = 'Alle weiteren phpThumb Parameter die übergeben werden sollen. Bitte verwenden Sie das URL Format.';
+$_lang['gallery.pos_b'] = 'Unten';
+$_lang['gallery.pos_bl'] = 'Links unten';
+$_lang['gallery.pos_br'] = 'Rechts unten';
+$_lang['gallery.pos_c'] = 'Zentriert';
+$_lang['gallery.pos_l'] = 'Links';
+$_lang['gallery.pos_r'] = 'Rechts';
+$_lang['gallery.pos_t'] = 'Oben';
+$_lang['gallery.pos_tr'] = 'Rechts oben';
+$_lang['gallery.pos_tl'] = 'Links oben';
+$_lang['gallery.resize'] = 'Bildgroesse';
+$_lang['gallery.rotate'] = 'Drehen';
+$_lang['gallery.tags'] = 'Tags';
+$_lang['gallery.title'] = 'Titel';
+$_lang['gallery.watermark_options'] = 'Wasserzeichen Optionen';
+$_lang['gallery.watermark_options_desc'] = 'Hinweis: Diese Optionen können nicht im Vorschau-Modus angezeigt werden.';
+$_lang['gallery.watermark_text'] = 'Wasserzeichen Text';
+$_lang['gallery.watermark_text_desc'] = 'Text der als Wasserzeichen im Bild eingefügt wird.';
+$_lang['gallery.watermark_text_position'] = 'Wasserzeichen Text Position';
+$_lang['gallery.watermark_text_position_desc'] = 'Position des Textes der als Wasserzeichen eingefügt wird.';
+$_lang['gallery.width'] = 'Breite';
diff --git a/core/components/gallery/lexicon/de/tvprops.inc.php b/core/components/gallery/lexicon/de/tvprops.inc.php
new file mode 100644
index 0000000..4bcc527
--- /dev/null
+++ b/core/components/gallery/lexicon/de/tvprops.inc.php
@@ -0,0 +1,52 @@
+
+ *
+ * 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
+ */
+/**
+ * Custom TV German Lexicon Entries for Gallery TVs
+ * Translated by Martin Gartner (gadgetto) / bitego.com
+ *
+ * @package gallery
+ * @subpackage lexicon
+ */
+$_lang['galtv.ascending'] = 'Aufsteigend';
+$_lang['galtv.descending'] = 'Absteigend';
+$_lang['galtv.limit'] = 'Limit';
+$_lang['galtv.limit_desc'] = 'Maximale Anzahl der Galerie Alben. Auf 0 setzen um alle anzuzeigen.';
+$_lang['galtv.listwidth'] = 'Dropdown Breite';
+$_lang['galtv.listwidth_desc'] = 'Breite der Dropdown Liste in Pixel.';
+$_lang['galtv.maxheight'] = 'Maximale Dropdown Höhe';
+$_lang['galtv.maxheight_desc'] = 'Maximale Höhe der Dropdown Liste.';
+$_lang['galtv.name'] = 'Name';
+$_lang['galtv.parent'] = 'Übergeordnetes Album (ID)';
+$_lang['galtv.parent_desc'] = 'Wenn gesetzt, werden nur Alben angezeigt, die Unter-Alben der angeführten ID sind. (Leer lassen, um alle anzuzeigen. Auf 0 setzen, um nur Top-Level Alben anzuzeigen).';
+$_lang['galtv.rank'] = 'Rang';
+$_lang['galtv.showcover'] = 'Cover anzeigen';
+$_lang['galtv.showcover_desc'] = 'Ein Thumbnail des Covers bei jedem Album anzeigen.';
+$_lang['galtv.shownone'] = 'Option "Keine" anzeigen';
+$_lang['galtv.shownone_desc'] = 'Die Option "Keine" anzeigen, die für einen leeren Wert ausgewählt werden kann.';
+$_lang['galtv.sort'] = 'Sortieren nach';
+$_lang['galtv.sort_desc'] = 'Das Feld, nach dem die Alben sortiert werden.';
+$_lang['galtv.sortdir'] = 'Sortier-Richtung';
+$_lang['galtv.sortdir_desc'] = 'Die Richtung, nach der die Alben sortiert werden.';
+$_lang['galtv.start'] = 'Start Index';
+$_lang['galtv.start_desc'] = 'Wenn das Limit größer als 0 ist, wird bei diesem Index begonnen.';
+$_lang['galtv.width'] = 'Breite';
+$_lang['galtv.width_desc'] = 'Breite der Combobox, in Pixel.';
\ No newline at end of file
diff --git a/core/components/gallery/lexicon/de/web.inc.php b/core/components/gallery/lexicon/de/web.inc.php
new file mode 100644
index 0000000..b02f5f0
--- /dev/null
+++ b/core/components/gallery/lexicon/de/web.inc.php
@@ -0,0 +1,29 @@
+
+ *
+ * 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
+ */
+/**
+ * German Lexicon Entries
+ * Translated by Martin Gartner (gadgetto) / bitego.com
+ *
+ * @package gallery
+ * @subpackage lexicon
+ */
+$_lang['gallery.plugin_err_load'] = 'Laden des Plugins "[[+name]]" von Pfad: [[+path]] fehlgeschlagen.';
\ No newline at end of file
diff --git a/core/components/gallery/lexicon/en/default.inc.php b/core/components/gallery/lexicon/en/default.inc.php
index ead56f2..cd7a651 100644
--- a/core/components/gallery/lexicon/en/default.inc.php
+++ b/core/components/gallery/lexicon/en/default.inc.php
@@ -26,6 +26,7 @@
* @subpackage lexicon
*/
$_lang['gallery'] = 'Gallery';
+$_lang['gallery.year'] = 'Year';
$_lang['gallery.active'] = 'Active';
$_lang['gallery.active_desc'] = 'If unchecked, this album will not be viewable.';
$_lang['gallery.album'] = 'Album';
@@ -47,6 +48,8 @@
$_lang['gallery.comma_separated_list'] = 'Comma-separated list';
$_lang['gallery.clearsuccessful'] = 'Clear Successful Uploads';
$_lang['gallery.clearfailure'] = 'Clear Failed Uploads';
+$_lang['gallery.cover_filename'] = 'Album cover';
+$_lang['gallery.delete_cover'] = 'Delete cover';
$_lang['gallery.directory'] = 'Directory';
$_lang['gallery.directory_desc'] = 'The directory to scan for images.';
$_lang['gallery.directory_err_create'] = 'Could not create directory: [[+directory]]';
@@ -87,9 +90,12 @@
$_lang['gallery.prominent'] = 'Prominent';
$_lang['gallery.prominent_desc'] = 'Making an Album non-prominent can be used to hide Albums from your Album listing, should you want a private album, or to create non-listed albums.';
$_lang['gallery.refresh'] = 'Refresh';
+$_lang['gallery.set_as_cover'] = 'Make as album cover';
$_lang['gallery.tags'] = 'Tags';
$_lang['gallery.title'] = 'Title';
$_lang['gallery.upload'] = 'Upload';
+$_lang['gallery.upload_cover'] = 'Upload cover';
+$_lang['gallery.view_cover'] = 'View cover';
$_lang['gallery.width'] = 'Width';
$_lang['gallery.xpdozip_err_nf'] = 'Could not load xPDOZip class.';
$_lang['gallery.zip_err_ns'] = 'Please specify a zip file.';
@@ -117,4 +123,4 @@
$_lang['setting_gallery.default_batch_upload_path_desc'] = 'The default value to use for the path when using batch upload.';
$_lang['setting_gallery.thumbs_prepend_site_url'] = 'Prepend Site URL to Thumbs';
-$_lang['setting_gallery.thumbs_prepend_site_url_desc'] = 'If true, will prepend the site URL to all thumbnails being sent to phpThumb.';
\ No newline at end of file
+$_lang['setting_gallery.thumbs_prepend_site_url_desc'] = 'If true, will prepend the site URL to all thumbnails being sent to phpThumb.';
diff --git a/core/components/gallery/lexicon/en/tvprops.inc.php b/core/components/gallery/lexicon/en/tvprops.inc.php
index 10669ac..866e71f 100644
--- a/core/components/gallery/lexicon/en/tvprops.inc.php
+++ b/core/components/gallery/lexicon/en/tvprops.inc.php
@@ -48,4 +48,6 @@
$_lang['galtv.start'] = 'Start Index';
$_lang['galtv.start_desc'] = 'If limit is greater than 0, will start at this index.';
$_lang['galtv.width'] = 'Width';
-$_lang['galtv.width_desc'] = 'The width of the combobox, in pixels.';
\ No newline at end of file
+$_lang['galtv.width_desc'] = 'The width of the combobox, in pixels.';
+$_lang['galtv.subchilds'] = 'Show all of parent sub childs';
+$_lang['galtv.subchilds_desc'] = 'Show all of parent childs and subchilds.';
\ No newline at end of file
diff --git a/core/components/gallery/lexicon/ru/default.inc.php b/core/components/gallery/lexicon/ru/default.inc.php
index adf3616..7dbca48 100644
--- a/core/components/gallery/lexicon/ru/default.inc.php
+++ b/core/components/gallery/lexicon/ru/default.inc.php
@@ -45,6 +45,7 @@
$_lang['gallery.batch_upload_tags'] = 'Метки которые будут назначенны всем элементам при пакетной загрузке, в виде списка разделённого запятыми.';
$_lang['gallery.bytes'] = 'bytes';
$_lang['gallery.comma_separated_list'] = 'Список меток разделённый запятыми.';
+$_lang['gallery.cover_filename'] = 'Обложка альбома';
$_lang['gallery.directory'] = 'Каталог';
$_lang['gallery.directory_desc'] = 'Каталог для поиска элементов.';
$_lang['gallery.directory_err_nf'] = 'Каталог не найден.';
@@ -79,7 +80,12 @@
$_lang['gallery.tags'] = 'Метки';
$_lang['gallery.title'] = 'Название';
$_lang['gallery.width'] = 'Ширина';
-
+$_lang['gallery.upload_cover'] = 'Загрузить обложку';
+$_lang['gallery.view_cover'] = 'Посмотреть';
+$_lang['gallery.set_as_cover'] = 'Сделать обложкой альбома';
+$_lang['gallery.current_cover'] = 'Текущая обложка альбома';
+$_lang['gallery.cover_upload'] = 'Загрузка обложки';
+$_lang['gallery.delete_cover'] = 'Удалить обложку';
$_lang['area_backend'] = 'Настройки бэкенда Gallery';
diff --git a/core/components/gallery/model/gallery/galalbum.class.php b/core/components/gallery/model/gallery/galalbum.class.php
index 1a78251..f940d97 100644
--- a/core/components/gallery/model/gallery/galalbum.class.php
+++ b/core/components/gallery/model/gallery/galalbum.class.php
@@ -195,39 +195,153 @@ 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;
}
+ public function getCoverUrl() {
+ $value='';
+ if($this->get('cover_filename')!='') {
+ $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';
+ if (empty($format)) $format = array();
+ $format['w']=100;
+ $format['h']=100;
+ $format['zc']=1;
+ $filename = $this->get('cover_filename');
+ $format['src'] = '';
+ if ($this->xpdo->getOption('gallery.thumbs_prepend_site_url',null,false)) {
+ $format['src'] = MODX_URL_SCHEME.$_SERVER['HTTP_HOST'];
+ }
+ $format['src'] .= $this->getFilesUrl($this->xpdo).$filename;
+ $url = $assetsUrl.'&'.http_build_query($format,'','&');
+ if ($this->xpdo->getOption('xhtml_urls',null,false)) {
+ $value = str_replace('&','&',$url);
+ $value = str_replace('&','&',$value);
+ } else {
+ $value = $url;
+ }
+ }
+ return $value;
+ }
+
+ private function cleanCoverCache() {
+ $assetsPath = $this->xpdo->getOption('gallery.assets_path',null,$this->xpdo->getOption('assets_path').'components/gallery/');
+ $cacheDir = $assetsPath.'cache/';
+ $filepath=str_replace(array('/','\\'),'_',$this->getPath()).'cover\.';
+ try {
+ $hDir=opendir($cacheDir);
+ while($file=readdir($hDir)) {
+ if(preg_match('#^'.$filepath.'#i',$file)) {
+ @unlink($cacheDir.$file);
+ }
+ }
+ } catch(Exception $e) {
+ if($hDir)
+ closedir($hDir);
+ echo $e;
+ }
+ }
+
+ public function setCoverFile($item) {
+ $fileName = false;
+ $albumDir = $this->getPath(false);
+ $targetDir = $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;
+ }
+
+ $this->cleanCoverCache();
+
+ if($item instanceof galItem) {
+ /* upload the file */
+ $filePath=$item->getPath();
+ $extension = pathinfo($filePath,PATHINFO_EXTENSION);
+ $shortName = 'cover.'.$extension;
+ $relativePath = $albumDir.$shortName;
+ $absolutePath = $targetDir.$shortName;
+ if (@file_exists($absolutePath)) {
+ @unlink($absolutePath);
+ }
+ if (!@copy($filePath,$absolutePath)) {
+ $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] An error occurred while trying to copy the file: '.$filePath.' to '.$absolutePath);
+ } else {
+ $fileName = str_replace(' ','',$relativePath);
+ }
+ return $fileName;
+ } elseif (is_array($item)) {
+ /* upload the file */
+ $filePath=$item['name'];
+ $extension = pathinfo($filePath,PATHINFO_EXTENSION);
+ $shortName = 'cover.'.$extension;
+ $relativePath = $albumDir.$shortName;
+ $absolutePath = $targetDir.$shortName;
+
+ if (@file_exists($absolutePath)) {
+ @unlink($absolutePath);
+ }
+ if (!@move_uploaded_file($item['tmp_name'],$absolutePath)) {
+ $this->xpdo->log(xPDO::LOG_LEVEL_ERROR,'[Gallery] An error occurred while trying to upload the file: '.$filePath.' to '.$absolutePath);
+ } else {
+ $fileName = str_replace(' ','',$relativePath);
+ }
+ return $fileName;
+ }
+ return false;
+ }
+
+ public function setCoverItem($item) {
+ if($filename=$this->setCoverFile($item)) {
+ $this->set('cover_filename',$filename);
+ return $this->save();
+ }
+ return false;
+ }
+
/**
* Get the cover item
*
@@ -242,33 +356,52 @@ public function getCoverItem($albumCoverSort = 'rank',$albumCoverSortDir = 'ASC'
$cache = $this->xpdo->cacheManager->get($cacheKey);
}
if (!$cache || true) {
- $c = $this->xpdo->newQuery('galItem');
- $c->innerJoin('galAlbumItem','AlbumItems');
- $c->where(array(
- 'AlbumItems.album' => $this->get('id'),
- ));
- $c->sortby($albumCoverSort,$albumCoverSortDir);
- $count = $this->xpdo->getCount('galItem', $c);
- $c->limit(1);
-
- /** @var galItem $item */
- $item = $this->xpdo->getObject('galItem',$c);
- if (empty($item)) {
- $assetsUrl = $this->xpdo->getOption('gallery.assets_url',null,$this->xpdo->getOption('assets_url',null,MODX_ASSETS_URL).'gallery/');
- if (strpos($assetsUrl,'http') === false && defined('MODX_URL_SCHEME') && defined('MODX_HTTP_HOST')) {
- $assetsUrl = MODX_URL_SCHEME.MODX_HTTP_HOST.$assetsUrl;
- }
+ if($this->get('cover_filename')!='') {
+ $c = $this->xpdo->newQuery('galItem');
+ $c->innerJoin('galAlbumItem','AlbumItems');
+ $c->where(array(
+ 'AlbumItems.album' => $this->get('id'),
+ ));
+ $count = $this->xpdo->getCount('galItem', $c);
$item = $this->xpdo->newObject('galItem');
$item->fromArray(array(
- 'name' => '',
- 'filename' => $assetsUrl.'images/album-empty.jpg',
+ 'name' => 'Cover',
+ 'filename' => $this->getFilesUrl($this->xpdo).$this->get('cover_filename'),
'absolute_filename' => true,
'active' => true,
));
- }
- $item->set('total',$count);
- $cache = $item->toArray();
- $this->xpdo->cacheManager->set($cacheKey,$cache);
+ $item->set('total',$count);
+ $cache = $item->toArray();
+ $this->xpdo->cacheManager->set($cacheKey,$cache);
+ } else {
+ $c = $this->xpdo->newQuery('galItem');
+ $c->innerJoin('galAlbumItem','AlbumItems');
+ $c->where(array(
+ 'AlbumItems.album' => $this->get('id'),
+ ));
+ $c->sortby($albumCoverSort,$albumCoverSortDir);
+ $count = $this->xpdo->getCount('galItem', $c);
+ $c->limit(1);
+
+ /** @var galItem $item */
+ $item = $this->xpdo->getObject('galItem',$c);
+ if (empty($item)) {
+ $assetsUrl = $this->xpdo->getOption('gallery.assets_url',null,$this->xpdo->getOption('assets_url',null,MODX_ASSETS_URL).'gallery/');
+ if (strpos($assetsUrl,'http') === false && defined('MODX_URL_SCHEME') && defined('MODX_HTTP_HOST')) {
+ $assetsUrl = MODX_URL_SCHEME.MODX_HTTP_HOST.$assetsUrl;
+ }
+ $item = $this->xpdo->newObject('galItem');
+ $item->fromArray(array(
+ 'name' => '',
+ 'filename' => $assetsUrl.'images/album-empty.jpg',
+ 'absolute_filename' => true,
+ 'active' => true,
+ ));
+ }
+ $item->set('total',$count);
+ $cache = $item->toArray();
+ $this->xpdo->cacheManager->set($cacheKey,$cache);
+ }
} else {
$item = $this->xpdo->newObject('galItem');
$item->fromArray($cache,'',true,true);
@@ -293,6 +426,7 @@ 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);
$showInactive = $modx->getOption('showInactive',$scriptProperties,false);
$prominentOnly = $modx->getOption('prominentOnly',$scriptProperties,true);
@@ -325,14 +459,21 @@ public static function getList(modX &$modx,array $scriptProperties = array()) {
}
$c->sortby($sort,$dir);
if ($limit > 0) { $c->limit($limit,$start); }
- $albums = $modx->getCollection('galAlbum',$c);
+ if (!empty($id)) {
+ $c->where(array(
+ 'id' => $id,
+ ));
+ }
- $cache = array();
- foreach ($albums as $album) {
- $cache[] = $album->toArray('',true);
- }
- $modx->cacheManager->set($cacheKey,$cache);
+ $albums = $modx->getCollection('galAlbum',$c);
+ if($sort !== 'RAND()') {
+ $cache = array();
+ foreach ($albums as $album) {
+ $cache[] = $album->toArray('',true);
+ }
+ $modx->cacheManager->set($cacheKey,$cache);
+ }
}
return $albums;
}
-}
\ No newline at end of file
+}
diff --git a/core/components/gallery/model/gallery/galitem.class.php b/core/components/gallery/model/gallery/galitem.class.php
index 13faf78..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);
@@ -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'],
@@ -264,7 +321,9 @@ public static function getList(modX &$modx,array $scriptProperties = array()) {
$tag = $modx->getOption('tag',$scriptProperties,'');
$limit = $modx->getOption('limit',$scriptProperties,0);
$start = $modx->getOption('start',$scriptProperties,0);
- $sort = $modx->getOption('sort',$scriptProperties,'rank');
+ /* Fix to make it work with getPage which uses "offset" instead of "start" */
+ $offset = $modx->getOption('offset',$scriptProperties,0);
+ if ($offset > 0) { $start = $offset; }
$sortAlias = $modx->getOption('sortAlias',$scriptProperties,'galItem');
if ($sort == 'rank') $sortAlias = 'AlbumItems';
$dir = $modx->getOption('dir',$scriptProperties,'ASC');
@@ -300,6 +359,7 @@ public static function getList(modX &$modx,array $scriptProperties = array()) {
$activeAlbum['id'] = $album->get('id');
$activeAlbum['name'] = $album->get('name');
$activeAlbum['description'] = $album->get('description');
+ $activeAlbum['year'] = $album->get('year');
unset($albumWhere,$albumField);
}
if (!empty($tag)) { /* pull by tag */
diff --git a/core/components/gallery/model/gallery/gallery.class.php b/core/components/gallery/model/gallery/gallery.class.php
index 2d25f4f..62ead5a 100644
--- a/core/components/gallery/model/gallery/gallery.class.php
+++ b/core/components/gallery/model/gallery/gallery.class.php
@@ -355,4 +355,31 @@ protected function endDebugTimer() {
$this->debugTimer = false;
return $totalTime;
}
+
+ /**
+ * Recursion
+ * Return all childs and subchilds for selected album
+ *
+ * @access public
+ * @param GalAlbumItem $album Album for which is selecting childs
+ * @param array $albumsWithSubs Array with results
+ * @param string $sort Element to sort by
+ * @param string $dir Sort direction
+ * @param int $deep Depth of actual album
+ */
+ public function getAllChilds($album, &$albumsWithSubs, $sort, $dir, $deep){
+ $c = $this->modx->newQuery('galAlbum');
+ $c->where(array(
+ 'parent' => $album->get('id'),
+ 'active' => 1,
+ ));
+ $c->sortby($sort,$dir);
+ $album->set('name', str_repeat(' ', ($deep == -1)? 0 : $deep).$album->get('name'));
+ $subAlbums = $this->modx->getCollection('galAlbum',$c);
+
+ foreach($subAlbums as $subAlbum){
+ $albumsWithSubs[] = $subAlbum;
+ $this->getAllChilds($subAlbum, $albumsWithSubs, $sort, $dir, $deep+1);
+ }
+ }
}
\ 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/model/gallery/mysql/galalbum.map.inc.php b/core/components/gallery/model/gallery/mysql/galalbum.map.inc.php
index 0de45fe..be5e898 100644
--- a/core/components/gallery/model/gallery/mysql/galalbum.map.inc.php
+++ b/core/components/gallery/model/gallery/mysql/galalbum.map.inc.php
@@ -11,6 +11,7 @@
array (
'parent' => 0,
'name' => '',
+ 'year' => '',
'description' => NULL,
'createdon' => NULL,
'createdby' => 0,
@@ -18,6 +19,7 @@
'active' => 0,
'prominent' => 0,
'watermark' => '',
+ 'cover_filename' => ''
),
'fieldMeta' =>
array (
@@ -40,6 +42,12 @@
'default' => '',
'index' => 'index',
),
+ 'year' =>
+ array (
+ 'dbtype' => 'varchar',
+ 'precision' => '100',
+ 'phptype' => 'string',
+ ),
'description' =>
array (
'dbtype' => 'text',
@@ -96,6 +104,14 @@
'null' => false,
'default' => '',
),
+ 'cover_filename' =>
+ array (
+ 'dbtype' => 'varchar',
+ 'precision' => '255',
+ 'phptype' => 'string',
+ 'null' => false,
+ 'default' => '',
+ ),
),
'indexes' =>
array (
diff --git a/core/components/gallery/model/schema/gallery.mysql.schema.xml b/core/components/gallery/model/schema/gallery.mysql.schema.xml
index c783cac..5abc72a 100644
--- a/core/components/gallery/model/schema/gallery.mysql.schema.xml
+++ b/core/components/gallery/model/schema/gallery.mysql.schema.xml
@@ -39,13 +39,15 @@
-
\ No newline at end of file
+
diff --git a/core/components/gallery/processors/mgr/album/get.class.php b/core/components/gallery/processors/mgr/album/get.class.php
index da31a98..66ac921 100644
--- a/core/components/gallery/processors/mgr/album/get.class.php
+++ b/core/components/gallery/processors/mgr/album/get.class.php
@@ -27,5 +27,11 @@ class GalleryAlbumGetProcessor extends modObjectGetProcessor {
public $classKey = 'galAlbum';
public $objectType = 'gallery.album';
public $languageTopics = array('gallery:default');
+
+ public function cleanup() {
+ $arResult=$this->object->toArray();
+ $arResult['cover_filename_url']=$this->object->getCoverUrl();
+ return $this->success('',$arResult);
+ }
}
return 'GalleryAlbumGetProcessor';
\ No newline at end of file
diff --git a/core/components/gallery/processors/mgr/album/setcoveritem.class.php b/core/components/gallery/processors/mgr/album/setcoveritem.class.php
new file mode 100644
index 0000000..73eaeff
--- /dev/null
+++ b/core/components/gallery/processors/mgr/album/setcoveritem.class.php
@@ -0,0 +1,69 @@
+
+ *
+ * Copyright 2010-2012 by Shaun McCormick
+ *
+ * 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
+ */
+/**
+ * @var modX $modx
+ *
+ * @package gallery
+ * @subpackage processors
+ */
+class GalleryAlbumSetCoverItemProcessor extends modProcessor {
+ private $albumId;
+ private $itemId;
+ /**
+ * @var galAlbum
+ */
+ private $obAlbum;
+ private $obItem;
+ public $languageTopics = array('gallery:default');
+
+ public function process() {
+ $canSave = $this->beforeSave();
+ if ($canSave !== true) {
+ return $this->failure($canSave);
+ }
+ if($this->obAlbum->setCoverItem($this->obItem)) {
+ $arResult=$this->obAlbum->toArray();
+ $arResult['cover_filename_url']=$this->obAlbum->getCoverUrl();
+ return $this->success('',$arResult);
+ }
+ return $this->failure(false);
+ }
+
+ public function beforeSave() {
+ /* type parsing */
+ $this->albumId = intval($this->getProperty('albumid'));
+ $this->itemId = intval($this->getProperty('id'));
+ $this->obAlbum=$this->modx->getObject('galAlbum',$this->albumId);
+ if($this->obAlbum) {
+ $this->obItem=$this->modx->getObject('galItem',$this->itemId);
+ if(!$this->obItem) {
+ $this->addFieldError('id',$this->modx->lexicon('gallery.item_not_found'));
+ }
+ } else {
+ $this->addFieldError('albumid',$this->modx->lexicon('gallery.album_not_found'));
+ }
+ return !$this->hasErrors();
+ }
+}
+return 'GalleryAlbumSetCoverItemProcessor';
\ No newline at end of file
diff --git a/core/components/gallery/processors/mgr/album/uploadcover.class.php b/core/components/gallery/processors/mgr/album/uploadcover.class.php
new file mode 100644
index 0000000..82f5b08
--- /dev/null
+++ b/core/components/gallery/processors/mgr/album/uploadcover.class.php
@@ -0,0 +1,64 @@
+
+ *
+ * Copyright 2010-2012 by Shaun McCormick
+ *
+ * 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
+ */
+/**
+ * @var modX $modx
+ *
+ * @package gallery
+ * @subpackage processors
+ */
+class GalleryAlbumUploadCoverProcessor extends modProcessor {
+ private $albumId;
+ /**
+ * @var galAlbum
+ */
+ private $obAlbum;
+ public $languageTopics = array('gallery:default');
+
+ public function process() {
+ $canSave = $this->beforeSave();
+ if ($canSave !== true) {
+ return $this->failure($canSave);
+ }
+ if($this->obAlbum->setCoverItem($_FILES['file'])) {
+ $arResult=$this->obAlbum->toArray();
+ $arResult['cover_filename_url']=$this->obAlbum->getCoverUrl();
+ return $this->success('',$arResult);
+ }
+ return $this->failure(false);
+ }
+
+ public function beforeSave() {
+ /* type parsing */
+ $this->albumId = intval($this->getProperty('id'));
+ if (empty($_FILES['file']) || $_FILES['file']['error'] != UPLOAD_ERR_OK) {
+ return $this->failure($this->modx->lexicon('gallery.item_err_ns_file'));
+ }
+ $this->obAlbum=$this->modx->getObject('galAlbum',$this->albumId);
+ if(!$this->obAlbum) {
+ $this->addFieldError('albumid',$this->modx->lexicon('gallery.album_not_found'));
+ }
+ return !$this->hasErrors();
+ }
+}
+return 'GalleryAlbumUploadCoverProcessor';
\ No newline at end of file
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 4b4c3c8..32b7249 100644
--- a/core/components/gallery/processors/mgr/item/batchupload.php
+++ b/core/components/gallery/processors/mgr/item/batchupload.php
@@ -56,32 +56,25 @@
$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');
/* iterate */
$images = array();
$errors = array();
+$files = array();
foreach (new DirectoryIterator($fullpath) as $file) {
if (in_array($file,array('.','..','.svn','_notes'))) continue;
if (!$file->isReadable() || $file->isDir()) continue;
- $fileName = $file->getFilename();
- $filePathName = $file->getPathname();
+ $files[$file->getFilename()] = array(
+ 'pathname' => $file->getPathname()
+ );
+}
+ksort($files);
+foreach ($files as $f_name => $file) {
+ $fileName = $f_name;
+ $filePathName = $file['pathname'];
$fileExtension = pathinfo($filePathName,PATHINFO_EXTENSION);
$fileExtension = $use_multibyte ? mb_strtolower($fileExtension,$encoding) : strtolower($fileExtension);
@@ -101,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,
@@ -149,4 +142,4 @@
}
/* output to browser */
-return $modx->error->success('',$images);
\ No newline at end of file
+return $modx->error->success('',$images);
diff --git a/core/components/gallery/processors/mgr/item/getlist.class.php b/core/components/gallery/processors/mgr/item/getlist.class.php
index 9dc4c7e..b1f3735 100644
--- a/core/components/gallery/processors/mgr/item/getlist.class.php
+++ b/core/components/gallery/processors/mgr/item/getlist.class.php
@@ -62,6 +62,7 @@ public function prepareQueryAfterCount(xPDOQuery $c) {
WHERE Tags.item = galItem.id
) AS tags'
));
+ $c->groupBy('id');
return $c;
}
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/readme.md b/readme.md
index 9be80b4..cda7759 100644
--- a/readme.md
+++ b/readme.md
@@ -2,6 +2,8 @@ Gallery Extra for MODx Revolution
=================================
**Author: Shaun McCormick (http://www.splittingred.com)**
+Gallery is currently maintained at [modxcms/Gallery](http://github.com/modxcms/Gallery). Please [go there](http://github.com/modxcms/Gallery).
+
A Gallery system for your photos. Supports albums, items, tagging, and more.
Also integrates a custom TV for resizing/cropping/editing of a photo before
putting it into a document.
@@ -16,4 +18,5 @@ For setting up the custom TV, create a TV with Input and Output types of
Documentation
=============
Please see the official documentation at:
-http://rtfm.modx.com/display/ADDON/Gallery/
\ No newline at end of file
+http://rtfm.modx.com/extras/revo/gallery
+