HackmanCMS/views/project/_tab_botschedule.php
Bashy 45b9e15152 Improve LinkedIn UI and scheduling robustness
- When LinkedIn is connected, replace the Connect button with a pencil
  (test post to first personal profile) and a reconnect arrow icon
- Add Process Now button to the Schedule tab that shells out to the cron
  script on demand and shows its output inline
- Add flock() to the cron script to prevent overlapping runs
- Fix cron install path comment to match deployed location

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-03 15:17:26 +03:00

88 lines
3.8 KiB
PHP

<div id="botSchedulePanel" data-project-id="<?= $pid ?>">
<!-- Create form -->
<div class="card mb-4">
<div class="card-header py-2 small fw-semibold"><i class="bi bi-clock me-1"></i>Schedule a Post</div>
<div class="card-body">
<div class="mb-2">
<label class="form-label small">Content</label>
<textarea id="schedContent" rows="4" class="form-control form-control-sm font-monospace"
placeholder="What's on your mind?"></textarea>
</div>
<div class="mb-3">
<label class="form-label small">URL <span class="text-muted">(optional appended to content)</span></label>
<input type="url" id="schedUrl" class="form-control form-control-sm font-monospace"
placeholder="https://example.com/post">
</div>
<div class="mb-3">
<label class="form-label small">Send at</label>
<input type="datetime-local" id="schedAt" class="form-control form-control-sm" style="max-width:240px">
</div>
<label class="form-label small">Platforms</label>
<div class="mb-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="schedUseDiscord">
<label class="form-check-label small fw-semibold" for="schedUseDiscord">
<i class="bi bi-discord me-1 text-primary"></i>Discord
</label>
</div>
<div id="schedDiscordPicker" class="d-none ms-3 mt-1">
<div id="schedDiscordChannels" class="d-flex flex-wrap gap-2"></div>
<div class="text-muted small d-none" id="schedDiscordEmpty">
No Discord channels configured add them in the Config tab.
</div>
</div>
</div>
<div class="mb-2">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="schedUseMastodon">
<label class="form-check-label small fw-semibold" for="schedUseMastodon">
<i class="bi bi-mastodon me-1 text-primary"></i>Mastodon
</label>
</div>
<div id="schedMastodonPicker" class="d-none ms-3 mt-1">
<div id="schedMastodonAccounts" class="d-flex flex-wrap gap-2"></div>
<div class="text-muted small d-none" id="schedMastodonEmpty">
No Mastodon accounts configured add them in the Config tab.
</div>
</div>
</div>
<div class="mb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="schedUseLinkedin">
<label class="form-check-label small fw-semibold" for="schedUseLinkedin">
<i class="bi bi-linkedin me-1 text-primary"></i>LinkedIn
</label>
</div>
<div id="schedLinkedinPicker" class="d-none ms-3 mt-1">
<div id="schedLinkedinProfiles" class="d-flex flex-wrap gap-2"></div>
<div class="text-muted small d-none" id="schedLinkedinEmpty">
No LinkedIn profiles connected connect your account in the Config tab.
</div>
</div>
</div>
<div class="text-danger small d-none mb-2" id="schedError"></div>
<button class="btn btn-primary btn-sm" id="schedSubmitBtn">
<i class="bi bi-calendar-check me-1"></i>Schedule Post
</button>
</div>
</div>
<!-- Post list -->
<div class="d-flex align-items-center gap-2 mb-3">
<h6 class="mb-0">Scheduled &amp; Recent Posts</h6>
<button class="btn btn-sm btn-outline-secondary ms-auto" id="schedRunNowBtn" title="Process all due posts now">
<i class="bi bi-play-circle me-1"></i>Process Now
</button>
</div>
<div id="schedRunNowOutput" class="d-none mb-2">
<pre class="bg-body-secondary border rounded p-2 small mb-0" id="schedRunNowPre" style="max-height:160px;overflow:auto"></pre>
</div>
<div id="schedPostsList"><div class="text-muted small">Loading…</div></div>
</div>