Files
amsterdam/ui/views/posts.jet
T
2026-04-19 20:18:23 -05:00

241 lines
15 KiB
Plaintext

{*
* Amsterdam Web Communities System
* Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*
* SPDX-License-Identifier: MPL-2.0
*}
<div class="p-4">
<!-- Page Title -->
<div class="mb-6">
<h1 class="text-blue-800 text-4xl font-bold inline">{{ topicName | raw }}</h1>
<span class="text-blue-800 text-xl font-bold ml-2">{{ summaryLine }}</span>
<hr class="border-2 border-gray-400 w-4/5 mt-2 mb-6">
</div>
<div class="max-w-6xl">
<!-- Topic Controls -->
<div class="flex justify-between items-center mb-4 gap-2 flex-wrap">
<div class="flex gap-2 flex-wrap">
<a href="{{ topicListLink }}"
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Topic List</a>
{{ if !.CurrentUser().IsAnon }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/hide"
class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">
{{ if isTopicHidden }}Show Topic{{ else }}Hide Topic{{ end }}
</a>
{{ end }}
{{ if isset(urlNextTopic) }}
<a href="{{ urlNextTopic }}"
class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Next Topic</a>
{{ end }}
{{ if isset(urlNextKeepNew) }}
<a href="{{ urlNextKeepNew }}"
class="bg-green-600 hover:bg-green-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Next & Keep New</a>
{{ end }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/find"
class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Find</a>
{{ if !isAnon }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/manage"
class="bg-gray-600 hover:bg-gray-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Manage</a>
{{ end }}
</div>
<div class="flex gap-2 flex-wrap">
{{ if canStick }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/stick"
class="bg-purple-600 hover:bg-purple-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">
{{ if isSticky }}Unstick Topic{{ else }}Stick Topic{{ end }}
</a>
{{ end }}
{{ if canFreeze }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/freeze"
class="bg-indigo-600 hover:bg-indigo-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">
{{ if isFrozen }}Unfreeze Topic{{ else }}Freeze Topic{{ end }}
</a>
{{ end }}
{{ if canArchive }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/archive"
class="bg-yellow-600 hover:bg-yellow-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">
{{ if isArchived }}Unarchive Topic{{ else }}Archive Topic{{ end }}
</a>
{{ end }}
{{ if canDelete }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/delete"
class="bg-red-600 hover:bg-red-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Delete Topic</a>
{{ end }}
</div>
</div>
<!-- Navigation Bar -->
<div class="flex justify-between items-center mb-4">
<form method="GET" action="{{ post_stem }}" class="flex items-center gap-2">
<input type="text" name="rgo" value="" size="6" maxlength="13" placeholder="Go to..."
class="px-3 py-2 border border-gray-300 rounded font-mono text-sm focus:outline-none focus:ring-2 focus:ring-blue-500">
<button type="submit" name="go" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded text-sm font-medium transition-colors">Go</button>
</form>
<div class="flex items-center gap-2 text-sm" name="top">
<a name="top"><span>[</span></a>
<a href="{{ post_stem }}?r=0,-1" class="text-blue-700 hover:text-blue-900">View All</a>
{{ if rangeStart > 0 }}
<span>|</span>
<a href="{{ post_stem }}?r={{ rangeStart - pageSize - 1 }},{{ rangeStart - 1 }}" class="text-blue-700 hover:text-blue-900 mx-2">Scroll Up {{ pageSize }}</a>
{{ end }}
{{ if rangeEnd < post_max }}
<span>|</span>
<a href="{{ post_stem }}?r={{ rangeEnd + 1 }},{{ rangeEnd + pageSize + 1 }}" class="text-blue-700 hover:text-blue-900 mx-2">Scroll Down {{ pageSize }}</a>
<span>|</span>
<a href="{{ post_stem }}?r={{ post_max - pageSize - 1 }},{{ post_max }}" class="text-blue-700 hover:text-blue-900 mx-2">Scroll To End</a>
{{ end }}
<span>|</span>
<a href="#bottom" class="text-blue-700 hover:text-blue-900">Bottom</a>
<span>]</span>
</div>
</div>
<!-- Permalink Info -->
<div class="text-center text-sm text-gray-600 mb-6">
<a href="{{ post_topicPermalink }}" class="text-blue-700 hover:text-blue-900" title="Permalink to this topic">🔗Topic</a>
<span class="mx-2">·</span>
<a href="{{ postsPermalink }}" class="text-blue-700 hover:text-blue-900" title="Permalink to these posts">🔗Posts</a>
</div>
<!-- Messages -->
<div class="space-y-6 mb-8">
{{ if advancedControls }}<div class="flex gap-4">{{ end }}
{{ post_cur := nil }}
{{ post_userName := "" }}
{{ post_text := "" }}
{{ post_overrideLine := "" }}
{{ post_overrideLink := "" }}
{{ post_attach := nil }}
{{ post_bozo := false }}
{{ post_profile_pic := "" }}
{{ range i, p := posts }}
{{ post_cur = p }}
{{ post_userName = post_getUserName(p, .) }}
{{ post_text = post_getText(p, .) }}
{{ post_overrideLine = post_getOverrideLine(p, advancedControls, .) }}
{{ post_overrideLink = post_getOverrideLink(p, advancedControls, post_topicLink) }}
{{ post_attach = post_getAttachmentInfo(p, .) }}
{{ post_bozo = post_isBozo(p, post_topic, .) }}
{{ if showPics }}
{{ post_profile_pic = post_profileImage(p, .) }}
{{ end }}
{{ include "singlepost.jet" }}
{{ if advancedControls }}
<div class="flex flex-col gap-2">
{{ if canHide }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/hide/{{ p.Num }}"
class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">
{{ if isPostHidden }}Show{{ else }}Hide{{ end }}
</a>
{{ end }}
{{ if canScribble }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/scribble/{{ p.Num }}"
class="bg-yellow-600 hover:bg-yellow-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">Scribble</a>
{{ end }}
{{ if !isAnon }}
<a href="{{ post_stem }}?r={{ p.Num }}&ac=1&bozo=1"
class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">Filter User</a>
{{ end }}
{{ if canNuke }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/nuke/{{ p.Num }}"
class="bg-red-600 hover:bg-red-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">Nuke</a>
{{ if post_attach.Filename != "" }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/prune/{{ p.Num }}"
class="bg-red-600 hover:bg-red-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">Prune Attach</a>
{{ end }}
{{ end }}
{{ if canMove }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/move/{{ p.Num }}"
class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">Move</a>
{{ end }}
{{ if canPublish }}
<a href="{{ topicListLink }}/op/{{ topicNum }}/publish/{{ p.Num }}"
class="bg-blue-600 hover:bg-blue-700 text-white px-3 py-2 rounded text-sm font-medium transition-colors whitespace-nowrap">Publish</a>
{{ end }}
</div>
{{ end }}
{{ if pin == p.Num }}<hr/>{{ end }}
{{ end }}
{{ if advancedControls }}</div>{{ end }}
</div>
<!-- Bottom Navigation -->
<div class="flex justify-end items-center mb-6 text-sm" name="bottom">
<a name="bottom"><span>[</span></a>
<a href="{{ post_stem }}?r=0,-1" class="text-blue-700 hover:text-blue-900 mx-2">View All</a>
{{ if rangeStart > 0 }}
<span>|</span>
<a href="{{ post_stem }}?r={{ rangeStart - pageSize - 1 }},{{ rangeStart - 1 }}" class="text-blue-700 hover:text-blue-900 mx-2">Scroll Up {{ pageSize }}</a>
{{ end }}
{{ if rangeEnd < post_max }}
<span>|</span>
<a href="{{ post_stem }}?r={{ rangeEnd + 1 }},{{ rangeEnd + pageSize + 1 }}" class="text-blue-700 hover:text-blue-900 mx-2">Scroll Down {{ pageSize }}</a>
<span>|</span>
<a href="{{ post_stem }}?r={{ post_max - pageSize - 1 }},{{ post_max }}" class="text-blue-700 hover:text-blue-900 mx-2">Scroll To End</a>
{{ end }}
<span>|</span>
<a href="#top" class="text-blue-700 hover:text-blue-900 mx-2">Top</a>
<span>]</span>
</div>
<!-- Reply Form -->
{{ if canPost }}
<hr class="border-gray-400 mb-6">
<h2 class="text-2xl font-bold text-black mb-4">Post Message in "{{ topicName | raw }}":</h2>
<form method="POST" action="{{ post_stem }}">
<input type="hidden" name="xp" value="{{ post_max }}"/>
{{ if isset(urlNextTopic) }}
<input type="hidden" name="nextlink" value="{{ urlNextTopic }}"/>
{{ end }}
<div class="bg-gray-50 p-6 rounded-lg space-y-4">
<div>
<label for="pseud" class="block text-black text-sm font-medium mb-2">Your name/header:</label>
<div class="flex items-center gap-4">
<input type="text" id="pseud" name="pseud" size="37" maxlength="255" value="{{ pseud }}"
class="flex-1 px-3 py-2 border border-gray-300 rounded font-mono focus:outline-none focus:ring-2 focus:ring-blue-500">
<div class="flex items-center gap-2">
<input type="checkbox" id="attach" name="attach" value="Y" class="w-4 h-4 text-blue-600 border-gray-300 rounded">
<label for="attach" class="text-black text-sm">Attach a file</label>
</div>
</div>
</div>
<div>
<div class="flex justify-between items-center mb-2">
<label for="pb" class="text-black text-sm font-medium">Message:</label>
<a href="#" onclick="window.open('/static/html-reference.html', 'htmlref', 'popup=true,width=800,height=800'); return false;"
class="text-blue-700 hover:text-blue-900 text-sm">HTML Guide</a>
</div>
<textarea id="pb" name="pb" wrap="soft" rows="7" cols="51" placeholder="Enter your post..."
class="w-full px-3 py-2 border border-gray-300 rounded font-mono text-sm focus:outline-none focus:ring-2 focus:ring-blue-500"></textarea>
</div>
<div class="flex justify-center gap-4">
<button type="submit" name="preview" class="bg-gray-600 hover:bg-gray-700 text-white px-6 py-2 rounded font-medium transition-colors">Preview</button>
<button type="submit" name="post" class="bg-green-600 hover:bg-green-700 text-white px-6 py-2 rounded font-medium transition-colors">Post & Reload</button>
{{ if isset(urlNextTopic) }}
<button type="submit" name="postnext" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded font-medium transition-colors">Post & Go Next</button>
{{ end }}
<button type="submit" name="posttopics" class="bg-blue-600 hover:bg-blue-700 text-white px-6 py-2 rounded font-medium transition-colors">Post & Go Topics</button>
</div>
</div>
</form>
{{ else if showFrozenArchiveMessages }}
<div class="text-center text-md text-gray-600">
{{ if isArchived }}
<b>This Is an <i>Archived</i> Topic</b>
{{ else if isFrozen }}
<b>This Is a <i>Frozen</i> Topic</b>
{{ end }}
</div>
{{ end }}
</div>
</div>