ASP Classic blog framework - BrainOrdure
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

139 lines
4.3KB

  1. <article class="card shadow-sm mb-4">
  2. <div class="card-body">
  3. <div class="mb-3">
  4. <a href="<%= PostsUrl() %>" class="small text-decoration-none">&larr; Back to posts</a>
  5. </div>
  6. <div class="magazine-label mb-3">Feature story</div>
  7. <h1 class="display-6 mb-2"><%= H(post.Title) %></h1>
  8. <%
  9. Dim publishedText
  10. publishedText = ""
  11. If IsDate(post.PublishedDate) Then
  12. If CDate(post.PublishedDate) > #1/1/1970# Then
  13. publishedText = FormatDateTime(post.PublishedDate, vbLongDate)
  14. End If
  15. End If
  16. If Len(publishedText) > 0 Then
  17. %>
  18. <p class="article-meta"><%= H(publishedText) %></p>
  19. <%
  20. End If
  21. Dim postBody
  22. postBody = RenderPostBody(post.Body)
  23. %>
  24. <div class="prose fs-5 lh-lg feature-dropcap"><%= postBody %></div>
  25. </div>
  26. </article>
  27. <!-- Comments -->
  28. <section class="mt-2">
  29. <%
  30. Dim commentsCount, commentsLoadFailed
  31. commentsCount = 0
  32. commentsLoadFailed = False
  33. On Error Resume Next
  34. If IsObject(comments) Then commentsCount = comments.Count
  35. If Err.Number <> 0 Then
  36. commentsLoadFailed = True
  37. commentsCount = 0
  38. Err.Clear
  39. End If
  40. On Error GoTo 0
  41. %>
  42. <h2 class="page-title h4 mb-3">Comments (<%= commentsCount %>)</h2>
  43. <% If commentsLoadFailed Then %>
  44. <div class="alert alert-warning mb-4">Comments are temporarily unavailable.</div>
  45. <% ElseIf commentsCount = 0 Then %>
  46. <p class="text-muted mb-4">No comments yet. Be the first to leave one below.</p>
  47. <% Else %>
  48. <%
  49. Dim commentIter, commentItem
  50. Dim commentsIterFailed
  51. commentsIterFailed = False
  52. On Error Resume Next
  53. Set commentIter = comments.Iterator()
  54. If Err.Number <> 0 Then
  55. commentsIterFailed = True
  56. Err.Clear
  57. End If
  58. Do While Not commentsIterFailed And commentIter.HasNext
  59. Set commentItem = commentIter.GetNext()
  60. If Err.Number <> 0 Then
  61. commentsIterFailed = True
  62. Err.Clear
  63. Exit Do
  64. End If
  65. Dim commentDateText
  66. commentDateText = ""
  67. If IsDate(commentItem.CreatedDate) Then
  68. commentDateText = FormatDateTime(commentItem.CreatedDate, vbLongDate)
  69. End If
  70. %>
  71. <div class="card shadow-sm mb-3 comment-card">
  72. <div class="card-body">
  73. <div class="d-flex justify-content-between mb-2">
  74. <strong class="small"><%= H(commentItem.AuthorName) %></strong>
  75. <span class="small text-muted"><%= H(commentDateText) %></span>
  76. </div>
  77. <%
  78. Dim commentBody
  79. commentBody = H(commentItem.Body)
  80. commentBody = Replace(commentBody, vbCrLf, "<br>")
  81. commentBody = Replace(commentBody, vbCr, "<br>")
  82. commentBody = Replace(commentBody, vbLf, "<br>")
  83. %>
  84. <p class="mb-0"><%= commentBody %></p>
  85. </div>
  86. </div>
  87. <%
  88. Loop
  89. If Err.Number <> 0 Then
  90. commentsIterFailed = True
  91. Err.Clear
  92. End If
  93. On Error GoTo 0
  94. If commentsIterFailed Then
  95. %>
  96. <div class="alert alert-warning mb-4">Some comments could not be displayed.</div>
  97. <%
  98. End If
  99. %>
  100. <% End If %>
  101. <!-- Comment form -->
  102. <div class="card shadow-sm mt-4">
  103. <div class="card-body">
  104. <h3 class="h5 mb-3">Leave a Comment</h3>
  105. <form method="post" action="<%= CommentsUrl() %>">
  106. <input type="hidden" name="PostID" value="<%= H(post.PostID) %>">
  107. <input type="hidden" name="PostSlug" value="<%= H(post.Slug) %>">
  108. <div class="mb-3">
  109. <label class="form-label" for="AuthorName">Name <span class="text-danger">*</span></label>
  110. <input class="form-control" type="text" id="AuthorName" name="AuthorName" required>
  111. </div>
  112. <div class="mb-3">
  113. <label class="form-label" for="AuthorEmail">Email <span class="text-muted small">(optional, not displayed)</span></label>
  114. <input class="form-control" type="email" id="AuthorEmail" name="AuthorEmail">
  115. </div>
  116. <div class="mb-3">
  117. <label class="form-label" for="Body">Comment <span class="text-danger">*</span></label>
  118. <textarea class="form-control" id="Body" name="Body" rows="4" required></textarea>
  119. </div>
  120. <button class="btn btn-primary" type="submit">Submit Comment</button>
  121. <p class="small text-muted mt-2 mb-0">Comments are reviewed before appearing.</p>
  122. </form>
  123. </div>
  124. </div>
  125. </section>

Powered by TurnKey Linux.