diff --git a/application/controllers/admin/quotas.php b/application/controllers/admin/quotas.php index 4ed4f6fff47..dc79476fd26 100644 --- a/application/controllers/admin/quotas.php +++ b/application/controllers/admin/quotas.php @@ -82,6 +82,11 @@ function _redirectToIndex($iSurveyId) } } + /** + * + * @param integer $iSurveyId the survey id + * @param boolean $quickreport : quick export a csv with actual quotas + */ function index($iSurveyId, $quickreport = false) { $iSurveyId = sanitize_int($iSurveyId); @@ -198,10 +203,8 @@ function index($iSurveyId, $quickreport = false) } else { - - //// WHY ??????? - - header("Content-Disposition: attachment; filename=results-survey" . $iSurveyId . ".csv"); + /* Export a quickly done csv file */ + header("Content-Disposition: attachment; filename=quotas-survey" . $iSurveyId . ".csv"); header("Content-type: text/comma-separated-values; charset=UTF-8"); header("Pragma: public"); echo gT("Quota name") . "," . gT("Limit") . "," . gT("Completed") . "," . gT("Remaining") . "\r\n"; @@ -209,7 +212,7 @@ function index($iSurveyId, $quickreport = false) { echo $line; } - die; + App()->end(); } } diff --git a/application/helpers/SurveyRuntimeHelper.php b/application/helpers/SurveyRuntimeHelper.php index 5f982bdeb9b..8867a78bc50 100644 --- a/application/helpers/SurveyRuntimeHelper.php +++ b/application/helpers/SurveyRuntimeHelper.php @@ -182,6 +182,11 @@ function run($surveyid,$args) $_SESSION[$LEMsessid]['prevstep']=$_SESSION[$LEMsessid]['step']-1; // this only happens on re-load } + /* quota submitted */ + if(isset($move) && $move=='confirmquota'){ + checkCompletedQuota($surveyid); + } + if (isset($_SESSION[$LEMsessid]['LEMtokenResume'])) { LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, $surveyOptions, false,$LEMdebugLevel); diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php index 570063b5365..cb2f0dc7d69 100644 --- a/application/helpers/expressions/em_manager_helper.php +++ b/application/helpers/expressions/em_manager_helper.php @@ -8596,6 +8596,7 @@ static function ProcessCurrentResponses() $relevant=false; $qid = $qinfo['info']['qid']; $gseq = $qinfo['info']['gseq']; + /* Never use posted value : must be fixed and find real actual relevance */ $relevant = (isset($_POST['relevance' . $qid]) ? ($_POST['relevance' . $qid] == 1) : false); $grelevant = (isset($_POST['relevanceG' . $gseq]) ? ($_POST['relevanceG' . $gseq] == 1) : false); $_SESSION[$LEM->sessid]['relevanceStatus'][$qid] = $relevant; diff --git a/application/helpers/frontend_helper.php b/application/helpers/frontend_helper.php index da2418b4df8..ca48eacc8f6 100644 --- a/application/helpers/frontend_helper.php +++ b/application/helpers/frontend_helper.php @@ -2061,15 +2061,16 @@ function checkCompletedQuota($surveyid,$return=false) return; } static $aMatchedQuotas; // EM call 2 times quotas with 3 lines of php code, then use static. + static $aPostedQuotaFields=array(); // Keep the posted field for the quota submit if(!$aMatchedQuotas) { $aMatchedQuotas=array(); - $quota_info=$aQuotasInfo = getQuotaInformation($surveyid, $_SESSION['survey_'.$surveyid]['s_lang']); + $aQuotasInfo = getQuotaInformation($surveyid, $_SESSION['survey_'.$surveyid]['s_lang']); // $aQuotasInfo have an 'active' key, we don't use it ? if(!$aQuotasInfo || empty($aQuotasInfo)) return $aMatchedQuotas; // OK, we have some quota, then find if this $_SESSION have some set - $aPostedFields = explode("|",Yii::app()->request->getPost('fieldnames','')); // Needed for quota allowing update + //$aPostedFields = explode("|",Yii::app()->request->getPost('fieldnames','')); // Needed for quota allowing update foreach ($aQuotasInfo as $aQuotaInfo) { if(!$aQuotaInfo['active']) @@ -2099,8 +2100,10 @@ function checkCompletedQuota($surveyid,$return=false) { $iMatchedAnswers++; } - if(in_array($sFieldName,$aPostedFields))// Need only one posted value + if(!is_null(App()->request->getPost($sFieldName))){// Need only one posted value $bPostedField=true; + $aPostedQuotaFields[$sFieldName]=App()->getRequest()->getPost($sFieldName); + } } // Condition to count quota : Answers are the same in quota + an answer is submitted at this time (bPostedField) OR all questions is hidden (bAllHidden) $bAllHidden=QuestionAttribute::model()->countByAttributes(array('qid'=>$aQuotaQid),'attribute=:attribute',array(':attribute'=>'hidden'))==count($aQuotaQid); @@ -2160,11 +2163,13 @@ function checkCompletedQuota($surveyid,$return=false) $sUrl=$event->get('url',$aMatchedQuota['quotals_url']); $sUrlDescription=$event->get('urldescrip',$aMatchedQuota['quotals_urldescrip']); $sAction=$event->get('action',$aMatchedQuota['action']); + /* Tag if we close or not the survey */ + $closeSurvey=($sAction=="1" || App()->getRequest()->getPost('move')=='confirmquota'); $sAutoloadUrl=$event->get('autoloadurl',$aMatchedQuota['autoload_url']); - // Doing the action and show the page - if ($sAction == "1" && $sClientToken) + if ($closeSurvey && $sClientToken){ submittokens(true); + } // Construct the default message $sMessage = templatereplace($sMessage,array(),$aDataReplacement, 'QuotaMessage', $aSurveyInfo['anonymized']!='N', NULL, array(), true ); $sUrl = passthruReplace($sUrl, $aSurveyInfo); @@ -2174,7 +2179,7 @@ function checkCompletedQuota($surveyid,$return=false) // Construction of default message inside quotamessage class $sHtmlQuotaMessage = "
\n"; $sHtmlQuotaMessage.= "\t".$sMessage."\n"; - if($sUrl) + if($sUrl && $closeSurvey) { $sHtmlQuotaUrl = App()->getController()->renderPartial("/survey/system/url",array( 'url'=>$sUrl, @@ -2187,16 +2192,13 @@ function checkCompletedQuota($surveyid,$return=false) } // Add the navigator with Previous button if quota allow modification. - if ($sAction == "2") + if (!$closeSurvey ) { $sQuotaStep = isset($_SESSION['survey_'.$surveyid]['step'])?$_SESSION['survey_'.$surveyid]['step']:0; // Surely not needed $sMovePrev = App()->getController()->renderPartial("/survey/system/actionButton/movePrevious",array('value'=>$sQuotaStep,'class'=>"ls-move-btn ls-move-previous-btn"),true); - /* Not completly tested submit : @todo test it */ - $sMoveSubmit = App()->getController()->renderPartial("/survey/system/actionButton/moveSubmit",array('value'=>"movesubmit",'class'=>"ls-move-btn ls-move-submit-btn"),true); - $sMoveSubmit = ""; + $sMoveSubmit = App()->getController()->renderPartial("/survey/system/actionButton/moveSubmit",array('value'=>"confirmquota",'class'=>"ls-move-btn ls-move-submit-btn"),true); $sNavigator = "$sMovePrev $sMoveSubmit"; - //$sNavigator .= " ".CHtml::htmlButton(gT("Submit"),array('type'=>'submit','id'=>"movesubmit",'value'=>"movesubmit",'name'=>"movesubmit",'accesskey'=>'l','class'=>"submit button")); $sHtmlQuotaMessage.= CHtml::form(array("/survey/index","sid"=>$surveyid), 'post', array('id'=>'limesurvey','name'=>'limesurvey','class'=>'survey-form-container QuotaMessage')); $sHtmlQuotaMessage.= templatereplace(file_get_contents($sTemplateViewPath."/navigator.pstpl"),array( 'MOVEPREVBUTTON' => $sMovePrev, @@ -2206,6 +2208,10 @@ function checkCompletedQuota($surveyid,$return=false) ),$aDataReplacement); $sHtmlQuotaMessage.= CHtml::hiddenField('sid',$surveyid); $sHtmlQuotaMessage.= CHtml::hiddenField('token',$sClientToken);// Did we really need it ? + foreach($aPostedQuotaFields as $field=>$post){ + $sHtmlQuotaMessage.= CHtml::hiddenField($field,$post); + } + $sHtmlQuotaMessage.= CHtml::hiddenField('thisstep',$sQuotaStep); $sHtmlQuotaMessage.= CHtml::endForm(); } @@ -2215,10 +2221,9 @@ function checkCompletedQuota($surveyid,$return=false) // Send page to user and end. sendCacheHeaders(); - if($sAutoloadUrl == 1 && $sUrl != "") + if($closeSurvey && $sAutoloadUrl == 1 && $sUrl != "") { - if ($sAction == "1") - killSurveySession($surveyid); + killSurveySession($surveyid); header("Location: ".$sUrl); } doHeader(); @@ -2226,8 +2231,9 @@ function checkCompletedQuota($surveyid,$return=false) echo templatereplace(file_get_contents($sTemplateViewPath."/completed.pstpl"),array("COMPLETED"=>$sHtmlQuotaMessage,"URL"=>$sHtmlQuotaUrl),$aDataReplacement); echo templatereplace(file_get_contents($sTemplateViewPath."/endpage.pstpl"),array(),$aDataReplacement); doFooter(); - if ($sAction == "1") + if ($closeSurvey){ killSurveySession($surveyid); + } Yii::app()->end(); } @@ -2423,6 +2429,7 @@ function SetSurveyLanguage($surveyid, $sLanguage) /** * getMove get move button clicked +* @return string **/ function getMove() { @@ -2430,14 +2437,17 @@ function getMove() // We can control is save and load are OK : todo fix according to survey settings // Maybe allow $aAcceptedMove in Plugin $move=Yii::app()->request->getParam('move'); + /* @deprecated since we use button and not input with different value. */ foreach($aAcceptedMove as $sAccepteMove) { if(Yii::app()->request->getParam($sAccepteMove)) $move=$sAccepteMove; } + /* Good idea, but used ? */ if($move=='clearall' && App()->request->getPost('confirm-clearall')!='confirm'){ $move="clearcancel"; } + /* default move (user don't click on a button, but use enter in a input:text or a select */ if($move=='default') { $surveyid=Yii::app()->getConfig('surveyID'); diff --git a/application/views/admin/quotas/editquota_view.php b/application/views/admin/quotas/editquota_view.php index 3395ffa4752..0ec1d3751f9 100644 --- a/application/views/admin/quotas/editquota_view.php +++ b/application/views/admin/quotas/editquota_view.php @@ -24,9 +24,10 @@
+
diff --git a/application/views/admin/quotas/newquota_view.php b/application/views/admin/quotas/newquota_view.php index 2061cde84fa..e8a72c6b454 100644 --- a/application/views/admin/quotas/newquota_view.php +++ b/application/views/admin/quotas/newquota_view.php @@ -29,9 +29,10 @@
+
@@ -41,7 +42,7 @@ widget('yiiwheels.widgets.switch.WhSwitch', array( 'name' => 'autoload_url', 'id'=>'autoload_url', - 'value' => 1, + 'value' => 0, 'onLabel'=>gT('Yes'), 'offLabel' => gT('No'))); ?> diff --git a/application/views/admin/quotas/viewquotasrow_view.php b/application/views/admin/quotas/viewquotasrow_view.php index 90eeee4d1e0..08916c551c5 100644 --- a/application/views/admin/quotas/viewquotasrow_view.php +++ b/application/views/admin/quotas/viewquotasrow_view.php @@ -17,7 +17,7 @@ > diff --git a/application/views/survey/questions/arrays/multiflexi/answer.php b/application/views/survey/questions/arrays/multiflexi/answer.php index 08e8c9c6e89..7ecc6505108 100644 --- a/application/views/survey/questions/arrays/multiflexi/answer.php +++ b/application/views/survey/questions/arrays/multiflexi/answer.php @@ -14,7 +14,7 @@ */ ?> - +
diff --git a/templates/default/views/clearall.pstpl b/templates/default/views/clearall.pstpl index a540f62f3c8..f2415a8e144 100644 --- a/templates/default/views/clearall.pstpl +++ b/templates/default/views/clearall.pstpl @@ -1,11 +1,4 @@ -
-
- - - -
- {ANSWERSCLEARED} -

- {RESTART} -
-
\ No newline at end of file +
+
{COMPLETED}
+
{URL}
+
diff --git a/templates/default/views/completed.pstpl b/templates/default/views/completed.pstpl index 8dd2ef88790..546ebe21a6c 100644 --- a/templates/default/views/completed.pstpl +++ b/templates/default/views/completed.pstpl @@ -1,4 +1,4 @@
-
{COMPLETED}
-
"+{URL}+"
+
{COMPLETED}
+
{URL}
diff --git a/templates/flatmodern/css/template-core.css b/templates/flatmodern/css/template-core.css index 9503bb76e4e..bd4a1122a0d 100644 --- a/templates/flatmodern/css/template-core.css +++ b/templates/flatmodern/css/template-core.css @@ -5,6 +5,9 @@ .ls-answers img,.ls-answers video,.ls-answers svg{ max-width: 100%;height: auto; } +label, th { + font-weight: normal; +} /* awesome-bootstrap-checkbox */ li.radio-item,li.checkbox-item{display:block} diff --git a/templates/flatmodern/css/template.css b/templates/flatmodern/css/template.css index 906b1969eb3..6b928a55de7 100644 --- a/templates/flatmodern/css/template.css +++ b/templates/flatmodern/css/template.css @@ -3,20 +3,13 @@ body padding-bottom: 10px; background-color: #f6f6f6; } - /* The header */ body { padding-top: 60px;/* now is redefine in JS to fit any title length */ } .navbar-action-link{ -padding-right:1em; /* really close to window without */ -} -.remove-margins { - margin: 0; -} -.remove-padding { - padding: 0; + padding-right:1em; /* really close to window without */ } /* specific for survey listing */ @@ -39,33 +32,31 @@ padding-right:1em; /* really close to window without */ background-color: #fff; padding: 1em; } - -#topContainer { +.top-container { width: 100%; - padding: 1em; + padding: 0; border-bottom: none; background-color: #ecf0f1; color: inherit; - margin-bottom: 30px; + margin-bottom:2em; } - -.progress { - height: 21px; - margin-bottom: 1em; +.top-container .top-content{ +padding-top:1em;padding-bottom:1em; } - -#surveynametitle { - font-size: 4em; +.top-container .top-content:empty{display:none} +.group-description:empty{display:none} +.group-title:empty{display:none} +.top-container .progress { + height: 21px; + margin-bottom: 0; } - -#surveydescription, #surveynametitle, #welcome-container h1 { - color: #2c3e50; - text-align: center; +.top-container .progress { + box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1) inset; /* flatly remove box-shadow : readd one */ } - -#surveydescription, .group-name { - color: #2c3e50; +.progress .progress-bar { + line-height:19px; } +.top-container .form-change-lang {text-align:center} /** * Navigator @@ -93,27 +84,11 @@ padding-right:1em; /* really close to window without */ margin-bottom: 30px; } -#indexcontainer { - display : none; -} - .radio-list li { display: block; clear: both; } -/* -.checkbox, .radio -{ - float: left; -} - -.label-radio span -{ - display: inline-block; - padding-top: 3px; -} -*/ .question-item .other-label { margin: 0px; @@ -123,13 +98,6 @@ padding-right:1em; /* really close to window without */ /** * For em-type */ - .strong - { - font-weight: bold; - display: inline-block; - padding: 0.2em; - } - .hide-tip { display: none; @@ -237,9 +205,6 @@ html body .navbar.navbar-default.navbar-fixed-top { } /* For striped tables */ -.array2 { - background-color: #f9f9f9; -} /* Make sure table covers hole page */ table { @@ -344,38 +309,6 @@ table > tbody > tr > td.ddprefix { } -/* - Arrays Question -*/ - -/* center the radio list in the td*/ -/* -td.answer-item.text-center -{ - padding-left: 39px; -} - -table.array-no-dropdown td.answer-item.text-center -{ - padding-left: 45px; -} - -.table-5-point-array td.answer-item.text-center -{ - padding-left: 54px; -} - -.table-10-point-array td.answer-item.text-center -{ - padding-left: 40px; -} - -.table-10-point-array thead tr th.text-center -{ - padding-left: 0px; -} -*/ - /** * On big screen only, iPad and up */ @@ -573,17 +506,6 @@ only screen and (max-width: 760px), * Display adjust, question type by question type */ -/* center the label text in no more table mode */ -.label-text{ - margin-top: -24px; - margin-left: 20px; -} - -/* ...except for dual-scale and array-by-column */ -.table-dual-scale .label-text, .array-by-columns-div .label-text { - margin-top: 0px; - margin-left: 0px; -} .table > tbody > tr > th { @@ -595,16 +517,6 @@ only screen and (max-width: 760px), margin-right: 5px; } -.multiple-choice-with-comment.table, .table-multi-num.table{ - table-layout: auto; - width: initial; -} - .multiple-choice-with-comment.table > tbody > tr > td { - padding-left: 18px; - vertical-align: middle; - } - - .geoloc-item .search-icon, .geoloc-item .checkbox { padding-top: 10px; } @@ -678,31 +590,9 @@ only screen and (max-width: 760px), */ /* Asterix */ -.asterisk { - display: inline-block; - font: normal normal normal 14px/1 FontAwesome; - font-size: inherit; - text-rendering: auto; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; -} -.asterisk:before { - content: "\f069"; -} - - -/* Check javascript */ -#checkjavascript { - margin-top: 100px; - z-index: 999; - right: 100px; - position: fixed; - width: 300px; -} - -/*label font weight*/ -label, th { - font-weight: normal; +.input-error .asterisk { + font-size: 1.2em; + margin-top:-0.2em; } #surveys-list-container @@ -732,9 +622,6 @@ label, th { top: 10px; } -.list-unstyled.radio-list { - //padding-left: 15px; -} div.yes-no .btn-group label { white-space:normal; @@ -768,47 +655,3 @@ div.yes-no .btn-group label { border: none; } } -/*** Small helper classes, that are not shipped with bootstrap but fit in well***/ -.ls-custom-padding{ - padding: 1px; -} -.ls-custom-padding.two{ - padding: 2px; -} -.ls-custom-padding.three{ - padding: 3px; -} -.ls-custom-padding.four{ - padding: 4px; -} -.ls-custom-padding.five{ - padding: 5px; -} -.ls-custom-padding.fifteen{ - padding: 15px; -} -.ls-custom-padding.eighteen{ - padding: 18px; -} - -.ls-custom-margin{ - margin: 1px; -} -.ls-custom-margin.two{ - margin: 2px; -} -.ls-custom-margin.three{ - margin: 3px; -} -.ls-custom-margin.four{ - margin: 4px; -} -.ls-custom-margin.five{ - margin: 5px; -} -.ls-custom-margin.fifteen{ - margin: 15px; -} -.ls-custom-margin.eighteen{ - margin: 18px; -} diff --git a/templates/flatmodern/views/groupdescription.pstpl b/templates/flatmodern/views/groupdescription.pstpl index f25b424eaff..fb181cf59c4 100644 --- a/templates/flatmodern/views/groupdescription.pstpl +++ b/templates/flatmodern/views/groupdescription.pstpl @@ -1,4 +1,2 @@ -
- {GROUPDESCRIPTION} -
+
{GROUPDESCRIPTION}
diff --git a/templates/flatmodern/views/navigator.pstpl b/templates/flatmodern/views/navigator.pstpl index e67182410a1..c3563007b54 100644 --- a/templates/flatmodern/views/navigator.pstpl +++ b/templates/flatmodern/views/navigator.pstpl @@ -1,11 +1,4 @@ - - - + diff --git a/templates/flatmodern/views/startgroup.pstpl b/templates/flatmodern/views/startgroup.pstpl index 0317673c282..fc6749860fb 100644 --- a/templates/flatmodern/views/startgroup.pstpl +++ b/templates/flatmodern/views/startgroup.pstpl @@ -1,5 +1,3 @@
-
-

{GROUPNAME}

-
+
{GROUPNAME}
diff --git a/templates/flatmodern/views/startpage.pstpl b/templates/flatmodern/views/startpage.pstpl index 63c9025baa0..30d817b056c 100644 --- a/templates/flatmodern/views/startpage.pstpl +++ b/templates/flatmodern/views/startpage.pstpl @@ -34,11 +34,8 @@
-
-
- {PERCENTCOMPLETE} - {LANGUAGECHANGER} -
+
+
{PERCENTCOMPLETE}{LANGUAGECHANGER}
diff --git a/templates/flatmodern/views/welcome.pstpl b/templates/flatmodern/views/welcome.pstpl index 354a55404d9..4b920f33fdb 100644 --- a/templates/flatmodern/views/welcome.pstpl +++ b/templates/flatmodern/views/welcome.pstpl @@ -1,15 +1,10 @@ - +{CHECKJAVASCRIPT} - -
-

{SURVEYNAME}

- {SURVEYDESCRIPTION} +
+

{SURVEYNAME}

+ {SURVEYDESCRIPTION} {WELCOME} - {THEREAREXQUESTIONS} + {THEREAREXQUESTIONS}
diff --git a/templates/lumen/pstpl/startgroup.pstpl b/templates/lumen/pstpl/startgroup.pstpl index 804ce528ef6..38fedaec392 100644 --- a/templates/lumen/pstpl/startgroup.pstpl +++ b/templates/lumen/pstpl/startgroup.pstpl @@ -1,2 +1,2 @@
-{if(!is_empty(GROUPNAME),"
"+GROUPNAME+"
","")} +
{GROUPNAME}