예제 #1
0
        void DoCreate(FormValues values)
        {
            string adminMail = SendRequestsTo;
            MailMessage msg = new MailMessage(AddressToSendMailFrom(values.Contact), adminMail);
            msg.IsBodyHtml = true;
            Uri uri = Request.Url;
            UriBuilder b = new UriBuilder(uri.Scheme, uri.Host, uri.Port, "/admin/EditProvider.aspx",
                "?Contact=" + HttpUtility.UrlEncode(values.Contact) +
                "&Namespace=" + HttpUtility.UrlEncode(values.Namespace) +
                "&Title=" + HttpUtility.UrlEncode(values.Title) +
                "&Description=" + HttpUtility.UrlEncode(values.Description));
            string link = b.ToString();

            msg.Subject = "FlexWiki namespace request - " + values.Namespace;
            msg.Body = @"<p>You have received a request to create a FlexWiki namespace.

            <p><b>Contact:</b> " + values.Contact + @"<br />
            <b>Namespace:</b> " + values.Namespace + @"<br />
            <b>Title:</b> " + values.Title + @"<br />
            <b>Description:</b> " + values.Description + @"<br />

            <p>To processed with creation of this namespace, you can use <a href='" + link + "'>this link</a>.";
            string fail = SendMail(msg);
            if (fail == null)
                Response.Write(@"<p>Your request to create a FlexWiki namespace (" + EscapeHTML(values.Namespace) + @") has been forwarded to the administration staff for this site (" + EscapeHTML(adminMail) + ").");
            else
            {
                Response.Write(@"<p>Your request to create a FlexWiki namespace (" + EscapeHTML(values.Namespace) + @") can not be forwarded to the administration staff at this time.  An error occurred trying to send them mail with your request.  You can try again later or send the information in mail manually to: " + EscapeHTML(adminMail) + ".");
                Response.Write(@"<p>The error that occurred is: <pre>
            " + EscapeHTML(fail)
            + "</pre>");
            }

            // Also send confirmation mail
            MailMessage msg2 = new MailMessage(AddressToSendMailFrom(values.Contact), values.Contact);
            msg2.Subject = "FlexWiki namespace request - " + values.Namespace;
            msg2.IsBodyHtml = true;
            msg2.Body = @"<p>This message is confirmation of your request to create a FlexWiki namespace.

            <p><b>Contact:</b> " + values.Contact + @"<br />
            <b>Namespace:</b> " + values.Namespace + @"<br />
            <b>Title:</b> " + values.Title + @"<br />
            <b>Description:</b> " + values.Description + @"<br />

            ";
            fail = SendMail(msg2);
            if (fail == null)
                Response.Write(@"<p>A confirmation mail describing your request to create a FlexWiki namespace (" + EscapeHTML(values.Namespace) + @") has been sent to your email address.");
            else
            {
                Response.Write(@"<p>A confirmation mail describing your request could not be forwarded to your email address.  An error occurred trying to send the email.");
                Response.Write(@"<p>The error that occurred is: <pre>
            " + EscapeHTML(fail)
                    + "</pre>");
            }
        }
예제 #2
0
		string Validate(FormValues values)
		{
			if (values.Namespace == null || values.Namespace == "")
				return "Namespace must be specified";
			if (values.Title == null || values.Title == "")
				return "Title must be specified";
			if (TheFederation.ContentBaseForNamespace(values.Namespace) != null)
				return "The namespace you selected already exists.  Please select another name.";
			if (values.Description == null || values.Description == "")
				return "Description must be specified";
			if (values.Contact == null || values.Contact == "")
				return "You must supply your contact information (which should be a valid email address)";
			return null;		
		}
예제 #3
0
		void WriteForm(FormValues values)
		{
			// Write the form
			Response.Write("<form method='post' ACTION='RequestNamespace.aspx'>");
			StartFields();
			WriteInputField("ns", "Namespace", "The full identifier for the namespace (e.g., Microsoft.Projects.Wiki or FlexWiki.Dev.Testing)", values.Namespace);
			WriteInputField("title", "Title", "A short title for this namespace", values.Title);
			WriteTextAreaField("description", "Description", "A description for the namespace (can use Wiki formatting)", values.Description);
			WriteInputField("contact", "Contact", "Specify a contact for this namespace (a valid email address)", values.Contact);
			EndFields();
			Response.Write("<input  type='submit'  name='OK' value ='Submit Request'>");
			Response.Write("</form>");
		}
예제 #4
0
		FormValues NewDefaultValues()
		{
			FormValues answer = new FormValues();
			return answer;
		}
예제 #5
0
		FormValues ReadValuesFromPost()
		{
			FormValues answer = new FormValues();
			answer.Namespace = Request.Form["ns"];
			answer.Title = Request.Form["title"];
			answer.Description = Request.Form["description"];
			answer.Contact = Request.Form["contact"];
			return answer;
		}
예제 #6
0
		void SaveChanges(FormValues values)
		{
			DoCreate(values);
		}