Commit Graph

259 Commits

Author SHA1 Message Date
Bharat Mediratta
5c49c041e7 Use "(string) $form" instead of "$form->__toString()" 2010-01-16 22:42:02 -08:00
Bharat Mediratta
8ce11ac970 Convert Movies_Controller::update() over to model based validation. 2010-01-16 12:07:36 -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
5a8449f16d Convert Photos_Controller::update() to use model based validation. 2010-01-16 11:12:27 -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
916da15cbb Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev 2010-01-15 13:36:16 -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
5809949ae8 Don't use Input directly to get album names, etc. Use the form fields. 2010-01-15 11:28:05 -08:00
Bharat Mediratta
b3e328c9ff Begin the process of converting to model based validation. Right
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-14 21:04:09 -08:00
Tim Almdal
260660b2f6 Somemore K24 migration holdovers. need to specify the where statement with operands. '=' is no longer assumed. Fixes ticket #979 2010-01-13 12:08:56 -08:00
Tim Almdal
2b283f4d01 Remove the translation submit button from translation search form. Fixes ticket #975 2010-01-11 13:26:10 -08:00
Tim Almdal
2ab6eda728 Change file proxy to url encode the path components instead of the entire path. Otherwise, we will encode the slashes and won't find the item. 2010-01-08 12:18:46 -08:00
Tim Almdal
58620c5faa Use rawurlencode to remove any encoding that the browser may have added. Fixes ticket #954. 2010-01-07 10:55:43 -08:00
Bharat Mediratta
6b8a52d328 Fix the logout link to send you back to the current url. The old
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-04 21:37:51 -08:00
Tim Almdal
cbf9754922 Send an empty Pragma header and use the item-updated time in the last-modified header 2010-01-04 09:10:12 -08:00
Bharat Mediratta
df001700dd Don't enable the rest module by default yet; we should make sure that
we do a more thorough security audit on it first.
2010-01-01 12:17:04 -08:00
Tim Almdal
c4ba5b6f65 Correct the sql so that the guest and admin passwords are actually blanked as part of the export 2010-01-01 09:54:10 -08:00
Bharat Mediratta
20bd09ff00 A more thorough fix for #745 and #940. Stop using the referer to
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-31 17:21:19 -08:00
Tim Almdal
55eeb8336f Change the file proxy to use the expires helper to manage content expiration. Fixes ticket #953. 2009-12-30 09:55:28 -08:00
Bharat Mediratta
057e8d09af Convert a bunch of leftover kohana::show_404 calls to throw
Kohana_404_Exception instead.  These are the ones where we used a
lower-case 'k' so my previous filter didn't catch it.
2009-12-23 20:51:33 -08:00
Bharat Mediratta
8b9a02084a Updates for the latest version of Kohana 2.4:
1) Controller::$input is gone -- use Input::instance() now
2) Handle new 'database.<default>.connection.params' parameter
3) Handle new 'cache.<default>.prefix' parameter
2009-12-21 21:27:43 -08:00
Bharat Mediratta
8883d1605a Convert some more database queries. 2009-12-17 21:16:37 -08:00
Bharat Mediratta
9b75b85e71 Update all database queries such that we can run "php index.php
package" and generate the same SQL as before.
2009-12-17 21:05:58 -08:00
Bharat Mediratta
c99a75b5d1 Improve the exception error message. 2009-12-17 09:16:44 -08:00
Bharat Mediratta
f431d7e12e Convert a database call. 2009-12-16 18:04:44 -08:00
Bharat Mediratta
86467363c2 Convert a database call. 2009-12-16 18:03:23 -08:00
Bharat Mediratta
9b3b9c6da6 Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev 2009-12-16 17:58:49 -08:00
Bharat Mediratta
b4a35a8e2c Show the right edit form for movies. 2009-12-16 09:37:28 -08:00
Bharat Mediratta
4566c299c1 Convert some database calls. 2009-12-16 09:24:38 -08:00
Bharat Mediratta
064a24b897 Convert a database call. 2009-12-13 17:15:59 -08:00
Bharat Mediratta
8ed47ceaad Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev 2009-12-06 19:17:02 -08:00
Bharat Mediratta
0bb742ef33 Use NULL instead of actual values in the vars table, so that var tweaks result in smaller diffs. 2009-12-05 21:21:08 -08:00
Bharat Mediratta
62693db037 Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev 2009-12-05 17:56:31 -08:00
Tim Almdal
267b3a1623 Make the rendering of the Theme Options page consistent between the first request and any errors 2009-12-04 13:48:52 -08:00
Bharat Mediratta
d2cb217e20 Convert more database calls over to the new format
- admin/maintenance page loads, the rebuild thumbs/resizes task works
- Fixed up some conversion bugs in the Cache driver
2009-12-02 00:34:34 -08:00
Bharat Mediratta
c803cb2909 Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev 2009-12-01 19:44:29 -08:00
Bharat Mediratta
6fa880777c Beter fix for #925. 2009-12-01 13:37:07 -08:00
Bharat Mediratta
f9ebe009c3 Use the real mime type for movies when we're requesting the full movie
instead of a thumbnail.  Fixes ticket #925, thanks to lsowen.
2009-12-01 13:34:40 -08:00
Bharat Mediratta
883fda313d Fix a typo that was breaking the home page (doh!)
$this->_show() -> $this->show()
2009-12-01 00:08:12 -08:00
Bharat Mediratta
852653ef24 Clean up item routing a bit.
1) The new default route is "albums", and Albums_Controller::index() does the right thing
2) Items_Controller redirects to the appropriate specific controller
3) All item controllers now have show() instead of _show(), so that
   the routing code in url::parse_url() can get to it.  But that code is protected against
   receiving bogus requests.
2009-11-30 13:57:50 -08:00
Bharat Mediratta
01bad461df Publish theme_edit_form and theme_edit_form_completed events so that themes can piggyback on the regular Admin > Appearance > Theme Options page. 2009-11-29 12:39:21 -08:00
Bharat Mediratta
53df0df0a4 Update a few more occurrences of ORM/Database -> Database_Builder 2009-11-29 02:48:42 -08:00
Bharat Mediratta
dee3ee81e2 Database::orwhere() is now Database_Builder::or_where() 2009-11-26 20:25:32 -08:00
Bharat Mediratta
54be15191b Overload Database_Builder to add merge_where() which takes predefined
where clauses and adds them to the existing query.  Update all
existing queries that take an additional where clause to use it.
2009-11-26 18:47:40 -08:00
Bharat Mediratta
1fd0e14359 Convert all DB where() calls to take 3 arguments.
Convert all open_paren() calls to and_open() or or_open() as appropriate.
2009-11-26 12:09:04 -08:00
Bharat Mediratta
0121bfd585 ORM::orderby -> ORM::order_by 2009-11-25 19:26:52 -08:00
Bharat Mediratta
60c20b0045 The html helpers no longer forces .js and .css suffixes to urls it generates (yay!) 2009-11-25 16:26:10 -08:00
Bharat Mediratta
4a417708f0 Kohana::show_404() -> throw new Kohana_404_Exception() 2009-11-25 13:51:33 -08:00
Bharat Mediratta
33b1d4b7ef Convert one more instance of ORM::$loaded to ORM::loaded() 2009-11-25 13:41:53 -08:00
Bharat Mediratta
f50dbd992d Merge branch 'master' of git@github.com:gallery/gallery3 into bharat_dev
Conflicts:
	modules/gallery/controllers/rest.php
2009-11-25 13:40:47 -08:00