diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-11-10 00:25:59 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-11-10 00:25:59 +0000 |
commit | b5f2443bb53b802366d1f76c80beebef70129e3f (patch) | |
tree | 9bc38839d37cefd60f9906a065b5aef0e88ccda2 | |
parent | 49f3794894fb591afd1009a6ad0a6f31cc10d066 (diff) |
Add the ability to create albums to the scaffolding
Revert $_POST back to $this->input->post() because that supports default values.
-rw-r--r-- | core/controllers/item.php | 12 | ||||
-rw-r--r-- | core/views/welcome.html.php | 12 |
2 files changed, 20 insertions, 4 deletions
diff --git a/core/controllers/item.php b/core/controllers/item.php index f047e810..38049380 100644 --- a/core/controllers/item.php +++ b/core/controllers/item.php @@ -67,13 +67,19 @@ class Item_Controller extends Controller { switch ($this->input->post("type")) { case "album": $new_item = album::create( - $item->id, $_POST["name"], $_POST["title"], $_POST["description"]); + $item->id, + $this->input->post("name"), + $this->input->post("title", $this->input->post("name")), + $this->input->post("description")); break; case "photo": $new_item = photo::create( - $item->id, $_FILES["file"]["tmp_name"], $_FILES["file"]["name"], - $_POST["title"], $_POST["description"]); + $item->id, + $_FILES["file"]["tmp_name"], + $_FILES["file"]["name"], + $this->input->post("title", $this->input->post("name")), + $this->input->post("description")); break; } diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php index 19001db6..d4015a91 100644 --- a/core/views/welcome.html.php +++ b/core/views/welcome.html.php @@ -155,12 +155,22 @@ </p> <form method="post" action="<?= url::site("album/1") ?>" enctype="multipart/form-data"> <p> - Upload: <input name="file" type="file"/> + Upload: + <input name="file" type="file"/> <input type="hidden" name="type" value="photo"/> <input type="hidden" name="__action" value="put"/> <input type="submit"/> </p> </form> + <form method="post" action="<?= url::site("album/1") ?>"> + <p> + Create Album: + <input type="text" name="name"/> + <input type="hidden" name="type" value="album"/> + <input type="hidden" name="__action" value="put"/> + <input type="submit"/> + </p> + </form> </div> <div id="info" class="activity"> |