diff --git a/application/controllers/RegisterController.php b/application/controllers/RegisterController.php index bb9fe70d4fe..8c7dd07d9c7 100644 --- a/application/controllers/RegisterController.php +++ b/application/controllers/RegisterController.php @@ -21,7 +21,16 @@ */ class RegisterController extends LSYii_Controller { - public $layout = 'bare'; + /* @var string : Default layout when using render : leave at bare actually : just send content */ + public $layout= 'survey'; + /* @var string the template name to be used when using layout */ + public $sTemplate= 'default'; + /* @var string[] Replacement data when use templatereplace function in layout, @see templatereplace $replacements */ + public $aReplacementData= array(); + /* @var array Global data when use templatereplace function in layout, @see templatereplace $redata */ + public $aGlobalData= array(); + /* @var boolean did we need survey.pstpl when using layout */ + public $bStartSurvey= true; /** * The array of errors to be displayed @@ -179,9 +188,9 @@ public function getRegisterForm($iSurveyId) App()->getPluginManager()->dispatchEvent($event); // Allow adding error or replace error with plugin ? $this->aRegisterErrors=$event->get('aRegistersErrors'); - if(!is_null($event->get('registerForm'))) + if(!is_null($event->get('registerForm'))){ return $event->get('registerForm'); - + } $aFieldValue=$this->getFieldValue($iSurveyId); $aRegisterAttributes=$this->getExtraAttributeInfo($iSurveyId); $aData['iSurveyId'] = $iSurveyId; @@ -191,27 +200,20 @@ public function getRegisterForm($iSurveyId) $aData['sEmail'] = $aFieldValue['sEmail']; $aData['aAttribute'] = $aFieldValue['aAttribute']; $aData['aExtraAttributes']=$aRegisterAttributes; - $aData['urlAction']=App()->createUrl('register/index',array('sid'=>$iSurveyId)); $aData['bCaptcha'] = function_exists("ImageCreate") && isCaptchaEnabled('registrationscreen', $aSurveyInfo['usecaptcha']); - $aReplacement['REGISTERFORM']=$this->renderPartial('registerForm',$aData,true); + $aReplacement['REGISTERFORM'] = CHtml::form(App()->createUrl('register/index',array('sid'=>$iSurveyId)),'post',array('id'=>'limesurvey', 'role' => 'form', 'class' => 'ls-form')); + $aReplacement['REGISTERFORM'].= $this->renderPartial('/survey/frontpage/registerForm/form',$aData,true); + $aReplacement['REGISTERFORM'].= CHtml::endForm(); if(is_array($this->aRegisterErrors)) { - $sRegisterError=""; + $aReplacement['REGISTERERROR']=$this->renderPartial("/survey/frontpage/registerForm/error",array('aErrors'=>$this->aRegisterErrors),true); } else { - $sRegisterError=''; + $aReplacement['REGISTERERROR']=''; } - - $aReplacement['REGISTERERROR'] = $sRegisterError; - $aReplacement['REGISTERMESSAGE1'] = gT("You must be registered to complete this survey"); - if($sStartDate=$this->getStartDate($iSurveyId)) - $aReplacement['REGISTERMESSAGE2'] = sprintf(gT("You may register for this survey but you have to wait for the %s before starting the survey."),$sStartDate)."
\n".gT("Enter your details below, and an email containing the link to participate in this survey will be sent immediately."); - else - $aReplacement['REGISTERMESSAGE2'] = gT("You may register for this survey if you wish to take part.")."
\n".gT("Enter your details below, and an email containing the link to participate in this survey will be sent immediately."); - + $aReplacement['REGISTERMESSAGE1']=$this->renderPartial("/survey/frontpage/registerForm/heading",array(),true); + $aReplacement['REGISTERMESSAGE2']=$this->renderPartial("/survey/frontpage/registerForm/message",array('sStartDate'=>$this->getStartDate($iSurveyId)),true); $aData['thissurvey'] = $aSurveyInfo; Yii::app()->setConfig('surveyID',$iSurveyId);//Needed for languagechanger $aData['languagechanger'] = makeLanguageChangerSurvey(App()->language); @@ -318,19 +320,18 @@ public function sendRegistrationEmail($iSurveyId,$iTokenId){ $today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust')); $oToken->sent=$today; $oToken->save(); - $this->sMessage="
" - . "

".gT("Thank you for registering to participate in this survey.")."

\n" - . "

{$this->sMailMessage}

\n" - . "

".sprintf(gT("Survey administrator %s (%s)"),$aSurveyInfo['adminname'],$aSurveyInfo['adminemail'])."

" - . "
\n"; + $aMessage=array(); + $aMessage['mail-thanks']=gT("Thank you for registering to participate in this survey."); + $aMessage['mail-message']=$this->sMailMessage; + $aMessage['mail-contact']=sprintf(gT("Survey administrator %s (%s)"),$aSurveyInfo['adminname'],$aSurveyInfo['adminemail']); + $this->sMessage=$this->renderPartial('/survey/system/message',array('aMessage'=>$aMessage),true); } else { - $this->sMessage="
" - . "

".gT("Thank you for registering to participate in this survey.")."

\n" - . "

".gT("You are registered but an error happened when trying to send the email - please contact the survey administrator.")."

\n" - . "

".sprintf(gT("Survey administrator %s (%s)"),$aSurveyInfo['adminname'],$aSurveyInfo['adminemail'])."

" - . "
\n"; + $aMessage['mail-thanks']=gT("Thank you for registering to participate in this survey."); + $aMessage['mail-message-error']=gT("You are registered but an error happened when trying to send the email - please contact the survey administrator."); + $aMessage['mail-contact']=sprintf(gT("Survey administrator %s (%s)"),$aSurveyInfo['adminname'],$aSurveyInfo['adminemail']); + $this->sMessage=$this->renderPartial('/survey/system/message',array('aMessage'=>$aMessage),true); } // Allways return true : if we come here, we allways trye to send an email return true; @@ -461,39 +462,46 @@ public function getStartDate($iSurveyId){ private function display($iSurveyId) { $sLanguage=Yii::app()->language; - $aData['surveyid']=$surveyid=$iSurveyId; - $aData['thissurvey']=getSurveyInfo($iSurveyId,$sLanguage); - $sTemplate=getTemplatePath($aData['thissurvey']['template']); + $this->aGlobalData['surveyid']=$surveyid=$iSurveyId; + $this->aGlobalData['thissurvey']=getSurveyInfo($iSurveyId,$sLanguage); Yii::app()->setConfig('surveyID',$iSurveyId);//Needed for languagechanger - $aData['sitename']=Yii::app()->getConfig('sitename'); - $aData['aRegisterErrors']=$this->aRegisterErrors; - $aData['sMessage']=$this->sMessage; + $this->aReplacementData['sitename']=Yii::app()->getConfig('sitename'); + $this->aReplacementData['aRegisterErrors']=$this->aRegisterErrors; + $this->aReplacementData['sMessage']=$this->sMessage; - $oTemplate = Template::model()->getInstance('', $iSurveyId); - Yii::app()->clientScript->registerPackage( 'survey-template' ); - sendCacheHeaders(); - doHeader(); - $aViewData['sTemplate']=$sTemplate; + $oTemplate = Template::model()->getInstance('', $iSurveyId); + Yii::app()->clientScript->registerPackage( 'survey-template' ); + + $this->sTemplate=$oTemplate->name; if(!$this->sMessage){ - $aData['languagechanger']=makeLanguageChangerSurvey($sLanguage); // Only show language changer shown the form is shown, not after submission - $aViewData['content']=self::getRegisterForm($iSurveyId); + $this->aGlobalData['languagechanger']=makeLanguageChangerSurvey($sLanguage); // Only show language changer shown the form is shown, not after submission + $this->aReplacementData['content']=self::getRegisterForm($iSurveyId); }else{ - $aViewData['content']=templatereplace($this->sMessage); + // Must use message.pstpl + $this->aReplacementData['content']=templatereplace(file_get_contents($oTemplate->viewPath . "/message.pstpl"), + array( + 'MESSAGEID'=>'register-message', + 'ERROR'=>'', + 'MESSAGE'=>$this->sMessage, + ) + ,$this->aGlobalData + ); + } - $aViewData['aData']=$aData; // Test if we come from index or from register if(empty(App()->clientScript->scripts)){ + /* This surely can be moved to layout , but remove iot from surveyController before */ $oTemplate = Template::model()->getInstance('', $iSurveyId); Yii::app()->clientScript->registerPackage( 'survey-template' ); App()->getClientScript()->registerPackage('jqueryui'); App()->getClientScript()->registerPackage('jquery-touch-punch'); App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts')."survey_runtime.js"); useFirebug(); - $this->render('/register/display',$aViewData); + $this->layout='survey'; + $this->render('/survey/system/display',$this->aReplacementData); }else{ // Survey/index need renderPartial - echo $this->renderPartial('/register/display',$aViewData, true, true); + echo $this->render('/survey/system/display',$this->aReplacementData, true, true); } - doFooter(); } } diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php index 92bfc93d746..e99a997d2cb 100644 --- a/application/helpers/frontend_helper.php +++ b/application/helpers/frontend_helper.php @@ -265,17 +265,6 @@ function makeLanguageChanger($sSelectedLanguage) 'sClass' => $sClass , ); $sHTMLCode = Yii::app()->getController()->renderPartial('/surveys/LanguageChangerForm', $languageChangerDatas, true); - - //~ $sHTMLCode= CHtml::beginForm(App()->createUrl('surveys/publiclist'),'get', array('class' => 'form-horizontal')); - //~ $sHTMLCode = Yii::app()->getController()->renderPartial('/survey/system/LanguageChanger/LanguageChanger', $languageChangerDatas, true); - //~ $sHTMLCode.=CHtml::label(gT("Language:"), 'lang',array('class'=>'control-label col-xs-4 col-sm-8')); - //~ $sHTMLCode .= "
"; - //~ $sHTMLCode.= CHtml::dropDownList('lang', $sSelected,$aListLang,array('class'=>$sClass)); - //~ $sHTMLCode .= "
"; - //~ $sHTMLCode .= "
"; - //~ $sHTMLCode.=""; - //~ $sHTMLCode .= "
"; - //~ $sHTMLCode.= CHtml::endForm(); return $sHTMLCode; } else @@ -905,6 +894,7 @@ function buildsurveysession($surveyid,$preview=false) $sTemplatePath = $_SESSION['survey_'.$surveyid]['templatepath']; $oTemplate = Template::model()->getInstance('', $surveyid); + App()->getController()->sTemplate=$oTemplate->name; $sTemplatePath = $oTemplate->path; $sTemplateViewPath = $oTemplate->viewPath; @@ -940,7 +930,6 @@ function buildsurveysession($surveyid,$preview=false) } else { $oTokenEntry = Token::model($surveyid)->usable()->incomplete()->findByAttributes(array('token' => $clienttoken)); } - $subscenarios['tokenValid'] = ((!empty($oTokenEntry) && ($clienttoken != ""))); } else @@ -952,9 +941,8 @@ function buildsurveysession($surveyid,$preview=false) if($scenarios['captchaRequired']) { //Check if the Captcha was correct - $loadsecurity = returnGlobal('loadsecurity',true); $captcha = Yii::app()->getController()->createAction('captcha'); - $subscenarios['captchaCorrect'] = $captcha->validate($loadsecurity, false); + $subscenarios['captchaCorrect'] = $captcha->validate(App()->getRequest()->getPost('loadsecurity'), false); } else { @@ -962,11 +950,14 @@ function buildsurveysession($surveyid,$preview=false) $loadsecurity = false; } + //RenderWay defines which html gets rendered to the user_error // Possibilities are main,register,correct $renderCaptcha = ""; $renderToken = ""; - + /** + * @todo : create 2 new function to create and call form + */ //Define array to render the partials $aEnterTokenData = array(); $aEnterTokenData['bNewTest'] = false; @@ -985,19 +976,28 @@ function buildsurveysession($surveyid,$preview=false) $aEnterTokenData['sLoadpass'] = htmlspecialchars($loadpass); } - $FlashError = ""; + $aEnterErrors=array(); + // Scenario => Token required + if ($scenarios['tokenRequired'] && !$preview){ + //Test if token is valid + list($renderToken, $FlashError) = testIfTokenIsValid($subscenarios, $thissurvey, $aEnterTokenData, $clienttoken); + if(!empty($FlashError)){ + $aEnterErrors['token']=$FlashError; + } + } // Scenario => Captcha required if($scenarios['captchaRequired'] && !$preview) { $FlashError = ''; - //Apply the captchaEnabled flag to the partial + //Apply the captcYii::app()->getRequest()->getPost($id);haEnabled flag to the partial $aEnterTokenData['bCaptchaEnabled'] = true; // IF CAPTCHA ANSWER IS NOT CORRECT OR NOT SET if (!$subscenarios['captchaCorrect']) { - if ($loadsecurity) { - // was a bad answer - $FlashError.=gT("Your answer to the security question was not correct - please try again.")."
\n"; + if(App()->getRequest()->getPost('loadsecurity')){ + $aEnterErrors['captcha']=gT("Your answer to the security question was not correct - please try again."); + }elseif(null!==App()->getRequest()->getPost('loadsecurity')){ + $aEnterErrors['captcha']=gT("Your must answer to the security question - please try again."); } $renderCaptcha='main'; } @@ -1007,19 +1007,14 @@ function buildsurveysession($surveyid,$preview=false) } } - // Scenario => Token required - if ($scenarios['tokenRequired'] && !$preview){ - //Test if token is valid - list($renderToken, $FlashError) = testIfTokenIsValid($subscenarios, $thissurvey, $aEnterTokenData, $clienttoken); - } - //If there were errors, display through yii->FlashMessage if($FlashError !== ""){ $aEnterTokenData['errorMessage'] = $FlashError; } - + $aEnterTokenData['aEnterErrors']=$aEnterErrors; $renderWay = getRenderWay($renderToken, $renderCaptcha); $redata = compact(array_keys(get_defined_vars())); + /* This funtion end if an form need to be shown */ renderRenderWayForm($renderWay, $redata, $scenarios, $sTemplateViewPath, $aEnterTokenData, $surveyid); // Reset all the session variables and start again @@ -1564,12 +1559,7 @@ function testIfTokenIsValid(array $subscenarios, array $thissurvey, array $aEnte } else { //token was wrong - $errorMsg= "" - . gT("The token you have provided is either not valid, or has already been used.")."

\n" - . sprintf( gT("For further information please contact %s"), $thissurvey['adminname']) - . "(" - . $thissurvey['adminemail'].")"; - + $errorMsg= gT("The token you have provided is either not valid, or has already been used."); $FlashError .= $errorMsg; $renderToken='main'; @@ -1633,26 +1623,35 @@ function renderRenderWayForm($renderWay, array $redata, array $scenarios, $sTemp { switch($renderWay){ case "main": //Token required, maybe Captcha required - sendCacheHeaders(); - doHeader(); - echo templatereplace(file_get_contents($sTemplateViewPath."startpage.pstpl"),array(),$redata,'frontend_helper[875]'); - echo templatereplace(file_get_contents($sTemplateViewPath."survey.pstpl"),array(),$redata,'frontend_helper[877]'); - + App()->getController()->layout="survey"; + App()->getController()->aReplacementData=$aEnterTokenData; + App()->getController()->bStartSurvey=true; // render token form + if($scenarios['tokenRequired']){ - App()->getController()->renderPartial('/survey/frontpage/enterToken', $aEnterTokenData); + $aReplacements['FORMID'] = 'token'; } else { - App()->getController()->renderPartial('/survey/frontpage/enterCaptcha', $aEnterTokenData); + $aReplacements['FORMID'] = 'captcha'; } - - echo templatereplace(file_get_contents($sTemplateViewPath."endpage.pstpl"),array(),$redata,'frontend_helper[1645]'); - doFooter(); + $aReplacements['FORMHEADING'] = App()->getController()->renderPartial("/survey/frontpage/{$aReplacements['FORMID']}Form/heading",$aEnterTokenData,true); + $aReplacements['FORMMESSAGE'] = App()->getController()->renderPartial("/survey/frontpage/{$aReplacements['FORMID']}Form/message",$aEnterTokenData,true); + $aReplacements['FORMERROR'] = App()->getController()->renderPartial("/survey/frontpage/{$aReplacements['FORMID']}Form/error",$aEnterTokenData,true); + + $aReplacements['FORM'] = CHtml::beginForm(array("/survey/index","sid"=>$surveyid), 'post',array('id'=>'form-'.$aReplacements['FORMID'],'class'=>'ls-form')); + $aReplacements['FORM'].= App()->getController()->renderPartial("/survey/frontpage/{$aReplacements['FORMID']}Form/form",$aEnterTokenData,true); + /* @ todo : some hidden field must be moved here : in controller */ + $aReplacements['FORM'].= CHtml::endForm(); + $content = templatereplace(file_get_contents($sTemplateViewPath."form.pstpl"),$aReplacements,$aData); + App()->getController()->render("/survey/system/display",array( + 'content'=>$content, + )); Yii::app()->end(); break; case "register": //Register new user // Add the event and test if done Yii::app()->runController("register/index/sid/{$surveyid}"); Yii::app()->end(); + /* We never get here */ echo templatereplace(file_get_contents($sTemplateViewPath."register.pstpl"),array(),$redata,'frontend_helper[1751]'); break; case "correct": //Nothing to hold back, render survey diff --git a/application/libraries/Load_answers.php b/application/libraries/Load_answers.php index cd66d776bb9..121b004f221 100644 --- a/application/libraries/Load_answers.php +++ b/application/libraries/Load_answers.php @@ -27,10 +27,10 @@ function run($args) { $sTemplate=Survey::model()->findByPk($surveyid)->template; $oTemplate = Template::model()->getInstance($sTemplate); /* Construction of data for templatereplace */ - $aReplacements['LOADHEADING'] = App()->getController()->renderPartial("/survey/system/loadForm/heading",array(),true); - $aReplacements['LOADMESSAGE'] = App()->getController()->renderPartial("/survey/system/loadForm/message",array(),true); + $aReplacements['LOADHEADING'] = App()->getController()->renderPartial("/survey/frontpage/loadForm/heading",array(),true); + $aReplacements['LOADMESSAGE'] = App()->getController()->renderPartial("/survey/frontpage/loadForm/message",array(),true); if(!empty($aLoadErrorMsg)){ - $aReplacements['LOADERROR'] = App()->getController()->renderPartial("/survey/system/loadForm/error",array('aLoadErrorMsg'=>$aLoadErrorMsg),true); + $aReplacements['LOADERROR'] = App()->getController()->renderPartial("/survey/frontpage/loadForm/error",array('aLoadErrorMsg'=>$aLoadErrorMsg),true); }else{ $aReplacements['LOADERROR'] = ""; } @@ -40,7 +40,7 @@ function run($args) { $captcha=null; } $loadForm = CHtml::beginForm(array("/survey/index","sid"=>$surveyid), 'post',array('id'=>'form-load')); - $loadForm .= App()->getController()->renderPartial("/survey/system/loadForm/form",array('captcha'=>$captcha),true); + $loadForm .= App()->getController()->renderPartial("/survey/frontpage/loadForm/form",array('captcha'=>$captcha),true); if ($clienttoken) { $loadForm .= CHtml::hiddenField('token',$clienttoken); diff --git a/application/libraries/Save.php b/application/libraries/Save.php index 13371d4141c..e29db01275a 100644 --- a/application/libraries/Save.php +++ b/application/libraries/Save.php @@ -80,13 +80,13 @@ function showsaveform($iSurveyId) $sTemplate=$oSurvey->template; $oTemplate = Template::model()->getInstance($sTemplate); - $aReplacements['SAVEHEADING'] = App()->getController()->renderPartial("/survey/system/saveForm/heading",array(),true); - $aReplacements['SAVEMESSAGE'] = App()->getController()->renderPartial("/survey/system/saveForm/message",array(),true); + $aReplacements['SAVEHEADING'] = App()->getController()->renderPartial("/survey/frontpage/saveForm/heading",array(),true); + $aReplacements['SAVEMESSAGE'] = App()->getController()->renderPartial("/survey/frontpage/saveForm/message",array(),true); if($oSurvey->anonymized=="Y"){ - $aReplacements['SAVEALERT'] = App()->getController()->renderPartial("/survey/system/saveForm/anonymized",array(),true); + $aReplacements['SAVEALERT'] = App()->getController()->renderPartial("/survey/frontpage/saveForm/anonymized",array(),true); } if(!empty($this->aSaveErrors)){ - $aReplacements['SAVEERROR'] = App()->getController()->renderPartial("/survey/system/saveForm/error",array('aSaveErrors'=>$this->aSaveErrors),true); + $aReplacements['SAVEERROR'] = App()->getController()->renderPartial("/survey/frontpage/saveForm/error",array('aSaveErrors'=>$this->aSaveErrors),true); }else{ $aReplacements['SAVEERROR'] = ""; } @@ -96,8 +96,9 @@ function showsaveform($iSurveyId) }else{ $captcha=null; } - $saveForm = CHtml::beginForm(array("/survey/index","sid"=>$iSurveyId), 'post',array('id'=>'form-save')); - $saveForm .= App()->getController()->renderPartial("/survey/system/saveForm/form",array('captcha'=>$captcha),true); + $saveForm = CHtml::beginForm(array("/survey/index","sid"=>$iSurveyId), 'post',array('id'=>'form-save','class'=>'ls-form')); + $saveForm .= CHtml::hiddenField('savesubmit','save'); + $saveForm .= App()->getController()->renderPartial("/survey/frontpage/saveForm/form",array('captcha'=>$captcha),true); if ($clienttoken) { $saveForm .= CHtml::hiddenField('token',$clienttoken); diff --git a/application/views/layouts/survey.php b/application/views/layouts/survey.php index d577701eeaa..5e52b169581 100644 --- a/application/views/layouts/survey.php +++ b/application/views/layouts/survey.php @@ -30,15 +30,15 @@ getInstance($this->sTemplate); + App()->getClientScript()->registerPackage('fontawesome'); // Maybe can add language changer here /* Add head by template + star body (if template start body here ....) */ - echo templatereplace(file_get_contents($oTemplate->viewPath."startpage.pstpl"),$this->aReplacementData,$this->aReplacementData); - + echo templatereplace(file_get_contents($oTemplate->viewPath."startpage.pstpl"),$this->aReplacementData,$this->aGlobalData); if(!empty($this->bStartSurvey)){ - echo templatereplace(file_get_contents($oTemplate->viewPath."survey.pstpl"),$this->aReplacementData,$this->aReplacementData); + echo templatereplace(file_get_contents($oTemplate->viewPath."survey.pstpl"),$this->aReplacementData,$this->aGlobalData); } echo $content; - echo templatereplace(file_get_contents($oTemplate->viewPath."endpage.pstpl"),$this->aReplacementData,$this->aReplacementData); + echo templatereplace(file_get_contents($oTemplate->viewPath."endpage.pstpl"),$this->aReplacementData,$this->aGlobalData); ?> diff --git a/application/views/register/display.php b/application/views/register/display.php deleted file mode 100644 index 48d32fda938..00000000000 --- a/application/views/register/display.php +++ /dev/null @@ -1,8 +0,0 @@ -getInstance($sTemplate); - - echo templatereplace(file_get_contents($oTemplate->viewPath."startpage.pstpl"),array(),$aData); - echo templatereplace(file_get_contents($oTemplate->viewPath."survey.pstpl"),array(),$aData); - echo $content; - echo templatereplace(file_get_contents($oTemplate->viewPath."endpage.pstpl"),array(),$aData); -?> diff --git a/application/views/register/registerForm.php b/application/views/register/registerForm.php deleted file mode 100644 index dc100f97000..00000000000 --- a/application/views/register/registerForm.php +++ /dev/null @@ -1,60 +0,0 @@ -'limesurvey', 'role' => 'form', 'class' => 'form-horizontal col-sm-12 col-md-10 col-md-offset-1')); ?> - -
- -
- 'register_firstname','class'=>'form-control input-sm')); ?> -
-
-
- -
- 'register_lastname','class'=>'form-control input-sm')); ?> -
-
-
- -
- 'register_email','class'=>'form-control input-sm','required'=>'required')); ?> -
-
-$aExtraAttribute){ ?> -
- -
- "register_{$key}",'class'=>'form-control input-sm')); ?> -
-
- - -
- -
-
 
