diff --git a/web/Controllers/HomeController.cs b/web/Controllers/HomeController.cs index fce3c827..3052e370 100644 --- a/web/Controllers/HomeController.cs +++ b/web/Controllers/HomeController.cs @@ -44,7 +44,7 @@ namespace Yavsc.Controllers } } - public ActionResult ReferencedAssemblies() + public ActionResult AssemblyInfo() { AssemblyName[] model = GetType ().Assembly.GetReferencedAssemblies (); @@ -76,17 +76,34 @@ namespace Yavsc.Controllers return View (); } - public ActionResult AOEMail (string reason, string body) + public ActionResult Contact (string email, string reason, string body) { + if (email==null) + ModelState.AddModelError("email","Enter your email"); + + if (reason==null) + ModelState.AddModelError("reason","Please, fill in a reason"); + + if (body==null) + ModelState.AddModelError("body","Please, fill in a body"); + if (!ModelState.IsValid) + return View (); + // requires valid owner and admin email? - using (System.Net.Mail.MailMessage msg = new MailMessage(owneremail,admail,"Poke : "+reason,body)) + if (OwnerEmail == null) + throw new Exception ("No site owner!"); + + using (System.Net.Mail.MailMessage msg = new MailMessage(email,OwnerEmail,"[Contact] "+reason,body)) { + msg.CC.Add(new MailAddress(Admail)); using (System.Net.Mail.SmtpClient sc = new SmtpClient()) { sc.Send (msg); - return View (); + ViewData ["Message"] = LocalizedText.Message_sent; + return View (new { reason="", body="" }); } } } + } } diff --git a/web/Formatters/RssFeedsFormatter.cs b/web/Formatters/RssFeedsFormatter.cs new file mode 100644 index 00000000..8eff9b6c --- /dev/null +++ b/web/Formatters/RssFeedsFormatter.cs @@ -0,0 +1,97 @@ +// +// RssFormatter.cs +// +// Author: +// paul <${AuthorEmail}> +// +// Copyright (c) 2015 paul +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Net.Http.Formatting; +using System.Net.Http.Headers; +using System.Collections.Generic; +using System.IO; +using System.Net.Http; +using System.Web.Mvc; +using System.Net; +using Yavsc.Model; +using System.Text; + +namespace Yavsc.Formatters +{ + + public class RssFeedsFormatter:SimpleFormatter + { + string doctype = ""; + + public RssFeedsFormatter + () : base ("application/rss+xml") + { + } + + private const string dateformat = "ddd, dd MMM yyyy HH:mm:ss K"; + + public override void WriteToStream (Type type, object value, Stream stream, HttpContentHeaders contentHeaders) + { + RssFeedsChannel feeds = value as RssFeedsChannel; + using (var writer = new StreamWriter (stream)) { + TagBuilder rss = new TagBuilder ("rss"); + rss.Attributes.Add ("version", "2.0"); + TagBuilder channel = new TagBuilder ("channel"); + TagBuilder title = new TagBuilder ("title"); + TagBuilder description = new TagBuilder ("description"); + TagBuilder lastBuildDate = new TagBuilder ("lastBuildDate"); + TagBuilder link = new TagBuilder ("link"); + + title.InnerHtml = MvcHtmlString.Create (feeds.Title).ToHtmlString (); + description.InnerHtml = MvcHtmlString.Create (feeds.Description).ToHtmlString (); + lastBuildDate.InnerHtml = MvcHtmlString.Create (feeds.LastBuildDate.ToString (dateformat)).ToHtmlString (); + link.InnerHtml = MvcHtmlString.Create (feeds.Link).ToHtmlString (); + StringBuilder sb = new StringBuilder (); + foreach (RssFeedsEntry e in feeds.Entries) { + TagBuilder item = new TagBuilder ("item"); + TagBuilder ititle = new TagBuilder ("title"); + ititle.InnerHtml = e.Title; + + TagBuilder idescription = new TagBuilder ("description"); + idescription.InnerHtml = MvcHtmlString.Create (e.Description).ToHtmlString (); + TagBuilder ipubDate = new TagBuilder ("pubDate"); + ipubDate.InnerHtml = MvcHtmlString.Create ( + e.PubDate.ToString (dateformat)).ToHtmlString (); + + TagBuilder ilink = new TagBuilder ("link"); + ilink.InnerHtml = MvcHtmlString.Create (e.Link).ToHtmlString (); + + item.InnerHtml = ititle.ToString () + "\n" + + idescription.ToString () + "\n" + + ipubDate.ToString () + "\n" + + ilink.ToString () + "\n"; + + sb.Append (item.ToString () + "\n"); + } + channel.InnerHtml = title.ToString () + "\n" + + description.ToString () + "\n" + + lastBuildDate.ToString () + "\n" + + link.ToString () + "\n" + + sb.ToString () + "\n"; + rss.InnerHtml = channel.ToString (); + writer.WriteLine (doctype); + writer.Write (rss.ToString ()); + } + } + } + +} diff --git a/web/Theme/style.css b/web/Theme/style.css index 4313856d..bbffc83a 100644 --- a/web/Theme/style.css +++ b/web/Theme/style.css @@ -7,7 +7,13 @@ body { font-family: 'Arial', cursive; margin-bottom:3em; } - +textarea { + width:25em; + height:5em; + } +input { + width:25em; + } main { background-color: rgba(17,0,23,0.65); float:left; diff --git a/web/Views/Home/AOEMail.aspx b/web/Views/Home/AOEMail.aspx deleted file mode 100644 index f64c5e48..00000000 --- a/web/Views/Home/AOEMail.aspx +++ /dev/null @@ -1,2 +0,0 @@ -<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - diff --git a/web/Views/Home/ReferencedAssemblies.aspx b/web/Views/Home/AssemblyInfo.aspx similarity index 88% rename from web/Views/Home/ReferencedAssemblies.aspx rename to web/Views/Home/AssemblyInfo.aspx index 5ae669a7..9d0d35c7 100644 --- a/web/Views/Home/ReferencedAssemblies.aspx +++ b/web/Views/Home/AssemblyInfo.aspx @@ -1,9 +1,12 @@ <%@ Page Title="Yavsc - indexe" Language="C#" Inherits="System.Web.Mvc.ViewPage>" MasterPageFile="~/Models/App.master"%> +

<%= GetType().Assembly.FullName %>

+

    <% foreach (System.Reflection.AssemblyName item in Model) { %>
  • <%= item.FullName %>
  • <% } %>
+

diff --git a/web/Views/Home/Contact.aspx b/web/Views/Home/Contact.aspx new file mode 100644 index 00000000..92813ebb --- /dev/null +++ b/web/Views/Home/Contact.aspx @@ -0,0 +1,23 @@ +<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> + + +<% using (Html.BeginForm("Contact", "Home")) { %> +

+<%= Html.Label("email") %>: +<%= Html.ValidationMessage("email") %>
+<%= Html.TextBox("email") %> +

+

+<%= Html.Label("reason") %>: +<%= Html.ValidationMessage("reason") %>
+<%= Html.TextBox("reason") %> +

+

+<%= Html.Label("body") %>: +<%= Html.ValidationMessage("body") %>
+<%= Html.TextArea("body") %> +

+ +<% } %> + +
\ No newline at end of file diff --git a/web/Views/Home/Index.aspx b/web/Views/Home/Index.aspx index eb1f7069..4ed218b6 100644 --- a/web/Views/Home/Index.aspx +++ b/web/Views/Home/Index.aspx @@ -6,6 +6,9 @@
Ghost Dog, la Voie du samouraï

<%= Html.ActionLink("Les blogs","Index","Blogs",null, new { @class="actionlink" }) %> + +<%= Html.ActionLink("Contact","Contact") %> +<%= Html.ActionLink("Version des librairies","AssemblyInfo") %>
diff --git a/web/Web.csproj b/web/Web.csproj index ea066ec8..e8ebdd29 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -174,6 +174,7 @@ + @@ -204,7 +205,6 @@ - @@ -246,7 +246,6 @@ - @@ -631,6 +630,8 @@ + + diff --git a/yavscModel/LocalizedText.Designer.cs b/yavscModel/LocalizedText.Designer.cs index 5a983db4..44c13ac1 100644 --- a/yavscModel/LocalizedText.Designer.cs +++ b/yavscModel/LocalizedText.Designer.cs @@ -46,147 +46,51 @@ namespace Yavsc.Model { } } - public static string Preview { - get { - return ResourceManager.GetString("Preview", resourceCulture); - } - } - - public static string Register { - get { - return ResourceManager.GetString("Register", resourceCulture); - } - } - public static string Unitary_cost { get { return ResourceManager.GetString("Unitary_cost", resourceCulture); } } - public static string Not_Approuved { - get { - return ResourceManager.GetString("Not Approuved", resourceCulture); - } - } - - public static string Remove { - get { - return ResourceManager.GetString("Remove", resourceCulture); - } - } - - public static string Online { - get { - return ResourceManager.GetString("Online", resourceCulture); - } - } - - public static string access_denied { - get { - return ResourceManager.GetString("access_denied", resourceCulture); - } - } - - public static string Product_reference { - get { - return ResourceManager.GetString("Product_reference", resourceCulture); - } - } - - public static string Google_error { - get { - return ResourceManager.GetString("Google_error", resourceCulture); - } - } - public static string Welcome { get { return ResourceManager.GetString("Welcome", resourceCulture); } } - public static string Remember_me { - get { - return ResourceManager.GetString("Remember_me", resourceCulture); - } - } - - public static string Title { - get { - return ResourceManager.GetString("Title", resourceCulture); - } - } - public static string UserName { get { return ResourceManager.GetString("UserName", resourceCulture); } } - public static string Offline { - get { - return ResourceManager.GetString("Offline", resourceCulture); - } - } - public static string Ciffer { get { return ResourceManager.GetString("Ciffer", resourceCulture); } } - public static string Pdf_version { - get { - return ResourceManager.GetString("Pdf_version", resourceCulture); - } - } - public static string Date_search { get { return ResourceManager.GetString("Date_search", resourceCulture); } } - public static string Google_calendar { + public static string MaxDate { get { - return ResourceManager.GetString("Google_calendar", resourceCulture); + return ResourceManager.GetString("MaxDate", resourceCulture); } } - public static string DocTemplateException { + public static string Remove { get { - return ResourceManager.GetString("DocTemplateException", resourceCulture); + return ResourceManager.GetString("Remove", resourceCulture); } } - public static string Description { + public static string Title { get { - return ResourceManager.GetString("Description", resourceCulture); - } - } - - public static string User_name { - get { - return ResourceManager.GetString("User_name", resourceCulture); - } - } - - public static string User_List { - get { - return ResourceManager.GetString("User List", resourceCulture); - } - } - - public static string MinDate { - get { - return ResourceManager.GetString("MinDate", resourceCulture); - } - } - - public static string Tex_version { - get { - return ResourceManager.GetString("Tex_version", resourceCulture); + return ResourceManager.GetString("Title", resourceCulture); } } @@ -196,16 +100,118 @@ namespace Yavsc.Model { } } + public static string access_denied { + get { + return ResourceManager.GetString("access_denied", resourceCulture); + } + } + + public static string User_List { + get { + return ResourceManager.GetString("User List", resourceCulture); + } + } + + public static string Message_sent { + get { + return ResourceManager.GetString("Message_sent", resourceCulture); + } + } + + public static string DocTemplateException { + get { + return ResourceManager.GetString("DocTemplateException", resourceCulture); + } + } + + public static string Preview { + get { + return ResourceManager.GetString("Preview", resourceCulture); + } + } + + public static string Google_error { + get { + return ResourceManager.GetString("Google_error", resourceCulture); + } + } + + public static string Description { + get { + return ResourceManager.GetString("Description", resourceCulture); + } + } + + public static string Online { + get { + return ResourceManager.GetString("Online", resourceCulture); + } + } + + public static string Google_calendar { + get { + return ResourceManager.GetString("Google_calendar", resourceCulture); + } + } + + public static string Tex_version { + get { + return ResourceManager.GetString("Tex_version", resourceCulture); + } + } + + public static string Pdf_version { + get { + return ResourceManager.GetString("Pdf_version", resourceCulture); + } + } + + public static string MinDate { + get { + return ResourceManager.GetString("MinDate", resourceCulture); + } + } + + public static string Offline { + get { + return ResourceManager.GetString("Offline", resourceCulture); + } + } + + public static string Product_reference { + get { + return ResourceManager.GetString("Product_reference", resourceCulture); + } + } + + public static string Remember_me { + get { + return ResourceManager.GetString("Remember_me", resourceCulture); + } + } + + public static string Not_Approuved { + get { + return ResourceManager.GetString("Not Approuved", resourceCulture); + } + } + + public static string User_name { + get { + return ResourceManager.GetString("User_name", resourceCulture); + } + } + + public static string Register { + get { + return ResourceManager.GetString("Register", resourceCulture); + } + } + public static string Count { get { return ResourceManager.GetString("Count", resourceCulture); } } - - public static string MaxDate { - get { - return ResourceManager.GetString("MaxDate", resourceCulture); - } - } } } diff --git a/yavscModel/LocalizedText.fr.resx b/yavscModel/LocalizedText.fr.resx index e3bc159c..b4efe4bf 100644 --- a/yavscModel/LocalizedText.fr.resx +++ b/yavscModel/LocalizedText.fr.resx @@ -40,5 +40,5 @@ Demande de rendez-vous Se souvenir du mot de passe Une erreur est survenue à la génération de votre document - + Votre message a été envoyé diff --git a/yavscModel/LocalizedText.resx b/yavscModel/LocalizedText.resx index 3b8a7d98..e9a05923 100644 --- a/yavscModel/LocalizedText.resx +++ b/yavscModel/LocalizedText.resx @@ -40,5 +40,6 @@ Rendez-vous query Remember me Exception occured when rendering your document - + Your message has been sent. + diff --git a/yavscModel/RssFeeds.cs b/yavscModel/RssFeeds.cs new file mode 100644 index 00000000..73ba90a7 --- /dev/null +++ b/yavscModel/RssFeeds.cs @@ -0,0 +1,42 @@ +// +// RssFeeds.cs +// +// Author: +// paul <${AuthorEmail}> +// +// Copyright (c) 2015 paul +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +using System; + +namespace Yavsc.Model +{ + public class RssFeedsEntry { + + public string Title { get ; set; } + public string Description { get ; set; } + public DateTime PubDate { get ; set; } + public string Link { get ; set; } + } + + public class RssFeedsChannel { + public string Title { get ; set; } + public string Description { get ; set; } + public DateTime LastBuildDate { get ; set; } + public string Link { get ; set; } + public RssFeedsEntry[] Entries; + } + +} + diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj index 9c589977..83b21e07 100644 --- a/yavscModel/YavscModel.csproj +++ b/yavscModel/YavscModel.csproj @@ -100,6 +100,7 @@ +