diff --git a/NpgsqlContentProvider/ChangeLog b/NpgsqlContentProvider/ChangeLog index 8252d469..3f8d2ff6 100644 --- a/NpgsqlContentProvider/ChangeLog +++ b/NpgsqlContentProvider/ChangeLog @@ -1,3 +1,8 @@ +2015-11-26 Paul Schneider + + * NpgsqlContentProvider.cs: reccupère la photo activité en + base de données + 2015-11-25 Paul Schneider * NpgsqlContentProvider.cs: implemente la gestion des diff --git a/NpgsqlContentProvider/NpgsqlContentProvider.cs b/NpgsqlContentProvider/NpgsqlContentProvider.cs index 039aec01..793fde44 100644 --- a/NpgsqlContentProvider/NpgsqlContentProvider.cs +++ b/NpgsqlContentProvider/NpgsqlContentProvider.cs @@ -32,7 +32,7 @@ namespace Yavsc using (NpgsqlConnection cnx = CreateConnection ()) { cnx.Open (); using (NpgsqlCommand cmd = cnx.CreateCommand ()) { - cmd.CommandText = @"select meacode, title, cmnt + cmd.CommandText = @"select meacode, title, cmnt, photo from activity where meacode = :code and applicationname = :app"; cmd.Parameters.AddWithValue ("code", MEACode); cmd.Parameters.AddWithValue ("app", applicationName); @@ -42,7 +42,8 @@ namespace Yavsc result = new Activity () { Id = rdr.GetString (0), Title = rdr.GetString (1), - Comment = rdr.GetString (2) + Comment = rdr.GetString (2), + Photo = rdr.GetString (3) }; } } @@ -65,7 +66,7 @@ namespace Yavsc cnx.Open (); using (NpgsqlCommand cmd = cnx.CreateCommand ()) { cmd.CommandText = (exerted) ? - @"SELECT a.meacode, a.title, a.cmnt + @"SELECT a.meacode, a.title, a.cmnt, a.photo FROM activity a, profiledata d, profiles p, users u WHERE u.username = p.username AND u.applicationname = p.applicationname @@ -75,7 +76,7 @@ namespace Yavsc AND u.islockedout = FALSE AND a.title like :pat ORDER BY a.meacode " : - @"SELECT meacode, title, cmnt + @"SELECT meacode, title, cmnt, photo FROM activity WHERE title LIKE :pat ORDER BY meacode "; @@ -88,7 +89,8 @@ namespace Yavsc acties.Add (new Activity () { Id = rdr.GetString (0), Title = rdr.GetString (1), - Comment = rdr.GetString (2) + Comment = rdr.GetString (2), + Photo = rdr.GetString (3) }); } } diff --git a/web/ApiControllers/BackOfficeController.cs b/web/ApiControllers/BackOfficeController.cs new file mode 100644 index 00000000..37fcf075 --- /dev/null +++ b/web/ApiControllers/BackOfficeController.cs @@ -0,0 +1,66 @@ +// +// BackOfficeController.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 Yavsc.Model.Google; +using Yavsc.Model.Calendar; +using Yavsc.Helpers; +using Yavsc.Model.Circles; +using System.Collections.Generic; +using System.Web.Profile; +using Yavsc.Helpers.Google; +using System.Web.Security; + +namespace Yavsc.ApiControllers +{ + /// + /// Back office controller. + /// + public class BackOfficeController: YavscController + { + /// + /// Notifies the event. + /// + /// Evpub. + [Authorize(Roles="BackOffice")] + public MessageWithPayloadResponse NotifyEvent(EventPub evpub) { + return GoogleHelpers.NotifyEvent(evpub); + } + + /// + /// Sets the registration identifier. + /// + /// Registration identifier. + [Authorize] + public void SetRegistrationId(string registrationId) + { + // TODO set registration id + setRegistrationId (User.Identity.Name, registrationId); + } + + private void setRegistrationId(string username, string regid) { + ProfileBase pr = ProfileBase.Create(username); + pr.SetPropertyValue ("gregid", regid); + pr.Save (); + } + + } +} + diff --git a/web/ApiControllers/BlogsController.cs b/web/ApiControllers/BlogsController.cs index 5290f2c0..f9aa0ea5 100644 --- a/web/ApiControllers/BlogsController.cs +++ b/web/ApiControllers/BlogsController.cs @@ -14,9 +14,6 @@ using System.Diagnostics; using Yavsc.Formatters; using Yavsc.Model; - - - namespace Yavsc.ApiControllers { /// @@ -183,6 +180,7 @@ namespace Yavsc.ApiControllers if (model.Rate < 0 || model.Rate > 100) ModelState.AddModelError ("Rate", "0<=Rate<=100"); else { + BlogManager.GetForEditing (model.Id); BlogManager.Rate (model.Id, model.Rate); } } @@ -205,6 +203,7 @@ namespace Yavsc.ApiControllers [Authorize, HttpPost, ValidateAjaxAttribute] public void SetPhoto(long id, [FromBody] string photo) { + BlogManager.GetForEditing (id); BlogManager.UpdatePostPhoto (id, photo); } diff --git a/web/ApiControllers/CalendarController.cs b/web/ApiControllers/CalendarController.cs index 686c7730..3cf74e57 100644 --- a/web/ApiControllers/CalendarController.cs +++ b/web/ApiControllers/CalendarController.cs @@ -28,6 +28,7 @@ using System.Web.Profile; using Yavsc.Model.Circles; using Yavsc.Model.Calendar; using System.Web.Http.Routing; +using System.Collections.Generic; namespace Yavsc.ApiControllers @@ -168,36 +169,7 @@ namespace Yavsc.ApiControllers } } - /// - /// Sets the registration identifier. - /// - /// Registration identifier. - [Authorize] - public void SetRegistrationId(string registrationId) - { - // TODO set registration id - setRegistrationId (Membership.GetUser ().UserName, registrationId); - } - - private void setRegistrationId(string username, string regid) { - ProfileBase pr = ProfileBase.Create(username); - pr.SetPropertyValue ("gregid", regid); - } - /// - /// Notifies the event. - /// - /// Evpub. - public MessageWithPayloadResponse NotifyEvent(EventPub evpub) { - SimpleJsonPostMethod,MessageWithPayloadResponse> r = - new SimpleJsonPostMethod,MessageWithPayloadResponse>( - "https://gcm-http.googleapis.com/gcm/send"); - using (r) { - var msg = new MessageWithPayload () { data = new YaEvent[] { (YaEvent)evpub } }; - msg.to = string.Join (" ", Circle.Union (evpub.Circles)); - return r.Invoke (msg); - } - } } } diff --git a/web/App_Code/Sql/activity.sql b/web/App_Code/Sql/activity.sql index c766f789..c07008eb 100644 --- a/web/App_Code/Sql/activity.sql +++ b/web/App_Code/Sql/activity.sql @@ -4,19 +4,19 @@ CREATE TABLE activity ( - meacode character varying(512) NOT NULL, -- Identifiant de l'activité, à terme, il faudrait ajouter un champ à cette id: le code pays.... title character varying(2048) NOT NULL, -- Description textuelle du code APE applicationname character varying(255) NOT NULL, cmnt character varying, -- a long description for this activity - CONSTRAINT activity_pkey PRIMARY KEY (meacode, applicationname) + meacode character varying(512) NOT NULL, -- Identifiant de l'activité, à terme, il faudrait ajouter un champ à cette id: le code pays.... + photo character varying(512) -- a photo url, as a front image for this activity ) WITH ( OIDS=FALSE ); -ALTER TABLE activity - OWNER TO yavscdev; COMMENT ON TABLE activity IS 'Activités prises en charge par l''application désignée'; +COMMENT ON COLUMN activity.title IS 'Description textuelle du code APE'; +COMMENT ON COLUMN activity.cmnt IS 'a long description for this activity'; COMMENT ON COLUMN activity.meacode IS 'Identifiant de l''activité, à terme, il faudrait ajouter un champ à cette id: le code pays. Definition francaise: @@ -25,6 +25,5 @@ une lettre en cinquième position. Exemple: ''71.12B'' => "Ingénierie, études techniques" '; -COMMENT ON COLUMN activity.title IS 'Description textuelle du code APE'; -COMMENT ON COLUMN activity.cmnt IS 'a long description for this activity'; +COMMENT ON COLUMN activity.photo IS 'a photo url, as a front image for this activity'; diff --git a/web/App_Themes/clear/style.css b/web/App_Themes/clear/style.css index 8878a367..c37e6b7f 100644 --- a/web/App_Themes/clear/style.css +++ b/web/App_Themes/clear/style.css @@ -1,7 +1,9 @@ +@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,700); body { background-color: grey; color: #303030; + font-family: 'Open Sans', sans-serif; } .tagname { color: #D0FFD0; } .tagname:hover { background-color: red; } diff --git a/web/App_Themes/dark/style.css b/web/App_Themes/dark/style.css index 9e88163e..32f2bfff 100644 --- a/web/App_Themes/dark/style.css +++ b/web/App_Themes/dark/style.css @@ -6,7 +6,7 @@ } body { - font-family: 'Arial', cursive; + font-family: 'Open Sans', sans-serif; background-color: black; color: #D0FFD0; } diff --git a/web/App_Themes/style.css b/web/App_Themes/style.css index 921dc1d2..fc9ab5e0 100644 --- a/web/App_Themes/style.css +++ b/web/App_Themes/style.css @@ -1,6 +1,5 @@ body { - font-family: 'Arial', cursive; padding: 0; margin: 0; } @@ -175,7 +174,6 @@ content: ")"; .usertitleref { border-radius: 1em; - font-family: 'Arial', cursive; padding: 1em; } .editable { @@ -239,7 +237,6 @@ legend { border-style: solid; border-width:1px; cursor: pointer; - font-family: 'Arial', cursive; padding: 1em; } @@ -247,7 +244,6 @@ input, select, textarea { border-radius:1em; border-style: solid; border-width:1px; - font-family: 'Arial', cursive; } .code { diff --git a/web/ChangeLog b/web/ChangeLog index 3cad5fc0..15770b1d 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,84 @@ +2015-11-26 Paul Schneider + + * BackOfficeController.cs: Impléménte un accès à l'API back + office pour l'envoi d'une notification aux mobiles des cercles + séléctionné de l'utilisateur + + * NotifyEvent.aspx: Implemente un formulaire d'envoi d'une + notification mobile + + * NotifyEventResponse.aspx: initie une page de resultat à la + notification mobile + + * BlogsController.cs: En attendant mieux, les billets de blog + sont noté par leur auteur, ou un admin. + + * CalendarController.cs: Les fontions de notification GCM et + de declaration d'enregistrement GCM + partent dans le controlleur back office. + + * activity.sql: ajoute la photo activité dans la definition du + modèle de données Npgsql + + * style.css: La fonte de caractère "Open Sans" (Google fonts) + pour le thème "clear" + + * style.css: La fonte de caractère "Open Sans" (Google fonts) + pour le thème "dark" aussi + + * style.css: pas de fonte de caractère dans la feuille de + style basique. + + * BackOfficeController.cs: Impléménte un accès web back office + pour l'envoi d'une notification aux mobiles des cercles + séléctionné de l'utilisateur + + * BlogsController.cs: Fixe la page de garde du blogspot en cas + d'absence + de billet à publier publiquement. + + * FrontOfficeController.cs: la fontion booking est maintenant + censée conerner uniquement une activité, + dont le code APE est donné en dernière partie de la route de + l'Url, ou en argument `id`. + + + * HomeController.cs: La page d'accueil présente maintenant les + activités mises en oeuvre par au moins un utilisateur + enregistré, validé et non vérouillé. + Le titre de l'activité est un lien vers la methode de + reservation simple. + + * GoogleHelpers.cs: recoit l'implementation de la methode de + notification mobile + + * SimpleJsonPostMethod.cs: Fixe l'envoi en UTF-8 + + * App.master: fonte de caractère pour le lien vers "Vos + billets" + + * parallax.js: fixe la différence de traitement entre + l'horizontale et la verticale + + * Profile.aspx: ajoute le sommaire de la validation + + * Index.aspx: initie un index pour le back office + + * Activities.aspx: nettoye la console de log javascript + + * Booking.aspx: ajoute le champ caché au formulaire de resa + + * Index.aspx: affiche les services fournis sur le site, par + des utilisateur enregistrés validés non bloqué. + + * Web.config: rends l'id Google d'enregistrement GCM + accessible au utilisateurs anonymes, + qui voudraient commander ou interagir avec l'application, sans + avoir à créer de compte sur le site. + + * Web.csproj: ajoute le contrôleur du back office, et le + formulaire de notification mobile + 2015-11-25 Paul Schneider * Activities.aspx: implémente la vue Html de la liste éditable diff --git a/web/Controllers/BackOfficeController.cs b/web/Controllers/BackOfficeController.cs index 882a61a2..e390c4f7 100644 --- a/web/Controllers/BackOfficeController.cs +++ b/web/Controllers/BackOfficeController.cs @@ -4,6 +4,10 @@ using System.Linq; using System.Web; using System.Web.Mvc; using Yavsc.Admin; +using Yavsc.Model.Calendar; +using Yavsc.Helpers.Google; +using Yavsc.Model.Circles; +using System.Web.Security; namespace Yavsc.Controllers @@ -21,5 +25,26 @@ namespace Yavsc.Controllers { return View (); } + + /// + /// Notifies the event. + /// + /// The event. + /// Evpub. + public ActionResult NotifyEvent(EventPub evpub) + { + if (ModelState.IsValid) { + ViewData ["NotifyEvent"] = evpub; + return View ("NotifyEventResponse", GoogleHelpers.NotifyEvent (evpub)); + } + + ViewData["CircleIds"] = CircleManager.DefaultProvider.List ( + Membership.GetUser ().UserName).Select (x => new SelectListItem { + Value = x.Id.ToString(), + Text = x.Title, + Selected = (evpub.CircleIds==null) ? false : evpub.CircleIds.Contains (x.Id) + }); + return View (evpub); + } } } diff --git a/web/Controllers/BlogsController.cs b/web/Controllers/BlogsController.cs index 3cb34daa..8d52a1c0 100644 --- a/web/Controllers/BlogsController.cs +++ b/web/Controllers/BlogsController.cs @@ -104,6 +104,8 @@ namespace Yavsc.Controllers [HttpGet] public ActionResult UserPosts (string user, string title=null, int pageIndex = 0, int pageSize = 10) { + if (user == null) + return Index (title, pageSize, pageIndex); if (title != null) return UserPost (user, title, pageIndex, pageSize); int recordcount=0; MembershipUser u = Membership.GetUser (); @@ -118,8 +120,6 @@ namespace Yavsc.Controllers if (u.UserName == user || Roles.IsUserInRole ("Admin")) sf |= FindBlogEntryFlags.MatchInvisible; readersName = u.UserName; - if (user == null) - user = u.UserName; } // find entries BlogEntryCollection c = @@ -128,11 +128,10 @@ namespace Yavsc.Controllers var pr = ProfileBase.Create (user); if (pr != null) { Profile bupr = new Profile (pr); + // listing meta data ViewData ["BlogUserProfile"] = bupr; - - // Inform of listing meta data - ViewData ["BlogTitle"] = bupr.BlogTitle; - ViewData ["Avatar"] = bupr.avatar; + ViewData ["BlogTitle"] = bupr.BlogTitle; + ViewData ["Avatar"] = bupr.avatar; } UUBlogEntryCollection uuc = new UUBlogEntryCollection (user, c); ViewData ["ResultCount"] = recordcount; diff --git a/web/Controllers/FrontOfficeController.cs b/web/Controllers/FrontOfficeController.cs index 27fb83e2..bc8f0320 100644 --- a/web/Controllers/FrontOfficeController.cs +++ b/web/Controllers/FrontOfficeController.cs @@ -43,7 +43,7 @@ namespace Yavsc.Controllers return View (model); } /// - /// Estimates this instance. + /// Estimates released to this client /// [Authorize] public ActionResult Estimates (string client) @@ -68,15 +68,15 @@ namespace Yavsc.Controllers /// - /// Estimate the specified id. + /// Estimate wearing the specified id. /// - /// Identifier. - public ActionResult Get (long estimid) + /// Estim Identifier. + public ActionResult Get (long id) { - Estimate f = WorkFlowManager.GetEstimate (estimid); + Estimate f = WorkFlowManager.GetEstimate (id); if (f == null) { ModelState.AddModelError ("Id", "Wrong Id"); - return View (new Estimate () { Id=estimid } ); + return View (new Estimate () { Id=id } ); } return View (f); } @@ -182,14 +182,14 @@ namespace Yavsc.Controllers /// /// Product the specified id, pc and pref. /// - /// Identifier. - /// Pc. + /// Brand Identifier. + /// Production catalog reference. /// Preference. [AcceptVerbs ("GET")] - public ActionResult Product (string brandid, string pc, string pref) + public ActionResult Product (string id, string pc, string pref) { Product p = null; - ViewData ["BrandName"] = brandid; + ViewData ["BrandName"] = id; ViewData ["ProdCatRef"] = pc; ViewData ["ProdRef"] = pref; Catalog cat = CatalogManager.GetCatalog (); @@ -198,7 +198,7 @@ namespace Yavsc.Controllers ViewData ["RefType"] = "Catalog"; return View ("ReferenceNotFound"); } - Brand b = cat.GetBrand (brandid); + Brand b = cat.GetBrand (id); if (b == null) { ViewData ["RefType"] = "Brand"; return View ("ReferenceNotFound"); @@ -266,6 +266,11 @@ namespace Yavsc.Controllers return View (skills); } + /// + /// Activities the specified search and toPower. + /// + /// Search. + /// If set to true to power. public ActionResult Activities (string search, bool toPower = false) { if (search == null) @@ -274,6 +279,10 @@ namespace Yavsc.Controllers return View (activities); } + /// + /// Activity at the specified id. + /// + /// Identifier. public ActionResult Activity(string id) { return View(WorkFlowManager.GetActivity (id)); @@ -283,7 +292,7 @@ namespace Yavsc.Controllers /// offer Ajax edition of /// user's skills. /// - /// the User Skills Profile. + /// the User name. [Authorize()] public ActionResult UserSkills (string id) { @@ -302,10 +311,11 @@ namespace Yavsc.Controllers /// Booking the specified model. /// /// Model. - public ActionResult Booking (SimpleBookingQuery model) + public ActionResult Booking (string id, SimpleBookingQuery model) { if (model.Needs == null) model.Needs = SkillManager.FindSkill ("%"); + model.MAECode = id; return View (model); } } diff --git a/web/Controllers/HomeController.cs b/web/Controllers/HomeController.cs index 2140e154..674fbd70 100644 --- a/web/Controllers/HomeController.cs +++ b/web/Controllers/HomeController.cs @@ -14,6 +14,7 @@ using Yavsc.Helpers; using Yavsc; using System.Web.Mvc; using Yavsc.Model.Blogs; +using Yavsc.Model.WorkFlow; namespace Yavsc.Controllers { @@ -83,7 +84,7 @@ namespace Yavsc.Controllers /// /// Index this instance. /// - public ActionResult Index () + public ActionResult Index (string id) { foreach (string tagname in new string[] {"Accueil","Yavsc","Événements","Mentions légales"}) { @@ -91,7 +92,9 @@ namespace Yavsc.Controllers // TODO specialyze BlogEntry creating a PhotoEntry ViewData [tagname] = ti; } - + if (id == null) + id = "%"; + ViewData["Activities"] = WorkFlowManager.FindActivity(id,true); return View (); } /// diff --git a/web/Helpers/Google/GoogleHelpers.cs b/web/Helpers/Google/GoogleHelpers.cs index f60f802e..fc71aa5a 100644 --- a/web/Helpers/Google/GoogleHelpers.cs +++ b/web/Helpers/Google/GoogleHelpers.cs @@ -23,6 +23,10 @@ using Yavsc.Model.Google; using System.Web.Profile; using System.Configuration; using System.Web; +using Yavsc.Model.Calendar; +using Yavsc.Model.Circles; +using System.Collections.Generic; +using System.Web.Security; namespace Yavsc.Helpers.Google { @@ -93,6 +97,41 @@ namespace Yavsc.Helpers.Google { return new OAuth2 (callBack,clientId,clientSecret); } + + /// + /// Notifies the event. + /// + /// The event. + /// Evpub. + public static MessageWithPayloadResponse NotifyEvent(EventPub evpub) { + using (SimpleJsonPostMethod,MessageWithPayloadResponse> r = + new SimpleJsonPostMethod,MessageWithPayloadResponse>( + "https://gcm-http.googleapis.com/gcm/send")) { + var users = Circle.Union (evpub.CircleIds); + var regids = new List (); + var to = new List (); + foreach (var u in users) { + var p = ProfileBase.Create (u); + if (p != null) { + var regid = p.GetPropertyValue("gregid"); + if (regid == null) { + var muser = Membership.GetUser (u); + to.Add (muser.Email); + } + else regids.Add ((string)regid); + } + } + if (regids.Count == 0) + throw new InvalidOperationException + ("No recipient where found for this circle list"); + + var msg = new MessageWithPayload () { + notification = new Notification() { title = evpub.Title, body = evpub.Description, icon = "event" }, + data = new YaEvent[] { (YaEvent)evpub }, registration_ids = regids.ToArray() }; + return r.Invoke (msg); + } + } + } } diff --git a/web/Helpers/SimpleJsonPostMethod.cs b/web/Helpers/SimpleJsonPostMethod.cs index d84cc6cb..76071852 100644 --- a/web/Helpers/SimpleJsonPostMethod.cs +++ b/web/Helpers/SimpleJsonPostMethod.cs @@ -66,6 +66,7 @@ namespace Yavsc.Helpers Request.Method = "POST"; Request.Accept = "application/json"; Request.ContentType = "application/json"; + Request.SendChunked = true; Request.TransferEncoding = "UTF-8"; } /// diff --git a/web/Models/App.master b/web/Models/App.master index 0a17dcd2..cb3f2d7f 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -61,9 +61,9 @@ else {%> Yavsc.notice(<%=note.body%>, <%=note.click_action%>, <%=note.click_acti <% } else { %> -" accesskey = "B" class="menuitem" > -vos billets -Vos billets +" accesskey = "B" class="menuitem fa" > + +Vos billets " accesskey="P" class="menuitem fa fa-user"> <%= HttpContext.Current.User.Identity.Name %> @@ -83,16 +83,14 @@ else {%> Yavsc.notice(<%=note.body%>, <%=note.click_action%>, <%=note.click_acti diff --git a/web/Scripts/parallax.js b/web/Scripts/parallax.js index ba363144..23e47bdf 100644 --- a/web/Scripts/parallax.js +++ b/web/Scripts/parallax.js @@ -23,7 +23,7 @@ $(document).ready(function(){ var $window = $(window); var $stwidth = $(window).width(); - var $stheight = $(window).width(); + var $stheight = $(window).height(); var onPos = function (bgobj,ax,ay) { var speed = bgobj.data('speed'); diff --git a/web/Views/Account/Profile.aspx b/web/Views/Account/Profile.aspx index f61eb055..b2f8331c 100644 --- a/web/Views/Account/Profile.aspx +++ b/web/Views/Account/Profile.aspx @@ -26,7 +26,7 @@ <%= Html.ValidationSummary() %> <% using(Html.BeginForm("Profile", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) %> <% { %> - + <%= Html.ValidationSummary() %> <%= Html.Hidden("UserName",ViewData["ProfileUserName"]) %>
Informations publiques diff --git a/web/Views/BackOffice/Index.aspx b/web/Views/BackOffice/Index.aspx index 3f7b78be..dcfb42b8 100644 --- a/web/Views/BackOffice/Index.aspx +++ b/web/Views/BackOffice/Index.aspx @@ -1,9 +1,7 @@ <%@ Page Title="Back office" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> -
  • - <%= Html.ActionLink("Catalog","Catalog","FrontOffice" ) %> -
  • -
  • <%= Html.ActionLink(LocalizedText.Skill,"Skills","FrontOffice" ) %>
  • +
      +
    • <%= Html.ActionLink("Notifier des cercles d'un évennement","NotifyEvent","BackOffice" ) %>
    diff --git a/web/Views/BackOffice/NotifyEvent.aspx b/web/Views/BackOffice/NotifyEvent.aspx new file mode 100644 index 00000000..5765336c --- /dev/null +++ b/web/Views/BackOffice/NotifyEvent.aspx @@ -0,0 +1,22 @@ +<%@ Page Title="Notify" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> + + +<% using( Html.BeginForm("NotifyEvent")) { %> + +<%= Html.ValidationSummary() %> +<%= Html.LabelFor(model => model.Title) %> +<%= Html.TextBox("Title") %> +<%= Html.ValidationMessage("Title", "*") %>
    + +<%= Html.LabelFor(model => model.Description) %> +<%= Html.TextArea("Description") %> +<%= Html.ValidationMessage("Description", "*") %>
    + +<%= Html.LabelFor(model => model.CircleIds) %> +<%= Html.ListBox("CircleIds") %> +<%= Html.ValidationMessage("CircleIds", "*") %> + + +<% } %> + +
    diff --git a/web/Views/BackOffice/NotifyEventResponse.aspx b/web/Views/BackOffice/NotifyEventResponse.aspx new file mode 100644 index 00000000..a56b13a8 --- /dev/null +++ b/web/Views/BackOffice/NotifyEventResponse.aspx @@ -0,0 +1,4 @@ +<%@ Page Title="Notify response" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> + + + diff --git a/web/Views/FrontOffice/Activities.aspx b/web/Views/FrontOffice/Activities.aspx index d65180b5..4f0852e3 100644 --- a/web/Views/FrontOffice/Activities.aspx +++ b/web/Views/FrontOffice/Activities.aspx @@ -25,7 +25,6 @@ Id: $('#meacode').val(), Comment: $('#comment').val(), }; - console.log(Yavsc.dumpprops(activity)); Yavsc.ajax( 'FrontOffice/RegisterActivity', activity, function() { var na = $('

    ').addClass('activity'); diff --git a/web/Views/FrontOffice/Booking.aspx b/web/Views/FrontOffice/Booking.aspx index d77c9608..2ae1f74e 100644 --- a/web/Views/FrontOffice/Booking.aspx +++ b/web/Views/FrontOffice/Booking.aspx @@ -11,7 +11,7 @@ <% using ( Html.BeginForm("Booking") ) { %> - +<%= Html.Hidden("MAECode") %>
    Préferences musicales <%= Html.LabelFor(model=>model.Needs) %>: diff --git a/web/Views/Home/Index.aspx b/web/Views/Home/Index.aspx index 5639baab..0d33b72d 100644 --- a/web/Views/Home/Index.aspx +++ b/web/Views/Home/Index.aspx @@ -8,6 +8,18 @@ +
    +<% foreach (var a in ((Activity[])(ViewData["Activities"]))) { %> +
    +
    +
    +

    "><%=Html.Encode(a.Title)%>

    +(<%=Html.Encode(a.Id)%>) +

    +<%=Html.Markdown(a.Comment)%> +

    +<% } %> +
    <%= Html.Partial("TagPanel",ViewData["Accueil"]) %>
    diff --git a/web/Web.config b/web/Web.config index 5cca0c21..df835a7f 100644 --- a/web/Web.config +++ b/web/Web.config @@ -147,7 +147,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx - + diff --git a/web/Web.csproj b/web/Web.csproj index 294823b2..8abbe497 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -215,6 +215,7 @@ + @@ -518,6 +519,8 @@ + + diff --git a/yavscModel/Calendar/BaseEvent.cs b/yavscModel/Calendar/BaseEvent.cs index e74718a6..349a5998 100644 --- a/yavscModel/Calendar/BaseEvent.cs +++ b/yavscModel/Calendar/BaseEvent.cs @@ -34,26 +34,24 @@ namespace Yavsc.Model.Calendar /// /// The title. /// - [Required(ErrorMessage="Please, choose a .")] + [Required(ErrorMessageResourceName="ChooseATitle",ErrorMessageResourceType=typeof(LocalizedText))] [Display(ResourceType=typeof(LocalizedText),Name="Title")] public string Title { get; set; } /// /// The description. /// - [Required(ErrorMessage="Please, choose a Description.")] + [Required(ErrorMessageResourceName="ChooseADescription",ErrorMessageResourceType=typeof(LocalizedText))] [Display(ResourceType=typeof(LocalizedText),Name="Description")] public string Description { get; set; } /// /// The location. /// - [Required(ErrorMessage="Please, choose a Location.")] [Display(ResourceType=typeof(LocalizedText),Name="Location")] public Position Location { get; set; } /// /// The start date. /// - [Required(ErrorMessage="Please, choose a Start Date.")] [Display(ResourceType=typeof(LocalizedText),Name="StartDate")] public DateTime StartDate { get; set; } @@ -61,7 +59,6 @@ namespace Yavsc.Model.Calendar /// Gets or sets the end date. ///
/// The end date. - [Required(ErrorMessage="Please, choose an End Date.")] [Display(ResourceType=typeof(LocalizedText),Name="EndDate")] public DateTime EndDate { get; set; } diff --git a/yavscModel/Calendar/EventPub.cs b/yavscModel/Calendar/EventPub.cs index d0ef9acd..3baea083 100644 --- a/yavscModel/Calendar/EventPub.cs +++ b/yavscModel/Calendar/EventPub.cs @@ -36,8 +36,10 @@ namespace Yavsc.Model.Calendar /// Gets or sets the circles. ///
/// The circles. - [Display(ResourceType=typeof(LocalizedText),Name="Circles")] - public Circle[] Circles { get; set; } + + [Required(ErrorMessageResourceName="DoSpecifyCircles",ErrorMessageResourceType=typeof(LocalizedText)), + Display(ResourceType=typeof(LocalizedText),Name="Circles")] + public long [] CircleIds { get; set; } } } diff --git a/yavscModel/Calendar/YaEvent.cs b/yavscModel/Calendar/YaEvent.cs index 7b38cf4d..dbb0a9f8 100644 --- a/yavscModel/Calendar/YaEvent.cs +++ b/yavscModel/Calendar/YaEvent.cs @@ -34,13 +34,11 @@ namespace Yavsc.Model.Calendar /// /// The name of the NF provider. /// - [Required(ErrorMessage="Please, choose a Provider Name.")] [Display(ResourceType=typeof(LocalizedText),Name="ProviderName")] public string ProviderName { get; set; } /// /// The NF provider identifier. /// - [Required(ErrorMessage="Please, choose a Provider Identifier.")] [Display(ResourceType=typeof(LocalizedText),Name="ProviderId")] public string ProviderId { get; set; } /// diff --git a/yavscModel/ChangeLog b/yavscModel/ChangeLog index 15a86531..ffa2a197 100644 --- a/yavscModel/ChangeLog +++ b/yavscModel/ChangeLog @@ -1,3 +1,31 @@ +2015-11-26 Paul Schneider + + * EventPub.cs: + * BaseEvent.cs: internationalise l'évennement (la base d'une + notification) + + * YaEvent.cs: les champs fournisseur d'une notification ne + sont pas requis. On peut en avoir de la part du site lui même, + qui ne soient pas à l'origine d'un evennement tiers du + workflow. Dans tous les autres cas, ils devraient être + renseignés ... à suivre. + + * Circle.cs: + * CircleBase.cs: ajoute une methode de construition des + destinataires à partir d'un tableau d'identifiants de cercles. + + * Activity.cs: implémente la photo activité dans le modèle + + * SimpleBookingQuery.cs: refabriqué + + * MessageWithPayLoad.cs: accuse aussi le champ `to` en cas + d'absence de destinataire. + + * LocalizedText.resx: + * LocalizedText.fr.resx: + * LocalizedText.Designer.cs: + * LocalizedText.fr.Designer.cs: internationalisation + 2015-11-25 Paul Schneider * BlogManager.cs: refactorisation diff --git a/yavscModel/Circles/Circle.cs b/yavscModel/Circles/Circle.cs index 597ebedb..946f4ced 100644 --- a/yavscModel/Circles/Circle.cs +++ b/yavscModel/Circles/Circle.cs @@ -52,6 +52,20 @@ namespace Yavsc.Model.Circles } return content.ToArray (); } + /// + /// Union the specified thoseIds. + /// + /// Those identifiers. + public static string [] Union (long [] thoseIds) + { + List content = new List(); + foreach (long cid in thoseIds) + foreach (string user_name in + CircleManager.DefaultProvider.GetMembers(cid).Members) + if (!content.Contains (user_name)) + content.Add (user_name); + return content.ToArray (); + } } } diff --git a/yavscModel/Circles/CircleBase.cs b/yavscModel/Circles/CircleBase.cs index 1f2175a9..94e165a0 100644 --- a/yavscModel/Circles/CircleBase.cs +++ b/yavscModel/Circles/CircleBase.cs @@ -51,7 +51,18 @@ namespace Yavsc.Model.Circles /// /// The title. public string Title { get; set; } - + /// + /// Determines whether the specified is equal to the current . + /// + /// The to compare with the current . + /// true if the specified is equal to the current + /// ; otherwise, false. + public override bool Equals (object obj) + { + if (base.Equals (obj)) + return true; + return Id == ((CircleBase)obj).Id; + } } } diff --git a/yavscModel/FrontOffice/Activity.cs b/yavscModel/FrontOffice/Activity.cs index 64b70631..dcbf232b 100644 --- a/yavscModel/FrontOffice/Activity.cs +++ b/yavscModel/FrontOffice/Activity.cs @@ -66,6 +66,9 @@ namespace Yavsc.Model.FrontOffice get; set; } + + public string Photo { get; set; } + /// /// The activity object has a static value during the /// most of the application life, diff --git a/yavscModel/FrontOffice/SimpleBookingQuery.cs b/yavscModel/FrontOffice/SimpleBookingQuery.cs index e5186eaf..e5ce49c6 100644 --- a/yavscModel/FrontOffice/SimpleBookingQuery.cs +++ b/yavscModel/FrontOffice/SimpleBookingQuery.cs @@ -38,8 +38,17 @@ namespace Yavsc.Model.FrontOffice [Display(ResourceType=typeof(LocalizedText),Name="PreferedDate")] public DateTime PreferedDate { get; set; } - public string Activity { get; set; } + /// + /// Gets or sets the MAE code. + /// + /// The MAE code. + public string MAECode { get; set; } + /// + /// Gets or sets the needs. + /// + /// The needs. + [Display(ResourceType=typeof(LocalizedText),Name="Needs")] public SkillEntity[] Needs { get; set; } } diff --git a/yavscModel/Google/Messaging/MessageWithPayLoad.cs b/yavscModel/Google/Messaging/MessageWithPayLoad.cs index e77ae938..7054d7dd 100644 --- a/yavscModel/Google/Messaging/MessageWithPayLoad.cs +++ b/yavscModel/Google/Messaging/MessageWithPayLoad.cs @@ -80,6 +80,7 @@ namespace Yavsc.Model.Google if (to==null && registration_ids == null) { modelState.AddModelError ("to", "One of \"to\" or \"registration_ids\" parameters must be specified"); modelState.AddModelError ("registration_ids", "*"); + modelState.AddModelError ("to", "*"); } if (notification == null && data == null) { modelState.AddModelError ("notification", "At least one of \"notification\" or \"data\" parameters must be specified"); diff --git a/yavscModel/LocalizedText.Designer.cs b/yavscModel/LocalizedText.Designer.cs index 64fcf25a..a03bf7dd 100644 --- a/yavscModel/LocalizedText.Designer.cs +++ b/yavscModel/LocalizedText.Designer.cs @@ -76,18 +76,36 @@ namespace Yavsc.Model { } } + public static string Message_sent { + get { + return ResourceManager.GetString("Message_sent", resourceCulture); + } + } + public static string DuplicateEmail { get { return ResourceManager.GetString("DuplicateEmail", resourceCulture); } } + public static string Photo { + get { + return ResourceManager.GetString("Photo", resourceCulture); + } + } + public static string Preview { get { return ResourceManager.GetString("Preview", resourceCulture); } } + public static string Remove { + get { + return ResourceManager.GetString("Remove", resourceCulture); + } + } + public static string DisplayName { get { return ResourceManager.GetString("DisplayName", resourceCulture); @@ -100,6 +118,12 @@ namespace Yavsc.Model { } } + public static string DoSpecifyCircles { + get { + return ResourceManager.GetString("DoSpecifyCircles", resourceCulture); + } + } + public static string My_Estimates { get { return ResourceManager.GetString("My_Estimates", resourceCulture); @@ -256,9 +280,9 @@ namespace Yavsc.Model { } } - public static string Remove { + public static string ChooseATitle { get { - return ResourceManager.GetString("Remove", resourceCulture); + return ResourceManager.GetString("ChooseATitle", resourceCulture); } } @@ -382,9 +406,9 @@ namespace Yavsc.Model { } } - public static string Message_sent { + public static string ChooseADescription { get { - return ResourceManager.GetString("Message_sent", resourceCulture); + return ResourceManager.GetString("ChooseADescription", resourceCulture); } } @@ -454,6 +478,12 @@ namespace Yavsc.Model { } } + public static string Needs { + get { + return ResourceManager.GetString("Needs", resourceCulture); + } + } + public static string Role { get { return ResourceManager.GetString("Role", resourceCulture); diff --git a/yavscModel/LocalizedText.fr.Designer.cs b/yavscModel/LocalizedText.fr.Designer.cs index 34d03453..c0692dd0 100644 --- a/yavscModel/LocalizedText.fr.Designer.cs +++ b/yavscModel/LocalizedText.fr.Designer.cs @@ -70,9 +70,21 @@ namespace Yavsc.Model { } } - public static string Circles { + public static string access_denied { get { - return ResourceManager.GetString("Circles", resourceCulture); + return ResourceManager.GetString("access_denied", resourceCulture); + } + } + + public static string Message_sent { + get { + return ResourceManager.GetString("Message_sent", resourceCulture); + } + } + + public static string Photo { + get { + return ResourceManager.GetString("Photo", resourceCulture); } } @@ -82,15 +94,27 @@ namespace Yavsc.Model { } } + public static string Remove { + get { + return ResourceManager.GetString("Remove", resourceCulture); + } + } + public static string DisplayName { get { return ResourceManager.GetString("DisplayName", resourceCulture); } } - public static string none { + public static string Circles { get { - return ResourceManager.GetString("none", resourceCulture); + return ResourceManager.GetString("Circles", resourceCulture); + } + } + + public static string DoSpecifyCircles { + get { + return ResourceManager.GetString("DoSpecifyCircles", resourceCulture); } } @@ -178,12 +202,6 @@ namespace Yavsc.Model { } } - public static string access_denied { - get { - return ResourceManager.GetString("access_denied", resourceCulture); - } - } - public static string Ciffer { get { return ResourceManager.GetString("Ciffer", resourceCulture); @@ -208,6 +226,12 @@ namespace Yavsc.Model { } } + public static string none { + get { + return ResourceManager.GetString("none", resourceCulture); + } + } + public static string entries { get { return ResourceManager.GetString("entries", resourceCulture); @@ -250,9 +274,9 @@ namespace Yavsc.Model { } } - public static string Remove { + public static string ChooseATitle { get { - return ResourceManager.GetString("Remove", resourceCulture); + return ResourceManager.GetString("ChooseATitle", resourceCulture); } } @@ -304,6 +328,12 @@ namespace Yavsc.Model { } } + public static string PhotoUpdated { + get { + return ResourceManager.GetString("PhotoUpdated", resourceCulture); + } + } + public static string PreferedDate { get { return ResourceManager.GetString("PreferedDate", resourceCulture); @@ -346,9 +376,9 @@ namespace Yavsc.Model { } } - public static string AnIMessageHasbeenSent { + public static string DoTag { get { - return ResourceManager.GetString("AnIMessageHasbeenSent", resourceCulture); + return ResourceManager.GetString("DoTag", resourceCulture); } } @@ -364,9 +394,9 @@ namespace Yavsc.Model { } } - public static string Message_sent { + public static string ChooseADescription { get { - return ResourceManager.GetString("Message_sent", resourceCulture); + return ResourceManager.GetString("ChooseADescription", resourceCulture); } } @@ -436,6 +466,12 @@ namespace Yavsc.Model { } } + public static string Needs { + get { + return ResourceManager.GetString("Needs", resourceCulture); + } + } + public static string Role { get { return ResourceManager.GetString("Role", resourceCulture); @@ -502,9 +538,9 @@ namespace Yavsc.Model { } } - public static string DoTag { + public static string Hide_source { get { - return ResourceManager.GetString("DoTag", resourceCulture); + return ResourceManager.GetString("Hide_source", resourceCulture); } } @@ -568,12 +604,6 @@ namespace Yavsc.Model { } } - public static string Hide_source { - get { - return ResourceManager.GetString("Hide_source", resourceCulture); - } - } - public static string UsersInRole { get { return ResourceManager.GetString("UsersInRole", resourceCulture); @@ -586,6 +616,12 @@ namespace Yavsc.Model { } } + public static string AnIMessageHasbeenSent { + get { + return ResourceManager.GetString("AnIMessageHasbeenSent", resourceCulture); + } + } + public static string Profile_edition { get { return ResourceManager.GetString("Profile_edition", resourceCulture); diff --git a/yavscModel/LocalizedText.fr.resx b/yavscModel/LocalizedText.fr.resx index 37129437..9db1d62a 100644 --- a/yavscModel/LocalizedText.fr.resx +++ b/yavscModel/LocalizedText.fr.resx @@ -23,12 +23,15 @@ Billet mis à jour Consultant Nombre + S'il vous plait, choisissez une description. + S'il vous plait, choisissez un titre. Chiffre Cercles Commentaire Base de données Commenter Ne pas publier mon activité + S'il vous plait, spécifiez ceux de vos cercles à qui est destiné ce contenu Créer Demande de rendez-vous Une erreur est survenue à la génération de votre document @@ -62,6 +65,7 @@ Date minimale du rendez-vous Modifier Mes estimations + Besoin Nouveau Tag pas de contenu aucun(e) @@ -72,6 +76,8 @@ En ligne Version Pdf Personne + Photo + Photo mise à jour Date souhaitée PrévisualiserPrévisualiser le document Édition du profile diff --git a/yavscModel/LocalizedText.resx b/yavscModel/LocalizedText.resx index 1f3cb85f..4a33bdcb 100644 --- a/yavscModel/LocalizedText.resx +++ b/yavscModel/LocalizedText.resx @@ -21,9 +21,10 @@ Bill removal Bill created Bill updated - Photo updated Create Count + Please, choose a description + Please, choose a title Ciffer Circles Consultant @@ -35,6 +36,7 @@ Display Name Exception occured when rendering your document Do Not Publish My Activity + Please, specify circles for audiance Tag This email adress is already used ({0}). This user name is already used ({0}). @@ -65,6 +67,7 @@ Minimal date for the rendez-vous Modify My estimates + Needs New Tag no content none @@ -75,6 +78,8 @@ Offline Pdf version Person + Photo + Photo updated Prefered date Previewcomment on preview Private circle