Commit 1be83a74 authored by Jelle_S's avatar Jelle_S

Coder review

parent fa269b65
......@@ -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'),
)
),
......
<?php
/**
* @file Webform multifile install functions.
*/
/**
* Implements hook_requirements().
*/
......
<?php
/**
* Implementation of hook_menu().
* Implements hook_menu().
*/
function webform_multifile_menu() {
$items[] = array();
......@@ -27,7 +27,7 @@ function webform_multifile_menu() {
}
/**
* Implementation of hook_webform_component_info().
* Implements hook_webform_component_info().
*/
function webform_multifile_webform_component_info() {
$components = array();
......@@ -74,11 +74,11 @@ function webform_multifile_file_download($uri) {
$q->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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment