Skip to content

Commit

Permalink
Dev: Disable textarea if user lacks permission
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Feb 5, 2018
1 parent 6841bff commit 82f6e69
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions application/controllers/admin/questions.php
Expand Up @@ -397,6 +397,10 @@ public function editdefaultvalues($surveyid, $gid, $qid)
$aData['sidemenu']['explorer']['state'] = true;
$aData['sidemenu']['explorer']['gid'] = (isset($gid)) ? $gid : false;
$aData['sidemenu']['explorer']['qid'] = (isset($qid)) ? $qid : false;
$aData['hasUpdatePermission'] =
Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update') ?
'' :
'disabled="disabled" readonly="readonly"';

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Feb 5, 2018

Collaborator

Why disable + readonly ? I like readonly : allow copy/pasting, but disable is OK too

This comment has been minimized.

Copy link
@olleharstedt

olleharstedt Feb 5, 2018

Author Contributor

I thought readonly wasn't clear enough, visually. The user might get frustrated and not understand why he/she can't edit. With disabled, it's more clear.


$this->_renderWrappedTemplate('survey/Question', 'editdefaultvalues_view', $aData);
}
Expand Down
Expand Up @@ -157,9 +157,10 @@
<?php eT("Default value:")?>
</label>
<div class="col-sm-12">
<textarea cols='50' name='defaultanswerscale_<?php echo "0_{$language}_0" ?>'
<textarea <?php echo $hasUpdatePermission; ?> cols='50' name='defaultanswerscale_<?php echo "0_{$language}_0" ?>'
id='defaultanswerscale_<?php echo "0_{$language}_0" ?>'><?php
echo htmlspecialchars($langopts[$language][$questionrow['type']][0]); ?></textarea>
echo htmlspecialchars($langopts[$language][$questionrow['type']][0]); ?>
</textarea>
</div>
</div>
<?php endif; //temporary solution?>
Expand Down

1 comment on commit 82f6e69

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think i make iot for develop, but master is OK, thanks !

Please sign in to comment.