<%OPTION EXPLICIT%> <% If Session("loggedin") <> "1" Then Response.Redirect("photo_login.asp") End If Dim teaser_id : teaser_id = Request("id") If teaser_id <> "" Then Dim dir : dir = Request("d") Dim sortby : sortby = Request("num") If dir = "delete" Then Remove teaser_id, sortby Else Reorder teaser_id, sortby, dir End If End If %> Empire Entertainment Incorporated
 
  Photos
 
     
 
 
<% GetTeasers %>

Add New
   
   
   
 
 


 
     
© 2008 Empire Entertainment, Inc. | Disclaimer

 

 

<% Function GetTeasers() Dim tableStr tableStr = "" Dim oConn, oCmd, oRs, strSQL, iRecordCount Set oConn = Session("oConn") strSQL = "SELECT teaser_id, teaser_title, teaser_img, teaser_sortby " strSQL = strSQL & "FROM teasers" strSQL = strSQL & " ORDER BY teaser_sortby" Set oRs = Server.CreateObject("ADODB.Recordset") oRs.CursorLocation = adUseClient oRs.Open strSql, oConn, adOpenDynamic Response.Write "" With oRs Do While Not .EOF Response.Write "" With .Fields Response.Write "" Response.Write "" ' last column includes arrows for reordering Response.Write "" Response.Write "" End With .MoveNext Response.Write "" Loop .Close End With tableStr = tableStr & "
Title (Click to edit)ThumbnailOrder
" & .Item("teaser_title") & "" Response.Write .Item("teaser_sortby") If .Item("teaser_sortby") > 1 Then Response.Write " " End If If .Item("teaser_sortby") < oRs.RecordCount Then Response.Write " " End If Response.Write "
" Response.Write tableStr End Function Function Reorder(id, num, dir) ' swap current "record" with one below/above by modifying their sortby values Dim oConn, oCmd, strSQL Dim alt_num : alt_num = num If dir = "up" Then num = num - 1 Else num = num + 1 End If Set oConn = Session("oConn") Set oCmd = Server.CreateObject("ADODB.Command") Set oCmd.ActiveConnection = oConn strSQL = "UPDATE teasers SET teaser_sortby=" & CLng(alt_num) & " WHERE teaser_sortby=" & CLng(num) oCmd.CommandText = strSQL oCmd.Execute strSQL = "UPDATE teasers SET teaser_sortby=" & CLng(num) & " WHERE teaser_id=" & CLng(id) oCmd.CommandText = strSQL oCmd.Execute End Function Function Remove(id, sortby) ' swap current "record" with one below/above by modifying their sortby values Dim oConn, oCmd, strSQL Set oConn = Session("oConn") Set oCmd = Server.CreateObject("ADODB.Command") Set oCmd.ActiveConnection = oConn strSQL = "DELETE FROM teasers WHERE teaser_id=" & CLng(id) oCmd.CommandText = strSQL oCmd.Execute strSQL = "UPDATE teasers SET teaser_sortby=teaser_sortby-1 WHERE teaser_sortby > " & sortby oCmd.CommandText = strSQL oCmd.Execute End Function %>