updated to video upload

This commit is contained in:
2025-01-23 16:31:57 +02:00
parent 4b8d075bfe
commit 70a0065b98
28 changed files with 619 additions and 420 deletions

View File

@@ -3,8 +3,21 @@
<head>
<title>Add Group</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Add Group</h1>
<form action="{{ url_for('add_group') }}" method="post">

View File

@@ -3,11 +3,24 @@
<head>
<title>Add Player</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Add Player</h1>
<form action="{{ url_for('add_player') }}" method="post">
<form method="POST" action="{{ url_for('add_player') }}">
<div class="mb-3">
<label for="username" class="form-label">Player Name</label>
<input type="text" class="form-control" id="username" name="username" required>
@@ -16,10 +29,6 @@
<label for="hostname" class="form-label">Hostname</label>
<input type="text" class="form-control" id="hostname" name="hostname" required>
</div>
<div class="mb-3">
<label for="ip" class="form-label">IP Address</label>
<input type="text" class="form-control" id="ip" name="ip" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required>

View File

@@ -3,60 +3,101 @@
<head>
<title>Admin Panel</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Admin Panel</h1>
<h2>Manage Users</h2>
<table class="table">
<thead>
<tr>
<th>Username</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.role }}</td>
<td>
<form action="{{ url_for('change_role', user_id=user.id) }}" method="post" class="d-inline">
<select name="role" class="form-select d-inline-block" style="width: auto;">
<option value="user" {% if user.role == 'user' %}selected{% endif %}>User</option>
<option value="admin" {% if user.role == 'admin' %}selected{% endif %}>Admin</option>
</select>
<button type="submit" class="btn btn-sm btn-primary">Change Role</button>
</form>
<form action="{{ url_for('delete_user', user_id=user.id) }}" method="post" class="d-inline">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this user?');">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header">
<h2>Manage Users</h2>
</div>
<div class="card-body">
<!-- Manage User Roles Section -->
<h3>Manage User Roles</h3>
<table class="table">
<thead>
<tr>
<th>Username</th>
<th>Role</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for user in users %}
<tr>
<td>{{ user.username }}</td>
<td>{{ user.role }}</td>
<td>
<form action="{{ url_for('change_role', user_id=user.id) }}" method="post" class="d-inline">
<select name="role" class="form-select d-inline-block" style="width: auto;">
<option value="user" {% if user.role == 'user' %}selected{% endif %}>User</option>
<option value="admin" {% if user.role == 'admin' %}selected{% endif %}>Admin</option>
</select>
<button type="submit" class="btn btn-sm btn-primary">Change Role</button>
</form>
<form action="{{ url_for('delete_user', user_id=user.id) }}" method="post" class="d-inline">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this user?');">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
<h2>Create New User</h2>
<form action="{{ url_for('create_user') }}" method="post">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required>
<!-- Add New User Section -->
<h3 class="mt-4">Add New User</h3>
<form action="{{ url_for('create_user') }}" method="post">
<div class="mb-3">
<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" required>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<div class="mb-3">
<label for="role" class="form-label">Role</label>
<select class="form-select" id="role" name="role" required>
<option value="user">User</option>
<option value="admin">Admin</option>
</select>
</div>
<button type="submit" class="btn btn-success">Create User</button>
</form>
</div>
<div class="mb-3">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required>
</div>
<!-- Change Theme Section -->
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header">
<h2>Change Theme</h2>
</div>
<div class="mb-3">
<label for="role" class="form-label">Role</label>
<select class="form-select" id="role" name="role" required>
<option value="user">User</option>
<option value="admin">Admin</option>
</select>
<div class="card-body">
<form action="{{ url_for('change_theme') }}" method="post">
<div class="mb-3">
<label for="theme" class="form-label">Select Theme</label>
<select class="form-select" id="theme" name="theme" required>
<option value="light" {% if theme == 'light' %}selected{% endif %}>Light</option>
<option value="dark" {% if theme == 'dark' %}selected{% endif %}>Dark</option>
</select>
</div>
<button type="submit" class="btn btn-primary">Change Theme</button>
</form>
</div>
<button type="submit" class="btn btn-success">Create User</button>
</form>
</div>
<div class="mt-4">
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Back to Dashboard</a>
@@ -65,4 +106,4 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>
</html>

View File

