mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -84,6 +84,13 @@ namespace Orchard.Core.Tests.Routable.Services {
|
|||||||
Assert.That(_routableService.IsSlugValid("some/page"), Is.True);
|
Assert.That(_routableService.IsSlugValid("some/page"), Is.True);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void DotsAroundSlugAreAllowed() {
|
||||||
|
Assert.That(_routableService.IsSlugValid(".slug"), Is.False);
|
||||||
|
Assert.That(_routableService.IsSlugValid("slug."), Is.False);
|
||||||
|
Assert.That(_routableService.IsSlugValid("slug.slug"), Is.True);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void EmptySlugsShouldBeConsideredValid() {
|
public void EmptySlugsShouldBeConsideredValid() {
|
||||||
// so that automatic generation on Publish occurs
|
// so that automatic generation on Publish occurs
|
||||||
|
@@ -198,7 +198,7 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
|
|
||||||
ActionResult CreatableTypeList() {
|
ActionResult CreatableTypeList() {
|
||||||
var list = Shape.List();
|
var list = Shape.List();
|
||||||
list.AddRange(GetCreatableTypes());
|
list.AddRange("CreatableTypeList", GetCreatableTypes());
|
||||||
|
|
||||||
var viewModel = Shape.ViewModel()
|
var viewModel = Shape.ViewModel()
|
||||||
.ContentTypes(list);
|
.ContentTypes(list);
|
||||||
|
@@ -83,8 +83,14 @@ namespace Orchard.Core.Routable.Drivers {
|
|||||||
part.Slug = model.Slug;
|
part.Slug = model.Slug;
|
||||||
|
|
||||||
if ( !_routableService.IsSlugValid(part.Slug) ) {
|
if ( !_routableService.IsSlugValid(part.Slug) ) {
|
||||||
|
var slug = (part.Slug ?? String.Empty);
|
||||||
|
if ( slug.StartsWith(".") || slug.EndsWith(".") ) {
|
||||||
|
updater.AddModelError("Routable.Slug", T("The \".\" can't be used around routes."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
updater.AddModelError("Routable.Slug", T("Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\". No spaces are allowed (please use dashes or underscores instead)."));
|
updater.AddModelError("Routable.Slug", T("Please do not use any of the following characters in your slugs: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\". No spaces are allowed (please use dashes or underscores instead)."));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string originalSlug = part.Slug;
|
string originalSlug = part.Slug;
|
||||||
if (!_routableService.ProcessSlug(part)) {
|
if (!_routableService.ProcessSlug(part)) {
|
||||||
|
@@ -26,6 +26,9 @@ namespace Orchard.Core.Routable.Services {
|
|||||||
if (slug.Length > 1000)
|
if (slug.Length > 1000)
|
||||||
slug = slug.Substring(0, 1000);
|
slug = slug.Substring(0, 1000);
|
||||||
|
|
||||||
|
// dots are not allowed at the begin and the end of routes
|
||||||
|
slug = slug.Trim('.');
|
||||||
|
|
||||||
model.Slug = slug.ToLowerInvariant();
|
model.Slug = slug.ToLowerInvariant();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,8 +66,7 @@ namespace Orchard.Core.Routable.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSlugValid(string slug) {
|
public bool IsSlugValid(string slug) {
|
||||||
// see http://tools.ietf.org/html/rfc3987 for prohibited chars
|
return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s]+$") && !(slug.StartsWith(".") || slug.EndsWith("."));
|
||||||
return slug == null || String.IsNullOrEmpty(slug.Trim()) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s]+$");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ProcessSlug(RoutePart part) {
|
public bool ProcessSlug(RoutePart part) {
|
||||||
@@ -80,7 +82,6 @@ namespace Orchard.Core.Routable.Services {
|
|||||||
// of slugs to consider for conflict detection
|
// of slugs to consider for conflict detection
|
||||||
pathsLikeThis = pathsLikeThis.Where(p => p.ContentItem.Id != part.ContentItem.Id);
|
pathsLikeThis = pathsLikeThis.Where(p => p.ContentItem.Id != part.ContentItem.Id);
|
||||||
|
|
||||||
//todo: (heskew) need better messages
|
|
||||||
if (pathsLikeThis.Count() > 0) {
|
if (pathsLikeThis.Count() > 0) {
|
||||||
var originalSlug = part.Slug;
|
var originalSlug = part.Slug;
|
||||||
//todo: (heskew) make auto-uniqueness optional
|
//todo: (heskew) make auto-uniqueness optional
|
||||||
|
@@ -43,7 +43,6 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
|
|
||||||
public ActionResult Create() {
|
public ActionResult Create() {
|
||||||
//TODO: (erikpo) Might think about moving this to an ActionFilter/Attribute
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Not allowed to create blogs")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Not allowed to create blogs")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -57,7 +56,6 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
|
|
||||||
[HttpPost, ActionName("Create")]
|
[HttpPost, ActionName("Create")]
|
||||||
public ActionResult CreatePOST() {
|
public ActionResult CreatePOST() {
|
||||||
//TODO: (erikpo) Might think about moving this to an ActionFilter/Attribute
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't create blog")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't create blog")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -79,7 +77,6 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Edit(string blogSlug) {
|
public ActionResult Edit(string blogSlug) {
|
||||||
//TODO: (erikpo) Might think about moving this to an ActionFilter/Attribute
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Not allowed to edit blog")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Not allowed to edit blog")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -93,7 +90,6 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
|
|
||||||
[HttpPost, ActionName("Edit")]
|
[HttpPost, ActionName("Edit")]
|
||||||
public ActionResult EditPOST(string blogSlug) {
|
public ActionResult EditPOST(string blogSlug) {
|
||||||
//TODO: (erikpo) Might think about moving this to an ActionFilter/Attribute
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't edit blog")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't edit blog")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -112,7 +108,6 @@ namespace Orchard.Blogs.Controllers {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Remove(string blogSlug) {
|
public ActionResult Remove(string blogSlug) {
|
||||||
//TODO: (erikpo) Might think about moving this to an ActionFilter/Attribute
|
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't delete blog")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageBlogs, T("Couldn't delete blog")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
@@ -18,21 +18,21 @@ namespace Orchard.Blogs.Handlers {
|
|||||||
private static void RecalculateBlogArchive(IRepository<BlogPartArchiveRecord> blogArchiveRepository, IRepository<CommonPartRecord> commonRepository, BlogPostPart blogPostPart) {
|
private static void RecalculateBlogArchive(IRepository<BlogPartArchiveRecord> blogArchiveRepository, IRepository<CommonPartRecord> commonRepository, BlogPostPart blogPostPart) {
|
||||||
blogArchiveRepository.Flush();
|
blogArchiveRepository.Flush();
|
||||||
|
|
||||||
//INFO: (erikpo) Remove all current blog archive records
|
// remove all current blog archive records
|
||||||
var blogArchiveRecords =
|
var blogArchiveRecords =
|
||||||
from bar in blogArchiveRepository.Table
|
from bar in blogArchiveRepository.Table
|
||||||
where bar.BlogPart == blogPostPart.BlogPart.Record
|
where bar.BlogPart == blogPostPart.BlogPart.Record
|
||||||
select bar;
|
select bar;
|
||||||
blogArchiveRecords.ToList().ForEach(blogArchiveRepository.Delete);
|
blogArchiveRecords.ToList().ForEach(blogArchiveRepository.Delete);
|
||||||
|
|
||||||
//INFO: (erikpo) Get all blog posts for the current blog
|
// get all blog posts for the current blog
|
||||||
var postsQuery =
|
var postsQuery =
|
||||||
from bpr in commonRepository.Table
|
from bpr in commonRepository.Table
|
||||||
where bpr.ContentItemRecord.ContentType.Name == "BlogPost" && bpr.Container.Id == blogPostPart.BlogPart.Record.Id
|
where bpr.ContentItemRecord.ContentType.Name == "BlogPost" && bpr.Container.Id == blogPostPart.BlogPart.Record.Id
|
||||||
orderby bpr.PublishedUtc
|
orderby bpr.PublishedUtc
|
||||||
select bpr;
|
select bpr;
|
||||||
|
|
||||||
//INFO: (erikpo) Create a dictionary of all the year/month combinations and their count of posts that are published in this blog
|
// create a dictionary of all the year/month combinations and their count of posts that are published in this blog
|
||||||
var inMemoryBlogArchives = new Dictionary<DateTime, int>(postsQuery.Count());
|
var inMemoryBlogArchives = new Dictionary<DateTime, int>(postsQuery.Count());
|
||||||
foreach (var post in postsQuery) {
|
foreach (var post in postsQuery) {
|
||||||
if (!post.PublishedUtc.HasValue)
|
if (!post.PublishedUtc.HasValue)
|
||||||
@@ -46,7 +46,7 @@ namespace Orchard.Blogs.Handlers {
|
|||||||
inMemoryBlogArchives[key] = 1;
|
inMemoryBlogArchives[key] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//INFO: (erikpo) Create the new blog archive records based on the in memory values
|
// create the new blog archive records based on the in memory values
|
||||||
foreach (KeyValuePair<DateTime, int> item in inMemoryBlogArchives) {
|
foreach (KeyValuePair<DateTime, int> item in inMemoryBlogArchives) {
|
||||||
blogArchiveRepository.Create(new BlogPartArchiveRecord {BlogPart = blogPostPart.BlogPart.Record, Year = item.Key.Year, Month = item.Key.Month, PostCount = item.Value});
|
blogArchiveRepository.Create(new BlogPartArchiveRecord {BlogPart = blogPostPart.BlogPart.Record, Year = item.Key.Year, Month = item.Key.Month, PostCount = item.Value});
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,6 @@ namespace Orchard.Blogs.Models {
|
|||||||
set { this.As<RoutePart>().Title = value; }
|
set { this.As<RoutePart>().Title = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: (erikpo) Need a data type for slug
|
|
||||||
public string Slug {
|
public string Slug {
|
||||||
get { return this.As<RoutePart>().Slug; }
|
get { return this.As<RoutePart>().Slug; }
|
||||||
set { this.As<RoutePart>().Slug = value; }
|
set { this.As<RoutePart>().Slug = value; }
|
||||||
|
@@ -27,7 +27,7 @@ namespace Orchard.ContentTypes.Controllers {
|
|||||||
#region Types
|
#region Types
|
||||||
|
|
||||||
public ActionResult List() {
|
public ActionResult List() {
|
||||||
return View(new ListContentTypesViewModel {
|
return View("List", new ListContentTypesViewModel {
|
||||||
Types = _contentDefinitionService.GetTypes()
|
Types = _contentDefinitionService.GetTypes()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -22,7 +22,7 @@ namespace Orchard.Experimental.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Execute() {
|
public ActionResult Execute() {
|
||||||
return View(new CommandsExecuteViewModel());
|
return View("Execute", new CommandsExecuteViewModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@@ -59,7 +59,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AdminMenu.cs" />
|
<Compile Include="AdminMenu.cs" />
|
||||||
<Compile Include="ResourceManifest.cs" />
|
|
||||||
<Compile Include="Commands\IndexingCommands.cs" />
|
<Compile Include="Commands\IndexingCommands.cs" />
|
||||||
<Compile Include="Controllers\AdminController.cs" />
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
<Compile Include="Migrations.cs" />
|
<Compile Include="Migrations.cs" />
|
||||||
@@ -100,6 +99,7 @@
|
|||||||
<Content Include="Views\DefinitionTemplates\FieldIndexing.cshtml" />
|
<Content Include="Views\DefinitionTemplates\FieldIndexing.cshtml" />
|
||||||
<Content Include="Views\DefinitionTemplates\TypeIndexing.cshtml" />
|
<Content Include="Views\DefinitionTemplates\TypeIndexing.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
|
@@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Orchard.UI.Resources;
|
|
||||||
|
|
||||||
namespace Orchard.Indexing {
|
|
||||||
public class ResourceManifest : IResourceManifestProvider {
|
|
||||||
public void BuildManifests(ResourceManifestBuilder builder) {
|
|
||||||
builder.Add().DefineStyle("IndexingAdmin").SetUrl("admin.css"); // todo: this does not exist
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +1,4 @@
|
|||||||
@model Orchard.Indexing.ViewModels.IndexViewModel
|
@model Orchard.Indexing.ViewModels.IndexViewModel
|
||||||
@{ Style.Require("IndexingAdmin"); }
|
|
||||||
|
|
||||||
<h1>@Html.TitleForPage(T("Search Index Management").ToString())</h1>
|
<h1>@Html.TitleForPage(T("Search Index Management").ToString())</h1>
|
||||||
@using (Html.BeginForm("update", "admin", FormMethod.Post, new {area = "Orchard.Indexing"})) {
|
@using (Html.BeginForm("update", "admin", FormMethod.Post, new {area = "Orchard.Indexing"})) {
|
||||||
|
@@ -107,7 +107,7 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
public ActionResult Modules(Guid? sourceId) {
|
public ActionResult Modules(Guid? sourceId) {
|
||||||
var selectedSource = _packagingSourceManager.GetSources().Where(s => s.Id == sourceId).FirstOrDefault();
|
var selectedSource = _packagingSourceManager.GetSources().Where(s => s.Id == sourceId).FirstOrDefault();
|
||||||
|
|
||||||
return View(new PackagingModulesViewModel {
|
return View("Modules", new PackagingModulesViewModel {
|
||||||
Modules = _packagingSourceManager.GetModuleList(selectedSource).Where(p => p.SyndicationItem.Categories.All(c => c.Name == "Orchard Module" || c.Name != "Orchard Theme")),
|
Modules = _packagingSourceManager.GetModuleList(selectedSource).Where(p => p.SyndicationItem.Categories.All(c => c.Name == "Orchard Module" || c.Name != "Orchard Theme")),
|
||||||
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
||||||
SelectedSource = selectedSource
|
SelectedSource = selectedSource
|
||||||
@@ -117,7 +117,7 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
public ActionResult Themes(Guid? sourceId) {
|
public ActionResult Themes(Guid? sourceId) {
|
||||||
var selectedSource = _packagingSourceManager.GetSources().Where(s => s.Id == sourceId).FirstOrDefault();
|
var selectedSource = _packagingSourceManager.GetSources().Where(s => s.Id == sourceId).FirstOrDefault();
|
||||||
|
|
||||||
return View(new PackagingModulesViewModel {
|
return View("Themes", new PackagingModulesViewModel {
|
||||||
Modules = _packagingSourceManager.GetModuleList(selectedSource).Where(p => p.SyndicationItem.Categories.Any(c => c.Name == "Orchard Theme")),
|
Modules = _packagingSourceManager.GetModuleList(selectedSource).Where(p => p.SyndicationItem.Categories.Any(c => c.Name == "Orchard Theme")),
|
||||||
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
||||||
SelectedSource = selectedSource
|
SelectedSource = selectedSource
|
||||||
|
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using Orchard.Core.Contents.Controllers;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Roles.Models;
|
using Orchard.Roles.Models;
|
||||||
using Orchard.Roles.Services;
|
using Orchard.Roles.Services;
|
||||||
@@ -98,9 +99,9 @@ namespace Orchard.Roles.Controllers {
|
|||||||
|
|
||||||
var role = _roleService.GetRole(id);
|
var role = _roleService.GetRole(id);
|
||||||
if (role == null) {
|
if (role == null) {
|
||||||
//TODO: Error message
|
return HttpNotFound();
|
||||||
throw new HttpException(404, "page with id " + id + " was not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var model = new RoleEditViewModel { Name = role.Name, Id = role.Id,
|
var model = new RoleEditViewModel { Name = role.Name, Id = role.Id,
|
||||||
RoleCategoryPermissions = _roleService.GetInstalledPermissions(),
|
RoleCategoryPermissions = _roleService.GetInstalledPermissions(),
|
||||||
CurrentPermissions = _roleService.GetPermissionsForRole(id)};
|
CurrentPermissions = _roleService.GetPermissionsForRole(id)};
|
||||||
@@ -117,7 +118,8 @@ namespace Orchard.Roles.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost, ActionName("Edit")]
|
[HttpPost, ActionName("Edit")]
|
||||||
public ActionResult EditPOST() {
|
[FormValueRequired("submit.Save")]
|
||||||
|
public ActionResult EditSavePOST(int id) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageRoles, T("Not authorized to manage roles")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageRoles, T("Not authorized to manage roles")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
@@ -125,7 +127,6 @@ namespace Orchard.Roles.Controllers {
|
|||||||
try {
|
try {
|
||||||
UpdateModel(viewModel);
|
UpdateModel(viewModel);
|
||||||
// Save
|
// Save
|
||||||
if (!String.IsNullOrEmpty(HttpContext.Request.Form["submit.Save"])) {
|
|
||||||
List<string> rolePermissions = new List<string>();
|
List<string> rolePermissions = new List<string>();
|
||||||
foreach (string key in Request.Form.Keys) {
|
foreach (string key in Request.Form.Keys) {
|
||||||
if (key.StartsWith("Checkbox.") && Request.Form[key] == "true") {
|
if (key.StartsWith("Checkbox.") && Request.Form[key] == "true") {
|
||||||
@@ -134,15 +135,30 @@ namespace Orchard.Roles.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
_roleService.UpdateRole(viewModel.Id, viewModel.Name, rolePermissions);
|
_roleService.UpdateRole(viewModel.Id, viewModel.Name, rolePermissions);
|
||||||
}
|
|
||||||
else if (!String.IsNullOrEmpty(HttpContext.Request.Form["submit.Delete"])) {
|
Services.Notifier.Information(T("Your Role has been saved."));
|
||||||
_roleService.DeleteRole(viewModel.Id);
|
return RedirectToAction("Edit", new { id });
|
||||||
}
|
|
||||||
return RedirectToAction("Edit", new { viewModel.Id });
|
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
||||||
return RedirectToAction("Edit", viewModel.Id);
|
return RedirectToAction("Edit", id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost, ActionName("Edit")]
|
||||||
|
[FormValueRequired("submit.Delete")]
|
||||||
|
public ActionResult EditDeletePOST(int id) {
|
||||||
|
if (!Services.Authorizer.Authorize(Permissions.ManageRoles, T("Not authorized to manage roles")))
|
||||||
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
|
try {
|
||||||
|
_roleService.DeleteRole(id);
|
||||||
|
|
||||||
|
Services.Notifier.Information(T("Role was successfully deleted."));
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
} catch (Exception exception) {
|
||||||
|
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
||||||
|
return RedirectToAction("Edit", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -103,6 +103,10 @@
|
|||||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||||
<Name>Orchard.Framework</Name>
|
<Name>Orchard.Framework</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||||
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
|
<Name>Orchard.Core</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
|
@@ -34,7 +34,5 @@
|
|||||||
</tr>
|
</tr>
|
||||||
}
|
}
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
}
|
}
|
@@ -44,9 +44,10 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
layers.First() :
|
layers.First() :
|
||||||
layers.FirstOrDefault(layer => layer.Id == id);
|
layers.FirstOrDefault(layer => layer.Id == id);
|
||||||
|
|
||||||
if (currentLayer == null) {
|
if (currentLayer == null &&
|
||||||
|
id != null) {
|
||||||
// Incorrect layer id passed
|
// Incorrect layer id passed
|
||||||
Services.Notifier.Error(T("Layer not found: {1}", id));
|
Services.Notifier.Error(T("Layer not found: {0}", id));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -254,7 +255,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
try {
|
try {
|
||||||
widgetPart = _widgetsService.GetWidget(id);
|
widgetPart = _widgetsService.GetWidget(id);
|
||||||
if (widgetPart == null) {
|
if (widgetPart == null) {
|
||||||
Services.Notifier.Error(T("Widget not found: {1}", id));
|
Services.Notifier.Error(T("Widget not found: {0}", id));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -243,9 +243,8 @@
|
|||||||
<IISUrl>
|
<IISUrl>
|
||||||
</IISUrl>
|
</IISUrl>
|
||||||
<NTLMAuthentication>False</NTLMAuthentication>
|
<NTLMAuthentication>False</NTLMAuthentication>
|
||||||
<UseCustomServer>False</UseCustomServer>
|
<UseCustomServer>True</UseCustomServer>
|
||||||
<CustomServerUrl>
|
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
|
||||||
</CustomServerUrl>
|
|
||||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||||
</WebProjectProperties>
|
</WebProjectProperties>
|
||||||
</FlavorProperties>
|
</FlavorProperties>
|
||||||
|
@@ -479,22 +479,14 @@ ul.comments li div.text {
|
|||||||
/*border:1px solid #ff0000;*/
|
/*border:1px solid #ff0000;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If zones 1 and 2 are empty in the quad */
|
/* If zone 1 is empty and 2, 3, 4 are not */
|
||||||
|
.split-234 #footer-quad-second div.zone { width:480px; }
|
||||||
|
|
||||||
.split-left #footer-quad-third div.zone {
|
/* If zone 2 is empty and 1, 3, 4 are not */
|
||||||
width:600px;
|
.split-134 #footer-quad-first div.zone { width:480px; }
|
||||||
}
|
|
||||||
|
|
||||||
.split-left #footer-quad-fourth div.zone {
|
/* If zone 3 is empty and 1, 2, 4 are not */
|
||||||
width:360px;
|
.split-124 #footer-quad-fourth div.zone { width:480px; }
|
||||||
}
|
|
||||||
|
|
||||||
/* If zones 3 and 4 are empty in the quad */
|
/* If zone 4 is empty and 1, 2, 3 are not */
|
||||||
|
.split-123 #footer-quad-third div.zone { width:480px; }
|
||||||
.split-right #footer-quad-first div.zone {
|
|
||||||
width:600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.split-right #footer-quad-second div.zone {
|
|
||||||
width:360px;
|
|
||||||
}
|
|
@@ -22,12 +22,24 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug Quad
|
||||||
|
// {WorkContext.Layout.FooterQuadSecond.Add("2 This is some test text to see if zones are working. This is some test text to see if zones are working.");}
|
||||||
|
// {WorkContext.Layout.FooterQuadFirst.Add("1 This is some test text to see if zones are working. This is some test text to see if zones are working.");}
|
||||||
|
// {WorkContext.Layout.FooterQuadThird.Add("3 This is some test text to see if zones are working. This is some test text to see if zones are working.");}
|
||||||
|
|
||||||
//Add classes to the wrapper div to toggle quad widget zones on and off
|
//Add classes to the wrapper div to toggle quad widget zones on and off
|
||||||
if (Model.FooterQuadFirst == null && Model.FooterQuadSecond == null) {
|
|
||||||
Model.Classes.Add("split-left");
|
if (Model.FooterQuadFirst == null && Model.FooterQuadSecond != null && Model.FooterQuadThird != null && Model.FooterQuadFourth != null) {
|
||||||
|
Model.Classes.Add("split-234");
|
||||||
}
|
}
|
||||||
else if (Model.FooterQuadThird == null && Model.FooterQuadFourth == null) {
|
else if (Model.FooterQuadFirst != null && Model.FooterQuadSecond == null && Model.FooterQuadThird != null && Model.FooterQuadFourth != null) {
|
||||||
Model.Classes.Add("split-right");
|
Model.Classes.Add("split-134");
|
||||||
|
}
|
||||||
|
else if (Model.FooterQuadFirst != null && Model.FooterQuadSecond != null && Model.FooterQuadThird == null && Model.FooterQuadFourth != null) {
|
||||||
|
Model.Classes.Add("split-124");
|
||||||
|
}
|
||||||
|
else if (Model.FooterQuadFirst != null && Model.FooterQuadSecond != null && Model.FooterQuadThird != null && Model.FooterQuadFourth == null) {
|
||||||
|
Model.Classes.Add("split-123");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
@@ -195,7 +195,6 @@ namespace Orchard.Mvc.Html {
|
|||||||
return value.HasValue ? htmlHelper.DateTimeRelative(value.Value, T) : defaultIfNull;
|
return value.HasValue ? htmlHelper.DateTimeRelative(value.Value, T) : defaultIfNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: (erikpo) This method needs localized
|
|
||||||
public static LocalizedString DateTimeRelative(this HtmlHelper htmlHelper, DateTime value, Localizer T) {
|
public static LocalizedString DateTimeRelative(this HtmlHelper htmlHelper, DateTime value, Localizer T) {
|
||||||
var time = htmlHelper.Resolve<IClock>().UtcNow - value;
|
var time = htmlHelper.Resolve<IClock>().UtcNow - value;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user