* LocalizedText.resx:

* LocalizedText.fr.resx:
* RssFeedsFormatter.cs:
* LocalizedText.Designer.cs: 

* Web.csproj:
* Contact.aspx:
* AOEMail.aspx:
* AssemblyInfo.aspx:
* ReferencedAssemblies.aspx: refactoring

* RssFeeds.cs: Rss feeds in progress

* HomeController.cs: - refactoring
- fixes contact page


* style.css: css for textarea and input

* Index.aspx: Contact & Assembly info in index

* YavscModel.csproj: Rss feeds
vnext
Paul Schneider 10 years ago
parent 2f6146c0f7
commit 7694f4d8b3
13 changed files with 261 additions and 63 deletions

@ -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="" });
}
}
}
}
}

@ -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 <http://www.gnu.org/licenses/>.
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 = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
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 ());
}
}
}
}

@ -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;

@ -1,2 +0,0 @@
<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>

@ -1,9 +1,12 @@
<%@ Page Title="Yavsc - indexe" Language="C#" Inherits="System.Web.Mvc.ViewPage<IEnumerable<System.Reflection.AssemblyName>>" MasterPageFile="~/Models/App.master"%>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<p><%= GetType().Assembly.FullName %></p>
<p>
<ul>
<% foreach (System.Reflection.AssemblyName item in Model) { %>
<li><%= item.FullName %></li>
<% } %>
</ul>
</p>
</asp:Content>

@ -0,0 +1,23 @@
<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
<% using (Html.BeginForm("Contact", "Home")) { %>
<p>
<%= Html.Label("email") %>:
<%= Html.ValidationMessage("email") %><br/>
<%= Html.TextBox("email") %>
</p>
<p>
<%= Html.Label("reason") %>:
<%= Html.ValidationMessage("reason") %><br/>
<%= Html.TextBox("reason") %>
</p>
<p>
<%= Html.Label("body") %>:
<%= Html.ValidationMessage("body") %><br/>
<%= Html.TextArea("body") %>
</p>
<input type="submit">
<% } %>
</asp:Content>

@ -6,6 +6,9 @@
<br/><a href="http://unefenetresurlemonde.over-blog.com/article-34325590.html">Ghost Dog, la Voie du samouraï</a>
</p><div>
<%= Html.ActionLink("Les blogs","Index","Blogs",null, new { @class="actionlink" }) %>
<%= Html.ActionLink("Contact","Contact") %>
<%= Html.ActionLink("Version des librairies","AssemblyInfo") %>
</div>
</asp:Content>

@ -174,6 +174,7 @@
<Compile Include="Helpers\Google\Calendar.cs" />
<Compile Include="Controllers\TemplateException.cs" />
<Compile Include="Formatters\ErrorHtmlFormatter.cs" />
<Compile Include="Formatters\RssFeedsFormatter.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Web.config" />
@ -204,7 +205,6 @@
<Content Include="Views\Blogs\TitleNotFound.aspx" />
<Content Include="Views\FrontOffice\ProductCategory.aspx" />
<Content Include="Views\FrontOffice\Product.aspx" />
<Content Include="Views\Home\AOEMail.aspx" />
<Content Include="errors\GeneralError.aspx" />
<Content Include="errors\PageNotFound.aspx" />
<Content Include="Views\FrontOffice\Service.aspx" />
@ -246,7 +246,6 @@
<Content Include="Theme\dark\style.css" />
<Content Include="Views\FrontOffice\Estimates.aspx" />
<Content Include="images\pgsql.png" />
<Content Include="Views\Home\ReferencedAssemblies.aspx" />
<Content Include="Catalog.xml" />
<Content Include="RegistrationMail.txt" />
<Content Include="Views\FrontOffice\Writting.ascx" />
@ -631,6 +630,8 @@
<Content Include="Scripts\datepicker-en-GB.js" />
<Content Include="Scripts\datepicker-fr.js" />
<Content Include="Views\Google\GoogleErrorMessage.aspx" />
<Content Include="Views\Home\Contact.aspx" />
<Content Include="Views\Home\AssemblyInfo.aspx" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

