aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-15 16:07:56 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-15 16:07:56 +0000
commitdaaa8560a34a262c21db4e8a33b4e8c042042860 (patch)
tree78df68954640f0e26de98a0532c204dae6dca37b /views/default
parent61ac3361f35cfd5ea2b1f8a9be5b901607e54137 (diff)
downloadelgg-daaa8560a34a262c21db4e8a33b4e8c042042860.tar.gz
elgg-daaa8560a34a262c21db4e8a33b4e8c042042860.tar.bz2
Rolled in Kevin's file store enhancements and upload code.
git-svn-id: https://code.elgg.org/elgg/trunk@3211 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default')
-rw-r--r--views/default/js/upload_js.php53
-rw-r--r--views/default/upload/upload_form_content.php114
2 files changed, 167 insertions, 0 deletions
diff --git a/views/default/js/upload_js.php b/views/default/js/upload_js.php
new file mode 100644
index 000000000..389228e11
--- /dev/null
+++ b/views/default/js/upload_js.php
@@ -0,0 +1,53 @@
+<script>
+number_of_files = 1;
+
+// wait for the DOM to be loaded
+$(document).ready(function() {
+ // bind 'file_form' and provide a simple callback function
+ $('#file_form').submit(function() {
+ $('#form_container').hide();
+ $('#form_message').html('<div class="contentWrapper"><?php echo $vars['submit_message']; ?></div>');
+ $('#form_message').show();
+ $(this).ajaxSubmit(function(response_message) {
+ $('#form_message').html('<div class="contentWrapper">'+response_message+'</div>');
+ });
+
+ return false;
+ });
+});
+
+function file_generate_bit(bit_label,prefix,class,field_type,field_size) {
+ bit = document.createElement('p');
+ label = document.createElement('label');
+ textnode = document.createTextNode(bit_label);
+ label.appendChild(textnode);
+ el = document.createElement('br');
+ label.appendChild(el);
+ el = document.createElement('input');
+ el.type = field_type;
+ el.className = class;
+ if (field_size > 0) {
+ el.size = field_size;
+ }
+ el.name = prefix+number_of_files;
+ el.value = "";
+ label.appendChild(el);
+ bit.appendChild(label);
+
+ return bit;
+}
+
+function file_addtoform() {
+ var o,el;
+ o = document.getElementById('option_container');
+ title_label = "<?php echo elgg_echo("title"); ?>";
+ bit = file_generate_bit(title_label,'title_','input-text','text',0);
+ o.appendChild(bit);
+ file_label = "<?php echo elgg_echo("file:file"); ?>";
+ bit = file_generate_bit(file_label,'upload_','input-file','file',30);
+ o.appendChild(bit);
+
+ number_of_files++;
+ document.file_form.number_of_files.value = number_of_files;
+}
+</script> \ No newline at end of file
diff --git a/views/default/upload/upload_form_content.php b/views/default/upload/upload_form_content.php
new file mode 100644
index 000000000..c2476e7d8
--- /dev/null
+++ b/views/default/upload/upload_form_content.php
@@ -0,0 +1,114 @@
+<input type="hidden" name="number_of_files" value="1">
+<?php
+
+if (isset($vars['entity'])) {
+ $title = $vars['entity']->title;
+ $description = $vars['entity']->description;
+ $tags = $vars['entity']->tags;
+ $access_id = $vars['entity']->access_id;
+} else {
+ $title = "";
+ $description = "";
+ $tags = "";
+ $access_id = get_default_access();
+}
+
+$plugin = $vars['plugin'];
+
+if (!$vars['entity']) {
+
+?>
+ <div id="option_container">
+ <p>
+ <label><?php echo elgg_echo("title"); ?><br />
+ <?php
+
+ echo elgg_view("input/text", array(
+ "internalname" => "title_0"
+ ));
+
+ ?>
+ </label>
+ </p>
+ <p>
+ <label><?php echo elgg_echo("$plugin:file"); ?><br />
+ <?php
+
+ echo elgg_view("input/file",array('internalname' => 'upload_0'));
+
+ ?>
+ </label>
+ </p>
+ </div>
+ <p><input type="button" onclick="javascript:file_addtoform()" value="<?php echo elgg_echo("$plugin:add_to_form"); ?>"></p>
+<?php
+ } else {
+
+?>
+ <p>
+ <label><?php echo elgg_echo("title"); ?><br />
+ <?php
+
+ echo elgg_view("input/text", array(
+ "internalname" => "title",
+ "value" => $title,
+ ));
+
+ ?>
+ </label>
+ </p>
+<?php
+ }
+?>
+ <p class="longtext_editarea">
+ <label><?php echo elgg_echo("description"); ?><br />
+ <?php
+
+ echo elgg_view("input/longtext",array(
+ "internalname" => "description",
+ "value" => $description,
+ ));
+ ?>
+ </label>
+ </p>
+ <br />
+ <p>
+ <label><?php echo elgg_echo("tags"); ?><br />
+ <?php
+
+ echo elgg_view("input/tags", array(
+ "internalname" => "tags",
+ "value" => $tags,
+ ));
+
+ ?>
+ </label></p>
+<?php
+
+ $categories = elgg_view('categories',$vars);
+ if (!empty($categories)) {
+?>
+
+ <p>
+ <?php echo $categories; ?>
+ </p>
+
+<?php
+ }
+ echo elgg_view("$plugin/folders/select",$vars);
+?>
+ <p>
+ <label>
+ <?php echo elgg_echo('access'); ?><br />
+ <?php echo elgg_view('input/access', array('internalname' => 'access_id','value' => $access_id)); ?>
+ </label>
+ </p>
+
+<?php
+
+ if (isset($vars['container_guid']))
+ echo "<input type=\"hidden\" name=\"container_guid\" value=\"{$vars['container_guid']}\" />";
+ if (isset($vars['entity']))
+ echo "<input type=\"hidden\" name=\"file_guid\" value=\"{$vars['entity']->getGUID()}\" />";
+
+?>