Skip to content

Commit

Permalink
Dev: added save and new question button
Browse files Browse the repository at this point in the history
Dev: added lstutorial basics
  • Loading branch information
lacrioque committed Oct 19, 2017
1 parent 5d5459b commit 178ba23
Show file tree
Hide file tree
Showing 39 changed files with 3,054 additions and 213 deletions.
35 changes: 34 additions & 1 deletion application/config/packages.php
Expand Up @@ -153,6 +153,38 @@
'jquery'
)
),
'lstutorial' => array(
'devBaseUrl' => 'assets/packages/lstutorial/',
'basePath' => 'core.lstutorial',
'coreScriptPosition'=>CClientScript::POS_BEGIN,
'defaultScriptFilePosition' =>CClientScript::POS_BEGIN,
'defaultScriptPosition' =>CClientScript::POS_BEGIN,
'position' =>CClientScript::POS_BEGIN,
'js' => array(
'build/lstutorial'.$minVersion.'.js',
),
'css' => array(
'build/lstutorial.css'
),
'depends' => array(
'pjax',
'jquery'
)
),
'adminbasics' => array(
'devBaseUrl' => 'assets/packages/adminbasics/',
'basePath' => 'core.adminbasics',
'js' => array(
'js/admin_core.js',
'js/notifications.js'
),
'depends' => array(
'pjax',
'jquery',
'adminpanel',
'lstutorial'
)
),
'surveymenufunctions' => array(
'devBaseUrl' => 'assets/packages/surveymenufunctions/',
'basePath' => 'core.surveymenufunctions',
Expand All @@ -163,6 +195,7 @@
'pjax',
'jquery'
)
)
),


);
4 changes: 2 additions & 2 deletions application/controllers/AdminController.php
Expand Up @@ -44,8 +44,8 @@ protected function _init()
// This line is needed for template editor to work
$oAdminTheme = AdminTheme::getInstance();

App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'admin_core.js');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'notifications.js' );
// App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'admin_core.js');
// App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'notifications.js' );
}

