Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jan 10, 2018
2 parents a5c414f + 10f4651 commit d2eb6a8
Show file tree
Hide file tree
Showing 19 changed files with 241 additions and 109 deletions.
2 changes: 1 addition & 1 deletion application/config/internal.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@

'sandboxConfig' => array(
'tags' => array('if', 'for', 'set', 'autoescape', 'block', 'embed', 'use', 'include'),
'filters' => array('escape', 'raw', 't', 'merge', 'length', 'gT', 'keys', 'date'),
'filters' => array('escape', 'raw', 't', 'merge', 'length', 'gT', 'keys', 'date', 'format'),
'methods' => array(
'ETwigViewRendererStaticClassProxy' => array("encode", "textfield", "form", "link", "emailField", "beginForm", "endForm", "dropDownList", "htmlButton", "passwordfield"),
'Survey' => array("getAllLanguages", "localizedtitle"),
Expand Down
71 changes: 48 additions & 23 deletions application/controllers/RegisterController.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,14 @@ public function actionIndex($sid = null)
Yii::app()->getController()->redirect($redirectUrl);
Yii::app()->end();
}

self::sendRegistrationEmail($iSurveyId, $iTokenId);

self::display($iSurveyId, $iTokenId, 'register_success');
Yii::app()->end();
}

// Display the page
self::display($iSurveyId);
self::display($iSurveyId, null, 'register_form');
}

/**
Expand Down Expand Up @@ -182,6 +183,38 @@ public function getRegisterErrors($iSurveyId)
}
}

/**
* Creates the array for the registration success page
*
* @param Integer $iSurveyId The survey id
* @param Integer $iTokenId The token id
*
* @return Array The rendereable array
*/
public function getRegisterSuccess($iSurveyId, $iTokenId){
$oSurvey = Survey::model()->findByPk($iSurveyId);

$oToken = Token::model($iSurveyId)->findByPk($iTokenId);

$aData['active'] = $oSurvey->active;
$aData['iSurveyId'] = $iSurveyId;
$aData['sLanguage'] = App()->language;
$aData['sFirstName'] = $oToken->firstname;
$aData['sLastName'] = $oToken->lastname;
$aData['sEmail'] = $oToken->email;
$aData['thissurvey'] = $oSurvey->attributes;

return $aData;
}

