| 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <!--- |
|---|
| 3 | Name : messages.cfm |
|---|
| 4 | Author : Raymond Camden |
|---|
| 5 | Created : June 10, 2004 |
|---|
| 6 | Last Updated : November 6, 2006 |
|---|
| 7 | History : Support for UUID (rkc 1/27/05) |
|---|
| 8 | Update to allow posting here (rkc 3/31/05) |
|---|
| 9 | Fixed code that gets # of pages (rkc 4/8/05) |
|---|
| 10 | Hide the darn error msg if errors is blank, links to messages (rkc 7/15/05) |
|---|
| 11 | Form posts so that if error, you go back down to form. If no error, you cflocate to top (rkc 7/29/05) |
|---|
| 12 | Have subscribe option (rkc 7/29/05) |
|---|
| 13 | Refresh user cache on post, change links a bit (rkc 8/3/05) |
|---|
| 14 | Fix typo (rkc 8/9/05) |
|---|
| 15 | Fix pages. Add anchor for last post (rkc 9/15/05) |
|---|
| 16 | It's possible form.title and form.body may not exist and my code didn't handle it (rkc 10/7/05) |
|---|
| 17 | IE cflocation bug fix, ensure logged on before posting (rkc 10/10/05) |
|---|
| 18 | Simple size change (rkc 7/27/06) |
|---|
| 19 | gravatar, sig, attachments (rkc 11/3/06) |
|---|
| 20 | bug when no attachment (rkc 11/6/06) |
|---|
| 21 | Purpose : Displays messages for a thread |
|---|
| 22 | ---> |
|---|
| 23 | |
|---|
| 24 | <!--- Get References ---> |
|---|
| 25 | |
|---|
| 26 | <cfset data = Event.getValue("data")> |
|---|
| 27 | <!--- Displays pagination on right side, plus left side buttons for threads ---> |
|---|
| 28 | <cfmodule template="../tags/pagination.cfm" pages="#Event.getValue("pages")#" mode="messages" /> |
|---|
| 29 | |
|---|
| 30 | <!--- Now display the table. This changes based on what our data is. ---> |
|---|
| 31 | <cfoutput> |
|---|
| 32 | <a name="top" /> |
|---|
| 33 | <p> |
|---|
| 34 | <cfif not getPlugin("messagebox").isEmpty()> |
|---|
| 35 | <h3>Please scroll down to correct your error(s):</h3> |
|---|
| 36 | #getPlugin("messagebox").renderit(false)#<br> |
|---|
| 37 | </cfif> |
|---|
| 38 | |
|---|
| 39 | <table width="100%" cellpadding="6" class="tableDisplay" cellspacing="1" border="0"> |
|---|
| 40 | <tr class="tableHeader"> |
|---|
| 41 | <td colspan="2" class="tableHeader">Thread: #request.thread.name#</td> |
|---|
| 42 | </tr> |
|---|
| 43 | |
|---|
| 44 | <tr class="tableSubHeader"> |
|---|
| 45 | <td class="tableSubHeader" colspan="2"> |
|---|
| 46 | <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
|---|
| 47 | <tr> |
|---|
| 48 | <td><b>Created on:</b> #dateFormat(request.thread.dateCreated,"mm/dd/yy")# #timeFormat(request.thread.dateCreated,"hh:mm tt")#</td> |
|---|
| 49 | <td align="right"><b>Replies:</b> #max(0,data.recordCount-1)#</td> |
|---|
| 50 | </tr> |
|---|
| 51 | </table> |
|---|
| 52 | </td> |
|---|
| 53 | </tr> |
|---|
| 54 | |
|---|
| 55 | <cfif data.recordCount> |
|---|
| 56 | <cfloop query="data" startrow="#(rc.page-1)*application.settings.perpage+1#" endrow="#(rc.page-1)*application.settings.perpage+application.settings.perpage#"> |
|---|
| 57 | <cfset uinfo = cachedUserInfo(username)> |
|---|
| 58 | <tr class="tableRow#currentRow mod 2#" valign="top"> |
|---|
| 59 | <td width="170" class="tableMessageCell" rowspan="2"><b>#username#</b><br> |
|---|
| 60 | #uInfo.rank#<br> |
|---|
| 61 | <cfif application.settings.allowgravatars> |
|---|
| 62 | <img src="http://www.gravatar.com/avatar.php?gravatar_id=#hash(uinfo.emailaddress)#&rating=PG&size=80&default=#application.settings.rooturl#/images/gravatar.gif" alt="#username#'s Gravatar" border="0"> |
|---|
| 63 | </cfif> |
|---|
| 64 | <br> |
|---|
| 65 | <b>Joined:</b> #dateFormat(uInfo.dateCreated,"mm/dd/yy")#<br> |
|---|
| 66 | <b>Posts:</b> #uInfo.postcount#</td> |
|---|
| 67 | <td class="tableMessageCellRight"> |
|---|
| 68 | <a name="#currentRow#"></a> |
|---|
| 69 | <cfif currentRow is recordCount><a name="last"></a></cfif> |
|---|
| 70 | <b>#title#</b><br> |
|---|
| 71 | #dateFormat(posted,"mm/dd/yy")# #timeFormat(posted,"h:mm tt")#<br> |
|---|
| 72 | <cfif len(attachment)>Attachment: <a href="index.cfm?event=#Event.getValue("xehAttachment")#&id=#id#">#attachment#</a><br></cfif> |
|---|
| 73 | <br> |
|---|
| 74 | <!--- |
|---|
| 75 | #paragraphFormat2(activateURL(body))# |
|---|
| 76 | ---> |
|---|
| 77 | #application.message.render(body)# |
|---|
| 78 | |
|---|
| 79 | <cfif len(uinfo.signature)><div class="signature">#uinfo.signature#</div></cfif> |
|---|
| 80 | |
|---|
| 81 | <cfif isLoggedOn() and application.utils.isUserInAnyRole("forumsadmin,forumsmoderator")> |
|---|
| 82 | <p align="right"><a href="index.cfm?event=#Event.getValue("xehMessageEdit")#&id=#id#">[Edit Post]</a></p> |
|---|
| 83 | </cfif> |
|---|
| 84 | </td> |
|---|
| 85 | </tr> |
|---|
| 86 | <tr> |
|---|
| 87 | <td class="tableMessageCellRight" align="right"> |
|---|
| 88 | <cfif isBoolean(cgi.server_port_secure) and cgi.server_port_secure> |
|---|
| 89 | <cfset pre = "https"> |
|---|
| 90 | <cfelse> |
|---|
| 91 | <cfset pre = "http"> |
|---|
| 92 | </cfif> |
|---|
| 93 | <cfset link = "#pre#://#cgi.server_name##cgi.script_name#?#cgi.query_string####currentrow#"> |
|---|
| 94 | <span class="linktext"><a href="#link#">Link</a> | <a href="##top">Top</a> | <a href="##bottom">Bottom</a></span> |
|---|
| 95 | </td> |
|---|
| 96 | </tr> |
|---|
| 97 | </cfloop> |
|---|
| 98 | <cfelse> |
|---|
| 99 | <tr class="tableRow1"> |
|---|
| 100 | <td colspan="2">Sorry, but there are no messages available for this thread.</td> |
|---|
| 101 | </tr> |
|---|
| 102 | </cfif> |
|---|
| 103 | </table> |
|---|
| 104 | </p> |
|---|
| 105 | <a name="bottom" /> |
|---|
| 106 | </cfoutput> |
|---|
| 107 | |
|---|
| 108 | <cfoutput> |
|---|
| 109 | <a name="newpost" /> |
|---|
| 110 | <p> |
|---|
| 111 | <table width="100%" cellpadding="6" class="tableDisplay" cellspacing="1" border="0"> |
|---|
| 112 | <tr class="tableHeader"> |
|---|
| 113 | <td class="tableHeader">New Post</td> |
|---|
| 114 | </tr> |
|---|
| 115 | <cfif Event.valueExists("posterrors") or not getPlugin("messagebox").isEmpty()> |
|---|
| 116 | <tr class="tableRowMain"> |
|---|
| 117 | <td> |
|---|
| 118 | #getPlugin("messagebox").renderit()# |
|---|
| 119 | </td> |
|---|
| 120 | </tr> |
|---|
| 121 | </cfif> |
|---|
| 122 | <tr class="tableRowMain"> |
|---|
| 123 | <td> |
|---|
| 124 | <form action="#cgi.script_name#?##newpost" method="post" enctype="multipart/form-data"> |
|---|
| 125 | <input type="hidden" name="event" value="#Event.getValue("xehMessagePost")#"> |
|---|
| 126 | <input type="hidden" name="threadid" value="#Event.getValue("threadid")#"> |
|---|
| 127 | <table> |
|---|
| 128 | <cfif not isLoggedOn()> |
|---|
| 129 | <cfset thisPage = cgi.script_name & "?" & cgi.query_string & "&##newpost"> |
|---|
| 130 | <cfset link = "index.cfm?event=#Event.getValue("xehLogin")#&ref=#urlEncodedFormat(thisPage)#"> |
|---|
| 131 | |
|---|
| 132 | <tr> |
|---|
| 133 | <td>Please <a href="#link#">login</a> to post a response.</td> |
|---|
| 134 | </tr> |
|---|
| 135 | <cfelseif application.utils.isUserInAnyRole("forumsadmin,forumsmoderator") or not Event.getValue("readonly")> |
|---|
| 136 | <tr> |
|---|
| 137 | <td><b>Title: </b></td> |
|---|
| 138 | <td><input type="text" name="post_title" value="#Event.getValue("post_title")#" class="formBox"></td> |
|---|
| 139 | </tr> |
|---|
| 140 | <tr> |
|---|
| 141 | <td colspan="2"><b>Body: </b><br> |
|---|
| 142 | <p> |
|---|
| 143 | #application.message.renderHelp()# |
|---|
| 144 | </p> |
|---|
| 145 | <textarea name="body" cols="50" rows="20">#Event.getValue("body")#</textarea></td> |
|---|
| 146 | </tr> |
|---|
| 147 | <tr> |
|---|
| 148 | <td><b>Subscribe to Thread: </b></td> |
|---|
| 149 | <td><select name="subscribe"> |
|---|
| 150 | <option value="true" <cfif Event.getValue("subscribe")>selected</cfif>>Yes</option> |
|---|
| 151 | <option value="false" <cfif not Event.getValue("subscribe")>selected</cfif>>No</option> |
|---|
| 152 | </select></td> |
|---|
| 153 | </tr> |
|---|
| 154 | <cfif isBoolean(request.forum.attachments) and request.forum.attachments> |
|---|
| 155 | <tr> |
|---|
| 156 | <td><b>Attach File:</b></td> |
|---|
| 157 | <td> |
|---|
| 158 | <input type="file" name="attachment"> |
|---|
| 159 | <cfif len(rc.oldattachment)> |
|---|
| 160 | <input type="hidden" name="oldattachment" value="#rc.oldattachment#"> |
|---|
| 161 | <input type="hidden" name="filename" value="#rc.filename#"> |
|---|
| 162 | <br> |
|---|
| 163 | File already attached: #rc.oldattachment# |
|---|
| 164 | </cfif> |
|---|
| 165 | </td> |
|---|
| 166 | </tr> |
|---|
| 167 | </cfif> |
|---|
| 168 | <tr> |
|---|
| 169 | <td> </td> |
|---|
| 170 | <td align="right"><cfif not isDefined("request.thread")><input type="image" src="images/btn_new_topic.gif" alt="New Topic" title="New Topic" width="71" height="19" name="post"><cfelse><input type="image" src="images/btn_reply.gif" alt="Reply" title="Reply" width="52" height="19" name="post"></cfif></td> |
|---|
| 171 | </tr> |
|---|
| 172 | <cfelse> |
|---|
| 173 | <tr> |
|---|
| 174 | <td><b>Sorry, but this area is readonly.</b></td> |
|---|
| 175 | </tr> |
|---|
| 176 | </cfif> |
|---|
| 177 | </table> |
|---|
| 178 | </form> |
|---|
| 179 | </td> |
|---|
| 180 | </tr> |
|---|
| 181 | </table> |
|---|
| 182 | </p> |
|---|
| 183 | </cfoutput> |
|---|
| 184 | |
|---|
| 185 | <cfsetting enablecfoutputonly=false> |
|---|