summaryrefslogtreecommitdiff
path: root/pages/users.ecpp
blob: f8bc5462b972857ef5ad49628aceb52c62013255 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<%pre>

#include <users.h>
#include <setup.h>

using namespace vdrlive;
using namespace std;

</%pre>
<%args>
	// input parameters
	string userid;
	string action;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<%include>page_init.eh</%include>
<%cpp>
if (!logged_in && LiveSetup().UseAuth()) return reply.redirect("login.html");
</%cpp>
<%cpp>
	pageTitle = tr("Users");
	if ( !userid.empty() ) {
		if (action == "delete")
		{
			Users.Del(Users.GetByUserId( userid ));
			Users.Save();
		}
	}
</%cpp>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ pageTitle $></title>
		<& pageelems.stylesheets &>
		<& pageelems.ajax_js &>
	</head>
	<body>
		<& pageelems.logo &>
		<& menu active=("users") component=("users.user_actions")>
		<div class="inhalt">
			<table class="listing" cellspacing="0" cellpadding="0">
				<tr class="head">
					<td colspan="3">
						<div class="boxheader"><div><div><$ pageTitle $></div></div></div>
					</td>
				</tr>
				<tr class="description">
					<td class="action leftcol"><div class="leftcol"><$ tr("Name") $></div></td>
					<td class="rightcol" colspan="8"/>
				</tr>
<%cpp>
				cUser* user = Users.First();
				while (user) 
				{
					bool bottom = (Users.Next(user) == NULL);
				    if (user) 
				    {
</%cpp>
					<tr class="description">
						<td class="action leftcol <? bottom ? "bottomrow" ?>"><div class="withmargin"><$ user->Name() $></div></td>	
						<td class="<? bottom ? "bottomrow" ?>"><a href="edit_user.html?userid=<$ user->Id() $>"><img src="<$ LiveSetup().GetThemedLink("img", "edit.png") $>" alt="" <& tooltip.hint text=(tr("Edit user")) &>></img></a></td>					
						<td class="action rightcol <? bottom ? "bottomrow" ?>"><a href="users.html?userid=<$ user->Id() $>&action=delete"><img src="<$ LiveSetup().GetThemedLink("img", "del.png") $>" alt="" <& tooltip.hint text=(tr("Delete user")) &>></img></a></td>
					</tr>
<%cpp>
				    }
				    user = Users.Next(user);
				}
</%cpp>
			</table>
		</div>
	</body>
</html>
<%include>page_exit.eh</%include>

<%def user_actions>
<a href="edit_user.html"><$ tr("New user") $></a>
</%def>