Skip to content

Commit

Permalink
#1611 Implement responsive tables
Browse files Browse the repository at this point in the history
  • Loading branch information
Studio384 committed Jun 10, 2018
1 parent ec4c849 commit f5c76e9
Show file tree
Hide file tree
Showing 12 changed files with 411 additions and 400 deletions.
50 changes: 26 additions & 24 deletions backstage/bans.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,19 +391,20 @@
<div class="panel-body">
<?php echo $paging_links ?>
</div>
<table class="table table-striped table-hover">
<thead>
<tr>
<th class="col-xs-1"><?php _e('Username', 'luna')?></th>
<th class="col-xs-2"><?php _e('Email', 'luna')?></th>
<th class="col-xs-1"><?php _e('IP', 'luna')?></th>
<th class="col-xs-1"><?php _e('Expires', 'luna')?></th>
<th class="col-xs-3"><?php _e('Message', 'luna')?></th>
<th class="col-xs-1"><?php _e('By', 'luna')?></th>
<th class="col-xs-3"><?php _e('Actions', 'luna')?></th>
</tr>
</thead>
<tbody>
<div class="table-responsive">
<table class="table table-striped table-hover">
<thead>
<tr>
<th class="col-xs-1"><?php _e('Username', 'luna')?></th>
<th class="col-xs-2"><?php _e('Email', 'luna')?></th>
<th class="col-xs-1"><?php _e('IP', 'luna')?></th>
<th class="col-xs-1"><?php _e('Expires', 'luna')?></th>
<th class="col-xs-3"><?php _e('Message', 'luna')?></th>
<th class="col-xs-1"><?php _e('By', 'luna')?></th>
<th class="col-xs-3"><?php _e('Actions', 'luna')?></th>
</tr>
</thead>
<tbody>
<?php

$result = $db->query('SELECT b.id, b.username, b.ip, b.email, b.message, b.expire, b.ban_creator, u.username AS ban_creator_username FROM ' . $db->prefix . 'bans AS b LEFT JOIN ' . $db->prefix . 'users AS u ON b.ban_creator=u.id WHERE b.id>0' . (!empty($conditions) ? ' AND ' . implode(' AND ', $conditions) : '') . ' ORDER BY ' . $db->escape($order_by) . ' ' . $db->escape($direction) . ' LIMIT ' . $start_from . ', 50') or error('Unable to fetch ban list', __FILE__, __LINE__, $db->error());
Expand All @@ -414,15 +415,15 @@
$expire = format_time($ban_data['expire'], true);

?>
<tr>
<td><?php echo ($ban_data['username'] != '') ? luna_htmlspecialchars($ban_data['username']) : '&#160;' ?></td>
<td><?php echo ($ban_data['email'] != '') ? luna_htmlspecialchars($ban_data['email']) : '&#160;' ?></td>
<td><?php echo ($ban_data['ip'] != '') ? luna_htmlspecialchars($ban_data['ip']) : '&#160;' ?></td>
<td><?php echo $expire ?></td>
<td><?php echo ($ban_data['message'] != '') ? luna_htmlspecialchars($ban_data['message']) : '&#160;' ?></td>
<td><?php echo ($ban_data['ban_creator_username'] != '') ? '<a href="../profile.php?id=' . $ban_data['ban_creator'] . '">' . luna_htmlspecialchars($ban_data['ban_creator_username']) . '</a>' : __('Unknown', 'luna') ?></td>
<td><?php echo $actions ?></td>
</tr>
<tr>
<td><?php echo ($ban_data['username'] != '') ? luna_htmlspecialchars($ban_data['username']) : '&#160;' ?></td>
<td><?php echo ($ban_data['email'] != '') ? luna_htmlspecialchars($ban_data['email']) : '&#160;' ?></td>
<td><?php echo ($ban_data['ip'] != '') ? luna_htmlspecialchars($ban_data['ip']) : '&#160;' ?></td>
<td><?php echo $expire ?></td>
<td><?php echo ($ban_data['message'] != '') ? luna_htmlspecialchars($ban_data['message']) : '&#160;' ?></td>
<td><?php echo ($ban_data['ban_creator_username'] != '') ? '<a href="../profile.php?id=' . $ban_data['ban_creator'] . '">' . luna_htmlspecialchars($ban_data['ban_creator_username']) . '</a>' : __('Unknown', 'luna') ?></td>
<td><?php echo $actions ?></td>
</tr>
<?php

}
Expand All @@ -431,8 +432,9 @@
}