/**
* Create the array to render the registration form
* Takes eventual changes through plugins into account
*
* @param Integer $iSurveyId The surey id
*
* @return Array The rendereable array
*/
public function getRegisterForm($iSurveyId)
{
$oSurvey = Survey::model()->findByPk($iSurveyId);
Expand All @@ -205,6 +238,7 @@ public function getRegisterForm($iSurveyId)
$aRegisterAttributes = $this->getExtraAttributeInfo($iSurveyId);

$aData['iSurveyId'] = $iSurveyId;
$aData['active'] = $oSurvey->active;
$aData['sLanguage'] = App()->language;
$aData['sFirstName'] = $aFieldValue['sFirstName'];
$aData['sLastName'] = $aFieldValue['sLastName'];
Expand Down Expand Up @@ -455,7 +489,7 @@ public function getStartDate($iSurveyId)
* Display needed public page
* @param $iSurveyId
*/
private function display($iSurveyId)
private function display($iSurveyId, $iTokenId=null, $registerContent)
{
$sLanguage = Yii::app()->language;
$this->aGlobalData['surveyid'] = $surveyid = $iSurveyId;
Expand All @@ -466,29 +500,20 @@ private function display($iSurveyId)
$this->aReplacementData['sMessage'] = $this->sMessage;

$oTemplate = Template::model()->getInstance('', $iSurveyId);
//Yii::app()->clientScript->registerPackage( 'survey-template' );

// $this->sTemplate=$oTemplate->sTemplateName;
// if(!$this->sMessage){
// // $this->aGlobalData['languagechanger']=frontend_helper::makeLanguageChangerSurvey($sLanguage); // Only show language changer shown the form is shown, not after submission
// }else{
// // Must use message.pstpl
// $this->aReplacementData['content']=templatereplace(file_get_contents($oTemplate->pstplPath . "/message.pstpl"),
// array(
// 'MESSAGEID'=>'register-message',
// 'ERROR'=>'',
// 'MESSAGE'=>$this->sMessage,
// )
// ,$this->aGlobalData
// );

// }

$aData['aSurveyInfo'] = self::getRegisterForm($iSurveyId);

if($iTokenId!==null){
$aData['aSurveyInfo'] = self::getRegisterSuccess($iSurveyId, $iTokenId);
$aData['registerSuccess'] = true;
} else {
$aData['aSurveyInfo'] = self::getRegisterForm($iSurveyId);
}

$aData['aSurveyInfo']['registration_view'] = $registerContent;

$aData['aSurveyInfo']['registerform']['hiddeninputs'] = '<input value="'.$aData['aSurveyInfo']['sLanguage'].'" type="hidden" name="lang" id="register_lang" /><input value="true" type="hidden" name="register"id="register_register" />';
$aData['aSurveyInfo']['include_content'] = 'register.twig';
Yii::app()->twigRenderer->renderTemplateFromFile('layout_global.twig', $aData, false);

}

}
2 changes: 1 addition & 1 deletion application/core/plugins/AuthLDAP/AuthLDAP.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ private function _createNewUser($new_user)
$rescount = ldap_count_entries($ldapconn, $dnsearchres);
if ($rescount == 1) {
$userentry = ldap_get_entries($ldapconn, $dnsearchres);
$new_email = flattenText($userentry[0][$mailattribute][0]);
$new_email = flattenText($userentry[0][strtolower($mailattribute)][0]);
$new_full_name = flattenText($userentry[0][strtolower($fullnameattribute)][0]);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion application/models/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ public static function getInstance($sTemplateName = null, $iSurveyId = null, $iS
public static function getStandardTemplateList()
{

$standardTemplates = array(getGlobalSetting('defaulttheme'), 'vanilla', 'material', 'no_bootstrap', 'bootswatch', 'fruity', 'embedded');
$standardTemplates = array('vanilla', 'material', 'no_bootstrap', 'bootswatch', 'fruity', 'embedded');
return $standardTemplates;
}

Expand Down
12 changes: 12 additions & 0 deletions application/models/TemplateConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,7 @@ public function getClassAndAttributes()
// Register
$aClassAndAttributes['class']['register'] = ' ';
$aClassAndAttributes['class']['registerrow'] = ' ';
$aClassAndAttributes['class']['registerrowjumbotron'] = ' jumbotron ';
$aClassAndAttributes['class']['registerrowjumbotrondiv'] = ' ';

$aClassAndAttributes['class']['registerform'] = ' register-form ';
Expand All @@ -558,6 +559,17 @@ public function getClassAndAttributes()
$aClassAndAttributes['class']['registerformcaptchadivb'] = ' ';
$aClassAndAttributes['class']['registerformcaptchadivc'] = ' captcha-widget ';
$aClassAndAttributes['class']['registerformcaptchainput'] = ' ';
$aClassAndAttributes['class']['registersuccessblock'] = ' col-sm-12 ';
$aClassAndAttributes['attr']['registersuccessblock'] = ' ';
$aClassAndAttributes['class']['registersuccesslistlabel'] = ' col-sm-4 text-right ';
$aClassAndAttributes['attr']['registersuccesslistlabel'] = ' ';
$aClassAndAttributes['class']['registersuccesslistcontent'] = ' col-sm-8 text-left ';
$aClassAndAttributes['attr']['registersuccesslistcontent'] = ' ';
$aClassAndAttributes['attr']['registersuccesslist'] = ' ';
$aClassAndAttributes['class']['registersuccesslist'] = ' list-group ';
$aClassAndAttributes['attr']['registersuccesslistitem'] = ' ';
$aClassAndAttributes['class']['registersuccesslistitem'] = ' list-group-item ';

$aClassAndAttributes['class']['registermandatoryinfo'] = ' ';
$aClassAndAttributes['class']['registersave'] = ' ';
$aClassAndAttributes['class']['registersavediv'] = ' ';
Expand Down
11 changes: 8 additions & 3 deletions application/views/admin/survey/surveySummary_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,21 @@
?>
<!-- START surveySummary -->
<div class="row">
<div class="col-sm-12 h3 pagetitle"><?php eT('Survey summary'); ?></div>
<div class="col-sm-12 h3 pagetitle">
<?php eT('Survey summary'); ?> :
<?php echo flattenText($oSurvey->currentLanguageSettings->surveyls_title)." (".gT("ID")." ".$oSurvey->sid.")";?>
</div>
</div>
<?php /*
/// Survey quick actions have been removed -> deprecated
<div class="row">
<div class="col-sm-12">
<?php echo $this->renderPartial('/admin/survey/subview/_survey_quickaction', $subviewData); ?>
</div>
</div>
<div class="row">
*/ ?>
<div class="row ls-space margin top-10">
<!-- Survey summary -->
<div class="col-sm-12 h4"><?php echo flattenText($oSurvey->currentLanguageSettings->surveyls_title)." (".gT("ID")." ".$oSurvey->sid.")";?></div>
<div class="col-md-12 col-lg-6">
<div class="panel panel-default">
<!-- Default panel contents -->
Expand Down
8 changes: 8 additions & 0 deletions assets/packages/adminpanel/build/lsadminpanel.css
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,14 @@
height: 100%; }
#sidebar .dragPointer {
cursor: move; }
#sidebar .question-question-list .question-question-list-item .question-question-list-item-link {
display: inline-flex; }
#sidebar .question_text_ellipsize {
display: inline-block;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
padding-left: 2px; }

