Commit Graph

61 Commits

Author SHA1 Message Date
Andy Staudacher
7608870537 Controller auth / CSRF fixes 2009-09-15 22:51:49 -07:00
Tim Almdal
5f343ab8a0 Change the variable to to resolve ticket #769 2009-09-14 08:11:12 -07:00
Bharat Mediratta
752c857116 Rename ORM_MPTT::is_descendant() to ORM_MPTT::contains() to make the
API a little clearer.  Write a test for it, too.
2009-09-10 10:28:43 -07:00
Bharat Mediratta
b550a06045 Rename $album to $target in move_to() 2009-09-10 10:08:29 -07:00
Tim Almdal
2bbe162339 A better fix for #741... the original problem was that the source and album variables were reversed 2009-09-10 10:09:09 -07:00
Tim Almdal
eb345cb870 Changed the check in organize_Controller::move_to:
1) check that target and source are not the same.
2) check that the source is not already a child of the target (use to be a
   descendant) Fixes #741.
2009-09-10 06:17:21 -07:00
Bharat Mediratta
db03c5d799 Don't try to move an item into its own descendant hierarchy. Just leave it out of the move for now. 2009-08-30 15:09:13 -07:00
Bharat Mediratta
c615918829 Manage the selection so we don't automatically select an album
whenever we expand a tree.
2009-08-30 14:40:55 -07:00
Bharat Mediratta
d1ade6620e Precalculate the organize tree based on the selected album and render
it right away while still allowing incremental tree loading.
2009-08-30 14:35:27 -07:00
Bharat Mediratta
483d8df91b Change the organize tree to expand/collapse. It doesn't properly open
up to the album that you're viewing, and if you move a photo to a
different album it'll reload the entire album tree.
2009-08-29 16:33:22 -07:00
Bharat Mediratta
775987dff9 Fix a bug where organize doesn't properly generate the tree at the root album. 2009-08-29 11:29:38 -07:00
Bharat Mediratta
b833cb6073 Get rid of the task infrastructure. The multiple requests greatly
slow down simple operations.  We may run into problems with more
complex operations, but let's only add tasks into the mix when it's
clear that we need them.
2009-08-29 10:48:23 -07:00
Bharat Mediratta
f257cd3d69 Major refactor of organize:
* Clean up naming conventions for variables in the controller
  so that we specifically refer to albums with $album_id, etc.

* Move complexity for drawing tree out of the controller and into
  the view.

* Simplify task definitions to get rid of extraneous text

* Change __PLACEHOLDERS__ to clearly define which is the album
  and which is the item that we're moving before/after

* Remove as many CSS ids as we can from the tree view to keep
  things simple
2009-08-29 10:00:47 -07:00
Bharat Mediratta
cb2171d082 Display the sort order in the Organize dialog, and allow users to
change the sort order on the fly.
2009-08-28 14:27:37 -07:00
Bharat Mediratta
b9aca313fa Fix a couple of off-by-one errors. 2009-08-28 11:41:06 -07:00
Bharat Mediratta
76e541745f Refactor rearrange_task_handler to have a more linear flow. 2009-08-28 11:13:04 -07:00
Bharat Mediratta
47fd2dc65e Clean up in preparation for some refactoring. 2009-08-28 09:53:54 -07:00
Tim Almdal
82edd2a37b This patch adds some security to the organize dialog.
1) If images are dragged from the content pane and dropped on a branch in the
   tree that the user only has view priviledges, then the drop is cancelled
   and the images are reverted.
2) The user cannot click on a branch, to which they only have view priviledges,
   the content pane does not change to the new album
