# New Module: GWT Organise

Glooper

Joined: 2005-09-21
Posts: 225
Posted: Fri, 2009-09-25 04:16

Shipped up all I did yesterday into one easy to install gallery module. It still doesn't run with any theme or anything but at least now it's easier to install and easy to access with the "GWT Organise" menu option.

All you need to do to install is unzip this zip file into your module directory.

Again only works on Firefox and Chrome (kind of works on IE but not well).. and requires the google gears add on.

Right click to see context menus for items and to upload photos, add albums, edit albums etc. Drag and drop photos and albums around to reorganise and if you are in manual mode you can drag and drop to rearrange an album.

Cheers
Ben

Edit: updated to be embeded (cheers rWatcher for your help on that) and added double clicking to view image, and rotating of images.
Edit: updated with security fix
Edit: small fixes on preview

Edit: I've included the original beta 3 version and the new version for the pre RC1 release. This version as well as fixes for the latest code base also include the following:
- Speed improvements due to later version of GWT
- Drag and drop from desktop
- A few other small interface improvements.

Edit: New Version for RC1 (when it's out)
- Dialog Forms will now show validation failures. For instance if you try to add an album with an empty name then you will be asked again.
- Dialog Forms can now have embeded javascript in... for instance the add album dialog will now correctly auto-fill the internet and directory name

Edit: repackaged for RC1. Tested it and it works ok on the RC1 release.

Edit: taken out reliance on google gears. Upload is disabled when no gears is found.

Benjamin Albert Smith - Photography

rWatcher

Joined: 2005-09-06
Posts: 721
Posted: Fri, 2009-09-25 05:21

Cool, that definitely does make it easier to use

Quote:
It still doesn't run with any theme or anything

If you want I can write up some quick theme-integration code for you.

Glooper

Joined: 2005-09-21
Posts: 225
Posted: Fri, 2009-09-25 23:15

Cool.. give it a go ..

Ben

Benjamin Albert Smith - Photography

floridave

Joined: 2003-12-22
Posts: 26666
Posted: Sat, 2009-09-26 04:19

Glooper,
Spectacular job. Keep up the great work.
I don't know much about gears but is seems that it helps out a LOT. A bit slow in some operations but a better UI in other respects.

GWT = ???

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

rWatcher

Joined: 2005-09-06
Posts: 721
Posted: Sat, 2009-09-26 04:51
floridave wrote:
GWT = ???

I'm assuming it means Google Web Toolkit.

Edit:
I've attached a modified version with some basic theme integration. I think the CSS might need to be tweaked a bit, but I can't seem to figure out what parts. Otherwise it should be good.

AttachmentSize
gwtorganise-themeedit.zip330.57 KB

Glooper

Joined: 2005-09-21
Posts: 225
Posted: Sat, 2009-09-26 20:24

@rWatcher
I had to remove the $item from the url in the admin_menu module method in gwtorganise_event to get it working. but yeah the css is all over the place a bit. It was what I was worried about a bit. The google GWT embed a lot of css and they have standard stuff in a directory under gwt/standard. but each time I compile the project it is overwritten. I kinda thought that it wasn't going to be compatible with the yahoo clean slate stuff, and some of the other css in gallery... just had a thought though... might be able to embed it in an iframe.. I'll have a go now @floridave gwt = Google Web Toolkit. It lets you write complex web applications using java.. which it will then compile into Javascript/css for you. Google gears is actually only used for the upload (instead of the flash plugin that gallery3 uses). I could have stuck with the gallery3's flash plugin but gears has a better gwt api and some of the other ideas I have for this module will make use of google gears... namely the drag and drop of image files from your desktop and the creation of thumbnails before uploading begins, just waiting for an update of google gears gwt api to add that functionality. BTW... a potential solution for the IE6 7 8 integration problem that I'm sure all gallery3 developers, module developers and theme developers have had... http://code.google.com/chrome/chromeframe/ Ben Benjamin Albert Smith - Photography Glooper Joined: 2005-09-21 Posts: 225 Posted: Sun, 2009-09-27 23:59 Ok.. got it working well embeded using an inner frame. Here's a new version of it. It runs in the admin theme Also added double click on images to view the resized version and rotating of images. Ben Benjamin Albert Smith - Photography floridave Joined: 2003-12-22 Posts: 26666 Posted: Sun, 2009-09-27 20:48 Glooper, I have created a skeletal codex page: http://codex.gallery2.org/Gallery3:Modules:gwtorganize Feel free to add more flesh or correct any mistakes I have made. Dave _____________________________________________ Blog & G2 || floridave - Gallery Team Glooper Joined: 2005-09-21 Posts: 225 Posted: Sun, 2009-09-27 21:20 Cheers Dave, I fleshed it out a little adding some more functionality and a little bit about how to use it. I'm not sure about how to add this to the contribs github folder though? As the source is Java code so needs compiling and so wont be unzippable straight into your module directory from a fresh download form github like all the other modules there? Ben Benjamin Albert Smith - Photography floridave Joined: 2003-12-22 Posts: 26666 Posted: Sun, 2009-09-27 21:47 I am no git expert. All I can do is point you to some docs: http://codex.gallery2.org/Gallery:Using_Git Perhaps rWatcher can help you out in this regard, he has created a bunch of useful modules as well. Dave _____________________________________________ Blog & G2 || floridave - Gallery Team Glooper Joined: 2005-09-21 Posts: 225 Posted: Sun, 2009-09-27 21:57 I'm fine with using git.. I've got two other previous modules in there that I've done... the problem is that this module isn't built in the same way as all the others in there, it's more of a how do I organise it problem ... Ben Benjamin Albert Smith - Photography talmdal Joined: 2006-12-06 Posts: 358 Posted: Sun, 2009-09-27 22:32 @Glooper: i would just set up a build.sh in the project that build the js http://www.timalmdal.com Glooper Joined: 2005-09-21 Posts: 225 Posted: Sun, 2010-10-10 01:22 A quick update again (sorry!)... fixed a small security problem Benjamin Albert Smith - Photography Glooper Joined: 2005-09-21 Posts: 225 Posted: Mon, 2009-09-28 02:58 Added to github. In the end I just included the eclipse project. I think there are too many external variables to create a build script. Besides I'm on windows here so it's a pain in the arse to create ;)... I did consider writing an ant script... but to be honest I think someone building this project is just as likely/ more likely to have eclipse installed than ant anyway! I sent a pull request so Let me know if it's OK or not. Ben Benjamin Albert Smith - Photography rWatcher Joined: 2005-09-06 Posts: 721 Posted: Mon, 2009-09-28 23:46 Looks good! Glooper wrote: Also added double click on images to view the resized version and rotating of images. One minor issue I found while playing around with the module -- If you double click on the thumbnail for a movie (which doesn't have any kind of resized version), the module gets stuck with that loading.gif file and has no way to cancel out of it (other then reloading the whole page). It might be a good idea to check and make sure the resized file exists before trying to load it. Glooper Joined: 2005-09-21 Posts: 225 Posted: Sun, 2010-10-10 01:52 Fixed on this latest version... Double clicking is now disabled on anything other than photos and albums. Also if a resized version isn't available for some reason then a rather ugly error dialog box appears and the loading stuff disappears. Also fixed a scroll bar that was sometimes appearing when previewing and image. Ben Benjamin Albert Smith - Photography paulmcnelis Joined: 2008-03-26 Posts: 32 Posted: Wed, 2009-09-30 01:18 Does this work in IE without having to installing stuff (Google..whatever)?? Glooper Joined: 2005-09-21 Posts: 225 Posted: Wed, 2009-09-30 01:25 It kinda works on IE..it just doesn't look very good. And I'm afraid it forces you to download google gears to allow for upload and future functionality (except on chrome which has it pre-installed) This module is meant for administrators rather than viewers of you site, which is why I concentrated on getting it good on chrome and firefox.. the assumption is that all administrators will be happy to use Chrome or Firefox Ben Benjamin Albert Smith - Photography paulmcnelis Joined: 2008-03-26 Posts: 32 Posted: Thu, 2009-10-01 02:49 Glooper wrote: It kinda works on IE..it just doesn't look very good. And I'm afraid it forces you to download google gears to allow for upload and future functionality (except on chrome which has it pre-installed) This module is meant for administrators rather than viewers of you site, which is why I concentrated on getting it good on chrome and firefox.. the assumption is that all administrators will be happy to use Chrome or Firefox You should never assume. I use IE and don't want to be bothered with google, chrome, gears, firefox, safari, etc, etc.. Don't understand why you would force someone to install google gears or anything else for that matter. I prefer modules that don't need any 3rd party junk. floridave Joined: 2003-12-22 Posts: 26666 Posted: Thu, 2009-10-01 04:07 paulmcnelis, It is up to the developer to develop what he/she wants and can assume anything she/he wants. I suggest that you don't use a module that does not meet your expectations. You should then develop one for yourself. Perhaps you will get some satisfaction in sharing your work with others. But I suspect you will have some excuse that you can't do this or can't find somebody that can, due to your attitude. Dave _____________________________________________ Blog & G2 || floridave - Gallery Team talmdal Joined: 2006-12-06 Posts: 358 Posted: Thu, 2009-10-01 04:21 @paulmcnelis: I was going to flame you for your last comment and the underlying attitude it exhibits, but I can't be bothered wasting my time. @glooper: haven't had a chance to look at it, but i for one appreciate your effort +++. http://www.timalmdal.com Glooper Joined: 2005-09-21 Posts: 225 Posted: Thu, 2009-10-01 04:37 paulmcnelis wrote: You should never assume. I use IE and don't want to be bothered with google, chrome, gears, firefox, safari, etc, etc.. Don't understand why you would force someone to install google gears or anything else for that matter. I prefer modules that don't need any 3rd party junk. I'm not forcing anyone to do anything.. If you don't want to use this module then don't.. I mainly wrote this module for me not for you ... I just thought it would be nice to share it. As an alternative to this module you can use the Organise, Simple Uploader, and other core functions that are installed as part of g3 and work well with IE and don't require google gears. Ben Benjamin Albert Smith - Photography paulmcnelis Joined: 2008-03-26 Posts: 32 Posted: Sat, 2009-10-03 03:49 This has absolutely nothing to do with how nice it is of Glooper to share this work. Yeah. He's an evil human being for being generous. And flame me? What is that talmdal, a veiled threat? Are we in high school? I don't care if Jesus Christ himself came down on a cloud and shared this module. I'd tell him the same exact thing: why are you sharing a module that doesn't work on IE when IE is the dominant browser (last time I checked)? Not only that, but why are you making assumptions? Don't you know it's wrong to assume anything about anything or anyone? And on what basis are you making the assumption? Do you have access to G3 logistics that show the majority of admins use google chrome and firefox? And floridave: yes, i know the developer can do whatever he or she wants. Obviously. Of course I'm not going to use a module that doesn't do what I want. Does that mean I can't say anything about it? Of course not. I don't like the ipod, but apple can do whatever it wants and force people to use itunes. I don't like that fact, so I won't buy an ipod. Does that mean I can't voice my opinion about it? Of course not. Same scenario here. I'm not going to apologize for not mincing my words. I'm a common sense guy and I'm all about common sense approach and results. You never manage to the exception. And the exception here is google chrome and firefox. floridave Joined: 2003-12-22 Posts: 26666 Posted: Sat, 2009-10-03 04:24 Quote: This has absolutely nothing to do with how nice it is of Glooper to share this work. Then start a new thread so that this thread keeps on topic. Dave _____________________________________________ Blog & G2 || floridave - Gallery Team Glooper Joined: 2005-09-21 Posts: 225 Posted: Sun, 2009-10-04 07:28 Paul, Firstly I apologize for making assumptions. The assumption was based upon 15 years as a professional in the industry... You are correct that IE is the dominant browser, however this is due to two reasons; the enterprise market, where enterprises are tied into microsoft products, and thus force their staff to use IE as standard, this is why there are still a lot of IE6's around. The second reason is that a lot people will only use the browser that is installed on their computer when it is bought, they would never even think to change to another browser. My assumption is that site administrators will not fall under those two categories, so if you take those figures out of the current market share (say from here... http://www.w3schools.com/browsers/browsers_stats.asp ) then my assumption (be it wrong or not) is that the majority of site administrators are using the other browsers, though probably mainly Firefox. That aside, As I've said before, It does work in IE. it just doesn't look as good, the thumbnails are stretched slightly and the highlighted item on the tree is a slightly different colour... it's only minor issues and certainly doesn't affect the functionality of the module ... It would take more time for me to get it looking good for it... and I'm not willing to spend that time.. All my paying clients that will be using this software are using firefox, chrome and safari on mac, so my emphasis was on getting it working on that, and that only. However, this is open source software so anyone can pick it up (including you) and fix it.. the code is here.. http://github.com/Glooper/gallery3-contrib/tree/master/modules/gwtorganise/ so please go ahead and create a new module based on it to sort out the issues with IE. I'm willing to give any help to get you started. With regards to google gears.. There is no way in IE and firefox to allow multiple files to be uploaded at once without installing a third party module. Gallery3 uses Adobe Flash to solve this. So I had a choice, try and use adobe flash or use google gears.. the reason I choose gears is that it also allows drag and drop from the desktop, which is something I plan to add in the future. Also Gears is a requirement for Google Wave which when it comes out will be something I'll be using with my clients as a way of communicating and planning their websites. So again it made sense for me to use google gears. Also chrome comes with gears pre-installed. Again please feel free to take the code and re-write the upload so it uses the flash upload. There is a GWT module available http://code.google.com/p/swfupload-gwt/ .. which can be used to change this module to use flash upload instead. Ben Benjamin Albert Smith - Photography smashkins Joined: 2009-09-30 Posts: 7 Posted: Mon, 2009-10-05 10:59 specatular module! Great! edbeeny Joined: 2009-11-26 Posts: 14 Posted: Thu, 2009-11-26 14:34 I'm getting an error when trying to use. Unexpected Error java.lang.Throwable: java.lang.IllegalArgumentException: empty argument - http://www.test.com/gallery3/index.php/json_album/is_admin/ Any ideas? Glooper Joined: 2005-09-21 Posts: 225 Posted: Thu, 2009-11-26 17:39 What version of gallery are you testing against?. This was released for beta3 so might not work on the current experimental version. If you are using beta 3 then I'm not sure what the problem is! is there any more information underneath the error message? Ben Benjamin Albert Smith - Photography edbeeny Joined: 2009-11-26 Posts: 14 Posted: Thu, 2009-11-26 20:27 I have upgraded to the latest experimental version, to try to resolve another issue! Are you looking to make it compatible or waiting for the next public release? edbeeny Joined: 2009-11-26 Posts: 14 Posted: Fri, 2009-11-27 11:20 Ok, managed to get it working with the latest experimental version. edit controllers/json_album.php line 47 if (user::active()->admin) { to if (identity::active_user()->admin) { edbeeny Joined: 2009-11-26 Posts: 14 Posted: Fri, 2009-11-27 20:44 Ben, Could this module be edited so it can resize the image when uploading to the gallery? Glooper Joined: 2005-09-21 Posts: 225 Posted: Sat, 2009-11-28 20:12 It was something I was thinking of doing... and something that is possible with google gears. So maybe for the next version.. Ben Benjamin Albert Smith - Photography Pipsqueak Joined: 2009-12-18 Posts: 3 Posted: Sat, 2009-12-19 21:03 You might roll that controllers/json_album.php fix from above into the download version. The bug is a show stopper, but the fix worked perfectly. I really like your organizing solution -- much better than the buggy built-in organize feature. Thanks! Glooper Joined: 2005-09-21 Posts: 225 Posted: Tue, 2009-12-22 07:43 Any one got any ideas on how the resize should work. I've got it working OK but was wondering how it should happen. I don't really want a pop up to occur to do it each time you upload. Was thinking it could be a setting such that you can set it so that all uploads are resized to a certain size (or not). But would this be better done on a per album setting or global or both? Ben Benjamin Albert Smith - Photography dave8401 Joined: 2009-06-01 Posts: 129 Posted: Thu, 2010-01-07 20:10 Did anyone get this working on the latest git-code? Sounds really promising, but doesn't work for me. Thanks, David Glooper Joined: 2005-09-21 Posts: 225 Posted: Thu, 2010-01-07 22:13 edbeeny has a fix mentioned above as of the Gallery 3 code in November. I'm not sure if there's been any changes to the main gallery code since then that would affect this module? I'm currently working on some new features but I'm still based on Beta 3. I might upgrade soon, but would rather wait for the next official release. Ben Benjamin Albert Smith - Photography dave8401 Joined: 2009-06-01 Posts: 129 Posted: Sat, 2010-01-09 12:14 Hi, yes saw that mentioned above. @edbeeny, would you mind having a look on the latest git version? anyhow, a great module! thanks, david GiiGii Joined: 2010-01-12 Posts: 3 Posted: Tue, 2010-01-12 17:21 Hi, I trying to use the GWT organize module (from Git Hub) against the current experimental version of gallery3 But, there is always a 'but', I always get the following : Quote: 2010-01-12 17:49:15 +01:00 --- error: Database_Exception [ 44 ]: #1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OFFSET 0' at line 5 [ SELECT g3b_items.* FROM g3b_items WHERE parent_id = 1 ORDER BY weight ASC, id ASC OFFSET 0 ] D:\xampp\htdocs\pqfo2\system\libraries\Database_Mysqli_Result.php [ 27 ] #0 D:\xampp\htdocs\pqfo2\system\libraries\Database_Mysqli.php(79): Database_Mysqli_Result_Core->__construct(false, 'SELECT g3b_ite...', Object(mysqli), true) #1 D:\xampp\htdocs\pqfo2\system\libraries\Database.php(272): Database_Mysqli_Core->query_execute('SELECT g3b_ite...') #2 D:\xampp\htdocs\pqfo2\modules\gallery\libraries\MY_Database.php(45): Database_Core->query('SELECT g3b_ite...') #3 D:\xampp\htdocs\pqfo2\system\libraries\Database_Builder.php(994): Database->query('SELECT g3b_ite...') #4 D:\xampp\htdocs\pqfo2\system\libraries\ORM.php(1528): Database_Builder_Core->execute(Object(Database_Mysqli)) #5 D:\xampp\htdocs\pqfo2\system\libraries\ORM.php(690): ORM_Core->load_result(true) #6 D:\xampp\htdocs\pqfo2\modules\gallery\libraries\ORM_MPTT.php(175): ORM_Core->find_all(NULL, 0) #7 D:\xampp\htdocs\pqfo2\modules\gallery\models\item.php(634): ORM_MPTT_Core->children(NULL, 0, Array, Array) #8 D:\xampp\htdocs\pqfo2\modules\gwtorganise\controllers\json_album.php(37): Item_Model->children(NULL, 0, Array) #9 D:\xampp\htdocs\pqfo2\modules\gwtorganise\controllers\json_album.php(62): Json_Album_Controller->child_elements('1') #10 [internal function]: Json_Album_Controller->children('1') #11 D:\xampp\htdocs\pqfo2\system\core\Kohana.php(330): ReflectionMethod->invokeArgs(Object(Json_Album_Controller), Array) #12 [internal function]: Kohana_Core::instance(NULL) #13 D:\xampp\htdocs\pqfo2\system\core\Event.php(208): call_user_func_array(Array, Array) #14 D:\xampp\htdocs\pqfo2\application\Bootstrap.php(67): Event_Core::run('system.execute') #15 D:\xampp\htdocs\pqfo2\index.php(90): require('D:\xampp\htdocs...') #16 {main} I ran the SQL request in a standalone SQL prompt and ... I got the same issue. Any thought about this ? Regards, G' PS : I did the edbeeny fix. My environment : * Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0 * Version du client MySQL: 5.1.37 * Extension PHP: mysqli talmdal Joined: 2006-12-06 Posts: 358 Posted: Tue, 2010-01-12 18:02 @GiiGii: the problem is the OFFSET 0. The offset attribute can't be specified by by itself. it always needs the limit parameter. This is caused by the gwtorganize controller specifying a null value for the limit and a zero value for the offset parameter. The other issue you could have problems with is we don't currently support gallery3 on a windows server. people have got it to work, but just a heads up. http://www.timalmdal.com talmdal Joined: 2006-12-06 Posts: 358 Posted: Tue, 2010-01-12 18:51 Just pushed a change to gallery3-contrib repository to address this issue. http://www.timalmdal.com GiiGii Joined: 2010-01-12 Posts: 3 Posted: Tue, 2010-01-12 19:25 Ok thank for this quick answer & the change . I'm going to move my web test server on a linux dist. Anyway, thank you. G' Bryan76 Joined: 2009-04-24 Posts: 10 Posted: Wed, 2010-01-13 23:03 I'm running into an issue. With a stock install (based on git clone from today I get a permission denied error in the iframe. From looking at the page source, the iframe's src is set to: src="http://www.mysite.com/gallery3/modules/gwtorganise/war/index.php?url=http://www.mysite.com/gallery3/" When I take the url parameter off, I no longer get the permission denied error. Also if I replace the forward slashes with %2F I no longer get the error. Obviously something about my web server doesn't like the encoding of it as such. So I modified views/gwtorganise_view.html.php adding urlencode: $url = "$base/modules/gwtorganise/war/index.php?url=" . urlencode($base);


lancemorton

Joined: 2007-09-24
Posts: 20
Posted: Thu, 2010-01-14 17:20

@Talmdal -- I was experiencing the same problem as GiiGii. Your fix worked (resolved the offset error). Now I'm seeing the following:

Database_Exception [ Database Error ]:
#1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'L 'b' AND parent_id = 1 ORDER BY weight ASC, id ASC' at line 3 [ SELECT items.* FROM items WHERE a L 'b' AND parent_id = 1 ORDER BY weight ASC, id ASC ]

Any thoughts?

By the way, Glooper, I love this module. Excellent work. And, since you asked - Having an option to re-size for uploads is a great idea. I can picture a situation where it would make sense to do it on a 'per album' basis, but having a global setting makes sense, too. So, why not have a global setting that can be overriden at the album level? (i.e. a default that can be changed for an alubum upload)?

talmdal

Joined: 2006-12-06
Posts: 358
Posted: Thu, 2010-01-14 17:53

@lancemorton: do you have a bit more of a stack trace? <gallery root>/var/logs

http://www.timalmdal.com

lancemorton

Joined: 2007-09-24
Posts: 20
Posted: Thu, 2010-01-14 18:31

@Talmdal -- I have attached the log from today; I believe this is what you're asking about. Thanks for having a look at it.

AttachmentSize
log.txt11.23 KB

talmdal

Joined: 2006-12-06
Posts: 358
Posted: Thu, 2010-01-14 22:18

@lancemorton: just pushed a fix... i hope. I don't use the module, so I have no way to test. We (the Gallery team) try to clean up things as we change the API, but don't take ownership of the maintenance of modules in the -contrib repository.

http://www.timalmdal.com

Glooper

Joined: 2005-09-21
Posts: 225
Posted: Thu, 2010-01-14 22:37

Talmdal,

Thanks for doing that... ..
I will be maintaining it better when g3 is released.. I just can't afford the time to run two versions at the moment.. so I really appreciate your help here.

Ben

Benjamin Albert Smith - Photography

talmdal

Joined: 2006-12-06
Posts: 358
Posted: Fri, 2010-01-15 04:29

oops, should be in the master gallery3-contrib now, inadvertently committed to my branch
http://www.timalmdal.com

lancemorton

Joined: 2007-09-24
Posts: 20
Posted: Fri, 2010-01-15 13:29

@talmdal ~ I updated the module with your changes. And here's what I see now:

Unexpected Error java.lang.Throwable: java.lang.IllegalArgumentException: empty argument - http://mortonplace.net/gallery3/index.php/json_album/is_admin/

There's nothing being written to the var/log regarding this (there's a file for today, but it simply reads, "<?php defined('SYSPATH') or die('No direct script access.'); ?>".

Happy friday!
-Lance

talmdal

Joined: 2006-12-06
Posts: 358
Posted: Fri, 2010-01-15 15:19

@lancemorton: that's something we will have to leave for glooper or someone else that has GWT development environment set up to fix.

http://www.timalmdal.com

lancemorton

Joined: 2007-09-24
Posts: 20
Posted: Sun, 2010-01-17 16:56

@talmdal - thanks for your help along the way. For what it's worth, I made the changes outlined by edbeeny to address the empty argument error thown in 'is_admin' function.

edit controllers/json_album.php
line 47