Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
  • 13 commits
  • 11 files changed
  • 0 commit comments
  • 2 contributors
View
10 README.md
@@ -8,6 +8,16 @@ VWM Surveys is licensed under the [Apache 2 License](http://www.apache.org/licen
## Change Log
+### 0.3.6
+
+* Fixed datepicker so it should now work after Ajax requests
+* Now using textarea for question title
+* Fixed undefined index bug with checkbox and radio questions when compiling survey results
+
+### 0.3.5
+
+* Added URL encoding for checkbox, radio matrix, and radio question types
+
### 0.3.4
* Fixed MySQL default value bug for survey questions
View
5 css/mcp.css
@@ -47,7 +47,8 @@ Edit survey
display: none;
}
-.question_title input {
+.question_title textarea {
+ text-align: center;
color: #fff;
background-color: transparent;
margin: 0px;
@@ -57,7 +58,7 @@ Edit survey
text-shadow: 0px 1px 0px #666;
}
-.question_title input:focus {
+.question_title textarea:focus {
margin: 0px;
padding: 0px;
border: 0px;
View
20 helpers/vwm_checkboxes_helper.php
@@ -123,15 +123,21 @@ function vwm_checkboxes_compile_results($survey_id, $submission_id, $question_op
// Loop through each of the checked checkboxes
foreach ($question_data['selections'] as $selection)
{
- // Add +1 to our count for this option
- $compiled_data[ $selection['option'] ]['count']++;
-
- // If this selection has "other" text
- if ( isset($selection['other']) )
+ // Make sure this is a current option (removed options will be ignored)
+ if ( isset($compiled_data[ $selection['option'] ]['count']) )
{
- // Add this "other" text to the compiled data
- $compiled_data[ $selection['option'] ]['other'][ $submission_id ] = $selection['other'];
+ // Add +1 to our count for this option
+ $compiled_data[ $selection['option'] ]['count']++;
+
+ // If this selection has "other" text
+ if ( isset($selection['other']) )
+ {
+ // Add this "other" text to the compiled data
+ $compiled_data[ $selection['option'] ]['other'][ $submission_id ] = $selection['other'];
+ }
}
+
+
}
}
View
16 helpers/vwm_radios_helper.php
@@ -85,13 +85,17 @@ function vwm_radios_compile_results($survey_id, $submission_id, $question_option
$compiled_data[ $key ]['count'] = $count++;
}
- $compiled_data[ $question_data['option'] ]['count']++;
-
- // If this selection has "other" text
- if ( isset($question_data['other']) )
+ // Make sure this is a current option (removed options will be ignored)
+ if ( isset($compiled_data[ $question_data['option'] ]['count']) )
{
- // Add this "other" text to the compiled data
- $compiled_data[ $question_data['option'] ]['other'][ $submission_id ] = $question_data['other'];
+ $compiled_data[ $question_data['option'] ]['count']++;
+
+ // If this selection has "other" text
+ if ( isset($question_data['other']) )
+ {
+ // Add this "other" text to the compiled data
+ $compiled_data[ $question_data['option'] ]['other'][ $submission_id ] = $question_data['other'];
+ }
}
}
View
26 javascript/mcp.js
@@ -187,7 +187,7 @@ $('.toggle > a').click(function() {
/**
* jQuery UI datepicker for date question type
*/
-(function() {
+var datepicker = function datepicker() {
var datepickers = $('li.vwm_date .datepicker'); // All date question type datepickers
var date_format_selects = $('li.vwm_date select.vwm_date_format'); // All date question type date format selectors
@@ -214,7 +214,7 @@ $('.toggle > a').click(function() {
break;
}
- $(this).datepicker('destroy');
+ try { $(this).datepicker('destroy'); } catch (e) { /* Prevent JS error if cannot destroy */ }
$(this).datepicker({
dateFormat: date_format
@@ -229,7 +229,9 @@ $('.toggle > a').click(function() {
$(date_format_selects).live('change', function() {
update_date_format();
});
-})();
+
+ return datepicker;
+}();
/**
* Toggle select groups multiselect
@@ -267,4 +269,20 @@ $('form.edit_survey').live('submit', function(e) {
if ( $(':focus').hasClass('no_submit') ) {
e.preventDefault();
}
-});
+});
+
+/**
+ * Run cleanup function on Ajax complete!
+ */
+$(document).ajaxComplete(function() {
+ ajaxCleanup();
+});
+
+/**
+ * Run Ajax cleanup functions!
+ */
+var ajaxCleanup = function ajaxCleanup() {
+ datepicker();
+
+ return ajaxCleanup;
+}
View
2 upd.vwm_surveys.php
@@ -18,7 +18,7 @@
class Vwm_surveys_upd {
private $EE;
- public $version = '0.3.5';
+ public $version = '0.3.6';
/**
* Constructor
View
2 views/questions_edit/vwm_checkboxes_edit.php
@@ -3,7 +3,7 @@
<?php if (isset($options['checkboxes'])): ?>
<?php foreach($options['checkboxes'] as $key => $checkbox): ?>
<li>
- <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][checkboxes][<?php echo $key; ?>][text]" value="<?php echo $checkbox['text']; ?>"/>
+ <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][checkboxes][<?php echo $key; ?>][text]" value="<?php echo htmlspecialchars($checkbox['text'], ENT_QUOTES, 'UTF-8'); ?>"/>
<select name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][checkboxes][<?php echo $key; ?>][type]">
<?php if ($checkbox['type'] == 'defined'): ?>
<option value="defined" selected="selected">Defined</option>
View
4 views/questions_edit/vwm_radio_matrix_edit.php
@@ -4,7 +4,7 @@
<?php if (isset($options['x'])): ?>
<?php foreach ($options['x'] as $key => $option): ?>
<li>
- <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][x][<?php echo $key; ?>][text]" value="<?php echo $option['text']; ?>" />
+ <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][x][<?php echo $key; ?>][text]" value="<?php echo htmlspecialchars($option['text'], ENT_QUOTES, 'UTF-8'); ?>" />
<input type="button" class="remove" value="Remove" />
</li>
<?php endforeach; ?>
@@ -17,7 +17,7 @@
<?php if (isset($options['y'])): ?>
<?php foreach ($options['y'] as $key => $option): ?>
<li>
- <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][y][<?php echo $key; ?>][text]" value="<?php echo $option['text']; ?>" />
+ <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][y][<?php echo $key; ?>][text]" value="<?php echo htmlspecialchars($option['text'], ENT_QUOTES, 'UTF-8'); ?>" />
<input type="button" class="remove" value="Remove" />
</li>
<?php endforeach; ?>
View
2 views/questions_edit/vwm_radios_edit.php
@@ -3,7 +3,7 @@
<?php if (isset($options['radios'])): ?>
<?php foreach($options['radios'] as $key => $radio): ?>
<li>
- <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][radios][<?php echo $key; ?>][text]" value="<?php echo $radio['text']; ?>"/>
+ <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][radios][<?php echo $key; ?>][text]" value="<?php echo htmlspecialchars($radio['text'], ENT_QUOTES, 'UTF-8'); ?>"/>
<select name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][options][radios][<?php echo $key; ?>][type]">
<?php if ($radio['type'] == 'defined'): ?>
<option value="defined" selected="selected">Defined</option>
View
2 views/questions_results/vwm_radio_matrix_results.php
@@ -19,7 +19,7 @@
<p><?php echo $x_value['text']; ?> (<?php echo $results[ $y_key ][ $x_key ]['count']; ?> Votes)</p>
<div class="bar" style="width: <?php echo $percent; ?>%">
- <span><?php echo $percent; ?>%</span>
+ <span><?php echo round($percent, 1); ?>%</span>
</div>
</li>
<?php endforeach; ?>
View
2 views/vwm_question_template.php
@@ -1,7 +1,7 @@
<!-- Question title -->
<label class="question_title">
<span>Title:</span>
- <input type="text" name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][title]" value="<?php echo $question['title']; ?>" />
+ <textarea name="vwm_surveys_pages[<?php echo $page_number; ?>][questions][<?php echo $question_number; ?>][title]" cols="64" rows="3"><?php echo htmlspecialchars($question['title'], ENT_QUOTES, 'UTF-8'); ?></textarea>
</label>
<div class="question_controls">

No commit comments for this range

Something went wrong with that request. Please try again.