Skip to content

Commit

Permalink
Dev: quick actions fixed, display of new/edit question ok on 720p and…
Browse files Browse the repository at this point in the history
… under
  • Loading branch information
louis committed Sep 15, 2015
1 parent dc29f52 commit 7a464be
Show file tree
Hide file tree
Showing 8 changed files with 294 additions and 268 deletions.
4 changes: 4 additions & 0 deletions application/controllers/admin/questions.php
Expand Up @@ -1040,6 +1040,10 @@ public function index($sa, $surveyid, $gid, $qid=null)
}
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'questions.js');

$aData['sValidateUrl'] = ($adding || $copying)?$this->getController()->createUrl('admin/questions', array('sa' => 'ajaxValidate','surveyid'=>$surveyid)):$this->getController()->createUrl('admin/questions', array('sa' => 'ajaxValidate','surveyid'=>$surveyid,'qid'=>$qid));

$aData['addlanguages'] = Survey::model()->findByPk($surveyid)->additionalLanguages;

$aViewUrls['editQuestion_view'][] = $aData;
$aViewUrls['questionJavascript_view'][] = array('type' => $eqrow['type']);
}
Expand Down
10 changes: 6 additions & 4 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -395,19 +395,21 @@ public function view($iSurveyID, $gid = null, $qid = null)

$survey = Survey::model()->findByPk($iSurveyID);
$surveyinfo = $survey->surveyinfo;

$aData['title_bar']['title'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
$aData["surveyinfo"] = $surveyinfo;
$aData['surveyid'] = $iSurveyID;
$aData['gid'] = $gid;
$aData['qid'] = $qid;

if($gid==null)
$aData['display']['surveysummary'] = true;
$aData['surveybar']['buttons']['view']= true;
{
$aData['display']['surveysummary'] = true;
}


$aData['surveybar']['buttons']['view']= true;
$aData['surveybar']['returnbutton']['url'] = $this->getController()->createUrl("admin/survey/sa/listsurveys");
$aData['surveybar']['returnbutton']['text'] = gT('return to survey list');

$aData['sidebar']["survey_menu"]=TRUE;


Expand Down
5 changes: 4 additions & 1 deletion application/core/Survey_Common_Action.php
Expand Up @@ -733,7 +733,9 @@ function _surveybar($aData)
//$sumquery3 = "SELECT * FROM ".db_table_name('questions')." WHERE sid={$iSurveyID} AND parent_qid=0 AND language='".$baselang."'"; //Getting a count of questions for this survey
$sumresult3 = Question::model()->findAllByAttributes($condition); //Checked
$sumcount3 = count($sumresult3);




$aData['canactivate'] = $sumcount3 > 0 && Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
$aData['candeactivate'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
$aData['expired'] = $surveyinfo['expires'] != '' && ($surveyinfo['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust')));
Expand Down Expand Up @@ -1155,6 +1157,7 @@ function _surveysummary($iSurveyID, $action=null, $gid=null)
$aData['aAdditionalLanguages'] = $aAdditionalLanguages;
$aData['surveyinfo'] = $aSurveyInfo;

$aData['groups_count'] = $sumcount2;
$this->getController()->renderPartial("/admin/survey/surveySummary_view", $aData);
}

Expand Down
368 changes: 172 additions & 196 deletions application/views/admin/survey/Question/editQuestion_view.php

Large diffs are not rendered by default.

Expand Up @@ -7,79 +7,90 @@
<?php $eqrow = array_map('htmlspecialchars', $eqrow); ?>
<?php if($eqrow['title']) {$sPattern="^([a-zA-Z][a-zA-Z0-9]*|{$eqrow['title']})$";}else{$sPattern="^[a-zA-Z][a-zA-Z0-9]*$";} ?>

<ul class="nav nav-tabs" >
<!-- New question language tabs -->
<ul class="nav nav-tabs" style="margin-right: 8px;" >
<li role="presentation" class="active">
<a data-toggle="tab" href="#<?php echo $eqrow['language']; ?>">
<?php echo getLanguageNameFromCode($eqrow['language'],false); ?>
(<?php eT("Base language"); ?>)
</a>
</li>

