home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / ReportShareList.asp < prev    next >
Text File  |  2006-11-29  |  10KB  |  257 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 displays a list of all results sharing assignments.  This 
  7. '                      functionality is only available to admins and owners of the 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/Constants_inc.asp"-->
  17. <!--#Include File="Include/SurveyUtility_inc.asp"-->
  18. <!--#Include File="Include/Utility_inc.asp"-->
  19. <!--#Include File="Include/CurrentUser_inc.asp"-->
  20. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  21. <!--#Include File="Include/Config_inc.asp"-->
  22. <!--#Include File="Include/adovbs_inc.asp"-->
  23. <%
  24.     Dim strPageTitle
  25.     Dim strSurveyName
  26.     Dim lngSurveyID
  27.     Dim rsReportSharingStatus
  28.     Dim strSQL
  29.     Dim strTableRowColor
  30.             
  31.     'Initialization
  32.     lngSurveyID = Request.QueryString("SurveyID")
  33.     strSurveyName = Request.QueryString("SurveyName")
  34.     strPageTitle = "Results Sharing"
  35.     Set rsReportSharingStatus = Server.CreateObject("ADODB.Recordset")
  36.     
  37.     'If the user does not either own this survey or have admin permission, deny them access to this functionality.
  38.     If IsUserOwnerOrAdmin(lngSurveyID) = False Then
  39.         Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_OWNER_FOR_RESULTS_SHARING
  40.     End If
  41.  
  42.     'Initialize the row color
  43.     strTableRowColor = "TableRowLightColor"
  44. %>
  45. <html>
  46. <head>
  47.     <title><%=strPageTitle%></title>    
  48.     <link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
  49. </head>
  50. <script language="JavaScript">
  51. function deleteReportShare(lngReportShareID)
  52. {
  53.     if (confirm("Are you sure you want to delete this report share?") == true) //OK
  54.     {
  55.         window.location.href = 'DeleteReportShare.asp?ReportShareID=' + lngReportShareID + '&SurveyID=<%=lngSurveyID%>';
  56.     }
  57. }
  58. </script>
  59. <body class="MainBodyStyle">
  60.  
  61. <!--#Include File="Include/FrameworkTop_inc.asp"-->
  62.  
  63. <table border="0" cellspacing="0" cellpadding="0" width="754" class="MediumBlueBackgroundColor">
  64.     <tr>
  65.         <td height="36" width="250" valign="center">
  66.               <span class="H1HeadingStyle"><a name="skipnav" tabindex="1"><%=strPageTitle%></a></span> <img style="cursor:hand" alt="Help" onClick="javascript:window.open('Help/Help.htm#ResultsSharing', null, 'menubar=no,toolbar=no,titlebar=no,status=no,left=10,top=10,scrollbars=yes,resizable=yes,height=550,width=770');" border="0" src="Resources/Images/Help.gif">
  67.         </td>
  68.         <td align="right" valign="middle">
  69.             <a href="ResultsOverview.asp?SurveyID=<%=lngSurveyID%>&DisplayHeader=Yes"><img border="0" alt="Return to the results overview report" name="btnResultsOverview" src="Resources/Buttons/ResultsOverview.gif"></a>
  70.             <a href="ReportShare.asp?SurveyID=<%=lngSurveyID%>&SurveyName=<%=strSurveyName%>"><img border="0" alt="Create new report share" name="btnCreateReportShare" src="Resources/Buttons/CreateReportShare.gif"></a>
  71.         </td>
  72.         <td width="7"></td>
  73.     </tr>
  74. </table>
  75.  
  76. <!--#Include File="Include/FrameworkTop2_inc.asp"-->
  77.  
  78. <table width="740" border="0" cellpadding="0" cellspacing="6" class="LightGrayBackgroundColor">
  79.     <tr>
  80.         <td align="left" valign="top" class="LightGrayBackgroundColor">
  81. <%
  82.             strSQL = "SELECT report_sharing_enabled_yn " & _
  83.                      "FROM sur_survey " & _
  84.                      "WHERE survey_id = " & lngSurveyID
  85.             rsReportSharingStatus.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenDynamic, , adCmdText
  86.             rsReportSharingStatus.MoveFirst
  87.             If rsReportSharingStatus("report_sharing_enabled_yn") = SUR_BOOLEAN_POSITIVE Then
  88. %>
  89.                 <table width="200" cellpadding="0" cellspacing="0" border="0">
  90.                     <tr>
  91.                         <td width="60" height="24"> 
  92.                             <span class="NormalGreenBold"><%=SUR_REPORT_SHARING_ENABLED%></span>
  93.                         </td>
  94.                         <td valign="bottom">
  95.                             <a href="ChangeReportSharingStatus.asp?SurveyID=<%=lngSurveyID%>&SurveyName=<%=strSurveyName%>&Enabled=<%=SUR_BOOLEAN_NEGATIVE%>"><img border="0" alt="Disable report sharing for this survey" src="Resources/Buttons/DisableSmall.gif"></a>
  96.                         </td>
  97.                     </tr>
  98.                 </table>
  99. <%            
  100.             Else
  101. %>
  102.                 <table width="200" cellpadding="0" cellspacing="0" border="0" class="LightGrayBackgroundColor">
  103.                     <tr>
  104.                         <td width="65" height="24"> 
  105.                             <span class="NormalRedBold"><%=SUR_REPORT_SHARING_DISABLED%></span>
  106.                         </td>
  107.                         <td valign="bottom">
  108.                             <a href="ChangeReportSharingStatus.asp?SurveyID=<%=lngSurveyID%>&SurveyName=<%=strSurveyName%>&Enabled=<%=SUR_BOOLEAN_POSITIVE%>"><img border="0" alt="Enable report sharing for this survey" src="Resources/Buttons/EnableSmall.gif"></a>
  109.                         </td>
  110.                     </tr>
  111.                 </table>
  112. <%            
  113.             End If
  114.             
  115.             'Clean up
  116.             rsReportSharingStatus.Close
  117.             Set rsReportSharingStatus = Nothing
  118. %>
  119.         </td>
  120.     </tr>
  121. </table>
  122.  
  123. <table width="740" border="0" cellpadding="6" cellspacing="0" class="WhiteBackgroundColor" summary="This page displays a list of all report shares associated with this survey">
  124.     <tr class="TableHeadingColor" height="40">
  125.         <th id="Active" align="center" width="35" valign="center" class="NormalBold">
  126.             Active
  127.         </th>
  128.         <th id="EmailAddresses" align="center" width="305" valign="center" class="NormalBold">
  129.             Email Addresses
  130.         </th>
  131.         <th id="Reports" align="center" width="190" valign="center" class="NormalBold">
  132.             Viewable Reports
  133.         </th>
  134.         <th id="SentDate" align="center" width="75" valign="center" class="NormalBold">
  135.             Sent Date
  136.         </th>
  137.         <th id="Edit" align="center" width="45" valign="center" class="NormalBold">
  138.             Edit
  139.         </th>
  140.         <th id="Delete" align="center" width="45" valign="center" class="NormalBold">
  141.             Delete
  142.         </th>
  143.         <th id="Send" align="center" width="45" valign="center" class="NormalBold">
  144.             Send
  145.         </th>
  146.     </tr>
  147. <%
  148.     Dim rsReportShares
  149.     Dim lngReportShareID
  150.     Dim strEmailAddresses
  151.     
  152.     'Initialization
  153.     Set rsReportShares = Server.CreateObject("ADODB.Recordset")
  154.     
  155.     'Select the list of all report shares for this survey
  156.     strSQL = "SELECT report_share_id, viewable_reports, last_sent_date, active_yn, email_addresses " & _
  157.              "FROM sur_report_share " & _
  158.              "WHERE survey_id = " & lngSurveyID & _
  159.              " ORDER BY last_sent_date DESC"
  160.     rsReportShares.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
  161.  
  162.     If rsReportShares.EOF = True Then
  163. %>    
  164.         <tr class="TableRowLightColor">
  165.             <td class="Normal" colspan="7">
  166.                 There are no report shares associated with this survey.
  167.             </td>
  168.         </tr>
  169. <%        
  170.     Else
  171.         rsReportShares.MoveFirst
  172.         Do While Not rsReportShares.EOF
  173.             lngReportShareID = rsReportShares("report_share_id") 
  174. %>
  175.             <tr class="<%=strTableRowColor%>">
  176.                 <td align="center" class="Normal" valign="center">
  177. <%
  178.                     'Format the Y/N flag to either Yes or No
  179.                     If rsReportShares("active_yn") = SUR_BOOLEAN_POSITIVE Then
  180. %>
  181.                         <%=SUR_BOOLEAN_POSITIVE_DISPLAY%>
  182. <%                    
  183.                     Else
  184. %>
  185.                         <%=SUR_BOOLEAN_NEGATIVE_DISPLAY%>
  186. <%                    
  187.                     End If
  188. %>                    
  189.                 </td>
  190.                 <td class="Normal">
  191. <%
  192.                     strEmailAddresses = rsReportShares("email_addresses")
  193.                     'If the length of email addresses is greater than 65 characters, trim it down, and add an ellipsis
  194.                     If Len(strEmailAddresses) > 65 Then
  195.                         strEmailAddresses = Left(strEmailAddresses, InStr(50, strEmailAddresses, ";")) & "..."
  196.                     End If
  197.                     Response.Write strEmailAddresses
  198. %>
  199.                 </td>
  200.                 <td align="center" class="Normal">
  201.                     <%=rsReportShares("viewable_reports")%>
  202.                 </td>
  203.                 <td align="center" class="Normal">
  204. <%
  205.                     If IsNull(rsReportShares("last_sent_date")) = True Then
  206.                         Response.Write " "
  207.                     Else
  208.                         Response.Write CustomDateFormatDisplay(DateValue(rsReportShares("last_sent_date")))
  209.                     End If
  210. %>
  211.                 </td>
  212.                 <td align="center" class="Normal">
  213.                     <a href="ReportShare.asp?SurveyName=<%=strSurveyName%>&SurveyID=<%=lngSurveyID%>&ReportShareID=<%=lngReportShareID%>"><img alt="Edit this report share" src="Resources/Icons/Edit.gif" border="0" onMouseOver="this.style.cursor='hand'"></a>
  214.                 </td>
  215.                 <td align="center" class="Normal">
  216.                     <a href="javascript:deleteReportShare('<%=lngReportShareID%>');"><img alt="Delete this report share" src="Resources/Icons/Delete.gif" border="0" onMouseOver="this.style.cursor='hand'"></a>
  217.                 </td>
  218.                 <td align="center" class="Normal">
  219. <%
  220.                     'Only display the send button for active report shares
  221.                     If rsReportShares("active_yn") = SUR_BOOLEAN_POSITIVE Then
  222. %>
  223.                         <a href="SendReportShareMessage.asp?SurveyName=<%=strSurveyName%>&SurveyID=<%=lngSurveyID%>&ReportShareID=<%=lngReportShareID%>"><img alt="Send an email for this report share" src="Resources/Icons/Send.gif" border="0" onMouseOver="this.style.cursor='hand'"></a>
  224. <%
  225.                     Else
  226.                         Response.Write " "
  227.                     End If
  228. %>                        
  229.                 </td>
  230.             </tr>
  231. <%    
  232.             'Alternate the colors for the rows in the table
  233.             If strTableRowColor = "TableRowDarkColor" Then
  234.                 strTableRowColor = "TableRowLightColor"
  235.             Else
  236.                 strTableRowColor = "TableRowDarkColor"
  237.             End If
  238.  
  239.             rsReportShares.MoveNext
  240.         Loop
  241.     End If
  242. %>
  243. </table>
  244.  
  245. <!--#Include File="Include/FrameworkBottom_inc.asp"-->
  246.  
  247. </body>
  248. </html>
  249. <%
  250.     'Clean up
  251.     rsReportShares.Close
  252.     Set rsReportShares = Nothing
  253.  
  254.     'Ensure that the web server returns the page
  255.     Response.Flush
  256. %>
  257.