aboutsummaryrefslogtreecommitdiff
path: root/views/default/tidypics/forms
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-02-25 12:16:53 +0000
committerCash Costello <cash.costello@gmail.com>2009-02-25 12:16:53 +0000
commit4e0c1576475390faa2f1fb4c4dc2902a953f440e (patch)
treecd3a47df019344d7f6c938ebe31c60cfa9b03677 /views/default/tidypics/forms
downloadelgg-4e0c1576475390faa2f1fb4c4dc2902a953f440e.tar.gz
elgg-4e0c1576475390faa2f1fb4c4dc2902a953f440e.tar.bz2
First commit
Diffstat (limited to 'views/default/tidypics/forms')
-rw-r--r--views/default/tidypics/forms/edit.php115
-rw-r--r--views/default/tidypics/forms/edit_multi.php44
-rw-r--r--views/default/tidypics/forms/upload.php79
3 files changed, 238 insertions, 0 deletions
diff --git a/views/default/tidypics/forms/edit.php b/views/default/tidypics/forms/edit.php
new file mode 100644
index 000000000..efe4aa508
--- /dev/null
+++ b/views/default/tidypics/forms/edit.php
@@ -0,0 +1,115 @@
+<?php
+ /**
+ * Elgg images edit/add page
+ * This form is used to:
+ * - create albums
+ * - edit albums
+ * - edit images
+ */
+
+ //set stuff if we are editing existing album or image
+ if (isset($vars['entity'])) {
+ $title = sprintf(elgg_echo("album:edit"),$object->title);
+ $action = "tidypics/editalbum";
+ $title = $vars['entity']->title;
+ $body = $vars['entity']->description;
+ $tags = $vars['entity']->tags;
+ $access_id = $vars['entity']->access_id;
+ $subtype = $vars['subtype'];
+
+ // if nothing is sent, create new, but only new albums are sent here
+ // new images are sent to upload.php
+ } else {
+ $title = elgg_echo("album:add");
+ $action = "tidypics/addalbum";
+ $tags = "";
+ $title = "";
+ $description = "";
+ }
+
+ // in case we have some cached details
+ if (isset($vars['albumtitle'])) {
+ $title = $vars['albumtitle'];
+ $body = $vars['albumbody'];
+ $tags = $vars['albumtags'];
+ }
+
+ $container_guid = get_input('container_guid');
+ if (!$container_guid) $container_guid = page_owner();
+
+?>
+ <form action="<?php echo $vars['url']; ?>action/<?php echo $action; ?>" method="post">
+ <p>
+ <label><?php echo elgg_echo('album:title'); ?></label>
+ <?php echo elgg_view("input/text", array("internalname" => "albumtitle", "value" => $title,)); ?>
+ </p>
+<?php
+ if($vars['subtype'] == 'album' || $action == "tidypics/addalbum")
+ {
+?>
+ <p>
+ <label><?php echo elgg_echo('album:desc'); ?></label>
+ <?php echo elgg_view("input/text",array("internalname" => "albumbody","value" => $body,)); ?>
+ </p>
+<?php
+ } else {
+?>
+ <p>
+ <label><?php echo elgg_echo('caption'); ?></label>
+ <?php echo elgg_view("input/text",array("internalname" => "albumbody","value" => $body,)); ?>
+ </p>
+<?php
+ } //End album/image selection
+?>
+ <p>
+ <label><?php echo elgg_echo("tags"); ?></label>
+ <?php echo elgg_view("input/tags", array( "internalname" => "albumtags","value" => $tags,)); ?>
+ </p>
+
+ <?php
+
+ if($vars['subtype'] == 'image')
+ {
+ //if this is an image --
+ //ALBUM COVER: ask to set image to album cover ::
+ //ACCESS: only existing images come here :: so acess should already be initially set by album
+
+ $guid = $vars['entity']->guid;
+ $container_guid = $vars['entity']->container_guid;
+ $cover_guid = get_entity($container_guid)->cover;
+
+ if($cover_guid == $vars['entity']->guid)
+ $cover = 'yes';
+
+ ?>
+ <p>
+ <label><?php echo elgg_echo("album:cover"); ?></label>
+ <?php echo elgg_view("input/cover_checkbox", array( "internalname" => "cover", "value" => $cover, 'options' => array(elgg_echo('album:cover:yes')))); ?>
+ </p>
+ <p>
+ <label><?php echo sprintf(elgg_echo('access'), "$subtype"); ?></label>
+ <?php echo elgg_view('input/accessRead', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </p>
+ <?php echo elgg_echo('image:access:note');?>
+ <?php
+ }
+ else{
+ //this is a new or existing album, both of which access is editable
+ ?>
+ <p>
+ <label><?php echo sprintf(elgg_echo('access'), "$subtype"); ?></label>
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </p>
+
+ <?php
+ }
+
+ if (isset($vars['entity'])) {
+ ?>
+ <input type="hidden" name="albumpost" value="<?php echo $vars['entity']->getGUID(); ?>" />
+ <?php
+ }
+ ?>
+ <input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
+ <p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
+ </form> \ No newline at end of file
diff --git a/views/default/tidypics/forms/edit_multi.php b/views/default/tidypics/forms/edit_multi.php
new file mode 100644
index 000000000..252a660bd
--- /dev/null
+++ b/views/default/tidypics/forms/edit_multi.php
@@ -0,0 +1,44 @@
+<?php
+ /**
+ * form for mass editing all uploaded images
+ */
+?>
+<form action="<?php echo $vars['url']; ?>action/tidypics/edit_multi" method="post">
+<?php
+
+ $file_array = $vars['file_array'];
+ $album_entity = get_entity($vars['album_guid']);
+ if(!$album_entity->cover) $no_cover = true;
+
+ foreach($file_array as $key => $file_guid){
+ $entity = get_entity($file_guid);
+ $guid = $entity->guid;
+ $body = $entity->description;
+ $tags = $entity->tags;
+ $container_guid = $entity->container_guid;
+ if($no_cover && !$cover) $cover = $guid;
+
+ echo '<div class="edit_image_container">';
+ echo '<img src="' . $vars['url'] . 'mod/tidypics/thumbnail.php?file_guid=' . $guid . '&size=small" border="0" class="edit_images" alt="' . $title . '"/>';
+ echo '<div class="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/text",array("internalname" => "caption[$key]", "value" => $body,)) . "\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 '<label>' . elgg_echo("album:cover") . '</label>';
+ echo elgg_view("input/multi_radio", array( "internalname" => "cover", "value" => $guid, 'options' => array('yes'), 'set' => $cover));
+ echo '</div>';
+ echo '</div>';
+
+ }
+ echo elgg_echo('image:access:note');
+?>
+ <input type="hidden" name="container_guid" value="<?php echo $container_guid; ?>" />
+ <p><input type="submit" name="submit" value="<?php echo elgg_echo('save'); ?>" /></p>
+ </form> \ No newline at end of file
diff --git a/views/default/tidypics/forms/upload.php b/views/default/tidypics/forms/upload.php
new file mode 100644
index 000000000..35768f64c
--- /dev/null
+++ b/views/default/tidypics/forms/upload.php
@@ -0,0 +1,79 @@
+<?php
+ /**
+ * Elgg file browser uploader
+ *
+ * @package ElggFile
+ * @author Curverider Ltd
+ * @copyright Curverider Ltd 2008
+ * @link http://elgg.com/
+ */
+ global $CONFIG;
+
+ //this is for image uploads only. Image edits are handled by edit.php form
+
+ $container_guid = get_input('container_guid');
+ $access_id = get_entity($vars['album'])->access_id;
+ if (get_plugin_setting('maxfilesize','tidypics')) {
+ if (((int) get_plugin_setting('maxfilesize','tidypics')) < 1 || ((int) get_plugin_setting('maxfilesize','tidypics')) > 1048576) {
+ $maxfilesize = 10240; //if file size is less than 1KB or greater than 1GB, default to 10MB
+ } else {
+ $maxfilesize = (int) get_plugin_setting('maxfilesize','tidypics');
+ }
+ } else {
+ $maxfilesize = 10240; //if the file size limit is not set, default to 10MB
+ }
+
+?>
+<script language="javascript">
+<!--
+
+var state = 'none';
+
+function showhide(layer_ref) {
+ if (state == 'block') {
+ state = 'none';
+ }
+ else {
+ state = 'block';
+ }
+ if (document.all) { //IS IE 4 or 5 (or 6 beta)
+ eval( "document.all." + layer_ref + ".style.display = state");
+ }
+ if (document.layers) { //IS NETSCAPE 4 or below
+ document.layers[layer_ref].display = state;
+ }
+ if (document.getElementById &&!document.all) {
+ hza = document.getElementById(layer_ref);
+ hza.style.display = state;
+ }
+ return false;
+}
+//-->
+</script>
+<form action="<?php echo $vars['url']; ?>action/tidypics/upload" enctype="multipart/form-data" method="post">
+ <p style="line-height:1.6em;">
+ <label><?php echo elgg_echo("images:upload"); ?></label><br />
+ <i><?php echo elgg_echo("tidypics:settings:maxfilesize") . ' ' . $maxfilesize; ?></i><br />
+ <div align="center" class="tidypics_loader" id="tidypics_loader" name="tidypics_loader" style="display:none;"><center><img alt="..." border="0" src="<?php echo $vars['url'].'mod/tidypics/graphics/loader.gif' ?>" /></center></div>
+ <ol id="image_upload_list">
+<?php
+ for($x = 0; $x < 10; $x++){
+ echo '<li>' . elgg_view("input/file",array('internalname' => "upload_$x")) . "</li>\n";
+ }
+?>
+ </ol>
+ </p>
+
+ <label><?php echo sprintf(elgg_echo('access'), 'image'); ?></label>
+ <?php echo elgg_view('input/accessRead', array('internalname' => 'access_id','value' => $access_id)); ?>
+
+ <p>
+ <?php
+ if ($container_guid)
+ echo '<input type="hidden" name="container_guid" value="'.$container_guid.'" />';
+
+ ?>
+ <input type="submit" value="<?php echo elgg_echo("save"); ?>" onclick="showhide('tidypics_loader');" />
+ </p>
+
+</form> \ No newline at end of file