Re: Ctrl-Click in the Organize module

Bharat Mediratta <[email protected]> Thu, 31 Jan 2013 21:53:13 -0800
Newsgroups gmane.comp.web.gallery.devel
Message-ID <CAESa+_mHBMU2XLJZsxLrSNoRwgzK1LgGG2s-hewMRNAnxVC_bQ@mail.gmail.com>
That code is complicated - you have to learn a fair bit about ExtJS in
order to understand it.  It's been a while since I worked on it and I don't
have time to go back and relearn it all right now - but I found this page:
http://www.sencha.com/forum/showthread.php?14469-2.0a1-CLOSED-Using-ctrl-key-for-multiple-select-in-DataView&p=183966&viewfull=1#post183966

it outlines a solution which seems to work - I've pushed a fix, see if that
resolves it for you.

https://sourceforge.net/apps/trac/gallery/ticket/1986



On Sat, Jan 12, 2013 at 9:11 PM, Mike Miller <[email protected]> wrote:

> This is actually almost a word-for-word copy from a forum thread
> (http://gallery.menalto.com/node/110656), but there was no response
> there, and it seems sufficiently technical (and about a core module)
> to be suitable for the development list.
>
> As has been reported in several threads (e.g.,
> http://gallery.menalto.com/node/108422 and
> http://gallery.menalto.com/node/108101), the organize module supports
> shift-clicking to extend the selection, but not ctrl-clicking to add a
> single item.
>
> Having looked at it in Chrome's debugger, I can see exactly why this
> happens, but I'm not sure I know how to fix it.
>
> I added a console.error message to
>
> Ext.DataView = Ext.extend(Ext.BoxComponent, {selectedClass:
> "x-view-selected",emptyText: "",deferEmptyText: true,trackOver:
> false,blockRefresh: false,last: false,initComponent: function() {
>     ...
>     },onItemClick: function(item, index, e) {
>         if (this.fireEvent("beforeclick", this, index, item, e) === false)
> {
>             return false;
>         }
>         if (this.multiSelect) {
> ===>        console.error("doMultiSelection"); <===
>             this.doMultiSelection(item, index, e);
>             e.preventDefault();
>
> I see that this function is called twice on control click with the
> following call stacks (the lines are from the pretty printed version):
>
> doMultiSelection ext-organize-bundle.js:12814
> Ext.DataView.Ext.extend.onItemClick ext-organize-bundle.js:12814
> Ext.DataView.Ext.extend.onClick ext-organize-bundle.js:12772
> v.dragZone.Ext.dd.DragZone.getDragData 8:170
> Ext.extend.handleMouseDown ext-organize-bundle.js:20108
> h ext-organize-bundle.js:4246
>
> And
>
> doMultiSelection ext-organize-bundle.js:12814
> Ext.DataView.Ext.extend.onItemClick ext-organize-bundle.js:12814
> Ext.DataView.Ext.extend.onClick ext-organize-bundle.js:12772
> h ext-organize-bundle.js:4246
>
> The two calls to doMultiSelection contain the following:
>
>     },doMultiSelection: function(item, index, e) {
>         if (e.shiftKey && this.last !== false) {
>             var last = this.last;
>             this.selectRange(last, index, e.ctrlKey);
>             this.last = last;
>         } else {
>             if ((e.ctrlKey || this.simpleSelect) &&
> this.isSelected(index)) {
>                 this.deselect(index);
>             } else {
>                 this.select(index, e.ctrlKey || e.shiftKey ||
> this.simpleSelect);
>             }
>         }
>     },getSelectionCount: function() {
>
> The first one fails the this.isSelected(index) test and calls
> this.select(); the second passes and so it calls this.deselect(). This
> is also clear in the UI, where while holding down the mouse the image
> is highlighted, but once the button is released, the highlight
> disappears.
>
> The second call (which, as noted above, actually occurs after mouse
> up) is due to views/organize_frame.html.php:170, which reads
>
> if (!v.isSelected(target)) {
>     v.onClick(e);
> }
>
> If I comment out the call to v.onClick(e), Ctrl works to highlight
> multiple images!
>
> However, it breaks drag and drop rearranging; I get the following in
> my log file, and the page returns a 500:
>
> 2013-01-08 13:59:54 +02:00 --- error: ORM_Validation_Exception [ 44 ]:
> ORM Validation has failed for items model
> /var/www/testing/gallery3/system/libraries/ORM_Validation_Exception.php [
> 20 ]
> #0 /var/www/testing/gallery3/system/libraries/ORM.php(755):
> ORM_Validation_Exception_Core::handle_validation('items',
> Object(Validation))
> #1
> /var/www/testing/gallery3-contrib/3.0/modules/videos/models/item.php(740):
> ORM_Core->validate(NULL)
> #2 /var/www/testing/gallery3/system/libraries/ORM.php(778):
> Item_Model_Core->validate()
> #3 /var/www/testing/gallery3/modules/gallery/libraries/MY_ORM.php(34):
> ORM_Core->save()
> #4 /var/www/testing/gallery3/modules/gallery/libraries/ORM_MPTT.php(76):
> ORM->save()
> #5
> /var/www/testing/gallery3-contrib/3.0/modules/videos/models/item.php(369):
> ORM_MPTT_Core->save()
> #6
> /var/www/testing/gallery3/modules/organize/controllers/organize.php(163):
> Item_Model_Core->save()
> #7 [internal function]: Organize_Controller->rearrange()
> #8 /var/www/testing/gallery3/system/core/Kohana.php(331):
> ReflectionMethod->invokeArgs(Object(Organize_Controller), Array)
> #9 [internal function]: Kohana_Core::instance(NULL)
> #10 /var/www/testing/gallery3/system/core/Event.php(208):
> call_user_func_array(Array, Array)
> #11 /var/www/testing/gallery3/application/Bootstrap.php(67):
> Event_Core::run('system.execute')
> #12 /var/www/testing/gallery3/index.php(116): require('/var/www/testin...')
> #13 {main}
> 2013-01-08 13:59:54 +02:00 --- error: Validation errors: Array
> (
>     [name] => required
>     [title] => required
>     [type] => invalid
> )
>
> This is as far as I can go right now; I don't really understand why
> this call is there or how the whole drag-and-drop logic fits together.
>
> Thanks
>
> -- Mike Miller
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_123012
> __[ g a l l e r y - d e v e l ]_________________________
>
> [ list info/archive --> http://gallery.sf.net/lists.php ]
> [ gallery info/FAQ/download --> http://gallery.sf.net ]
>
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan

__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]