Commit Graph

683 Commits

Author SHA1 Message Date
Bharat Mediratta
41ca2b0195 Rework our exception framework to fit into Kohana's model better.
Instead of overwriting Kohana_Exception::handle() (which we were doing
in MY_Kohana_Exception) we instead use their existing template system.

gallery/views/kohana/error.php overrides system/views/kohana/error.php
and is the standard error template for all exceptions.  Our version of
error.php figures out the appropriate view based on context (cli,
authenticated admin, guest viewing a 404, guest viewing a system
error) and delegates appropriately.  Each delegated view has a narrow
responsibility.

This paves the way for us to add new error views per module.  For
example, the rest module will define its own template in
Rest_Exception and then its exceptions can be rendered the way that it
wants (json encoded, in that case).
2010-06-19 14:07:32 -07:00
Bharat Mediratta
bc70ff498d Use request::protocol() 2010-06-18 15:25:33 -07:00
Jan Koprowski
1fb3339326 Fix issue1068. Fill from_id field in photo with indetificator 2010-06-16 22:51:39 +08:00
Bharat Mediratta
a432a43b3b Revert "Change the item rest update processing to call the
item::move(source, target) helper when the parent member has changed.
Using the move method insures that names and slugs that could conflict
in the target album are resolved properly.  Changed the item::move
method so it returns a message to be displayed if the caller chooses.
And changed the move controller to display the message returned by the
move if the item name was renamed as part of the move."

Rolling this back for a couple of reasons:

1) Bug in move.php ("message.info" is not a function name)

2) Having the message come back from the API call as a side-effect is
sloppy.  We should find a cleaner way to do this checking.

3) having item::move() call save() on any changed values in the ORM
is counter-intuitive.  Move should move, save should save.

I think the right approach here is to roll the move() code properly into
save().

This reverts commit 2492280cc0.
2010-06-15 17:18:22 -07:00
Bharat Mediratta
48dc07dbc8 Revert "Fix for ticket #1118. Create a item::save_with_retries helper
method, which encapsulates saving an item and handling name and slug
conflicts. Call this instead of doing a save directly."

Rolled this back because it fails KISS.  We already have an API for
saving models with Item_Model::save() that's consistent with all of
our other model code.  Adding a new way to save items is confusing and
inconsistent.

