Files
assetmgt/upgrades.php
“VeLiTi” 9673d9be7b Implement Software Upgrade Management API and Frontend Functionality
- Added software.php for managing software versions, including download and purchase actions.
- Created upgrade_paths.php for handling upgrade paths management.
- Developed user_licenses.php for managing user licenses.
- Introduced version_access_rules.php for managing access rules for software versions.
- Implemented frontend functions in functions.js for interacting with the software upgrade API.
- Added version_access.php for user access validation and license management.
- Created upgrades.php for displaying available upgrades and handling user interactions.
- Enhanced UI with responsive design and progress indicators for downloads and purchases.
2025-12-11 15:32:18 +01:00

285 lines
5.6 KiB
PHP

<?php
defined(page_security_key) or exit;
if (debug && debug_id == $_SESSION['id']){
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
}
include_once './assets/functions.php';
include_once './settings/settings_redirector.php';
//Check if allowed
if (isAllowed('upgrades',$_SESSION['profile'],$_SESSION['permission'],'R') === 0){
header('location: index.php');
exit;
}
template_header('Software Upgrades', 'upgrades', 'view');
$view = '
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-header">
<h3 class="card-title">
<i class="fas fa-download"></i> Software Upgrades
</h3>
<div class="card-tools">
<button type="button" class="btn btn-tool" data-card-widget="collapse">
<i class="fas fa-minus"></i>
</button>
</div>
</div>
<div class="card-body">
<div id="upgrade-container">
<div class="text-center">
<div class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
<p>Loading available upgrades...</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Include the upgrade functions -->
<script src="assets/functions.js"></script>
<script>
// Initialize upgrade system when page loads
document.addEventListener(\'DOMContentLoaded\', function() {
// Wait a bit for the upgrade manager to initialize
setTimeout(function() {
showUpgradeOptions(\'upgrade-container\');
}, 500);
});
</script>
<style>
/* Upgrade System Styles */
.current-version-info {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 0.375rem;
padding: 1rem;
margin-bottom: 2rem;
}
.current-version-info h3 {
color: #495057;
margin-bottom: 0.5rem;
font-size: 1.25rem;
}
.available-versions {
display: grid;
gap: 1.5rem;
}
.version-card {
border: 1px solid #dee2e6;
border-radius: 0.5rem;
padding: 1.5rem;
background: white;
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
transition: box-shadow 0.15s ease-in-out;
}
.version-card:hover {
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}
.version-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 1rem;
}
.version-header h4 {
margin: 0;
color: #495057;
font-size: 1.1rem;
}
.version-number {
background: #6c757d;
color: white;
padding: 0.25rem 0.5rem;
border-radius: 0.25rem;
font-size: 0.875rem;
font-weight: 500;
}
.version-description {
color: #6c757d;
margin-bottom: 1rem;
line-height: 1.5;
}
.version-meta {
display: flex;
gap: 1rem;
margin-bottom: 1rem;
font-size: 0.875rem;
color: #6c757d;
}
.price-info {
margin-bottom: 1rem;
font-size: 1.1rem;
font-weight: 600;
color: #28a745;
}
.upgrade-price {
color: #dc3545;
text-decoration: line-through;
margin-right: 0.5rem;
}
.original-price {
color: #6c757d;
font-size: 0.9rem;
}
.upgrade-label {
display: block;
font-size: 0.8rem;
color: #17a2b8;
font-weight: normal;
margin-top: 0.25rem;
}
.version-actions {
margin-top: 1rem;
}
.download-btn, .purchase-btn {
background: #007bff;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
cursor: pointer;
font-size: 1rem;
font-weight: 500;
transition: background-color 0.15s ease-in-out;
}
.download-btn:hover, .purchase-btn:hover {
background: #0056b3;
}
.locked-btn {
background: #6c757d;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
cursor: not-allowed;
font-size: 1rem;
font-weight: 500;
}
.success-btn {
background: #28a745 !important;
color: white;
border: none;
padding: 0.75rem 1.5rem;
border-radius: 0.375rem;
font-size: 1rem;
font-weight: 500;
}
.badge {
display: inline-block;
padding: 0.35rem 0.5rem;
font-size: 0.75rem;
font-weight: 700;
line-height: 1;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.375rem;
}
.badge.owned {
background: #28a745;
color: white;
}
.badge.locked {
background: #dc3545;
color: white;
}
.download-progress {
margin-top: 1rem;
text-align: center;
}
.progress-bar {
width: 100%;
height: 1rem;
background: #e9ecef;
border-radius: 0.5rem;
overflow: hidden;
margin-bottom: 0.5rem;
}
.progress-fill {
height: 100%;
background: #007bff;
transition: width 0.3s ease;
border-radius: 0.5rem;
}
.progress-text {
font-weight: 600;
color: #495057;
}
.error-message {
color: #dc3545;
background: #f8d7da;
border: 1px solid #f5c6cb;
border-radius: 0.375rem;
padding: 1rem;
text-align: center;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.version-header {
flex-direction: column;
align-items: flex-start;
gap: 0.5rem;
}
.version-meta {
flex-direction: column;
gap: 0.25rem;
}
.available-versions {
gap: 1rem;
}
.version-card {
padding: 1rem;
}
}
</style>
';
//OUTPUT
echo $view;
template_footer();