- 'loadsecurity','class'=>'form-control input-sm','required'=>'required')); ?> -
-
- -
-
-
- '); ?> -
-
- -
-
- 'btn-default btn-block btn','id'=>'register','name'=>'register')); ?> -
-
- diff --git a/application/views/survey/frontpage/captchaForm/error.php b/application/views/survey/frontpage/captchaForm/error.php new file mode 100644 index 00000000000..2fa9ed64d6b --- /dev/null +++ b/application/views/survey/frontpage/captchaForm/error.php @@ -0,0 +1,15 @@ + +getController()->renderPartial( + '/survey/system/errorAlert', + array('aErrors' => (array)$aEnterErrors) + ); +} +?> diff --git a/application/views/survey/frontpage/captchaForm/form.php b/application/views/survey/frontpage/captchaForm/form.php new file mode 100644 index 00000000000..61aa7e644cc --- /dev/null +++ b/application/views/survey/frontpage/captchaForm/form.php @@ -0,0 +1,42 @@ + +
+
+
+ +
+
+
+ widget('CCaptcha',array( + 'buttonOptions'=>array('class'=> 'btn btn-xs btn-info'), + 'buttonType' => 'button', + 'buttonLabel' => gt('Reload image','unescaped') + )); ?> +
+ +
+
+
+ + 'lang')); ?> + + 'lang')); ?> + + + 'loadall')); ?> + 'scid')); ?> + 'loadname')); ?> + 'loadpass')); ?> + + +
+
+ +
+
+
diff --git a/application/views/survey/frontpage/captchaForm/heading.php b/application/views/survey/frontpage/captchaForm/heading.php new file mode 100644 index 00000000000..1f3081622c7 --- /dev/null +++ b/application/views/survey/frontpage/captchaForm/heading.php @@ -0,0 +1,7 @@ + + diff --git a/application/views/survey/frontpage/captchaForm/message.php b/application/views/survey/frontpage/captchaForm/message.php new file mode 100644 index 00000000000..d5fd759d198 --- /dev/null +++ b/application/views/survey/frontpage/captchaForm/message.php @@ -0,0 +1,6 @@ + - - $error
- - -
-
-

