summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/controllers/albums.php10
-rw-r--r--core/helpers/album.php13
-rw-r--r--core/models/item.php2
-rw-r--r--core/views/welcome.html.php1
4 files changed, 26 insertions, 0 deletions
diff --git a/core/controllers/albums.php b/core/controllers/albums.php
index ec5466a6..e684fa6b 100644
--- a/core/controllers/albums.php
+++ b/core/controllers/albums.php
@@ -46,4 +46,14 @@ class Albums_Controller extends Items_Controller {
print $template;
}
+
+ /**
+ * @see Rest_Controller::_form_add($parameters)
+ */
+ public function _form_add($parent_id) {
+ $parent = ORM::factory("item", $parent_id);
+
+ print album::get_add_form($parent)->render();
+ }
+
}
diff --git a/core/helpers/album.php b/core/helpers/album.php
index dd62d693..3e77d521 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -58,4 +58,17 @@ class album_Core {
return $album;
}
+
+ static function get_add_form($parent) {
+ $form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
+ $group = $form->group(_("Add Album to {$parent->title}"));
+ $group->input("name");
+ $group->input("title");
+ $group->input("description");
+ $group->hidden("type")->value("album");
+ $group->submit(_("Create"));
+ $form->add_rules_from(ORM::factory("item"));
+ return $form;
+
+ }
}
diff --git a/core/models/item.php b/core/models/item.php
index 99a9c32a..9d23170f 100644
--- a/core/models/item.php
+++ b/core/models/item.php
@@ -21,6 +21,8 @@ class Item_Model extends ORM_MPTT {
protected $children = 'items';
protected $has_one = array("owner" => "user");
+ var $rules = array();
+
/**
* Is this item an album?
* @return true if it's an album
diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php
index 18effd55..262adcfc 100644
--- a/core/views/welcome.html.php
+++ b/core/views/welcome.html.php
@@ -150,6 +150,7 @@
}
</style>
<?= html::script("lib/jquery.js") ?>
+ <?= html::script("lib/jquery.form.js") ?>
<?= html::script("lib/jquery.cookie.js") ?>
<?= html::script("lib/jquery.MultiFile.js") ?>
<?= rearrange_block::head(null) ?>