This reverts commit 9504f71efc.
2010-06-15 17:17:25 -07:00
Tim Almdal
9504f71efc Fix for ticket #1118. Create a item::save_with_retries helper method, which encapsulates saving an item and handling name and slug conflicts. Call this instead of doing a save directly. 2010-06-15 14:18:23 -07:00
Tim Almdal
2492280cc0 Change the item rest update processing to call the item::move(source, target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Changed the item::move method so it returns a message to be displayed if the caller chooses. And changed the move controller to display the message returned by the move if the item name was renamed as part of the move. 2010-06-15 12:52:28 -07:00
Tim Almdal
207f6beb61 Only change the weights of the album children if the item sort_column is set to weight. 2010-06-15 11:40:01 -07:00
Tim Almdal
00c4cb3f63 Revert "Change the item rest update processing to call the itemm::move(source, target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Also, only change the weights of the album children if the item sort_column is set to weight."
This reverts commit 603d464014.
2010-06-15 11:38:46 -07:00
Tim Almdal
603d464014 Change the item rest update processing to call the itemm::move(source, target) helper when the parent member has changed. Using the move method insures that names and slugs that could conflict in the target album are resolved properly. Also, only change the weights of the album children if the item sort_column is set to weight. 2010-06-15 11:20:04 -07:00
Tim Almdal
1c5264d7f5 Merge branch 'master' of git@github.com:gallery/gallery3 2010-06-14 07:44:17 -07:00
Bharat Mediratta
793780daa7 Replace __CSRF__ with the actual csrf token. 2010-06-13 20:51:11 -07:00
Bharat Mediratta
6f443a819b Change single to double quotes. 2010-06-13 20:49:50 -07:00
Tim Almdal
938eea7fc4 Merge branch 'master' into talmdal_dev 2010-06-13 09:59:27 -07:00
Bharat Mediratta
dceecabbf1 Make login/logout continuation url code consistent. Where necessary,
we specify the continue_url in the session, but we store it in the
login form so that we can propagate it across the session creation
that happens at login time.
2010-06-12 15:16:47 -07:00
Bharat Mediratta
c026da85cd Use "continue_url" instead of "continue" for consistency with the
reauth code.
2010-06-12 15:10:34 -07:00
Bharat Mediratta
63d95087bf Stop trying to parse the continue url in the logout controller because
it requires us to reproduce a bunch of complex routing logic.
Instead, just have the logout link generating code generate a link
that's visible to guests.
2010-06-12 13:35:12 -07:00
Tim Almdal
58b21e909d Change the pattern used to convert the file name to a title. Fixes ticket#1061 2010-06-10 18:49:29 -07:00
Bharat Mediratta
3dacafb718 Revert the "preserve_ids" global query parameter. We decided that it was a
bad idea.

This reverts commit 6425d41edd.
2010-06-09 20:49:32 -07:00
Tim Almdal
d5b80f2944 Don't use the standard error formatting for exceptions that have occurred as part of a REST request. Format the exception as a json encoded text string so the client can extract the fault information if they so choose. 2010-06-08 14:35:35 -07:00
Bharat Mediratta
6425d41edd Add a "preserve_ids" global query parameter for REST requests that
indicates that we shouldn't opportunistically convert ids into REST
urls.
2010-06-07 23:12:52 -07:00
Tim Almdal
4a6775f5d3 Merge branch 'master' into talmdal_dev 2010-06-07 05:11:09 -07:00
Bharat Mediratta
1d91e1b2dc Don't show the rotate links if the active user can't edit the photo. Fixes ticket #1157. Thanks to psvo. 2010-06-06 23:19:02 -07:00
Bharat Mediratta
ab0bef14be Try to adjust for situations where /proc/loadavg is_readable() but
generates an error if we call file() on it.  Fixes ticket #1149.
2010-06-06 21:08:10 -07:00
Tim Almdal
097ef934c6 Merge branch 'master' into talmdal_dev 2010-06-06 15:45:03 -07:00
Bharat Mediratta
aeee88031f Fix an unused variable caused by converting straight query params
to $entity based params.
2010-06-06 13:06:08 -07:00
Bharat Mediratta
e1d3b0295d Change "ancestor_for" to "ancestors_for" for consistency. 2010-06-06 12:42:16 -07:00
Bharat Mediratta
4e56176f35 item::random_query() doesn't need to take a "where" clause because
it's returning a query, so the caller can add the where clause
himself.  This makes for a cleaner API.
2010-06-05 23:47:47 -07:00
Bharat Mediratta
10895ca529 Undo the change added in e4eedbce22
which deactivates modules on upgrade.  No idea why we did that, but it
breaks upgrading because it deactivates any module that's been
upgraded.
2010-06-05 23:04:23 -07:00
Bharat Mediratta
0350cf3cd8 Fix a comment typo. 2010-06-05 22:50:20 -07:00
Tim Almdal
ed1905d3f9 Change the name of the private format_restful_item to _format_restful_item so that the File_Structure_Test will pass. 2010-06-04 14:05:25 -07:00
Tim Almdal
686da5a3e0 Save the item before updating the order of the children. Also always increment the weight count (even if it is equal to the weight of the current child) 2010-06-04 14:05:25 -07:00
Tim Almdal
a600185b60 Allow the use of the type query parameter to filter the results of a rest/gallery/items?urls=... request. This allows the client to pass the entire list of member urls and have the rest server filter the results based on the specified types.
(cherry picked from commit 3fe10b15cf)
2010-06-04 14:05:24 -07:00
Tim Almdal
04b90c3bde Remove the item id from the rest/gallery/items url as that was inconsistent. Add the query parameter ancestors_for=<url> to provide a restful way to retrieve the ancestors of an item.
(cherry picked from commit e9c8a8ae53)

Conflicts:

	modules/gallery/helpers/items_rest.php
2010-06-04 14:05:24 -07:00
Tim Almdal
ae595795f0 If the file is empty (i.e. the upload failed, then throw a 'bad request' exception before trying to create the item. 2010-05-28 09:42:44 -07:00
Tim Almdal
73c7ec5310 Save the item before updating the order of the children. Also always increment the weight count (even if it is equal to the weight of the current child) 2010-05-18 06:16:47 -07:00
Tim Almdal
83ce637ce3 Allow the use of the type query parameter to filter the results of a rest/gallery/items?urls=... request. This allows the client to pass the entire list of member urls and have the rest server filter the results based on the specified types.
(cherry picked from commit 3fe10b15cf)
2010-05-15 23:43:25 -07:00
Tim Almdal
48b66f2d67 Remove the item id from the rest/gallery/items url as that was inconsistent. Add the query parameter ancestors_for=<url> to provide a restful way to retrieve the ancestors of an item.
(cherry picked from commit e9c8a8ae53)

Conflicts:

	modules/gallery/helpers/items_rest.php
2010-05-15 23:42:55 -07:00
Bharat Mediratta
1240878df0 Fix-ups for d98b85f7d3
- Pass the CSS selector of the active image in as an arg to site_menu
  so that quick operations know what they're operating on.
- Change the ids from g-{photo,movie}-id to the generic g-item-id
- Initialize ajax handlers for site menu on the photo and movie page
- Drop the movie context menu, it's now in the site menu
2010-05-14 16:55:15 -07:00
Chad Kieffer
163dd0eb93 Merge branch 'master' of github.com:gallery/gallery3 2010-05-14 17:16:22 -06:00
ckieffer
d98b85f7d3 Drop context_menu for wind's photo/resize view. Move photo edit options to the site_menu. 2010-05-14 17:14:34 -06:00
Bharat Mediratta
9affa8ebbd Pick a new album cover when the photo that's the current cover is
deleted.  Fixes ticket #1083.
2010-05-10 22:11:59 -07:00
ckieffer
44753c5249 Deleted extra CSS class assignment for context_menu delete option. 2010-05-08 15:05:56 -06:00
Bharat Mediratta
2257776f9b Don't show the member element for non-collection elements in the response. Having a members sidebar element indicates to the rest clients that this is a resource collection.
Conflicts:

	modules/gallery/helpers/items_rest.php
2010-04-17 15:36:46 -07:00
Tim Almdal
a2e0472f83 Only return the members element to the rest client if the item is an album. This makes it consistent to the rest client that collections will have a members element. 2010-04-16 14:30:41 -07:00
Bharat Mediratta
c2615e87a7 Merge branch 'master' into bharat_dev 2010-04-16 14:19:21 -07:00
Bharat Mediratta
8d8aefc5b8 Add album_add_form event to album::get_add_form(). 2010-04-10 20:58:05 -07:00
Bharat Mediratta
886337e1dd Add error messages to theme::get_edit_form_admin() 2010-04-10 20:45:09 -07:00
Tim Almdal
6652b69193 Merge branch 'master' into bharat_dev 2010-04-07 07:29:46 -07:00
Bharat Mediratta
2657d08586 Move the "Fix MPTT" task from the rescue module into the main Gallery
module.
2010-04-04 14:46:44 -07:00