Skip to content

Commit

Permalink
Dev: multiple small amendmends and bugfixing
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Aug 9, 2017
1 parent fe27409 commit b7a84f2
Show file tree
Hide file tree
Showing 69 changed files with 1,121 additions and 956 deletions.
1 change: 0 additions & 1 deletion application/controllers/admin/assessments.php
Expand Up @@ -117,7 +117,6 @@ private function _showAssessments($iSurveyID, $action)
Yii::app()->loadHelper('admin/htmleditor');

$urls['output'] = '<div class="side-body ' . getSideBodyClass(false) . '">';
//$urls['output'] .= App()->getController()->renderPartial('/admin/survey/breadcrumb', array('oSurvey'=>$oSurvey, 'active'=>gT("Assessments")), true, false);
$urls['output'] .= '<h3>'.gT("Assessments").'</h3>';
$aData['asessementNotActivated'] = false;
if ($oSurvey->assessments!='Y')
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/conditionsaction.php
Expand Up @@ -105,7 +105,7 @@ public function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
Yii::app()->loadHelper("database");

$aData['sidemenu']['state'] = false;
$aData['title_bar']['title'] = $survey->currentLanguageSettings->surveyls_title." (".gT("ID").":".$iSurveyID.")";
$aData['title_bar']['title'] = gT("Conditions designer");

$aData['subaction'] = gT("Conditions designer");
$aData['questionbar']['closebutton']['url'] = 'admin/questions/sa/view/surveyid/'.$iSurveyID.'/gid/'.$gid.'/qid/'.$qid; // Close button
Expand Down Expand Up @@ -348,7 +348,7 @@ public function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$aData['conditionsoutput_action_error'] = $conditionsoutput_action_error;
$aData['javascriptpre'] = $javascriptpre;
$aData['sCurrentQuestionText'] = $questiontitle .': '.viewHelper::flatEllipsizeText($sCurrentFullQuestionText,true,'120');
$aData['subaction'] = $subaction;
//$aData['subaction'] = $subaction;
$aData['scenariocount'] = $scenariocount;
$aViewUrls['conditionslist_view'][] = $aData;

Expand Down
7 changes: 5 additions & 2 deletions application/controllers/admin/database.php
Expand Up @@ -1534,9 +1534,12 @@ private function actionInsertCopyQuestion($iSurveyID)
}

LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting
$redirectLink = $this->getController()->createUrl('admin/questions/sa/view/', array('surveyid' => $iSurveyID, 'gid' => $this->iQuestionGroupID, 'qid' => $this->iQuestionID));
if(Yii::app()->request->getPost('saveandnew', '') != ''){
$redirectLink = $this->getController()->createUrl('admin/questions/sa/newquestion/', array('surveyid' => $iSurveyID, 'gid' => $this->iQuestionGroupID));
}

//admin/survey/sa/view/surveyid/
$this->getController()->redirect(array('admin/questions/sa/view/surveyid/'.$iSurveyID.'/gid/'.$this->iQuestionGroupID.'/qid/'.$this->iQuestionID));
$this->getController()->redirect($redirectLink);
}

}
10 changes: 9 additions & 1 deletion application/controllers/admin/export.php
Expand Up @@ -171,10 +171,11 @@ public function exportresults()

if ( ! $sExportType )
{
$aFieldMap = array();
//FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT
if ($survey->isSaveTimings) {
//Append survey timings to the fieldmap array
$aFieldMap = $aFieldMap + createTimingsFieldMap($iSurveyID, 'full',false,false,$oSurvey->language);
$aFieldMap = createTimingsFieldMap($iSurveyID, 'full',false,false,$oSurvey->language);
}
$iFieldCount = count($aFieldMap);

Expand All @@ -195,6 +196,7 @@ public function exportresults()
}

