* ResultPages.cs:
* NpgsqlBlogProvider.cs: PageIndex is now one based * AccountController.cs: Fixes a typo in the registration mail * AdminController.cs: Should fix a 500 at Registration validation * BasketController.cs: WIP * BlogsController.cs: page indexes are now one based * FrontOfficeController.cs: cleanning * GoogleController.cs: code formatting * Global.asax.cs: Default route data to "controller" "action" "id" * BBCodeHelper.cs: Allows not closed "url" BBcodes * InitDb.aspx: StatisPage.master was renamed * packages.config: Google references require System.Web 4.0.0.0 ... removed
This commit is contained in:
parent
630ddee841
commit
f54336852b
12 changed files with 29 additions and 54 deletions
|
|
@ -144,7 +144,7 @@ namespace Yavsc.Controllers
|
|||
body = body.Replace ("<%SiteName%>", YavscHelpers.SiteName);
|
||||
body = body.Replace ("<%UserName%>", user.UserName);
|
||||
body = body.Replace ("<%UserActivatonUrl%>",
|
||||
string.Format ("<{0}://{1}/Account/Validate/{2}?key={3}",
|
||||
string.Format ("<{0}://{1}/Account/Validate/{2}?key={3}>",
|
||||
Request.Url.Scheme,
|
||||
Request.Url.Authority,
|
||||
user.UserName,
|
||||
|
|
|
|||
|
|
@ -260,13 +260,23 @@ namespace Yavsc.Controllers
|
|||
[Authorize()]
|
||||
public ActionResult Admin (NewAdminModel model)
|
||||
{
|
||||
|
||||
// ASSERT (Roles.RoleExists (adminRoleName))
|
||||
string [] admins = Roles.GetUsersInRole (adminRoleName);
|
||||
string currentUser = Membership.GetUser ().UserName;
|
||||
List<SelectListItem> users = new List<SelectListItem> ();
|
||||
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 ["admins"] = admins;
|
||||
ViewData ["useritems"] = users;
|
||||
if (ModelState.IsValid) {
|
||||
Roles.AddUserToRole (model.UserName, adminRoleName);
|
||||
ViewData ["Message"] = model.UserName + " "+LocalizedText.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");
|
||||
|
|
@ -274,22 +284,13 @@ namespace Yavsc.Controllers
|
|||
return View ("Index");
|
||||
}
|
||||
} else {
|
||||
// No admin, gives the Admin Role to the current user
|
||||
Roles.AddUserToRole (currentUser, adminRoleName);
|
||||
admins = new string[] { currentUser };
|
||||
ViewData ["Message"] += string.Format (
|
||||
LocalizedText.was_added_to_the_empty_role,
|
||||
currentUser, adminRoleName);
|
||||
}
|
||||
|
||||
List<SelectListItem> users = new List<SelectListItem> ();
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ using System.Web;
|
|||
using System.Web.Security;
|
||||
using System.Web.Http;
|
||||
using Yavsc.Model.WorkFlow;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
|
|
@ -26,32 +27,11 @@ namespace Yavsc.ApiControllers
|
|||
base.Initialize (controllerContext);
|
||||
wfmgr = new WorkFlowManager ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Validates the order.
|
||||
///
|
||||
/// </summary>
|
||||
/// <returns><c>true</c>, if order was validated, <c>false</c> otherwise.</returns>
|
||||
/// <param name="orderid">Orderid.</param>
|
||||
bool ValidateOrder(long orderid) {
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
long CreateOrder(string title,string mesg)
|
||||
[AcceptVerbs("GET")]
|
||||
public long Create(string productId , NameValueCollection cmdParams)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds to basket, a product from the catalog, in the user's session.
|
||||
/// </summary>
|
||||
/// <returns>The to basket.</returns>
|
||||
[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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -98,6 +98,7 @@ namespace Yavsc.Controllers
|
|||
|
||||
|
||||
|
||||
// page index becomes one-based
|
||||
/// <summary>
|
||||
/// Users the posts.
|
||||
/// </summary>
|
||||
|
|
@ -106,7 +107,7 @@ namespace Yavsc.Controllers
|
|||
/// <param name="pageIndex">Page index.</param>
|
||||
/// <param name="pageSize">Page size.</param>
|
||||
[HttpGet]
|
||||
public ActionResult UserPosts (string user, int pageIndex = 0, int pageSize = 10)
|
||||
public ActionResult UserPosts (string user, int pageIndex = 1, int pageSize = 10)
|
||||
{
|
||||
int tr;
|
||||
MembershipUser u = Membership.GetUser ();
|
||||
|
|
|
|||
|
|
@ -204,9 +204,9 @@ namespace Yavsc.Controllers
|
|||
{
|
||||
try {
|
||||
// get files from the request
|
||||
string fnre = "[A-Za-z0-9~\\-.]+";
|
||||
string fnre = "[A-Za-z0-9~\\-.]+";
|
||||
HttpFileCollectionBase hfc = Request.Files;
|
||||
|
||||
// TODO mime-magic on content, and file name filter
|
||||
foreach (String h in hfc.AllKeys) {
|
||||
if (!Regex.Match (hfc [h].FileName, fnre).Success) {
|
||||
ViewData ["Message"] = "File name refused";
|
||||
|
|
@ -232,9 +232,5 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
}
|
||||
|
||||
ActionResult YourCommands ()
|
||||
{
|
||||
return View (GetBasket());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ namespace Yavsc.Controllers
|
|||
/// </summary>
|
||||
public class GoogleController : Controller
|
||||
{
|
||||
|
||||
private string SetSessionSate ()
|
||||
{
|
||||
Random rand = new Random ();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue