Mise en forme du message de contact au préstataire
* Sent.aspx: Vue de confirmation du messag envoyé * PerformerContact.cs: modèle de donnnée d'un message * 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é * 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
This commit is contained in:
parent
a14e63d26f
commit
3b33be013c
20 changed files with 283 additions and 91 deletions
|
|
@ -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}",
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
|
||||
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -1,3 +1,31 @@
|
|||
2015-12-30 Paul Schneider <paul@pschneider.fr>
|
||||
|
||||
* 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 <paul@pschneider.fr>
|
||||
|
||||
* ResetPassword.txt: Un message pour le mot de passe oublié
|
||||
|
|
|
|||
|
|
@ -1,28 +1,29 @@
|
|||
using System;
|
||||
using Yavsc;
|
||||
using System.Web.Mvc;
|
||||
using System.Web;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.IO;
|
||||
using Yavsc.Controllers;
|
||||
using System.Collections.Generic;
|
||||
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.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 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 Yavsc.Helpers;
|
||||
using Yavsc.Model;
|
||||
using Yavsc.Model.Calendar;
|
||||
using Yavsc.Model.Circles;
|
||||
using Yavsc.Model.FileSystem;
|
||||
using Yavsc.Model.FrontOffice;
|
||||
using Yavsc.Model.FrontOffice.Catalog;
|
||||
using Yavsc.Model.Google.Api;
|
||||
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));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contact the specified user.
|
||||
/// </summary>
|
||||
/// <param name="user">User.</param>
|
||||
[Authorize]
|
||||
public ActionResult Contact(PerformerContact model)
|
||||
{
|
||||
return View (model);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Send the specified pmsg.
|
||||
/// </summary>
|
||||
/// <param name="pmsg">Pmsg.</param>
|
||||
[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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Command the specified collection.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -71,21 +71,7 @@ namespace Yavsc.Controllers
|
|||
return View (asnlist.ToArray()) ;
|
||||
}
|
||||
|
||||
private static string owneremail = null;
|
||||
/// <summary>
|
||||
/// Gets or sets the owner email.
|
||||
/// </summary>
|
||||
/// <value>The owner email.</value>
|
||||
public static string OwnerEmail {
|
||||
get {
|
||||
if (owneremail == null)
|
||||
owneremail = WebConfigurationManager.AppSettings.Get ("OwnerEMail");
|
||||
return owneremail;
|
||||
}
|
||||
set {
|
||||
owneremail = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Index this instance.
|
||||
/// </summary>
|
||||
|
|
@ -102,6 +88,7 @@ namespace Yavsc.Controllers
|
|||
ViewData["Activities"] = WorkFlowManager.FindActivity(id,true);
|
||||
return View ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Credits this instance.
|
||||
/// </summary>
|
||||
|
|
@ -109,6 +96,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
return View ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// About this instance.
|
||||
/// </summary>
|
||||
|
|
@ -116,12 +104,7 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
return View ();
|
||||
}
|
||||
#if DEBUG
|
||||
public ActionResult Test ()
|
||||
{
|
||||
return View ();
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Contact the specified email, reason and body.
|
||||
/// </summary>
|
||||
|
|
@ -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())
|
||||
|
|
|
|||
|
|
@ -95,7 +95,16 @@ namespace Yavsc.Helpers
|
|||
return admail;
|
||||
}
|
||||
}
|
||||
|
||||
private static string owneremail = WebConfigurationManager.AppSettings.Get ("OwnerEMail");
|
||||
/// <summary>
|
||||
/// Gets or sets the owner email.
|
||||
/// </summary>
|
||||
/// <value>The owner email.</value>
|
||||
public static string OwnerEmail {
|
||||
get {
|
||||
return owneremail;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Sends the activation message.
|
||||
/// </summary>
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
|
|||
$(document).ready(function(){
|
||||
<% foreach (Notification note in (IEnumerable<Notification>) 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)%>); <% } %>
|
||||
<% } %>
|
||||
});
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ self.onScroll = function() {
|
|||
self.notice = function (msg, callback, msgok) {
|
||||
if (!msgok) msgok='Ok';
|
||||
var note = $('<div class="notification">'+msg+'<br></div>');
|
||||
var btn = $('<a class="actionlink"><i class="fa fa-check">'+msgok+'</i></a>');
|
||||
var btn = $('<a class="link"><i class="fa fa-check">'+msgok+'</i></a>');
|
||||
if (callback) btn.click(callback);
|
||||
btn.click(self.dimiss).appendTo(note);
|
||||
note.appendTo("#notifications");
|
||||
|
|
|
|||
|
|
@ -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<PerformerContact>" %>
|
||||
|
||||
<asp:Content ContentPlaceHolderID="MainContent" ID="MainContentContent" runat="server">
|
||||
<div class="bigpanel">
|
||||
|
||||
<p>
|
||||
<%= Html.Translate("ContactThisPerformer") %>
|
||||
<%= Html.Translate("ContactAPerformer") %>
|
||||
</p>
|
||||
<% using (Html.BeginForm("Contact", "Home")) { %>
|
||||
<% using (Html.BeginForm("Send", "FrontOffice")) { %>
|
||||
<%= Html.Translate("Performer") %> : <%= Html.Encode(Model.Performer) %>
|
||||
<%= Html.Hidden("Performer") %>
|
||||
<br>
|
||||
<fieldset style="width:100%">
|
||||
<legend>Message</legend>
|
||||
<p>
|
||||
<%= Html.Label("email",LocalizedText.email) %>:
|
||||
<%= Html.ValidationMessage("email") %><br/>
|
||||
<%= Html.TextBox("email") %>
|
||||
</p>
|
||||
<p>
|
||||
<%= Html.Label("reason",LocalizedText.reason) %>:
|
||||
<%= Html.ValidationMessage("reason") %><br/>
|
||||
<%= Html.TextBox("reason") %>
|
||||
<%= Html.TextBox("reason",null, new { @style="width:100%", @placeholder=LocalizedText.PleaseFillInAReason } ) %>
|
||||
</p>
|
||||
<p>
|
||||
<%= Html.Label("body",LocalizedText.body) %>:
|
||||
<%= Html.ValidationMessage("body") %><br/>
|
||||
<%= Html.TextArea("body",new {@rows="25"}) %>
|
||||
<%= Html.TextArea("body",new {@rows="25", @style="width:100%", @placeholder=LocalizedText.PleaseFillInABody }) %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<input type="submit" value="<%=Html.Translate("Submit")%>">
|
||||
|
|
|
|||
|
|
@ -13,9 +13,8 @@ data-roles="<%=string.Join (" ",Roles.GetRolesForUser (Model.UserName)) %>"
|
|||
</h2>
|
||||
<address>
|
||||
<% if (Membership.GetUser()!=null) { %>
|
||||
<a href="mailto:<%=Model.EMail%>">
|
||||
<a href="<%=Url.RouteUrl("Performance",new { action="Contact", Performer = Model.UserName })%>">
|
||||
<i class="fa fa-envelope"></i>
|
||||
<<%=Html.Encode(Model.EMail)%>>
|
||||
</a>
|
||||
<% } else { %>
|
||||
<i class="fa fa-envelope"></i>
|
||||
|
|
|
|||
8
web/Views/FrontOffice/Sent.aspx
Normal file
8
web/Views/FrontOffice/Sent.aspx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
<%@ Page Title="Front office" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>
|
||||
|
||||
<asp:Content ID="MainContentContent" ContentPlaceHolderID="MainContent" runat="server">
|
||||
|
||||
<%= Html.Translate("YourMessageHasBeenSent") %>
|
||||
Votre message a été envoyé
|
||||
|
||||
</asp:Content>
|
||||
|
|
@ -784,6 +784,7 @@
|
|||
<Content Include="Views\Account\UpdatePassword.aspx" />
|
||||
<Content Include="App_Themes\base\style.css" />
|
||||
<Content Include="Views\FrontOffice\Contact.aspx" />
|
||||
<Content Include="Views\FrontOffice\Sent.aspx" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue