Commit Graph

162 Commits

Author SHA1 Message Date
Chad Parry
f0f094c3f7 Explain the conditional rename in item::save() with a comment. 2011-04-30 20:22:49 -06:00
Chad Parry
1b3a6b85c1 Improve the comment explaining why the data_file extension is important. 2011-04-30 18:29:34 -06:00
Chad Parry
c3e8c1e3b5 The data_file field is public, so we don't need to supply an accessor method. 2011-04-30 18:12:56 -06:00
Chad Parry
a8ca9dcf9e Change the name of the extensions helper to legal_file. 2011-04-30 16:10:06 -06:00
Chad Parry
6d564f185e Merge branch 'master' of https://github.com/gallery/gallery3 into rawphoto 2011-04-27 20:35:58 -06:00
Chad Parry
7ff485fa48 Move the extensions helpers out of the Kohana system directory and into their own Gallery Extensions class. 2011-04-27 20:29:06 -06:00
Bharat Mediratta
91c83874e5 Fix a bug introduced in 526859d960 where
we changed the behavior of the slug code and included the file
extension, not just the name.  This broke
Item_Model_Test::move_photo_with_conflicting_target_gets_uniqified_test
so yay for unit tests!  #1668
2011-04-25 22:15:34 -07:00
Chad Parry
26585fed03 Merge branch 'master' of https://github.com/gallery/gallery3 into rawphoto 2011-04-24 08:28:39 -06:00
Chad Parry
809567f128 Expose the data file field. 2011-04-24 08:10:04 -06:00
Chad Parry
fcb06bf175 Don't assign to the item->name field if the name is unchanged, because the save method will crash. 2011-04-24 00:45:12 -06:00
Chad Parry
c6ef706d70 Preserve old data files long enough for them to be available to event handlers. 2011-04-23 22:55:59 -06:00
Chad Parry
e149cf7238 Support data files that change their extension and MIME type. 2011-04-23 16:39:25 -06:00
Chad Parry
6702104f57 Resolve an infinite recursion that happens when the path caches are updated during saving. 2011-04-23 16:35:00 -06:00
Bharat Mediratta
526859d960 Do simple transliteration when converting filenames to slugs, but check
to see if the transliteration module is available and use a more complex
transliteration if possible.  Fixes #1668.
2011-04-22 13:57:46 -07:00
Chad Parry
31ba081b79 Add an event that will collect all valid filename extensions. 2011-04-21 02:11:04 -06:00
Bharat Mediratta
423daa52d5 Update copyright to 2011. 2011-01-21 23:01:06 -08:00
Jérémy Subtil
0d7e951aa5 Moved item_Model::get_position() method to the Item helper. It now calls the viewable() method on every query. 2011-01-09 12:14:46 +01:00
Bharat Mediratta
e2b0f92007 Keep Item_Model::scale_dimensions from upscaling. Fixes #1579. 2011-01-05 21:05:20 -08:00
Joe7
7ce902d373 Removed accidental whitespace 2011-01-03 11:01:09 -08:00
Joe7
336632fea0 Keep view counters of all item types accurate
Added common increment_view_count() func in item model for reuse
2011-01-03 11:01:02 -08:00
Bharat Mediratta
7e31f97b4c Improve Item_Model::as_restful_array() to take an array of fields so
that we only return the fields we care about.  This improves
performance when retrieving large numbers of items.  Fixes #1536.
2010-12-16 20:37:00 -08:00
Bharat Mediratta
cd48b89f31 Consolidate all the random code into a random helper that offers:
random::hash()
  random::string()
  random::percent()
  random::int()

