summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/config/upload.php17
-rw-r--r--core/controllers/photos.php9
-rw-r--r--core/controllers/welcome.php14
-rw-r--r--core/helpers/album.php6
-rw-r--r--core/helpers/photo.php15
5 files changed, 47 insertions, 14 deletions
diff --git a/core/config/upload.php b/core/config/upload.php
new file mode 100644
index 00000000..9885ab32
--- /dev/null
+++ b/core/config/upload.php
@@ -0,0 +1,17 @@
+<?php defined('SYSPATH') or die('No direct access allowed.');
+/**
+ * @package Core
+ *
+ * This path is relative to your index file. Absolute paths are also supported.
+ */
+$config['directory'] = VARPATH.'uploads';
+
+/**
+ * Enable or disable directory creation.
+ */
+$config['create_directories'] = FALSE;
+
+/**
+ * Remove spaces from uploaded filenames.
+ */
+$config['remove_spaces'] = TRUE; \ No newline at end of file
diff --git a/core/controllers/photos.php b/core/controllers/photos.php
index 143c3bb8..7a599f4b 100644
--- a/core/controllers/photos.php
+++ b/core/controllers/photos.php
@@ -35,4 +35,13 @@ class Photos_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 photo::get_add_form($parent)->render();
+ }
}
diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php
index 7f1070ba..e61ae674 100644
--- a/core/controllers/welcome.php
+++ b/core/controllers/welcome.php
@@ -507,16 +507,8 @@ class Welcome_Controller extends Template_Controller {
$this->auto_render = false;
}
- public function _get_add_photo_html() {
- return '
- <fieldset>
- <legend>Photos</legend>
- <form method="post" action="' . url::site("albums/1") . '" enctype="multipart/form-data">
- <input type="submit" value="upload"/>
- <input id="photo_upload" name="file[]" type="file"/>
- <input type="hidden" name="type" value="photo"/>
- </form>
- </fieldset>
- ';
+ public function _get_add_photo_html($parent_id=1) {
+ $parent = ORM::factory("item", $parent_id);
+ return photo::get_add_form($parent);
}
}
diff --git a/core/helpers/album.php b/core/helpers/album.php
index d82f076b..3e3b6054 100644
--- a/core/helpers/album.php
+++ b/core/helpers/album.php
@@ -62,9 +62,9 @@ class album_Core {
static function get_add_form($parent) {
$form = new Forge("albums/{$parent->id}", "", "post", array("id" => "gAddAlbumForm"));
$group = $form->group(sprintf(_("Add Album to %s"), $parent->title));
- $group->input("name");
- $group->input("title");
- $group->input("description");
+ $group->input("name")->label(true);
+ $group->input("title")->label(true);
+ $group->input("description")->label(true);
$group->hidden("type")->value("album");
$group->submit(_("Create"));
$form->add_rules_from(ORM::factory("item"));
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index fc23c375..6d9887a4 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -82,4 +82,19 @@ class photo_Core {
return $result;
}
+
+ static function get_add_form($parent) {
+ $form = new Forge("albums/{$parent->id}", "", "post",
+ array("id" => "gAddPhotoForm", "enctype" => "multipart/form-data"));
+ $group = $form->group(sprintf(_("Add Photo to %s"), $parent->title));
+ $group->input("name")->label(true);
+ $group->input("title")->label(true);
+ $group->input("description")->label(true)->rules("length[0, 255");
+ $group->upload("file")->label(true)->rules("allow[jpg,png,gif,tiff]");
+ $group->hidden("type")->value("photo");
+ $group->submit(_("Upload"));
+ $form->add_rules_from(ORM::factory("item"));
+ return $form;
+ }
+
}