?>
</tbody>
</table>
</tbody>
</table>
</div>
<div class="panel-body">
<?php echo $paging_links ?>
</div>
Expand Down
71 changes: 30 additions & 41 deletions backstage/board.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,16 +391,17 @@
<div class="alert alert-info"><i class="fas fa-fw fa-info-circle"></i> <?php printf(__('Permission settings that differ from the default permissions for the group are marked red. Some permissions are disabled under some conditions.', 'luna'), '<a href="groups.php">' . __('User groups', 'luna') . '</a>')?></div>
<button class="btn btn-warning pull-right" type="submit" name="revert_perms" tabindex="<?php echo $cur_index++ ?>"><i class="fas fa-fw fa-undo"></i> <?php _e('Revert to default', 'luna')?></button>
</div>
<table class="table">
<thead>
<tr>
<th>&#160;</th>
<th><?php _e('Read forum', 'luna')?></th>
<th><?php _e('Comment', 'luna')?></th>
<th><?php _e('Create threads', 'luna')?></th>
</tr>
</thead>
<tbody>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th>&#160;</th>
<th><?php _e('Read forum', 'luna')?></th>
<th><?php _e('Comment', 'luna')?></th>
<th><?php _e('Create threads', 'luna')?></th>
</tr>
</thead>
<tbody>
<?php

$result = $db->query('SELECT g.g_id, g.g_title, g.g_read_board, g.g_comment, g.g_create_threads, fp.read_forum, fp.comment, fp.create_threads FROM ' . $db->prefix . 'groups AS g LEFT JOIN ' . $db->prefix . 'forum_perms AS fp ON (g.g_id=fp.group_id AND fp.forum_id=' . $forum_id . ') WHERE g.g_id!=' . LUNA_ADMIN . ' ORDER BY g.g_id') or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error());
Expand All @@ -416,37 +417,25 @@
$create_threads_def = (($create_threads && $cur_perm['g_create_threads'] == '0') || (!$create_threads && ($cur_perm['g_create_threads'] == '' || $cur_perm['g_create_threads'] == '1'))) ? false : true;

?>
<tr>
<th class="atcl"><?php echo luna_htmlspecialchars($cur_perm['g_title']) ?></th>
<td<?php if (!$read_forum_def) {
echo ' class="danger"';
}
?>>
<input type="hidden" name="read_forum_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($read_forum) ? '1' : '0'; ?>" />
<input type="checkbox" name="read_forum_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($read_forum) ? ' checked' : ''; ?><?php echo ($cur_perm['g_read_board'] == '0') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
</td>
<td<?php if (!$comment_def) {
echo ' class="danger"';
}
?>>
<input type="hidden" name="comment_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($comment) ? '1' : '0'; ?>" />
<input type="checkbox" name="comment_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($comment) ? ' checked' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
</td>
<td<?php if (!$create_threads_def) {
echo ' class="danger"';
}
?>>
<input type="hidden" name="create_threads_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($create_threads) ? '1' : '0'; ?>" />
<input type="checkbox" name="create_threads_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($create_threads) ? ' checked' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
</td>
</tr>
<?php

}

