Commit Graph

124 Commits

Author SHA1 Message Date
Bharat Mediratta
3f48f17e54 We don't care about the name and slug for the root album so don't bother enforcing them. 2010-07-29 19:41:03 -07:00
Romain LE DISEZ
39962eaddc Accept extension .m4v as video/mp4 2010-07-10 08:09:04 -07:00
Tim Almdal
2bbce8dddb Fix for ticket #1117 align videos to the center. 2010-06-17 09:10:01 -07:00
Tim Almdal
38d09c5d1a Scale a movie to the resize size so that it doesn't overflow into the sidebar. 2010-06-17 08:03:08 -07:00
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
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
Tim Almdal
6652b69193 Merge branch 'master' into bharat_dev 2010-04-07 07:29:46 -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
5679e30ef6 REST changes: Allow PUT and POST requests to modify members, not
just entity.

TESTS ARE NOT UPDATED YET.

- Fix item_rest::get() to maintain the proper sort order, which
  requires duplicating some Item_Model code.

- Elide "weight" from the REST version of item

- Adjust the weight of members according to the order they're returned
  from the client.  You can't add or remove members here, you can only
  reorder them.

- Changed the wire protocol to handle more complex values.
  Now "entity" and "members" are JSON encoded.  The Gallery3
  helper does this correctly.

- Changed the wire protocol for tag_item -- now it stores the
  tag and item urls in the entity, not as members.  This is more
  consistent.

- Added missing security for renaming and deleting tags.

- Got rid of vestigial tag_rest::post().  We add/remove tags
  via the relationship.
2010-04-04 11:55:54 -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
5fbc472300 Fix the resize_url and file_url in as_restful_array() 2010-02-19 11:54:03 -08:00
Tim Almdal
10c0698949 Correct the view_fillsize permission to view_full. In addition, change the name of the field containing the url to the fullsize image to file_url instead of fullzie_url 2010-02-19 11:48:54 -08:00
Tim Almdal
a597b57210 return the absolute url not the relative for the full size, resize and thumb images. 2010-02-15 12:29:49 -08:00
Tim Almdal
897215689c Remove the dirty flags from the information returned from the rest request for an item. In addition, add links to the images. 2010-02-14 07:32:35 -08:00
Bharat Mediratta
ce71ea6aa7 Revert "1) Add a depth parameter to retrieving an item thru the rest api"
This reverts commit 3439671bcf.
2010-02-12 04:53:26 -08:00
Tim Almdal
3439671bcf 1) Add a depth parameter to retrieving an item thru the rest api
2) Standardize the structure of members so that client programs can consistently
   parse the return information.
3) Added a summary parameter so that client programs can easily determine if the
   information returned is summary (item type, item title) or the full meal deal
2010-02-12 09:52:57 -08:00
Bharat Mediratta
c050acf30a Fix lots of warnings that pop up when we're in E_STRICT mode. They're
mostly issues around uninitialized variables, calling non-static
functions in a static context, calling Session functions directly
instead of on its singleton, passing non-variables by reference, and
subclasses not using the same interface as the parent class.
2010-01-31 16:07:41 -08:00
Bharat Mediratta
ee35b0a9fe Elide data that isn't useful from the REST array. 2010-01-31 13:10:34 -08:00
Bharat Mediratta
d29028c4ea Add Item_Model::as_restful_array() for convenience. 2010-01-30 23:36:11 -08:00
Tim Almdal
c4e3604315 Strongly type the argument list to the model::validate method. 2010-01-29 14:04:27 -08:00
Bharat Mediratta
4b32a71afc Convert back to using ORM::factory(..., $id) instead of calling where(). 2010-01-27 22:34:11 -08:00
Bharat Mediratta
212633d05a Prevent accidentally deleting the root album. 2010-01-27 21:52:18 -08:00
Bharat Mediratta
5c68519d92 Specialize the album cover id check to allow the root album to have no
album cover.
2010-01-26 00:23:45 -08:00
Bharat Mediratta
953c9283ad Always keep the original around when updating existing items, because
we need it for the item_updated event.
2010-01-25 23:39:24 -08:00
Bharat Mediratta
dde429f71e Whitespace. 2010-01-20 23:49:20 -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
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
6aee6cde25 Move data initialization into the constructor so that it happens
before validate() is called, which is important with our two phase web
controllers.