<?php foreach ($addlanguages as $addlanguage):?>
<li role="presentation">
<a data-toggle="tab" href="#<?php echo $addlanguage; ?>">
<?php echo getLanguageNameFromCode($addlanguage,false); ?>
</a>
</li>
<?php endforeach; ?>

</ul>

<!-- Editors for each languages -->
<div class="tab-content">

<!-- Base Language tab-pane -->
<div id="<?php echo $eqrow['language']; ?>" class="tab-pane fade in active">
<div class="form-group">
<label class="col-sm-2 control-label" for='title'>

<!-- Question Code -->
<div class="form-group col-sm-12" style="padding-left: 0px;">
<label class="col-sm-1 control-label" for='title' style="padding-left: 0px;">
<?php eT("Code:"); ?>
</label>
<div class="col-sm-5">
<div class="col-sm-4" style="padding-left: 0px;">
<input type='text' autofocus="autofocus" size='20' maxlength='20' id='title' required='required' name='title' pattern='<?php echo $sPattern ?>' value="<?php echo $eqrow['title']; ?>" />
</div>
<span class='text-warning'><?php eT("Required"); ?> </span>
<div class="col-sm-1" style="padding-left: 0px;">
<span class='text-warning'><?php eT("Required"); ?> </span>
</div>
</div>


<!-- Question Text -->
<div class="form-group">
<label for='question_<?php echo $eqrow['language']; ?>' class=""> <?php eT("Question:"); ?></label>
<div class='htmleditor' style="position: relative; top: -8px; left:0px;" >
<div class='htmleditor' >
<textarea cols='80' rows='100' id='question_<?php echo $eqrow['language']; ?>' name='question_<?php echo $eqrow['language']; ?>'><?php echo $eqrow['question']; ?></textarea>
</div>
<?php echo getEditor("question-text","question_".$eqrow['language'], "[".gT("Question:", "js")."](".$eqrow['language'].")",$surveyid,$gid,$qid,$action); ?>

</div>

<!-- Question Help -->
<div class="form-group">
<label for='help_<?php echo $eqrow['language']; ?>' class="col-sm-2 control-label"><?php eT("Help:"); ?></label>
<label for='help_<?php echo $eqrow['language']; ?>' class=""><?php eT("Help:"); ?></label>

<div class='htmleditor col-sm-offset-2' style="position: relative; top: -8px; left: 7px;" >
<div class='htmleditor' >
<textarea cols='45' rows='4' id='help_<?php echo $eqrow['language']; ?>' name='help_<?php echo $eqrow['language']; ?>'><?php echo $eqrow['help']; ?></textarea>
</div>
<?php echo getEditor("question-help","help_".$eqrow['language'], "[".gT("Help:", "js")."](".$eqrow['language'].")",$surveyid,$gid,$qid,$action); ?>
</div>
</div>

<!-- Other languages tab-panes -->
<?php foreach ($addlanguages as $addlanguage): ?>
<div id="<?php echo $addlanguage; ?>" class="tab-pane fade">


<!-- Question Text -->
<div class="form-group">
<label class="col-sm-2 control-label" for='question_<?php echo $addlanguage; ?>'><?php eT("Question:"); ?></label>

<div class='htmleditor col-sm-offset-2' style="position: relative; top: -8px; left: 7px;" >
<textarea cols='45' rows='4' id='question_<?php echo $addlanguage; ?>' name='question_<?php echo $addlanguage; ?>'></textarea>
<?php echo getEditor("question-text","question_".$addlanguage, "[".gT("Question:", "js")."](".$addlanguage.")",$surveyid,$gid,$qid,$action); ?>
</div>
</div>
<label for='question_<?php echo $addlanguage; ?>'><?php eT("Question:"); ?></label>
<div class='htmleditor' >
<textarea cols='80' rows='4' id='question_<?php echo $addlanguage; ?>' name='question_<?php echo $addlanguage; ?>'></textarea>
</div>
<?php echo getEditor("question-text","question_".$addlanguage, "[".gT("Question:", "js")."](".$addlanguage.")",$surveyid,$gid,$qid,$action); ?>
</div>