?>
</tbody>
</table>
<tr>
<th class="atcl"><?php echo luna_htmlspecialchars($cur_perm['g_title']) ?></th>
<td<?php if (!$read_forum_def) { echo ' class="danger"'; } ?>>
<input type="hidden" name="read_forum_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($read_forum) ? '1' : '0'; ?>" />
<input type="checkbox" name="read_forum_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($read_forum) ? ' checked' : ''; ?><?php echo ($cur_perm['g_read_board'] == '0') ? ' disabled="disabled"' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
</td>
<td<?php if (!$comment_def) { echo ' class="danger"'; } ?>>
<input type="hidden" name="comment_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($comment) ? '1' : '0'; ?>" />
<input type="checkbox" name="comment_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($comment) ? ' checked' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
</td>
<td<?php if (!$create_threads_def) { echo ' class="danger"'; } ?>>
<input type="hidden" name="create_threads_old[<?php echo $cur_perm['g_id'] ?>]" value="<?php echo ($create_threads) ? '1' : '0'; ?>" />
<input type="checkbox" name="create_threads_new[<?php echo $cur_perm['g_id'] ?>]" value="1"<?php echo ($create_threads) ? ' checked' : ''; ?> tabindex="<?php echo $cur_index++ ?>" />
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</fieldset>
</div>
</form>
Expand Down
52 changes: 27 additions & 25 deletions backstage/censoring.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,45 +122,47 @@
</div>
<form id="censoring" method="post" action="censoring.php">
<fieldset>
<table class="table table-striped">
<thead>
<tr>
<th class="col-xs-4"><?php _e('Censored word', 'luna')?></th>
<th class="col-xs-4"><?php _e('Replacement word', 'luna')?></th>
<th class="col-xs-4"><?php _e('Action', 'luna')?></th>
</tr>
</thead>
<tbody>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th class="col-xs-4"><?php _e('Censored word', 'luna')?></th>
<th class="col-xs-4"><?php _e('Replacement word', 'luna')?></th>
<th class="col-xs-4"><?php _e('Action', 'luna')?></th>
</tr>
</thead>
<tbody>
<?php

$result = $db->query('SELECT id, search_for, replace_with FROM ' . $db->prefix . 'censoring ORDER BY id') or error('Unable to fetch censor word list', __FILE__, __LINE__, $db->error());
if ($db->num_rows($result)) {

while ($cur_word = $db->fetch_assoc($result)) {
?>
<tr>
<td>
<input type="text" class="form-control" name="search_for[<?php echo $cur_word['id'] ?>]" value="<?php echo luna_htmlspecialchars($cur_word['search_for']) ?>" maxlength="60" />
</td>
<td>
<input type="text" class="form-control" name="replace_with[<?php echo $cur_word['id'] ?>]" value="<?php echo luna_htmlspecialchars($cur_word['replace_with']) ?>" maxlength="60" />
</td>
<td>
<div class="btn-group">
<button class="btn btn-primary" type="submit" name="update[<?php echo $cur_word['id'] ?>]"><span class="fas fa-fw fa-check"></span> <?php _e('Update', 'luna')?></button>
<button class="btn btn-danger" type="submit" name="remove[<?php echo $cur_word['id'] ?>]"><span class="fas fa-fw fa-trash"></span> <?php _e('Remove', 'luna')?></button>
</div>
</td>
</tr>
<tr>
<td>
<input type="text" class="form-control" name="search_for[<?php echo $cur_word['id'] ?>]" value="<?php echo luna_htmlspecialchars($cur_word['search_for']) ?>" maxlength="60" />
</td>
<td>
<input type="text" class="form-control" name="replace_with[<?php echo $cur_word['id'] ?>]" value="<?php echo luna_htmlspecialchars($cur_word['replace_with']) ?>" maxlength="60" />
</td>
<td>
<div class="btn-group">
<button class="btn btn-primary" type="submit" name="update[<?php echo $cur_word['id'] ?>]"><span class="fas fa-fw fa-check"></span> <?php _e('Update', 'luna')?></button>
<button class="btn btn-danger" type="submit" name="remove[<?php echo $cur_word['id'] ?>]"><span class="fas fa-fw fa-trash"></span> <?php _e('Remove', 'luna')?></button>
</div>
</td>
</tr>
<?php
}
} else {
echo "\t\t\t\t\t\t\t" . '<tr><td colspan="3">' . __('No censor words in list.', 'luna') . '</td></tr>' . "\n";
}

?>
</tbody>
</table>
</tbody>
</table>
</div>
</fieldset>
</form>
</div>
Expand Down
32 changes: 17 additions & 15 deletions backstage/groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,9 @@
<div class="panel-heading">
<h3 class="panel-title"><?php echo __('Manage groups', 'luna') ?></h3>
</div>
<table class="table">
<tbody>
<div class="table-responsive">
<table class="table">
<tbody>
<?php

$cur_index = 5;
Expand All @@ -649,22 +650,23 @@

