summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Almdal <tnalmdal@shaw.ca>2009-11-10 12:49:13 -0800
committerTim Almdal <tnalmdal@shaw.ca>2009-11-10 12:49:13 -0800
commit9546e19e34d08e0d55f066f04149794e566c3539 (patch)
tree22e341a6e5e430b35d7d7b605587b9e06b8a375d
parentd8beb6f5301204cac3b74a827dbbc3082324de6f (diff)
Pass two of uploadify... remove the default.css file, removed the folder option and create a status area where succesful uploads are listed.
-rw-r--r--lib/uploadify/default.css10
-rw-r--r--lib/uploadify/expressInstall.swfbin727 -> 0 bytes
-rw-r--r--modules/gallery/controllers/simple_uploader.php9
-rw-r--r--modules/gallery/css/gallery.css51
-rw-r--r--modules/gallery/views/simple_uploader.html.php91
5 files changed, 53 insertions, 108 deletions
diff --git a/lib/uploadify/default.css b/lib/uploadify/default.css
deleted file mode 100644
index 2173d9ec..00000000
--- a/lib/uploadify/default.css
+++ /dev/null
@@ -1,10 +0,0 @@
-body {
- font: 12px/16px Arial, Helvetica, sans-serif;
-}
-#fileQueue {
- width: 400px;
- height: 300px;
- overflow: auto;
- border: 1px solid #E5E5E5;
- margin-bottom: 10px;
-} \ No newline at end of file
diff --git a/lib/uploadify/expressInstall.swf b/lib/uploadify/expressInstall.swf
deleted file mode 100644
index 0fbf8fca..00000000
--- a/lib/uploadify/expressInstall.swf
+++ /dev/null
Binary files differ
diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php
index 36464e24..bc508319 100644
--- a/modules/gallery/controllers/simple_uploader.php
+++ b/modules/gallery/controllers/simple_uploader.php
@@ -66,15 +66,6 @@ class Simple_Uploader_Controller extends Controller {
log::success("content", t("Added a photo"),
html::anchor("photos/$item->id", t("view photo")));
}
- $tags = $this->input->post("tags");
- if (!empty($tags)) {
- foreach (split(",", $tags) as $tag_name) {
- $tag_name = trim($tag_name);
- if ($tag_name) {
- $tag = tag::add($item, $tag_name);
- }
- }
- }
} catch (Exception $e) {
Kohana::log("alert", $e->__toString());
if (file_exists($temp_filename)) {
diff --git a/modules/gallery/css/gallery.css b/modules/gallery/css/gallery.css
index 077b21bc..066ab68a 100644
--- a/modules/gallery/css/gallery.css
+++ b/modules/gallery/css/gallery.css
@@ -56,15 +56,17 @@
/* Simple uploader ~~~~~~~~~~~~~~~~~~~~~~~ */
-#g-add-photos #SWFUpload_0 {
- left: 134px;
- position: relative;
- top: -200px;
+#g-add-photos-canvas {
+ border: 1px solid #ccc;
+ height: 200px;
+ margin: .5em 0;
+ overflow: auto;
+ width: 469px;
}
-#g-add-photos-canvas {
+#g-add-photos-status {
border: 1px solid #ccc;
- height: 325px;
+ height: 125px;
margin: .5em 0;
overflow: auto;
width: 469px;
@@ -76,30 +78,9 @@
margin-left: .5em;
}
-#g-uploadqueue-infobar {
- clear: both;
-}
-
-#g-uploadqueue-infobar #g-cancelupload {
- cursor: pointer;
- display: none;
-}
-
-#g-add-photos-queue .progressbar {
- height: 4px;
-}
-
-#g-add-photos-queue .status {
- font-size: .75em;
-}
-
-#g-add-photos-queue .box {
- padding: .2em;
-}
-
-#g-add-photos-queue .pending {
- background-color: #e8e8e8;
- border: 1px solid #d7d7d7;
+#g-add-photos-status td {
+ text-align: left;
+ padding-left: 2em;
}
#g-add-photos-queue .error {
@@ -107,16 +88,6 @@
border: 1px solid #ebb;
}
-#g-add-photos-queue .uploading {
- background-color: #ff9;
- border: 1px solid #ee8;
-}
-
-#g-add-photos-queue .complete {
- background-color: #cfc;
- border: 1px solid #beb;
-}
-
#g-add-photos p {
margin: 0
}
diff --git a/modules/gallery/views/simple_uploader.html.php b/modules/gallery/views/simple_uploader.html.php
index 014919c3..a84a3b00 100644
--- a/modules/gallery/views/simple_uploader.html.php
+++ b/modules/gallery/views/simple_uploader.html.php
@@ -5,12 +5,10 @@
$("#g-add-photos-canvas").ready(function () {
$("#g-uploadify").uploadify({
uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>",
- folder: "<?= url::file("var/uploads") ?>",
script: "<?= url::site("simple_uploader/add_photo/{$item->id}") ?>",
scriptData: <?= json_encode(array(
"g3sid" => Session::instance()->id(),
"user_agent" => Input::instance()->server("HTTP_USER_AGENT"),
- "tags" => "",
"csrf" => $csrf)) ?>,
fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.flv;*.mp4;*.GIF;*.JPG;*.JPEG;*.PNG;*.FLV;*.MP4",
fileDesc: <?= t("Photos and movies")->for_js() ?>,
@@ -31,6 +29,12 @@
.attr("disabled", "disabled");
return true;
},
+ onComplete: function(event, queueID, fileObj, response, data) {
+ $("#g-add-photos-status tbody").append(
+ "<tr class=\"g-success\"><td>" + fileObj.name + "</td><td>" +
+ Math.ceil(fileObj.size / 1000) + " KB" + "</td><td>" + Math.floor(data.speed) + " KB/s </td></tr>");
+ return true;
+ },
onSelect: function(event) {
if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) {
$("#g-upload-cancel-all")
@@ -40,15 +44,6 @@
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>
@@ -57,47 +52,45 @@
<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.",
+ <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 ?>
+ "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>
-
- <? 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 ($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;">
- <div id="g-uploadify"></div>
- </div>
+ <div id="g-uploadify"></div>
+ </div>
+ <div id="g-add-photos-status" style="text-align: center;">
+ <table>
+ <tbody>
+ </tbody>
+ </table>
+ </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()">
- <?= 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>
+ <!-- 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>