Skip to content

Commit

Permalink
Fixed issue #7670: Unable to browse responses in other language than …
Browse files Browse the repository at this point in the history
…default
  • Loading branch information
c-schmitz committed Mar 17, 2013
1 parent 63dda19 commit 62bf59a
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 29 deletions.
13 changes: 4 additions & 9 deletions application/controllers/admin/responses.php
Expand Up @@ -68,24 +68,19 @@ private function _getData($params)

$aData['surveyinfo'] = $thissurvey;

if (isset($browselang) && $browselang != '')
if (Yii::app()->request->getParam('browselang'))
{
Yii::app()->session['browselang'] = $browselang;
$aData['language'] = Yii::app()->session['browselang'];
}
elseif (isset(Yii::app()->session['browselang']))
{
$aData['language'] = Yii::app()->session['browselang'];
$aData['language'] = Yii::app()->request->getParam('browselang');
$aData['languagelist'] = $languagelist = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
$aData['languagelist'][] = Survey::model()->findByPk($iSurveyId)->language;
if (!in_array($aData['language'], $languagelist))
{
$aData['language'] = Survey::model()->findByPk($iSurveyId)->language;
$aData['language'] = $thissurvey['language'];
}
}
else
{
$aData['language'] = Survey::model()->findByPk($iSurveyId)->language;
$aData['language'] = $thissurvey['language'];
}