-
-

-
-
- - - -
- 'tokenform', - 'class' => 'form-horizontal col-sm-12 col-md-10 col-md-offset-1' - )); ?> - -
- -
-
 
- 'captchafield', - 'class' => 'text input-sm form-control '.$sKpClass, - 'required' => 'required' - )) ?> -
-
- - -
- - - 'btn btn-default btn-block button submit')); ?> - -
- -
-
\ No newline at end of file diff --git a/application/views/survey/frontpage/enterToken.php b/application/views/survey/frontpage/enterToken.php deleted file mode 100644 index 7b94b1bbac7..00000000000 --- a/application/views/survey/frontpage/enterToken.php +++ /dev/null @@ -1,101 +0,0 @@ -
- -
-
- -
- -
- -

-
- - - - - -
- 'tokenform', - 'class' => 'ls-form-token form-horizontal col-sm-12 col-md-10 col-md-offset-1' - )); ?> -
- 'control-label col-sm-12 col-md-4 '.$sKpClass, - )); - ?> -
- - - 'text input-sm form-control '.$sKpClass, - 'required' => 'required', - 'id' => 'token')); - ?> - - 'visibleToken', - 'class' => 'text input-sm form-control '.$sKpClass, - 'disabled'=>'disabled', - 'data-value' => $visibleToken, - 'value' => $visibleToken, - )); - ?> - $sKpClass, - 'id' => 'token', - 'data-value' => $token, - 'value' => $token)); - ?> - - - 'sid')); ?> - 'lang')); ?> - - - 'lang')); ?> - -
-
- - 'loadall')); ?> - 'scid')); ?> - 'loadname')); ?> - 'loadpass')); ?> - - - - -
- -
-
 