.bigIcons {
font-size: 18px;
Expand Down
25 changes: 19 additions & 6 deletions assets/packages/adminpanel/build/lsadminpanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -36777,7 +36777,7 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
if (this.isMouseDown) {
this.isMouseDown = false;
this.$store.state.isCollapsed = false;
if (parseInt(this.sideBarWidth) < 335 && !this.$store.state.isCollapsed) {
if (parseInt(this.sideBarWidth) < 250 && !this.$store.state.isCollapsed) {
this.toggleCollapse();
this.$store.commit('changeSidebarwidth', '340px');
} else {
Expand Down Expand Up @@ -37052,6 +37052,9 @@ Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
},
createQuestionAllowed() {
return this.$store.state.questiongroups.length > 0;
},
itemWidth() {
return parseInt(this.$store.state.sidebarwidth) - 135 + 'px';
}
},
methods: {
Expand Down Expand Up @@ -37263,7 +37266,12 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
_vm.openQuestionGroup(questiongroup)
}
}
}, [_vm._v(" \n " + _vm._s(questiongroup.group_name) + " \n "), _c('span', {
}, [_c('span', {
staticClass: "question_text_ellipsize",
style: ({
width: _vm.itemWidth
})
}, [_vm._v(" " + _vm._s(questiongroup.group_name) + " ")]), _vm._v(" "), _c('span', {
staticClass: "badge pull-right ls-space margin right-5"
}, [_vm._v(_vm._s(questiongroup.questions.length))])]), _vm._v(" "), _c('i', {
staticClass: "fa bigIcons",
Expand All @@ -37279,7 +37287,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
"name": "slide-fade-down"
}
}, [(_vm.isActive(questiongroup.gid)) ? _c('ul', {
staticClass: "list-group background-muted padding-left",
staticClass: "list-group background-muted padding-left question-question-list",
on: {
"drop": function($event) {
_vm.dropQuestion($event, _vm.question)
Expand All @@ -37288,7 +37296,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}, _vm._l((_vm.orderQuestions(questiongroup.questions)), function(question) {
return _c('li', {
key: question.qid,
staticClass: "list-group-item ls-flex-row align-itmes-flex-between",
staticClass: "list-group-item question-question-list-item ls-flex-row align-itmes-flex-between",
class: _vm.questionItemClasses(question),
on: {
"dragenter": function($event) {
Expand All @@ -37309,7 +37317,7 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
}
}
}, [_vm._v(" ")]), _vm._v(" "), _c('a', {
staticClass: "col-12 pjax",
staticClass: "col-12 pjax question-question-list-item-link",
attrs: {
"href": question.link,
"data-toggle": "tootltip",
Expand All @@ -37321,7 +37329,12 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c
_vm.openQuestion(question)
}
}
}, [_c('i', [_vm._v("[" + _vm._s(question.title) + "]")]), _vm._v(" " + _vm._s((_vm.$store.state.maximalSidebar ? question.question : question.name_short)) + " ")])])
}, [_c('i', [_vm._v("[" + _vm._s(question.title) + "]")]), _vm._v(" "), _c('span', {
staticClass: "question_text_ellipsize",
style: ({
width: _vm.itemWidth
})
}, [_vm._v(" " + _vm._s(question.question) + " ")])])])
})) : _vm._e()])], 1)
}))])
},staticRenderFns: []}
Expand Down
2 changes: 1 addition & 1 deletion assets/packages/adminpanel/build/lsadminpanel.js.map

Large diffs are not rendered by default.

0 comments on commit d2eb6a8

Please sign in to comment.