aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/assets/javascript
diff options
context:
space:
mode:
authorCesar G <prototech91@gmail.com>2013-12-18 19:23:14 -0800
committerCesar G <prototech91@gmail.com>2014-01-17 19:25:12 -0800
commitebc2d1dd1bd2a102ee8c8f1b134068e7a1f75c00 (patch)
tree7fee820c60db574ed58d85c5ad1445f74e686ce2 /phpBB/assets/javascript
parent9a21dec1b609db71bd9ed6b3b74c16d2d8418029 (diff)
downloadforums-ebc2d1dd1bd2a102ee8c8f1b134068e7a1f75c00.tar
forums-ebc2d1dd1bd2a102ee8c8f1b134068e7a1f75c00.tar.gz
forums-ebc2d1dd1bd2a102ee8c8f1b134068e7a1f75c00.tar.bz2
forums-ebc2d1dd1bd2a102ee8c8f1b134068e7a1f75c00.tar.xz
forums-ebc2d1dd1bd2a102ee8c8f1b134068e7a1f75c00.zip
[ticket/11915] Pass the data to the template instead of scraping HTML for it.
PHPBB3-11915
Diffstat (limited to 'phpBB/assets/javascript')
-rw-r--r--phpBB/assets/javascript/plupload.js36
1 files changed, 3 insertions, 33 deletions
diff --git a/phpBB/assets/javascript/plupload.js b/phpBB/assets/javascript/plupload.js
index f84a8b0a56..6b37b009a4 100644
--- a/phpBB/assets/javascript/plupload.js
+++ b/phpBB/assets/javascript/plupload.js
@@ -1,5 +1,5 @@
plupload.addI18n(phpbb.plupload.i18n);
-phpbb.plupload.data = phpbb.plupload.ids = [];
+phpbb.plupload.ids = [];
(function($) { // Avoid conflicts with other libraries
@@ -19,9 +19,8 @@ phpbb.plupload.initialize = function() {
// Show multi-file upload options.
$('#attach-panel-multi').show();
- // Gather existing attachment data from HTML.
- var data = phpbb.plupload.getDataFromHtml();
- phpbb.plupload.setData(data);
+ // Set attachment data.
+ phpbb.plupload.setData(phpbb.plupload.data);
phpbb.plupload.updateMultipartParams(phpbb.plupload.getSerializedData());
// Initialize the Plupload uploader.
@@ -85,35 +84,6 @@ phpbb.plupload.getSerializedData = function() {
};
/**
- * Grab all attachment data present in the HTML. This assumes
- * that all revelant data is present in form elements that have a name that follows
- * the naming convention of attachment_data[index][property]
- *
- * @return array An array containing all gathered data in the form of
- * array(index => object(property: value))
- */
-phpbb.plupload.getDataFromHtml = function() {
- var data = [],
- form = phpbb.plupload.form;
-
- for (var i = 0; i < form.length; i++) {
- if (form[i].name.indexOf('attachment_data[') !== 0) {
- continue;
- }
-
- var matches = form[i].name.match(/attachment_data\[(\d+)\]\[([^\]]+)\]/);
- var index = matches[1];
- var property = matches[2];
-
- if (typeof data[index] === 'undefined') {
- data[index] = {};
- }
- data[index][property] = form[i].value;
- }
- return data;
-};
-
-/**
* Get the index from the phpbb.plupload.data array where the given
* attachment id appears.
*