| [5] | 1 | <cfsetting enablecfoutputonly=true> |
|---|
| 2 | <!--- |
|---|
| 3 | Name : threads.cfm |
|---|
| 4 | Author : Raymond Camden |
|---|
| 5 | Created : June 10, 2004 |
|---|
| 6 | Last Updated : August 4, 2006 |
|---|
| 7 | History : Support for uuid (rkc 1/27/05) |
|---|
| 8 | Fixed code that gets # of pages (rkc 4/8/05) |
|---|
| 9 | Stupid typo (rkc 4/11/05) |
|---|
| 10 | Removed mappings, sticky (rkc 8/27/05) |
|---|
| 11 | sorting, page fix, link to last (rkc 9/15/05) |
|---|
| 12 | show last user (rkc 7/12/06) |
|---|
| 13 | fix title (rkc 8/4/06) |
|---|
| 14 | Purpose : Displays threads for a forum |
|---|
| 15 | ---> |
|---|
| 16 | |
|---|
| 17 | <cfif not isDefined("url.forumid") or not len(url.forumid)> |
|---|
| 18 | <cflocation url="index.cfm" addToken="false"> |
|---|
| 19 | </cfif> |
|---|
| 20 | |
|---|
| 21 | <!--- get parents ---> |
|---|
| 22 | <cftry> |
|---|
| 23 | <cfset request.forum = application.galleon.forum.getForum(url.forumid)> |
|---|
| 24 | <cfset request.conference = application.galleon.conference.getConference(request.forum.conferenceidfk)> |
|---|
| 25 | <cfcatch> |
|---|
| 26 | <cflocation url="index.cfm" addToken="false"> |
|---|
| 27 | </cfcatch> |
|---|
| 28 | </cftry> |
|---|
| 29 | |
|---|
| 30 | <!--- get my threads ---> |
|---|
| 31 | <cfset data = application.galleon.thread.getThreads(forumid=url.forumid)> |
|---|
| 32 | |
|---|
| 33 | <!--- sort ---> |
|---|
| 34 | <cfset data = request.udf.querySort(data,url.sort,url.sortdir)> |
|---|
| 35 | |
|---|
| 36 | <!--- Loads header ---> |
|---|
| 37 | <cfmodule template="tags/layout.cfm" templatename="main" title="#application.galleon.settings.title# : #request.conference.name# : #request.forum.name#"> |
|---|
| 38 | |
|---|
| 39 | <!--- determine max pages ---> |
|---|
| 40 | <cfif data.recordCount and data.recordCount gt application.galleon.settings.perpage> |
|---|
| 41 | <cfset pages = ceiling(data.recordCount / application.galleon.settings.perpage)> |
|---|
| 42 | <cfelse> |
|---|
| 43 | <cfset pages = 1> |
|---|
| 44 | </cfif> |
|---|
| 45 | |
|---|
| 46 | <!--- Displays pagination on right side, plus left side buttons for threads ---> |
|---|
| 47 | <cfmodule template="tags/pagination.cfm" pages="#pages#" mode="threads" /> |
|---|
| 48 | |
|---|
| 49 | <!--- Now display the table. This changes based on what our data is. ---> |
|---|
| 50 | <cfoutput> |
|---|
| 51 | <p> |
|---|
| 52 | <table width="100%" cellpadding="6" class="tableDisplay" cellspacing="1" border="0"> |
|---|
| 53 | <tr class="tableHeader"> |
|---|
| 54 | <td colspan="5" class="tableHeader">Forum: #request.forum.name#</td> |
|---|
| 55 | </tr> |
|---|
| 56 | <tr class="tableSubHeader"> |
|---|
| 57 | <td class="tableSubHeader">#request.udf.headerLink("Thread","name")#</td> |
|---|
| 58 | <td class="tableSubHeader">#request.udf.headerLink("Originator","username")#</td> |
|---|
| 59 | <td class="tableSubHeader">#request.udf.headerLink("Replies","messagecount")#</td> |
|---|
| 60 | <td class="tableSubHeader">#request.udf.headerLink("Last Post","lastpost")#</td> |
|---|
| 61 | <td class="tableSubHeader">#request.udf.headerLink("Read Only","readonly")#</td> |
|---|
| 62 | </tr> |
|---|
| 63 | <cfif data.recordCount> |
|---|
| 64 | <cfloop query="data" startrow="#(url.page-1)*application.galleon.settings.perpage+1#" endrow="#(url.page-1)*application.galleon.settings.perpage+application.galleon.settings.perpage#"> |
|---|
| 65 | <!--- |
|---|
| 66 | I add this because it is possible for a thread to have 0 posts. |
|---|
| 67 | ---> |
|---|
| 68 | <cfset mcount = max(0, messagecount-1)> |
|---|
| 69 | <tr class="tableRow#currentRow mod 2#"> |
|---|
| 70 | <td><cfif isBoolean(sticky) and sticky><b>[Sticky]</b></cfif> <a href="messages.cfm?threadid=#id#">#name#</a></td> |
|---|
| 71 | <td>#username#</td> |
|---|
| 72 | <td>#mcount#</td> |
|---|
| 73 | <td> |
|---|
| 74 | <cfif len(lastuseridfk)> |
|---|
| 75 | <cfset uinfo = cachedUserInfo(username=lastuseridfk,userid=true)> |
|---|
| 76 | <a href="messages.cfm?threadid=#id###last">#dateFormat(lastpost,"m/d/yy")# #timeFormat(lastpost,"h:mm tt")#</a> by #uinfo.username# |
|---|
| 77 | <cfelse> </cfif> |
|---|
| 78 | </td> |
|---|
| 79 | <td>#yesNoFormat(readonly)#</td> |
|---|
| 80 | </tr> |
|---|
| 81 | </cfloop> |
|---|
| 82 | <cfelse> |
|---|
| 83 | <tr class="tableRow1"> |
|---|
| 84 | <td colspan="5">Sorry, but there are no threads available for this forum.</td> |
|---|
| 85 | </tr> |
|---|
| 86 | </cfif> |
|---|
| 87 | </table> |
|---|
| 88 | </p> |
|---|
| 89 | </cfoutput> |
|---|
| 90 | |
|---|
| 91 | </cfmodule> |
|---|
| 92 | |
|---|
| 93 | <cfsetting enablecfoutputonly=false> |
|---|