Closed (fixed)
Project:
MySite
Version:
master
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
5 Dec 2006 at 15:02 UTC
Updated:
4 Jun 2007 at 22:24 UTC
Jump to comment: Most recent file
I have figured out how to use jQuery to allow for drag-and-drop placement of items on the MySite layout.
Next step is porting the solution to the mysite code.
These changes will go into the 5.x.1.x-dev branch and eventually spin a new release.
These changes will create new requirements in the way layout files are written.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | interface.js.txt | 16.14 KB | agentrickard |
Comments
Comment #1
agentrickardUpdate: 12-DEC-2007
I have tested an initial pass at this code, and it works fine for single-column layouts. But the standard 'columns' layout assumes that the columns will have an equal number of items. This makes sorting across columns unstable (and perhaps impossible to achieve).
A possible solution is to add a 'region' column to the mysite_data table, which would assign contente groups to specific layout regions. This is an added layer of complexity, but does open the door to more advanced layout options.
Of course, setting up regions in this way might create the need for region-specific rules. As in, "only 1 content item is allowed in region A" or "only Views may be put in regions B". Not sure if the module needs this level of complexity.
Comment #2
jacauc commentedsubscribing
Comment #3
agentrickardFor all the JQuery experts out there.
I couldn't find an obvious drag-and-drop function that would also fire an AJAX request to save changes instantiated by the AJAX sort feature. I ended up writting one from scratch.
What I'm looking for is a JQuery-native XML HTTP Request handler function. Is there one that I missed?
Attached is the interface.js file that I wrote. It still needs testing for IE/MS compatibility.
Comment #4
jacauc commentedCan I test this?
What should I do with the JS file, just place it in the mysite module folder?
Comment #5
agentrickardNo, there are other code changes that support the use of that JS file.
I need to set aside some time to roll the proper code and release it. The big holdup is the regions concept. To really support drag-and-drop, the MySite module will need to recognize and store region data. This need will cause a change in the {mysite_data} table and some changes to Layout files. It is not a minor change.
I'm still trying to get all the bugs reported and fixed that people report when upgrading to Drupal 5; after that, I'll have to start a 5.x.2 branch that had the drag-and-drop. Simply haven't had time.
I could tar up what I have so far and post it here, though, but it is definitely NOT ready for production use.
Comment #6
jacauc commentedThanks for the quick response!
I understand the fact that this could take up a lot of your time, and by no means am I trying to push you to complete it though.
I am just really interested in the possibilities of this module, and I've got a D5 development site up and running where I want to play around.
I would appreciate if you could post a tar file, - Will not be used in anything production related from my side.
Quick question though... Do people generally know not to use HEAD in production sites? Or... does HEAD necessarily have to be stable at all?
If not, is it acceptable to post to HEAD as you develop? Then we don't have to ask every time for a tar package.
No pressure! Promise :P
Thanks again
jacauc
Comment #7
agentrickardPeople generally do know not to use HEAD for production. It's clearly stated in all the documentation.
I messed up the HEAD branch early on, and haven't been committing changes to it. I need to take some time to update HEAD to be current for MySite. Current changes have only been committed to 4.7.x.3.dev and 5.x.1.dev.
None of the drag-and-drop code has been committed to CVS, since it changes the API in some significant ways.
This code also predates the security fix described here: http://drupal.org/node/103958, so I can't post a tar file right now.
I'll need to get caught up, release the newest bugfixes, then port 5.x.1.dev to HEAD. Then I can commit drag-and-drop to HEAD.
I don't have a timeline for that, though.
Comment #8
jacauc commentedThanks, I'll keep an eye here.
:D
Comment #9
matt_paz commentedAlso interested in this one ... sounds like a great addition! Just out of curiosity, I'm wondering if there could be any interesting ways to integrate this module and subscriptions (http://drupal.org/project/subscription). A slightly different beast, I understand, but the two seem to share some very interesting overlap.
Comment #10
agentrickardMaybe, but new features are only going into the 5.x branch, and Subscriptions isn't fully released for 4.7 yet.
Is the suggestion to port some functionality into MySite? If so, what?
Comment #11
agentrickardComment #12
agentrickardOK. I have committed drag-and-drop, take 1 to HEAD. You can download and test the changes here:
This code is not ready for use in production sites.
http://ftp.osuosl.org/pub/drupal/files/projects/mysite-HEAD.tar.gz
Make sure the mysite.module file is at least v1.11 and that the mysite.js file exists. Current users will need to run update.php.
Changes:
1) Addition of the mysite.js file, which implements a subset of the Interface library for jQuery.
2) You can now drag items around your MySite page (/mysite/UID/view). Changes are saved via AJAX when you release an item.
3) The {mysite_data} table has a new column: 'position' which tells the layout files which area the content should be presented in.
4) Layout files now check the position value in order to load content. For default.php, everything is assumed to be position 0. For columns.php, any value > 0 is treated as positon 1.
5) For those implementing additional layouts, there is no limit to the number of positions that you can have. They just need to be implemented as shown in coloumns.php.
There are still some elements that definitely need work, and I am by no means a JavaScript master.
1) I didn't implement Save buttons, even though I agreed to: http://groups.drupal.org/node/2512. I simply couldn't make them work.
2) I never made jQuery's #ajax function work correctly, so I rolled my own. Probably not needed.
3) I had to duplicate most of the jQuery.js file as part of the Interface library. This may cause unintended conflicts with other Drupal functions.
4) The UI colors and effects need work. Highlights may not be bold enough.
5) Everything is implemented inside a
<ul>tag now, which may not be optimal.6) The code has only been tested on Mac OS X, using Firefox 1.5.
So consider this an open call to testers and JS masters. Patches are definitely welcome.
Comment #13
agentrickardI should mention that MySite HEAD is compatible with Drupal 5.x only.
Comment #14
agentrickardAnd, if you've never used MySite before, you'll need to read http://drupal.org/node/119574.
Comment #15
agentrickardThis issue is on hold until http://drupal.org/node/124978 is resolved.
Comment #16
agentrickardComment #17
agentrickardResolved and committed to 5.x.2-beta. Thanks to jjeff for the jQuery Update and jQuery Interface modules.