diff --git a/NpgsqlBlogProvider/BlogManager.cs b/NpgsqlBlogProvider/BlogManager.cs index 2ebac0d7..b92f2690 100644 --- a/NpgsqlBlogProvider/BlogManager.cs +++ b/NpgsqlBlogProvider/BlogManager.cs @@ -57,6 +57,15 @@ namespace Npgsql.Web.Blog { return Provider.GetComments (postid,getHidden); } + /// + /// Tag the specified post by postid. + /// + /// Postid. + /// The tag identifier + public static long Tag(long postid, string tag) { + return Provider.Tag (postid, tag); + } + } } diff --git a/NpgsqlBlogProvider/BlogProvider.cs b/NpgsqlBlogProvider/BlogProvider.cs index dfa4fee6..76314bfc 100644 --- a/NpgsqlBlogProvider/BlogProvider.cs +++ b/NpgsqlBlogProvider/BlogProvider.cs @@ -25,6 +25,8 @@ namespace yavscModel.Blogs public abstract bool AutoValidateComment { get; set; } public abstract void ValidateComment (long cmtid); public abstract void UpdateComment (long cmtid, string content, bool visible); + public abstract long Tag (long postid,string tag); + public abstract void RemoveTag (long tagid); } } diff --git a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs index ad1c2e2f..9422dd88 100644 --- a/NpgsqlBlogProvider/NpgsqlBlogProvider.cs +++ b/NpgsqlBlogProvider/NpgsqlBlogProvider.cs @@ -14,6 +14,26 @@ namespace Npgsql.Web.Blog #region implemented abstract members of BlogProvider + public override long Tag (long postid, string tag) + { + using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) + using (NpgsqlCommand cmd = cnx.CreateCommand ()) { + cmd.CommandText = "insert into bltag (blid,tag) values (@postid,@tag) returning _id"; + cmd.Parameters.Add("@tag",tag); + cmd.Parameters.Add("@postid",postid); + return (long) cmd.ExecuteScalar (); + } + } + + public override void RemoveTag (long tagid) + { + using (NpgsqlConnection cnx = new NpgsqlConnection (connectionString)) + using (NpgsqlCommand cmd = cnx.CreateCommand ()) { + cmd.CommandText = "delete from bltag where _id = @tagid"; + cmd.Parameters.Add("@tagid",tagid); + cmd.ExecuteNonQuery (); + } + } public override long GetPostId (string username, string title) { throw new NotImplementedException (); @@ -199,6 +219,18 @@ namespace Npgsql.Web.Blog be.Posted = rdr.GetDateTime (rdr.GetOrdinal ("posted")); be.Visible = rdr.GetBoolean (rdr.GetOrdinal ("visible")); be.Id = rdr.GetInt64 (rdr.GetOrdinal ("_id")); + using (NpgsqlCommand cmdtags = cnx.CreateCommand()) { + List tags = new List (); + cmd.CommandText = "select tag from bltags where blid = @pid"; + cmd.Parameters.Add ("@pid", be.Id); + using (NpgsqlDataReader rdrt = cmd.ExecuteReader ()) { + + while (rdrt.Read ()) { + tags.Add (rdrt.GetString (0)); + } + } + be.Tags = tags.ToArray (); + } } } } diff --git a/WorkFlowProvider/NpgsqlContentProvider.cs b/WorkFlowProvider/NpgsqlContentProvider.cs index 34de5455..80a173a7 100644 --- a/WorkFlowProvider/NpgsqlContentProvider.cs +++ b/WorkFlowProvider/NpgsqlContentProvider.cs @@ -12,6 +12,35 @@ namespace WorkFlowProvider { public class NpgsqlContentProvider: ProviderBase, IContentProvider { + public Estimate[] GetEstimates (string client) + { + throw new NotImplementedException (); + } + + public void Install () + { + throw new NotImplementedException (); + } + + public void Uninstall () + { + throw new NotImplementedException (); + } + + public ConfigurationSection DefaultConfig (string appName, string cnxStr) + { + throw new NotImplementedException (); + } + + public bool Active { + get { + throw new NotImplementedException (); + } + set { + throw new NotImplementedException (); + } + } + public StatusChange[] GetWrittingStatuses (long wrid) { throw new NotImplementedException (); @@ -246,6 +275,9 @@ namespace WorkFlowProvider cnxstr = ConfigurationManager.ConnectionStrings [config ["connectionStringName"]].ConnectionString; applicationName = config["applicationName"] ?? "/"; + + + } protected NpgsqlConnection CreateConnection () diff --git a/WorkFlowProvider/WFManager.cs b/WorkFlowProvider/WFManager.cs index 99432237..5a48f513 100644 --- a/WorkFlowProvider/WFManager.cs +++ b/WorkFlowProvider/WFManager.cs @@ -12,7 +12,10 @@ namespace WorkFlowProvider { return ContentProvider.GetEstimate (estid); } - + public static Estimate [] GetEstimates (string client) + { + return ContentProvider.GetEstimates (client); + } public static void UpdateWritting (Writting wr) { ContentProvider.UpdateWritting (wr); @@ -80,6 +83,7 @@ namespace WorkFlowProvider } + public static long Write(long estid, string desc, decimal ucost, int count, long productid) { return ContentProvider.Write(estid, desc, ucost, count, productid); diff --git a/web/Controllers/AccountController.cs b/web/Controllers/AccountController.cs index f70ad920..61f6e527 100644 --- a/web/Controllers/AccountController.cs +++ b/web/Controllers/AccountController.cs @@ -100,11 +100,16 @@ namespace Yavsc.Controllers return View (model); case MembershipCreateStatus.Success: FileInfo fi = new FileInfo ( - Server.MapPath(registrationMessage)); + Server.MapPath (registrationMessage)); if (!fi.Exists) { - ViewData["Error"] = "Erreur inattendue (pas de corps de message à envoyer)"; + ViewData ["Error"] = + string.Format ( + "Erreur inattendue (pas de corps de message " + + "à envoyer pour le message de confirmation ({0}))", + registrationMessage); return View (model); } + using (StreamReader sr = fi.OpenText()) { string body = sr.ReadToEnd(); body = body.Replace("<%SiteName%>",YavscHelpers.SiteName); @@ -189,79 +194,8 @@ namespace Yavsc.Controllers return View (model); } - [Authorize()] - public ActionResult UserList () - { - MembershipUserCollection c = Membership.GetAllUsers (); - return View (c); - } - - private const string adminRoleName = "Admin"; - - [Authorize()] - public ActionResult Admin (NewAdminModel model) - { - string currentUser = Membership.GetUser ().UserName; - if (ModelState.IsValid) { - Roles.AddUserToRole (model.UserName, adminRoleName); - ViewData ["Message"] = model.UserName + " was added to the role '" + adminRoleName + "'"; - } else { - if (!Roles.RoleExists (adminRoleName)) { - Roles.CreateRole (adminRoleName); - string.Format ("The role '{0}' has just been created. ", - adminRoleName); - } - string [] admins = Roles.GetUsersInRole (adminRoleName); - if (admins.Length > 0) { - if (! admins.Contains (Membership.GetUser ().UserName)) { - ModelState.Remove("UserName"); - ModelState.AddModelError("UserName", "You're not administrator!"); - return View ("Index"); - } - } else { - Roles.AddUserToRole (currentUser, adminRoleName); - admins = new string[] { currentUser }; - ViewData ["Message"] += string.Format ( - "There was no user in the 'Admin' role. You ({0}) was just added as the firt user in the 'Admin' role. ", currentUser); - } - - List users = new List (); - foreach (MembershipUser u in Membership.GetAllUsers ()) { - var i = new SelectListItem (); - i.Text = string.Format ("{0} <{1}>", u.UserName, u.Email); - i.Value = u.UserName; - users.Add (i); - } - ViewData ["useritems"] = users; - ViewData ["admins"] = admins; - } - return View (model); - } - - [Authorize()] - public ActionResult RoleList () - { - return View (Roles.GetAllRoles ()); - } - - [Authorize(Roles="Admin")] - public ActionResult RemoveFromRole(string username, string rolename, string returnUrl) - { - Roles.RemoveUserFromRole(username,rolename); - return Redirect(returnUrl); - } - [Authorize(Roles="Admin")] - public ActionResult RemoveUser (string username, string submitbutton) - { - if (submitbutton == "Supprimer") { - Membership.DeleteUser (username); - ViewData["Message"]= - string.Format("utilisateur \"{0}\" supprimé",username); - } - return RedirectToAction("UserList"); - } [Authorize] [HttpPost] //public ActionResult UpdateProfile(HttpPostedFileBase Avatar, string Address, string CityAndState, string ZipCode, string Country, string WebSite) @@ -304,30 +238,6 @@ namespace Yavsc.Controllers return RedirectToAction ("Profile"); } - [Authorize(Roles="Admin")] - public ActionResult RemoveRole (string rolename, string submitbutton) - { - if (submitbutton == "Supprimer") - { - Roles.DeleteRole(rolename); - } - return RedirectToAction("RoleList"); - } - - [Authorize(Roles="Admin")] - public ActionResult RemoveRoleQuery(string rolename) - { - ViewData["roletoremove"] = rolename; - return View (); - } - - [Authorize(Roles="Admin")] - public ActionResult RemoveUserQuery(string username) - { - ViewData["usertoremove"] = username; - return UserList(); - } - [Authorize] public ActionResult Logout (string returnUrl) { @@ -335,20 +245,9 @@ namespace Yavsc.Controllers return Redirect(returnUrl); } - [Authorize(Roles="Admin")] - public ActionResult AddRole () - { - return View (); - } - [Authorize(Roles="Admin")] - public ActionResult DoAddRole (string rolename) - { - Roles.CreateRole(rolename); - ViewData["Message"] = "Rôle créé : "+rolename; - return View (); - } + [HttpGet] public ActionResult Validate (string id, string key) { MembershipUser u = Membership.GetUser (id, false); diff --git a/web/Controllers/AdminController.cs b/web/Controllers/AdminController.cs new file mode 100644 index 00000000..7b40c0ae --- /dev/null +++ b/web/Controllers/AdminController.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Mvc; +using System.Web.Mvc.Ajax; +using System.Web.Security; +using yavscModel.RolesAndMembers; + +namespace Yavsc.Controllers.Controllers +{ + public class AdminController : Controller + { + [Authorize(Roles="Admin")] + public ActionResult RemoveFromRole(string username, string rolename, string returnUrl) + { + Roles.RemoveUserFromRole(username,rolename); + return Redirect(returnUrl); + } + + [Authorize(Roles="Admin")] + public ActionResult RemoveUser (string username, string submitbutton) + { + if (submitbutton == "Supprimer") { + Membership.DeleteUser (username); + ViewData["Message"]= + string.Format("utilisateur \"{0}\" supprimé",username); + } + return RedirectToAction("UserList"); + } + [Authorize(Roles="Admin")] + public ActionResult RemoveRole (string rolename, string submitbutton) + { + if (submitbutton == "Supprimer") + { + Roles.DeleteRole(rolename); + } + return RedirectToAction("RoleList"); + } + + [Authorize(Roles="Admin")] + public ActionResult RemoveRoleQuery(string rolename) + { + ViewData["roletoremove"] = rolename; + return View (); + } + + [Authorize(Roles="Admin")] + public ActionResult RemoveUserQuery(string username) + { + ViewData["usertoremove"] = username; + return UserList(); + } + //TODO no more than pageSize results per page + [Authorize()] + public ActionResult UserList () + { + MembershipUserCollection c = Membership.GetAllUsers (); + return View (c); + } + + [Authorize(Roles="Admin")] + public ActionResult AddRole () + { + return View (); + } + + [Authorize(Roles="Admin")] + public ActionResult DoAddRole (string rolename) + { + Roles.CreateRole(rolename); + ViewData["Message"] = "Rôle créé : "+rolename; + return View (); + } + + [Authorize()] + public ActionResult RoleList () + { + return View (Roles.GetAllRoles ()); + } + private const string adminRoleName = "Admin"; + protected override void Initialize (System.Web.Routing.RequestContext requestContext) + { + base.Initialize (requestContext); + if (!Roles.RoleExists (adminRoleName)) { + Roles.CreateRole (adminRoleName); + } + } + + [Authorize()] + public ActionResult Admin (NewAdminModel model) + { + string currentUser = Membership.GetUser ().UserName; + if (ModelState.IsValid) { + Roles.AddUserToRole (model.UserName, adminRoleName); + ViewData ["Message"] = model.UserName + " was added to the role '" + adminRoleName + "'"; + } else { + // assert (Roles.RoleExists (adminRoleName)) + string [] admins = Roles.GetUsersInRole (adminRoleName); + if (admins.Length > 0) { + if (! admins.Contains (Membership.GetUser ().UserName)) { + ModelState.Remove("UserName"); + ModelState.AddModelError("UserName", "You're not administrator!"); + return View ("Index"); + } + } else { + Roles.AddUserToRole (currentUser, adminRoleName); + admins = new string[] { currentUser }; + ViewData ["Message"] += string.Format ( + "There was no user in the 'Admin' role. You ({0}) was just added as the firt user in the 'Admin' role. ", currentUser); + } + + List users = new List (); + foreach (MembershipUser u in Membership.GetAllUsers ()) { + var i = new SelectListItem (); + i.Text = string.Format ("{0} <{1}>", u.UserName, u.Email); + i.Value = u.UserName; + users.Add (i); + } + ViewData ["useritems"] = users; + ViewData ["admins"] = admins; + } + return View (model); + } + } +} + diff --git a/web/Controllers/BackOfficeController.cs b/web/Controllers/BackOfficeController.cs index 5f47af6d..555c56db 100644 --- a/web/Controllers/BackOfficeController.cs +++ b/web/Controllers/BackOfficeController.cs @@ -47,6 +47,10 @@ namespace Yavsc.Controllers throw new NotImplementedException(); } + [Authorize(Roles="Admin")] + public ActionResult Upgrade(DataAccess datac) { + throw new NotImplementedException(); + } [Authorize(Roles="Admin")] public ActionResult Restore(DataAccess datac,string backupName,bool dataOnly=true) diff --git a/web/Controllers/BasketController.cs b/web/Controllers/BasketController.cs index 0f4c0254..4aef0999 100644 --- a/web/Controllers/BasketController.cs +++ b/web/Controllers/BasketController.cs @@ -2,72 +2,54 @@ using System; using System.Collections.Generic; using System.Linq; using System.Web; -using System.Web.Mvc; using System.Web.Security; +using System.Web.Http; +using yavscModel.WorkFlow; -namespace Yavsc.Controllers +namespace Yavsc.ApiControllers { // TODO should mostly be an API Controller - public class BasketController : Controller + public class BasketController : ApiController { - public ActionResult Index() - { - return View (); - } + /// + /// Validates the order. + /// + /// + /// true, if order was validated, false otherwise. + /// Orderid. + bool ValidateOrder(long orderid) { + throw new NotImplementedException (); + } - public ActionResult Details(int id) - { - return View (); - } + long CreateOrder(string title,string mesg) + { + throw new NotImplementedException (); + } - public ActionResult Create() - { - throw new NotImplementedException(); - // var user = Membership.GetUser (); - // var username = (user != null)?user.UserName:Request.AnonymousID; - // get an existing basket - - //return View (); - } + /// + /// Adds to basket, a product from the catalog, in the user's session. + /// + /// The to basket. + [HttpGet] + public long AddToOrder (long orderid, string prodref,int count, object prodparams=null) + { + //TODO find the basket for Membership.GetUser().UserName + //return WFManager.Write(estid << from the basket, desc, ucost, count, productid); + throw new NotImplementedException (); + } - [HttpPost] - public ActionResult Create(FormCollection collection) - { - try { - return RedirectToAction ("Index"); - } catch { - return View (); - } - } - - public ActionResult Edit(int id) - { - return View (); - } + [HttpGet] + [Authorize] + public Estimate[] YourEstimates() + { + return WorkFlowProvider.WFManager.GetEstimates ( + Membership.GetUser().UserName); + } - [HttpPost] - public ActionResult Edit(int id, FormCollection collection) - { - try { - return RedirectToAction ("Index"); - } catch { - return View (); - } - } - - public ActionResult Delete(int id) - { - return View (); - } - - [HttpPost] - public ActionResult Delete(int id, FormCollection collection) - { - try { - return RedirectToAction ("Index"); - } catch { - return View (); - } - } + [HttpGet] + public object Order (BasketImpact bi) + { + return new { c="lmk,", message="Panier impacté", impactRef=bi.ProductRef, count=bi.Count}; + } } } \ No newline at end of file diff --git a/web/Controllers/BasketImpact.cs b/web/Controllers/BasketImpact.cs index a57d6087..e83254ed 100644 --- a/web/Controllers/BasketImpact.cs +++ b/web/Controllers/BasketImpact.cs @@ -15,7 +15,8 @@ namespace Yavsc.ApiControllers public class BasketImpact { public string ProductRef { get; set; } - public int count { get; set; } + public int Count { get; set; } + public string Message { get; set; } } } diff --git a/web/Controllers/BlogsApiController.cs b/web/Controllers/BlogsApiController.cs index e9c07f4e..103d3f68 100644 --- a/web/Controllers/BlogsApiController.cs +++ b/web/Controllers/BlogsApiController.cs @@ -12,7 +12,16 @@ namespace Yavsc.Controllers { public class BlogsApiController : Controller { - public void Tag (long postid,string tag) { + private const string adminRoleName = "Admin"; + protected override void Initialize (System.Web.Routing.RequestContext requestContext) + { + base.Initialize (requestContext); + if (!Roles.RoleExists (adminRoleName)) { + Roles.CreateRole (adminRoleName); + } + } + + public long Tag (long postid,string tag) { BlogEntry e = BlogManager.GetPost (postid); if (!Roles.IsUserInRole ("Admin")) { string rguser = Membership.GetUser ().UserName; @@ -23,6 +32,7 @@ namespace Yavsc.Controllers e.UserName)); } } + return BlogManager.Tag (postid, tag); } public static HttpStatusCodeResult RemovePost(string user, string title) { @@ -44,6 +54,10 @@ namespace Yavsc.Controllers BlogManager.RemovePost (user, title); return new HttpStatusCodeResult (200); } + + public void RemoveTag(long tagid) { + throw new NotImplementedException (); + } } } diff --git a/web/Controllers/FrontOfficeApiController.cs b/web/Controllers/FrontOfficeApiController.cs index 6202e2c5..0887c020 100644 --- a/web/Controllers/FrontOfficeApiController.cs +++ b/web/Controllers/FrontOfficeApiController.cs @@ -13,6 +13,7 @@ using System.IO; using System.Net; using WorkFlowProvider; using System.Web.Security; +using yavscModel.WorkFlow; namespace Yavsc.ApiControllers { @@ -66,17 +67,21 @@ namespace Yavsc.ApiControllers return result; } + + + [Authorize] + [HttpGet] /// - /// Adds to basket, a product from the catalog, in the user's session. + /// Gets the estimate. /// - /// The to basket. - [HttpGet] - public long AddToBasket (string prodref,int count, object prodparams=null) + /// The estimate. + /// Estid. + public Estimate GetEstimate (long estid) { - //TODO find the basket for Membership.GetUser().UserName - //return WFManager.Write(estid << from the basket, desc, ucost, count, productid); - throw new NotImplementedException (); + Estimate est = WFManager.ContentProvider.GetEstimate (estid); + return est; } + } } diff --git a/web/Controllers/FrontOfficeController.cs b/web/Controllers/FrontOfficeController.cs index ea4c9ab2..6242c160 100644 --- a/web/Controllers/FrontOfficeController.cs +++ b/web/Controllers/FrontOfficeController.cs @@ -10,14 +10,25 @@ using Yavsc.Controllers; using System.Collections.Generic; using yavscModel.WorkFlow; using WorkFlowProvider; +using System.Web.Security; namespace Yavsc.Controllers { public class FrontOfficeController : Controller { [HttpGet] - public Estimate GetEstimate(long estid) { - return WFManager.GetEstimate (estid); + [HttpPost] + public ActionResult Estimate(Estimate e) + { + if (ModelState.IsValid) { + if (e.Id > 0) { + Estimate f = WFManager.GetEstimate (e.Id); + if (e.Owner != f.Owner) + if (!Roles.IsUserInRole ("FrontOffice")) + throw new UnauthorizedAccessException ("You're not allowed to modify this estimate"); + } + } + return View (e); } [AcceptVerbs("GET")] diff --git a/web/Controllers/HomeController.cs b/web/Controllers/HomeController.cs index 95a15a10..c4e54ffb 100644 --- a/web/Controllers/HomeController.cs +++ b/web/Controllers/HomeController.cs @@ -60,12 +60,12 @@ namespace Yavsc.Controllers public ActionResult Index () { - InitCatalog (); + InitCulture (); ViewData ["Message"] = string.Format(T.GetString("Welcome")+"({0})",GetType ().Assembly.FullName); return View (); } - public void InitCatalog() { + public void InitCulture() { CultureInfo culture = null; string defaultCulture = "fr"; diff --git a/web/Controllers/T.cs b/web/Controllers/T.cs index a212dbad..70fac62c 100644 --- a/web/Controllers/T.cs +++ b/web/Controllers/T.cs @@ -17,6 +17,5 @@ namespace Yavsc { return Mono.Unix.Catalog.GetString (msgid); } - } } diff --git a/web/Controllers/WorkFlowController.cs b/web/Controllers/WorkFlowController.cs index bcc1fd45..b3372ee9 100644 --- a/web/Controllers/WorkFlowController.cs +++ b/web/Controllers/WorkFlowController.cs @@ -14,6 +14,16 @@ namespace Yavsc.ApiControllers [HttpControllerConfiguration(ActionValueBinder=typeof(Basic.MvcActionValueBinder))] public class WorkFlowController : ApiController { + string adminRoleName="Admin"; + + protected override void Initialize (HttpControllerContext controllerContext) + { + base.Initialize (controllerContext); + if (!Roles.RoleExists (adminRoleName)) { + Roles.CreateRole (adminRoleName); + } + } + [HttpGet] [Authorize] public long CreateEstimate (string title) @@ -21,6 +31,7 @@ namespace Yavsc.ApiControllers return WFManager.CreateEstimate ( Membership.GetUser().UserName,title); } + [HttpGet] [Authorize] public void DropWritting(long wrid) @@ -49,11 +60,7 @@ namespace Yavsc.ApiControllers return new { test=string.Format("Hello {0}!",username) }; } - [HttpGet] - public object Order (BasketImpact bi) - { - return new { c="lmk,", message="Panier impacté", impactRef=bi.ProductRef, count=bi.count}; - } + [HttpGet] [Authorize] @@ -63,18 +70,7 @@ namespace Yavsc.ApiControllers return WFManager.Write(estid, desc, ucost, count, productid); } - [Authorize] - [HttpGet] - /// - /// Gets the estimate. - /// - /// The estimate. - /// Estid. - public Estimate GetEstimate (long estid) - { - Estimate est = WFManager.ContentProvider.GetEstimate (estid); - return est; - } + /* public object Details(int id) { diff --git a/web/Models/App.master b/web/Models/App.master index aac47956..0fb20616 100644 --- a/web/Models/App.master +++ b/web/Models/App.master @@ -32,17 +32,13 @@ - - - -

