diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/assets/javascript/plupload.js | 36 | ||||
-rw-r--r-- | phpBB/posting.php | 5 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/plupload.html | 1 |
3 files changed, 7 insertions, 35 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. * diff --git a/phpBB/posting.php b/phpBB/posting.php index 6066511d1c..902f1b2175 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -1548,8 +1548,9 @@ $template->assign_vars(array( 'S_BBCODE_QUOTE' => $quote_status, 'S_POST_ACTION' => $s_action, - 'S_HIDDEN_FIELDS' => $s_hidden_fields) -); + 'S_HIDDEN_FIELDS' => $s_hidden_fields, + 'S_ATTACH_DATA' => json_encode($message_parser->attachment_data), +)); /** * This event allows you to modify template variables for the posting screen diff --git a/phpBB/styles/prosilver/template/plupload.html b/phpBB/styles/prosilver/template/plupload.html index b7c6e42ab9..21acae1c44 100644 --- a/phpBB/styles/prosilver/template/plupload.html +++ b/phpBB/styles/prosilver/template/plupload.html @@ -61,6 +61,7 @@ phpbb.plupload = { }, order: '{ATTACH_ORDER}', maxFiles: {MAX_ATTACHMENTS}, + data: {S_ATTACH_DATA}, } //]]> </script> |