$aFields=array();
$aFieldsOptions=array();
foreach($aFieldMap as $sFieldName=>$fieldinfo)
{
$sCode=viewHelper::getFieldCode($fieldinfo);
Expand Down Expand Up @@ -258,6 +260,8 @@ public function exportresults()

$data['display']['menu_bars']['browse'] = gT('Browse responses'); // browse is independent of the above
$data['title_bar']['title'] = gT('Browse responses').': '.$survey->currentLanguageSettings->surveyls_title;
$data['title_bar']['subaction'] = gT('Export results');
$data['subaction'] = gT('Export results');

$this->_renderWrappedTemplate('export', 'exportresults_view', $data);

Expand Down Expand Up @@ -689,6 +693,8 @@ public function vvexport()

$aData['display']['menu_bars']['browse'] = gT('Browse responses'); // browse is independent of the above
$aData['title_bar']['title'] = gT('Browse responses').': '.$survey->currentLanguageSettings->surveyls_title;
$aData['title_bar']['subaction'] = gt('Export a VV survey file');
$aData['subaction'] = gt('Export a VV survey file');

$aData['sidemenu']['state'] = false;
$aData['menu']['edition'] = true;
Expand Down Expand Up @@ -1246,6 +1252,8 @@ public function quexml($iSurveyID)
$aData['baselang'] = Survey::model()->findByPk($iSurveyID)->language;
$aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/'.$iSurveyID; // Close button
$aData['sidemenu']['state'] = false;
$aData['title_bar']['subaction'] = gt('queXML PDF export');
$aData['subaction'] = gt('queXML PDF export');
$aData['title_bar']['title'] = $survey->currentLanguageSettings->surveyls_title." (".gT("ID").":".$iSurveyID.")";

array_unshift($aData['slangs'],$aData['baselang']);
Expand Down
4 changes: 1 addition & 3 deletions application/controllers/admin/expressions.php
Expand Up @@ -41,7 +41,6 @@ function index()
}
else
{
$oSurvey = Survey::model()->findByPk($iSurveyID);
App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('decimal');

Expand All @@ -50,7 +49,6 @@ function index()
$this->_printOnLoad(Yii::app()->request->getQuery('sa', 'index'));
$aData['pagetitle']="ExpressionManager: {$aData['sa']}";
$aData['subaction']=$this->_printTitle($aData['sa']);
$aData['assessments'] = Yii::app()->request->getQuery('assessments', $oSurvey->assessments == 'Y');

if(isset($iSurveyID))
{
Expand All @@ -59,7 +57,7 @@ function index()
$aData['surveyid'] = $iSurveyID;
$aData['sidemenu']['state'] = false;
$aData['title_bar']['title'] = $survey->currentLanguageSettings->surveyls_title." (".gT("ID").":".$iSurveyID.")";
$aData['assessments'] = Yii::app()->request->getQuery('assessments', $oSurvey->assessments == 'Y');
$aData['assessments'] = Yii::app()->request->getQuery('assessments', $survey->assessments == 'Y');

$LEM_debug_timing = Yii::app()->request->getQuery('LEM_DEBUG_TIMING', 0) == 'Y';
$LEM_debug_validation_summary = Yii::app()->request->getQuery('LEM_DEBUG_VALIDATION_SUMMARY', 0) == 'Y';
Expand Down
6 changes: 5 additions & 1 deletion application/controllers/admin/questiongroups.php
Expand Up @@ -245,7 +245,11 @@ public function insert($surveyid)
{
$this->getController()->redirect(array("admin/questiongroups/sa/view/surveyid/$surveyid/gid/$newGroupID"));
}
else
else if(Yii::app()->request->getPost('saveandnew','') !== '')
{
$this->getController()->redirect(array("admin/questiongroups/sa/add/surveyid/$surveyid"));
}
else
{
// After save, go to edit
$this->getController()->redirect(array("admin/questiongroups/sa/edit/surveyid/$surveyid/gid/$newGroupID"));
Expand Down
3 changes: 3 additions & 0 deletions application/controllers/admin/questions.php
Expand Up @@ -1022,6 +1022,7 @@ public function newquestion($surveyid)
$survey = Survey::model()->findByPk($iSurveyID);

$aData['title_bar']['title'] = $survey->currentLanguageSettings->surveyls_title." (".gT("ID").":".$iSurveyID.")";
$aData['subaction'] = gT('Add a new question');
$aData['surveybar']['importquestion'] = true;
$aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
$aData['surveybar']['saveandclosebutton']['form'] = 'frmeditgroup';
Expand Down Expand Up @@ -1177,6 +1178,8 @@ public function index($sa, $surveyid, $gid, $qid=null)

$aData['adding'] = $adding = $action == 'addquestion';
$aData['copying'] = $copying = $action == 'copyquestion';
$aData['subaction'] = $copying ? gT('Copy question') : gT('Add a new question');

$questlangs = $oSurvey->additionalLanguages;
$baselang = $oSurvey->language;
$questlangs[] = $baselang;
Expand Down
2 changes: 2 additions & 0 deletions application/controllers/admin/statistics.php
Expand Up @@ -843,6 +843,8 @@ protected function _renderWrappedTemplate($sAction = 'export', $aViewUrls = arra
$aData['sidemenu']['state'] = false;
$iSurveyId = $aData['surveyid'];
$aData['title_bar']['title'] = gT('Browse responses').': '.$oSurvey->currentLanguageSettings->surveyls_title;
$aData['title_bar']['subaction'] = gT('Statistics');
$aData['subaction'] = gT('Statistics');
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData);
}

Expand Down
26 changes: 17 additions & 9 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -1943,9 +1943,18 @@ function insert($iSurveyID=null)
// Check if survey title was set
if (Yii::app()->request->getPost('surveyls_title')=='')
{
Yii::app()->session['flashmessage'] = gT("Survey could not be created because it did not have a title");
$this->getController()->redirect($this->getController()->createUrl('admin'));
return;
$alertError = gT("Survey could not be created because it did not have a title");
//Yii::app()->session['flashmessage'] = $alertError;
return Yii::app()->getController()->renderPartial(
'/admin/super/_renderJson',
array(
'data' => array(
'alertData' => $alertError,
'missingField' => 'surveyls_title'
)
),
false,
false);
}

Yii::app()->loadHelper("surveytranslator");
Expand Down Expand Up @@ -2056,12 +2065,10 @@ function insert($iSurveyID=null)
$sTitle = Yii::app()->request->getPost('surveyls_title');
$sDescription = Yii::app()->request->getPost('description');
$sWelcome = Yii::app()->request->getPost('welcome');
$sURLDescription = Yii::app()->request->getPost('urldescrip');

$sTitle = html_entity_decode($sTitle, ENT_QUOTES, "UTF-8");
$sDescription = html_entity_decode($sDescription, ENT_QUOTES, "UTF-8");
$sWelcome = html_entity_decode($sWelcome, ENT_QUOTES, "UTF-8");
$sURLDescription = html_entity_decode($sURLDescription, ENT_QUOTES, "UTF-8");

// Fix bug with FCKEditor saving strange BR types
$sTitle = fixCKeditorText($sTitle);
Expand All @@ -2076,9 +2083,9 @@ function insert($iSurveyID=null)
'surveyls_description' => $sDescription,
'surveyls_welcometext' => $sWelcome,
'surveyls_language' => Yii::app()->request->getPost('language'),
'surveyls_urldescription' => Yii::app()->request->getPost('urldescrip'),
'surveyls_endtext' => Yii::app()->request->getPost('endtext'),
'surveyls_url' => Yii::app()->request->getPost('url'),
'surveyls_urldescription' => Yii::app()->request->getPost('urldescrip',''),
'surveyls_endtext' => Yii::app()->request->getPost('endtext',''),
'surveyls_url' => Yii::app()->request->getPost('url',''),
'surveyls_dateformat' => (int) Yii::app()->request->getPost('dateformat'),
'surveyls_numberformat' => (int) Yii::app()->request->getPost('numberformat'),
);
Expand All @@ -2088,7 +2095,7 @@ function insert($iSurveyID=null)
// Update survey permissions
Permission::model()->giveAllSurveyPermissions(Yii::app()->session['loginID'], $iNewSurveyid);

$createSample = (int)App()->request->getPost('createsample', 0) === 1;
$createSample = ( (int) App()->request->getPost('createsample', 0) ) === 1;

if($createSample) {
$iNewGroupID = $this->_createSampleGroup($iNewSurveyid);
Expand Down Expand Up @@ -2116,6 +2123,7 @@ function insert($iSurveyID=null)
['surveyid'=>$iNewSurveyid]
);
}

