home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / MovePage.asp < prev    next >
Text File  |  2006-11-29  |  8KB  |  216 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.11
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page allows the user to move an existing page anywhere 
  7. '                      within the same survey.
  8. '
  9. '   COPYRIGHT NOTICE                                
  10. '
  11. '   See attached Software License Agreement
  12. '
  13. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  14. '***********************************************************************
  15. %>
  16. <!--#Include File="Include/Config_inc.asp"-->
  17. <!--#Include File="Include/Utility_inc.asp"-->
  18. <!--#Include File="Include/SurveyUtility_inc.asp"-->
  19. <!--#Include File="Include/adovbs_inc.asp"-->
  20. <!--#Include File="Include/CurrentUser_inc.asp"-->
  21. <!--#Include File="Include/Constants_inc.asp"-->
  22. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  23. <%
  24.     'If the user does not have "Create" or "Admin" permission, redirect them to the access denied page.
  25.     If lngUserSecurityLevel <> SUR_SECURITY_LEVEL_CREATE And lngUserSecurityLevel <> SUR_SECURITY_LEVEL_ADMIN Then
  26.         Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL
  27.     End If
  28.  
  29.     Dim rsPages
  30.     Dim rsOriginalPage
  31.     Dim strPage
  32.     Dim strSQL
  33.     Dim lngSurveyID
  34.     Dim lngPageNumber
  35.     Dim strSurveyTitle
  36.     Dim strPageTitle
  37.     Dim flgDisplayedItem
  38.     Dim lngLastPageNumber
  39.     
  40.     'Initialization 
  41.     Set rsPages = Server.CreateObject("ADODB.Recordset")
  42.     Set rsOriginalPage = Server.CreateObject("ADODB.Recordset")
  43.     lngSurveyID = Request.Form("SurveyID")
  44.     If Len(Request.Form("PageNumber")) = 0 Then
  45.         lngPageNumber = 1
  46.     Else
  47.         lngPageNumber = Request.Form("PageNumber")
  48.     End If
  49.     flgDisplayedItem = False
  50.     
  51.     'Get the name of the survey
  52.     strSQL = "SELECT title " & _
  53.              "FROM sur_survey " & _
  54.              "WHERE survey_id = " & lngSurveyID
  55.     rsOriginalPage.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
  56.     rsOriginalPage.MoveFirst
  57.     strSurveyTitle = rsOriginalPage("title")
  58.     rsOriginalPage.Close
  59.  
  60.     'Get the page title (if it exists)
  61.     strSQL = "SELECT page_title " & _
  62.              "FROM sur_page " & _
  63.              "WHERE survey_id = " & lngSurveyID & _
  64.              " AND page_number = " & lngPageNumber
  65.     rsOriginalPage.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
  66.     If rsOriginalPage.EOF = True Then
  67.         strPageTitle = "[No Page Title]"
  68.     Else
  69.         rsOriginalPage.MoveFirst
  70.         strPageTitle = rsOriginalPage("page_title")
  71.     End If
  72.     rsOriginalPage.Close
  73.     Set rsOriginalPage = Nothing
  74. %>
  75. <html>
  76. <head>
  77.     <title>Move Existing Page</title>
  78.     <link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
  79. </head>
  80.  
  81. <body class="MainBodyStyle">
  82.  
  83. <!--#Include File="Include/FrameworkTop_inc.asp"-->
  84.  
  85. <table border="0" cellspacing="0" cellpadding="0" width="754" class="MediumBlueBackgroundColor">
  86.     <tr>
  87.         <td height="36" valign="center">
  88.               <span class="H1HeadingStyle"><a name="skipnav" tabindex="1">Move Existing Page</a></span>
  89.         </td>
  90.     </tr>
  91. </table>
  92.  
  93. <!--#Include File="Include/FrameworkTop2_inc.asp"-->
  94.  
  95. <table width="740" border="0" cellpadding="0" cellspacing="6" class="LightGrayBackgroundColor">
  96.     <form name="frmMoveItem" method="post" action="MovePageAction.asp">
  97.         <input type="hidden" name="SurveyID" value="<%=lngSurveyID%>">
  98.         <input type="hidden" name="PageNumber" value="<%=Request.Form("PageNumber")%>">
  99.         <tr>
  100.             <td width="1" rowspan="2"></td>
  101.             <td width="738" align="left" valign="center" height="36" class="Normal">
  102.                 <span class="H2HeadingStyle">Select Page Destination</span>
  103.             </td>
  104.             <td width="1" rowspan="2"> </td>
  105.         </tr>
  106.         <tr>
  107.             <td valign="top" class="Normal" height="22">
  108.                 Move the selected page to a different location.  The selected page can be moved to any location in the survey.
  109.             </td>
  110.         </tr>
  111.     </table>
  112.     <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td height="1" background="Resources/Images/ThinDivider.gif"></td></tr>
  113.     <table border="0" cellpadding="0" cellspacing="6" width="740" class="WhiteBackgroundColor">
  114.         <tr>
  115.             <td height="8"></td>
  116.         </tr>
  117.         <tr>
  118.             <td width="1" rowspan="20"></td>
  119.             <td valign="top" width="200">
  120.                 <span class="NormalBold">Survey Name:</span>
  121.             </td>
  122.             <td align="left" valign="top" width="500">
  123.                 <span class="Normal">
  124.                     <%=strSurveyTitle%>
  125.                 </span>
  126.             </td>
  127.             <td width="1" rowspan="20"> </td>
  128.         </tr>
  129.         <tr>
  130.             <td valign="top">
  131.                 <span class="NormalBold">Page Number to Move:</span>
  132.             </td>
  133.             <td align="left" valign="top">
  134.                 <span class="Normal">
  135.                     <%=lngPageNumber%>
  136.                 </span>
  137.             </td>
  138.         </tr>
  139.         <tr>
  140.             <td valign="top">
  141.                 <span class="NormalBold">Page Title to Move:</span>
  142.             </td>
  143.             <td align="left" valign="top">
  144.                 <span class="Normal"><%=strPageTitle%><br></span>
  145.             </td>
  146.         </tr>
  147.         <tr>
  148.             <td valign="top">
  149.                 <span class="NormalBold"><label for="cboPageNumberBefore">Move Before Page:</label></span>
  150.             </td>
  151.             <td align="left" valign="top">
  152.                 <select name="cboPageNumberBefore" id="cboPageNumberBefore" style="width:500">
  153. <%
  154.                     'Create the SQL for creating the list of pages
  155.                     strSQL = "SELECT DISTINCT m.page_number, page_title " & _
  156.                              "FROM sur_survey_to_item_mapping m LEFT JOIN sur_page p " & _
  157.                              "ON m.page_number = p.page_number " & _
  158.                              "AND m.survey_id = p.survey_id " & _
  159.                              "WHERE m.survey_id = " & lngSurveyID & _
  160.                              " ORDER BY m.page_number"
  161.                     rsPages.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
  162.                     rsPages.MoveFirst
  163.                     Do While Not rsPages.EOF
  164.                         'Record the current page number so that, when finished looping, we have the last page number
  165.                         lngLastPageNumber = rsPages("page_number")
  166.                     
  167.                         'Do not display the page being moved in the list, or the page after it
  168.                         If CStr(lngPageNumber) <> CStr(rsPages("page_number")) And CStr(lngPageNumber + 1) <> CStr(rsPages("page_number")) Then
  169.                             'If there's no page title, display the page number with a "No Page Title" message.
  170.                             If Len(rsPages("page_title")) = 0 Or IsNull(rsPages("page_title")) = True Then
  171.                                 strPage = "Page " & rsPages("page_number") & " - [No Page Title]"
  172.                             Else
  173.                                 strPage = "Page " & rsPages("page_number") & " - " & rsPages("page_title")
  174.                             End If
  175. %>
  176.                             <option <% If CStr(rsPages("page_number")) = CStr(lngPageNumber) Then Response.Write "selected" End If %> value="<%=rsPages("page_number")%>"><%=strPage%></option>
  177. <%
  178.                         End If
  179.                         
  180.                         rsPages.MoveNext
  181.                     Loop
  182.                     
  183.                     'If the page to be moved is the last page in the survey, do not display the "move to end of survey" choice
  184.                     If CStr(lngLastPageNumber) <> CStr(lngPageNumber) Then
  185. %>
  186.                         <option value="<%=lngLastPageNumber + 1%>"><%=SUR_MOVE_PAGE_TO_END%></option>
  187. <%
  188.                     End If
  189.                     
  190.                     'Clean up 
  191.                     rsPages.Close
  192.                     Set rsPages = Nothing
  193. %>
  194.                 </select>
  195.             </td>
  196.         </tr>
  197.         <tr>
  198.             <td valign="center" align="right" colspan="2" height="38">
  199.                 <a href="ModifySurvey.asp?SurveyID=<%=lngSurveyID%>"><img border="0" alt="Cancel" src="Resources/Buttons/Cancel.gif" name="btnCancel"></a>
  200.                 <input type="image" border="0" alt="Move" src="Resources/Buttons/Move.gif" name="btnMove">
  201.                 <br>
  202.             </td>
  203.         </tr>
  204.     </form>
  205. </table>
  206.  
  207. <!--#Include File="Include/FrameworkBottom_inc.asp"-->
  208.  
  209. </body>
  210. </html>
  211.  
  212. <%        
  213.     'Ensure that the web server returns the page
  214.     Response.Flush
  215. %>
  216.