<% Dim objRs Dim strDeleteURL Dim strbgcol Dim strSearch Dim astrSearch Dim astrCategories Dim intCategories Dim astrContributors Dim intContributors Dim intCat Dim intCont Dim strSql_Temp Dim strCategoryName Dim intArticles, astrArticles Dim bolAllArticles bolAllArticles = SecurePage("UpdatesAllArticles") intCat = Request("lstCat") intCont = Request("lstCont") If len(intCat & "") = 0 then intCat = 0 If len(intCont & "") = 0 then intCont = 0 If intCat = "*" then 'do nothing Else intCat = CInt(intCat) End If intCont = CInt(intCont) strSearch = Request("txtSearch") Session("lstCat") = intCat Session("lstCont") = intCont Session("srt") = Request("srt") Session("stp") = Request("stp") Session("txtSearch") = strSearch Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open strDSN 'If len(Session("FullName") & "") = 0 then Response.Redirect "default.asp?serr=tout" strSql = "SELECT artId, artTitle, artDate, autName, artActive FROM tblArticles LEFT JOIN tblAuthors ON (tblArticles.artautId = tblAuthors.autId)" If len(strSearch & "") > 0 then strSearch = Replace(strSearch, " ", " ") astrSearch = Split(strSearch, " ") For intCount = 0 to UBound(astrSearch) If intCount = 0 then strSql = strSql & " WHERE (" Else strSql = strSql & " OR " End If astrSearch(intCount) = Replace(astrSearch(intCount), "'", "''") strSql = strSql & " artTitle LIKE '%" & astrSearch(intCount) & "%' OR autName LIKE '%" & astrSearch(intCount) & "%' OR artStory LIKE '%" & astrSearch(intCount) & "%'" Next strSql = strSql & ")" End If strCategoryName = "" If intCat & "" <> "0" then If intCat = "*" then If instr(1, strSql, "WHERE") > 0 then strSql = strSql & " AND (artId NOT IN (SELECT arcartId FROM tblArticleCategories))" Else strSql = strSql & " WHERE (artId NOT IN (SELECT arcartId FROM tblArticleCategories))" End If Else strSql_Temp = "SELECT catName FROM tblCategories WHERE catId = " & intCat strCategoryName = objConn.Execute(strSql_Temp)(0) If instr(1, strSql, "WHERE") > 0 then strSql = strSql & " AND " Else strSql = strSql & " WHERE " End If strSql = strSql & "(artId IN (SELECT arcartId FROM tblArticleCategories WHERE arccatId = " & intCat & " OR arccatId IN (SELECT catChild FROM qryCategoriesP WHERE catId = " & intCat & ") OR arccatId IN (SELECT catGrandChild FROM qryCategoriesP WHERE catId = " & intCat & ") OR arccatId IN (SELECT catGGrandChild FROM qryCategoriesP WHERE catId = " & intCat & ") OR arccatId IN (SELECT catGGGrandChild FROM qryCategoriesP WHERE catId = " & intCat & ")))" End If End If If Not bolAllArticles then If Instr(1, strSql, "WHERE") > 0 then strSql = strSql & " AND " Else strSql = strSql & " WHERE " End If strSql = strSql & "artId IN (SELECT arcartId FROM tblArticleCategories WHERE arccatId IN (SELECT grccatID FROM tblGroupCategories WHERE grcgrpId = " & Session("grpId") & "))" End If Select Case Request("srt") & "" Case "1" strSql = strSql & " ORDER by artTitle, artDate DESC" Case "2" strSql = strSql & " ORDER by artDate DESC" Case "3" strSql = strSql & " ORDER by autName, artDate DESC" Case Else strSql = strSql & " ORDER by artDate DESC" End Select Set objRs = Server.CreateObject("ADODB.Recordset") objRs.Open strSql, objConn, 1, 1 intArticles = objRs.RecordCount If intArticles > 0 then astrArticles = objRs.GetRows objRs.Close strSql = "SELECT catId, catName FROM tblCategories WHERE catParent = 0 AND catTextID <> 'search'" If Not bolAllArticles then strSql = strSql & " AND catId IN (SELECT grccatID FROM tblGroupCategories WHERE grcgrpId = " & Session("grpId") & ")" strSql = strSql & " ORDER by catOrder" objRs.Open strSql, objConn, 1, 1 intCategories = objRs.RecordCount If intCategories > 0 then astrCategories = objRs.GetRows objRs.Close strSql = "SELECT autId, autName FROM tblAuthors ORDER by autName" objRs.Open strSql, objConn, 1, 1 intContributors = objRs.RecordCount If intContributors > 0 then astrContributors = objRs.GetRows objRs.Close Set objRs = Nothing objConn.Close Set objConn = Nothing 'Paging Dim intstp Dim intPageSize Dim intPageStart Dim intPageEnd intPageSize = 20 intstp = Request("stp") If len(intstp & "") = 0 then intstp = 0 If Not IsNumeric(intstp & "") then intstp = 0 intstp = CInt(intstp) intPageStart = intPageSize * CInt(intstp) If intPageStart > intArticles then intPageStart = 0 IntPageEnd = intPageStart + intPageSize If intPageEnd > intArticles then intPageEnd = intArticles Sub GeneratePagingLinks() Dim intTotalPages Dim intPageFrom Dim intPageTo Dim intPagesShown Dim intLinkPageStart intPagesShown = 15 intPageFrom = intstp intTotalPages = CInt(intArticles / intPageSize) If intArticles/ intPageSize < intTotalPages then intTotalPages = intTotalPages - 1 intPageTo = intstp + intPagesShown If intPageTo > intTotalPages then intPageTo = intTotalPages intPageFrom = intPageTo - intPagesShown If intPageFrom < 0 then intPageFrom = 0 End If If intPageFrom > 0 then Response.Write "< FIRST | " intLinkPageStart = intPageFrom - intPagesShown If intLinkPageStart < 0 then intLinkPageStart = 0 Response.Write "< ..RWND. | " End If For intCount = intPageFrom to intPageTo If intStp = intCount then Response.Write intCount + 1 & " | " Else Response.Write "" & intCount + 1 & " | " End If Next If intPageTo < intTotalPages then intLinkPageStart = intPageTo + intPagesShown If intLinkPageStart > intTotalPages then intLinkPageStart = intTotalPages Response.Write " .FFWD.. > | " Response.Write " LAST > | " End If End Sub %>
 
