summaryrefslogtreecommitdiff
path: root/modules/gallery/models
AgeCommit message (Collapse)Author
2010-01-16Make movie creation use model based validation. Move movie relatedBharat Mediratta
logic from movie::create() into Item_Model
2010-01-16Check for illegal extensions in valid_name()Bharat Mediratta
Fix a bug where we were not calling valid_data_file correctly.
2010-01-16Convert photo uploading over to the new model based validationBharat Mediratta
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-16Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_devBharat Mediratta
Conflicts: modules/gallery/models/item.php
2010-01-16Don't pass MY_ORM::original() to update event handlers, since afterBharat Mediratta
parent::save() it'll be reset. Clone it first. This is an alternate fix for #978.
2010-01-15Validate the model type.Bharat Mediratta
2010-01-15Move model business logic out of album::create() and intoBharat Mediratta
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-15Move setting Item_Model::rand_key into Item_Model::save() since it'sBharat Mediratta
business logic.
2010-01-15Use $value in valid_xxx() functions instead of the member field. They're ↵Bharat Mediratta
equivalent, but it's more intuitive this way.
2010-01-14Begin the process of converting to model based validation. RightBharat Mediratta
now only Albums_Controller::update() supports the pattern. All form and controller based validation happening when editing an album has been moved over. Model based validation means that our REST controllers share the same validation as web controllers. We'll have consistency enforced at the model level, which is a Good Thing. The basic pattern is now: 1) Rules are in the model 2) ORM::validate() (which is called by ORM::save() but you can call it directly, too) checks the model for all the rules and throws an ORM_Validation_Exception if there are failures 3) Actions are no longer taken when you call Item_Model::__set(). Instead, they're all queued up and executed when you call Item_Model::save(). Notes: - item::validate_xxx() functions are now in Item_Model:: - We still call $form->validate() because the form can have rules (and forms triggered by events will likely continue to have rules.
2010-01-04Change uppercase NULL to lowercase null to match the gallery3 style guideTim Almdal
2010-01-04Another K2.4 holder over... We had, when checking for position, ->where(, ↵Tim Almdal
"=", NULL) which would never find any. It should have been ->where(, "is", NULL)
2010-01-02Add a cache buster to the resize and file urls. This fixes ticketBharat Mediratta
2010-01-02Take precautions against deleting var/albums, var/thumbs or var/resizes.Bharat Mediratta
Fixes ticket #916.
2009-12-22The default value for $offset should always be null (according to theBharat Mediratta
new K24 ORM). Fix up a bad where tuple in the test.
2009-12-18Convert a database query.Bharat Mediratta
2009-12-16Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_devBharat Mediratta
2009-12-16Adjust for the fact that movies have JPG thumbnails. Fixes ticketBharat Mediratta
2009-12-13Convert some database calls.Bharat Mediratta
2009-11-26Convert some more Database::instance() calls to db::build() form.Bharat Mediratta
2009-11-26ORM::find_all() now uses null as the default value for offset.Bharat Mediratta
2009-11-26Overload Database_Builder to add merge_where() which takes predefinedBharat Mediratta
where clauses and adds them to the existing query. Update all existing queries that take an additional where clause to use it.
2009-11-26Convert all DB where() calls to take 3 arguments.Bharat Mediratta
Convert all open_paren() calls to and_open() or or_open() as appropriate.
2009-11-26ORM::$rules now has a special meaning. Use $form_rules for ourBharat Mediratta
internal rules code.
2009-11-25ORM::orderby -> ORM::order_byBharat Mediratta
2009-11-25Preliminary work to cut over to Kohana 2.4Bharat Mediratta
- Kohana::log() -> Kohana_Log::add() - Kohana::config_XXX -> Kohana_Config::instance()->XXX - Implement View::set_global in MY_View - Updated Cache_Database_Driver to latest APIs - ORM::$loaded -> ORM::loaded() - Updated item::viewable() to use K2.4 parenthesization
2009-11-06Make sure the position method works for both ascending and descending sort ↵Tim Almdal
orders.
2009-11-04Modified the so that a where clause can be passed into item::get_position. ↵Tim Almdal
Was also able to remove the sub-select from the calculation of the current position as we already have the child item containing the sort column value. Also added a where clause that ignores albums to the get_position, children and children_count method calls in photos.php and movies.php
2009-10-30Log an alert when we can't load a user.Bharat Mediratta
2009-10-27Refix #812, by removing the decoding in file_proxy instead of not encoding ↵Tim Almdal
in Item_Model when creating the relative_path_cache.
2009-10-27Don't url encode the components of the relative_path_cache as we they refer ↵Tim Almdal
to file paths and they are converted back in the file proxy. Fixes ticket #812
2009-10-24Merge branch 'master' into talmdal_devTim Almdal
2009-10-24When an item is renamed or move insure that the target file name doesn't ↵Tim Almdal
exist. fixes ticket #694
2009-10-22Change the name of identity library from Identity to IdentityProvider. ↵Tim Almdal
Create a helper class called identity to simplify call the Identity Provider. Move the contents of MY_Session.php to the new helper class and remove the MY_Session class
2009-10-16Start simplifying the interface by moving the static methods from user.php ↵Tim Almdal
and group.php. Tried creating a identity helper, but the helper identity.php was confused with the library Identity.php. So got around this by making the methods on Identity static and calling the instance within the static methods. Also temporarily moved the user.php and group.php back into the user module.
2009-10-09Convert direct lookups for the user table using ORM to using the ↵Tim Almdal
user::lookup_by_name and user_lookup API methods. Convert the Admin_User controller Convert the login and password change controller Change the item model to call user::lookup to get the owner. On the log model, delete the relationship between the log and user table, and replace with a call to user::lookup (cherry picked from commit 194cc3b27a73afe5119da9f09407c1e068dc6fa3) Create the get_user_list, lookup_by_name, lookup_by_hash and get_group_list api functions
2009-10-11Make the slug field required for all items.Bharat Mediratta
Make the filename field required for photos/movies. Fixes ticket #838
2009-10-08Merge branch 'master' of git@github.com:gallery/gallery3 into talmdal_devTim Almdal
2009-10-05First pass on converting calls to the Identity interface. Will worry about ↵Tim Almdal
writes and saves later. Convert the Admin_User controller Convert the login and password change controller Change the item model to call user::lookup to get the owner. On the log model, delete the relationship between the log and user table, and replace with a call to user::lookup
2009-10-04Renamed most, if not all css selectors from gName to g-name. Moved a few ↵Chad Kieffer
shared images from wind to lib. Deleted unused images in the admin_wind. This will likely break a few ajax features.
2009-09-21Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_devBharat Mediratta
Conflicts: modules/gallery/controllers/albums.php
2009-09-212nd attempt at gracefully dealing with sort columns that containBharat Mediratta
nulls. This time around, do a query to determine whether or not the sort column has nulls in it. If it doesn't, then use our comparators as before. There are NULLs in the sort column, so we can't use MySQL comparators. Fall back to iterating over every child row to get to the current one. This can be wildly inefficient for really large albums, but it should be a rare case that the user is sorting an album with null values in the sort column. Fixes #627
2009-09-21Fix Item_Model::get_position() so that our sort is stable when the comparisonBharat Mediratta
row has a null value in the sort field. Fix for #627 Note: this changes get_position() to take an Item_Model instead of an id!
2009-09-11rawurlencode() path components in relative_path_cache andBharat Mediratta
relative_url_cache so that they're safe for browser use.
2009-09-08Change the relative_path_cache and relative_url_cache columns to storeBharat Mediratta
urlencoded data for ease of use when we're dealing with the data. This fixes ticket #569 by not allowing the urls that we put into our RSS feeds to have bad characters in them. We have to convert a path like var/albums/foo/"quotes"/bar.jpg into something like var/albums/foo/%22quotes%22/bar.jpg. If we take the approach of storing native data in the cache, then we have to explode the path, urlencode the bits, and implode it again to avoid escaping the / char. By storing it escaped, we avoid this problem. I believe (but have not tested) that this is more efficient.
2009-09-08Minor tweaks to the url refactor.Bharat Mediratta
2009-09-08Move specialized (pretty) url generation back into Item_Model so thatBharat Mediratta
we're not relying on overriding url::site() to do tricks around item urls. This means that you won't get item urls by doing url::site("albums/37"), for example, but it also means that we won't get pretty urls where we don't expect them (like in the action of a <form> element). Incidentally, this will help us move over to using the slug format because if you've got a bad character in a url, the edit forms will now work on it since they'll be id based.
2009-09-07Update Item_Model::save() to consider the relative_xxx_cache fields asBharat Mediratta
insignificant, in addition to the view_count field. This means that we won't trigger an event, nor will we adjust the updated field if *only* those fields are changed.
2009-09-071. Actually set the slug to the new value in the controllers.Bharat Mediratta
2. Fix up an issue where we were crashing if there were no conflicting rows 3. Amend Item_Model so that if you change the slug, it flushes the cache for all children
2009-09-07Correct a mental mistake in the prior change. All the xxx_url()Bharat Mediratta
methods actually refer to the url to the file on disk, not the logical item. That's relative_url(). Perhaps some API renaming is in order?