@@ -5,8 +5,18 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Dashboard</h1>
@@ -15,110 +25,116 @@
<a href="{{ url_for('logout') }}" class="btn btn-danger">Sign Out</a>
</div>
<!-- Users Management Section -->
{% if current_user.role == 'admin' %}
<div class="card mb-4">
<div class="card-header bg-info text-white">
<h2>Users Management</h2>
</div>
<div class="card-body text-center">
<a href="{{ url_for('admin') }}" class="btn btn-info btn-lg">Manage Users</a>
</div>
</div>
{% endif %}
<div class="row">
<div class="col-md-8">
<!-- Players Section -->
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-primary text-white">
<h2>Players</h2>
</div>
<div class="card-body">
<ul class="list-group">
{% for player in players %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<strong>{{ player.username }}</strong>
</div>
<div>
<a href="{{ url_for('player_page', player_id=player.id) }}" class="btn btn-sm btn-secondary">Manage Player</a>
<a href="{{ url_for('player_fullscreen', player_id=player.id) }}" class="btn btn-sm btn-primary">Full Screen</a>
{% if current_user.role == 'admin' %}
<form action="{{ url_for('delete_player', player_id=player.id) }}" method="post" style="display:inline;">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this player?');">Delete</button>
</form>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
{% if current_user.role == 'admin' %}
<div class="mt-3">
<a href="{{ url_for('add_player') }}" class="btn btn-success">Add Player</a>
</div>
{% endif %}
</div>
</div>
<!-- Players Section -->
<div class="card mb-4">
<div class="card-header bg-primary text-white">
<h2>Players</h2>
</div>
<div class="card-body">
<ul class="list-group">
{% for player in players %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<strong>{{ player.username }}</strong> ({{ player.ip }})
</div>
<div>
<a href="{{ url_for('player_page', player_id=player.id) }}" class="btn btn-sm btn-secondary">Manage Player</a>
<a href="{{ url_for('player_fullscreen', player_id=player.id) }}" class="btn btn-sm btn-primary">Full Screen</a>
{% if current_user.role == 'admin' %}
<form action="{{ url_for('delete_player', player_id=player.id) }}" method="post" style="display:inline;">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this player?');">Delete</button>
</form>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
<!-- Groups Section -->
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-success text-white">
<h2>Player Groups</h2>
</div>
<div class="card-body">
<ul class="list-group">
{% for group in groups %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<strong>{{ group.name }}</strong> ({{ group.players | length }} players)
<ul class="list-group mt-2">
{% for player in group.players %}
<li class="list-group-item">
{{ player.username }}
</li>
{% endfor %}
</ul>
</div>
<div>
<a href="{{ url_for('manage_group', group_id=group.id) }}" class="btn btn-sm btn-secondary">Manage Group</a>
<a href="{{ url_for('group_fullscreen', group_id=group.id) }}" class="btn btn-sm btn-primary">Full Screen</a>
{% if current_user.role == 'admin' %}
<form action="{{ url_for('delete_group', group_id=group.id) }}" method="post" style="display:inline;">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this group?');">Delete</button>
</form>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
{% if current_user.role == 'admin' %}
<div class="mt-3">
<a href="{{ url_for('add_group') }}" class="btn btn-primary">Add Group</a>
</div>
{% endif %}
</div>
</div>
<!-- Content Upload Section -->
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-warning text-dark">
<h2>Content Upload</h2>
</div>
<div class="card-body text-center">
<a href="{{ url_for('upload_content') }}" class="btn btn-warning btn-lg">Upload Content</a>
</div>
</div>
<!-- Integrate Player Section -->
{% if current_user.role == 'admin' %}
<div class="mt-3">
<a href="{{ url_for('add_player') }}" class="btn btn-success">Add Player</a>
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-dark text-white">
<h2>Integrate Player</h2>
</div>
<div class="card-body text-center">
<a href="{{ url_for('integrate_player') }}" class="btn btn-dark btn-lg">Integrate Player</a>
</div>
</div>
{% endif %}
</div>
</div>
<!-- Groups Section -->
<div class="card mb-4">
<div class="card-header bg-success text-white">
<h2>Player Groups</h2>
</div>
<div class="card-body">
<ul class="list-group">
{% for group in groups %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
<strong>{{ group.name }}</strong> ({{ group.players | length }} players)
<ul class="list-group mt-2">
{% for player in group.players %}
<li class="list-group-item">
{{ player.username }} ({{ player.ip }})
</li>
{% endfor %}
</ul>
</div>
<div>
<a href="{{ url_for('manage_group', group_id=group.id) }}" class="btn btn-sm btn-secondary">Manage Group</a>
<a href="{{ url_for('group_fullscreen', group_id=group.id) }}" class="btn btn-sm btn-primary">Full Screen</a>
{% if current_user.role == 'admin' %}
<form action="{{ url_for('delete_group', group_id=group.id) }}" method="post" style="display:inline;">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this group?');">Delete</button>
</form>
{% endif %}
</div>
</li>
{% endfor %}
</ul>
{% if current_user.role == 'admin' %}
<div class="mt-3">
<a href="{{ url_for('add_group') }}" class="btn btn-primary">Add Group</a>
<!-- App Settings Section -->
{% if current_user.role == 'admin' %}
<div class="col-md-4">
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-info text-white">
<h2>App Settings</h2>
</div>
<div class="card-body text-center">
<a href="{{ url_for('admin') }}" class="btn btn-info btn-lg">Go to Settings</a>
</div>
</div>
{% endif %}
</div>
{% endif %}
</div>
<!-- Content Upload Section -->
<div class="card mb-4">
<div class="card-header bg-warning text-dark">
<h2>Content Upload</h2>
</div>
<div class="card-body text-center">
<a href="{{ url_for('upload_content') }}" class="btn btn-warning btn-lg">Upload Content</a>
</div>
</div>
<!-- Integrate Player Section -->
{% if current_user.role == 'admin' %}
<div class="card mb-4">
<div class="card-header bg-dark text-white">
<h2>Integrate Player</h2>
</div>
<div class="card-body text-center">
<a href="{{ url_for('integrate_player') }}" class="btn btn-dark btn-lg">Integrate Player</a>
</div>
</div>
{% endif %}
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>

View File

@@ -3,13 +3,26 @@
<head>
<title>Integrate Player</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Integrate Player</h1>
<!-- Players Section -->
<div class="card mb-4">
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-primary text-white">
<h2>Players</h2>
</div>
@@ -17,7 +30,7 @@
<div class="row">
{% for player in players %}
<div class="col-md-4 mb-3">
<div class="card">
<div class="card {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-body">
<h5 class="card-title">{{ player.username }}</h5>
<p class="card-text">{{ player.ip }}</p>
@@ -35,7 +48,7 @@
</div>
<!-- Groups Section -->
<div class="card mb-4">
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-success text-white">
<h2>Groups</h2>
</div>
@@ -43,7 +56,7 @@
<div class="row">
{% for group in groups %}
<div class="col-md-4 mb-3">
<div class="card">
<div class="card {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-body">
<h5 class="card-title">{{ group.name }}</h5>
<p class="card-text">{{ group.players | length }} players</p>

View File

@@ -3,13 +3,26 @@
<head>
<title>Manage Group</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Manage Group: {{ group.name }}</h1>
<!-- Add Players to Group Section -->
<div class="card mb-4">
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-primary text-white">
<h2>Add Players to Group</h2>
</div>
@@ -29,17 +42,17 @@
</div>
<!-- Players in Group Section -->
<div class="card mb-4">
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-secondary text-white">
<h2>Players in Group</h2>
</div>
<div class="card-body">
<ul class="list-group">
{% for player in group.players %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>{{ player.username }} ({{ player.ip }})</div>
<li class="list-group-item {{ 'dark-mode' if theme == 'dark' else '' }}">
{{ player.username }} ({{ player.ip }})
<form action="{{ url_for('remove_player_from_group', group_id=group.id, player_id=player.id) }}" method="post" class="d-inline">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to remove this player from the group?');">Remove</button>
<button type="submit" class="btn btn-danger btn-sm float-end">Remove</button>
</form>
</li>
{% endfor %}
@@ -47,57 +60,15 @@
</div>
</div>
<!-- Upload Content Section -->
<div class="card mb-4">
<div class="card-header bg-success text-white">
<h2>Upload Content for Group</h2>
</div>
<div class="card-body">
<form action="{{ url_for('upload_content_to_group', group_id=group.id) }}" method="post" enctype="multipart/form-data">
<div class="mb-3">
<label for="files" class="form-label">Select Images</label>
<input type="file" class="form-control" id="files" name="files" multiple required>
</div>
<div class="mb-3">
<label for="duration" class="form-label">Display Duration (seconds)</label>
<input type="number" class="form-control" id="duration" name="duration" required>
</div>
<button type="submit" class="btn btn-primary">Upload</button>
</form>
</div>
</div>
<!-- Manage Group Content Section -->
<div class="card mb-4">
<div class="card-header bg-warning text-dark">
<h2>Manage Group Content</h2>
</div>
<div class="card-body">
<ul class="list-group">
{% for content in group.content %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>{{ content.file_name }} - {{ content.duration }} seconds</div>
<div>
<!-- Edit Duration Form -->
<form action="{{ url_for('edit_group_content', content_id=content.id) }}" method="post" class="d-inline">
<input type="number" name="duration" value="{{ content.duration }}" class="form-control d-inline-block" style="width: 80px;" required>
<button type="submit" class="btn btn-sm btn-warning">Edit</button>
</form>
<!-- Delete Content Form -->
<form action="{{ url_for('delete_group_content', content_id=content.id) }}" method="post" class="d-inline">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this content?');">Delete</button>
</form>
</div>
</li>
{% endfor %}
</ul>
<a href="{{ url_for('group_fullscreen', group_id=group.id) }}" class="btn btn-primary mt-3">Full Screen</a>
</div>
<!-- Replace Upload Content Card with Button -->
{% if current_user.role == 'admin' %}
<div class="text-center mb-4">
<a href="{{ url_for('upload_content', target_type='group', target_id=group.id, return_url=request.url) }}" class="btn btn-primary">Upload Content</a>
</div>
{% endif %}
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Back to Dashboard</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@@ -3,8 +3,21 @@
<head>
<title>Player Authentication</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Player Authentication</h1>
<form action="{{ url_for('player_fullscreen', player_id=player_id) }}" method="post">

View File

@@ -3,13 +3,26 @@
<head>
<title>Player Schedule</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Player Schedule for {{ player.username }}</h1>
<!-- Player Info Section -->
<div class="card mb-4">
<div class="card mb-4 {{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="card-header bg-info text-white">
<h2>Player Info</h2>
</div>
@@ -32,76 +45,24 @@
<h4 class="text-center">Member of Group(s):</h4>
<ul class="list-group">
{% for group in player.groups %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>{{ group.name }}</div>
<form action="{{ url_for('remove_player_from_group', group_id=group.id, player_id=player.id) }}" method="post" class="d-inline">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to remove this player from the group?');">Remove</button>
</form>
</li>
<li class="list-group-item {{ 'dark-mode' if theme == 'dark' else '' }}">{{ group.name }}</li>
{% endfor %}
</ul>
{% else %}
<h4 class="text-center">Not a member of any group</h4>
<p class="text-center">This player is not a member of any groups.</p>
{% endif %}
</div>
<!-- Schedule Section -->
<div class="card mb-4">
<div class="card-header bg-primary text-white">
<h2>Schedule</h2>
</div>
<div class="card-body">
<ul class="list-group">
{% for item in content %}
<li class="list-group-item d-flex justify-content-between align-items-center">
<div>
{{ item.file_name }} - {{ item.duration }} seconds
</div>
{% if not player.groups %}
<div>
<!-- Edit Duration Form -->
<form action="{{ url_for('edit_content', content_id=item.id) }}" method="post" class="d-inline">
<input type="number" name="duration" value="{{ item.duration }}" class="form-control d-inline-block" style="width: 80px;" required>
<button type="submit" class="btn btn-sm btn-warning">Edit</button>
</form>
<!-- Delete Resource Form -->
<form action="{{ url_for('delete_content', content_id=item.id) }}" method="post" class="d-inline">
<button type="submit" class="btn btn-sm btn-danger" onclick="return confirm('Are you sure you want to delete this resource?');">Delete</button>
</form>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
</div>
</div>
<!-- Upload Section -->
{% if not player.groups %}
<div class="card mb-4">
<div class="card-header bg-success text-white">
<h2>Upload Content</h2>
</div>
<div class="card-body">
<form action="{{ url_for('upload_content_to_player', player_id=player.id) }}" method="post" enctype="multipart/form-data">
<div class="mb-3">
<label for="files" class="form-label">Select Images</label>
<input type="file" class="form-control" id="files" name="files" multiple required>
</div>
<div class="mb-3">
<label for="duration" class="form-label">Display Duration (seconds)</label>
<input type="number" class="form-control" id="duration" name="duration" required>
</div>
<button type="submit" class="btn btn-primary">Upload</button>
</form>
</div>
<!-- Replace Upload Content Card with Button -->
{% if current_user.role == 'admin' %}
<div class="text-center mb-4">
<a href="{{ url_for('upload_content', target_type='player', target_id=player.id, return_url=request.url) }}" class="btn btn-primary">Upload Content</a>
</div>
{% endif %}
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary">Back to Dashboard</a>
<a href="{{ url_for('player_fullscreen', player_id=player.id) }}" class="btn btn-primary">Full Screen</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
</body>
</html>

View File

@@ -3,8 +3,21 @@
<head>
<title>Register</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Register</h1>
<form action="{{ url_for('register') }}" method="post">

View File

@@ -3,32 +3,58 @@
<head>
<title>Upload Content</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
body.dark-mode {
background-color: #121212;
color: #ffffff;
}
.card.dark-mode {
background-color: #1e1e1e;
color: #ffffff;
}
.dark-mode label, .dark-mode th, .dark-mode td {
color: #ffffff;
}
</style>
</head>
<body>
<body class="{{ 'dark-mode' if theme == 'dark' else '' }}">
<div class="container py-5">
<h1 class="text-center mb-4">Upload Content</h1>
<form method="POST" enctype="multipart/form-data">
<div class="mb-3">
<label for="target_type" class="form-label">Target Type:</label>
<select name="target_type" id="target_type" class="form-select" required>
<option value="player">Player</option>
<option value="group">Group</option>
<select name="target_type" id="target_type" class="form-select" required {% if target_type %}disabled{% endif %}>
<option value="player" {% if target_type == 'player' %}selected{% endif %}>Player</option>
<option value="group" {% if target_type == 'group' %}selected{% endif %}>Group</option>
</select>
{% if target_type %}
<input type="hidden" name="target_type" value="{{ target_type }}">
{% endif %}
</div>
<div class="mb-3">
<label for="target_id" class="form-label">Target ID:</label>
<select name="target_id" id="target_id" class="form-select" required>
<select name="target_id" id="target_id" class="form-select" required {% if target_id %}disabled{% endif %}>
<optgroup label="Players">
{% for player in players %}
<option value="{{ player.id }}">{{ player.username }}</option>
<option value="{{ player.id }}" {% if target_type == 'player' and target_id == player.id %}selected{% endif %}>{{ player.username }}</option>
{% endfor %}
</optgroup>
<optgroup label="Groups">
{% for group in groups %}
<option value="{{ group.id }}">{{ group.name }}</option>
<option value="{{ group.id }}" {% if target_type == 'group' and target_id == group.id %}selected{% endif %}>{{ group.name }}</option>
{% endfor %}
</optgroup>
</select>
{% if target_id %}
<input type="hidden" name="target_id" value="{{ target_id }}">
{% endif %}
</div>
<div class="mb-3">
<label for="media_type" class="form-label">Media Type:</label>
<select name="media_type" id="media_type" class="form-select" required>
<option value="image">Image</option>
<option value="video">Video</option>
</select>
</div>
<div class="mb-3">
<label for="files" class="form-label">Files:</label>
@@ -40,8 +66,26 @@
</div>
<button type="submit" class="btn btn-primary">Upload</button>
</form>
<a href="{{ return_url }}" class="btn btn-secondary mt-3">Back</a>
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary mt-3">Back to Dashboard</a>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/js/bootstrap.bundle.min.js"></script>
<script>
document.getElementById('files').addEventListener('change', function(event) {
const files = event.target.files;
const mediaType = document.getElementById('media_type').value;
if (mediaType === 'video' && files.length > 0) {
const videoFile = files[0];
const videoElement = document.createElement('video');
videoElement.preload = 'metadata';
videoElement.onloadedmetadata = function() {
window.URL.revokeObjectURL(videoElement.src);
const duration = videoElement.duration;
document.getElementById('duration').value = Math.round(duration);
}
videoElement.src = URL.createObjectURL(videoFile);
}
});
</script>
</body>
</html>