Content Management System
<%= WebsiteName %> 
<%= Session("FullName") %> logged in. [ <%= FormatDateTime(Now(), vbLongDate) %>] SEARCH: " size="20"> | | |
<% If len(strCategoryName & "") then %>

ADD ARTICLE TO '<%= strCategoryName %>'

<% End If If intArticles = 0 then Response.Write "
There are no articles currently listed" If len(strSearch & "") > 0 then Response.Write " with the search criteria '" & strSearch & "'." Response.Write "." Else Response.Write "

There are " & intArticles & " articles currently listed" If len(strSearch & "") > 0 then Response.Write " with the search criteria '" & strSearch & "'" Response.Write "." %>
<% strbgcol = "" For intCount = intPageStart to intPageEnd - 1 if intCount mod 2 = 0 then strbgcol = "class='darktext'" else strbgcol = "class='lightbluebgonly'" end if strDeleteURL = "DeleteRecord.asp?fldId=" & astrArticles(0, intCount) & "&fldnm=artId&tblnm=tblArticles&recnm=" & astrArticles(1, intCount) %> id="artrows"> <% Next %>

article manager

# TITLE DATE CONTRIBUTOR  
<%= intCount + 1 %>.  <%= astrArticles(1, intCount) %>  <% If Not astrArticles(4, intCount) then Response.Write "[not active]" %> <%= astrArticles(2, intCount) %>  <%= astrArticles(3, intCount) %> 

PREVIEW | EDIT | DELETE

<% If intArticles > intPageSize then %> Pages: <% GeneratePagingLinks() %> <% End If %>
<% End If %>