summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-02-08 21:19:24 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-02-08 21:19:24 +0000
commitbbf79a59703ef3ba4ed63c8143f97d9da5a73b8d (patch)
tree05f6f2d03208da257d5ad4864a93a6797cc499c3 /templates
parentaa0c57afc44b8f804c2f553d2d264ed62fc16121 (diff)
downloadampache-bbf79a59703ef3ba4ed63c8143f97d9da5a73b8d.tar.gz
ampache-bbf79a59703ef3ba4ed63c8143f97d9da5a73b8d.tar.bz2
ampache-bbf79a59703ef3ba4ed63c8143f97d9da5a73b8d.zip
* Initial Database Changes for 3.4, many things are now broken
Diffstat (limited to 'templates')
-rw-r--r--templates/show_add_user.inc.php87
-rw-r--r--templates/show_confirmation.inc.php2
-rw-r--r--templates/show_edit_user.inc.php66
-rw-r--r--templates/show_users.inc.php (renamed from templates/show_users.inc)57
4 files changed, 142 insertions, 70 deletions
diff --git a/templates/show_add_user.inc.php b/templates/show_add_user.inc.php
new file mode 100644
index 00000000..4746c524
--- /dev/null
+++ b/templates/show_add_user.inc.php
@@ -0,0 +1,87 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2007 Ampache.org
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 2
+ of the License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+?>
+<?php show_box_top(_('Adding a New User')); ?>
+<?php $GLOBALS['error']->print_error('general'); ?>
+<form name="add_user" enctype="multpart/form-data" method="post" action="<?php echo conf('web_path') . "/admin/users.php"; ?>">
+<table class="tabledata" cellspacing="0" cellpadding="0" border="0">
+<tr>
+ <td>
+ <?php echo _('Username'); ?>:
+ </td>
+ <td>
+ <input type="text" name="username" size="30" maxlength="128" value="<?php echo scrub_out($_POST['username']); ?>" />
+ <?php $GLOBALS['error']->print_error('username'); ?>
+ </td>
+</tr>
+<tr>
+ <td><?php echo _('Full Name'); ?>:</td>
+ <td>
+ <input type="text" name="fullname" size="30" value="<?php echo scrub_out($_POST['fullname']); ?>" />
+ </td>
+</tr>
+<tr>
+ <td>
+ <?php echo _('E-mail'); ?>:
+ </td>
+ <td>
+ <input type="text" name="email" size="30" value="<?php echo scrub_out($_POST['email']); ?>" />
+ </td>
+</tr>
+<tr>
+ <td>
+ <?php echo _('Password'); ?> :
+ </td>
+ <td>
+ <input type="password" name="password_1" size="30" value="" />
+ <?php $GLOBALS['error']->print_error('password'); ?>
+ </td>
+</tr>
+<tr>
+ <td>
+ <?php echo _('Confirm Password'); ?>:
+ </td>
+ <td>
+ <input type="password" name="password_2" size="30" value="" />
+ </td>
+</tr>
+<tr>
+ <td>
+ <?php echo _('User Access Level'); ?>:
+ </td>
+ <td>
+ <?php $var_name = "on_" . $working_user->access; ${$var_name} = 'selected="selected"'; ?>
+ <select name="access">
+ <option value="1" <?php echo $on_1; ?>><?php echo _('Guest'); ?></option>
+ <option value="25" <?php echo $on_25; ?>><?php echo _('User'); ?></option>
+ <option value="100" <?php echo $on_100; ?>><?php echo _('Admin'); ?></option>
+ </select>
+ </td>
+</tr>
+ <td colspan="2">
+ <input type="submit" value="<?php echo _('Add User'); ?>" />
+ <input type="hidden" name="action" value="add_user" />
+ </td>
+</tr>
+</table>
+</form>
+<?php show_box_bottom(); ?>
diff --git a/templates/show_confirmation.inc.php b/templates/show_confirmation.inc.php
index 165df5b6..e278ed7d 100644
--- a/templates/show_confirmation.inc.php
+++ b/templates/show_confirmation.inc.php
@@ -20,7 +20,7 @@
*/
?>
<?php show_box_top(scrub_out($title)); ?>
-<?php echo scrub_out($text); ?>
+<?php echo $text; ?>
<br />
<div class="text-action">
<a href="<?php echo $path; ?>"><?php echo _('Continue'); ?></a>
diff --git a/templates/show_edit_user.inc.php b/templates/show_edit_user.inc.php
index 675c6224..fc6dd546 100644
--- a/templates/show_edit_user.inc.php
+++ b/templates/show_edit_user.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2006 Ampache.org
+ Copyright (c) 2001 - 2007 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -19,60 +19,49 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-if ($type === 'new_user') {
- $userfield = "<input type=\"text\" name=\"new_username\" size=\"30\" value=\"" . scrub_out($username) . "\" />";
- $title = _('Adding a New User');
-}
-else {
- $userfield = scrub_out($username);
- $title = _('Editing existing User');
-}
?>
-
-<br />
-<?php show_box_top($title); ?>
+<?php show_box_top(_('Editing existing User')); ?>
<?php $GLOBALS['error']->print_error('general'); ?>
-<form name="update_user" method="post" action="<?php echo conf('web_path') . "/admin/users.php"; ?>">
-<table cellspacing="0" cellpadding="0" border="0">
+<form name="update_user" enctype="multipart/form-data" method="post" action="<?php echo conf('web_path') . "/admin/users.php"; ?>">
+<table class="tabledata" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
- <?php echo _('Username'); ?>:
+ <?php echo _('Username'); ?>:
</td>
<td>
- <?php echo $userfield; ?>
+ <input type="text" name="username" size="30" maxlength="128" value="<?php echo scrub_out($working_user->username); ?>" />
<?php $GLOBALS['error']->print_error('username'); ?>
</td>
</tr>
<tr>
- <td><?php echo _('Full Name'); ?>:</td>
+ <td><?php echo _('Full Name'); ?>:</td>
<td>
- <input type="text" name="new_fullname" size="30" value="<?php echo scrub_out($fullname); ?>" />
+ <input type="text" name="fullname" size="30" value="<?php echo scrub_out($working_user->fullname); ?>" />
</td>
</tr>
<tr>
<td>
- <?php echo _('E-mail'); ?>:
+ <?php echo _('E-mail'); ?>:
</td>
<td>
- <input type="text" name="new_email" size="30" value="<?php echo scrub_out($email); ?>" />
+ <input type="text" name="email" size="30" value="<?php echo scrub_out($working_user->email); ?>" />
</td>
</tr>
<tr>
<td>
- <?php echo _('Password'); ?> :
+ <?php echo _('Password'); ?> :
</td>
<td>
- <input type="password" name="new_password_1" size="30" value="" />
+ <input type="password" name="password_1" size="30" value="" />
<?php $GLOBALS['error']->print_error('password'); ?>
</td>
</tr>
<tr>
<td>
- <?php echo _('Confirm Password'); ?>:
+ <?php echo _('Confirm Password'); ?>:
</td>
<td>
- <input type="password" name="new_password_2" size="30" value="" />
+ <input type="password" name="password_2" size="30" value="" />
</td>
</tr>
<tr>
@@ -80,24 +69,21 @@ else {
<?php echo _('User Access Level'); ?>:
</td>
<td>
- <select name="user_access">
- <option value="1" <?php if($access==='1') echo "selected=\"selected\""; ?>>Guest</option>
- <option value="user" <?php if($access==='user') echo "selected=\"selected\""; ?>>User</option>
- <option value="admin" <?php if($access==='admin') echo "selected=\"selected\""; ?>>Admin</option>
+ <?php $var_name = "on_" . $working_user->access; ${$var_name} = 'selected="selected"'; ?>
+ <select name="access">
+ <option value="1" <?php echo $on_1; ?>><?php echo _('Guest'); ?></option>
+ <option value="25" <?php echo $on_25; ?>><?php echo _('User'); ?></option>
+ <option value="100" <?php echo $on_100; ?>><?php echo _('Admin'); ?></option>
</select>
</td>
</tr>
+<tr>
+ <td colspan="2">
+ <input type="hidden" name="action" value="update_user" />
+ <input type="submit" value="<?php echo _('Update User'); ?>" />
+ <input type="hidden" name="user_id" value="<?php echo $working_user->id; ?>" />
+ </td>
+</tr>
</table>
-<?php
-if ($type == 'new_user') {
- echo "<input type=\"hidden\" name=\"action\" value=\"add_user\" />";
- echo "<input type=\"submit\" value=\"" . _('Add User') . "\" />";
-}
-else {
- echo "<input type=\"hidden\" name=\"action\" value=\"update_user\" />\n";
- echo "<input type=\"submit\" value=\"" . _('Update User') . "\" />\n";
- echo "<input type=\"hidden\" name=\"new_username\" value=\"$id\" />";
-}
-?>
</form>
<?php show_box_bottom(); ?>
diff --git a/templates/show_users.inc b/templates/show_users.inc.php
index b92afb11..39bf90f6 100644
--- a/templates/show_users.inc
+++ b/templates/show_users.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2006 Ampache.org
+ Copyright (c) 2001 - 2007 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -18,15 +18,16 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*!
- @header Show Users (admin section)
-*/
$web_path = conf('web_path');
$total_items = $view->total_items;
$admin_menu = "admin/";
-?>
+show_box_top(_('Manage Users'));
+ echo get_user_icon('add_user') . '&nbsp;';
+ echo '<a href="' . $web_path . '/admin/users.php?action=show_add_user">' . _('Add a new user') . '</a>';
+show_box_bottom();
+?>
<?php show_box_top(); ?>
<table class="tabledata" cellpadding="0" cellspacing="0" border="0">
<tr class="table-header" align="center">
@@ -37,10 +38,10 @@ $admin_menu = "admin/";
<tr class="table-header">
<td align="center">
<a href="<?php echo $web_path; ?>/<?php echo $_SESSION['view_script']; ?>?action=<?php echo $_REQUEST['action']; ?>&amp;keep_view=true&amp;sort_type=fullname&amp;sort_order=0">
- <b><?php echo _("Fullname"); ?></b>
+ <b><?php echo _('Fullname'); ?></b>
</a>
<a href="<?php echo $web_path; ?>/<?php echo $_SESSION['view_script']; ?>?action=<?php echo $_REQUEST['action']; ?>&amp;keep_view=true&amp;sort_type=username&amp;sort_order=0">
- <b>(<?php echo _("Username"); ?>)</b>
+ <b>(<?php echo _('Username'); ?>)</b>
</a>
</td>
<td align="center">
@@ -67,19 +68,17 @@ $admin_menu = "admin/";
</td>
</tr>
<?php
-while ($results = mysql_fetch_object($db_result)) {
- $user = new User($results->username);
- $last_seen = date("m\/d\/Y - H:i",$user->last_seen);
- if (!$user->last_seen) { $last_seen = "Never"; }
- $create_date = date("m\/d\/Y - H:i",$user->create_date);
- $user->format_user();
- if (!$user->create_date) { $create_date = "Unknown"; }
+foreach ($users as $working_user) {
+ $working_user->format_user();
+ $last_seen = date("m\/d\/Y - H:i",$working_user->last_seen);
+ if (!$working_user->last_seen) { $last_seen = _('Never'); }
+ $create_date = date("m\/d\/Y - H:i",$working_user->create_date);
+ if (!$working_user->create_date) { $create_date = _('Unknown'); }
?>
-
<tr class="<?php echo flip_class(); ?>" align="center">
<td align="left">
- <a href="<?php echo $web_path; ?>/admin/users.php?action=edit&amp;user=<?php echo $user->id; ?>">
- <?php echo $user->fullname; ?> (<?php echo $user->username; ?>)
+ <a href="<?php echo $web_path; ?>/admin/users.php?action=edit&amp;user_id=<?php echo $working_user->id; ?>">
+ <?php echo $working_user->fullname; ?> (<?php echo $working_user->username; ?>)
</a>
</td>
<td>
@@ -90,54 +89,54 @@ while ($results = mysql_fetch_object($db_result)) {
</td>
<td>
- <?php echo $user->f_useage; ?>
+ <?php echo $working_user->f_useage; ?>
</td>
<?php if (conf('track_user_ip')) { ?>
<td>
- <a href="<?php echo $web_path; ?>/admin/users.php?action=show_ip_history&amp;user_id=<?php echo $user->id; ?>">
- <?php echo $user->ip_history; ?>
+ <a href="<?php echo $web_path; ?>/admin/users.php?action=show_ip_history&amp;user_id=<?php echo $working_user->id; ?>">
+ <?php echo $working_user->ip_history; ?>
</a>
</td>
<?php } ?>
<td>
- <a href="<?php echo $web_path; ?>/admin/users.php?action=edit&amp;user=<?php echo $user->id; ?>">
+ <a href="<?php echo $web_path; ?>/admin/users.php?action=edit&amp;user_id=<?php echo $working_user->id; ?>">
<?php echo get_user_icon('edit'); ?>
</a>
</td>
<td>
- <a href="<?php echo $web_path; ?>/admin/preferences.php?action=user&amp;user_id=<?php echo $user->id; ?>">
+ <a href="<?php echo $web_path; ?>/admin/preferences.php?action=user&amp;user_id=<?php echo $working_user->id; ?>">
<?php echo get_user_icon('preferences'); ?>
</a>
</td>
<td>
- <a href="<?php echo $web_path; ?>/stats.php?action=user_stats&amp;user_id=<?php echo $user->id; ?>">
+ <a href="<?php echo $web_path; ?>/stats.php?action=user_stats&amp;user_id=<?php echo $working_user->id; ?>">
<?php echo get_user_icon('statistics'); ?>
</a>
</td>
<?php
//FIXME: Fix this for the extra permission levels
if ($user->disabled == '1') {
- echo "<td><a href=\"".$web_path."/admin/users.php?action=update&amp;user=$user->username&amp;level=enabled\">" . get_user_icon('enable') . "</a></td>";
+ echo "<td><a href=\"".$web_path."/admin/users.php?action=enable&amp;user_id=$working_user->id\">" . get_user_icon('enable') . "</a></td>";
}
else {
- echo "<td><a href=\"".$web_path."/admin/users.php?action=update&amp;user=$user->username&amp;level=disabled\">" . get_user_icon('disable') ."</a></td>";
+ echo "<td><a href=\"".$web_path."/admin/users.php?action=disable&amp;user_id=$working_user->id\">" . get_user_icon('disable') ."</a></td>";
}
?>
<td>
- <a href="<?php echo $web_path; ?>/admin/users.php?action=delete&amp;user=<?php echo $user->username; ?>">
+ <a href="<?php echo $web_path; ?>/admin/users.php?action=delete&amp;user_id=<?php echo $working_user->id; ?>">
<?php echo get_user_icon('delete'); ?>
</a>
</td>
<?php
- if (($user->is_logged_in()) and ($user->is_online())) {
+ if (($working_user->is_logged_in()) and ($working_user->is_online())) {
echo "<td class=\"user_online\"> &nbsp; </td>";
- } elseif ($user->disabled == 1) {
+ } elseif ($working_user->disabled == 1) {
echo "<td class=\"user_disabled\"> &nbsp; </td>";
} else {
echo "<td class=\"user_offline\"> &nbsp; </td>";
}
?>
</tr>
-<?php } //end while ($results = mysql_fetch_object($db_result)) ?>
+<?php } //end foreach users ?>
</table>
<?php show_box_bottom(); ?>