$aData['qulanguage'] = Survey::model()->findByPk($iSurveyId)->language;
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/tokens.php
Expand Up @@ -2394,7 +2394,7 @@ function _newtokentable($iSurveyId)
* @param array $aData Data to be passed on. Optional.
*/
protected function _renderWrappedTemplate($sAction = 'token', $aViewUrls = array(), $aData = array())
{
{
$aData['imageurl'] = Yii::app()->getConfig('adminimageurl');
$aData['display']['menu_bars'] = false;
parent::_renderWrappedTemplate($sAction, $aViewUrls, $aData);
Expand Down
12 changes: 11 additions & 1 deletion application/core/Survey_Common_Action.php
Expand Up @@ -871,7 +871,17 @@ function _browsemenubar($iSurveyID, $title='')
$aData['sImageURL'] = Yii::app()->getConfig("adminimageurl");
$aData['clang'] = Yii::app()->lang;
$aData['surveyid'] = $iSurveyID;
$aData['languagelist'] = Survey::model()->findByPk($iSurveyID)->getAllLanguages();
$js_admin_includes[] = Yii::app()->getConfig('generalscripts') . 'jquery/superfish.js';
$js_admin_includes[] = Yii::app()->getConfig('generalscripts') . 'jquery/hoverIntent.js';
$this->getController()->_js_admin_includes($js_admin_includes);
$this->getController()->_css_admin_includes(Yii::app()->getConfig('adminstyleurl')."superfish.css");


$tmp_survlangs = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
$baselang = Survey::model()->findByPk($iSurveyID)->language;
$tmp_survlangs[] = $baselang;
rsort($tmp_survlangs);
$aData['tmp_survlangs'] = $tmp_survlangs;

$this->getController()->renderPartial("/admin/responses/browsemenubar_view", $aData);
}
Expand Down
58 changes: 43 additions & 15 deletions application/views/admin/responses/browsemenubar_view.php
Expand Up @@ -13,21 +13,49 @@
{ ?>
<a href='<?php echo $this->createUrl("admin/responses/sa/index/surveyid/$surveyid"); ?>'>
<img src='<?php echo $sImageURL; ?>summary.png' title='' alt='<?php $clang->eT("Show summary information"); ?>' /></a>
<a id='browseresponses' href='<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid"); ?>'>
<img src='<?php echo $sImageURL; ?>document.png' title='' alt='<?php $clang->eT("Display Responses"); ?>' /></a>
<?php if (count($languagelist) > 1)
{ ?>
<div class="popuptip" rel="browseresponses"><?php $clang->eT("Display Responses in:"); ?>
<ul>
<?php foreach ($languagelist as $tmp_lang){ ?>
<li><a href='<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid/browselang/$tmp_lang"); ?>' ><?php echo getLanguageNameFromCode($tmp_lang,false); ?></a></li>
<?php } ?>
</ul>
</div>
<?php } ?>
<a href='<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid/start/0/limit/50/order/desc"); ?>'>
<img src='<?php echo $sImageURL; ?>viewlast.png' alt='<?php $clang->eT("Display Last 50 Responses"); ?>' /></a>
<?php }
<?php } ?>
</div>
<?php if (hasSurveyPermission($surveyid, 'responses', 'read'))
{ ?>
<ul class='sf-menu'>
<?php if (count(Survey::model()->findByPk($surveyid)->additionalLanguages) == 0) { ?>
<li><a href='<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid"); ?>'>
<img src='<?php echo $sImageURL; ?>document.png' title='' alt='<?php $clang->eT("Display Responses"); ?>' /></a></li>
<?php } else { ?>
<li><a href='#' accesskey='b'>
<img src='<?php echo $sImageURL;?>document.png' alt='<?php $clang->eT("Display Responses"); ?>' />
</a><ul>
<li><a accesskey='b' target='_blank' href='<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid"); ?>'>
<img src='<?php echo $sImageURL;?>document_30.png' alt=''/> <?php $clang->eT("Display Responses"); ?> </a><ul>
<?php foreach ($tmp_survlangs as $tmp_lang) { ?>
<li>
<a href="<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid/start/0/limit/50/order/asc/browselang/$tmp_lang"); ?>" accesskey='b'><img src='<?php echo $sImageURL;?>document_30.png' alt=''/> <?php echo getLanguageNameFromCode($tmp_lang, false); ?></a>
</li>
<?php } ?>
</ul></li>
</ul></li>
<?php } ?>
<?php if (count(Survey::model()->findByPk($surveyid)->additionalLanguages) == 0) { ?>
<li><a href='<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid"); ?>'>
<img src='<?php echo $sImageURL; ?>viewlast.png' title='' alt='<?php $clang->eT("Display Last 50 Responses"); ?>' /></a></li>
<?php } else { ?>
<li><a href='#' accesskey='b'>
<img src='<?php echo $sImageURL;?>viewlast.png' alt='<?php $clang->eT("Display Last 50 Responses"); ?>' />
</a><ul>
<li><a accesskey='b' target='_blank' href='<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid/start/0/limit/50/order/desc"); ?>'>
<img src='<?php echo $sImageURL;?>document_30.png' alt=''/> <?php $clang->eT("Display Last 50 Responses"); ?> </a><ul>
<?php foreach ($tmp_survlangs as $tmp_lang) { ?>
<li>
<a href="<?php echo $this->createUrl("admin/responses/sa/browse/surveyid/$surveyid/start/0/limit/50/order/desc/browselang/$tmp_lang"); ?>" accesskey='b'><img src='<?php echo $sImageURL;?>document_30.png' alt=''/> <?php echo getLanguageNameFromCode($tmp_lang, false); ?></a>
</li>
<?php } ?>
</ul></li>
</ul></li>
<?php } ?>
</ul>
<?php } ?>
<div class='menubar-left'>
<?php
if (hasSurveyPermission($surveyid, 'responses', 'create'))
{ ?>
<a href='<?php echo $this->createUrl("admin/dataentry/sa/view/surveyid/$surveyid"); ?>'>
Expand Down
6 changes: 3 additions & 3 deletions scripts/admin/browse.js
Expand Up @@ -12,9 +12,9 @@
* $Id: browse.js 10251 2011-06-10 17:33:49Z tpartner $
*/
$(document).ready(function(){



$('ul.sf-menu').superfish({
speed:'fast'
});
$("#selectall").click(function(){
$('.cbResponseMarker').attr('checked',$(this).attr('checked'));
});
Expand Down
Binary file added styles/blobblueish/images/document_30.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/blobblueish/images/viewlast_30.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/gartergrey/images/document_30.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/gartergrey/images/viewlast_30.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/gringegreen/images/document_30.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added styles/gringegreen/images/viewlast_30.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 62bf59a

Please sign in to comment.