<!-- Question Help -->
<div class="form-group">
<label for='help_<?php echo $addlanguage; ?>'><?php eT("Help:"); ?></label>

<div class='htmleditor col-sm-offset-2' style="position: relative; top: -8px; left: 7px;" >
<div class='htmleditor'>
<textarea cols='45' rows='4' id='help_<?php echo $addlanguage; ?>' name='help_<?php echo $addlanguage; ?>'></textarea>
<?php echo getEditor("question-help","help_".$addlanguage, "[".gT("Help:", "js")."](".$addlanguage.")",$surveyid,$gid,$qid,$action); ?>
</div>
</div>

</div>
<?php endforeach; ?>
</div>

<!-- submit buttons-->
<div id='questionactioncopy' class='extra-action'>
<button type='submit' class="saveandreturn" name="redirection" value="edit"><?php eT("Save") ?> </button>
<input type='submit' value='<?php eT("Save and close"); ?>' />
<button type='submit' class="saveandreturn hidden" name="redirection" value="edit"><?php eT("Save") ?> </button>
<input type='submit' class="hidden" value='<?php eT("Save and close"); ?>' />
</div>
34 changes: 22 additions & 12 deletions application/views/admin/survey/Question/newQuestion_view.php
@@ -1,37 +1,47 @@
<?php
/**
* This view display the page to add a new question to a controller, and to choose its group.
* It will have to be merged with other question function such as "edit" or "copy".
* TODO : It will have to be merged with other question function such as "edit" or "copy".
*
*/
?>

<?php $this->renderPartial("./survey/Question/newQuestion_subviews/_ajax_variables", $ajaxDatas); ?>

<div class="side-body" id="edit-question-body">
<h3>
<?php eT("Add a new question"); ?>
</h3>
<h3><?php eT("Add a new question"); ?></h3>

<div class="row">
<!-- Form for the whole page-->
<?php echo CHtml::form(array("admin/database/index"), 'post',array('class'=>'form30','id'=>'frmeditquestion','name'=>'frmeditquestion')); ?>

<!-- The tabs & tab-fanes -->
<div class="col-lg-8 content-right">
<?php $this->renderPartial('./survey/Question/newQuestion_subviews/_tabs',array('eqrow'=>$eqrow,'addlanguages'=>$addlanguages, 'surveyid'=>$surveyid, 'gid'=>NULL, 'qid'=>NULL, 'action'=>'addquestion' ));?>
</div>

<div class="col-lg-4">
<!-- The Accordion -->
<div class="col-lg-4" style="padding-left: 0px; padding-right: 0px;">
<?php
// TODO : find why the $groups can't be generated from controller
// $this->renderPartial('./survey/Question/newQuestion_subviews/_accordion_container', $accordionDatas);
?>
// TODO : find why the $groups can't be generated from controller
// $this->renderPartial('./survey/Question/newQuestion_subviews/_accordion_container', $accordionDatas);
?>
<div id='questionbottom'>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">

<!-- General Options -->
<div class="panel panel-default" id="questionTypeContainer">

<!-- General Options : Header -->
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
<?php eT("General Option");?>
</a>
</h4>
</div>

<!-- General Options : Body -->
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
<div>
Expand Down Expand Up @@ -133,7 +143,7 @@
</div>
</div>


<!-- Advanced Settings-->
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
<h4 class="panel-title">
Expand Down Expand Up @@ -171,9 +181,9 @@


</div>
<input type='hidden' name='action' value='insertquestion' />
<input type='submit' value='<?php eT("Add question"); ?>' />
<input type='hidden' id='sid' name='sid' value='<?php echo $surveyid; ?>' />
<input type='hidden' name='action' value='insertquestion' />
<input type='submit' class="hidden" value='<?php eT("Add question"); ?>' />
<input type='hidden' id='sid' name='sid' value='<?php echo $surveyid; ?>' />
</form>
<script type='text/javascript'>
<!--
Expand Down
32 changes: 20 additions & 12 deletions application/views/admin/survey/Question/question_subviews/_tabs.php
Expand Up @@ -7,56 +7,64 @@
<?php $eqrow = array_map('htmlspecialchars', $eqrow); ?>
<?php if($eqrow['title']) {$sPattern="^([a-zA-Z][a-zA-Z0-9]*|{$eqrow['title']})$";}else{$sPattern="^[a-zA-Z][a-zA-Z0-9]*$";} ?>

