aboutsummaryrefslogtreecommitdiff
path: root/views/default/js
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2012-08-03 23:57:50 +0200
committerSem <sembrestels@riseup.net>2012-08-03 23:57:50 +0200
commit148b27d5d409a5f08e9e7f7e4a1b5adc8b3b2631 (patch)
treeed171f9ca115a37945bd75877557fc78d8fcde66 /views/default/js
parent8b359df98a438b4b7e053806d9230cf4f51dffe9 (diff)
parenta5f23d31518e5b8f00293fde8bc2fbdd481d574b (diff)
downloadelgg-148b27d5d409a5f08e9e7f7e4a1b5adc8b3b2631.tar.gz
elgg-148b27d5d409a5f08e9e7f7e4a1b5adc8b3b2631.tar.bz2
Merge branch 'jquery-uploader' of git://github.com/sembrestels/Tidypics
Diffstat (limited to 'views/default/js')
-rw-r--r--views/default/js/photos/upload.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/views/default/js/photos/upload.php b/views/default/js/photos/upload.php
new file mode 100644
index 000000000..82e2696bd
--- /dev/null
+++ b/views/default/js/photos/upload.php
@@ -0,0 +1,61 @@
+<?php
+/**
+ *
+ */
+
+$maxfilesize = (int) elgg_get_plugin_setting('maxfilesize', 'tidypics');
+$maxfilesize *= 1024;
+
+?>
+
+elgg.provide('elgg.tidypics.upload');
+
+elgg.tidypics.upload.init = function() {
+
+ window.locale = {
+ "fileupload": {
+ "error": elgg.echo('tidypics:upload:error'),
+ "errors": {
+ "maxFileSize": elgg.echo('tidypics:upload:maxfilesize'),
+ "minFileSize": elgg.echo('tidypics:upload:minfilesize'),
+ "acceptFileTypes": elgg.echo('tidypics:upload:acceptfiletypes'),
+ "maxNumberOfFiles": elgg.echo('tidypics:upload:maxnumberoffiles'),
+ },
+ }
+ };
+
+ $.widget('blueimpJUI.fileupload', $.blueimpUI.fileupload, {
+ _transition: function (node) {
+ var that = this,
+ deferred = $.Deferred();
+ if (node.hasClass('fade')) {
+ node.fadeToggle(function () {
+ deferred.resolveWith(node);
+ });
+ } else {
+ deferred.resolveWith(node);
+ }
+ return deferred;
+ },
+ });
+
+ // Initialize the jQuery File Upload widget:
+ $('#fileupload').fileupload();
+
+ // Settings
+ $('#fileupload').fileupload('option', {
+ maxFileSize: <?php echo $maxfilesize; ?>,
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
+ change: function() {
+ elgg.tidypics.upload.fileinput.hide().appendTo($('#fileupload'));
+ elgg.tidypics.upload.fileinput = $('#fileupload .elgg-input-file');
+ },
+ drop: function () {
+ return false;
+ }
+ });
+
+ elgg.tidypics.upload.fileinput = $('#fileupload .elgg-input-file');
+};
+
+elgg.register_hook_handler('init', 'system', elgg.tidypics.upload.init);