Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

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

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: concrete5/concrete5
base: 4dba1a04b3
...
head fork: concrete5/concrete5
compare: 9c389aee58
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 2 contributors
View
27 web/concrete/blocks/form/auto.js
@@ -18,11 +18,13 @@ var miniSurvey ={
$("#answerType").change(function(r) {
miniSurvey.optionsCheck($('#answerType').get(0));
miniSurvey.settingsCheck($('#answerType').get(0));
+ miniSurvey.replytoCheck($('#answerType').get(0));
});
$("#answerTypeEdit").change(function(r) {
miniSurvey.optionsCheck($('#answerTypeEdit').get(0), 'Edit');
miniSurvey.settingsCheck($('#answerTypeEdit').get(0), 'Edit');
+ miniSurvey.replytoCheck($('#answerTypeEdit').get(0), 'Edit');
});
$('#refreshButton').click( function(){ miniSurvey.refreshSurvey(); return false; } );
@@ -68,6 +70,12 @@ var miniSurvey ={
$('#answerSettings'+mode).css('display','block');
}else $('#answerSettings'+mode).css('display','none');
},
+ replytoCheck : function(radioButton,mode){
+ if(mode!='Edit') mode='';
+ if( radioButton.value=='email' ){
+ $('#answerReplyto'+mode).css('display','block');
+ }else $('#answerReplyto'+mode).css('display','none');
+ },
addQuestion : function(mode){
var msqID=0;
if(mode!='Edit') {
@@ -75,15 +83,17 @@ var miniSurvey ={
} else {
msqID=parseInt($('#msqID').val(), 10);
}
- var postStr='question='+encodeURIComponent($('#question'+mode).val())+'&options='+encodeURIComponent($('#answerOptions'+mode).val());
+ var formID = '#answerType'+mode;
+ answerType = $(formID).val();
+ var options = encodeURIComponent($('#answerOptions'+mode).val());
+ if (answerType == 'email') var options = $('#answerReplyto'+mode).find('input').first().prop('checked') ? 1 : 0;
+ var postStr='question='+encodeURIComponent($('#question'+mode).val())+'&options='+options;
postStr+='&width='+escape($('#width'+mode).val());
postStr+='&height='+escape($('#height'+mode).val());
var req = $('#required'+mode+' input[value=1]').prop('checked') ? 1 : 0;
postStr+='&required='+req;
postStr+='&position='+escape($('#position'+mode).val());
var form=document.getElementById('ccm-block-form');
- var formID = '#answerType'+mode;
- answerType = $(formID).val();
postStr+='&inputType='+answerType;//$('input[name=answerType'+mode+']:checked').val()
postStr+='&msqID='+msqID+'&qsID='+parseInt(this.qsID);
$.ajax({
@@ -153,15 +163,23 @@ var miniSurvey ={
$('#requiredEdit input[value=1]').prop('checked', false);
$('#requiredEdit input[value=0]').prop('checked', true);
}
+ if (jsonObj.inputType == 'email' && parseInt(jsonObj.optionVals, 10) == 1) {
+ $('#answerReplytoEdit input[value=1]').prop('checked', true);
+ $('#answerReplytoEdit input[value=0]').prop('checked', false);
+ } else {
+ $('#answerReplytoEdit input[value=1]').prop('checked', false);
+ $('#answerReplytoEdit input[value=0]').prop('checked', true);
+ }
$('#msqID').val(jsonObj.msqID);
$('#answerTypeEdit').val(jsonObj.inputType);
miniSurvey.optionsCheck($('#answerTypeEdit').get(0), 'Edit');
miniSurvey.settingsCheck($('#answerTypeEdit').get(0), 'Edit');
+ miniSurvey.replytoCheck($('#answerTypeEdit').get(0), 'Edit');
if(parseInt(jsonObj.bID)>0)
miniSurvey.edit_qID = parseInt(qID) ;
- scroll(0,165);
+ $('.miniSurveyOptions').first().closest('.ui-dialog-content').get(0).scrollTop = 0;
}
});
},
@@ -193,6 +211,7 @@ var miniSurvey ={
$('#height').val('3');
$('#msqID').val('');
$('#answerType').val('field').change();
+ $('#answerReplyto').hide();
$('#answerOptionsArea').hide();
$('#answerSettings').hide();
$('#required input').prop('checked', false);
View
44 web/concrete/blocks/form/controller.php
@@ -13,7 +13,7 @@ class FormBlockController extends BlockController {
protected $btExportTables = array('btForm', 'btFormQuestions');
protected $btExportPageColumns = array('redirectCID');
-
+ protected $helpers = array('form');
protected $lastAnswerSetId=0;
/**
@@ -265,7 +265,17 @@ function action_submit_form() {
$notCompleted=1;
}elseif( !strlen(trim($_POST['Question'.$row['msqID']])) ){
$notCompleted=1;
- }
+ }
+ if ($notCompleted) {
+ if (!isset($datetime)) {
+ $datetime = Loader::helper("form/date_time");
+ }
+ $translated = $datetime->translate('Question'.$row['msqID']);
+ if ($translated) {
+ $_POST['Question'.$row['msqID']] = $translated;
+ $notCompleted=0;
+ }
+ }
if($notCompleted) $errors['CompleteRequired'] = t("Complete required fields *") ;
}
}
@@ -324,7 +334,7 @@ function action_submit_form() {
$this->lastAnswerSetId=$answerSetID;
$questionAnswerPairs=array();
-
+ $this->sendEmailFrom = false;
//loop through each question and get the answers
foreach( $rows as $row ){
//save each answer
@@ -348,6 +358,9 @@ function action_submit_form() {
}elseif($row['inputType']=='email'){
$answerLong="";
$answer=$txt->sanitize($_POST['Question'.$row['msqID']]);
+ if ($this->sendEmailFrom === false && $row['options'] == '1') {
+ $this->sendEmailFrom = $answer;
+ }
}elseif($row['inputType']=='telephone'){
$answerLong="";
$answer=$txt->sanitize($_POST['Question'.$row['msqID']]);
@@ -385,13 +398,14 @@ function action_submit_form() {
}
if(intval($this->notifyMeOnSubmission)>0 && !$foundSpam){
-
- if( strlen(FORM_BLOCK_SENDER_EMAIL)>1 && strstr(FORM_BLOCK_SENDER_EMAIL,'@') ){
+ if ($this->sendEmailFrom !== false) {
+ $formFormEmailAddress = $this->sendEmailFrom;
+ } else if( strlen(FORM_BLOCK_SENDER_EMAIL)>1 && strstr(FORM_BLOCK_SENDER_EMAIL,'@') ){
$formFormEmailAddress = FORM_BLOCK_SENDER_EMAIL;
}else{
$adminUserInfo=UserInfo::getByID(USER_SUPER_ID);
$formFormEmailAddress = $adminUserInfo->getUserEmail();
- }
+ }
$mh = Loader::helper('mail');
$mh->to( $this->recipientEmail );
@@ -709,11 +723,11 @@ function loadSurvey( $qsID, $showEdit=false, $bID=0, $hideQIDs=array(), $showPen
<?php /* <div class="miniSurveyResponse"><?php echo $this->loadInputType($questionRow,$showEdit)?></div> */ ?>
<div class="miniSurveyOptions">
<div style="float:right">
- <a href="#" onclick="miniSurvey.moveUp(this,<?php echo $questionRow['msqID']?>);return false" class="moveUpLink"></a>
- <a href="#" onclick="miniSurvey.moveDown(this,<?php echo $questionRow['msqID']?>);return false" class="moveDownLink"></a>
+ <a href="javascript:void(0)" onclick="miniSurvey.moveUp(this,<?php echo $questionRow['msqID']?>);return false" class="moveUpLink"></a>
+ <a href="javascript:void(0)" onclick="miniSurvey.moveDown(this,<?php echo $questionRow['msqID']?>);return false" class="moveDownLink"></a>
</div>
- <a href="#" onclick="miniSurvey.reloadQuestion(<?=intval($questionRow['qID']) ?>);return false"><?php echo t('edit')?></a> &nbsp;&nbsp;
- <a href="#" onclick="miniSurvey.deleteQuestion(this,<?=intval($questionRow['msqID']) ?>,<?=intval($questionRow['qID'])?>);return false"><?= t('remove')?></a>
+ <a href="javascript:void(0)" onclick="miniSurvey.reloadQuestion(<?=intval($questionRow['qID']) ?>);return false"><?php echo t('edit')?></a> &nbsp;&nbsp;
+ <a href="javascript:void(0)" onclick="miniSurvey.deleteQuestion(this,<?=intval($questionRow['msqID']) ?>,<?=intval($questionRow['qID'])?>);return false"><?= t('remove')?></a>
</div>
<div class="miniSurveySpacer"></div>
</div>
@@ -725,6 +739,7 @@ function loadSurvey( $qsID, $showEdit=false, $bID=0, $hideQIDs=array(), $showPen
function loadInputType($questionData,$showEdit){
$options=explode('%%',$questionData['options']);
$msqID=intval($questionData['msqID']);
+ $datetime = loader::helper('form/date_time');
switch($questionData['inputType']){
case 'checkboxlist':
// this is looking really crappy so i'm going to make it behave the same way all the time - andrew
@@ -779,7 +794,14 @@ function loadInputType($questionData,$showEdit){
return '<input name="Question'.$msqID.'" id="Question'.$msqID.'" type="tel" value="'.stripslashes(htmlspecialchars($val)).'" />';
case 'email':
$val=($_REQUEST['Question'.$msqID])?$_REQUEST['Question'.$msqID]:'';
- return '<input name="Question'.$msqID.'" id="Question'.$msqID.'" type="email" value="'.stripslashes(htmlspecialchars($val)).'" />';
+ return '<input name="Question'.$msqID.'" id="Question'.$msqID.'" type="email" value="'.stripslashes(htmlspecialchars($val)).'" />';
+ case 'date':
+ $val=($_REQUEST['Question'.$msqID])?$_REQUEST['Question'.$msqID]:'';
+ return $datetime->date('Question'.$msqID,$val);
+ case 'datetime':
+ $val=($_REQUEST['Question'.$msqID])?$_REQUEST['Question'.$msqID]:'';
+ $out = '<input name="Question'.$msqID.'" id="Question'.$msqID.'" type="datetime" value="'.stripslashes(htmlspecialchars($val)).'" />';
+ return $out . $datetime->datetime('Question'.$msqID,$val);
case 'field':
default:
$val=($_REQUEST['Question'.$msqID])?$_REQUEST['Question'.$msqID]:'';
View
61 web/concrete/blocks/form/form_setup_html.php
@@ -143,10 +143,30 @@
<option value="email"><?=t('Email Address')?></option>
<option value="telephone"><?=t('Telephone')?></option>
<option value="url"><?=t('Web Address')?></option>
+ <option value="date"><?=t('Date Field')?></option>
+ <option value="datetime"><?=t('DateTime Field')?></option>
</select>
</div>
</div>
+ <div id="answerReplyto">
+ <div class="clearfix">
+ <?=$form->label('replyto', t('Reply to Email'))?>
+ <div class="input">
+ <ul class="inputs-list" id="replyto">
+ <li><label>
+ <?=$form->radio('replyto', 1)?>
+ <span><?=t('Yes')?></span>
+ </label></li>
+ <li><label>
+ <?=$form->radio('replyto', 0)?>
+ <span><?=t('No')?></span>
+ </label></li>
+ </ul>
+ </div>
+ </div>
+ </div>
+
<div id="answerOptionsArea">
<div class="clearfix">
<?=$form->label('answerOptions', t('Answer Options'))?>
@@ -228,9 +248,29 @@
<option value="email"><?=t('Email Address')?></option>
<option value="telephone"><?=t('Telephone')?></option>
<option value="url"><?=t('Web Address')?></option>
+ <option value="date"><?=t('Date Field')?></option>
+ <option value="datetime"><?=t('DateTime Field')?></option>
</select>
</div>
</div>
+
+ <div id="answerReplytoEdit">
+ <div class="clearfix">
+ <?=$form->label('replytoEdit', t('Reply to Email'))?>
+ <div class="input">
+ <ul class="inputs-list" id="replytoEdit">
+ <li><label>
+ <?=$form->radio('replytoEdit', 1)?>
+ <span><?=t('Yes')?></span>
+ </label></li>
+ <li><label>
+ <?=$form->radio('replytoEdit', 0)?>
+ <span><?=t('No')?></span>
+ </label></li>
+ </ul>
+ </div>
+ </div>
+ </div>
<div id="answerOptionsAreaEdit">
<div class="clearfix">
@@ -261,11 +301,18 @@
<label><?=t('Required')?> </label>
<div class="input">
<ul class="inputs-list" id="requiredEdit">
- <li><label> <?=$form->radio('requiredEdit', 1)?> <span><?=t('Yes')?>
- </span>
- </label></li>
- <li><label> <?=$form->radio('requiredEdit', 0)?> <span><?=t('No')?> </span>
- </label></li>
+ <li>
+ <label>
+ <?=$form->radio('requiredEdit', 1)?>
+ <span><?=t('Yes')?></span>
+ </label>
+ </li>
+ <li>
+ <label>
+ <?=$form->radio('requiredEdit', 0)?>
+ <span><?=t('No')?> </span>
+ </label>
+ </li>
</ul>
</div>
</div>
@@ -274,8 +321,8 @@
<input type="hidden" id="positionEdit" name="position" type="text" value="1000" />
<div>
- <?=$ih->button(t('Cancel'), '#', 'left', '', array('id' => 'cancelEditQuestion'))?>
- <?=$ih->button(t('Save Changes'), '#', 'right', 'primary', array('id' => 'editQuestion'))?>
+ <?=$ih->button(t('Cancel'), 'javascript:void(0)', 'left', '', array('id' => 'cancelEditQuestion'))?>
+ <?=$ih->button(t('Save Changes'), 'javascript:void(0)', 'right', 'primary', array('id' => 'editQuestion'))?>
</div>
</div>
View
1  web/concrete/blocks/form/styles_include.php
@@ -7,6 +7,7 @@
.spacer{ clear:both; font-size:1px }
#answerOptionsArea, #answerOptionsAreaEdit{display:none}
#answerSettings, #answerSettingsEdit{display:none}
+#answerReplyto, #answerReplytoEdit{display:none}
#editQuestionForm .formBlockSubmitButton{display:none}
.formBlockQuestionMsg{ background:#FFFF99; padding:2px; margin:16px 0px; border:1px solid #ddd; display:none; }

No commit comments for this range

Something went wrong with that request. Please try again.