<ul class="nav nav-tabs" >
<!-- New question language tabs -->
<ul class="nav nav-tabs" style="margin-right: 8px;" >
<li role="presentation" class="active">
<a data-toggle="tab" href="#<?php echo $eqrow['language']; ?>">
<?php echo getLanguageNameFromCode($eqrow['language'],false); ?>
(<?php eT("Base language"); ?>)
</a>
</li>

<?php foreach ($addlanguages as $addlanguage):?>
<li role="presentation">
<a data-toggle="tab" href="#<?php echo $addlanguage; ?>">
<?php echo getLanguageNameFromCode($addlanguage,false); ?>
</a>
</li>
<?php endforeach; ?>

</ul>

<!-- Editors for each languages -->
<div class="tab-content">

<!-- Base Language tab-pane -->
<div id="<?php echo $eqrow['language']; ?>" class="tab-pane fade in active">
<div class="form-group">
<label class="col-sm-2 control-label" for='title'>

<!-- Question Code -->
<div class="form-group col-sm-12" style="padding-left: 0px;">
<label class="col-sm-1 control-label" for='title' style="padding-left: 0px;">
<?php eT("Code:"); ?>
</label>
<div class="col-sm-5">
<div class="col-sm-4" style="padding-left: 0px;">
<input type='text' autofocus="autofocus" size='20' maxlength='20' id='title' required='required' name='title' pattern='<?php echo $sPattern ?>' value="<?php echo $eqrow['title']; ?>" />
</div>
<span class='text-warning'><?php eT("Required"); ?> </span>
<div class="col-sm-1" style="padding-left: 0px;">
<span class='text-warning'><?php eT("Required"); ?> </span>
</div>
</div>


<!-- Question Text -->
<div class="form-group">
<label for='question_<?php echo $eqrow['language']; ?>' class="col-sm-2 control-label"><?php eT("Question:"); ?></label>
<label for='question_<?php echo $eqrow['language']; ?>' class=""><?php eT("Question:"); ?></label>

<div class='htmleditor col-sm-offset-2' style="position: relative; top: -8px; left: 7px;" >
<div class='htmleditor'>
<textarea cols='80' rows='100' id='question_<?php echo $eqrow['language']; ?>' name='question_<?php echo $eqrow['language']; ?>'><?php echo $eqrow['question']; ?></textarea>
</div>
<?php echo getEditor("question-text","question_".$eqrow['language'], "[".gT("Question:", "js")."](".$eqrow['language'].")",$surveyid,$gid,$qid,$action); ?>
</div>

<!-- Question Help -->
<div class="form-group">
<label for='help_<?php echo $eqrow['language']; ?>' class="col-sm-2 control-label"><?php eT("Help:"); ?></label>
<label for='help_<?php echo $eqrow['language']; ?>'><?php eT("Help:"); ?></label>

<div class='htmleditor col-sm-offset-2' style="position: relative; top: -8px; left: 7px;" >
<div class='htmleditor' >
<textarea cols='45' rows='4' id='help_<?php echo $eqrow['language']; ?>' name='help_<?php echo $eqrow['language']; ?>'><?php echo $eqrow['help']; ?></textarea>
</div>
<?php echo getEditor("question-help","help_".$eqrow['language'], "[".gT("Help:", "js")."](".$eqrow['language'].")",$surveyid,$gid,$qid,$action); ?>
</div>
</div>

<!-- Other languages tab-panes -->
<?php if (!$adding):?>
<?php foreach ($aqresult as $aqrow): ?>
<?php $aqrow = $aqrow->attributes;?>
Expand Down

0 comments on commit 7a464be

Please sign in to comment.