return Yii::app()->getController()->renderPartial(
'/admin/super/_renderJson',
array(
Expand Down
1 change: 0 additions & 1 deletion application/controllers/admin/surveypermission.php
Expand Up @@ -52,7 +52,6 @@ public function index($iSurveyID)
App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'surveypermissions.js');

$surveysecurity = "<div id='edit-permission' class='side-body " . getSideBodyClass(false) . "'>";
// $surveysecurity .= App()->getController()->renderPartial('/admin/survey/breadcrumb', array('oSurvey'=>$oSurvey, 'active'=>gT("Survey permissions")), true, false);
$surveysecurity .="<h3>".gT("Survey permissions")."</h3>\n";
$surveysecurity .= '<div class="row"><div class="col-lg-12 content-right">';
$result2 = Permission::model()->getUserDetails($iSurveyID);
Expand Down
5 changes: 3 additions & 2 deletions application/core/Survey_Common_Action.php
Expand Up @@ -361,12 +361,13 @@ protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $

//// TODO : Move this divs inside each correct view ASAP !
echo '</div>' ;
echo '</div>' ;
echo '</div>' ;

if (!empty($aData['surveyid']))
{
echo '</div>' ;
echo '</div>' ;
echo '</div>' ;
echo '</div>' ;
}


Expand Down
1 change: 0 additions & 1 deletion application/views/admin/conditions/conditionshead_view.php
@@ -1,5 +1,4 @@
<div class='side-body <?php echo getSideBodyClass(false); ?>'>
<?php// $this->renderPartial('/admin/survey/breadcrumb', array('oQuestion'=>$oQuestion, 'active'=>gT("Conditions designer") )); ?>
<h3>
<?php eT("Conditions designer"); ?>

Expand Down
Expand Up @@ -32,7 +32,6 @@
</script>

<div class="side-body <?php echo getSideBodyClass(false); ?>">
<?php //$this->renderPartial('/admin/survey/breadcrumb', array('oSurvey'=>$oSurvey, 'active'=> gT("Edit email templates"))); ?>
<h3><?php eT("Edit email templates"); ?></h3>

<div class="row">
Expand Down
Expand Up @@ -4,53 +4,65 @@
</div>

<div class="panel-body">
<div class='form-group'>
<label for='completionstate' class="col-sm-4 control-label"><?php eT("Include:"); ?> </label>
<?php $this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => 'completionstate',
'value'=> incompleteAnsFilterState(),
'selectOptions'=>array(
"all"=>gT("All responses",'unescaped'),
"complete"=>gT("Complete only",'unescaped'),
"incomplete"=>gT("Incomplete only",'unescaped'),
)
));?>
</div>