2009-08-17 19:52:40 -07:00
Tim Almdal
6f6d5b306b remove the batch start/stop and replace the ORM update of the weight, with a direct sql update. This bypasses the gallery3 event mechanism. Fire a album_rearrange event when the rearrangement is complete 2009-08-17 12:56:05 -07:00
Tim Almdal
69d1b16818 Change back to using the ORM to update the child weight, but use the batch::start() method so notifications are queued 2009-08-17 12:32:33 -07:00
Tim Almdal
5e9c602b09 Fix the performance problem related to setting the child weight, by bypassing ORM and generating the sql directly. 2009-08-17 11:46:10 -07:00
Tim Almdal
dd9f4b6d7f The rearrange functionality works. but it is slower than shit. I've left the debug statements in until we can solve this issue. 2009-08-17 08:49:37 -07:00
Tim Almdal
76f320ab3d In this patch, drag now works to the album tree, but the progress bar is not
showing. As well fixed a problem where selectable single clink no longer
worked when the album was reloaded.
2009-08-16 12:36:14 -07:00
Tim Almdal
3823f65dfb Implement the first part of drag functionality. Having trouble getting visual feedback of the drop position between thumbnails, so this commit provides a checkpoint for trying various options 2009-08-12 21:55:25 -07:00
Bharat Mediratta
a245c57400 Further streamline the code.
Organize_Controller:
* Remove unnecessary constants
* Rename index() to dialog()
* Simplify _get_micro_thumb_grid

organize.js:
* Move sizing code in here from organize_dialog.html.php

organize_dialog.html.php:
* Move CSS and JS links in here so that we only load them when we need them.
* Move sizing code into organize.js

organize_thumb_grid.html.php:
* Move pagination logic in here, since it's view centric
* Collapse the css class determination code and inline it
2009-08-06 21:52:23 -07:00
Tim Almdal
8131e6fa38 Tighten up the code by loading all the albums in the tree at once, removing
the events to populate the button bar.
2009-08-06 06:33:17 -07:00
Tim Almdal
a92a46b0cd Change to use the new children and children_count API 2009-08-05 11:04:42 -07:00
Tim Almdal
63f3efef37 Revert "Revert "Enable the expand/collapse of branches by clicking on the plus/minus""
This reverts commit e37526f94d.
2009-08-05 10:26:49 -07:00
Tim Almdal
65c850c393 Revert "Revert "Checkpoint the organize module rewrite. At this point, it doesn't really do""
This reverts commit 397468c47b.
2009-08-05 10:26:11 -07:00
Tim Almdal
397468c47b Revert "Checkpoint the organize module rewrite. At this point, it doesn't really do"
This reverts commit a25f08d433.
2009-08-05 09:23:32 -07:00
Tim Almdal
e37526f94d Revert "Enable the expand/collapse of branches by clicking on the plus/minus"
This reverts commit 869c3de961.
2009-08-05 09:23:01 -07:00
Tim Almdal
869c3de961 Enable the expand/collapse of branches by clicking on the plus/minus
icons.  Branches with no albums, will not have an icon.
2009-08-05 08:31:58 -07:00
Tim Almdal
a25f08d433 Checkpoint the organize module rewrite. At this point, it doesn't really do
anything, but get the dialog up, populate the album tree and intelligently
populate the micro thumb grid.
Still to do:
1) get the microthumbs laided out ptoperly
2) expand and collapse functionality in the album tree
3) use the album tree to change the content of the micro thumb grid
4) Actually add some functionality

At the moment, it supports a callback "" to allow modules to add icons
to the organize drawer label.  The close button is added outside of this
framework as it will always be last.
2009-08-03 09:19:17 -07:00
Shai Ben-Naphtali
5a0424f458 Fix some consistency in text.
This fixes ticket #546

Signed-off-by: Bharat Mediratta <bharat@menalto.com>
2009-07-21 13:18:59 +08:00
Bharat Mediratta
0f766b149d Second non-trivial change to the event code. We now publish model
related events from within the model handling code.  The only
exception to this currently is item_created which is challenging
because we have to save the item using ORM_MPTT::add_to_parent()
before the object itself is fully set up.  When we get that down to
one call to save() we can publish that event from within the model
also.
2009-07-16 12:31:40 -07:00
Bharat Mediratta
5b3b675b6d Non-trivial changes to the event handling code:
1) The item_updated event no longer takes the old and new items.
   Instead we overload ORM to track the original data and make
   that available via the item.  This will allow us to move event
   publishing down into the API methods which in turn will give us
   more stability since we won't require each controller to remember
   to do it.

