Skip to content

Commit

Permalink
New feature: question save/save and close options - instead of just u…
Browse files Browse the repository at this point in the history
…pdating and closing, now choice is to save and keep editing, or to save and return to question view. My wife made me do it.
  • Loading branch information
jcleeland committed Jul 22, 2012
1 parent fbc70dc commit 3e04821
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 11 deletions.
6 changes: 5 additions & 1 deletion application/controllers/admin/database.php
Expand Up @@ -851,7 +851,11 @@ function index($sa = null)
}
else
{
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
if(Yii::app()->request->getPost('newpage') == "return") {
$this->getController()->redirect($this->getController()->createUrl('admin/question/editquestion/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
} else {
$this->getController()->redirect($this->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/gid/'.$gid.'/qid/'.$qid));
}
}
}

Expand Down
12 changes: 9 additions & 3 deletions application/views/admin/survey/Question/editQuestion_view.php
Expand Up @@ -14,6 +14,7 @@
<?php } else { ?>
<?php $clang->eT("Edit question"); ?>
<?php } ?>

</div>

<div id='tabs'>
Expand All @@ -32,7 +33,11 @@
?>
</ul>
<form name='frmeditquestion' id='frmeditquestion' class='form30' action='<?php echo $this->createUrl("admin/database/index"); ?>' method='post' onsubmit="return isEmpty(document.getElementById('title'), '<?php $clang->eT("Error: You have to enter a question code.",'js'); ?>');">
<div id="<?php echo $eqrow['language']; ?>">
<div id='questionactioncopy' style='float: right; margin-top: -60px'>
<p><input type='button' class="saveandreturn" value='<?php $clang->eT("Save") ?>' />
<input type='submit' value='<?php $clang->eT("Save and close"); ?>' />
</div>
<div id="<?php echo $eqrow['language']; ?>">
<?php $eqrow = array_map('htmlspecialchars', $eqrow); ?>
<ul><li>
<label for='title'> <?php $clang->eT("Code:"); ?></label><input type='text' size='20' maxlength='20' id='title' name='title' value="<?php echo $eqrow['title']; ?>" /> <?php if ($copying) $clang->eT("Note: You MUST enter a new question code!"); ?>
Expand Down Expand Up @@ -227,7 +232,6 @@
<div id="advancedquestionsettings"></div>
</div><br />
<?php } ?>

<?php if ($adding)
{ ?>
<input type='hidden' name='action' value='insertquestion' />
Expand All @@ -244,8 +248,10 @@
else
{ ?>
<input type='hidden' name='action' value='updatequestion' />
<input type='hidden' id='newpage' name='newpage' value='' />
<input type='hidden' id='qid' name='qid' value='<?php echo $qid; ?>' />
<p><input type='submit' value='<?php $clang->eT("Update question"); ?>' />
<p><input type='button' class="saveandreturn" value='<?php $clang->eT("Save") ?>' />
<input type='submit' value='<?php $clang->eT("Save and close"); ?>' />
<?php } ?>
<input type='hidden' id='sid' name='sid' value='<?php echo $surveyid; ?>' /></p><br />
</div></form></div>
Expand Down
19 changes: 12 additions & 7 deletions scripts/admin/surveytoolbar.js
Expand Up @@ -2,7 +2,7 @@
// based on TTabs from http://interface.eyecon.ro/

$(document).ready(function(){
// Load the superfish menu
// Load the superfish menu
$('ul.sf-menu').superfish({
speed:'fast'
});
Expand All @@ -12,18 +12,18 @@ $(document).ready(function(){
{
$(this).qtip({
style: { name: 'cream',
tip:true,
color:'#1D2D45',
tip:true,
color:'#1D2D45',
border: {
width: 1,
radius: 5,
color: '#EADF95'}
},
position: { adjust: {
},
position: { adjust: {
screen: true, scroll:true },
corner: {
target: 'topRight',
tooltip: 'bottomLeft'}
tooltip: 'bottomLeft'}
},
show: {effect: { length:50},
delay:1000
Expand All @@ -33,5 +33,10 @@ $(document).ready(function(){

});
}
});
});
$(".saveandreturn").click(function() {
var form=$(this).parents('form:first'); //Get the parent form info
$("#newpage").val('return');
form.submit();
});
});

0 comments on commit 3e04821

Please sign in to comment.