- 'captchafield', - 'class' => 'text input-sm form-control '.$sKpClass, - 'required' => 'required' - )) ?> -
-
- - -
- - 'btn btn-default btn-block button submit')); ?> - -
- -
-
diff --git a/application/views/survey/frontpage/loadForm/error.php b/application/views/survey/frontpage/loadForm/error.php new file mode 100644 index 00000000000..42d1a49d5ee --- /dev/null +++ b/application/views/survey/frontpage/loadForm/error.php @@ -0,0 +1,12 @@ + +getController()->renderPartial( + '/survey/system/errorAlert', + array('aErrors' => $aLoadErrorMsg) + ); +?> diff --git a/application/views/survey/system/loadForm/form.php b/application/views/survey/frontpage/loadForm/form.php similarity index 100% rename from application/views/survey/system/loadForm/form.php rename to application/views/survey/frontpage/loadForm/form.php diff --git a/application/views/survey/system/loadForm/heading.php b/application/views/survey/frontpage/loadForm/heading.php similarity index 100% rename from application/views/survey/system/loadForm/heading.php rename to application/views/survey/frontpage/loadForm/heading.php diff --git a/application/views/survey/system/loadForm/message.php b/application/views/survey/frontpage/loadForm/message.php similarity index 100% rename from application/views/survey/system/loadForm/message.php rename to application/views/survey/frontpage/loadForm/message.php diff --git a/application/views/survey/system/saveForm/error.php b/application/views/survey/frontpage/registerForm/error.php similarity index 76% rename from application/views/survey/system/saveForm/error.php rename to application/views/survey/frontpage/registerForm/error.php index d85e909e53b..8be78b2ecae 100644 --- a/application/views/survey/system/saveForm/error.php +++ b/application/views/survey/frontpage/registerForm/error.php @@ -5,7 +5,7 @@ */ ?> diff --git a/application/views/survey/frontpage/registerForm/form.php b/application/views/survey/frontpage/registerForm/form.php new file mode 100644 index 00000000000..85f593c7e40 --- /dev/null +++ b/application/views/survey/frontpage/registerForm/form.php @@ -0,0 +1,58 @@ + +
+
+ +
+ 'register_firstname','class'=>'form-control')); ?> +
+
+ +
+ +
+ 'register_lastname','class'=>'form-control')); ?> +
+
+
+ +
+ 'register_email','class'=>'form-control input-sm','required'=>true)); ?> +
+
+$aExtraAttribute){ ?> +
+ +
+ "register_{$key}",'class'=>'form-control input-sm')); ?> +
+
+ + +
+ +
+
+
+ widget('CCaptcha',array( + 'buttonOptions'=>array('class'=> 'btn btn-xs btn-info'), + 'buttonType' => 'button', + 'buttonLabel' => gt('Reload image','unescaped') + )); ?> +
+ +
+
+
+ + + +
+
+ 'btn-primary btn-block btn','id'=>'register','name'=>'register')); ?> +
+
diff --git a/application/views/survey/frontpage/registerForm/heading.php b/application/views/survey/frontpage/registerForm/heading.php new file mode 100644 index 00000000000..04a41830f78 --- /dev/null +++ b/application/views/survey/frontpage/registerForm/heading.php @@ -0,0 +1,7 @@ + + diff --git a/application/views/survey/frontpage/registerForm/message.php b/application/views/survey/frontpage/registerForm/message.php new file mode 100644 index 00000000000..70bade69798 --- /dev/null +++ b/application/views/survey/frontpage/registerForm/message.php @@ -0,0 +1,12 @@ + + +