2) ORM class now tracks the original values.  It doesn't track
   the original relationships (no need for that, yet)

3) Added new events:
     item_deleted
     group_deleted
     user_deleted
2009-07-16 11:19:34 -07:00
Tim Almdal
54ffea2419 Split the clean method into two clean and purify. clean is a light weight
approach using html::specialchars and purify uses HTMLPurifier to intelligently
cleanse the output fields. Use purifier for text and title fields where it is
likely that a user would enter html to format their data.
2009-07-03 21:44:10 -07:00
Bharat Mediratta
8f9a943f55 Fix a bunch of XSS vulnerabilities turned up by manual inspection
using the checklist in ticket #385.
2009-07-01 17:57:39 -07:00
Bharat Mediratta
dd854379c2 Sanitize all data we return via json_encode() to guard against XSS and
other data leaks.
2009-06-03 17:08:23 -07:00
Bharat Mediratta
43abcd9386 Security pass over all controller code. Mostly adding CSRF checking
and verifying user permissions, but there are several above-the-bar
changes:

1) Server add is now only available to admins.  This is a hard
   requirement because we have to limit server access (eg:
   server_add::children) to a user subset and the current permission
   model doesn't include that.  Easiest fix is to restrict to admins.
   Got rid of the server_add permission.

2) We now know check permissions at every level, which means in
   controllers AND in helpers.  This "belt and suspenders" approach will
   give us defense in depth in case we overlook it in one area.

3) We now do CSRF checking in every controller method that changes the
   code, in addition to the Forge auto-check.  Again, defense in depth
   and it makes scanning the code for security much simpler.

4) Moved Simple_Uploader_Controller::convert_filename_to_title to
   item:convert_filename_to_title

5) Fixed a bug in sending notification emails.

6) Fixed the Organize code to verify that you only have access to your
   own tasks.  In general, added permission checks to organize which had
   pretty much no validation code.

I did my best to verify every feature that I touched.
2009-06-01 22:40:22 -07:00
Bharat Mediratta
88a3d43ba9 Update all references to the core application to now point to the
gallery module.  This type of mass update is prone to some small bugs.
2009-05-27 16:17:29 -07:00
Tim Almdal
908618960b Since organize is now in the preview stage and will probably be
rewritten by beta2, pull all of its "tenticles" back into itself and
out of core or tags module.
2009-05-26 14:43:31 +00:00
Tim Almdal
762ca22544 This takes us the next step closer to providing bulk edit. We still
can't edit, but we are getting closer :-).
This change sets up a framework for modules to contribute edit panels
to the organize drawer. Currently implemented General (albums and
photos), Sort Order (albums only) and Manage Tags
2009-05-18 19:34:03 +00:00
Bharat Mediratta
5495037a3d Gee it's May already. Update copyright to 2009. 2009-05-13 20:04:58 +00:00
Chad Kieffer
eb9162f6c4 Remove angled ends of edit drawer handle. 2009-05-02 06:34:05 +00:00
Chad Kieffer
590eceaf93 Set organize messages to use existing gMessage, added album cover message. 2009-05-01 05:35:56 +00:00
Tim Almdal
33122e8968 Change album cover functionality added 2009-04-29 03:57:24 +00:00
Tim Almdal
89bdd6ca98 The delete button now deletes the selected items 2009-04-29 01:29:39 +00:00
Tim Almdal
12d976b94d 1) Refactor the ajax calls so that the code is reused across multipl
request types.
2) Enable/Disable the drawer handle buttons depending on the number of
items selcted
3) Image rotation works.
2009-04-28 21:29:14 +00:00
Tim Almdal
091fde3e00 Another iteration of the organize module:
Rearrange the layout as per discussion with thumb, start the drawer
functionality. Still to do... 
1) Add the processing behind the buttons on the drawer handle
2) Enable the drawer buttons when something is selected
3) Create a copy of the thumbs for the drawer
4) Add the bulk editting functionality to the drawer
2009-04-27 20:30:46 +00:00