| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>ArduPilot Overlay Manager - Edit</title>
- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css">
-
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.css">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/theme/monokai.min.css">
-
- <style>
- html, body { height: 100%; }
- body {
- display: flex;
- flex-direction: column;
- font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
- background-color: #f4f6f9;
- }
- .content-wrapper { flex: 1 0 auto; }
- .navbar-brand { font-size: 25px; }
- .card { border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.05); border: none;}
- footer { flex-shrink: 0; }
-
- .CodeMirror {
- height: 600px;
- font-size: 14px;
- font-family: 'Courier New', Courier, monospace;
- border-radius: 0;
- }
-
- .profile-list-item.active {
- background-color: #0d6efd;
- border-color: #0d6efd;
- color: white;
- }
- .profile-list-item.active .text-muted {
- color: rgba(255,255,255,0.9) !important;
- }
- </style>
- </head>
- <body>
- <div class="content-wrapper">
- <nav class="navbar navbar-dark bg-dark shadow-sm py-2">
- <div class="container-fluid px-4">
- <div class="d-flex align-items-center">
- <a class="navbar-brand d-flex align-items-center" href="/">
- <img src="/static/images/ardupilot_logo.png" alt="ArduPilot" height="24" class="d-inline-block align-text-top me-2">
- <span class="text-white">Overlay Manager</span>
- </a>
- </div>
- <div class="ms-auto d-flex align-items-center">
- <a href="javascript:void(0);" onclick="window.location.href = window.location.protocol + '//' + window.location.hostname;" class="btn btn-outline-light">
- <i class="bi bi-arrow-left me-2"></i>Back to Main App
- </a>
- </div>
- </div>
- </nav>
- <div class="container-fluid px-4 mt-4">
- {% if error_msg %}
- <div class="alert alert-danger alert-dismissible fade show shadow-sm" role="alert">
- <i class="bi bi-exclamation-triangle-fill me-2"></i>{{ error_msg }}
- <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
- </div>
- {% endif %}
- <div class="row g-4">
- <div class="col-md-3">
- <div class="card mb-4">
- <div class="card-header bg-white py-3 d-flex justify-content-between align-items-center">
- <h6 class="mb-0 fw-bold text-dark"><i class="bi bi-diagram-3-fill me-2 text-primary"></i>Profiles / Loadouts</h6>
- </div>
- <div class="list-group list-group-flush">
- {% for p in profiles %}
- <div class="list-group-item d-flex justify-content-between align-items-center profile-list-item {% if p.id == active_profile.id %}active{% endif %}">
- <div class="w-100 fw-bold text-muted {% if p.id == active_profile.id %}text-white{% endif %}">
- {{ p.name }}
- {% if p.is_readonly %}
- <i class="bi bi-shield-lock-fill ms-1" title="Read-Only System Profile"></i>
- {% elif p.is_locked %}
- <i class="bi bi-lock-fill ms-1" title="User Locked"></i>
- {% endif %}
- {% if p.id == active_profile.id %}<i class="bi bi-check-circle-fill ms-2"></i>{% endif %}
- </div>
- </div>
- {% endfor %}
- </div>
- <div class="card-footer bg-light p-3 text-center">
- <small class="text-muted"><i class="bi bi-info-circle me-1"></i> Return to the dashboard to switch profiles.</small>
- </div>
- </div>
- </div>
- <div class="col-md-9">
- <div class="card h-100 mb-5 border-0 shadow-sm">
- <div class="card-header bg-white py-3 d-flex justify-content-between align-items-center border-bottom-0">
- <h5 class="card-title mb-0 fw-bold text-dark">
- <i class="bi bi-pencil-square me-2 text-primary"></i>Editing: <span class="text-primary font-monospace">{{ filepath }}</span>
- </h5>
- <a href="./" class="btn btn-sm btn-outline-secondary"><i class="bi bi-arrow-left me-1"></i> Back to Loadout</a>
- </div>
-
- <div class="card-body p-0">
- {% if active_profile.is_readonly or active_profile.is_locked %}
- <div class="alert alert-warning m-3 shadow-sm border-0">
- <i class="bi bi-lock-fill me-2"></i> This profile is locked or read-only. You can view the file but cannot save changes.
- </div>
- {% endif %}
-
- <form action="edit" method="post" id="editForm">
- <input type="hidden" name="file_id" value="{{ file_id }}">
-
- <textarea id="code-editor" name="content">{{ content }}</textarea>
- {% if not active_profile.is_readonly and not active_profile.is_locked %}
- <div class="p-3 bg-light text-end rounded-bottom border-top">
- <a href="./" class="btn btn-secondary me-2">Cancel</a>
- <button type="submit" class="btn btn-success fw-bold"><i class="bi bi-save2-fill me-2"></i> Save Changes to DB</button>
- </div>
- {% endif %}
- </form>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- <footer class="py-3 bg-dark text-white-50 mt-auto">
- <div class="container-fluid px-4 d-flex justify-content-between">
- <div>
- <span class="mx-2">Credits: <a href="https://github.com/ArduPilot/CustomBuild/graphs/contributors" style="text-decoration: underline; color: white;">See Contributors</a></span>|
- <span class="mx-2">Source: <a href="https://git.equalmass.com/Equalmass/ArdupilotCustomFirmwareBuilder" style="text-decoration: underline; color: white;">Ardupilot/CustomBuild</a></span>
- </div>
- <span>ArduPilot Overlay Manager</span>
- </div>
- </footer>
-
- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
-
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/codemirror.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/clike/clike.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.65.13/mode/python/python.min.js"></script>
-
- <script>
- var isLocked = {{ 'true' if active_profile.is_readonly or active_profile.is_locked else 'false' }};
- var editor = CodeMirror.fromTextArea(document.getElementById("code-editor"), {
- lineNumbers: true,
- mode: "text/x-c++src",
- theme: "monokai",
- matchBrackets: true,
- indentUnit: 4,
- indentWithTabs: false,
- readOnly: isLocked ? "nocursor" : false
- });
-
- document.getElementById('editForm').addEventListener('submit', function(e) {
- if (isLocked) {
- e.preventDefault();
- alert('Cannot save. The profile is currently locked.');
- } else {
- editor.save();
- }
- });
- </script>
- </body>
- </html>
|