summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle Sebreghts2012-06-22 13:06:26 (GMT)
committerJelle Sebreghts2012-06-22 13:06:26 (GMT)
commit1be83a7435541ef9afdc6e294100df7c39dfac55 (patch)
treecf83d2577df2641321ff0bb46d054c328e66d544
parentfa269b65ab2fc49662b621d4b6e5aad06ada48e4 (diff)
Coder review
-rw-r--r--multifile.inc20
-rw-r--r--webform_multifile.install4
-rw-r--r--webform_multifile.module14
3 files changed, 21 insertions, 17 deletions
diff --git a/multifile.inc b/multifile.inc
index 4e7e883..fdb162b 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 c81a2d6..77d2da2 100644
--- a/webform_multifile.install
+++ b/webform_multifile.install
@@ -1,5 +1,9 @@
<?php
/**
+ * @file Webform multifile install functions.
+ */
+
+/**
* Implements hook_requirements().
*/
function webform_multifile_requirements() {
diff --git a/webform_multifile.module b/webform_multifile.module
index ef0c5b1..7d7061d 100644
--- a/webform_multifile.module
+++ b/webform_multifile.module
@@ -1,7 +1,7 @@
<?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();