@ -46,105 +46,105 @@ namespace Yavsc.Model {
}
}
public static string Preview {
public static string Unitary_cost {
get {
return ResourceManager.GetString("Preview", resourceCulture);
return ResourceManager.GetString("Unitary_cost", resourceCulture);
}
}
public static string Register {
public static string Welcome {
get {
return ResourceManager.GetString("Register", resourceCulture);
return ResourceManager.GetString("Welcome", resourceCulture);
}
}
public static string Unitary_cost {
public static string UserName {
get {
return ResourceManager.GetString("Unitary_cost", resourceCulture);
return ResourceManager.GetString("UserName", resourceCulture);
}
}
public static string Not_Approuved {
public static string Ciffer {
get {
return ResourceManager.GetString("Not Approuved", resourceCulture);
return ResourceManager.GetString("Ciffer", resourceCulture);
}
}
public static string Remove {
public static string Date_search {
get {
return ResourceManager.GetString("Remove", resourceCulture);
return ResourceManager.GetString("Date_search", resourceCulture);
}
}
public static string Online {
public static string MaxDate {
get {
return ResourceManager.GetString("Online", resourceCulture);
return ResourceManager.GetString("MaxDate", resourceCulture);
}
}
public static string access_denied {
public static string Remove {
get {
return ResourceManager.GetString("access_denied", resourceCulture);
return ResourceManager.GetString("Remove", resourceCulture);
}
}
public static string Product_reference {
public static string Title {
get {
return ResourceManager.GetString("Product_reference", resourceCulture);
return ResourceManager.GetString("Title", resourceCulture);
}
}
public static string Google_error {
public static string Consultant {
get {
return ResourceManager.GetString("Google_error", resourceCulture);
return ResourceManager.GetString("Consultant", resourceCulture);
}
}
public static string Welcome {
public static string access_denied {
get {
return ResourceManager.GetString("Welcome", resourceCulture);
return ResourceManager.GetString("access_denied", resourceCulture);
}
}
public static string Remember_me {
public static string User_List {
get {
return ResourceManager.GetString("Remember_me", resourceCulture);
return ResourceManager.GetString("User List", resourceCulture);
}
}
public static string Title {
public static string Message_sent {
get {
return ResourceManager.GetString("Title", resourceCulture);
return ResourceManager.GetString("Message_sent", resourceCulture);
}
}
public static string UserName {
public static string DocTemplateException {
get {
return ResourceManager.GetString("UserName", resourceCulture);
return ResourceManager.GetString("DocTemplateException", resourceCulture);
}
}
public static string Offline {
public static string Preview {
get {
return ResourceManager.GetString("Offline", resourceCulture);
return ResourceManager.GetString("Preview", resourceCulture);
}
}
public static string Ciffer {
public static string Google_error {
get {
return ResourceManager.GetString("Ciffer", resourceCulture);
return ResourceManager.GetString("Google_error", resourceCulture);
}
}
public static string Pdf_version {
public static string Description {
get {
return ResourceManager.GetString("Pdf_version", resourceCulture);
return ResourceManager.GetString("Description", resourceCulture);
}
}
public static string Date_search {
public static string Online {
get {
return ResourceManager.GetString("Date_search", resourceCulture);
return ResourceManager.GetString("Online", resourceCulture);
}
}
@ -154,57 +154,63 @@ namespace Yavsc.Model {
}
}
public static string DocTemplateException {
public static string Tex_version {
get {
return ResourceManager.GetString("DocTemplateException", resourceCulture);
return ResourceManager.GetString("Tex_version", resourceCulture);
}
}
public static string Description {
public static string Pdf_version {
get {
return ResourceManager.GetString("Description", resourceCulture);
return ResourceManager.GetString("Pdf_version", resourceCulture);
}
}
public static string User_name {
public static string MinDate {
get {
return ResourceManager.GetString("User_name", resourceCulture);
return ResourceManager.GetString("MinDate", resourceCulture);
}
}
public static string User_List {
public static string Offline {
get {
return ResourceManager.GetString("User List", resourceCulture);
return ResourceManager.GetString("Offline", resourceCulture);
}
}
public static string MinDate {
public static string Product_reference {
get {
return ResourceManager.GetString("MinDate", resourceCulture);
return ResourceManager.GetString("Product_reference", resourceCulture);
}
}
public static string Tex_version {
public static string Remember_me {
get {
return ResourceManager.GetString("Tex_version", resourceCulture);
return ResourceManager.GetString("Remember_me", resourceCulture);
}
}
public static string Consultant {
public static string Not_Approuved {
get {
return ResourceManager.GetString("Consultant", resourceCulture);
return ResourceManager.GetString("Not Approuved", resourceCulture);
}
}
public static string Count {
public static string User_name {
get {
return ResourceManager.GetString("Count", resourceCulture);
return ResourceManager.GetString("User_name", resourceCulture);
}
}
public static string MaxDate {
public static string Register {
get {
return ResourceManager.GetString("MaxDate", resourceCulture);
return ResourceManager.GetString("Register", resourceCulture);
}
}
public static string Count {
get {
return ResourceManager.GetString("Count", resourceCulture);
}
}
}

@ -40,5 +40,5 @@
<data name="Date_search"><value>Demande de rendez-vous</value></data>
<data name="Remember_me"><value>Se souvenir du mot de passe</value></data>
<data name="DocTemplateException"><value>Une erreur est survenue à la génération de votre document</value></data>
<data name="Message_sent"><value>Votre message a été envoyé</value></data>
</root>

@ -40,5 +40,6 @@
<data name="Date_search"><value>Rendez-vous query</value></data>
<data name="Remember_me"><value>Remember me</value></data>
<data name="DocTemplateException"><value>Exception occured when rendering your document</value></data>
<data name="Message_sent"><value>Your message has been sent.</value></data>
</root>

@ -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 <http://www.gnu.org/licenses/>.
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;
}
}

@ -100,6 +100,7 @@
<Compile Include="IViewRenderer.cs" />
<Compile Include="ViewRenderer.cs" />
<Compile Include="Google\GoogleErrorMessage.cs" />
<Compile Include="RssFeeds.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>

Loading…