+ + +

<%= Page.Title %>

- - - <% if (ViewData["Error"]!=null) { %>
<%= Html.Encode(ViewData["Error"]) %> @@ -53,7 +49,7 @@ <%= Html.Encode(ViewData["Message"]) %>
<% } %> - + diff --git a/web/Views/Account/AddRole.aspx b/web/Views/Account/AddRole.aspx index d0ba38b5..772712ac 100644 --- a/web/Views/Account/AddRole.aspx +++ b/web/Views/Account/AddRole.aspx @@ -1,9 +1,4 @@ -<%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -

Ajout d'un role

-
+<%@ Page Title="Ajout d'un role" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> <%= Html.ValidationSummary() %> diff --git a/web/Views/Account/Admin.aspx b/web/Views/Account/Admin.aspx index 65e9df7c..a50a8f0a 100644 --- a/web/Views/Account/Admin.aspx +++ b/web/Views/Account/Admin.aspx @@ -1,7 +1,4 @@ -<%@ Page Title="Administration" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - -

Liste des administrateurs

-
+<%@ Page Title="Liste des administrateurs" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %>
diff --git a/web/Views/Account/ChangePassword.aspx b/web/Views/Account/ChangePassword.aspx index d272736c..fd46b38b 100644 --- a/web/Views/Account/ChangePassword.aspx +++ b/web/Views/Account/ChangePassword.aspx @@ -1,9 +1,5 @@ <%@ Page Title="Change your Password" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - - <%= Html.ValidationSummary("Modification de mot de passe") %> <% using(Html.BeginForm("ChangePassword", "Account")) { %> diff --git a/web/Views/Account/ChangePasswordSuccess.aspx b/web/Views/Account/ChangePasswordSuccess.aspx index 1a3bf654..ce22f4fd 100644 --- a/web/Views/Account/ChangePasswordSuccess.aspx +++ b/web/Views/Account/ChangePasswordSuccess.aspx @@ -1,6 +1,4 @@ <%@ Page Title="Successfully changed your password" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - -
<%= Html.ActionLink("Register","Register")%>
diff --git a/web/Views/Account/Index.aspx b/web/Views/Account/Index.aspx index a75eb950..cb848e27 100644 --- a/web/Views/Account/Index.aspx +++ b/web/Views/Account/Index.aspx @@ -1,6 +1,4 @@ <%@ Page Title="Comptes utilisateur - Index" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - -

Comptes utilisteur

diff --git a/web/Views/Account/Login.aspx b/web/Views/Account/Login.aspx index a96ea09f..331c9a48 100644 --- a/web/Views/Account/Login.aspx +++ b/web/Views/Account/Login.aspx @@ -1,9 +1,5 @@ <%@ Page Title="Login" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -
<%= Html.ValidationSummary("Ouverture de session") %> <% using(Html.BeginForm("DoLogin", "Account")) %> <% { %> @@ -22,7 +18,6 @@ <% } %> -
-
-<%= Html.ActionLink("S'enregistrer","Register",new {returnUrl=ViewData["returnUrl"]}) %>
+ +<%= Html.ActionLink("S'enregistrer","Register",new {returnUrl=ViewData["returnUrl"]}) %>
diff --git a/web/Views/Account/Profile.aspx b/web/Views/Account/Profile.aspx index 113dde26..e3c9925f 100644 --- a/web/Views/Account/Profile.aspx +++ b/web/Views/Account/Profile.aspx @@ -1,13 +1,18 @@ <%@ Page Title="Profile" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - -<%=ViewData["UserName"]%> : Profile - <%=YavscHelpers.SiteName%> + + +<% Title = ViewData["UserName"]+"'s profile" %> + -

<%=ViewData["UserName"]%> : Profile - <%=YavscHelpers.SiteName%>

-

<%= Html.ActionLink("Changer de mot de passe","ChangePassword", "Account")%>

+

<%=ViewData["UserName"]%>'s profile - <%=YavscHelpers.SiteName%>

+

+ -<%= Html.ValidationSummary() %> + <%= Html.ActionLink("Changer de mot de passe","ChangePassword", "Account")%> + + <%= Html.ValidationSummary() %> <% using(Html.BeginForm("UpdateProfile", "Account", FormMethod.Post, new { enctype = "multipart/form-data" })) %> <% { %> diff --git a/web/Views/Account/Register.aspx b/web/Views/Account/Register.aspx index d4c5e638..d64dc3af 100644 --- a/web/Views/Account/Register.aspx +++ b/web/Views/Account/Register.aspx @@ -1,7 +1,4 @@ <%@ Page Title="Register" Language="C#" Inherits="Yavsc.RegisterPage" MasterPageFile="~/Models/App.master" %> - -

Créez votre compte utilisateur <%= Html.Encode(YavscHelpers.SiteName) %>

-
<%= Html.ValidationSummary() %> diff --git a/web/Views/Account/RegistrationPending.aspx b/web/Views/Account/RegistrationPending.aspx index 7bb96ab4..4cb3accf 100644 --- a/web/Views/Account/RegistrationPending.aspx +++ b/web/Views/Account/RegistrationPending.aspx @@ -1,17 +1,13 @@ -<%@ Page Title="Comptes utilisateur - Index" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -

Comptes utilisteur

-
+<%@ Page Title="Comptes utilisateur" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> + -

Votre compte utilisateur <%= Html.Encode(YavscHelpers.SiteName) %> a été créé, un e-mail de validation de votre compte a été envoyé a l'adresse fournie:
<<%= Html.Encode(ViewData["email"]) %>>.
Vous devriez le recevoir rapidement.
Pour valider votre compte, suivez le lien indiqué dans cet e-mail. -

+
diff --git a/web/Views/Account/RemoveRoleQuery.aspx b/web/Views/Account/RemoveRoleQuery.aspx index a6bc14b4..e1b4f0b6 100644 --- a/web/Views/Account/RemoveRoleQuery.aspx +++ b/web/Views/Account/RemoveRoleQuery.aspx @@ -1,9 +1,4 @@ <%@ Page Title="User removal" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -

Suppression d'un rôle

-
<%= Html.ValidationSummary() %> diff --git a/web/Views/Account/RoleList.aspx b/web/Views/Account/RoleList.aspx index 573fb065..751407cc 100644 --- a/web/Views/Account/RoleList.aspx +++ b/web/Views/Account/RoleList.aspx @@ -1,9 +1,4 @@ -<%@ Page Title="Role list" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -

Liste des rôles

-
+<%@ Page Title="Liste des rôles" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> Roles:
    diff --git a/web/Views/Account/UserList.aspx b/web/Views/Account/UserList.aspx index b506bd92..8bb9da3b 100644 --- a/web/Views/Account/UserList.aspx +++ b/web/Views/Account/UserList.aspx @@ -1,9 +1,4 @@ <%@ Page Title="User List" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -

    Liste des utilisateurs

    -
      diff --git a/web/Views/Account/Validate.aspx b/web/Views/Account/Validate.aspx index a26c70d5..a5975bd6 100644 --- a/web/Views/Account/Validate.aspx +++ b/web/Views/Account/Validate.aspx @@ -1,8 +1,2 @@ <%@ Page Title="Comptes utilisateur - Validation" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -

      Validation d'un compte utilisateur

      -
      - - + diff --git a/web/Views/BackOffice/BackupCreated.aspx b/web/Views/BackOffice/BackupCreated.aspx index a965d9d5..936039ea 100644 --- a/web/Views/BackOffice/BackupCreated.aspx +++ b/web/Views/BackOffice/BackupCreated.aspx @@ -1,13 +1,7 @@ -<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - -

      Backup created

      -
      +<%@ Page Title="Backup created" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %>

      Error message

      <%= Html.Encode(Model.Error) %>

      Message

      <%= Html.Encode(Model.Message) %>

      File name

      <%= Html.Encode(Model.FileName) %>

      Exit Code

      <%= Html.Encode(Model.ExitCode) %>
      -
      diff --git a/web/Views/BackOffice/Backups.aspx b/web/Views/BackOffice/Backups.aspx index 5f625d33..a11783cd 100644 --- a/web/Views/BackOffice/Backups.aspx +++ b/web/Views/BackOffice/Backups.aspx @@ -1,10 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - -Backups - - -

      Backups

      -
      <%=Html.ActionLink("Create a database backup", "CreateBackup", "BackOffice")%>
      diff --git a/web/Views/BackOffice/CreateBackup.aspx b/web/Views/BackOffice/CreateBackup.aspx index c287ffe7..635d15dc 100644 --- a/web/Views/BackOffice/CreateBackup.aspx +++ b/web/Views/BackOffice/CreateBackup.aspx @@ -1,8 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - <%= Html.ValidationSummary("CreateBackup") %> <% using (Html.BeginForm("CreateBackup","BackOffice")) { %> diff --git a/web/Views/BackOffice/Index.aspx b/web/Views/BackOffice/Index.aspx index 0a999001..4840f5bd 100644 --- a/web/Views/BackOffice/Index.aspx +++ b/web/Views/BackOffice/Index.aspx @@ -1,8 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - <%= Html.ActionLink("Backups","Backups","BackOffice") %> diff --git a/web/Views/BackOffice/Restore.aspx b/web/Views/BackOffice/Restore.aspx index 523e2b77..ce2c1ba4 100644 --- a/web/Views/BackOffice/Restore.aspx +++ b/web/Views/BackOffice/Restore.aspx @@ -1,11 +1,5 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - - - <%= Html.ValidationSummary("Restore a database backup") %> <% using (Html.BeginForm("Restore","BackOffice")) { %> diff --git a/web/Views/BackOffice/Restored.aspx b/web/Views/BackOffice/Restored.aspx index cb320315..375fc051 100644 --- a/web/Views/BackOffice/Restored.aspx +++ b/web/Views/BackOffice/Restored.aspx @@ -1,8 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - -

      <%=Html.Encode(ViewData["BackupName"])%> Restauration

      Error message

      <%= Html.Encode(Model.Error) %>
      diff --git a/web/Views/Blogs/Error.aspx b/web/Views/Blogs/Error.aspx index e49602ac..739b5216 100644 --- a/web/Views/Blogs/Error.aspx +++ b/web/Views/Blogs/Error.aspx @@ -1,11 +1,6 @@ -<%@ Page Title="Comptes utilisateur - Index" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - -

      Comptes utilisteur

      -
      - +<%@ Page Title="Comptes utilisateur - Erreur" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> +
      <%= Html.Encode(ViewData["Message"]) %>
      Your UID : diff --git a/web/Views/Blogs/RemovePost.aspx b/web/Views/Blogs/RemovePost.aspx index 96b7b2cb..662609d9 100644 --- a/web/Views/Blogs/RemovePost.aspx +++ b/web/Views/Blogs/RemovePost.aspx @@ -1,13 +1,5 @@ <%@ Page Title="" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - - - - - - <%= Html.ValidationSummary() %> diff --git a/web/Views/Blogs/TitleNotFound.aspx b/web/Views/Blogs/TitleNotFound.aspx index b6334ec1..6a8453e3 100644 --- a/web/Views/Blogs/TitleNotFound.aspx +++ b/web/Views/Blogs/TitleNotFound.aspx @@ -1,9 +1,4 @@ <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master"%> - - - - - Pas d'article trouvé ici: <<%= Html.Encode(ViewData["BlogUser"]) %>/<%= Html.Encode(ViewData["PostTitle"]) %>> diff --git a/web/Views/FileSystem/Create.aspx b/web/Views/FileSystem/Create.aspx index c994d646..7f8ef9d5 100644 --- a/web/Views/FileSystem/Create.aspx +++ b/web/Views/FileSystem/Create.aspx @@ -1,4 +1,4 @@ -<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> +<%@ Page Title="File posting" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> <% using(Html.BeginForm("Create", "FileSystem", FormMethod.Post, new { enctype = "multipart/form-data" })) { %> diff --git a/web/Views/FileSystem/Delete.aspx b/web/Views/FileSystem/Delete.aspx index e6c14b90..b8c893bb 100644 --- a/web/Views/FileSystem/Delete.aspx +++ b/web/Views/FileSystem/Delete.aspx @@ -1,7 +1,3 @@ -<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - +<%@ Page Title="File System - File removal" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> diff --git a/web/Views/FileSystem/Details.aspx b/web/Views/FileSystem/Details.aspx index 79bec8b3..4be065bc 100644 --- a/web/Views/FileSystem/Details.aspx +++ b/web/Views/FileSystem/Details.aspx @@ -1,8 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - <%= Model.Name %>
      Création : diff --git a/web/Views/FileSystem/Edit.aspx b/web/Views/FileSystem/Edit.aspx index 4e92b60b..b4de16ff 100644 --- a/web/Views/FileSystem/Edit.aspx +++ b/web/Views/FileSystem/Edit.aspx @@ -1,8 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - <%= Html.ActionLink("Delete","FileSystem") %> <%= Html.ActionLink("Rename","FileSystem") %> diff --git a/web/Views/FileSystem/Index.aspx b/web/Views/FileSystem/Index.aspx index 345305d4..5c77d6fe 100644 --- a/web/Views/FileSystem/Index.aspx +++ b/web/Views/FileSystem/Index.aspx @@ -1,9 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - -

      Index of <%=ViewData["UserName"] %>'s files (<%= Html.Encode(Model.Count) %>)

        diff --git a/web/Views/FrontOffice/Brand.aspx b/web/Views/FrontOffice/Brand.aspx index a1177ab8..86e8bde4 100644 --- a/web/Views/FrontOffice/Brand.aspx +++ b/web/Views/FrontOffice/Brand.aspx @@ -1,6 +1,5 @@ <%@ Page Title="Catalog" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - +

        <% if (Model.Logo!=null) { %> <%=Model.Logo.Alt%> diff --git a/web/Views/FrontOffice/Catalog.aspx b/web/Views/FrontOffice/Catalog.aspx index fdc51f15..4d897125 100644 --- a/web/Views/FrontOffice/Catalog.aspx +++ b/web/Views/FrontOffice/Catalog.aspx @@ -1,9 +1,5 @@ <%@ Page Title="Catalog" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - - <% foreach (Brand b in Model.Brands ) { %>

        <%= Html.ActionLink( b.Name, "Brand", new { id = b.Name }, new { @class="actionlink" } ) %>

        diff --git a/web/Views/FrontOffice/Command.aspx b/web/Views/FrontOffice/Command.aspx index 65933f74..b1ea51d6 100644 --- a/web/Views/FrontOffice/Command.aspx +++ b/web/Views/FrontOffice/Command.aspx @@ -1,7 +1,4 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - + diff --git a/web/Views/FrontOffice/Product.aspx b/web/Views/FrontOffice/Product.aspx index 0aeb5a48..cd741e71 100644 --- a/web/Views/FrontOffice/Product.aspx +++ b/web/Views/FrontOffice/Product.aspx @@ -1,10 +1,12 @@ <%@ Page Title="Catalog" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - -<%= Html.Encode(Model.Name) %> + + +<% Title = Model.Name; %> + -

        <%= Html.Encode(Model.Name) %>

        <%= Html.Encode(Model.Reference) %>
        +

        <%= Html.Encode(Model.Description) %>

        diff --git a/web/Views/FrontOffice/ProductCategory.aspx b/web/Views/FrontOffice/ProductCategory.aspx index 063a6365..39969bd8 100644 --- a/web/Views/FrontOffice/ProductCategory.aspx +++ b/web/Views/FrontOffice/ProductCategory.aspx @@ -1,8 +1,5 @@ <%@ Page Title="Catalog" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - - - - + <% foreach (Product p in Model.Products ) { %> diff --git a/web/Views/FrontOffice/ReferenceNotFound.aspx b/web/Views/FrontOffice/ReferenceNotFound.aspx index e6c14b90..51855ace 100644 --- a/web/Views/FrontOffice/ReferenceNotFound.aspx +++ b/web/Views/FrontOffice/ReferenceNotFound.aspx @@ -1,7 +1,5 @@ -<%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - +<%@ Page Title="Référence absente au catalogue" Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> + + diff --git a/web/Views/FrontOffice/Service.aspx b/web/Views/FrontOffice/Service.aspx index d61c5e19..4bdb2048 100644 --- a/web/Views/FrontOffice/Service.aspx +++ b/web/Views/FrontOffice/Service.aspx @@ -1,9 +1,9 @@ <%@ Page Title="Catalog" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - -<%= Html.Encode(Model.Name) %> + +<%= Title = ViewData ["BrandName"] + " " + Model.Name; %> -

        <%=ViewData ["BrandName"]%> - <%=ViewData ["ProdCatName"]%> - <%= Html.ActionLink( Model.Name, "Product", new { id = ViewData ["BrandName"], pc = ViewData ["ProdCatRef"] , pref = Model.Reference } ) %>

        +

        <%=ViewData ["ProdCatName"]%> - <%= Html.ActionLink( Model.Name, "Product", new { id = ViewData ["BrandName"], pc = ViewData ["ProdCatRef"] , pref = Model.Reference } ) %>

        diff --git a/web/Views/Home/AOEMail.aspx b/web/Views/Home/AOEMail.aspx index e6c14b90..f64c5e48 100644 --- a/web/Views/Home/AOEMail.aspx +++ b/web/Views/Home/AOEMail.aspx @@ -1,7 +1,2 @@ <%@ Page Language="C#" MasterPageFile="~/Models/App.master" Inherits="System.Web.Mvc.ViewPage" %> - - - - - - + diff --git a/web/Views/WorkFlow/Index.aspx b/web/Views/WorkFlow/Index.aspx index dd7860b9..a70bbb42 100644 --- a/web/Views/WorkFlow/Index.aspx +++ b/web/Views/WorkFlow/Index.aspx @@ -1,7 +1,5 @@ -<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master"%> - - <%= "Index - " + Html.Encode(YavscHelpers.SiteName) + "" %> - +<%@ Page Title="Workflow" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master"%> +
        <%= Html.ActionLink("blogs","Index","WorkFlow") %> diff --git a/web/Views/WorkFlow/NewProject.aspx b/web/Views/WorkFlow/NewProject.aspx index 7ae525e7..00167a19 100644 --- a/web/Views/WorkFlow/NewProject.aspx +++ b/web/Views/WorkFlow/NewProject.aspx @@ -1,6 +1,4 @@ <%@ Page Title="Nouveau projet" Language="C#" Inherits="System.Web.Mvc.ViewPage" MasterPageFile="~/Models/App.master" %> - -
        <%= Html.ValidationSummary("Nouveau projet") %> diff --git a/web/Web.csproj b/web/Web.csproj index 0255b16e..49c8d472 100644 --- a/web/Web.csproj +++ b/web/Web.csproj @@ -145,6 +145,7 @@ + diff --git a/yavscModel/IModule.cs b/yavscModel/IModule.cs new file mode 100644 index 00000000..bb6d1d9c --- /dev/null +++ b/yavscModel/IModule.cs @@ -0,0 +1,17 @@ +using System; +using System.Configuration; +using System.Collections.Specialized; + +namespace yavscModel +{ + public interface IModule + { + void Install(); + void Uninstall(); + ConfigurationSection DefaultConfig (string appName, string cnxStr); + bool Active { get; set; } + string ApplicationName { get; set; } + void Initialize (string name, NameValueCollection config); + } +} + diff --git a/yavscModel/IProvider.cs b/yavscModel/IProvider.cs deleted file mode 100644 index 76a4cb67..00000000 --- a/yavscModel/IProvider.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; -using System.Collections.Specialized; - -namespace yavscModel -{ - public interface IProvider - { - string ApplicationName { get; set; } - void Initialize (string name, NameValueCollection config); - } -} - diff --git a/yavscModel/WorkFlow/IContentProvider.cs b/yavscModel/WorkFlow/IContentProvider.cs index 38e369df..35b8266b 100644 --- a/yavscModel/WorkFlow/IContentProvider.cs +++ b/yavscModel/WorkFlow/IContentProvider.cs @@ -5,7 +5,7 @@ using System.Web.Mvc; namespace yavscModel.WorkFlow { - public interface IContentProvider : IProvider, IDisposable + public interface IContentProvider : IModule, IDisposable { /// @@ -18,6 +18,7 @@ namespace yavscModel.WorkFlow StatusChange[] GetWrittingStatuses (long wrid); StatusChange[] GetEstimateStatuses (long estid); long CreateEstimate (string client, string title); + Estimate [] GetEstimates(string client); Estimate GetEstimate (long estimid); long Write (long estid, string desc, decimal ucost, int count, long productid); void DropWritting (long wrid); diff --git a/yavscModel/yavscModel.csproj b/yavscModel/yavscModel.csproj index c02363e9..f039a531 100644 --- a/yavscModel/yavscModel.csproj +++ b/yavscModel/yavscModel.csproj @@ -34,6 +34,7 @@ + @@ -57,13 +58,13 @@ - +