Only show trust controls if the trust updater has received trust values.
[Sone.git] / src / main / resources / templates / include / viewPost.html
index e351fd0..706ef32 100644 (file)
@@ -1,18 +1,71 @@
-<a name="post-<% post.id|html>"></a>
-<div id="<% post.id|html>" class="post<%if loop.last> last<%/if><%if post.new> new<%/if>">
+<div id="post-<% post.id|html>" class="post<%if loop.last> last<%/if><%if !post.sone.local><%if post.new> new<%/if><%/if>">
+       <a name="post-<% post.id|html>"></a>
        <div class="post-time hidden"><% post.time|html></div>
-       <div class="avatar">
-               <img src="/WoT/GetIdenticon?identity=<% post.sone.id|html>&amp;width=48&height=48" width="48" height="48" alt="Avatar Image" />
+       <div class="post-author hidden"><% post.sone.id|html></div>
+       <div class="post-author-local hidden"><% post.sone.local></div>
+       <%include include/soneMenu.html class=="sone-post-menu" sone=post.sone>
+       <div class="avatar post-avatar" >
+               <%if post.loaded>
+                       <%ifnull !post.sone.profile.avatar>
+                               <%post.sone.profile.avatar|image-link max-width==48 max-height==48 mode==enlarge title=="Avatar Image">
+                       <%else>
+                               <img src="/WebOfTrust/GetIdenticon?identity=<% post.sone.id|html>&amp;width=48&amp;height=48" width="48" height="48" alt="Avatar Image" />
+                       <%/if>
+               <%else>
+                       <img src="images/sone-avatar.png" width="48" height="48" alt="Avatar Image" />
+               <%/if>
        </div>
        <div class="inner-part">
-               <div>
+               <div<%if !post.loaded> class="hidden"<%/if>>
                        <div class="author profile-link"><a href="viewSone.html?sone=<% post.sone.id|html>"><% post.sone.niceName|html></a></div>
-                       <div class="text"><% post.text|html></div>
+                       <%ifnull !post.recipient>
+                               <span class="recipient-to">→</span>
+                               <%ifnull post.recipient.identity>
+                                       <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><%= View.Post.UnknownAuthor|l10n|html></a></div>
+                               <%else>
+                                       <div class="recipient profile-link"><a href="viewSone.html?sone=<% post.recipient.id|html>"><% post.recipient.niceName|html></a></div>
+                               <%/if>
+                       <%/if>
+                       <% post.text|html|store key==originalText text==true>
+                       <% post.text|parse sone=post.sone|store key==parsedText text==true>
+                       <% post.text|parse sone=post.sone length=core.preferences.charactersPerPost cut-off-length=core.preferences.postCutOffLength|store key==shortText text==true>
+                       <div class="post-text raw-text<%if !raw> hidden<%/if>"><% originalText></div>
+                       <div class="post-text text<%if raw> hidden<%/if><%if !shortText|match key=parsedText> hidden<%/if>"><% parsedText></div>
+                       <div class="post-text short-text<%if raw> hidden<%/if><%if shortText|match key=parsedText> hidden<%/if>"><% shortText></div>
+                       <%if !shortText|match value=parsedText><%if !raw><a class="expand-post-text" href="viewPost.html?post=<% post.id|html>&amp;raw=true"><%= View.Post.ShowMore|l10n|html></a><%/if><%/if>
+                       <%if !shortText|match value=parsedText><%if !raw><a class="shrink-post-text hidden"><%= View.Post.ShowLess|l10n|html></a><%/if><%/if>
                </div>
