summaryrefslogtreecommitdiff
path: root/modules/gallery/views
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-11-20 19:41:45 -0800
committerBharat Mediratta <bharat@menalto.com>2009-11-20 19:41:45 -0800
commit5e9bbbe490e40da103e0a7960312ab1c814dafa3 (patch)
tree641678d13204c4817edf5058a34b154becc5376f /modules/gallery/views
parent144c2fb61ee30e1168a6afe3b0332485d748d608 (diff)
Convert the Simple Uploader form over to Forge, and use the event
model to let the Tags module modify it. This brings it inline with our other module-extensible form based interactions.
Diffstat (limited to 'modules/gallery/views')
-rw-r--r--modules/gallery/views/form_uploadify.html.php (renamed from modules/gallery/views/simple_uploader.html.php)97
-rw-r--r--modules/gallery/views/form_uploadify_buttons.html.php8
2 files changed, 38 insertions, 67 deletions
diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/form_uploadify.html.php
index d23b89e0..7448db84 100644
--- a/modules/gallery/views/simple_uploader.html.php
+++ b/modules/gallery/views/form_uploadify.html.php
@@ -18,12 +18,8 @@
$("#g-add-photos-canvas").ready(function () {
$("#g-uploadify").uploadify({
uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>",
- script: "<?= url::site("simple_uploader/add_photo/{$item->id}") ?>",
- scriptData: <?= json_encode(array(
- "g3sid" => Session::instance()->id(),
- "tags" => "",
- "user_agent" => Input::instance()->server("HTTP_USER_AGENT"),
- "csrf" => $csrf)) ?>,
+ script: "<?= url::site("simple_uploader/add_photo/{$album->id}") ?>",
+ scriptData: <?= json_encode($script_data) ?>,
fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4",
fileDesc: <?= t("Photos and movies")->for_js() ?>,
cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>",
@@ -92,69 +88,36 @@
return true;
}
});
- <? if (module::active("tag")): ?>
- $('#g-add-photos-tags').autocomplete(
- '<?= url::site("tags/autocomplete") ?>',
- {max: 30, multiple: true, multipleSeparator: ',', cacheLength: 1}
- );
- $('#g-add-photos-tags').blur(function (event) {
- $("#g-uploadify").uploadifySettings("scriptData", {"tags": $(this).val()});
- });
- <? endif ?>
});
</script>
-<form id="g-add-photos-form" action="<?= url::site("simple_uploader/finish?csrf=$csrf") ?>">
- <fieldset>
- <legend>
- <?= t("Add photos to %album_title", array("album_title" => html::purify($item->title))) ?>
- </legend>
- </fieldset>
- <div id="g-add-photos">
- <? if (ini_get("suhosin.session.encrypt")): ?>
- <ul id="g-action-status" class="g-message-block">
- <li class="g-error">
- <?= t("Error: your server is configured to use the <a href=\"%encrypt_url\"><code>suhosin.session.encrypt</code></a> setting from <a href=\"%suhosin_url\">Suhosin</a>. You must disable this setting to upload photos.",
- array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt",
- "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?>
- </li>
- </ul>
- <? endif ?>
-
- <div>
- <p>
- <?= t("Photos will be uploaded to album: ") ?>
- </p>
- <ul class="g-breadcrumbs">
- <? foreach ($item->parents() as $i => $parent): ?>
- <li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li>
- <? endforeach ?>
- <li class="g-active"> <?= html::purify($item->title) ?> </li>
- </ul>
- </div>
-
- <div id="g-add-photos-canvas" style="text-align: center;">
- <a id="g-add-photos-button" class="ui-corner-all" style="padding-bottom: 1em;" href="#"><?= t("Select Photos...") ?></a>
- <span id="g-uploadify"></span>
- </div>
- <div id="g-add-photos-status" style="text-align: center;">
- <ul>
- </ul>
- </div>
+<? if (ini_get("suhosin.session.encrypt")): ?>
+<ul id="g-action-status" class="g-message-block">
+ <li class="g-error">
+ <?= t("Error: your server is configured to use the <a href=\"%encrypt_url\"><code>suhosin.session.encrypt</code></a> setting from <a href=\"%suhosin_url\">Suhosin</a>. You must disable this setting to upload photos.",
+ array("encrypt_url" => "http://www.hardened-php.net/suhosin/configuration.html#suhosin.session.encrypt",
+ "suhosin_url" => "http://www.hardened-php.net/suhosin/")) ?>
+ </li>
+</ul>
+<? endif ?>
- <? if (module::active("tag")): ?>
- <div style="clear: both;">
- <label for="g-add-photos-tags"><?= t("Add tags to all uploaded files") ?></label>
- <input type="text" id="g-add-photos-tags" name="tags" value="" />
- </div>
- <? endif ?>
+<div>
+ <p>
+ <?= t("Photos will be uploaded to album: ") ?>
+ </p>
+ <ul class="g-breadcrumbs">
+ <? foreach ($album->parents() as $i => $parent): ?>
+ <li<? if ($i == 0) print " class=\"g-first\"" ?>> <?= html::clean($parent->title) ?> </li>
+ <? endforeach ?>
+ <li class="g-active"> <?= html::purify($album->title) ?> </li>
+ </ul>
+</div>
- <!-- Proxy the done request back to our form, since its been ajaxified -->
- <button id="g-upload-done" class="ui-state-default ui-corner-all" onclick="$('#g-add-photos-form').submit();return false;">
- <?= t("Done") ?>
- </button>
- <button id="g-upload-cancel-all" class="ui-state-default ui-corner-all ui-state-disabled" onclick="$('#g-uploadify').uploadifyClearQueue();return false;" disabled="disabled">
- <?= t("Cancel All") ?>
- </button>
- </div>
-</form>
+<div id="g-add-photos-canvas" style="text-align: center;">
+ <a id="g-add-photos-button" class="ui-corner-all" style="padding-bottom: 1em;" href="#"><?= t("Select Photos...") ?></a>
+ <span id="g-uploadify"></span>
+</div>
+<div id="g-add-photos-status" style="text-align: center;">
+ <ul>
+ </ul>
+</div>
diff --git a/modules/gallery/views/form_uploadify_buttons.html.php b/modules/gallery/views/form_uploadify_buttons.html.php
new file mode 100644
index 00000000..d88bb6aa
--- /dev/null
+++ b/modules/gallery/views/form_uploadify_buttons.html.php
@@ -0,0 +1,8 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
+<!-- Proxy the done request back to our form, since its been ajaxified -->
+<button id="g-upload-done" class="ui-state-default ui-corner-all" onclick="$('#g-add-photos-form').submit();return false;">
+ <?= t("Done") ?>
+</button>
+<button id="g-upload-cancel-all" class="ui-state-default ui-corner-all ui-state-disabled" onclick="$('#g-uploadify').uploadifyClearQueue();return false;" disabled="disabled">
+ <?= t("Cancel All") ?>
+</button>