home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / ReportShare.asp < prev    next >
Text File  |  2006-11-29  |  14KB  |  331 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 for editing an existing report share
  7. '                      or creating a new one.  
  8. '   COPYRIGHT NOTICE                                
  9. '
  10. '   See attached Software License Agreement
  11. '
  12. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  13. '***********************************************************************
  14. %>
  15. <!--#Include File="Include/Config_inc.asp"-->
  16. <!--#Include File="Include/SurveyUtility_inc.asp"-->
  17. <!--#Include File="Include/Utility_inc.asp"-->
  18. <!--#Include File="Include/adovbs_inc.asp"-->
  19. <!--#Include File="Include/Constants_inc.asp"-->
  20. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  21. <!--#Include File="Include/CurrentUser_inc.asp"-->
  22.  
  23. <%
  24.     Dim strSurveyName
  25.     Dim lngSurveyID
  26.     Dim rsReportShare
  27.     Dim strSQL
  28.     Dim strPageTitle
  29.     Dim lngReportShareID
  30.     Dim strReportShareURLID
  31.     Dim strEmailAddresses
  32.     Dim strLastSentDate
  33.     Dim strExportDataYN
  34.     Dim strReportFilteringYN
  35.     Dim strViewableReports
  36.     Dim strViewOpenEndedYN
  37.     Dim strActiveYN
  38.     Dim strCreatedDate
  39.     Dim strState
  40.         
  41.     'Initialization
  42.     lngSurveyID = Request.QueryString("SurveyID")
  43.     
  44.     'If the user does not either own this survey or have admin permission, deny them access to this functionality.
  45.     If IsUserOwnerOrAdmin(lngSurveyID) = False Then
  46.         Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_OWNER_FOR_RESULTS_SHARING
  47.     End If
  48.  
  49.     'Initialization
  50.     Set rsReportShare = Server.CreateObject("ADODB.Recordset")
  51.     strSurveyName = Request.QueryString("SurveyName")
  52.     
  53.     'Determine whether the page is in EDIT or INSERT mode based on the existence of the ReportShareID paramater in the querystring    
  54.     If Len(Request.QueryString("ReportShareID")) > 0 Then
  55.         strState = SUR_STATE_EDIT
  56.         lngReportShareID = Request.QueryString("ReportShareID")
  57.         strPageTitle = "Edit Report Share"
  58.  
  59.         'In EDIT mode, query the existing data for the report share from the database
  60.         strSQL = "SELECT report_share_url_id, created_date, last_sent_date, export_data_yn, report_filtering_yn, " & _
  61.                  "viewable_reports, view_open_ended_yn, active_yn, email_addresses " & _
  62.                  "FROM sur_report_share " & _
  63.                  "WHERE report_share_id = " & lngReportShareID
  64.         rsReportShare.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenForwardOnly, adLockReadOnly, adCmdText
  65.         rsReportShare.MoveFirst
  66.         strReportShareURLID = rsReportShare("report_share_url_id")
  67.         strLastSentDate = rsReportShare("last_sent_date")
  68.         strExportDataYN = rsReportShare("export_data_yn")
  69.         strReportFilteringYN = rsReportShare("report_filtering_yn")
  70.         strViewableReports = rsReportShare("viewable_reports")
  71.         strViewOpenEndedYN = rsReportShare("view_open_ended_yn")
  72.         strActiveYN = rsReportShare("active_yn")
  73.         strCreatedDate = rsReportShare("created_date")
  74.         strEmailAddresses = rsReportShare("email_addresses")
  75.         rsReportShare.Close
  76.         Set rsReportShare = Nothing
  77.     Else
  78.         strState = SUR_STATE_INSERT
  79.         strPageTitle = "Insert Report Share"
  80.         strReportShareURLID = ""
  81.         strEmailAddresses = ""
  82.         strLastSentDate = ""
  83.         strExportDataYN = SUR_BOOLEAN_NEGATIVE
  84.         strReportFilteringYN = SUR_BOOLEAN_NEGATIVE
  85.         strViewableReports = SUR_VIEWABLE_REPORT_OVERVIEW_AND_INDIVIDUAL
  86.         strViewOpenEndedYN = SUR_BOOLEAN_POSITIVE
  87.         strActiveYN = SUR_BOOLEAN_POSITIVE
  88.     End If
  89. %>
  90.  
  91. <html>
  92. <head>
  93.     <title><%=strPageTitle%></title>
  94.     <link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
  95. </head>
  96.  
  97. <script language ="JavaScript" src="ClientInclude/Utility.js"></script>
  98. <script language="JavaScript">
  99. function deleteReportShare()
  100. {
  101.     if (confirm("Are you sure you want to delete this report share?") == true) //OK
  102.     {
  103.         window.location.href = 'DeleteReportShare.asp?ReportShareID=<%=lngReportShareID%>';
  104.     }
  105. }
  106.  
  107. function submitCheck() 
  108. {
  109.     var strEmailAddress;
  110.     var arrEmailAddresses;
  111.     var strInvalidEmailAddresses = "";
  112.     var flgReturnValue = true;
  113.     var i;
  114.     
  115.     // Check the list of email addresses.  Split on the ;, creating an array of email addresses.
  116.     var strEmailAddresses = trim(document.forms['frmReportShare'].txtEmailAddresses.value);
  117.     
  118.     if (strEmailAddresses.length == 0)
  119.     {
  120.         alert("You must enter at least one valid email address.");
  121.         document.forms['frmReportShare'].txtEmailAddresses.focus();
  122.         flgReturnValue = false;
  123.     }
  124.     else
  125.     {
  126.         // Get the array of email addresses
  127.         arrEmailAddresses = strEmailAddresses.split(';');
  128.             
  129.         // Loop through each of the email addresses
  130.         for (i = 0; i < arrEmailAddresses.length; i++)
  131.         {
  132.             // Get the email address
  133.             strEmailAddress = trim(arrEmailAddresses[i]);
  134.             
  135.             if (strEmailAddress.length > 0)
  136.             {
  137.                 if (isValidEmailAddress(strEmailAddress) == false)
  138.                 {
  139.                     strInvalidEmailAddresses = strInvalidEmailAddresses + strEmailAddress + ", "
  140.                     flgReturnValue = false;
  141.                 }
  142.             }
  143.         }
  144.     }
  145.  
  146.     // If there were any invalid email addresses, display an error message
  147.     if (strInvalidEmailAddresses.length > 0)
  148.     {
  149.         // Trim off the trailing comma and space
  150.         strInvalidEmailAddresses = trim(strInvalidEmailAddresses);
  151.         strInvalidEmailAddresses = strInvalidEmailAddresses.substr(0, strInvalidEmailAddresses.length - 1)
  152.         
  153.         // Display the error message
  154.         alert("The email addresses are not entered correctly.  The following email addresses are not valid: " + strInvalidEmailAddresses);
  155.         document.forms['frmReportShare'].txtEmailAddresses.focus();
  156.         flgReturnValue = false;
  157.     }
  158.     
  159.     // Only submit the form if there were no errors
  160.     if (flgReturnValue == true)
  161.     {
  162.         document.forms['frmReportShare'].submit();
  163.     }
  164. }
  165. </script>
  166.  
  167. <body class="MainBodyStyle">
  168.  
  169. <!--#Include File="Include/FrameworkTop_inc.asp"-->
  170.  
  171. <table border="0" cellspacing="0" cellpadding="0" width="754" class="MediumBlueBackgroundColor">
  172.     <tr>
  173.         <td height="36" valign="center">
  174.               <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">
  175.         </td>
  176.     </tr>
  177. </table>
  178.  
  179. <!--#Include File="Include/FrameworkTop2_inc.asp"-->
  180.  
  181. <table width="740" border="0" cellpadding="0" cellspacing="6" class="LightGrayBackgroundColor">
  182.     <form name="frmReportShare" method="post" action="ReportShareAction.asp" onSubmit="return submitCheck();">
  183.         <input type="hidden" name="ReportShareID" value="<%=lngReportShareID%>">
  184.         <input type="hidden" name="State" value="<%=strState%>">
  185.         <input type="hidden" name="SurveyID" value="<%=lngSurveyID%>">
  186.         <input type="hidden" name="SurveyName" value="<%=strSurveyName%>">
  187.         <tr>
  188.             <td width="1" rowspan="25"></td>
  189.             <td height="30">
  190.                 <span class="H2HeadingStyle"><%=strPageTitle%> for '<%=strSurveyName%>' Survey</span>
  191.             </td>
  192.             <td width="1" rowspan="25"> </td>
  193.         </tr>
  194.         <tr>
  195.             <td valign="top" class="Normal" height="24">
  196.                 All fields marked with an asterisk (<span class="Required">*</span>) are required.
  197.             </td>
  198.         </tr>
  199.     </table>
  200.     <table border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td height="1" background="Resources/Images/ThinDivider.gif"></td></tr>
  201.     <table border="0" cellpadding="0" cellspacing="6" width="740" class="WhiteBackgroundColor">
  202.         <tr>
  203.             <td height="8"></td>
  204.         </tr>
  205.         <tr>
  206.             <td width="1" rowspan="25"></td>
  207.             <td width="170" valign="top" class="NormalBold">
  208.                 <label for="txtEmailAddresses">Email Addresses:</label><span class="Required">*</span>
  209.             </td>
  210.             <td valign="top" class="Normal">
  211.                 <span class="InlineHelpSpanStyle">Enter the email address(es) to send this report share to.  Separate multiple email addresses with a semi-colon.<br></span>
  212.                 <textarea class="TextareaStyle" name="txtEmailAddresses" id="txtEmailAddresses" rows="5" style="width:540px"><%=strEmailAddresses%></textarea>
  213.             </td>
  214.             <td width="1" rowspan="25"></td>
  215.         </tr>
  216.         <tr>
  217.             <td valign="top" class="NormalBold">
  218.                 <label for="cboViewableReports">Viewable Reports:</label><span class="Required">*</span>
  219.             </td>
  220.             <td valign="top" class="Normal">
  221.                 <span class="InlineHelpSpanStyle">Select the types of report that recipients of this report share are able to view.<br></span>
  222.                 <select name="cboViewableReports" id="cboViewableReports" style="width:200px">
  223.                     <option <% If strViewableReports = SUR_VIEWABLE_REPORT_OVERVIEW_ONLY Then Response.Write "selected" End If %> value="<%=SUR_VIEWABLE_REPORT_OVERVIEW_ONLY%>"><%=SUR_VIEWABLE_REPORT_OVERVIEW_ONLY%></option>
  224.                     <option <% If strViewableReports = SUR_VIEWABLE_REPORT_OVERVIEW_AND_INDIVIDUAL Then Response.Write "selected" End If %> value="<%=SUR_VIEWABLE_REPORT_OVERVIEW_AND_INDIVIDUAL%>"><%=SUR_VIEWABLE_REPORT_OVERVIEW_AND_INDIVIDUAL%></option>
  225.                 </select>
  226.             </td>
  227.         </tr>
  228.         <tr>
  229.             <td valign="top" class="NormalBold">
  230.                 <label for="cboExportDataYN">Export Data:</label><span class="Required">*</span>
  231.             </td>
  232.             <td valign="top" class="Normal">
  233.                 <span class="InlineHelpSpanStyle">Select whether or not recipients of this report share should be allowed to export data.<br></span>
  234.                 <select name="cboExportDataYN" id="cboExportDataYN" style="width:100px">
  235.                     <option <% If strExportDataYN = SUR_BOOLEAN_NEGATIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_NEGATIVE%>"><%=SUR_BOOLEAN_NEGATIVE_DISPLAY%></option>
  236.                     <option <% If strExportDataYN = SUR_BOOLEAN_POSITIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_POSITIVE%>"><%=SUR_BOOLEAN_POSITIVE_DISPLAY%></option>
  237.                 </select>
  238.             </td>
  239.         </tr>
  240.         <tr>
  241.             <td valign="top" class="NormalBold">
  242.                 <label for="cboReportFilteringYN">Report Filtering:</label><span class="Required">*</span>
  243.             </td>
  244.             <td valign="top" class="Normal">
  245.                 <span class="InlineHelpSpanStyle">Select whether or not recipients of this report share should be allowed to user report filtering.<br></span>
  246.                 <select name="cboReportFilteringYN" id="cboReportFilteringYN" style="width:100px">
  247.                     <option <% If strReportFilteringYN = SUR_BOOLEAN_NEGATIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_NEGATIVE%>"><%=SUR_BOOLEAN_NEGATIVE_DISPLAY%></option>
  248.                     <option <% If strReportFilteringYN = SUR_BOOLEAN_POSITIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_POSITIVE%>"><%=SUR_BOOLEAN_POSITIVE_DISPLAY%></option>
  249.                 </select>
  250.             </td>
  251.         </tr>
  252.         <tr>
  253.             <td valign="top" class="NormalBold">
  254.                 <label for="cboViewOpenEndedYN">View Open-Ended:</label><span class="Required">*</span>
  255.             </td>
  256.             <td valign="top" class="Normal">
  257.                 <span class="InlineHelpSpanStyle">Select whether or not recipients of this report share are allowed to view open-ended responses.<br></span>
  258.                 <select name="cboViewOpenEndedYN" id="cboViewOpenEndedYN" style="width:100px">
  259.                     <option <% If strViewOpenEndedYN = SUR_BOOLEAN_NEGATIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_NEGATIVE%>"><%=SUR_BOOLEAN_NEGATIVE_DISPLAY%></option>
  260.                     <option <% If strViewOpenEndedYN = SUR_BOOLEAN_POSITIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_POSITIVE%>"><%=SUR_BOOLEAN_POSITIVE_DISPLAY%></option>
  261.                 </select>
  262.             </td>
  263.         </tr>
  264.         <tr>
  265.             <td valign="top" class="NormalBold">
  266.                 <label for="cboActiveYN">Active:</label><span class="Required">*</span>
  267.             </td>
  268.             <td valign="top" class="Normal">
  269.                 <span class="InlineHelpSpanStyle">Select whether or not recipients of this report share is currently active.<br></span>
  270.                 <select name="cboActiveYN" id="cboActiveYN" style="width:100px">
  271.                     <option <% If strActiveYN = SUR_BOOLEAN_NEGATIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_NEGATIVE%>"><%=SUR_BOOLEAN_NEGATIVE_DISPLAY%></option>
  272.                     <option <% If strActiveYN = SUR_BOOLEAN_POSITIVE Then Response.Write "selected" End If %> value="<%=SUR_BOOLEAN_POSITIVE%>"><%=SUR_BOOLEAN_POSITIVE_DISPLAY%></option>
  273.                 </select>
  274.             </td>
  275.         </tr>
  276. <%
  277.         'In EDIT mode, display some additional data
  278.         If strState = SUR_STATE_EDIT Then
  279. %>
  280.             <tr>
  281.                 <td valign="top" class="NormalBold">
  282.                     Date Created:
  283.                 </td>
  284.                 <td valign="top" class="Normal">
  285.                     <%=CustomDateFormatDisplay(DateValue(strCreatedDate))%>
  286.                 </td>
  287.             </tr>
  288.             <tr>
  289.                 <td valign="top" class="NormalBold">
  290.                     Last Sent Date:
  291.                 </td>
  292.                 <td valign="top" class="Normal">
  293. <%
  294.                     If IsNull(strLastSentDate) = True Then
  295.                         Response.Write "Not Sent"
  296.                     Else
  297.                         Response.Write CustomDateFormatDisplay(DateValue(strLastSentDate))
  298.                     End If
  299. %>
  300.                 </td>
  301.             </tr>
  302.             <tr>
  303.                 <td valign="top" class="NormalBold">
  304.                     URL Unique ID:
  305.                 </td>
  306.                 <td valign="top" class="Normal">
  307.                     <%=strReportShareURLID%>
  308.                 </td>
  309.             </tr>
  310. <%
  311.         End If
  312. %>
  313.         <tr>
  314.             <td align="right" valign="middle" colspan="2">
  315.                 <a href="ReportShareList.asp?SurveyID=<%=lngSurveyID%>&SurveyName=<%=strSurveyName%>"><img border="0" alt="Cancel" name="btnCancel" src="Resources/Buttons/Cancel.gif"></a>
  316.                 <a href="javascript:submitCheck();"><img border="0" alt="Save" name="btnSave" src="Resources/Buttons/Save.gif"></a>
  317.             </td>
  318.         </tr>
  319.     </table>
  320. </form>
  321.  
  322. <!--#Include File="Include/FrameworkBottom_inc.asp"-->
  323.  
  324. </body>
  325. </html>
  326.  
  327. <%        
  328.     'Ensure that the web server returns the page
  329.     Response.Flush
  330. %>
  331.