Commit Graph
128 Commits
Author SHA1 Message Date
Jozef Selesi b63ea2cdbf - All comments of an item can now be seen /comments?item_id=
- Return proper Content-Type header for GET /comments requests
- Got rid of the query processing for index() in REST_Controller()
- Small misc fixes
2008-11-18 15:48:08 +00:00
Bharat Mediratta d4fc15f76c Fix a typo in the text MPTT link 2008-11-18 09:07:46 +00:00
Bharat Mediratta d8225e44c4 Fix a typo user_id -> owner_id 2008-11-18 09:03:49 +00:00
Jozef Selesi 3ebb751cda First iteration of REST controller refactoring. RESTful controllers that refer to collections should now have plural names and there should be only one controller per resource. Updated existing classes that implement REST_Controller. The routing now works like this:
GET    /controller    -> controller::_index()
POST   /controller    -> controller::_create()
GET    /controller/id -> controller::_show()
PUT    /controller/id -> controller::_update()
DELETE /controller/id -> controller::_delete()
GET    /form/edit/controller/resource_id -> controller::_form()
GET    /form/add/controller/data         -> controller::_form()
2008-11-18 08:28:32 +00:00
Bharat Mediratta c91e90406b Add output formats to our REST controllers. Add support for JSON and
XML to the comment controllers as a proof of concept.  It's not fully
baked; we should examine ways to create helpers to make this process
easier.
2008-11-17 00:30:18 +00:00
Bharat Mediratta b6de985922 Handle _method in either GET or POST 2008-11-16 19:22:27 +00:00
Bharat Mediratta 5d14531af9 Drop the call to render() and just use the View's __toString method to
print it out.
2008-11-16 19:12:01 +00:00
Bharat Mediratta bcb2230a6b Remove a @todo 2008-11-16 10:19:01 +00:00
Bharat Mediratta 4610fc8e7f Create Forge::add_rules_from() which pulls validation rules from the model and
associates them with the form.  This replaces the various _add_validation_rules()
functions in the user and comment modules.

Move user edit form into user helper for consistency with the comment module.

Implement missing _form method in the user controller.
2008-11-16 07:51:42 +00:00
Bharat Mediratta e3be3cecf5 Second half of renaming the tags module. Change all occurrences of
gTags to gTag in the CSS.
2008-11-16 07:20:58 +00:00
Bharat Mediratta e87a37b855 Rename 'tags' module to 'tag' for consistency of pluralization 2008-11-16 07:17:29 +00:00
Bharat Mediratta 140736a1e4 Several large changes:
1) Changed the way that we get forms.  Now, if you want to get a form
   for a REST resource you prefix /form to the resource id.  So:
    /form/photo/1    : returns a form for editing photo id 1
    /form/comments/1 : returns a form for adding a comment to photo id 1
    /form/comment/1  : returns a form for editing comment id 1

2) Changed the comment module to have two controllers:
    comment:  deals with a single comment resource
    comments: deal with collections of comments attached to an item

Related stuff:
- Moved the comments js into the theme
- Reworked Comment_Helper for clarity
- Moved form generation code down into Comment_Helper
- Cleaned up routes (eliminating new comment ones added in recent rev)
- Added form() function to all REST controllers
- Changed comment module to use a block instead of an arbitrary helper call from the theme
- Comment controller only returns HTML currently, but returns a 201 Created status
  code when a new comment is added, which the Ajax code can catch and act upon.
- Got rid of a lot of extra views in comment module
2008-11-16 07:14:12 +00:00
Tim Almdal be67187ad9 Create MY_Forge to specify the defaul html 2008-11-16 06:43:31 +00:00
Felix Rabinovich f27929e126 create a regular user and make scaffolding assign owner to logged in user 2008-11-16 05:46:42 +00:00
Jozef Selesi f9eaa8c220 Initial add comment implementation. 2008-11-15 16:52:23 +00:00
Bharat Mediratta e901d613bf Add Theme::module() and module::get() 2008-11-15 09:08:18 +00:00
Bharat Mediratta db6061096e Item / Owner changes.
* Hardcode the item has_one owner relationship again
* Overload User_Model::__get to handle missing owners gracefully
* Fix Item_Controller to take the owner_id from the session or
  from the parent album when adding new albums and photos.
2008-11-15 08:44:01 +00:00
Felix Rabinovich 6dbf5ae172 Clean user / item relationship. Upload files gets the ownership of current user; and the views don't break if user module is not installed 2008-11-15 08:19:14 +00:00
Bharat Mediratta ae7839ffaa Revise the user login code.
* Remove user registration link and popup from the theme; this
  shouldn't be done in a popup. Use ajaxform to simplify the way
  that we load the login popup.

* Create form.html.php, this is a template for Forge based forms.

* Move user validation rules into User_Model and let forms
  populate the rules into their forms as useful.

* Undo r18688's changes regarding the REST code.  We should never
  accept a null resource, this breaks the REST abstraction.

* Change login and user controllers to use Forge which lets us delete
  login.html.php and user.html.php since those now are generated by
  the theme-owned form template
