diff --git a/NpgsqlMRPProviders/ChangeLog b/NpgsqlMRPProviders/ChangeLog new file mode 100644 index 00000000..93838543 --- /dev/null +++ b/NpgsqlMRPProviders/ChangeLog @@ -0,0 +1,5 @@ +2015-10-28 Paul Schneider + + * NpgsqlProfileProvider.cs: Fixes the defaultValue + specification from config file + diff --git a/NpgsqlMRPProviders/NpgsqlProfileProvider.cs b/NpgsqlMRPProviders/NpgsqlProfileProvider.cs index 49d7011e..0340c589 100644 --- a/NpgsqlMRPProviders/NpgsqlProfileProvider.cs +++ b/NpgsqlMRPProviders/NpgsqlProfileProvider.cs @@ -221,7 +221,7 @@ namespace Npgsql.Web } else { foreach (SettingsProperty p in collection) { SettingsPropertyValue v = new SettingsPropertyValue (p); - v.PropertyValue = null; + v.PropertyValue = p.DefaultValue; c.Add (v); } } diff --git a/web/ApiControllers/AccountController.cs b/web/ApiControllers/AccountController.cs index a9180291..f2523aa8 100644 --- a/web/ApiControllers/AccountController.cs +++ b/web/ApiControllers/AccountController.cs @@ -32,7 +32,7 @@ namespace Yavsc.ApiControllers /// /// Account controller. /// - public class AccountController : YavscApiController + public class AccountController : YavscController { /// diff --git a/web/ApiControllers/BlogsController.cs b/web/ApiControllers/BlogsController.cs index 83dcaf3e..4431f522 100644 --- a/web/ApiControllers/BlogsController.cs +++ b/web/ApiControllers/BlogsController.cs @@ -19,7 +19,7 @@ namespace Yavsc.ApiControllers /// /// Blogs API controller. /// - public class BlogsController : YavscApiController + public class BlogsController : YavscController { /// /// Tag the specified model. diff --git a/web/ApiControllers/CalendarController.cs b/web/ApiControllers/CalendarController.cs index d1b8300f..686c7730 100644 --- a/web/ApiControllers/CalendarController.cs +++ b/web/ApiControllers/CalendarController.cs @@ -50,7 +50,7 @@ namespace Yavsc.ApiControllers }, new YaEvent () { Title = "Test2", - ImgLocator = "http://bla/im.png", + Photo = "http://bla/im.png", Location = new Position () { Longitude = 0, Latitude = 0 @@ -66,7 +66,7 @@ namespace Yavsc.ApiControllers }, new YaEvent () { Title = "Test2", - ImgLocator = "http://bla/im.png", + Photo = "http://bla/im.png", Location = new Position () { Longitude = 0, Latitude = 0 diff --git a/web/ApiControllers/YavscApiController.cs b/web/ApiControllers/YavscController.cs similarity index 76% rename from web/ApiControllers/YavscApiController.cs rename to web/ApiControllers/YavscController.cs index ed0e788a..ce8c172d 100644 --- a/web/ApiControllers/YavscApiController.cs +++ b/web/ApiControllers/YavscController.cs @@ -21,14 +21,26 @@ using System; using System.Web.Http; using System.Net.Http; +using System.Web.Profile; namespace Yavsc.ApiControllers { - public abstract class YavscApiController : ApiController + public class YavscController : ApiController { - public YavscApiController () + public YavscController () { } + public class Auth { + public string Id { get; set; } + } + + public void AllowCookies (Auth model) + { + if (model.Id != null) { + ProfileBase anonymousProfile = ProfileBase.Create (model.Id); + anonymousProfile.SetPropertyValue ("allowcookies", true); + } + } protected HttpResponseMessage DefaultResponse() { diff --git a/web/App_Data/instdbws.sql b/web/App_Data/instdbws.sql index 7a9fc945..4803e91a 100644 --- a/web/App_Data/instdbws.sql +++ b/web/App_Data/instdbws.sql @@ -91,13 +91,13 @@ WITH ( OIDS=FALSE ); - -- Table: profiledata + -- Table: profiledata -- DROP TABLE profiledata; CREATE TABLE profiledata ( - uniqueid integer, + uniqueid integer, zipcode character varying(10), cityandstate character varying(255), blogtitle character varying(255), -- Blog Title @@ -122,6 +122,7 @@ CREATE TABLE profiledata avatar character varying(512), -- url for an avatar gcalapi boolean NOT NULL DEFAULT false, gregid character varying(1024), -- Google Cloud Message registration identifier + allowcookies boolean NOT NULL DEFAULT false, CONSTRAINT fkprofiles2 FOREIGN KEY (uniqueid) REFERENCES profiles (uniqueid) MATCH SIMPLE ON UPDATE CASCADE ON DELETE CASCADE @@ -129,18 +130,18 @@ CREATE TABLE profiledata WITH ( OIDS=FALSE ); -COMMENT ON COLUMN profiledata."address.address" IS 'Postal address'; COMMENT ON COLUMN profiledata.blogtitle IS 'Blog Title'; +COMMENT ON COLUMN profiledata.address IS 'Postal address'; +COMMENT ON COLUMN profiledata.accountnumber IS 'Numero de compte'; +COMMENT ON COLUMN profiledata.bankedkey IS 'clé RIB'; +COMMENT ON COLUMN profiledata.bankcode IS 'Code banque'; +COMMENT ON COLUMN profiledata.gtoken IS 'Google authentification token'; +COMMENT ON COLUMN profiledata.grefreshtoken IS 'Google refresh token'; +COMMENT ON COLUMN profiledata.gtokentype IS 'Google access token type'; +COMMENT ON COLUMN profiledata.gcalid IS 'Google calendar identifier'; +COMMENT ON COLUMN profiledata.gtokenexpir IS 'Google access token expiration date'; COMMENT ON COLUMN profiledata.avatar IS 'url for an avatar'; -COMMENT ON COLUMN profiledata."bank.accountnumber" IS 'Numero de compte'; -COMMENT ON COLUMN profiledata."bank.key" IS 'clé RIB'; -COMMENT ON COLUMN profiledata."bank.code" IS 'Code banque'; -COMMENT ON COLUMN profiledata."google.token" IS 'Google authentification token'; -COMMENT ON COLUMN profiledata."google.refreshtoken" IS 'Google refresh token'; -COMMENT ON COLUMN profiledata."google.tokentype" IS 'Google access token type'; -COMMENT ON COLUMN profiledata."google.calid" IS 'Google calendar identifier'; -COMMENT ON COLUMN profiledata."google.tokenexpir" IS 'Google access token expiration date'; -COMMENT ON COLUMN profiledata."google.regid" IS 'Google Cloud Message registration identifier'; +COMMENT ON COLUMN profiledata.gregid IS 'Google Cloud Message registration identifier'; -- Index: fki_fkprofiles2 @@ -154,6 +155,9 @@ CREATE INDEX fki_fkprofiles2 + + + -- Table: profiles diff --git a/web/App_Themes/style.css b/web/App_Themes/style.css index 0af32496..9e91e974 100644 --- a/web/App_Themes/style.css +++ b/web/App_Themes/style.css @@ -27,6 +27,16 @@ body { url('/images/FhHRx.gif') 50% 50% no-repeat; + overflow: scroll; +} +.dispmodal { + position: fixed; + z-index: 1000; + top: 0; + left: 0; + height: 100%; + width: 100%; + overflow: scroll; } body.loading { @@ -217,6 +227,10 @@ label { font-size: large; background-color: rgba(64,64,0,0.5); border: solid green 1px; + padding: 1em; + border-radius:1em; + margin:1em; + padding:1em; } .dirty { background-color: rgba(128,128,0,0.5); @@ -356,6 +370,9 @@ header h1, header a , .actionlink, .menuitem, a { padding:.5em;} } #notifications { padding: .5em; + border-radius:.5em; + margin:.5em; + padding:.5em; } .menuitem { display: block; diff --git a/web/ChangeLog b/web/ChangeLog index 5fecdd5d..3e354cc9 100644 --- a/web/ChangeLog +++ b/web/ChangeLog @@ -1,3 +1,38 @@ +2015-10-28 Paul Schneider + + * BlogsController.cs: + * AccountController.cs: + * CalendarController.cs: refactoring : the Yavsc controller + name + + * instdbws.sql: a new profile value : a boolean, + `AllowCookies` :'{ + + * style.css: a class to display notification + + * HomeController.cs: Notifies users this site uses cookies + (what for an information!) + If authenticated, at dimissing this notification, the user's + profile is updated, + and he'll not mess up anymore with the info. + + * App.master: + * YavscHelpers.cs: adds usage of click_action value at + displaying a notification. + + * yavsc.js: Implements the notification `click_action` + + + * Web.config: * enables anonymous profiles + * adds a new `allowcookies` profile property + + + * Web.csproj: Yavsc controller refactoring + + * Web.config: code prettying + + * YavscController.cs: Gives Yavsc a concrete base controller + 2015-10-27 Paul Schneider * AppAdmin.master: A new master page for Administration diff --git a/web/Controllers/HomeController.cs b/web/Controllers/HomeController.cs index 7c798baa..c06d9aa4 100644 --- a/web/Controllers/HomeController.cs +++ b/web/Controllers/HomeController.cs @@ -14,6 +14,8 @@ using Yavsc.Helpers; using Yavsc; using System.Web.Mvc; using Yavsc.Model.Blogs; +using System.Web.Security; +using System.Web.Profile; namespace Yavsc.Controllers { @@ -85,6 +87,17 @@ namespace Yavsc.Controllers /// public ActionResult Index () { + var anonid = Request.AnonymousID; + if (Session.IsNewSession) { + if (!Request.IsAuthenticated) { + ProfileBase anonymousProfile = ProfileBase.Create(anonid); + object ac = anonymousProfile.GetPropertyValue ("allowcookies"); + if (ac is string && ac!="true") + YavscHelpers.Notify (ViewData, LocalizedText.ThisSiteUsesCookies, + "function(){Yavsc.ajax(\"/Yavsc/AllowCookies\", { id:'"+anonid+"' });}"); + } + } + foreach (string tagname in new string[] {"Accueil","Événements","Mentions légales"}) { TagInfo ti = BlogManager.GetTagInfo (tagname); diff --git a/web/Helpers/YavscHelpers.cs b/web/Helpers/YavscHelpers.cs index 64e0366b..2813c4af 100644 --- a/web/Helpers/YavscHelpers.cs +++ b/web/Helpers/YavscHelpers.cs @@ -15,10 +15,12 @@ using System.Web.Profile; using System.Web.Script.Serialization; using System.Web.Mvc; using System.Text.RegularExpressions; +using Yavsc.Model.Messaging; namespace Yavsc.Helpers { - + + /// /// Yavsc helpers. /// @@ -219,10 +221,11 @@ namespace Yavsc.Helpers JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Serialize(obj); } + /// - /// Notifies + /// Notify the specified helper and message. /// - /// View data. + /// Helper. /// Message. public static void Notify (this HtmlHelper helper, string message) { Notify (helper.ViewData, message); @@ -232,10 +235,12 @@ namespace Yavsc.Helpers /// /// View data. /// Message. - public static void Notify(ViewDataDictionary viewData, string message) { + public static void Notify(ViewDataDictionary viewData, string message, string click_action=null) { if (viewData ["Notifications"] == null) - viewData ["Notifications"] = new List (); - (viewData ["Notifications"] as List).Add (message.Replace("\'","\\\'")); + viewData ["Notifications"] = new List (); + (viewData ["Notifications"] as List).Add ( + new Notification { body = message.Replace("\'","\\\'"), + click_action = click_action } ) ; } /// /// Files the list. diff --git a/web/Models/App.master b/web/Models/App.master index 649dc00f..b8fbdaab 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -36,11 +36,12 @@ var apiBaseUrl = '<%=Url.Content(Yavsc.WebApiConfig.UrlPrefixRelative)%>';
-<%if (ViewData ["Notifications"]!=null) { %> +<% if (ViewData ["Notifications"]!=null) { %> diff --git a/web/Scripts/yavsc.js b/web/Scripts/yavsc.js index 7d8bbb79..be74cfde 100644 --- a/web/Scripts/yavsc.js +++ b/web/Scripts/yavsc.js @@ -1,8 +1,8 @@ var Yavsc = (function(apiBaseUrl){ var self = {}; -var $notifications = $('#notifications'); -function dumpprops(obj) { + +self.dumpprops = function (obj) { var str = ""; for(var k in obj) if (obj.hasOwnProperty(k)) @@ -30,32 +30,42 @@ self.dimiss = function () { $(this).parent().remove(); }; +self.ajax = function (method,data,callback) { + $.ajax({ + url: self.apiBaseUrl+method, + type: "POST", + data: data, + success: function (response) { + if (callback) callback(response); + }, + statusCode: { + 400: Yavsc.onAjaxBadInput + }, + error: Yavsc.onAjaxError}); + }; + self.onScroll = function() { + var $notifications = $('#notifications'); if ($notifications.has('*').length>0) { - if ($(window).scrollTop()>375) { - console.log('fixit'); - $notifications.css('position','fixed'); - $notifications.css('z-index',2); - $notifications.css('top',0); + if ($(window).scrollTop()>100) { + $notifications.addClass("dispmodal"); } else { - $notifications.css('position','static'); - $notifications.css('z-index',1); + $notifications.removeClass("dispmodal"); }} }; -self.notice = function (msg, msgok) { +self.notice = function (msg, callback, msgok) { if (!msgok) msgok='Ok'; - if (msg) { var note = $('
'+msg+'
'); - $(''+msgok+'').click(self.dimiss).appendTo(note); + var btn = $(''+msgok+''); + if (callback) btn.click(callback); + btn.click(self.dimiss).appendTo(note); note.appendTo("#notifications"); self.onScroll(); - } - }; - + }; - self.onAjaxBadInput = function (data) +self.onAjaxBadInput = function (data) { if (!data) { Yavsc.notice('no data'); return; } if (!data.responseJSON) { Yavsc.notice('no json data:'+data); return; } @@ -68,7 +78,6 @@ self.notice = function (msg, msgok) { else errspan.innerHTML=value.errors.join("
"); }); - }; self.onAjaxError = function (xhr, ajaxOptions, thrownError) { @@ -95,24 +104,16 @@ $btnshow.addClass('hidden'); $btnhide.removeClass('hidden'); }); }); - - }); - - $(document).ready(function(){ - -$body = $("body"); -$(document).on({ - ajaxStart: function() { $body.addClass("loading"); }, - ajaxStop: function() { $body.removeClass("loading"); } -}); + $body = $("body"); + $(document).on({ + ajaxStart: function() { $body.addClass("loading"); }, + ajaxStop: function() { $body.removeClass("loading"); } + }); $(window).scroll(self.onScroll); }); - - - return self; })(); diff --git a/web/Views/Web.config b/web/Views/Web.config index 787c29ba..db86717b 100644 --- a/web/Views/Web.config +++ b/web/Views/Web.config @@ -29,7 +29,6 @@ - diff --git a/web/Web.config b/web/Web.config index c3941652..5070fbb5 100644 --- a/web/Web.config +++ b/web/Web.config @@ -68,11 +68,13 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx + + @@ -139,6 +141,7 @@ http://msdn2.microsoft.com/en-us/library/b5ysx397.aspx + diff --git a/web/Web.csproj b/web/Web.csproj index 3fff22b0..6ab4dcb8 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -205,7 +205,7 @@ - + diff --git a/yavscModel/Calendar/ICalendarManager.cs b/yavscModel/Calendar/ICalendarManager.cs new file mode 100644 index 00000000..59baf6e4 --- /dev/null +++ b/yavscModel/Calendar/ICalendarManager.cs @@ -0,0 +1,32 @@ +// +// ICalendarManager.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 System.Collections.Generic; + +namespace Yavsc.Model.Calendar +{ + public interface ICalendarManager { + IFreeDateSet GetFreeDates(string username, BookQuery req); + bool Book(string username, YaEvent ev); + } +} diff --git a/yavscModel/Calendar/FreeDate.cs b/yavscModel/Calendar/IFreeDateSet.cs similarity index 80% rename from yavscModel/Calendar/FreeDate.cs rename to yavscModel/Calendar/IFreeDateSet.cs index fa61e52f..b582cf8c 100644 --- a/yavscModel/Calendar/FreeDate.cs +++ b/yavscModel/Calendar/IFreeDateSet.cs @@ -19,40 +19,36 @@ // along with this program. If not, see . using System; using Yavsc.Model.Google; +using System.Collections.Generic; namespace Yavsc.Model.Calendar { + /// /// Free date. /// - public class FreeDateSet + public interface IFreeDateSet { /// /// Gets or sets the reference. /// /// The reference. - public DateTime [] Values { get; set; } + IEnumerable Values { get; set; } /// /// Gets or sets the duration. /// /// The duration. - public TimeSpan Duration { get; set; } + TimeSpan Duration { get; set; } /// /// Gets or sets the attendees. /// /// The attendees. - public string UserName { get; set; } + string UserName { get; set; } /// /// Gets or sets the location. /// /// The location. - public string Location { get; set; } - - static FreeDateSet CreateFromCalAndQuery(CalendarEventList cal, BookQuery query) - { - - throw new NotImplementedException (); - } + string Location { get; set; } } } diff --git a/yavscModel/Calendar/YaEvent.cs b/yavscModel/Calendar/YaEvent.cs index d9277243..41f3b1f1 100644 --- a/yavscModel/Calendar/YaEvent.cs +++ b/yavscModel/Calendar/YaEvent.cs @@ -26,13 +26,8 @@ using Yavsc.Model; namespace Yavsc.Model.Calendar { - - /// - /// NF event. - /// - public class YaEvent + public class BaseEvent { - /// /// The title. /// @@ -45,6 +40,7 @@ namespace Yavsc.Model.Calendar [Required(ErrorMessage="Please, choose a Description.")] [Display(ResourceType=typeof(LocalizedText),Name="Description")] public string Description { get; set; } + /// /// The location. /// @@ -65,6 +61,13 @@ namespace Yavsc.Model.Calendar [Required(ErrorMessage="Please, choose an End Date.")] [Display(ResourceType=typeof(LocalizedText),Name="EndDate")] public DateTime EndDate { get; set; } + + } + /// + /// NF event. + /// + public class YaEvent : BaseEvent + { /// /// The name of the NF provider. /// @@ -90,7 +93,7 @@ namespace Yavsc.Model.Calendar /// /// The image locator. /// - [Display(ResourceType=typeof(LocalizedText),Name="ImgLocator")] - public string ImgLocator { get; set; } + [Display(ResourceType=typeof(LocalizedText),Name="Photo")] + public string Photo { get; set; } } } diff --git a/yavscModel/ChangeLog b/yavscModel/ChangeLog index 25d15385..8e5eefb5 100644 --- a/yavscModel/ChangeLog +++ b/yavscModel/ChangeLog @@ -1,3 +1,22 @@ +2015-10-28 Paul Schneider + + * ICalendarManager.cs: WIP booking TODO a calendar provider + + * YaEvent.cs: + * IFreeDateSet.cs: WIP booking + + * LocalizedText.resx: + * LocalizedText.fr.resx: + * LocalizedText.Designer.cs: + * LocalizedText.fr.Designer.cs: implements the message "uses + cookies" + + * YavscModel.csproj: refactoring + + * Notification.cs: The Yavsc otification will start as a + Google one ... + many properties are not yet used, but all seems usefull. + 2015-10-27 Paul Schneider * YavscModel.csproj: diff --git a/yavscModel/LocalizedText.Designer.cs b/yavscModel/LocalizedText.Designer.cs index 14bb8941..0fc77ddd 100644 --- a/yavscModel/LocalizedText.Designer.cs +++ b/yavscModel/LocalizedText.Designer.cs @@ -388,6 +388,12 @@ namespace Yavsc.Model { } } + public static string ThisSiteUsesCookies { + get { + return ResourceManager.GetString("ThisSiteUsesCookies", resourceCulture); + } + } + public static string ReadMore { get { return ResourceManager.GetString("ReadMore", resourceCulture); diff --git a/yavscModel/LocalizedText.fr.Designer.cs b/yavscModel/LocalizedText.fr.Designer.cs index 337d53a9..af6a6185 100644 --- a/yavscModel/LocalizedText.fr.Designer.cs +++ b/yavscModel/LocalizedText.fr.Designer.cs @@ -64,6 +64,12 @@ namespace Yavsc.Model { } } + public static string Location { + get { + return ResourceManager.GetString("Location", resourceCulture); + } + } + public static string Circles { get { return ResourceManager.GetString("Circles", resourceCulture); @@ -208,12 +214,6 @@ namespace Yavsc.Model { } } - public static string Tag_name { - get { - return ResourceManager.GetString("Tag_name", resourceCulture); - } - } - public static string Google_error { get { return ResourceManager.GetString("Google_error", resourceCulture); @@ -274,9 +274,9 @@ namespace Yavsc.Model { } } - public static string Location { + public static string Tag_name { get { - return ResourceManager.GetString("Location", resourceCulture); + return ResourceManager.GetString("Tag_name", resourceCulture); } } @@ -376,6 +376,12 @@ namespace Yavsc.Model { } } + public static string ThisSiteUsesCookies { + get { + return ResourceManager.GetString("ThisSiteUsesCookies", resourceCulture); + } + } + public static string ReadMore { get { return ResourceManager.GetString("ReadMore", resourceCulture); diff --git a/yavscModel/LocalizedText.fr.resx b/yavscModel/LocalizedText.fr.resx index 033209ae..8165ec6a 100644 --- a/yavscModel/LocalizedText.fr.resx +++ b/yavscModel/LocalizedText.fr.resx @@ -75,9 +75,10 @@ Rôle créé Date de démarrage Soumettre + Nom du tag Version LaTeX + Ce site utilise les cookies Titre - Nom du tag Coût unitaire Liste des utilisateurs Nom d'utilisateur diff --git a/yavscModel/LocalizedText.resx b/yavscModel/LocalizedText.resx index bea081a0..5256b0dc 100644 --- a/yavscModel/LocalizedText.resx +++ b/yavscModel/LocalizedText.resx @@ -77,9 +77,10 @@ role created Start date Submit + Tag name LaTeX version + This site uses cookies Title - Tag name Unitary_cost User List User name diff --git a/yavscModel/Messaging/SimpleMessage.cs b/yavscModel/Messaging/Notification.cs similarity index 54% rename from yavscModel/Messaging/SimpleMessage.cs rename to yavscModel/Messaging/Notification.cs index f7904f34..0874dc4b 100644 --- a/yavscModel/Messaging/SimpleMessage.cs +++ b/yavscModel/Messaging/Notification.cs @@ -1,5 +1,5 @@ // -// Message.cs +// Notification.cs // // Author: // Paul Schneider @@ -22,31 +22,11 @@ using System; namespace Yavsc.Model.Messaging { - /// - /// Simple message. - /// - public class SimpleMessage + public class Notification : Google.Notification { - /// - /// Gets or sets the user name this message is comming from. - /// - /// From. - public string From { get; set; } - /// - /// Gets or sets the user names, separted by semilicon to which this message will be sent. - /// - /// To. - public string To { get; set; } - /// - /// Gets or sets the subject. - /// - /// The subject. - public string Subject { get; set; } - /// - /// Gets or sets the body. - /// - /// The body. - public string Body { get; set; } + public Notification () + { + } } } diff --git a/yavscModel/YavscModel.csproj b/yavscModel/YavscModel.csproj index 482f50a4..7b7caa64 100644 --- a/yavscModel/YavscModel.csproj +++ b/yavscModel/YavscModel.csproj @@ -155,8 +155,6 @@ - - @@ -178,6 +176,9 @@ + + +