Skip to content

Commit

Permalink
Dev: fixed Panelintegration still todo-> not saving correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Oct 10, 2017
1 parent c6eb5b5 commit 706b56d
Show file tree
Hide file tree
Showing 17 changed files with 4,077 additions and 3,348 deletions.
3 changes: 1 addition & 2 deletions application/config/packages.php
Expand Up @@ -147,12 +147,11 @@
),
'css' => array(
'build/lsadminpanel.css'
)
),
'depends' => array(
'pjax',
'jquery'
)
)

);
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -14,7 +14,7 @@

$config['versionnumber'] = '3.0.0-beta.3'; //The current version of this branch
$config['masterversion'] = '2.67.3'; //The current masters version merged into this branch
$config['dbversionnumber'] = 318;
$config['dbversionnumber'] = 319;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '2903';
Expand Down
685 changes: 275 additions & 410 deletions application/controllers/admin/database.php

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -932,13 +932,11 @@ public function rendersidemenulink($iSurveyID, $subaction){
$this->getController()->redirect(array('admin/survey','sa'=>'view','surveyid'=>$iSurveyID));
Yii::app()->end();
}

$templateData = is_array($menuEntry->data) ? $menuEntry->data : [];

if( empty($menuEntry->data)) {
$templateData = call_user_func_array(array($this,$menuEntry->getdatamethod), array('survey'=>$survey));
}
else
{
$templateData = $menuEntry->data;
if( !empty($menuEntry->getdatamethod)) {
$templateData = array_merge($templateData, call_user_func_array(array($this,$menuEntry->getdatamethod), array('survey'=>$survey)));
}

$templateData = array_merge($this->_getGeneralTemplateData($iSurveyID), $templateData);
Expand Down Expand Up @@ -1761,6 +1759,8 @@ private function _tabTokens($esrow)
*/
private function _tabPanelIntegration($survey)
{

App()->getClientScript()->registerPackage('jquery-datatable');
$aData = array();
$oResult = Question::model()->getQuestionsWithSubQuestions($survey->sid, $survey->language, "({{questions}}.type = 'T' OR {{questions}}.type = 'Q' OR {{questions}}.type = 'T' OR {{questions}}.type = 'S')");
$aData['questions'] = $oResult;
Expand Down
11 changes: 11 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -473,6 +473,17 @@ function db_upgrade_all($iOldDBVersion, $bSilent=false) {
$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>318),"stg_name='DBVersion'");
$oTransaction->commit();
}

//force panelintegration to a full reload

if ($iOldDBVersion < 319) {
$oTransaction = $oDB->beginTransaction();

$oDB->createCommand()->update('{{surveymenu_entries}}',array('data'=>'{"render": {"link": { "pjaxed": false}}}'),"name='panelintegration'");

$oDB->createCommand()->update('{{settings_global}}',array('stg_value'=>319),"stg_name='DBVersion'");
$oTransaction->commit();
}



Expand Down
6 changes: 3 additions & 3 deletions application/models/SurveymenuEntries.php
Expand Up @@ -114,11 +114,11 @@ public static function reorderMenu($menuId){
$menuEntriesInMenu = SurveymenuEntries::model()->findAll($criteriaItems);

$statistics =
Yii::app()->db->createCommand()->select('MIN(ordering) as lowOrder, MAX(ordering) as highOrder, COUNT(id) as count')
Yii::app()->db->createCommand()->select('MIN(ordering) as loworder, MAX(ordering) as highorder, COUNT(id) as count')
->from('{{surveymenu_entries}}')
->where(['menu_id = :menu_id'],['menu_id' => (int) $menuId])
->queryRow();
if( ($statistics['lowOrder'] != 1) || ($statistics['highOrder'] != $statistics['count']) ){
->queryRow();
if( ($statistics['loworder'] != 1) || ($statistics['highorder'] != $statistics['count']) ){
$current = 1;
foreach($menuEntriesInMenu as $menuEntry){
$menuEntry->ordering = $current;
Expand Down
Expand Up @@ -64,10 +64,12 @@
method:'POST',
data: data,
success: function(result){

console.log({result: result});
if(result.redirecturl != undefined ){
window.location.href=result.redirecturl;
//window.location.href=result.redirecturl;
} else {
window.location.reload();
//window.location.reload();
}
},
error: function(result){
Expand Down
Expand Up @@ -22,8 +22,32 @@
var sAddParam = "<?php eT('Add URL parameter','js');?>";
var sEditParam = "<?php eT('Edit URL parameter','js');?>";
var iSurveyId = "<?php echo $surveyid; ?>";
var questionArray =JSON.parse('<?php echo json_encode($questions); ?>');
</script>
<!-- Container -->
<lspanelparametertable :sid="<?php echo $surveyid; ?>" json-url="<?php echo App()->createUrl('admin/survey/sa/getUrlParamsJson', array('surveyid' => $surveyid))?>" :translate="{
table: {
idColumn : '<?php eT('ID');?>',
actionColumn : '<?php eT('Action');?>',
parameterColumn : '<?php eT('Parameter');?>',
questionColumn : '<?php eT('Target question');?>',
sidColumn : '<?php eT('Survey id');?>',
qidColumn : '<?php eT('Question id');?>',
sqidColumn : '<?php eT('SubQuestion ID');?>',
addParameter : '<?php eT('Add URL parameter');?>'
},
popup: {
editParam : '<?php eT('Edit URL parameter');?>',
newParam : '<?php eT('Add URL parameter');?>',
paramName : '<?php eT('Parameter');?>',
targetQuestion : '<?php eT('Target question');?>',
noTargetQuestion : '<?php eT('(No target question)');?>',
save : '<?php eT('Save');?>',
cancel : '<?php eT('Cancel');?>'
}
}"></lspanelparametertable>

<?php /*
<div class="container-fluid">
<div class="row">
<div class="col-sm-12">
Expand All @@ -41,4 +65,5 @@
<!-- Modal box to add a parameter -->
<div data-copy="submitsurveybutton"></div>
<?php $this->renderPartial('survey/subview/addPanelIntegrationParameter_view', array('questions' => $questions)); ?>
<?php $this->renderPartial('survey/subview/addPanelIntegrationParameter_view', array('questions' => $questions)); ?>
*/?>

0 comments on commit 706b56d

Please sign in to comment.