Make valid_parent smarter about moving existing items, vs new items.
2010-01-19 20:53:21 -08:00
Bharat Mediratta
afe2128bb0 Make video/x-flv a valid movie mime_type 2010-01-19 19:30:18 -08:00
Bharat Mediratta
703882f4df Update valid_parent() to disallow moving an item inside its own hierarchy.
Move move_to() inside save()
2010-01-18 22:50:50 -08:00
Bharat Mediratta
0e2f4a7a37 Fix renaming in save() by moving the actual rename action under
parent::save().  This is consistent with other changes because all
filesystem operations happen after the database change is committed.

Also, inline rename() since it's fairly simple now.
2010-01-18 20:13:46 -08:00
Bharat Mediratta
1cfee16e38 In valid_name, don't query on the id if it's null. 2010-01-18 13:09:58 -08:00
Bharat Mediratta
39bb08db28 Make set_data_file() chainable. 2010-01-17 20:02:30 -08:00
Bharat Mediratta
afb3fa71b9 Get rid of internal_only designation -- it's too hard to enforce cleanly. 2010-01-17 16:58:47 -08:00
Bharat Mediratta
4f8c98a7bc Move rules entirely down into validate() so that we can be more
sophisticated but keep all our rules in one place.

Add rules for most fields.
2010-01-17 12:13:25 -08:00
Bharat Mediratta
fdcb4a1f32 PHPdoc. 2010-01-16 18:16:47 -08:00
Bharat Mediratta
a5aacfa4a6 Don't forget to save when we make insignificant chagnes only. 2010-01-16 18:10:40 -08:00
Bharat Mediratta
efdb73cb98 Make movie creation use model based validation. Move movie related
logic from movie::create() into Item_Model
2010-01-16 12:00:50 -08:00
Bharat Mediratta
9f6dba7238 Check for illegal extensions in valid_name()
Fix a bug where we were not calling valid_data_file correctly.
2010-01-16 11:12:19 -08:00
Bharat Mediratta
bf085a1a17 Convert photo uploading over to the new model based validation
approach.

- Rearrange Simple_Uploader_Controller::add_photo() to validate
  the form early in the process, and switch to using model based
  validation.

- Move thumbnail generation into gallery_event::item_created() so
  that it's decoupled from the model.

- Delete photo::create() and move all of its logic into
  Item_Model::save().

- Add Item_Model::$data_file to track the data file associated
  with new movies and photos.

- Do some cleanup on the validation callbacks -- it turns out the
  2nd argument is the field name not the value.
2010-01-16 00:51:31 -08:00
Bharat Mediratta
434d351b2f Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev
Conflicts:
	modules/gallery/models/item.php
2010-01-16 00:15:23 -08:00
Bharat Mediratta
dcf4b5e71a Don't pass MY_ORM::original() to update event handlers, since after
parent::save() it'll be reset.  Clone it first.

This is an alternate fix for #978.
2010-01-16 00:13:28 -08:00
Bharat Mediratta
654b103355 Validate the model type. 2010-01-15 13:41:46 -08:00
Bharat Mediratta
50e3cc5837 Move model business logic out of album::create() and into
Item_Model::save().  This makes creating albums similar to editing
them and makes it difficult to create an album poorly.  I expect to be
able to remove a lot of code from the photo and movie helper because
it's duplicated here.

In order to do this, I refactored ORM_MPTT::add_to_parent() into
ORM_MPTT::save() so we now add it to the parent when we do save.  This
allows us to call save() only once which saves a database call per
add.

The Albums_Controller logic is roughly the same as before.

Haven't updated the tests yet, they're going to fail miserably since
many of them depend on album::create() which is now gone.
2010-01-15 12:15:20 -08:00
Bharat Mediratta
94f58e8b65 Move setting Item_Model::rand_key into Item_Model::save() since it's
business logic.
2010-01-15 10:48:39 -08:00
Bharat Mediratta
1a557ce5a6 Use $value in valid_xxx() functions instead of the member field. They're equivalent, but it's more intuitive this way. 2010-01-15 10:36:56 -08:00