So that we don't have lots of different ways to get random values all
over the code.  Follow-on to #1527.
2010-12-15 14:57:00 -08:00
Bharat Mediratta
45c63f4d11 Use mt_rand() instead of rand() since it provides better portability.
Fixes #1527.
2010-12-15 12:48:56 -08:00
Bharat Mediratta
79740a2c77 Move photo/movie file extension validation into the model. Fixes #1524. 2010-12-14 21:19:25 -08:00
Bharat Mediratta
8d030cea64 Fix a bug where simultaneous deletes of the same item can result in it
deleting the first item row in the database.  The root issue is a bug
in Kohana that's addressed in dca9b5f3fc
but in this change we deal with the fact that reloading an item can
result in an instance of the item that's unloaded.  In those cases, we
should just ignore it and move on.  Fixes #1489.
2010-11-18 09:52:40 -08:00
Bharat Mediratta
e87c502ede Tie the image cachebuster to the file mtime instead of
Item_Model::$updated since we want the url to be stable whenever
possible.  Fixes #1482.
2010-11-09 12:48:07 -08:00
Bharat Mediratta
d503513eca Create item_before_create and item_before_update events, and make
Item_Model::data_file public.  This allows us to intercept and tweak
data files before saving the model which enables the max_size module.
2010-11-06 21:54:28 -07:00
Bharat Mediratta
f01fad1cd0 Deal in integers when doing aspect ratio operations. Fixes #1470. 2010-10-31 12:21:06 -07:00
Bharat Mediratta
85637a0826 Fix a bug introduced recently in
f84c4a6192 where we were generating bad
SQL.  If we're checking for a conflict on a new item, the id is null
and we were doing a comparison that resulted in "id <> NULL" which
won't work -- in that case we need "id IS NOT NULL".

Fixes #1393.
2010-09-23 20:45:27 -07:00
Bharat Mediratta
19034d140e Rename the class to Item_Model_Core so that it can be overloaded.
Related to ticket #1368.
2010-09-12 13:35:50 -07:00
Bharat Mediratta
f84c4a6192 Uniqify the name and slug when we move an item to a new location with
a conflict.  This fixes #1364.
2010-09-11 23:37:12 -07:00
Bharat Mediratta
4ba93b7cfc Return the size in bytes of the thumb, resize and full file.
Don't return thumb info if there's no thumbnail (eg: album w/ no contents)
Don't return file_url_public for albums

Fixes ticket #1347.
2010-09-07 22:23:54 -07:00
Bharat Mediratta
ab880120e6 The G2 import sets the sort_order to "asc"/"desc" but
Item_Model::get_position() expects "DESC".  This breaks navigation in
any album imported from G2 that has a descending sort order.

Two things:
1) Use "ASC"/"DESC" in G2 import for consistency
2) Make Item_Model::get_position() more robust against capitalization

Fixes ticket #1334.
2010-09-07 21:04:38 -07:00
Bharat Mediratta
2f810ec126 Add "web_url" with the url to the web version of the item. Fixes ticket #1341. 2010-09-06 19:28:34 -07:00
Bharat Mediratta
3ff91e5e33 Null out Item_Model::$data_file in Item_Model::save() when we're
creating a new item, else the item_created event will trigger
subsequent saves which will think that they need to post an
item_updated_data_file event.  Partial fix for #1286
2010-08-25 10:05:21 -07:00
Bharat Mediratta
dbe595f15e Always use the data resource to return thumbs, resizes and full sizes.
That way the client does not have to differentiate between RESTful
request types and raw request types.  If there's a public raw url,
return that as well.
2010-08-14 16:10:32 -07:00
Bharat Mediratta
9de371e1b3 Use the data_rest implementation to proxy access to raw
thumb/resize/full data files when permissions are in play.
2010-08-09 22:55:58 -07:00
Bharat Mediratta
dfb095a262 Add the ability to replace the source data file in Item_Model::save().
Refactor the rotate code in Quick_Controller to replace the data file,
and then have gallery_event::item_updated_data_file() pick up after
the change is saved, rebuild the image and handle album covers.  This
is much more portable than before and it will allow any mechanism (eg:
REST) to replace the source image.
2010-08-07 22:18:28 -07:00
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