Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:gallery/gallery3
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Almdal committed Aug 31, 2010
2 parents 9bc84b6 + 5568ab2 commit 7819cc1
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 120 deletions.
230 changes: 124 additions & 106 deletions modules/gallery/views/form_uploadify.html.php
Expand Up @@ -2,126 +2,144 @@
<script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script>
<script type="text/javascript" src="<?= url::file("lib/uploadify/jquery.uploadify.min.js") ?>"></script>
<script type="text/javascript">
<? $flash_minimum_version = "9.0.24" ?>
$("#g-add-photos-canvas").ready(function () {
$("#g-uploadify").uploadify({
width: 150,
height: 33,
uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>",
script: "<?= url::site("uploader/add_photo/{$album->id}") ?>",
scriptData: <?= json_encode($script_data) ?>,
fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.GIF;*.JPG;*.JPEG;*.PNG<? if ($movies_allowed): ?>;*.flv;*.mp4;*.m4v;*.FLV;*.MP4;*.M4V<? endif ?>",
fileDesc: <?= t("Photos and movies")->for_js() ?>,
cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>",
simUploadLimit: <?= $simultaneous_upload_limit ?>,
wmode: "transparent",
hideButton: true, /* should be true */
auto: true,
multi: true,
onAllComplete: function(filesUploaded, errors, allbytesLoaded, speed) {
$("#g-upload-cancel-all")
.addClass("ui-state-disabled")
.attr("disabled", "disabled");
$("#g-upload-done")
.removeClass("ui-state-disabled")
.attr("disabled", null);
return true;
},
onClearQueue: function(event) {
$("#g-upload-cancel-all")
.addClass("ui-state-disabled")
.attr("disabled", "disabled");
$("#g-upload-done")
.removeClass("ui-state-disabled")
.attr("disabled", null);
return true;
},
onComplete: function(event, queueID, fileObj, response, data) {
var re = /^error: (.*)$/i;
var msg = re.exec(response);
if (msg) {
$("#g-add-photos-status ul").append(
"<li class=\"g-error\">" + fileObj.name + " - " + msg[1] + "</li>");
} else {
$("#g-add-photos-status ul").append(
"<li class=\"g-success\">" + fileObj.name + " - " + <?= t("Completed")->for_js() ?> + "</li>");
}
return true;
},
onError: function(event, queueID, fileObj, errorObj) {
var msg = " - ";
if (errorObj.type == "HTTP") {
if (errorObj.info == "500") {
msg += <?= t("Unable to process this file")->for_js() ?>;
// Server error - check server logs
} else if (errorObj.info == "404") {
msg += <?= t("The upload script was not found.")->for_js() ?>;
// Server script not found
} else {
// Server Error: status: errorObj.info
msg += (<?= t("Server error: __INFO__")->for_js() ?>.replace("__INFO__", errorObj.info));
}
} else if (errorObj.type == "File Size") {
var sizelimit = $("#g-uploadify").uploadifySettings(sizeLimit);
msg += fileObj.name+' '+errorObj.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB';
} else {
msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?>
.replace("__INFO__", errorObj.info)
.replace("__TYPE__", errorObj.type));
}
$("#g-add-photos-status ul").append(
"<li class=\"g-error\">" + fileObj.name + msg + "</li>");
$("#g-uploadify" + queueID).remove();
},
onSelect: function(event) {
if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) {
if (swfobject.hasFlashPlayerVersion("<?= $flash_minimum_version ?>")) {
$("#g-uploadify").uploadify({
width: 150,
height: 33,
uploader: "<?= url::file("lib/uploadify/uploadify.swf") ?>",
script: "<?= url::site("uploader/add_photo/{$album->id}") ?>",
scriptData: <?= json_encode($script_data) ?>,
fileExt: "*.gif;*.jpg;*.jpeg;*.png;*.GIF;*.JPG;*.JPEG;*.PNG<? if ($movies_allowed): ?>;*.flv;*.mp4;*.m4v;*.FLV;*.MP4;*.M4V<? endif ?>",
fileDesc: <?= t("Photos and movies")->for_js() ?>,
cancelImg: "<?= url::file("lib/uploadify/cancel.png") ?>",
simUploadLimit: <?= $simultaneous_upload_limit ?>,
wmode: "transparent",
hideButton: true, /* should be true */
auto: true,
multi: true,
onAllComplete: function(filesUploaded, errors, allbytesLoaded, speed) {
$("#g-upload-cancel-all")
.addClass("ui-state-disabled")
.attr("disabled", "disabled");
$("#g-upload-done")
.removeClass("ui-state-disabled")
.attr("disabled", null);
$("#g-upload-done")
return true;
},
onClearQueue: function(event) {
$("#g-upload-cancel-all")
.addClass("ui-state-disabled")
.attr("disabled", "disabled");
$("#g-upload-done")
.removeClass("ui-state-disabled")
.attr("disabled", null);
return true;
},
onComplete: function(event, queueID, fileObj, response, data) {
var re = /^error: (.*)$/i;
var msg = re.exec(response);
if (msg) {
$("#g-add-photos-status ul").append(
"<li class=\"g-error\">" + fileObj.name + " - " + msg[1] + "</li>");
} else {
$("#g-add-photos-status ul").append(
"<li class=\"g-success\">" + fileObj.name + " - " + <?= t("Completed")->for_js() ?> + "</li>");
}
return true;
},
onError: function(event, queueID, fileObj, errorObj) {
var msg = " - ";
if (errorObj.type == "HTTP") {
if (errorObj.info == "500") {
msg += <?= t("Unable to process this file")->for_js() ?>;
// Server error - check server logs
} else if (errorObj.info == "404") {
msg += <?= t("The upload script was not found.")->for_js() ?>;
// Server script not found
} else {
// Server Error: status: errorObj.info
msg += (<?= t("Server error: __INFO__")->for_js() ?>.replace("__INFO__", errorObj.info));
}
} else if (errorObj.type == "File Size") {
var sizelimit = $("#g-uploadify").uploadifySettings(sizeLimit);
msg += fileObj.name+' '+errorObj.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB';
} else {
msg += (<?= t("Server error: __INFO__ (__TYPE__)")->for_js() ?>
.replace("__INFO__", errorObj.info)
.replace("__TYPE__", errorObj.type));
}
$("#g-add-photos-status ul").append(
"<li class=\"g-error\">" + fileObj.name + msg + "</li>");
$("#g-uploadify" + queueID).remove();
},
onSelect: function(event) {
if ($("#g-upload-cancel-all").hasClass("ui-state-disabled")) {
$("#g-upload-cancel-all")
.removeClass("ui-state-disabled")
.attr("disabled", null);
$("#g-upload-done")
.addClass("ui-state-disabled")
.attr("disabled", "disabled");
}
return true;
}
return true;
}
});
});
} else {
$(".requires-flash").hide();
$(".no-flash").show();
}
});
</script>

