Skip to content

Commit

Permalink
Fixed issue 8137: Relevance equation cannot be edited for unknown rea…
Browse files Browse the repository at this point in the history
…sons
  • Loading branch information
c-schmitz committed Sep 18, 2013
1 parent 5146094 commit d8e5532
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
7 changes: 2 additions & 5 deletions application/controllers/admin/question.php
Expand Up @@ -787,6 +787,8 @@ public function index($sa, $surveyid, $gid, $qid=null)
$criteria->addCondition('language != :lang');
$aqresult = Questions::model()->findAll($criteria);
$aData['aqresult'] = $aqresult;

$aData['bRelevanceReadOnly']= Questions::model()->hasConditions($aData['qid'])>0;
}

$aData['clang'] = $clang;
Expand All @@ -810,11 +812,6 @@ public function index($sa, $surveyid, $gid, $qid=null)
$aData['selectormodeclass'] = $selectormodeclass;
}

if (!$adding)
$qattributes = questionAttributes();
else
$qattributes = array();

if ($adding)
{
// Get the questions for this group
Expand Down
5 changes: 5 additions & 0 deletions application/models/Questions.php
Expand Up @@ -331,6 +331,11 @@ public function getQuestionList($surveyid, $language)
->bindParam(":language2", $language, PDO::PARAM_STR)
->bindParam(":sid", $surveyid, PDO::PARAM_INT)->queryAll();
}

public function hasConditions($iQuestionID)
{
return self::model()->count('qid = '.$iQuestionID);
}

}

Expand Down
Expand Up @@ -191,7 +191,10 @@
</li>
<li>
<label for='relevance'><?php $clang->eT("Relevance equation:"); ?></label>
<textarea cols='50' rows='1' id='relevance' name='relevance'><?php echo $eqrow['relevance']; ?></textarea>
<textarea cols='50' rows='1' id='relevance' name='relevance' <?php if (isset($bRelevanceReadOnly) && $bRelevanceReadOnly) {?> readonly='readonly'<?php } ?>><?php echo $eqrow['relevance']; ?></textarea>
<?php if (isset($bRelevanceReadOnly) && $bRelevanceReadOnly) {?>
<span class='annotation'> <?php $clang->eT("Note: You can't edit the relevance equation because there are currently conditions set for this question."); ?></span>
<?php } ?>
</li>

<li id='Validation'>
Expand Down
1 change: 1 addition & 0 deletions styles/blobblueish/adminstyle.css
Expand Up @@ -391,6 +391,7 @@ textarea {
.annotation {
font-size: 10px;
color: #E00;
vertical-align: top;
}

.errortitle {
Expand Down
1 change: 1 addition & 0 deletions styles/gringegreen/adminstyle.css
Expand Up @@ -394,6 +394,7 @@ textarea {
.annotation {
font-size: 10px;
color: #FF9D00;
vertical-align: top;
}

.errortitle {
Expand Down

1 comment on commit d8e5532

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry ....

Already fix in 2.05, not kno if it's needed in 2.0 (old 'bug').

Think i use "title" in 2.05 to give information.

Please sign in to comment.