+ +

+ +

diff --git a/application/views/survey/system/saveForm/anonymized.php b/application/views/survey/frontpage/saveForm/anonymized.php similarity index 100% rename from application/views/survey/system/saveForm/anonymized.php rename to application/views/survey/frontpage/saveForm/anonymized.php diff --git a/application/views/survey/frontpage/saveForm/error.php b/application/views/survey/frontpage/saveForm/error.php new file mode 100644 index 00000000000..338a0dc812a --- /dev/null +++ b/application/views/survey/frontpage/saveForm/error.php @@ -0,0 +1,12 @@ + +getController()->renderPartial( + '/survey/system/errorAlert', + array('aErrors' => $aSaveErrors) + ); +?> diff --git a/application/views/survey/system/saveForm/form.php b/application/views/survey/frontpage/saveForm/form.php similarity index 100% rename from application/views/survey/system/saveForm/form.php rename to application/views/survey/frontpage/saveForm/form.php diff --git a/application/views/survey/system/saveForm/heading.php b/application/views/survey/frontpage/saveForm/heading.php similarity index 100% rename from application/views/survey/system/saveForm/heading.php rename to application/views/survey/frontpage/saveForm/heading.php diff --git a/application/views/survey/system/saveForm/message.php b/application/views/survey/frontpage/saveForm/message.php similarity index 100% rename from application/views/survey/system/saveForm/message.php rename to application/views/survey/frontpage/saveForm/message.php diff --git a/application/views/survey/frontpage/tokenForm/error.php b/application/views/survey/frontpage/tokenForm/error.php new file mode 100644 index 00000000000..2fa9ed64d6b --- /dev/null +++ b/application/views/survey/frontpage/tokenForm/error.php @@ -0,0 +1,15 @@ + +getController()->renderPartial( + '/survey/system/errorAlert', + array('aErrors' => (array)$aEnterErrors) + ); +} +?> diff --git a/application/views/survey/frontpage/tokenForm/form.php b/application/views/survey/frontpage/tokenForm/form.php new file mode 100644 index 00000000000..47f9562fd40 --- /dev/null +++ b/application/views/survey/frontpage/tokenForm/form.php @@ -0,0 +1,60 @@ + +
+
+ +
+ + + + 'token', + 'required'=>true, + 'readonly'=>true, + )); + ?> + +
+
+ +
+ + +
+
+
+ widget('CCaptcha',array( + 'buttonOptions'=>array('class'=> 'btn btn-xs btn-info'), + 'buttonType' => 'button', + 'buttonLabel' => gt('Reload image','unescaped') + )); ?> +
+ +
+
+
+ + + 'lang')); ?> + + 'lang')); ?> + + + 'loadall')); ?> + 'scid')); ?> + 'loadname')); ?> + 'loadpass')); ?> + + +
+
+ +
+
+
diff --git a/application/views/survey/frontpage/tokenForm/heading.php b/application/views/survey/frontpage/tokenForm/heading.php new file mode 100644 index 00000000000..0c1d3063431 --- /dev/null +++ b/application/views/survey/frontpage/tokenForm/heading.php @@ -0,0 +1,7 @@ + + diff --git a/application/views/survey/frontpage/tokenForm/message.php b/application/views/survey/frontpage/tokenForm/message.php new file mode 100644 index 00000000000..fc5f41c6f8f --- /dev/null +++ b/application/views/survey/frontpage/tokenForm/message.php @@ -0,0 +1,13 @@ + +

