Commit Graph

42 Commits

Author SHA1 Message Date
Bharat Mediratta
e3535349ab Revert "Add a "convert_ids" parameter to Item_Model::as_restful_array(), which"
This reverts commit 98fce83de5.

Conflicts:

	modules/gallery/tests/Item_Model_Test.php
2010-06-15 20:25:35 -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
Bharat Mediratta
b40057283e Add a "can_edit" field to the Item_Model's REST output. It's
applicable to the current user.
2010-06-08 20:59:24 -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
Bharat Mediratta
98fce83de5 Add a "convert_ids" parameter to Item_Model::as_restful_array(), which
we can turn on with a query parameter.
2010-06-07 22:23:46 -07: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
Bharat Mediratta
4068e80f06 Update test to reflect slug change in 78db1bb339 2010-04-22 22:24:44 -07:00
Bharat Mediratta
78db1bb339 Fix a bug where if the file name is composed of entirely illegal
characters, we'll get an empty slug.  Partial fix for #1086.
2010-04-04 14:27:39 -07:00
Bharat Mediratta
c3c2b45280 Update the copyright to 2010. It's only 3 months into the year :-) 2010-03-03 10:15:34 -08:00
Bharat Mediratta
d29028c4ea Add Item_Model::as_restful_array() for convenience. 2010-01-30 23:36:11 -08:00
Bharat Mediratta
212633d05a Prevent accidentally deleting the root album. 2010-01-27 21:52:18 -08:00
Bharat Mediratta
46d4d778ad Remove debug code. 2010-01-20 23:33:09 -08:00
Bharat Mediratta
feefdfd533 Stop using MY_ORM::original(). 2010-01-20 22:51:18 -08:00
Bharat Mediratta
995faaa27f Stop using MY_ORM::original(). It's got very odd semantics and we are
not capturing all cases for setting and resetting $original, which
leads to some weird and hard to reproduce behavior.

Instead, if we need the original just reload it from the database.
This may result in a somewhat excessive load in places, but we'll have
to fix that in a later optimization pass.
2010-01-20 22:45:19 -08:00
Bharat Mediratta
76da85a1a0 Extend Gallery_Unit_Test_Case instead of Unit_Test_Case. 2010-01-19 22:38:19 -08:00
Bharat Mediratta
e39c8df19f Fix some validation checks to check to see if the original was loaded
before deciding whether or not we changed a value.

Change valid_name to be cascading, not parallel.
2010-01-19 21:20:36 -08:00
Bharat Mediratta
4418993db9 Add slug_is_url_safe_test() 2010-01-18 23:38:39 -08:00
Bharat Mediratta
9eedf5c207 switch to test::starts_with(). 2010-01-18 22:55:16 -08:00
Bharat Mediratta
cfc0f3d0c0 Minor test cleanup. 2010-01-18 22:51:40 -08:00
Bharat Mediratta
b4e6834a28 Added move_album_fails_wrong_target_type_test() 2010-01-18 21:14:43 -08:00
Bharat Mediratta
677fb08002 Updated tests to match what the expected new API for moving items.
Now to move an item, you just change its parent_id.
2010-01-18 21:12:26 -08:00
Bharat Mediratta
38c13760af Switch to using test::random_name() to avoid integer names.
Fix up rename_photo_test.
2010-01-18 20:14:09 -08:00
Bharat Mediratta
92ed5d45e6 In item_rename_fails_with_existing_name_test switch validate() to
save() now that Kohana ticket #2504 is resolved.
2010-01-18 12:56:49 -08:00
Bharat Mediratta
ebb909625c Merge branch 'master' into bharat_dev 2010-01-18 12:54:26 -08:00
Bharat Mediratta
cf236a228a Don't assert_same() now that typecasting is gone from ORM. 2010-01-18 12:37:20 -08:00
Bharat Mediratta
53735f6b16 Convert a $root to item::root() to fix a test. 2010-01-17 23:50:42 -08:00
Bharat Mediratta
31ecb009ba Get rid of urls_are_rawurlencoded_test -- it's no longer necessary
since we can't have unsafe slugs.

Add basic_validation_test.
2010-01-17 23:47:16 -08:00
Bharat Mediratta
06541f0e2a Fix item_rename_fails_with_existing_name_test() -- broken because of
http://dev.kohanaphp.com/issues/2504
2010-01-17 21:49:48 -08:00
Bharat Mediratta
710e472edc Fix rename_album_test() 2010-01-17 21:03:15 -08:00
Bharat Mediratta
b35a3c8b81 Fix rename_photo_test(). 2010-01-17 20:54:08 -08:00
Bharat Mediratta
9ddb961a91 Partially updated for model based validation. 2010-01-17 20:53:32 -08:00
Bharat Mediratta
00c73a4b07 Revert "Fix for ticket #978. Don't reset the original property as part of the save processing, because that will overwrite the original values with all the new values. The problem with the original approach is that when changed event handlers used ->original(), it had already been reset as part of the save processing. Went back and forth on either leaving this alone and forcing callers to save the original prior to calling the save function, but there were a few event handlers that used ->original(). This seemed the easier change. So to reset the original you need to call reload() or clear(). There is now an optional parameter on the reload to only reload the original."
This reverts commit daeaca110d.
2010-01-15 23:53:43 -08:00
Tim Almdal
daeaca110d Fix for ticket #978. Don't reset the original property as part of the save processing, because that will overwrite the original values with all the new values. The problem with the original approach is that when changed event handlers used ->original(), it had already been reset as part of the save processing. Went back and forth on either leaving this alone and forcing callers to save the original prior to calling the save function, but there were a few event handlers that used ->original(). This seemed the easier change. So to reset the original you need to call reload() or clear(). There is now an optional parameter on the reload to only reload the original. 2010-01-13 11:27:09 -08:00
Bharat Mediratta
bfcd99f3f2 Updated for K24 2009-12-21 11:30:34 -08:00
Tim Almdal
f176bc7299 Correct spacing 2009-11-06 23:19:48 -08:00
Tim Almdal
607662d66b When an item is renamed or move insure that the target file name doesn't exist. fixes ticket #694 2009-10-24 10:08:48 -07:00
Bharat Mediratta
7ec490b600 rawurlencode() path components in relative_path_cache and
relative_url_cache so that they're safe for browser use.
2009-09-11 11:04:35 -07:00
Tim Almdal
27b81257fa Standardize the access to the create_random_item method 2009-08-29 11:24:12 -07:00
Bharat Mediratta
7ad0808a11 Change the API for getting to the original state of an ORM.
Old API:  $obj->original("field_name")
  New API:  $obj->original()->field_name

This allows us to revert the varous xxx_updated events back to passing
an original ORM as well as the the updated one.  This makes for a
cleaner event API.

  Old API:  comment_updated($comment) { $comment->original("field_name") }
  Old API:  comment_updated($old, $new) { $old->field_name }
2009-08-02 12:09:00 -07:00
Bharat Mediratta
19d89f94f9 Remove debug statements 2009-07-30 09:57:24 -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
Bharat Mediratta
28b41056e3 Restructure things so that the application is now just another module.
Kohana makes this type of transition fairly straightforward in that
all controllers/helpers/etc are still located in the cascading
filesystem without any extra effort, except that I've temporarily
added a hack to force modules/gallery into the module path.

Rename what's left of "core" to be "application" so that it conforms
more closely to the Kohana standard (basically, just
application/config/config.php which is the minimal thing that you need
in the application directory)

There's still considerable work left to be done here.
2009-05-27 15:07:27 -07:00