summaryrefslogtreecommitdiff
path: root/src/views/pages/users
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/pages/users')
-rw-r--r--src/views/pages/users/index.html.php74
-rw-r--r--src/views/pages/users/new.html.php10
2 files changed, 58 insertions, 26 deletions
diff --git a/src/views/pages/users/index.html.php b/src/views/pages/users/index.html.php
index 366fb8a..dfeff15 100644
--- a/src/views/pages/users/index.html.php
+++ b/src/views/pages/users/index.html.php
@@ -2,26 +2,47 @@
$t = $VARS['template'];
$attribs = $VARS['attribs'];
$users = $VARS['users'];
+require_once('Login.class.php');
$t->header('Users');
-$t->paragraph($t->link($t->url('users.csv'), "Download this as a spreadsheet."));
+$t->paragraph($t->link($t->url('users.csv'), "Download this as a spreadsheet.", true));
$t->paragraph($t->link($t->url('users/all'), "See details for all users."));
$t->openTag('form', array('action'=>$t->url('users/index'),
'method'=>'post'));
-$t->tag('input', array('type'=>'submit',
- 'value'=>'Save/Update'));
+if (Login::isLoggedIn()) {
+ $t->tag('input', array('type'=>'submit',
+ 'value'=>'Save/Update'));
+}
-$t->openTag('table');
+$t->openTag('table', array('class'=>'sortable', 'id'=>'bar'));
-$t->openTag('tr');
-foreach ($attribs as $attrib) {
- $t->tag('th', array(), $attrib['name']);
+function table_head($attribs, $t) {
+ $t->openTag('tr');
+ foreach ($attribs as $attrib) {
+ switch ($attrib['type']) {
+ case 'bool': $class = 'small'; break;
+ default: $class = ''; break;
+ }
+ $t->tag('th', array('class'=>$class), $attrib['name']);
+ }
+ if (Login::isLoggedIn()) {
+ $t->tag('th', array(), '-');
+ }
+ $t->closeTag('tr');
}
-$t->tag('th');
-$t->closeTag('tr');
+
+$t->openTag('thead');
+table_head($attribs, $t);
+$t->closeTag('thead');
+
+$t->openTag('tfoot');
+table_head($attribs, $t);
+$t->closeTag('tfoot');
+
+$t->openTag('tbody');
foreach ($users as $user) {
$t->openTag('tr');
@@ -30,11 +51,15 @@ foreach ($users as $user) {
$t->openTag('td');
$props = $user[$attrib['key']];
-
- $value = $props['value'];
+
+ $bool = $attrib['type']=='bool';
+ if ($bool) {
+ $value = $props['value']=='true';
+ } else {
+ $value = $props['value'];
+ }
$editable = $props['editable'];
$post_key = $props['post_key'];
- $bool = is_bool($value);
$arr = array('name'=>$post_key);
if (!$editable) {
@@ -49,6 +74,7 @@ foreach ($users as $user) {
$arr['value'] = 'true';
$arr['type'] = 'checkbox';
} else {
+ $t->tag('span', array('class'=>'cell_width'), $value);
$arr['value'] = $value;
$arr['type'] = 'text';
}
@@ -60,24 +86,20 @@ foreach ($users as $user) {
$t->closeTag('td');
}
- $t->openTag('td');
- $t->link($t->url('users/'.$user['auth_name']['value']), 'More');
- $t->closeTag('td');
-
+ if (Login::isLoggedIn()) {
+ $t->openTag('td');
+ $t->link($t->url('users/'.$user['auth_name']['value']), 'More');
+ $t->closeTag('td');
+ }
$t->closeTag('tr');
}
-$t->openTag('tr');
-foreach ($attribs as $attrib) {
- $t->tag('th', array(), $attrib['name']);
-}
-$t->tag('th');
-$t->closeTag('tr');
-
+$t->closeTag('tbody');
$t->closeTag('table');
-$t->tag('input', array('type'=>'submit',
- 'value'=>'Save/Update'));
-$t->closeTag('form');
+if (Login::isLoggedIn()) {
+ $t->tag('input', array('type'=>'submit',
+ 'value'=>'Save/Update'));
+}
$t->footer();
diff --git a/src/views/pages/users/new.html.php b/src/views/pages/users/new.html.php
index 8b6bdf8..9df376f 100644
--- a/src/views/pages/users/new.html.php
+++ b/src/views/pages/users/new.html.php
@@ -7,6 +7,16 @@ $t->openTag('form', array('method'=>'post',
'action'=>$t->url('users')));
$t->openFieldset("New User: Step 1");
+
+if ($VARS['userlist']) {
+ $t->inputP("If you may have already created a username, please, ".
+ "<em>please</em> check the ".
+ $t->link($t->url('users/'), 'user-list', true).
+ " to find your old username, instead of creating a new ".
+ "user. If you don't like the name, you can log in and ".
+ "change it.");
+}
+
if (in_array('illegal name', $VARS['errors'])) {
$t->inputP("That is a forbidden username.", true);
}