+ + + + + +

diff --git a/application/views/survey/question_help/asterisk.php b/application/views/survey/question_help/asterisk.php index 79960896705..763fa625612 100644 --- a/application/views/survey/question_help/asterisk.php +++ b/application/views/survey/question_help/asterisk.php @@ -3,4 +3,5 @@ * This file render the asterisk for mandatory questions */ ?> - + + () diff --git a/application/views/survey/system/formItem/captcha.php b/application/views/survey/system/formItem/captcha.php new file mode 100644 index 00000000000..de387105b9e --- /dev/null +++ b/application/views/survey/system/formItem/captcha.php @@ -0,0 +1,23 @@ + +
+ +
+
+
+ widget('CCaptcha',array( + 'buttonOptions'=>array('class'=> 'btn btn-xs btn-info'), + 'buttonType' => 'button', + 'buttonLabel' => gt('Reload image','unescaped') + )); ?> +
+ +
+
+
diff --git a/application/views/survey/system/loadForm/error.php b/application/views/survey/system/loadForm/error.php deleted file mode 100644 index 445408d677e..00000000000 --- a/application/views/survey/system/loadForm/error.php +++ /dev/null @@ -1,17 +0,0 @@ - - 1) : ?> - - - - diff --git a/application/views/survey/system/message.php b/application/views/survey/system/message.php index d80b7d915d1..22d17b79d82 100644 --- a/application/views/survey/system/message.php +++ b/application/views/survey/system/message.php @@ -4,6 +4,6 @@ * */ ?> - -

