Skip to content

Commit

Permalink
Don't show empty column in OreDictList when can't edit
Browse files Browse the repository at this point in the history
Close #55.
  • Loading branch information
elifoster committed Oct 12, 2017
1 parent 8d7cf17 commit 29d3022
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions special/OreDictList.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,26 @@ public function execute($par) {
$msgModName = wfMessage('oredict-mod-name');
$msgGridParams = wfMessage('oredict-grid-params');
$canEdit = in_array("editoredict", $this->getUser()->getRights());
$table .= "! !! # !! $msgTagName !! $msgItemName !! $msgModName !! $msgGridParams\n";
$table .= "!";
if ($canEdit) {
$table .= " !!";
}
$table .= " # !! $msgTagName !! $msgItemName !! $msgModName !! $msgGridParams\n";
$linkStyle = "style=\"width:23px; padding-left:5px; padding-right:5px; text-align:center; font-weight:bold;\"";
foreach ($results as $result) {
$lId = $result->entry_id;
$lTag = $result->tag_name;
$lItem = $result->item_name;
$lMod = $result->mod_name;
$lParams = $result->grid_params;
$table .= "|-\n";
$table .= "|-\n| ";
// Check user rights
if ($canEdit) {
$msgEdit = wfMessage('oredict-list-edit')->text();
$editLink = "[[Special:OreDictEntryManager/$lId|$msgEdit]]";
} else {
$editLink = "";
$table .= "$linkStyle | $editLink || ";
}
$table .= "| style=\"width:23px; padding-left:5px; padding-right:5px; text-align:center; font-weight:bold;\" | $editLink || $lId || $lTag || $lItem || $lMod || $lParams\n";
$table .= "$lId || $lTag || $lItem || $lMod || $lParams\n";
}
$table .= "|}\n";

Expand Down

0 comments on commit 29d3022

Please sign in to comment.