<div class='form-group'>
<?php $sViewsummaryall = (int) Yii::app()->request->getPost('viewsummaryall');?>
<label class="col-sm-4 control-label" for='viewsummaryall'><?php eT("View summary of all available fields:"); ?></label>
<div class='col-sm-1'>
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array('name' => 'viewsummaryall', 'id'=>'viewsummaryall', 'value'=>$sViewsummaryall, 'onLabel'=>gT('On'),'offLabel'=>gT('Off')));?>
<div class="row">
<div class='form-group'>
<label for='completionstate' class="col-sm-4 control-label"><?php eT("Include:"); ?> </label>
<?php $this->widget('yiiwheels.widgets.buttongroup.WhButtonGroup', array(
'name' => 'completionstate',
'value'=> incompleteAnsFilterState(),
'selectOptions'=>array(
"all"=>gT("All responses",'unescaped'),
"complete"=>gT("Complete only",'unescaped'),
"incomplete"=>gT("Incomplete only",'unescaped'),
)
));?>
</div>
</div>
<div class="row">
<div class='form-group col-sm-6'>
<?php $sViewsummaryall = (int) Yii::app()->request->getPost('viewsummaryall');?>
<label class="col-lg-8 control-label" for='viewsummaryall'><?php eT("View summary of all available fields:"); ?></label>
<div class='col-lg-4'>
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array('name' => 'viewsummaryall', 'id'=>'viewsummaryall', 'value'=>$sViewsummaryall, 'onLabel'=>gT('On'),'offLabel'=>gT('Off')));?>
</div>
</div>

