<%@ Page Language="c#" %>

<%@ Register TagPrefix="uc1" TagName="Trailer" Src="Trailer.ascx" %>
<%@ Register TagPrefix="uc2" TagName="Header" Src="top.ascx" %>
<%@ Import Namespace="System.Web" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="edu.jhu.Cas.Users" %>
<%@ Import Namespace="edu.jhu.Cas.Util" %>
<%@ Import Namespace="edu.jhu.Cas.Web" %>
<%@ Import Namespace="edu.jhu.Cas" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>CasJobs Help Desk Contact Page</title>
    <link href="cjobs.css" rel="stylesheet" />
</head>
<body>
    <uc2:Header ID="Header" runat="server"/>
    
<div id="transp">
<script name="JavaScript">
function SendEmail()
{
	var helpdesk = 'helpdesk@sdss3.org';
	var subject = 'CasJobs issue: ' + document.jsform.subject.value;
	var mailer = 'mailto:' + helpdesk + '?subject=' + subject + '&body=' + 
		'Name:%20' + document.jsform.username.value + '%20%20%0A' + 'Email:%20' + document.jsform.email.value + 
		'%20%20%0A' + 'URL:%20' + document.jsform.url.value + '%20%20%0A' + 'Description:%20%20%0A' + document.jsform.message.value +'%0A%0A';
	parent.location = mailer;
}
</script>

<%
//    WebUtils.CheckLoggedIn(Session, Response);
//    long wsid = (long)Session["USER"];
    string lmessage = Request.Params["lmessage"];
    string pmessage = Request.Params["pmessage"];

    edu.jhu.Cas.Util.User user = null;
    string userName = "";
    string userEmail = "";

    CasUsers cu = new CasUsers();


    try {
        User[] users = cu.FindUser(edu.jhu.Cas.Util.ID.SERVICE_ID, "WEBSERVICESID=" + Session["USER"]);
        if (users != null) {
            user = users[0];
            Session["THEUSER"] = user;
	    userName = user.Name;
	    userEmail = user.Email;
        }
    }
    catch (Exception e) {
        lmessage = e.Message;
    }
%>

<form name="jsform">
<h2>SDSS Help Desk Contact Form</h2>
<%
if( user == null )
	Response.Write( "<h5>You are not logged in.</h5>");
%>
<table width=600><tr>
	<td colspan=3>If you encounter a problem with the CasJobs site that is not covered by the <a href="Guide.aspx">Help pages</a>, 
	please fill out the short form below and press <b>Send</b> to send it to the SDSS Help Desk.  Someone will contact you shortly with
	an answer to your question.  We request that you observe the following guidelines when communicating with the SDSS Help Desk:
	<ul>
	    <li>Please remember to copy the help desk email account on all email related to this problem in the future, so that
		we have a record of how the problem was resolved.</li>
	    <li>Please do not contact the help desk respondents directly by email, because help desk support is handled
	    	by a pool of SDSS scientists with expertise in different areas and as time permits, and the best response time to your problem will usually 
		be obtained if you direct your question to the help desk account rather than individual SDSS scientists.</li>
	    <li>Fill in as much information as you can that is relevant to your issue, this will help expedite the solution
		to your problem; for example filling in the exact URL of the page that you are writing about is very
		useful for the helpdesk staff to diagnose your problem.</li>
	</ul>
	Thank you for using CasJobs! </p>
	</td></tr>

	<tr><td colspan=3>&nbsp;</td></tr>

	<tr>
		<td width=180><b>Name</b>:&nbsp;</td><td><input name="username" size="25" value="<%=userName%>"</td><td>&nbsp;</td></td>
	</tr>

	<tr>
		<td width=180><b>Email</b>:&nbsp;</td><td><input name="email" size="25" value="<%=userEmail%>"></td><td>&nbsp;</td></td>
	</tr>

	<tr>
		<td width=180><b>URL of relevant page</b>:&nbsp;</td><td colspan=2><input name="url" size="60" value="http://skyservice.pha.jhu.edu/casjobs/"></td>
	</tr>

	<tr>
		<td width=180><b>Subject</b>:&nbsp;</td><td colspan=2><input name="subject" size="60"></td>
	</tr>

	<tr>
		<td colspan=3><b>Problem/Question Description:</b></td>
	</tr>
	<tr>
		<td colspan="3" align=right>
			<textarea name="message" cols="72" rows="8" wrap="soft"></textarea>
		</td>
	</tr>
	<tr>
		<td width=40><input type="button" onClick="SendEmail()" value=" Send to Help Desk "></td>
		<td>&nbsp;</td>
		<td align=right><input name=reset type=reset value=" Reset Form "> </td>
	</tr>
</table>
</form>

</div>
</body>
</html>