+$message) : ?> +

diff --git a/application/views/survey/system/required.php b/application/views/survey/system/required.php new file mode 100644 index 00000000000..13d6f2e92e8 --- /dev/null +++ b/application/views/survey/system/required.php @@ -0,0 +1,6 @@ + + () diff --git a/templates/basic/pstpl/form.pstpl b/templates/basic/pstpl/form.pstpl new file mode 100644 index 00000000000..b888bc7a21a --- /dev/null +++ b/templates/basic/pstpl/form.pstpl @@ -0,0 +1,9 @@ +
+
{FORMHEADING}
+ {LANGUAGECHANGER} +
+ {FORMMESSAGE} + {FORMERROR} +
{FORM}
+
+
diff --git a/templates/basic/pstpl/register.pstpl b/templates/basic/pstpl/register.pstpl index 582c83bd748..703483520a2 100644 --- a/templates/basic/pstpl/register.pstpl +++ b/templates/basic/pstpl/register.pstpl @@ -1,6 +1,6 @@ -
-{if(REGISTERERROR,"")} -
{REGISTERMESSAGE1}
-
{REGISTERMESSAGE2}
-
{REGISTERFORM}
+
+
{REGISTERMESSAGE1}
+
{REGISTERMESSAGE2}
+ {REGISTERERROR} +
{REGISTERFORM}
diff --git a/templates/default/views/form.pstpl b/templates/default/views/form.pstpl new file mode 100644 index 00000000000..b888bc7a21a --- /dev/null +++ b/templates/default/views/form.pstpl @@ -0,0 +1,9 @@ +
+
{FORMHEADING}
+ {LANGUAGECHANGER} +
+ {FORMMESSAGE} + {FORMERROR} +
{FORM}
+
+
diff --git a/templates/test/pstpl/form.pstpl b/templates/test/pstpl/form.pstpl new file mode 100644 index 00000000000..b888bc7a21a --- /dev/null +++ b/templates/test/pstpl/form.pstpl @@ -0,0 +1,9 @@ +
+
{FORMHEADING}
+ {LANGUAGECHANGER} +
+ {FORMMESSAGE} + {FORMERROR} +
{FORM}
+
+