<? if ($suhosin_session_encrypt || !$movies_allowed): ?>
<div class="g-message-block g-info">
<? if ($suhosin_session_encrypt): ?>
<p 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/")) ?>
</p>
<? endif ?>
<div class="requires-flash">
<? if ($suhosin_session_encrypt || !$movies_allowed): ?>
<div class="g-message-block g-info">
<? if ($suhosin_session_encrypt): ?>
<p 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/")) ?>
</p>
<? endif ?>

<? if (!$movies_allowed): ?>
<p class="g-warning">
<?= t("Can't find <i>ffmpeg</i> on your system. Movie uploading disabled. <a href=\"%help_url\">Help!</a>", array("help_url" => "http://codex.gallery2.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?>
</p>
<? if (!$movies_allowed): ?>
<p class="g-warning">
<?= t("Can't find <i>ffmpeg</i> on your system. Movie uploading disabled. <a href=\"%help_url\">Help!</a>", array("help_url" => "http://codex.gallery2.org/Gallery3:FAQ#Why_does_it_say_I.27m_missing_ffmpeg.3F")) ?>
</p>
<? endif ?>
</div>
<? endif ?>

<div>
<p>
<?= t("Photos will be uploaded to album: ") ?>
</p>
<ul class="g-breadcrumbs ui-helper-clearfix">
<? 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>

<div id="g-add-photos-canvas">
<button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos...") ?></button>
<span id="g-uploadify"></span>
</div>
<div id="g-add-photos-status">
<ul id="g-action-status" class="g-message-block">
</ul>
</div>
</div>
<? endif ?>

<div>
<div class="no-flash" style="display: none">
<p>
<?= t("Photos will be uploaded to album: ") ?>
<?= t("Your browser must have Adobe Flash Player version %flash_minimum_version or greater installed to use this feature.", array("flash_minimum_version" => $flash_minimum_version)) ?>
</p>
<ul class="g-breadcrumbs ui-helper-clearfix">
<? 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>

<div id="g-add-photos-canvas">
<button id="g-add-photos-button" class="g-button ui-state-default ui-corner-all" href="#"><?= t("Select photos...") ?></button>
<span id="g-uploadify"></span>
</div>
<div id="g-add-photos-status">
<ul id="g-action-status" class="g-message-block">
</ul>
<a href="http://www.adobe.com/go/getflashplayer">
<img src="<?= request::protocol() ?>://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt=<?= t("Get Adobe Flash Player")->for_js() ?> />
</a>
</div>
12 changes: 7 additions & 5 deletions modules/gallery/views/form_uploadify_buttons.html.php
@@ -1,8 +1,10 @@
<?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;">
<div class="requires-flash">
<!-- 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">
</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 uploads") ?>
</button>
</button>
</div>
14 changes: 5 additions & 9 deletions modules/organize/views/organize_dialog.html.php
@@ -1,10 +1,6 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript" src="<?= url::file("lib/swfobject.js") ?>"></script>
<style type="text/css" media="screen">
#flashContent {
//display:none;
}

.g-organize {
padding: 0;
margins: 0;
Expand All @@ -21,10 +17,10 @@
</style>

<script type="text/javascript">
$("#g-dialog").bind("dialogclose", function(event, ui) {
// @todo do a call to organize/closing to end the batch
window.location.reload();
});
$("#g-dialog").bind("dialogclose", function(event, ui) {
// @todo do a call to organize/closing to end the batch
window.location.reload();
});

function closeOrganizeDialog() {
$("#g-dialog").dialog("close");
Expand Down Expand Up @@ -130,7 +126,7 @@ function getGalleryParameters() {
<h1 style="display:none"><?= t("Organize :: %name", array("name" => html::purify($album->title))) ?></h1>
<div id="flashContent">
<p>
<?= t("To use the Organize feature, please ensure that Adobe Flash Player version %flash_minimum_version or greater is installed.", array("flash_minimum_version" => $flash_minimum_version)) ?>
<?= t("Your browser must have Adobe Flash Player version %flash_minimum_version or greater installed to use this feature.", array("flash_minimum_version" => $flash_minimum_version)) ?>
</p>
<a href="http://www.adobe.com/go/getflashplayer">
<img src="<?= request::protocol() ?>://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
Expand Down

0 comments on commit 7819cc1

Please sign in to comment.