diff --git a/web/App_Code/Global.asax.cs b/web/App_Code/Global.asax.cs index 2880261e..835aeb21 100644 --- a/web/App_Code/Global.asax.cs +++ b/web/App_Code/Global.asax.cs @@ -72,18 +72,26 @@ namespace Yavsc title=UrlParameter.Optional, id=UrlParameter.Optional } ); + routes.MapRoute ( "BlogById", "b/{action}/{postid}", new { controller = "Blogs", action = "Index", postid=UrlParameter.Optional } ); + routes.MapRoute ( "BackCompat", "Blogs/{action}/{user}/{title}", new { controller = "Blogs", action = "Index", user = UrlParameter.Optional, title = UrlParameter.Optional } ); + routes.MapRoute ( + "Performance", + "to/{action}/{Performer}", + new { controller = "FrontOffice", action = "Contact", Performer = UrlParameter.Optional } + ); + routes.MapRoute ( "Default", "{controller}/{action}/{id}", diff --git a/web/App_Themes/base/style.css b/web/App_Themes/base/style.css index e02abfc9..c65238fb 100644 --- a/web/App_Themes/base/style.css +++ b/web/App_Themes/base/style.css @@ -1 +1,2 @@  + diff --git a/web/App_Themes/style.css b/web/App_Themes/style.css index e62055d7..ffaf7edf 100644 --- a/web/App_Themes/style.css +++ b/web/App_Themes/style.css @@ -262,6 +262,10 @@ input, select, textarea { border-width: 1px; font-size: large; } + +.link { cursor: pointer; } + + .performer , .availability { text-align: center; padding: 1em; } .c2 { font-size: small; font-style: italic; } diff --git a/web/ChangeLog b/web/ChangeLog index ba9816a2..d04edb72 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,31 @@ +2015-12-30 Paul Schneider + + * Sent.aspx: Vue de confirmation du messag envoyé + + * Global.asax.cs: ajout d'une route /to/ + + * style.css: rien + + * style.css: forme du pointeur de liens + + * FrontOfficeController.cs: implémente l'envoi d'un e-mail au + préstataire + + * YavscHelpers.cs: + * HomeController.cs: l'e-mail admin est obtenu du helper + global + + * App.master: Corrige les guillemets autour de notifications + web + + * yavsc.js: la class des liens est "link", pas "actionlink" + + * Contact.aspx: mise en forme du formulaire de contact + + * Performer.ascx: lien vers le contact préstataire + + * Yavsc.csproj: ajout de la vue du message envoyé + 2015-12-30 Paul Schneider * ResetPassword.txt: Un message pour le mot de passe oublié diff --git a/web/Controllers/FrontOfficeController.cs b/web/Controllers/FrontOfficeController.cs index 72f1517f..a49eb758 100644 --- a/web/Controllers/FrontOfficeController.cs +++ b/web/Controllers/FrontOfficeController.cs @@ -1,28 +1,29 @@ using System; -using Yavsc; -using System.Web.Mvc; -using System.Web; -using System.Text.RegularExpressions; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Configuration; using System.IO; +using System.Linq; +using System.Net; +using System.Net.Mail; +using System.Text.RegularExpressions; +using System.Threading; +using System.Web; +using System.Web.Mvc; +using System.Web.Profile; +using System.Web.Security; +using Yavsc; using Yavsc.Controllers; -using System.Collections.Generic; +using Yavsc.Helpers; using Yavsc.Model; -using Yavsc.Model.WorkFlow; -using System.Web.Security; -using System.Threading; -using Yavsc.Model.FrontOffice; -using Yavsc.Model.FileSystem; using Yavsc.Model.Calendar; -using System.Configuration; -using Yavsc.Helpers; +using Yavsc.Model.Circles; +using Yavsc.Model.FileSystem; +using Yavsc.Model.FrontOffice; using Yavsc.Model.FrontOffice.Catalog; -using Yavsc.Model.Skill; -using System.Web.Profile; using Yavsc.Model.Google.Api; -using System.Net; -using System.Linq; -using System.ComponentModel.DataAnnotations; -using Yavsc.Model.Circles; +using Yavsc.Model.Skill; +using Yavsc.Model.WorkFlow; namespace Yavsc.Controllers { @@ -238,6 +239,45 @@ namespace Yavsc.Controllers return View (WorkFlowManager.GetCommands (Membership.GetUser ().UserName)); } + /// + /// Contact the specified user. + /// + /// User. + [Authorize] + public ActionResult Contact(PerformerContact model) + { + return View (model); + } + + /// + /// Send the specified pmsg. + /// + /// Pmsg. + [Authorize] + public ActionResult Send(PerformerContact pmsg) + { + var performer = Membership.GetUser (pmsg.Performer); + if (performer == null) + ModelState.AddModelError ("Performer", "This user doesn't exist"); + var user = Membership.GetUser(); + if (ModelState.IsValid) { + using (System.Net.Mail.MailMessage msg = new MailMessage( + YavscHelpers.OwnerEmail, + performer.Email,"[Contact] ("+user.UserName+") "+pmsg.Reason,pmsg.Body)) + { + msg.CC.Add(new MailAddress(YavscHelpers.Admail)); + using (System.Net.Mail.SmtpClient sc = new SmtpClient()) + { + sc.Send (msg); + ViewData.Notify(LocalizedText.Message_sent); + } + } + return View ("Sent"); + } + else + return View ("Contact",pmsg); + } + /// /// Command the specified collection. /// diff --git a/web/Controllers/HomeController.cs b/web/Controllers/HomeController.cs index cc0d847c..cf9e622a 100644 --- a/web/Controllers/HomeController.cs +++ b/web/Controllers/HomeController.cs @@ -71,21 +71,7 @@ namespace Yavsc.Controllers return View (asnlist.ToArray()) ; } - private static string owneremail = null; - /// - /// Gets or sets the owner email. - /// - /// The owner email. - public static string OwnerEmail { - get { - if (owneremail == null) - owneremail = WebConfigurationManager.AppSettings.Get ("OwnerEMail"); - return owneremail; - } - set { - owneremail = value; - } - } + /// /// Index this instance. /// @@ -102,6 +88,7 @@ namespace Yavsc.Controllers ViewData["Activities"] = WorkFlowManager.FindActivity(id,true); return View (); } + /// /// Credits this instance. /// @@ -109,6 +96,7 @@ namespace Yavsc.Controllers { return View (); } + /// /// About this instance. /// @@ -116,12 +104,7 @@ namespace Yavsc.Controllers { return View (); } - #if DEBUG - public ActionResult Test () - { - return View (); - } - #endif + /// /// Contact the specified email, reason and body. /// @@ -142,10 +125,10 @@ namespace Yavsc.Controllers return View (); // requires valid owner and admin email? - if (OwnerEmail == null) + if (YavscHelpers.OwnerEmail == null) throw new Exception ("No site owner!"); - using (System.Net.Mail.MailMessage msg = new MailMessage(email,OwnerEmail,"[Contact] "+reason,body)) + using (System.Net.Mail.MailMessage msg = new MailMessage(email,YavscHelpers.OwnerEmail,"[Contact] "+reason,body)) { msg.CC.Add(new MailAddress(YavscHelpers.Admail)); using (System.Net.Mail.SmtpClient sc = new SmtpClient()) diff --git a/web/Helpers/YavscHelpers.cs b/web/Helpers/YavscHelpers.cs index adfcdbe6..d62609c2 100644 --- a/web/Helpers/YavscHelpers.cs +++ b/web/Helpers/YavscHelpers.cs @@ -95,7 +95,16 @@ namespace Yavsc.Helpers return admail; } } - + private static string owneremail = WebConfigurationManager.AppSettings.Get ("OwnerEMail"); + /// + /// Gets or sets the owner email. + /// + /// The owner email. + public static string OwnerEmail { + get { + return owneremail; + } + } /// /// Sends the activation message. /// @@ -293,8 +302,8 @@ namespace Yavsc.Helpers } public static void Notify(this ViewDataDictionary ViewData, string message, string click_action=null, string clickActionName="Ok") { - Notify(ViewData, new Notification { body = YavscAjaxHelper.QuoteJavascriptString(message), - click_action = click_action, click_action_name = YavscAjaxHelper.QuoteJavascriptString(clickActionName)} ) ; + Notify(ViewData, new Notification { body = message, + click_action = click_action, click_action_name = clickActionName} ) ; } public static void Notify(this ViewDataDictionary ViewData, Notification note) { diff --git a/web/Models/App.master b/web/Models/App.master index dcf793ec..4c5b2aa0 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -50,7 +50,7 @@ var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>'; $(document).ready(function(){ <% foreach (Notification note in (IEnumerable) ViewData ["Notifications"] ) { if (note.click_action == null) {%> Yavsc.notice(<%=Ajax.JString(note.body)%>); <% } -else {%> Yavsc.notice(<%=note.body%>, <%=note.click_action%>, <%=note.click_action_name%>); <% } %> +else {%> Yavsc.notice(<%=Ajax.JString(note.body)%>, <%=note.click_action%>, <%=Ajax.JString(note.click_action_name)%>); <% } %> <% } %> }); diff --git a/web/Scripts/yavsc.js b/web/Scripts/yavsc.js index e2aa0607..8ff54006 100644 --- a/web/Scripts/yavsc.js +++ b/web/Scripts/yavsc.js @@ -64,7 +64,7 @@ self.onScroll = function() { self.notice = function (msg, callback, msgok) { if (!msgok) msgok='Ok'; var note = $('
'+msg+'
'); - var btn = $(''+msgok+''); + var btn = $(''+msgok+''); if (callback) btn.click(callback); btn.click(self.dimiss).appendTo(note); note.appendTo("#notifications"); diff --git a/web/Views/FrontOffice/Contact.aspx b/web/Views/FrontOffice/Contact.aspx index a36131c0..3094f7e1 100644 --- a/web/Views/FrontOffice/Contact.aspx +++ b/web/Views/FrontOffice/Contact.aspx @@ -1,27 +1,26 @@ -<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> +<%@ Page Title="Contact" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
+

-<%= Html.Translate("ContactThisPerformer") %> +<%= Html.Translate("ContactAPerformer") %>

-<% using (Html.BeginForm("Contact", "Home")) { %> +<% using (Html.BeginForm("Send", "FrontOffice")) { %> +<%= Html.Translate("Performer") %> : <%= Html.Encode(Model.Performer) %> +<%= Html.Hidden("Performer") %> +
Message

-<%= Html.Label("email",LocalizedText.email) %>: -<%= Html.ValidationMessage("email") %>
-<%= Html.TextBox("email") %> -

-

<%= Html.Label("reason",LocalizedText.reason) %>: <%= Html.ValidationMessage("reason") %>
-<%= Html.TextBox("reason") %> +<%= Html.TextBox("reason",null, new { @style="width:100%", @placeholder=LocalizedText.PleaseFillInAReason } ) %>

<%= Html.Label("body",LocalizedText.body) %>: <%= Html.ValidationMessage("body") %>
-<%= Html.TextArea("body",new {@rows="25"}) %> +<%= Html.TextArea("body",new {@rows="25", @style="width:100%", @placeholder=LocalizedText.PleaseFillInABody }) %>

"> diff --git a/web/Views/FrontOffice/Performer.ascx b/web/Views/FrontOffice/Performer.ascx index f2f2692b..88205d81 100644 --- a/web/Views/FrontOffice/Performer.ascx +++ b/web/Views/FrontOffice/Performer.ascx @@ -13,9 +13,8 @@ data-roles="<%=string.Join (" ",Roles.GetRolesForUser (Model.UserName)) %>"
<% if (Membership.GetUser()!=null) { %> - +"> -<<%=Html.Encode(Model.EMail)%>> <% } else { %> diff --git a/web/Views/FrontOffice/Sent.aspx b/web/Views/FrontOffice/Sent.aspx new file mode 100644 index 00000000..1c63a637 --- /dev/null +++ b/web/Views/FrontOffice/Sent.aspx @@ -0,0 +1,8 @@ +<%@ Page Title="Front office" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> + + + +<%= Html.Translate("YourMessageHasBeenSent") %> +Votre message a été envoyé + + diff --git a/web/Yavsc.csproj b/web/Yavsc.csproj index 5f8830f0..f23845a4 100644 --- a/web/Yavsc.csproj +++ b/web/Yavsc.csproj @@ -784,6 +784,7 @@ + diff --git a/yavscModel/ChangeLog b/yavscModel/ChangeLog index d91af018..7b9b011c 100644 --- a/yavscModel/ChangeLog +++ b/yavscModel/ChangeLog @@ -1,3 +1,14 @@ +2015-12-30 Paul Schneider + + * PerformerContact.cs: modèle de donnnée d'un message + + * LocalizedText.resx: + * LocalizedText.fr.resx: + * LocalizedText.Designer.cs: + * LocalizedText.fr.Designer.cs: traductions + + * YavscModel.csproj: ajout du modèle de données d'un message + 2015-12-30 Paul Schneider * UpdatePassword.cs: modèle de la modification de mot de passe diff --git a/yavscModel/FrontOffice/PerformerContact.cs b/yavscModel/FrontOffice/PerformerContact.cs new file mode 100644 index 00000000..a2c55fad --- /dev/null +++ b/yavscModel/FrontOffice/PerformerContact.cs @@ -0,0 +1,38 @@ +// +// PerformerContact.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 GNU GPL +// +// 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.ComponentModel.DataAnnotations; + +namespace Yavsc.Model.FrontOffice +{ + public class PerformerContact + { + [Required] + public string Performer { get; set; } + + [Required] + public string Reason { get; set; } + + [Required] + public string Body { get; set; } + } +} + diff --git a/yavscModel/LocalizedText.Designer.cs b/yavscModel/LocalizedText.Designer.cs index 26cad0f9..1d1acc4b 100644 --- a/yavscModel/LocalizedText.Designer.cs +++ b/yavscModel/LocalizedText.Designer.cs @@ -46,12 +46,6 @@ namespace Yavsc.Model { } } - public static string Private_circle { - get { - return ResourceManager.GetString("Private_circle", resourceCulture); - } - } - public static string Comment { get { return ResourceManager.GetString("Comment", resourceCulture); @@ -124,9 +118,9 @@ namespace Yavsc.Model { } } - public static string UsersInRole { + public static string PleaseFillInAReason { get { - return ResourceManager.GetString("UsersInRole", resourceCulture); + return ResourceManager.GetString("PleaseFillInAReason", resourceCulture); } } @@ -412,6 +406,12 @@ namespace Yavsc.Model { } } + public static string to { + get { + return ResourceManager.GetString("to", resourceCulture); + } + } + public static string EndHour { get { return ResourceManager.GetString("EndHour", resourceCulture); @@ -430,6 +430,12 @@ namespace Yavsc.Model { } } + public static string ContactAPerformer { + get { + return ResourceManager.GetString("ContactAPerformer", resourceCulture); + } + } + public static string Needs { get { return ResourceManager.GetString("Needs", resourceCulture); @@ -478,9 +484,9 @@ namespace Yavsc.Model { } } - public static string ContactThisPerformer { + public static string Private_circle { get { - return ResourceManager.GetString("ContactThisPerformer", resourceCulture); + return ResourceManager.GetString("Private_circle", resourceCulture); } } @@ -556,6 +562,12 @@ namespace Yavsc.Model { } } + public static string YourMessageHasBeenSent { + get { + return ResourceManager.GetString("YourMessageHasBeenSent", resourceCulture); + } + } + public static string UserNotInThisRole { get { return ResourceManager.GetString("UserNotInThisRole", resourceCulture); @@ -628,6 +640,12 @@ namespace Yavsc.Model { } } + public static string PleaseFillInABody { + get { + return ResourceManager.GetString("PleaseFillInABody", resourceCulture); + } + } + public static string PhotoUpdated { get { return ResourceManager.GetString("PhotoUpdated", resourceCulture); @@ -658,9 +676,9 @@ namespace Yavsc.Model { } } - public static string DocTemplateException { + public static string UsersInRole { get { - return ResourceManager.GetString("DocTemplateException", resourceCulture); + return ResourceManager.GetString("UsersInRole", resourceCulture); } } @@ -772,6 +790,12 @@ namespace Yavsc.Model { } } + public static string DocTemplateException { + get { + return ResourceManager.GetString("DocTemplateException", resourceCulture); + } + } + public static string DoNotPublishMyActivity { get { return ResourceManager.GetString("DoNotPublishMyActivity", resourceCulture); @@ -838,6 +862,12 @@ namespace Yavsc.Model { } } + public static string Performer { + get { + return ResourceManager.GetString("Performer", resourceCulture); + } + } + public static string NoSkillforthisactivity { get { return ResourceManager.GetString("NoSkillforthisactivity", resourceCulture); diff --git a/yavscModel/LocalizedText.fr.Designer.cs b/yavscModel/LocalizedText.fr.Designer.cs index 3d69fc13..c84b107a 100644 --- a/yavscModel/LocalizedText.fr.Designer.cs +++ b/yavscModel/LocalizedText.fr.Designer.cs @@ -100,9 +100,9 @@ namespace Yavsc.Model { } } - public static string Welcome { + public static string User_name { get { - return ResourceManager.GetString("Welcome", resourceCulture); + return ResourceManager.GetString("User_name", resourceCulture); } } @@ -112,9 +112,9 @@ namespace Yavsc.Model { } } - public static string UsersInRole { + public static string PleaseFillInAReason { get { - return ResourceManager.GetString("UsersInRole", resourceCulture); + return ResourceManager.GetString("PleaseFillInAReason", resourceCulture); } } @@ -400,6 +400,12 @@ namespace Yavsc.Model { } } + public static string to { + get { + return ResourceManager.GetString("to", resourceCulture); + } + } + public static string EndHour { get { return ResourceManager.GetString("EndHour", resourceCulture); @@ -418,6 +424,12 @@ namespace Yavsc.Model { } } + public static string ContactAPerformer { + get { + return ResourceManager.GetString("ContactAPerformer", resourceCulture); + } + } + public static string Needs { get { return ResourceManager.GetString("Needs", resourceCulture); @@ -472,12 +484,6 @@ namespace Yavsc.Model { } } - public static string ContactThisPerformer { - get { - return ResourceManager.GetString("ContactThisPerformer", resourceCulture); - } - } - public static string OnlyAuthorizedMayContact { get { return ResourceManager.GetString("OnlyAuthorizedMayContact", resourceCulture); @@ -562,12 +568,6 @@ namespace Yavsc.Model { } } - public static string User_name { - get { - return ResourceManager.GetString("User_name", resourceCulture); - } - } - public static string Item_added_to_basket { get { return ResourceManager.GetString("Item_added_to_basket", resourceCulture); @@ -580,6 +580,12 @@ namespace Yavsc.Model { } } + public static string Welcome { + get { + return ResourceManager.GetString("Welcome", resourceCulture); + } + } + public static string YourEstimates { get { return ResourceManager.GetString("YourEstimates", resourceCulture); @@ -622,6 +628,12 @@ namespace Yavsc.Model { } } + public static string PleaseFillInABody { + get { + return ResourceManager.GetString("PleaseFillInABody", resourceCulture); + } + } + public static string PhotoUpdated { get { return ResourceManager.GetString("PhotoUpdated", resourceCulture); @@ -652,9 +664,9 @@ namespace Yavsc.Model { } } - public static string DocTemplateException { + public static string UsersInRole { get { - return ResourceManager.GetString("DocTemplateException", resourceCulture); + return ResourceManager.GetString("UsersInRole", resourceCulture); } } @@ -760,6 +772,12 @@ namespace Yavsc.Model { } } + public static string DocTemplateException { + get { + return ResourceManager.GetString("DocTemplateException", resourceCulture); + } + } + public static string DoNotPublishMyActivity { get { return ResourceManager.GetString("DoNotPublishMyActivity", resourceCulture); @@ -826,6 +844,12 @@ namespace Yavsc.Model { } } + public static string Performer { + get { + return ResourceManager.GetString("Performer", resourceCulture); + } + } + public static string NoSkillforthisactivity { get { return ResourceManager.GetString("NoSkillforthisactivity", resourceCulture); diff --git a/yavscModel/LocalizedText.fr.resx b/yavscModel/LocalizedText.fr.resx index 00737901..45586d6a 100644 --- a/yavscModel/LocalizedText.fr.resx +++ b/yavscModel/LocalizedText.fr.resx @@ -41,7 +41,7 @@ Cercles Commentaire Consultant - Contactez ce préstataire + Contactez un préstataire Nombre Créer Demande de rendez-vous @@ -109,9 +109,12 @@ Version Pdf Date de la prestation Perstataires + Préstataire Personne Photo Photo mise à jour + S'il vous plait, saisissez un corps de message + S'il vous plait, saisissez une réson, un sujet pour votre message Posté Date souhaitée PrévisualiserPrévisualiser le document @@ -145,6 +148,7 @@ Selon son calendier Google, ce perstataire pourrait ne pas être disponible ce Ce prestataire n'a pas mis de calendrier à disposition. Titre + pour Coût unitaire Liste des utilisateurs Nom d'utilisateur diff --git a/yavscModel/LocalizedText.resx b/yavscModel/LocalizedText.resx index 53f7c26e..2f9b571a 100644 --- a/yavscModel/LocalizedText.resx +++ b/yavscModel/LocalizedText.resx @@ -36,7 +36,7 @@ Book a software editor Catalog Create - Contact this performer + Contact a performer Count Please, choose a description Please, choose a title @@ -113,9 +113,12 @@ Pdf version Performance Date Performers + Performer Person Photo Photo updated + Please fill in a body + Please, fill in a reason Posted Prefered date Previewcomment on preview @@ -150,6 +153,7 @@ This performer gives access to his calendar and it appears he should not be available this ThisPerformerDoesntGiveAccessToHisCalendar Title + to Unitary_cost User List User name @@ -172,5 +176,5 @@ Your skills, your special fields, the scope of your activities You posts Your profile - + Your message has been sent diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj index a37d4762..95c7274c 100644 --- a/yavscModel/YavscModel.csproj +++ b/yavscModel/YavscModel.csproj @@ -255,6 +255,7 @@ +