summaryrefslogtreecommitdiff
path: root/modules/gallery/helpers
AgeCommit message (Collapse)Author
2010-01-20Throw Rest exceptions, not regular exceptions.Bharat Mediratta
2010-01-20Forbidden is a 403, not a 503.Bharat Mediratta
2010-01-19Change "filename" to "name" in the edit album form. I'd rather haveBharat Mediratta
consistency between field names than deal with underlying issues with Forge bitching about the "name" property.
2010-01-19Change "dirname" to "name" in the edit album form. I'd rather haveBharat Mediratta
consistency between field names than deal with underlying issues with Forge bitching about the "name" property.
2010-01-19Use property_exists() on our stdClass instead of array_key_exists()Bharat Mediratta
2010-01-19Change rest::url() to take a module name and a resource. The moduleBharat Mediratta
does the rest. This function is symmetrical to rest::resolve.
2010-01-19Make scope default to direct.Bharat Mediratta
Add slug to the post params. Fix minor output bug.
2010-01-19Don't try to set the album cover for the grandparent if we don't have edit ↵Bharat Mediratta
permissions for it.
2010-01-19Return arrays instead of calling rest::reply.Bharat Mediratta
2010-01-18Merge branch 'master' into bharat_devBharat Mediratta
2010-01-18Switch from stdClass to arrays which works around issues caused inBharat Mediratta
http://dev.kohanaphp.com/issues/2459 -- I don't exactly know why, but the solutions are equivalent so I'm not going to dig too far.
2010-01-18Change DENY and ALLOW to "0" and "1" to match the fact that ORM noBharat Mediratta
longer typecasts values as of http://dev.kohanaphp.com/issues/2459
2010-01-18Overload url::current() and url::merge() to make the current url XSSBharat Mediratta
safe. Add tests to make sure that it doesn't relapse with future Kohana changes. Fixes ticket #983. Ref: http://gallery.menalto.com/node/93738
2010-01-17Change IdentityProvider::create_user() to take $email as well, since that's ↵Bharat Mediratta
a required parameter for the Gallery driver.
2010-01-17Remove a @todo.Bharat Mediratta
2010-01-17Adjust installers to work with model based validation.Bharat Mediratta
2010-01-16Convert Movies_Controller::update() over to model based validation.Bharat Mediratta
2010-01-16Make movie creation use model based validation. Move movie relatedBharat Mediratta
logic from movie::create() into Item_Model
2010-01-16Oops, log::failure() doesn't exist. Use log::error().Bharat Mediratta
2010-01-16Convert Photos_Controller::update() to use model based validation.Bharat Mediratta
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-15Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_devBharat 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-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-11Remove the automatically marking the resizes dirty line as this could cause ↵Tim Almdal
alot of pain to some installations
2010-01-11Fixes ticket #671.Tim Almdal
In the graphics_rules table height and width set the maximum height and width values and should be equal. Initially, the height on the resize target rule was less than the height, which artificially constrained images in portrait mode. **Note"" this fix requires an upgrade to version 22. All the resizes will be flagged dirty.
2010-01-10Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_devBharat Mediratta
2010-01-09Fix for ticket #972 and more. In Kohana 2.4, ORM::delete_all ignores any whereTim Almdal
clauses and deletes all the entries in the table unless an array of id's are passed as the parameter. This fix used the Database_builder to specify any where conditions. Thanks psvo for find the first one. :-)
2010-01-08Move the random image functionality into the gallery REST helper sinceBharat Mediratta
choosing a random image is essentially a function on an item collection. Also implemented a bunch of other query filters for item collections. Created item::random_query() as a way of generating a reasonable starting point for random queries.
2010-01-08Remove debug code.Bharat Mediratta
2010-01-08Add item::random() to return a random Item_Model.Bharat Mediratta
2010-01-08Allow the "name" param in get() so that you can restrict the query to ↵Bharat Mediratta
children with a given name.
2010-01-07Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_devBharat Mediratta
2010-01-05Improve REST tag support.Bharat Mediratta
- Add support for retrieving a list of members from a collection - Implement put(), post() and delete() for tags. - Use tag_rest::delete() as a way to remove members from the tag collection
2010-01-04Further progress on refining the REST server side code.Bharat Mediratta
1) Deal in fully qualified URL resources through the rest interface. All rest methods are now passed the complete url in request->url. 2) Create rest::resolve() which lets individual resource definition code convert a full url into the appropriate matching resource. Implement gallery_rest::resolve() and tag_rest::resolve() 3) Reimplement tag_rest's get() and post() methods. They're much simpler now. 4) Implement the tags_rest helper which supports working with the entire tags collection.
2010-01-04Fix the logout link to send you back to the current url. The oldBharat Mediratta
approach depended on having an $item, which is not the case on all pages (eg: tag pages). Also, check the CSRF in the logout controller, else you can use the logout link as a blind forwarder.
2010-01-03Simplify the REST API code. Here's what I did:Bharat Mediratta
1) Simplify gallery_rest to return flat models, no children and do no validation for now. 2) Flatten the REST replies and use HTTP codes to indicate success/failure instead of additional status messages. 3) Use the message and error code support in the base Exception class, instead of brewing our own in Rest_Exception. 4) Get rid of rest::success() and rest::fail() -- we only need rest::reply() since all failures are covered by throwing an exception. 5) Get rid of /rest/access_key and just use /rest for authentication. 6) Inline and simplify rest::normalize_request since we only use it once 7) Change rest::set_active_user to succeed or throw an exception 8) Extract Rest_Exception::sendHeaders into rest::send_headers() Here's what's currently broken: 1) Data validation. There currently is none 2) Logging. That's gone too 3) image block and tag code is broken 4) Tests are broken 5) No movie support
2010-01-02Remove the Rest_Exception::trigger method.Tim Almdal
2009-12-31Merge branch 'master' into talmdal_devTim Almdal
2009-12-31A more thorough fix for #745 and #940. Stop using the referer toBharat Mediratta
guess how to send the user back. Instead, proxy the originating item id through the edit forms so that we can tell exactly what page we were on when we began editing. If we were viewing the item, then redirect to its new url (in case it changed) to fix ticket #745. But if we were viewing some other item, then just stay on the current page to fix #940. The page_type approach didn't work because you'd have the same "collection" page_type when doing a context menu edit for an album.
2009-12-31Create a Rest_Exception class and use it to convey status to the client ↵Tim Almdal
instead of calling rest::forbidden and other rest helper error messages.
2009-12-31Change the gallery_rest::_validate() method to use the form rules in ↵Tim Almdal
Item_Model. Change the Duplicate errors to sentence case. And generally clean up the flow in _validate().
2009-12-301) Remove the rest::not_found method and replace it with "throw new ↵Tim Almdal
Kohana_404_Exception 2) Don't use the input path to lookup the item via relative_path_cache. Instead use url::get_item_from_uri method.
2009-12-30Rollback the refactoring of the update into a helper method. Also remove the ↵Tim Almdal
refactoring for check for commits
2009-12-30Merge branch 'master' into talmdal_devTim Almdal
2009-12-29Another holdover from the K2.4 conversion. In R2.4 the url::current(true) ↵Tim Almdal
was returning an empty string. This fixes ticket #955.
2009-12-27Clean up validation the check for duplicate names or slugs, finish ↵Tim Almdal
converting the rest API to Kohana 2.4
2009-12-26Forgot to commit local changes to item helper for K2.4Tim Almdal
2009-12-26Merge branch 'master' into talmdal_devTim Almdal
Conflicts: modules/gallery/controllers/albums.php modules/gallery/controllers/movies.php modules/gallery/controllers/photos.php