<div class='form-group'>
<?php $sNoncompleted = (int) Yii::app()->request->getPost('noncompleted');?>
<label class="col-sm-4 control-label" id='noncompletedlbl' for='noncompleted' title='<?php eT("Count stats for each question based only on the total number of responses for which the question was displayed"); ?>'><?php eT("Subtotals based on displayed questions:"); ?></label>
<div class='col-sm-1'>
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array('name' => 'noncompleted', 'id'=>'noncompleted', 'value'=>$sNoncompleted, 'onLabel'=>gT('On'),'offLabel'=>gT('Off')));?>
<div class='form-group col-sm-6'>
<?php $sNoncompleted = (int) Yii::app()->request->getPost('noncompleted');?>
<label class="col-lg-8 control-label" id='noncompletedlbl' for='noncompleted' title='<?php eT("Count stats for each question based only on the total number of responses for which the question was displayed"); ?>'><?php eT("Subtotals based on displayed questions:"); ?></label>
<div class='col-lg-4'>
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch',
array(
'name' => 'noncompleted',
'id'=>'noncompleted',
'value'=>$sNoncompleted,
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
)
);?>
</div>
</div>
</div>
<div class="row">
<?php
$language_options="";
foreach ($survlangs as $survlang){
$language_options .= "\t<option value=\"{$survlang}\"";
if ( $survlang == Survey::model()->findByPk($surveyid)->language){
$language_options .= " selected=\"selected\" " ;
}
$temp = getLanguageNameFromCode($survlang,true);
$language_options .= ">".$temp[1]."</option>\n";
}
?>

<?php
$language_options="";
foreach ($survlangs as $survlang){
$language_options .= "\t<option value=\"{$survlang}\"";
if ( $survlang == Survey::model()->findByPk($surveyid)->language){
$language_options .= " selected=\"selected\" " ;
}
$temp = getLanguageNameFromCode($survlang,true);
$language_options .= ">".$temp[1]."</option>\n";
}
?>

<div class='form-group'>
<label for='statlang' class="col-sm-4 control-label" ><?php eT("Statistics report language:"); ?></label>
<div class='col-sm-4'>
<select name="statlang" id="statlang" class="form-control">
<?php echo $language_options; ?>
</select>
<div class='form-group'>
<label for='statlang' class="col-lg-4 control-label" ><?php eT("Statistics report language:"); ?></label>
<div class='col-lg-8'>
<select name="statlang" id="statlang" class="form-control">
<?php echo $language_options; ?>
</select>
</div>
</div>
</div>
</div>
Expand Down

0 comments on commit b7a84f2

Please sign in to comment.