| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- <?php
- require_once __DIR__ . '/lib/identity.php';
- require_once __DIR__ . '/lib/render.php';
- $actor = current_actor('ICG');
- $vendors = all_vendors();
- $initialMessageMaxIds = [];
- foreach ($vendors as $v) {
- $initialMessageMaxIds[(int) $v['id']] = max_message_id((int) $v['id']);
- }
- $initialHistoryId = max_history_id();
- ?><!doctype html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <title>PDQ Schedule</title>
- <link rel="stylesheet" href="assets/app.css">
- <script>
- window.PDQ = {
- actor: 'ICG',
- audience: 'ICG',
- vendors: <?= json_encode(array_map(fn($v) => ['slug' => $v['slug'], 'name' => $v['name']], $vendors)) ?>,
- pollMs: 60000,
- initialHistoryId: <?= (int) $initialHistoryId ?>,
- initialMessageMaxIds: <?= json_encode((object) $initialMessageMaxIds) ?>
- };
- </script>
- <script src="assets/app.js" defer></script>
- </head>
- <body>
- <div class="topbar">
- <h1>PDQ Schedule</h1>
- <span class="who">
- <a href="log.php">Activity log</a>
- · Signed in as <strong>ICG</strong>
- · <span id="sync-time">Loading…</span>
- </span>
- </div>
- <div class="add-row">
- <label for="add-job-vendor">Add job for:</label>
- <select id="add-job-vendor">
- <?php foreach ($vendors as $v): ?>
- <option value="<?= h($v['slug']) ?>"><?= h($v['name']) ?></option>
- <?php endforeach; ?>
- </select>
- <button id="add-job" class="btn btn-add">Add One</button>
- </div>
- <div class="jobs-wrap">
- <div id="jobs-table"><?= render_jobs_table('ICG') ?></div>
- </div>
- <div class="threads-container">
- <?php foreach ($vendors as $v):
- $vid = (int) $v['id'];
- $maxId = max_message_id($vid);
- ?>
- <section class="thread" data-vendor="<?= h($v['slug']) ?>">
- <h2>Messages with <?= h($v['name']) ?></h2>
- <div class="thread-list" data-max-id="<?= $maxId ?>">
- <?php
- $rendered = render_messages($vid);
- echo $rendered !== '' ? $rendered : '<div class="msg-empty">No messages yet.</div>';
- ?>
- </div>
- <form class="thread-compose" autocomplete="off">
- <input type="text" name="body" placeholder="Message <?= h($v['name']) ?>…" maxlength="4000" required>
- <button type="submit" class="btn btn-post">Post</button>
- </form>
- </section>
- <?php endforeach; ?>
- </div>
- </body>
- </html>
|