-               <div class="post-status-line status-line">
-                       <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format="MMM d, yyyy, HH:mm:ss"></a></div>
-                       <div class="likes<%if post.likes.size|match value=0> hidden<%/if>"><span title="<% post.likes.soneNames|html>">⬆<span class="like-count"><% post.likes.size></span></span></div>
+               <div class="post-status-line status-line<%if !post.loaded> hidden<%/if>">
+                       <div class="bookmarks">
+                               <form class="unbookmark<%if !post.bookmarked> hidden<%/if>" action="unbookmark.html" method="post">
+                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                       <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                       <input type="hidden" name="post" value="<% post.id|html>" />
+                                       <button type="submit" title="<%= View.Post.Bookmarks.PostIsBookmarked|l10n|html>">★</button>
+                               </form>
+                               <form class="bookmark<%if post.bookmarked> hidden<%/if>" action="bookmark.html" method="post">
+                                       <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                       <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                       <input type="hidden" name="post" value="<% post.id|html>" />
+                                       <button type="submit" title="<%= View.Post.Bookmarks.PostIsNotBookmarked|l10n|html>">☆</button>
+                               </form>
+                       </div>
+                       <span class='separator'>·</span>
+                       <div class="time"><a href="viewPost.html?post=<% post.id|html>"><% post.time|date format=="MMM d, yyyy, HH:mm:ss"></a></div>
+                       <span class='separator'>·</span>
+                       <div class="permalink permalink-post"><a href="post://<%post.id|html>">[<%= View.Post.Permalink|l10n|html>]</a></div>
+                       <span class='separator'>·</span>
+                       <div class="permalink permalink-author"><a href="sone://<%post.sone.id|html>">[<%= View.Post.PermalinkAuthor|l10n|html>]</a></div>
+                       <%if ! originalText|match value=parsedText>
+                               <span class='separator'>·</span>
+                               <div class="show-source"><a href="viewPost.html?post=<% post.id|html>&amp;raw=<%if raw>false<%else>true<%/if>"><%= View.Post.ShowSource|l10n|html></a></div>
+                       <%/if>
+                       <div class="likes<%if post.likes.size|match value==0> hidden<%/if>">
+                               <span class='separator'>·</span>
+                               <span title="<% post.likes.soneNames|html>">↑<span class="like-count"><% post.likes.size></span></span>
+                       </div>
                        <%ifnull ! currentSone>
+                               <span class='separator'>·</span>
                                <form class="like like-post<%if post.liked> hidden<%/if>" action="like.html" method="post">
                                        <input type="hidden" name="formPassword" value="<% formPassword|html>" />
                                        <input type="hidden" name="returnPage" value="<% request.uri|html>" />
                                        <input type="hidden" name="post" value="<% post.id|html>" />
                                        <button type="submit" value="1"><%= View.Post.UnlikeLink|l10n|html></button>
                                </form>
+                               <%if !post.sone.current>
+                                       <%ifnull !post.sone.trust>
+                                       <span class='separator'>·</span>
+                                       <form class="trust post-trust<%if post.sone.trust.assigned> hidden<%/if>" action="trust.html" method="post">
+                                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                               <input type="hidden" name="sone" value="<% post.sone.id|html>" />
+                                               <button type="submit" title="<%= View.Trust.Tooltip.Trust|l10n|html>">✓</button>
+                                       </form>
+                                       <form class="distrust post-distrust<%if post.sone.trust.assigned> hidden<%/if>" action="distrust.html" method="post">
+                                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                               <input type="hidden" name="sone" value="<% post.sone.id|html>" />
+                                               <button type="submit" title="<%= View.Trust.Tooltip.Distrust|l10n|html>">✗</button>
+                                       </form>
+                                       <form class="untrust post-untrust<%if !post.sone.trust.assigned> hidden<%/if>" action="untrust.html" method="post">
+                                               <input type="hidden" name="formPassword" value="<% formPassword|html>" />
+                                               <input type="hidden" name="returnPage" value="<% request.uri|html>" />
+                                               <input type="hidden" name="sone" value="<% post.sone.id|html>" />
+                                               <button type="submit" title="<%= View.Trust.Tooltip.Untrust|l10n|html>">↶</button>
+                                       </form>
+                                       <%/if>
+                               <%/if>
                        <%/if>
-                       <%if post.sone.current>
+                       <%if post.sone.local>
+                               <span class='separator'>·</span>
                                <form class="delete delete-post" action="deletePost.html" method="post">
                                        <input type="hidden" name="formPassword" value="<% formPassword|html>" />
                                        <input type="hidden" name="returnPage" value="<% request.uri|html>" />
                                </form>
                        <%/if>
                </div>
+               <div<%if post.loaded> class="hidden"<%/if>>
+                       <%= View.Post.NotDownloaded|l10n|html>
+               </div>
                <div class="replies">
                        <%foreach post.replies reply>
                                <%include include/viewReply.html>
                                                <input type="hidden" name="formPassword" value="<% formPassword|html>" />
                                                <input type="hidden" name="returnPage" value="<% request.uri|html>" />
                                                <input type="hidden" name="post" value="<% post.id|html>" />
-                                               <input type="text" class="reply-input" name="text" value="" />
+                                               <div class="sender">
+                                                       <select name="sender" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">
+                                                               <%foreach localSones localSone|sort>
+                                                                       <option value="<% localSone.id|html>"<%if localSone.current> selected="selected"<%/if>><% localSone.niceName|html></option>
+                                                               <%/foreach>
+                                                       </select>
+                                               </div>
+                                               <div class="select-sender"><button type="button" title="<%= View.UpdateStatus.Text.ChooseSenderIdentity|l10n|html>">+</button></div>
+                                               <textarea class="rip-out reply-input" name="text"></textarea>
                                                <button type="submit"><%= View.Post.SendReply|l10n|html></button>
                                        </form>
                                </div>