Minor changes to improve testability of helpers
[castle.git] / MonoRail / Castle.MonoRail.Framework / Constants.cs
blob4dec6c4cbd1966c8e2f34ac32f4a212e4cb7b2a3
1 // Copyright 2004-2007 Castle Project - http://www.castleproject.org/
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle.MonoRail.Framework
17 using System;
18 using System.Text.RegularExpressions;
20 /// <summary>
21 /// MonoRail constants
22 /// </summary>
23 static class Constants
25 #region Controller Constants
27 /// <summary>
28 /// TODO: Document why this is necessary
29 /// </summary>
30 public static readonly String ControllerContextKey = "rails.controller";
32 /// <summary>
33 /// TODO: Document why this is necessary
34 /// </summary>
35 internal static readonly String OriginalViewKey = "rails.original_view";
37 #endregion
39 #region Email Constants
41 public const String To = "to";
42 public const String Cc = "cc";
43 public const String Bcc = "bcc";
45 public static readonly String EmailTemplatePath = "mail";
46 public static readonly String ToAddressPattern = @"[ \t]*(?<header>(to|cc|bcc)):[ \t]*(?<value>([\w-\.]+@([\w\.]){1,}\w+[ \t]*[,;]?[ \t]*)+)[ \t]*(\r*\n*)?";
47 public static readonly String FromAddressPattern = @"[ \t]*from:[ \t]*(?<value>(\w+[ \t]*)*<*[ \t]*[\w-\.]+@([\w\.]){1,}[\w][ \t]*>*)[ \t]*(\r*\n*)?";
48 public static readonly String HeaderPattern = @"[ \t]*(?<header>(subject|X-\w+)):[ \t]*(?<value>(\w+[ \t]*)+)(\r*\n*)?";
49 public static readonly String HeaderKey = "header";
50 public static readonly String ValueKey = "value";
51 public static readonly String Subject = "subject";
52 public static readonly String HtmlTag = "<html>";
53 public static readonly String SmtpUsername = "SMTP_USERNAME";
54 public static readonly String SmtpPassword = "SMTP_PASSWORD";
55 public static readonly String SmtpUsernameSchema = "http://schemas.microsoft.com/cdo/configuration/sendusername";
56 public static readonly String SmtpPasswordSchema = "http://schemas.microsoft.com/cdo/configuration/sendpassword";
57 public static readonly String SmtpAuthSchema = "http://schemas.microsoft.com/cdo/configuration/smtpauthenticate";
58 public static readonly String SmtpAuthEnabled = "1";
59 public static readonly String SmtpServer = "SMTP_SERVER";
60 public static readonly String DefaultSmtpServer = "localhost";
62 public static readonly Regex readdress = new Regex(ToAddressPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);
63 public static readonly Regex refrom = new Regex(FromAddressPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);
64 public static readonly Regex reheader = new Regex(HeaderPattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);
66 #endregion