while ($cur_group = $db->fetch_assoc($result)) {
?>
<tr>
<td>
<a class="btn btn-primary" href="groups.php?edit_group=<?php echo $cur_group['g_id'] ?>" tabindex="<?php echo $cur_index++ ?>"><span class="fas fa-fw fa-pencil-alt-square-o"></span> <?php echo __('Edit', 'luna') ?></a>
</td>
<td class="col-lg-10"><?php echo luna_htmlspecialchars($cur_group['g_title']) ?></td>
<td>
<?php if ($cur_group['g_id'] > LUNA_MEMBER) {?>
<a class="btn btn-danger" href="groups.php?del_group=<?php echo $cur_group['g_id'] ?>" tabindex="<?php echo $cur_index++ ?>"><span class="fas fa-fw fa-trash"></span> <?php echo __('Delete', 'luna') ?></a>
<?php }?>
</td>
</tr>
<tr>
<td>
<a class="btn btn-primary" href="groups.php?edit_group=<?php echo $cur_group['g_id'] ?>" tabindex="<?php echo $cur_index++ ?>"><span class="fas fa-fw fa-pencil-alt-square-o"></span> <?php echo __('Edit', 'luna') ?></a>
</td>
<td class="col-lg-10"><?php echo luna_htmlspecialchars($cur_group['g_title']) ?></td>
<td>
<?php if ($cur_group['g_id'] > LUNA_MEMBER) {?>
<a class="btn btn-danger" href="groups.php?del_group=<?php echo $cur_group['g_id'] ?>" tabindex="<?php echo $cur_index++ ?>"><span class="fas fa-fw fa-trash"></span> <?php echo __('Delete', 'luna') ?></a>
<?php }?>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
</div>
</div>
Expand Down
40 changes: 21 additions & 19 deletions backstage/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,16 @@
<div class="panel-heading">
<h3 class="panel-title"><?php _e('New reports', 'luna')?><span class="pull-right"><a class="btn btn-primary" href="reports.php"><span class="fas fa-fw fa-eye"></span> <?php _e('View all', 'luna')?></a></span></h3>
</div>
<table class="table">
<thead>
<tr>
<th class="col-lg-3"><?php _e('Reported by', 'luna')?></th>
<th class="col-lg-3"><?php _e('Date and time', 'luna')?></th>
<th class="col-lg-6"><?php _e('Message', 'luna')?></th>
</tr>
</thead>
<tbody>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th class="col-lg-3"><?php _e('Reported by', 'luna')?></th>
<th class="col-lg-3"><?php _e('Date and time', 'luna')?></th>
<th class="col-lg-6"><?php _e('Message', 'luna')?></th>
</tr>
</thead>
<tbody>
<?php

$result = $db->query('SELECT r.id, r.thread_id, r.forum_id, r.reported_by, r.created, r.message, p.id AS pid, t.subject, f.forum_name, u.username AS reporter FROM ' . $db->prefix . 'reports AS r LEFT JOIN ' . $db->prefix . 'comments AS p ON r.comment_id=p.id LEFT JOIN ' . $db->prefix . 'threads AS t ON r.thread_id=t.id LEFT JOIN ' . $db->prefix . 'forums AS f ON r.forum_id=f.id LEFT JOIN ' . $db->prefix . 'users AS u ON r.reported_by=u.id WHERE r.zapped IS NULL ORDER BY created DESC') or error('Unable to fetch report list', __FILE__, __LINE__, $db->error());
Expand All @@ -139,27 +140,28 @@
$report_location = array($forum, $thread, $comment_id);

?>
<tr>
<td><?php printf($reporter)?></td>
<td><?php printf(format_time($cur_report['created']))?></td>
<td><?php echo $comment ?></td>
</tr>
<tr>
<td><?php printf($reporter)?></td>
<td><?php printf(format_time($cur_report['created']))?></td>
<td><?php echo $comment ?></td>
</tr>
<?php

}
} else {

?>
<tr>
<td colspan="4"><?php _e('There are no new reports.', 'luna')?></td>
</tr>
<tr>
<td colspan="4"><?php _e('There are no new reports.', 'luna')?></td>
</tr>
<?php

}

?>
</tbody>
</table>
</tbody>
</table>
</div>
</div>
<form class="form-horizontal" method="post" action="index.php">
<input type="hidden" name="form_sent" value="1" />
Expand Down
Loading

0 comments on commit f5c76e9

Please sign in to comment.