Permalink
Browse files

Merge remote-tracking branch 'upstream/develop' into develop

  • Loading branch information...
2 parents e0615f3 + 8aa85cf commit b47c8fc0039b250ad86579abf00c59df629df193 Thomas Dullnig committed May 24, 2012
@@ -22,6 +22,9 @@
/**
* Resolve changes to db model
*
+ * @var xPDOObject $object
+ * @var array $options
+ *
* @package gallery
* @subpackage build
*/
@@ -32,11 +35,29 @@
$modx =& $object->xpdo;
$modelPath = $modx->getOption('gallery.core_path',null,$modx->getOption('core_path').'components/gallery/').'model/';
$modx->addPackage('gallery',$modelPath);
+ $manager = $modx->getManager();
+ $oldLogLevel = $modx->getLogLevel();
+ $modx->setLogLevel(0);
+
+ $manager->addField('galAlbum','parent',array('after' => 'id'));
+ $manager->addIndex('galAlbum','parent');
+ $manager->addField('galItem','url',array('after' => 'mediatype'));
+
+ /* 1.6.0+ */
+ $manager->addField('galItem','slug',array('after' => 'mediatype'));
+ $manager->addIndex('galItem','slug');
+ $manager->addIndex('galItem','name');
+ $manager->addIndex('galItem','active');
+ $manager->addIndex('galItem','mediatype');
+
+ $manager->addIndex('galAlbum','rank');
+ $manager->addIndex('galAlbum','active');
+ $manager->addIndex('galAlbum','prominent');
+
+ $manager->addIndex('galAlbumItem','rank');
- $modx->exec("ALTER TABLE {$modx->getTableName('galAlbum')} ADD `parent` int(10) unsigned NOT NULL default '0' AFTER `id`");
- $modx->exec("ALTER TABLE {$modx->getTableName('galAlbum')} ADD INDEX `parent` (`parent`)");
- $modx->exec("ALTER TABLE {$modx->getTableName('galItem')} ADD `url` TEXT AFTER `mediatype`");
+ $modx->setLogLevel($oldLogLevel);
break;
}
}
@@ -23,12 +23,16 @@ Ext.extend(MODx.DataView.dropZone, Ext.dd.DropZone,{
Ext.fly(target).removeClass('x-view-selected');
}
,onNodeOver : function(target, dd, e, data) {
- return Ext.dd.DropZone.prototype.dropAllowed;
+ return Ext.dd.DropZone.prototype.dropAllowed && (target != data.nodes[0]);
}
,onNodeDrop : function(target, dd, e, data) {
var targetNode = this.view.getRecord(target);
var sourceNode = this.view.getRecord(data.nodes[0]);
+ if (sourceNode == targetNode) { return false; }
+ var targetElement = Ext.get(target);
+ var sourceElement = Ext.get(data.nodes[0]);
+ sourceElement.insertBefore(targetElement);
this.view.fireEvent('sort',{
target: targetNode
,source: sourceNode
@@ -37,11 +37,6 @@ Ext.extend(GAL.view.AlbumItems,MODx.DataView,{
,source: o.source.id
,target: o.target.id
}
- ,listeners: {
- 'success':{fn:function(r) {
- this.run();
- },scope:this}
- }
});
}
@@ -155,10 +155,41 @@ GAL.panel.AlbumItems = function(config) {
,style: 'overflow: auto;'
});
this.view.pagingBar = new Ext.PagingToolbar({
- pageSize: 24
+ pageSize: config.pageSize || (parseInt(MODx.config.default_per_page) || 24)
,store: this.view.store
,displayInfo: true
,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}
+ }
+ }
+ ,'-'
+ ]
});
var dv = this.view;
@@ -231,24 +262,6 @@ GAL.panel.AlbumItems = function(config) {
Ext.extend(GAL.panel.AlbumItems,MODx.Panel,{
windows: {}
- ,handleSort: function(o) {
- var s = this.view.store;
- console.log(o);
- return;
- var origRec = s.getAt(o.sourceId);
- var lastRec = s.getAt(o.targetId);
-
- MODx.Ajax.request({
- url: this.config.url
- ,params: {
- action: 'item/sort'
- ,album: this.config.album
- ,source: o.sourceIndex
- ,target: o.targetIndex
- }
- });
- }
-
,uploadMultiItems: function(btn,e) {
var r = {
album: this.config.album
@@ -1,5 +1,15 @@
Changelog for Gallery.
+Gallery 1.6.0
+====================================
+- [#205] Add per page box to paging bar in album items view
+- [#108] Improve drag/drop reorder of items in manager by supressing refresh
+- [#192] Fix issues with deactivating items, albums
+- [#198] Fix sort of albums due to urldecode issue
+- Better optimization of DB fields
+- [#197], [#188] Fix issues with upload and file names
+- [#208] Prevent sorting in drag/drop when target and source is the same
+
Gallery 1.5.0
====================================
- Gallery 1.5+ only supports MODX 2.2+ and greater
@@ -55,7 +55,7 @@
$_lang['gallery.thumbtpl_desc'] = 'De Chunk om te gebruiken voor de thumbnails.';
$_lang['gallery.thumbwidth_desc'] = 'De breedte van de gegenereerd thumbnails in pixels.';
$_lang['gallery.thumbzoomcrop_desc'] = 'Of de thumbnail wel of niet gebruik moet maken van de zoom-crop functie.';
-$_lang['gallery.usecss_desc'];
+$_lang['gallery.usecss_desc'] = 'Gebruik de bijgevoegde CSS?';
/* GalleryAlbums Snippet */
$_lang['galleryalbums.albumrequestvar_desc'] = 'Als checkForRequestAlbumVar waar is, zal dit zoeken naar een REQUEST variabele met deze naam om het album te selecteren.';
@@ -188,7 +188,7 @@ public function ensurePathExists() {
return $exists;
}
- public function uploadItem($filePath,$name) {
+ public function uploadItem(galItem $item,$filePath,$name) {
$fileName = false;
$albumDir = $this->getPath(false);
@@ -206,7 +206,7 @@ public function uploadItem($filePath,$name) {
/* upload the file */
$extension = pathinfo($name,PATHINFO_EXTENSION);
- $shortName = $this->get('id').'.'.$extension;
+ $shortName = $item->get('id').'.'.$extension;
$relativePath = $albumDir.$shortName;
$absolutePath = $targetDir.$shortName;
@@ -127,7 +127,7 @@ public function upload($file,$albumId) {
$album = $this->xpdo->getObject('galAlbum',$albumId);
if (empty($album)) return false;
- $fileName = $album->uploadItem($file['tmp_name'],$file['name']);
+ $fileName = $album->uploadItem($this,$file['tmp_name'],$file['name']);
if (empty($fileName)) {
return false;
}
@@ -1,6 +1,14 @@
<?php
$xpdo_meta_map = array (
+ 'xPDOSimpleObject' =>
+ array (
+ 0 => 'galItem',
+ 1 => 'galAlbum',
+ 2 => 'galAlbumItem',
+ 3 => 'galAlbumContext',
+ 4 => 'galTag',
+ ),
'modMediaSource' =>
array (
0 => 'GalleryAlbumsMediaSource',
@@ -4,7 +4,9 @@
*/
$xpdo_meta_map['galAlbum']= array (
'package' => 'gallery',
+ 'version' => NULL,
'table' => 'gallery_albums',
+ 'extends' => 'xPDOSimpleObject',
'fields' =>
array (
'parent' => 0,
@@ -95,23 +97,103 @@
'default' => '',
),
),
- 'aggregates' =>
+ 'indexes' =>
array (
- 'Parent' =>
+ 'parent' =>
array (
- 'class' => 'galAlbum',
- 'local' => 'parent',
- 'foreign' => 'id',
- 'cardinality' => 'one',
- 'owner' => 'foreign',
+ 'alias' => 'parent',
+ 'primary' => false,
+ 'unique' => false,
+ 'type' => 'BTREE',
+ 'columns' =>
+ array (
+ 'parent' =>
+ array (
+ 'length' => '',
+ 'collation' => 'A',
+ 'null' => false,
+ ),
+ ),
),
- 'CreatedBy' =>
+ 'name' =>
array (
- 'class' => 'modUser',
- 'local' => 'createdby',
- 'foreign' => 'id',
- 'cardinality' => 'one',
- 'owner' => 'foreign',
+ 'alias' => 'name',
+ 'primary' => false,
+ 'unique' => false,
+ 'type' => 'BTREE',
+ 'columns' =>
+ array (
+ 'name' =>
+ array (
+ 'length' => '',
+ 'collation' => 'A',
+ 'null' => false,
+ ),
+ ),
+ ),
+ 'createdby' =>
+ array (
+ 'alias' => 'createdby',
+ 'primary' => false,
+ 'unique' => false,
+ 'type' => 'BTREE',
+ 'columns' =>
+ array (
+ 'createdby' =>
+ array (
+ 'length' => '',
+ 'collation' => 'A',
+ 'null' => false,
+ ),
+ ),
+ ),
+ 'rank' =>
+ array (
+ 'alias' => 'rank',
+ 'primary' => false,
+ 'unique' => false,
+ 'type' => 'BTREE',
+ 'columns' =>
+ array (
+ 'rank' =>
+ array (
+ 'length' => '',
+ 'collation' => 'A',
+ 'null' => false,
+ ),
+ ),
+ ),
+ 'active' =>
+ array (
+ 'alias' => 'active',
+ 'primary' => false,
+ 'unique' => false,
+ 'type' => 'BTREE',
+ 'columns' =>
+ array (
+ 'active' =>
+ array (
+ 'length' => '',
+ 'collation' => 'A',
+ 'null' => false,
+ ),
+ ),
+ ),
+ 'prominent' =>
+ array (
+ 'alias' => 'prominent',
+ 'primary' => false,
+ 'unique' => false,
+ 'type' => 'BTREE',
+ 'columns' =>
+ array (
+ 'prominent' =>
+ array (
+ 'length' => '',
+ 'collation' => 'A',
+ 'null' => false,
+ ),
+ ),
),
),
'composites' =>
@@ -141,4 +223,23 @@
'owner' => 'local',
),
),
+ 'aggregates' =>
+ array (
+ 'Parent' =>
+ array (
+ 'class' => 'galAlbum',
+ 'local' => 'parent',
+ 'foreign' => 'id',
+ 'cardinality' => 'one',
+ 'owner' => 'foreign',
+ ),
+ 'CreatedBy' =>
+ array (
+ 'class' => 'modUser',
+ 'local' => 'createdby',
+ 'foreign' => 'id',
+ 'cardinality' => 'one',
+ 'owner' => 'foreign',
+ ),
+ ),
);
Oops, something went wrong.

0 comments on commit b47c8fc

Please sign in to comment.