diff --git a/multifile.inc b/multifile.inc index 4e7e88359078e867456dbabca3e31164e02974ee..fdb162b9a88acdb5f0c4d1ce34deb58165490732 100644 --- a/multifile.inc +++ b/multifile.inc @@ -342,9 +342,9 @@ function theme_webform_edit_multifile($variables) { * Implementation of _webform_render_component(). */ function _webform_render_multifile($component, $value = NULL, $filter = TRUE) { - drupal_add_js(drupal_get_path('module', 'webform_multifile') .'/multifile/jquery.MultiFile.js'); - drupal_add_js(drupal_get_path('module', 'webform_multifile') .'/webform_multifile.js', array('scope' => 'footer')); - $id = 'MultiFile-identifier-'. str_replace('_', '-', $component['form_key']); + drupal_add_js(drupal_get_path('module', 'webform_multifile') . '/multifile/jquery.MultiFile.js'); + drupal_add_js(drupal_get_path('module', 'webform_multifile') . '/webform_multifile.js', array('scope' => 'footer')); + $id = 'MultiFile-identifier-' . str_replace('_', '-', $component['form_key']); $component['extra']['attributes']['class'][] = 'form-item multi ' . $id; $node = node_load($component['nid']); @@ -363,14 +363,14 @@ function _webform_render_multifile($component, $value = NULL, $filter = TRUE) { 'js' => array( "(function ($) { \n" . // Stores all the settings for each field in an array so the javascript files can load later - " if (typeof MultiFile_fields == 'undefined') {MultiFile_fields = []} \n". - " MultiFile_fields.push(\n {\n id :'$id',\n properties : {\n". + " if (typeof MultiFile_fields == 'undefined') {MultiFile_fields = []} \n" . + " MultiFile_fields.push(\n {\n id :'$id',\n properties : {\n" . " max:" . $component['extra']['max_amount'] . ",\n" . - " accept:'" . join('|', $current_types) . "',\n STRING: {\n". - " remove:'" . t('Remove') . "',\n". - " denied:'" . t('You are kindly asked not to submit !ext files in this form.', array('!ext' => '$ext')) . "',\n". - " duplicate:'" . t('The file !file has already been selected and will be uploaded once you submit this form.', array('!file' => '$file')) . "'\n". - " }\n". + " accept:'" . join('|', $current_types) . "',\n STRING: {\n" . + " remove:'" . t('Remove') . "',\n" . + " denied:'" . t('You are kindly asked not to submit !ext files in this form.', array('!ext' => '$ext')) . "',\n" . + " duplicate:'" . t('The file !file has already been selected and will be uploaded once you submit this form.', array('!file' => '$file')) . "'\n" . + " }\n" . " }\n }\n );\n}) (jQuery);" => array('type' => 'inline'), ) ), diff --git a/webform_multifile.install b/webform_multifile.install index c81a2d6b968ce79ec6277c74c6f7be0bcf1300b3..77d2da223d03bdbe0bd379ea2c39a79124e65d19 100644 --- a/webform_multifile.install +++ b/webform_multifile.install @@ -1,4 +1,8 @@ join('webform_component', 'wc', 'wsd.cid = wc.cid'); $multifile_scan = $q->fields('wsd')->condition('wc.type', 'multifile', '=')->execute(); $submission_id = $submission_uid = NULL; - while($multifile_row = $multifile_scan->fetchAssoc()) { - $file_ids = unserialize($multifile_row['data']); - if (in_array($target_document->fid, $file_ids) ) { - $submission_id = $multifile_row['sid']; - } + while ($multifile_row = $multifile_scan->fetchAssoc()) { + $file_ids = unserialize($multifile_row['data']); + if (in_array($target_document->fid, $file_ids) ) { + $submission_id = $multifile_row['sid']; + } } if ($submission_id) { $submission_uid = db_select('webform_submissions', 'ws')->fields('ws', array('uid'))->condition('sid', $submission_id, '=')->execute()->fetchObject();