aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-11-19 23:13:26 -0500
committercash <cash.costello@gmail.com>2011-11-19 23:13:26 -0500
commitc51b483f24936c8d04a54a6999412937ec21c49a (patch)
treed45e3b9ede0115e3ce3b84ea1622bfc98d7470a0 /views
parent98664daa72a390fe760b69116af8bfa9327826e3 (diff)
downloadelgg-c51b483f24936c8d04a54a6999412937ec21c49a.tar.gz
elgg-c51b483f24936c8d04a54a6999412937ec21c49a.tar.bz2
uploading photos through the basic interface works now
Diffstat (limited to 'views')
-rw-r--r--views/default/forms/photos/basic_upload.php103
-rw-r--r--views/default/forms/photos/batch/edit.php32
-rw-r--r--views/default/forms/photos/batch/edit/image.php39
-rw-r--r--views/default/object/album/full.php5
-rw-r--r--views/default/tidypics/forms/edit_multi.php59
5 files changed, 112 insertions, 126 deletions
diff --git a/views/default/forms/photos/basic_upload.php b/views/default/forms/photos/basic_upload.php
index 55ab854a4..e4535814b 100644
--- a/views/default/forms/photos/basic_upload.php
+++ b/views/default/forms/photos/basic_upload.php
@@ -1,24 +1,22 @@
<?php
/**
- * Tidypics basic uploader form
+ * Basic uploader form
*
* This only handled uploading the images. Editing the titles and descriptions
* are handled with the edit forms.
*
- * @uses $vars['album']
+ * @uses $vars['entity']
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
*/
-global $CONFIG;
-
-$album = $vars['album'];
+$album = $vars['entity'];
$access_id = $album->access_id;
-$maxfilesize = (float) get_plugin_setting('maxfilesize','tidypics');
-if (!$maxfilesize) {
- $maxfilesize = 5;
-}
-
-$quota = get_plugin_setting('quota','tidypics');
+$maxfilesize = (float) elgg_get_plugin_setting('maxfilesize', 'tidypics');
+$quota = elgg_get_plugin_setting('quota', 'tidypics');
+/*
if ($quota) {
$image_repo_size_md = get_metadata_byname($album->container_guid, "image_repo_size");
$image_repo_size = (int)$image_repo_size_md->value;
@@ -34,16 +32,6 @@ if ($quota) {
$image_repo_size = $quota;
}
}
-
-?>
-<div id="tidypics_ref"></div>
-<div class="contentWrapper">
- <?php
- ob_start();
- ?>
- <p style="line-height:1.6em;">
- <label><?php echo elgg_echo("tidypics:uploader:upload"); ?></label><br />
- <i><?php echo sprintf(elgg_echo('tidypics:uploader:basic'), $maxfilesize); ?></i><br />
<?php
if ($quota) {
?>
@@ -51,54 +39,37 @@ if ($quota) {
<?php
}
?>
- <div class="tidypics_popup">
- <?php echo elgg_echo("tidypics:uploading:images"); ?><br />
- <div style="margin:20px 0px 20px 80px;"><img id="progress" alt="..." border="0" src="<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>" /></div>
- </div>
- <ol id="tidypics_image_upload_list">
- <?php
- for ($x = 0; $x < 10; $x++) {
- echo '<li>' . elgg_view("input/file",array('internalname' => "upload_$x")) . '</li>';
- }
- ?>
- </ol>
-</p>
-<p>
- <?php
- if ($album) {
- echo '<input type="hidden" name="album_guid" value="' . $album->guid . '" />';
- }
- if ($access_id) {
- echo '<input type="hidden" name="access_id" value="' . $access_id . '" />';
- }
- ?>
- <input type="submit" value="<?php echo elgg_echo("save"); ?>" onclick="displayProgress();" />
-</p>
-<?php
-$form_body = ob_get_clean();
-echo $form_body;
-?>
-</div>
-<script type="text/javascript">
+ *
+*/
- function displayProgress()
- {
- offsetY = 60;
- offsetX = 120;
+$instructions = elgg_echo("tidypics:uploader:upload");
+$max = elgg_echo('tidypics:uploader:basic', array($maxfilesize));
- divWidth = $('#tidypics_ref').width();
- imgOffset = $('#tidypics_ref').offset();
- imgWidth = $('#tidypics_ref').width();
+$list = '';
+for ($x = 0; $x < 10; $x++) {
+ $list .= '<li>' . elgg_view('input/file', array('name' => 'images[]')) . '</li>';
+}
- _top = imgOffset.top + offsetY;
- _left = imgOffset.left + offsetX;
+$foot = elgg_view('input/hidden', array('name' => 'guid', 'value' => $album->getGUID()));
+$foot .= elgg_view('input/submit', array('value' => elgg_echo("save")));
- $('.tidypics_popup').show().css({
- "top": _top + "px",
- "left": _left + "px"
- });
+$form_body = <<<HTML
+<div>
+ $max
+</div>
+<div>
+ <ol>
+ $list
+ </ol>
+</div>
+<div class='elgg-foot'>
+ $foot
+</div>
+HTML;
- setTimeout('document.images["progress"].src = "<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>"', 200);
- }
-</script> \ No newline at end of file
+echo elgg_view('input/form', array(
+ 'body' => $form_body,
+ 'action' => 'action/photos/image/upload',
+ 'enctype' => 'multipart/form-data',
+));
diff --git a/views/default/forms/photos/batch/edit.php b/views/default/forms/photos/batch/edit.php
new file mode 100644
index 000000000..fa017ac96
--- /dev/null
+++ b/views/default/forms/photos/batch/edit.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Edit properties on a batch of images
+ *
+ * @uses $vars['batch'] ElggObject
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$batch = $vars['batch'];
+$album = $batch->getContainerEntity();
+
+$images = elgg_get_entities_from_relationship(array(
+ 'type' => 'object',
+ 'subtype' => 'image',
+ 'relationship' => 'belongs_to_batch',
+ 'relationship_guid' => $batch->getGUID(),
+ 'inverse_relationship' => true,
+));
+
+echo '<ul>';
+foreach ($images as $image) {
+ echo '<li>';
+ echo elgg_view('forms/photos/batch/edit/image', array('entity' => $image));
+ echo '</li>';
+}
+echo '</ul>';
+
+echo '<div class="elgg-foot">';
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+echo '</div>';
diff --git a/views/default/forms/photos/batch/edit/image.php b/views/default/forms/photos/batch/edit/image.php
new file mode 100644
index 000000000..bf982ed84
--- /dev/null
+++ b/views/default/forms/photos/batch/edit/image.php
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Form component for editing a single image
+ *
+ * @uses $vars['entity']
+ *
+ * @author Cash Costello
+ * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2
+ */
+
+$image = $vars['entity'];
+
+echo '<div class="elgg-image-block">';
+
+echo '<div class="elgg-image">';
+echo elgg_view('output/img', array(
+ 'src' => $image->getSrcURL(),
+ 'alt' => $image->getTitle(),
+ 'class' => 'elgg-photo',
+));
+echo '</div>';
+
+echo '<div class="elgg-body"><fieldset class="mlm">';
+echo '<div><label>' . elgg_echo('album:title') . '</label>';
+echo elgg_view('input/text', array('name' => 'title[]', 'value' => $title,));
+echo '</div>';
+
+echo '<div><label>' . elgg_echo('caption') . '</label>';
+echo elgg_view('input/longtext', array('name' => 'caption[]'));
+echo '</div>';
+
+echo '<div><label>' . elgg_echo("tags") . '</label>';
+echo elgg_view('input/tags', array('name' => 'tags[]'));
+echo '</div>';
+
+echo elgg_view('input/hidden', array('name' => 'guid[]', 'value' => $image->getGUID()));
+echo '<fieldset></div>';
+
+echo '</div>';
diff --git a/views/default/object/album/full.php b/views/default/object/album/full.php
index 7484a48f3..4d2d8c88b 100644
--- a/views/default/object/album/full.php
+++ b/views/default/object/album/full.php
@@ -41,7 +41,10 @@ $params = array(
$params = $params + $vars;
$summary = elgg_view('object/elements/summary', $params);
-$body = elgg_list_entities(array(
+$body = elgg_view('output/longtext', array(
+ 'value' => $album->description,
+));
+$body .= elgg_list_entities(array(
'type' => 'object',
'subtype' => 'image',
'container_guid' => $album->getGUID(),
diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php
deleted file mode 100644
index aba6fd324..000000000
--- a/views/default/tidypics/forms/edit_multi.php
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-/**
- * form for mass editing all uploaded images
- */
-
-$images = $vars['images'];
-$album = get_entity($images[0]->container_guid);
-
-?>
-<div class="contentWrapper">
-<form action="<?php echo $vars['url']; ?>action/tidypics/edit_multi" method="post">
-<?php
-
- // make sure one of the images becomes the cover if there isn't one already
- if (!$album->getCoverImageGuid()) {
- $no_cover = true;
- }
-
- foreach ($images as $key => $image) {
- $guid = $image->guid;
- $body = $image->description;
- $title = $image->title;
- $tags = $image->tags;
-
- // first one is default cover if there isn't one already
- if ($no_cover) {
- $val = $guid;
- $no_cover = false;
- }
-
- echo '<div class="tidypics_edit_image_container">';
- echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" class="tidypics_edit_images" alt="' . $title . '"/>';
- echo '<div class="tidypics_image_info">';
- echo '<p><label>' . elgg_echo('album:title') . '</label>';
- echo elgg_view("input/text", array("internalname" => "title[$key]", "value" => $title,)) . "\n";
- echo '</p>';
- echo '<p><label>' . elgg_echo('caption') . "</label>";
- echo elgg_view("input/longtext",array("internalname" => "caption[$key]", "value" => $body, "class" => 'tidypics_caption_input',)) . "\n";
- echo "</p>";
- echo '<p><label>' . elgg_echo("tags") . "</label>\n";
- echo elgg_view("input/tags", array( "internalname" => "tags[$key]","value" => $tags)) . "\n";
- echo '</p>';
- echo '<input type="hidden" name="image_guid[' .$key. ']" value="'. $guid .'">' . "\n";
- echo elgg_view('input/securitytoken');
-
- echo elgg_view("input/radio", array("internalname" => "cover",
- "value" => $val,
- 'options' => array( elgg_echo('album:cover') => $guid,
- ),
- ));
- echo '</div>';
- echo '</div>';
- }
-
-?>
-<input type="hidden" name="container_guid" value="<?php echo $album->guid; ?>" />
-<p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
-</form>
-</div> \ No newline at end of file