/**
Expand Down
4 changes: 4 additions & 0 deletions application/controllers/admin/questiongroups.php
Expand Up @@ -249,6 +249,10 @@ public function insert($surveyid)
{
$this->getController()->redirect(array("admin/questiongroups/sa/add/surveyid/$surveyid"));
}
else if(Yii::app()->request->getPost('saveandnewquestion','') !== '')
{
$this->getController()->redirect(array("admin/questions/sa/newquestion/", 'surveyid' => $surveyid, 'gid' => $newGroupID));
}
else
{
// After save, go to edit
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/templates.php
Expand Up @@ -322,9 +322,9 @@ public function index($editfile = '', $screenname = 'welcome', $templatename = '

App()->getClientScript()->reset();
Yii::app()->clientScript->packages['bootstrap']=$aBootstrapPackage;
App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'admin_core.js');
// App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'admin_core.js');
App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'templates.js');
App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'notifications.js');
// App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'notifications.js');
App()->getClientScript()->registerPackage('ace');
App()->getClientScript()->registerPackage('jsuri');
$aData['fullpagebar']['returnbutton']=true;
Expand Down Expand Up @@ -1067,7 +1067,7 @@ protected function _initialise($templatename, $screenname, $editfile, $showsumma
$aViewUrls = array_merge($aViewUrls, $this->_templatesummary($templatename, $screenname, $sEditfile, $editfile, $aAllTemplates, $files, $cssfiles, $jsfiles, $otherfiles, $myoutput));
}

App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'admin_core.js');
// App()->getClientScript()->registerScriptFile( App()->getConfig('adminscripts') . 'admin_core.js');

return $aViewUrls;
}
Expand Down
3 changes: 1 addition & 2 deletions application/models/AdminTheme.php
Expand Up @@ -147,8 +147,7 @@ public function registerStylesAndScripts()
App()->getClientScript()->registerPackage('bootstrap-switch');
App()->getClientScript()->registerPackage('bootstrap-select2');
App()->getClientScript()->registerPackage('bootstrap-datetimepicker');
App()->getClientScript()->registerPackage('pjax'); // pjax -> Push State Ajax loading library
App()->getClientScript()->registerPackage('adminpanel'); // Combined scripts and style for the new admin panel
App()->getClientScript()->registerPackage('adminbasics'); // Combined scripts and style for the new admin panel
App()->getClientScript()->registerPackage('ckeditor'); //
App()->getClientScript()->registerPackage('ckeditoradditions'); // CKEDITOR in a global sope
}
Expand Down
27 changes: 18 additions & 9 deletions application/views/admin/super/welcome.php
Expand Up @@ -50,14 +50,23 @@
<h4 class="modal-title"><?php echo sprintf(gT("Welcome to %s!"), 'LimeSurvey'); ?></h4>
</div>
<div class="modal-body">
<p><?php eT("Some piece-of-cake steps to create your very own first survey:"); ?></p>
<ol>
<li><?php echo sprintf(gT('Create a new survey clicking on the %s icon.'),
"<span class='icon-add text-success'></span>"); ?></li>
<li><?php eT('Create a new question group inside your survey.'); ?></li>
<li><?php eT('Create one or more questions inside the new question group.'); ?></li>
<li><?php echo sprintf(gT('Done. Test your survey using the %s icon.'), "<span class='icon-do text-success'></span>"); ?></li>
</ol>
<div class="container-fluid">
<div class="row" id="selector__welcome-modal--simplesteps">
<p><?php eT("Some piece-of-cake steps to create your very own first survey:"); ?></p>
<ol>
<li><?php echo sprintf(gT('Create a new survey clicking on the %s icon.'),
"<span class='icon-add text-success'></span>"); ?></li>
<li><?php eT('Create a new question group inside your survey.'); ?></li>
<li><?php eT('Create one or more questions inside the new question group.'); ?></li>
<li><?php echo sprintf(gT('Done. Test your survey using the %s icon.'), "<span class='icon-do text-success'></span>"); ?></li>
</ol>
</div>
<div class="row"><hr/></div>
<div class="row" id="selector__welcome-modal--tutorial">
<p><?php eT('Or, try out our interactive tutorial tour'); ?> </p>
<p class="text-center"><button class="btn btn-primary btn-lg" id="selector__welcome-modal--starttour"><?php eT("Start the tour"); ?></button></p>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><?php eT('Close');?></button>
Expand Down Expand Up @@ -146,7 +155,7 @@
</div>
</div>

</div>
</>
</div>

<!-- Notification setting -->
Expand Down
Expand Up @@ -64,7 +64,6 @@
method:'POST',
data: data,
success: function(result){

console.log({result: result});
if(result.redirecturl != undefined ){
window.location.href=result.redirecturl;
Expand Down
Expand Up @@ -50,7 +50,7 @@
<div class="">
<?php $this->widget('yiiwheels.widgets.switch.WhSwitch', array(
'name' => 'createsample',
'value' => 1,
'value' => 0,
'onLabel'=>gT('On'),
'offLabel'=>gT('Off')
)); ?>
Expand Down
11 changes: 6 additions & 5 deletions application/views/admin/survey/subview/tabCreate_view.php
Expand Up @@ -73,7 +73,7 @@
</div>
</div>
<div class="row">
<input type="hidden" name="saveandclose" value="1" />
<input type="hidden" name="saveandclose" id="submitaddnesurvey" value="1" />
<!-- Submit button -->
<button class="btn btn-primary btn-success hide" type="submit" name="save" id="create_survey_save_and_send" value='insertsurvey'><?php eT("Finish & save"); ?></button>
</div>
Expand Down Expand Up @@ -109,12 +109,13 @@
$('#save-and-close-form-button').removeClass('disabled');
}
});
$('#addnewsurvey').on('submit', function(event){
event.preventDefault();
var form = this;

$('#addnewsurvey').on('submit', function(ev){
ev.preventDefault();
updateCKfields();
var data = $(this).serializeArray();
var uri = $(this).attr('action');
var data = $(form).serializeArray();
var uri = $(form).attr('action');
$.ajax({
url: uri,
method:'POST',
Expand Down
8 changes: 7 additions & 1 deletion application/views/admin/survey/surveybar_view.php
Expand Up @@ -645,11 +645,17 @@
$paramArray = array();
$paramArray["surveyid"] = $surveyid;
$saveAndNewLink = $this->createUrl("admin/questiongroups/sa/add/", $paramArray);
$saveAndAddQuestionLink = $this->createUrl("admin/questions/sa/newquestion/", $paramArray);
?>

<a class="btn btn-success" id='save-and-new-question-button' href="<?php echo $saveAndAddQuestionLink ?>" role="button">
<span class="fa fa-floppy-o"></span>
<?php eT("Save and add question");?>
</a>

<a class="btn btn-success" id='save-and-new-button' href="<?php echo $saveAndNewLink ?>" role="button">
<span class="fa fa-floppy-o"></span>
<?php eT("Save and new");?>
<?php eT("Save and new group");?>
</a>
<?php endif;?>
<?php if(isset($surveybar['importquestion'])):?>
Expand Down

0 comments on commit 178ba23

Please sign in to comment.