2008-11-15 06:23:09 +00:00
Tim Almdal e0ec9dd76a Allow the HTTP get method to be called without an id to create any empty template. 2008-11-14 16:51:11 +00:00
Tim Almdal b5f48e4ab3 Use the shortform to load the resource. 2008-11-14 07:30:47 +00:00
Bharat Mediratta 0fe8d44472 Create module helper and refactor all the code that creates, updates
and deletes modules into it.
2008-11-13 10:38:28 +00:00
Jozef Selesi 56dcb953b0 Code cleanup, add test for time formatting function. 2008-11-12 15:43:05 +00:00
Bharat Mediratta 453e15f502 Throw an exception when we can't upload a file. This is not the best solution, but it works for now. 2008-11-12 10:11:05 +00:00
Felix Rabinovich 7423c755c0 aliasing owner to user 2008-11-12 08:30:55 +00:00
Bharat Mediratta 51c64f1d28 Create a simple benchmark that loads 500 localized messages and performs
500 localizations on them.
2008-11-12 00:05:47 +00:00
Bharat Mediratta fd4faa89e6 Override View_Core::render so that we trap errors stemming from bad
PHP includes and show a visible stack trace to help developers.
2008-11-11 23:07:30 +00:00
Bharat Mediratta a15c7cb11f Change the PUT/DELETE tunneling param from __action to _method
to be like Rails.
2008-11-11 13:11:20 +00:00
Bharat Mediratta ee413f5f39 Updated for recent Item_Controller API change 2008-11-11 13:00:11 +00:00
Jozef Selesi 1651b3fe85 Move scaffolding code out of the comments controller to welcome.php. 2008-11-11 12:20:20 +00:00
Tim Almdal bba5289035 Change Album and Photo controllers to set the user object as a global variable; change the header so it links to the user controllers; and add the user controllers which don't do anything. 2008-11-11 07:39:20 +00:00
Bharat Mediratta 87f1115113 Change REST API to use non-routable functions: _get(), _post(),
_put(), _delete().

This should make it more obvious that these are not your typical
routes, simplifies overall routing by removing a rule and removes the
possibility of accidentally leaking information if we route to one of
them by accident.
2008-11-11 07:29:48 +00:00
Bharat Mediratta d35f337b7b Add phpdocs to explain how to use REST_Controller 2008-11-11 06:24:30 +00:00
Tim Almdal 9f261213a5 Reset PasswordHash.php to its original state and exclude it from the file_structure_test 2008-11-11 06:21:21 +00:00
Bharat Mediratta dae36c2aa4 Create REST_Controller abstract base class for all REST based resource
controllers.  Any controller that wants to act RESTful can extend this
class and implement get/post/put/delete.

Tweak default routes to disallow direct access to the REST controller
and direct access to any REST methods.
2008-11-11 06:18:45 +00:00
Bharat Mediratta ffa39aabb9 Manually delete the auth table and module entry to ease transitions for devs. 2008-11-10 21:55:27 +00:00
Jozef Selesi ddf0a51900 Comment creation controller, helper and test. Add comments from the scaffold. 2008-11-10 17:32:04 +00:00
Tim Almdal 359e28a50f Remove Auth module 2008-11-10 16:45:06 +00:00
Tim Almdal d4415d0d3e Reset the links in the header and update the readme 2008-11-10 16:36:56 +00:00
Bharat Mediratta 7a1b2b0ca7 Add a test to make sure that we have no windows-style line endings. 2008-11-10 15:33:55 +00:00
Bharat Mediratta ceb0782233 Add support for multi-file-upload using jquery.MultiFile and modify
Item_Controller to accept it.
2008-11-10 12:28:58 +00:00
Tim Almdal 8858b957b0 The start of the login functionality. It shows the login popup but doesn't do anything else. Just got tire of my changes being clobbered :-) 2008-11-10 03:17:56 +00:00
Bharat Mediratta c2162a645a Clean up HTML for adding albums/photos a tad. 2008-11-10 00:34:02 +00:00
Bharat Mediratta b5f2443bb5 Add the ability to create albums to the scaffolding
Revert $_POST back to $this->input->post() because that supports default values.
2008-11-10 00:25:59 +00:00
Bharat Mediratta 085ba7cd46 Tests for Item_Controller 2008-11-10 00:16:41 +00:00
Bharat Mediratta c054b4de04 Convert quote styles
Convert $this->input->post to $_POST
2008-11-10 00:16:03 +00:00
Bharat Mediratta 223cba531e Rename tests to make room for controller tests
Album_Test -> Album_Helper_Test
  Photo_Test -> Photo_Helper_Test
2008-11-09 23:49:09 +00:00
Bharat Mediratta e7155c09c5 Implement Item_Controller::put() and delete()
Adjust/simplify photo::create
Add image uploading to the scaffolding
2008-11-09 23:40:28 +00:00
Bharat Mediratta 25dd0bbf1c style fix 2008-11-09 23:29:05 +00:00
Jozef Selesi 24decb7fa4 Beginnings of the comment module. Install and uninstall. 2008-11-09 22:57:55 +00:00