mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 12:53:33 +08:00
@@ -13,6 +13,7 @@ using Orchard.UI.Navigation;
|
|||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
using Orchard.Comments.ViewModels;
|
using Orchard.Comments.ViewModels;
|
||||||
using Orchard.Comments.Services;
|
using Orchard.Comments.Services;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Comments.Controllers {
|
namespace Orchard.Comments.Controllers {
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
@@ -80,9 +81,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
Pager = pagerShape
|
Pager = pagerShape
|
||||||
};
|
};
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Listing comments failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Listing comments failed: " + exception.Message));
|
|
||||||
return View(new CommentsIndexViewModel());
|
return View(new CommentsIndexViewModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -134,9 +135,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing comments failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing comments failed: " + exception.Message));
|
|
||||||
return RedirectToAction("Index", "Admin", new { options = viewModel.Options });
|
return RedirectToAction("Index", "Admin", new { options = viewModel.Options });
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,9 +177,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
CommentsClosedOnItem = _commentService.CommentsDisabledForCommentedContent(id),
|
CommentsClosedOnItem = _commentService.CommentsDisabledForCommentedContent(id),
|
||||||
};
|
};
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Listing comments failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Listing comments failed: " + exception.Message));
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -230,9 +231,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
default:
|
default:
|
||||||
throw new ArgumentOutOfRangeException();
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing comments failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing comments failed: " + exception.Message));
|
|
||||||
return Details(viewModel.CommentedItemId, viewModel.Options);
|
return Details(viewModel.CommentedItemId, viewModel.Options);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,9 +247,8 @@ namespace Orchard.Comments.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_commentService.DisableCommentsForCommentedContent(commentedItemId);
|
_commentService.DisableCommentsForCommentedContent(commentedItemId);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Disabling Comments failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Disabling Comments failed: " + exception.Message));
|
|
||||||
}
|
}
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||||
}
|
}
|
||||||
@@ -260,9 +260,8 @@ namespace Orchard.Comments.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_commentService.EnableCommentsForCommentedContent(commentedItemId);
|
_commentService.EnableCommentsForCommentedContent(commentedItemId);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Enabling Comments failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Enabling Comments failed: " + exception.Message));
|
|
||||||
}
|
}
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||||
}
|
}
|
||||||
@@ -280,9 +279,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
};
|
};
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
|
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing comment failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing comment failed: " + exception.Message));
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -297,9 +296,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
|
|
||||||
_commentService.UpdateComment(viewModel.Id, viewModel.Name, viewModel.Email, viewModel.SiteName, viewModel.CommentText, viewModel.Status);
|
_commentService.UpdateComment(viewModel.Id, viewModel.Name, viewModel.Email, viewModel.SiteName, viewModel.CommentText, viewModel.Status);
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing comment failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing Comment failed: " + exception.Message));
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -314,9 +313,8 @@ namespace Orchard.Comments.Controllers {
|
|||||||
_commentService.ApproveComment(id);
|
_commentService.ApproveComment(id);
|
||||||
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Approving comment failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Approving comment failed: " + exception.Message));
|
|
||||||
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||||
}
|
}
|
||||||
@@ -332,9 +330,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
_commentService.UnapproveComment(id);
|
_commentService.UnapproveComment(id);
|
||||||
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Unapproving comment failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Unapproving comment failed: " + exception.Message));
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -349,9 +347,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
_commentService.MarkCommentAsSpam(id);
|
_commentService.MarkCommentAsSpam(id);
|
||||||
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Marking comment as spam failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Marking comment as spam failed: " + exception.Message));
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,9 +364,9 @@ namespace Orchard.Comments.Controllers {
|
|||||||
_commentService.DeleteComment(id);
|
_commentService.DeleteComment(id);
|
||||||
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Details", new { id = commentedOn }));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Deleting comment failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Deleting comment failed: " + exception.Message));
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,9 +7,10 @@ using Orchard.Commands;
|
|||||||
using Orchard.Experimental.ViewModels;
|
using Orchard.Experimental.ViewModels;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.Themes;
|
using Orchard.Themes;
|
||||||
using Orchard.UI.Admin;
|
using Orchard.UI.Admin;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Experimental.Controllers {
|
namespace Orchard.Experimental.Controllers {
|
||||||
[Themed, Admin, OrchardFeature("Orchard.Experimental.WebCommandLine")]
|
[Themed, Admin, OrchardFeature("Orchard.Experimental.WebCommandLine")]
|
||||||
@@ -20,10 +21,12 @@ namespace Orchard.Experimental.Controllers {
|
|||||||
_commandManager = commandManager;
|
_commandManager = commandManager;
|
||||||
Services = services;
|
Services = services;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
return Execute();
|
return Execute();
|
||||||
@@ -47,9 +50,9 @@ namespace Orchard.Experimental.Controllers {
|
|||||||
.ToArray();
|
.ToArray();
|
||||||
model.Results = writer.ToString();
|
model.Results = writer.ToString();
|
||||||
}
|
}
|
||||||
}
|
} catch(Exception exception) {
|
||||||
catch(Exception exception) {
|
this.Error(exception, T("Error executing command: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Error executing command: {0}", exception.Message));
|
|
||||||
Services.TransactionManager.Cancel();
|
Services.TransactionManager.Cancel();
|
||||||
}
|
}
|
||||||
return View(model);
|
return View(model);
|
||||||
|
@@ -5,10 +5,12 @@ using System.Web;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Core.Contents.Controllers;
|
using Orchard.Core.Contents.Controllers;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.Media.Models;
|
using Orchard.Media.Models;
|
||||||
using Orchard.Media.Services;
|
using Orchard.Media.Services;
|
||||||
using Orchard.Media.ViewModels;
|
using Orchard.Media.ViewModels;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Media.Controllers {
|
namespace Orchard.Media.Controllers {
|
||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
@@ -20,10 +22,12 @@ namespace Orchard.Media.Controllers {
|
|||||||
_mediaService = mediaService;
|
_mediaService = mediaService;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOrchardServices Services { get; set;}
|
public IOrchardServices Services { get; set;}
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
// Root media folders
|
// Root media folders
|
||||||
@@ -44,7 +48,8 @@ namespace Orchard.Media.Controllers {
|
|||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Deleting Folder failed: {0}", exception.Message));
|
this.Error(exception, T("Deleting Folder failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +73,8 @@ namespace Orchard.Media.Controllers {
|
|||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Creating Folder failed: {0}", exception.Message));
|
this.Error(exception, T("Creating Folder failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -81,7 +87,8 @@ namespace Orchard.Media.Controllers {
|
|||||||
return View(model);
|
return View(model);
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Editing failed: {0}", exception.Message));
|
this.Error(exception, T("Editing failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -110,9 +117,9 @@ namespace Orchard.Media.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Deleting failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Deleting failed: {0}", exception.Message));
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,9 +143,9 @@ namespace Orchard.Media.Controllers {
|
|||||||
|
|
||||||
Services.Notifier.Information(T("Media folder deleted"));
|
Services.Notifier.Information(T("Media folder deleted"));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Deleting media folder failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Deleting media folder failed: {0}", exception.Message));
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -158,7 +165,8 @@ namespace Orchard.Media.Controllers {
|
|||||||
Services.Notifier.Information(T("Media folder properties modified"));
|
Services.Notifier.Information(T("Media folder properties modified"));
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Modifying media folder properties failed: {0}", exception.Message));
|
this.Error(exception, T("Modifying media folder properties failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -190,9 +198,9 @@ namespace Orchard.Media.Controllers {
|
|||||||
|
|
||||||
Services.Notifier.Information(T("Media file(s) uploaded"));
|
Services.Notifier.Information(T("Media file(s) uploaded"));
|
||||||
return RedirectToAction("Edit", new { name = viewModel.FolderName, mediaPath = viewModel.MediaPath });
|
return RedirectToAction("Edit", new { name = viewModel.FolderName, mediaPath = viewModel.MediaPath });
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Uploading media file failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Uploading media file failed: {0}", exception.Message));
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,7 +263,8 @@ namespace Orchard.Media.Controllers {
|
|||||||
Services.Notifier.Information(T("Media deleted"));
|
Services.Notifier.Information(T("Media deleted"));
|
||||||
return RedirectToAction("Edit", new { name = viewModel.FolderName, mediaPath = viewModel.MediaPath });
|
return RedirectToAction("Edit", new { name = viewModel.FolderName, mediaPath = viewModel.MediaPath });
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Removing media file failed: {0}", exception.Message));
|
this.Error(exception, T("Removing media file failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,7 +295,8 @@ namespace Orchard.Media.Controllers {
|
|||||||
mediaPath = viewModel.MediaPath });
|
mediaPath = viewModel.MediaPath });
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Editing media file failed: {0}", exception.Message));
|
this.Error(exception, T("Editing media file failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -7,11 +7,13 @@ using Orchard.Environment.Extensions;
|
|||||||
using Orchard.Environment.Extensions.Models;
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Environment.Features;
|
using Orchard.Environment.Features;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.Modules.Services;
|
using Orchard.Modules.Services;
|
||||||
using Orchard.Modules.ViewModels;
|
using Orchard.Modules.ViewModels;
|
||||||
using Orchard.Reports.Services;
|
using Orchard.Reports.Services;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Modules.Controllers {
|
namespace Orchard.Modules.Controllers {
|
||||||
public class AdminController : Controller {
|
public class AdminController : Controller {
|
||||||
@@ -39,10 +41,12 @@ namespace Orchard.Modules.Controllers {
|
|||||||
_shellDescriptor = shellDescriptor;
|
_shellDescriptor = shellDescriptor;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage modules")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage modules")))
|
||||||
@@ -111,9 +115,8 @@ namespace Orchard.Modules.Controllers {
|
|||||||
_reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation");
|
_reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation");
|
||||||
_dataMigrationManager.Update(id);
|
_dataMigrationManager.Update(id);
|
||||||
Services.Notifier.Information(T("The feature {0} was updated successfully", id));
|
Services.Notifier.Information(T("The feature {0} was updated successfully", id));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception ex) {
|
this.Error(exception, T("An error occured while updating the feature {0}: {1}", id, exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("An error occured while updating the feature {0}: {1}", id, ex.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Features");
|
return RedirectToAction("Features");
|
||||||
|
@@ -1,13 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Environment;
|
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.MultiTenancy.Services;
|
using Orchard.MultiTenancy.Services;
|
||||||
using Orchard.MultiTenancy.ViewModels;
|
using Orchard.MultiTenancy.ViewModels;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.MultiTenancy.Controllers {
|
namespace Orchard.MultiTenancy.Controllers {
|
||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
@@ -21,10 +22,12 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
|
|
||||||
Services = orchardServices;
|
Services = orchardServices;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
return View(new TenantsIndexViewModel { TenantSettings = _tenantService.GetTenants() });
|
return View(new TenantsIndexViewModel { TenantSettings = _tenantService.GetTenants() });
|
||||||
@@ -61,9 +64,9 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Creating Tenant failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Creating Tenant failed: {0}", exception.Message));
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,9 +118,9 @@ namespace Orchard.MultiTenancy.Controllers {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Failed to edit tenant: {0} ", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Failed to edit tenant: {0} ", exception.Message));
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,6 +19,7 @@ using Orchard.Themes;
|
|||||||
using Orchard.UI.Admin;
|
using Orchard.UI.Admin;
|
||||||
using Orchard.UI.Navigation;
|
using Orchard.UI.Navigation;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
using IPackageManager = Orchard.Packaging.Services.IPackageManager;
|
using IPackageManager = Orchard.Packaging.Services.IPackageManager;
|
||||||
|
|
||||||
namespace Orchard.Packaging.Controllers {
|
namespace Orchard.Packaging.Controllers {
|
||||||
@@ -100,8 +101,7 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
if (String.IsNullOrWhiteSpace(title)) {
|
if (String.IsNullOrWhiteSpace(title)) {
|
||||||
ModelState.AddModelError("Url", T("The feed has no title.").Text);
|
ModelState.AddModelError("Url", T("The feed has no title.").Text);
|
||||||
}
|
}
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
ModelState.AddModelError("Url", T("The url of the feed or its content is not valid.").Text);
|
ModelState.AddModelError("Url", T("The url of the feed or its content is not valid.").Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
Services.Notifier.Information(T("The feed has been added successfully."));
|
Services.Notifier.Information(T("The feed has been added successfully."));
|
||||||
|
|
||||||
return RedirectToAction("Sources");
|
return RedirectToAction("Sources");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Adding feed failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Adding feed failed: {0}", exception.Message));
|
|
||||||
return View(new PackagingAddSourceViewModel { Url = url });
|
return View(new PackagingAddSourceViewModel { Url = url });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,10 +198,8 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
extensions = extensions.Take(pager.PageSize);
|
extensions = extensions.Take(pager.PageSize);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception ex) {
|
this.Error(exception, T("Error loading extensions from gallery source '{0}'. {1}.", source.FeedTitle, exception.Message), Logger, Services.Notifier);
|
||||||
Logger.Error(ex, "Error loading extensions from gallery source '{0}'. {1}.", source.FeedTitle, ex.Message);
|
|
||||||
Services.Notifier.Error(T("Error loading extensions from gallery source '{0}'. {1}.", source.FeedTitle, ex.Message));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,12 +239,8 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
else if (packageId.StartsWith(PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Module))) {
|
else if (packageId.StartsWith(PackagingSourceManager.GetExtensionPrefix(DefaultExtensionTypes.Module))) {
|
||||||
Services.Notifier.Information(T("The module has been successfully installed. Its features can be enabled in the \"Configuration | Features\" page accessible from the menu."));
|
Services.Notifier.Information(T("The module has been successfully installed. Its features can be enabled in the \"Configuration | Features\" page accessible from the menu."));
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Package installation failed."), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Package installation failed."));
|
|
||||||
for (Exception scan = exception; scan != null; scan = scan.InnerException) {
|
|
||||||
Services.Notifier.Error(T("{0}", scan.Message));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction(redirectTo == "Themes" ? "Themes" : "Modules");
|
return RedirectToAction(redirectTo == "Themes" ? "Themes" : "Modules");
|
||||||
|
@@ -15,6 +15,7 @@ using Orchard.Security;
|
|||||||
using Orchard.Themes;
|
using Orchard.Themes;
|
||||||
using Orchard.UI.Admin;
|
using Orchard.UI.Admin;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
using IPackageManager = Orchard.Packaging.Services.IPackageManager;
|
using IPackageManager = Orchard.Packaging.Services.IPackageManager;
|
||||||
using PackageBuilder = Orchard.Packaging.Services.PackageBuilder;
|
using PackageBuilder = Orchard.Packaging.Services.PackageBuilder;
|
||||||
|
|
||||||
@@ -42,10 +43,12 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
Services = services;
|
Services = services;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = Logging.NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
|
public Logging.ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult AddTheme(string returnUrl) {
|
public ActionResult AddTheme(string returnUrl) {
|
||||||
if (_shellSettings.Name != ShellSettings.DefaultName || !Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to add themes")))
|
if (_shellSettings.Name != ShellSettings.DefaultName || !Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to add themes")))
|
||||||
@@ -107,12 +110,8 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.RedirectLocal(returnUrl, "~/");
|
return this.RedirectLocal(returnUrl, "~/");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Package uploading and installation failed."), Logger, Services.Notifier);
|
||||||
_notifier.Error(T("Package uploading and installation failed."));
|
|
||||||
for (Exception scan = exception; scan != null; scan = scan.InnerException) {
|
|
||||||
_notifier.Error(T("{0}", scan.Message));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Redirect(retryUrl);
|
return Redirect(retryUrl);
|
||||||
}
|
}
|
||||||
@@ -128,11 +127,8 @@ namespace Orchard.Packaging.Controllers {
|
|||||||
_notifier.Information(T("Uninstalled package \"{0}\"", id));
|
_notifier.Information(T("Uninstalled package \"{0}\"", id));
|
||||||
|
|
||||||
return this.RedirectLocal(returnUrl, "~/");
|
return this.RedirectLocal(returnUrl, "~/");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Uninstall failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
for (Exception scan = exception; scan != null; scan = scan.InnerException) {
|
|
||||||
_notifier.Error(T("Uninstall failed: {0}", exception.Message));
|
|
||||||
}
|
|
||||||
|
|
||||||
return Redirect(retryUrl);
|
return Redirect(retryUrl);
|
||||||
}
|
}
|
||||||
|
@@ -4,12 +4,14 @@ using System.Linq;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Core.Contents.Controllers;
|
using Orchard.Core.Contents.Controllers;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.Mvc.Extensions;
|
using Orchard.Mvc.Extensions;
|
||||||
using Orchard.Roles.Models;
|
using Orchard.Roles.Models;
|
||||||
using Orchard.Roles.Services;
|
using Orchard.Roles.Services;
|
||||||
using Orchard.Roles.ViewModels;
|
using Orchard.Roles.ViewModels;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Roles.Controllers {
|
namespace Orchard.Roles.Controllers {
|
||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
@@ -25,12 +27,14 @@ namespace Orchard.Roles.Controllers {
|
|||||||
Services = services;
|
Services = services;
|
||||||
_roleService = roleService;
|
_roleService = roleService;
|
||||||
_authorizationService = authorizationService;
|
_authorizationService = authorizationService;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage roles")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage roles")))
|
||||||
@@ -54,9 +58,9 @@ namespace Orchard.Roles.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Deleting Role failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Deleting Role failed: {0}", exception.Message));
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,9 +90,9 @@ namespace Orchard.Roles.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Creating Role failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Creating Role failed: {0}", exception.Message));
|
|
||||||
return RedirectToAction("Create");
|
return RedirectToAction("Create");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -138,9 +142,9 @@ namespace Orchard.Roles.Controllers {
|
|||||||
|
|
||||||
Services.Notifier.Information(T("Your Role has been saved."));
|
Services.Notifier.Information(T("Your Role has been saved."));
|
||||||
return RedirectToAction("Edit", new { id });
|
return RedirectToAction("Edit", new { id });
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing Role failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
|
||||||
return RedirectToAction("Edit", id);
|
return RedirectToAction("Edit", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,7 +167,8 @@ namespace Orchard.Roles.Controllers {
|
|||||||
|
|
||||||
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
return this.RedirectLocal(returnUrl, () => RedirectToAction("Index"));
|
||||||
} catch (Exception exception) {
|
} catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Editing Role failed: {0}", exception.Message));
|
this.Error(exception, T("Editing Role failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return RedirectToAction("Edit", id);
|
return RedirectToAction("Edit", id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,6 +13,7 @@ using Orchard.UI.Navigation;
|
|||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
using Orchard.Collections;
|
using Orchard.Collections;
|
||||||
using Orchard.Themes;
|
using Orchard.Themes;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Search.Controllers {
|
namespace Orchard.Search.Controllers {
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
@@ -55,10 +56,8 @@ namespace Orchard.Search.Controllers {
|
|||||||
Services.WorkContext.CurrentSite.As<SearchSettingsPart>().Record.FilterCulture,
|
Services.WorkContext.CurrentSite.As<SearchSettingsPart>().Record.FilterCulture,
|
||||||
searchFields,
|
searchFields,
|
||||||
searchHit => searchHit);
|
searchHit => searchHit);
|
||||||
}
|
} catch(Exception exception) {
|
||||||
catch(Exception e) {
|
this.Error(exception, T("Invalid search query: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Invalid search query: {0}", q));
|
|
||||||
Logger.Error(e, "Invalid search query: " + q);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var list = Shape.List();
|
var list = Shape.List();
|
||||||
|
@@ -2,11 +2,13 @@
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Environment;
|
using Orchard.Environment;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.Setup.Services;
|
using Orchard.Setup.Services;
|
||||||
using Orchard.Setup.ViewModels;
|
using Orchard.Setup.ViewModels;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Themes;
|
using Orchard.Themes;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Setup.Controllers {
|
namespace Orchard.Setup.Controllers {
|
||||||
[ValidateInput(false), Themed]
|
[ValidateInput(false), Themed]
|
||||||
@@ -19,10 +21,13 @@ namespace Orchard.Setup.Controllers {
|
|||||||
_viewsBackgroundCompilation = viewsBackgroundCompilation;
|
_viewsBackgroundCompilation = viewsBackgroundCompilation;
|
||||||
_notifier = notifier;
|
_notifier = notifier;
|
||||||
_setupService = setupService;
|
_setupService = setupService;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
private ActionResult IndexViewResult(SetupViewModel model) {
|
private ActionResult IndexViewResult(SetupViewModel model) {
|
||||||
return View(model);
|
return View(model);
|
||||||
@@ -87,12 +92,9 @@ namespace Orchard.Setup.Controllers {
|
|||||||
|
|
||||||
// redirect to the welcome page.
|
// redirect to the welcome page.
|
||||||
return Redirect("~/");
|
return Redirect("~/");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Setup failed:"), Logger, _notifier);
|
||||||
_notifier.Error(T("Setup failed:"));
|
|
||||||
for (var scan = exception; scan != null; scan = scan.InnerException) {
|
|
||||||
_notifier.Error(new LocalizedString(scan.Message));
|
|
||||||
}
|
|
||||||
return IndexViewResult(model);
|
return IndexViewResult(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ using Orchard.Environment.Extensions;
|
|||||||
using Orchard.Environment.Extensions.Models;
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Environment.Features;
|
using Orchard.Environment.Features;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.Mvc.Extensions;
|
using Orchard.Mvc.Extensions;
|
||||||
using Orchard.Reports.Services;
|
using Orchard.Reports.Services;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
@@ -15,6 +16,7 @@ using Orchard.Themes.Preview;
|
|||||||
using Orchard.Themes.Services;
|
using Orchard.Themes.Services;
|
||||||
using Orchard.Themes.ViewModels;
|
using Orchard.Themes.ViewModels;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Themes.Controllers {
|
namespace Orchard.Themes.Controllers {
|
||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
@@ -50,10 +52,12 @@ namespace Orchard.Themes.Controllers {
|
|||||||
_reportsCoordinator = reportsCoordinator;
|
_reportsCoordinator = reportsCoordinator;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IOrchardServices Services { get; set; }
|
public IOrchardServices Services { get; set; }
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
try {
|
try {
|
||||||
@@ -74,9 +78,9 @@ namespace Orchard.Themes.Controllers {
|
|||||||
InstallThemes = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null,
|
InstallThemes = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null,
|
||||||
BrowseToGallery = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "Gallery") != null
|
BrowseToGallery = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "Gallery") != null
|
||||||
});
|
});
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Listing themes failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Listing themes failed: " + exception.Message));
|
|
||||||
return View(new ThemesIndexViewModel());
|
return View(new ThemesIndexViewModel());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,9 +92,9 @@ namespace Orchard.Themes.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
_previewTheme.SetPreviewTheme(themeName);
|
_previewTheme.SetPreviewTheme(themeName);
|
||||||
return this.RedirectLocal(returnUrl, "~/");
|
return this.RedirectLocal(returnUrl, "~/");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Previewing theme failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Previewing theme failed: " + exception.Message));
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,10 +106,10 @@ namespace Orchard.Themes.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
_previewTheme.SetPreviewTheme(null);
|
_previewTheme.SetPreviewTheme(null);
|
||||||
_siteThemeService.SetSiteTheme(themeName);
|
_siteThemeService.SetSiteTheme(themeName);
|
||||||
|
} catch (Exception exception) {
|
||||||
|
this.Error(exception, T("Previewing theme failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
|
||||||
Services.Notifier.Error(T("Previewing theme failed: " + exception.Message));
|
|
||||||
}
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,9 +119,8 @@ namespace Orchard.Themes.Controllers {
|
|||||||
if (!Services.Authorizer.Authorize(Permissions.ApplyTheme, T("Couldn't preview the current theme")))
|
if (!Services.Authorizer.Authorize(Permissions.ApplyTheme, T("Couldn't preview the current theme")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
_previewTheme.SetPreviewTheme(null);
|
_previewTheme.SetPreviewTheme(null);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Previewing theme failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Previewing theme failed: " + exception.Message));
|
|
||||||
}
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -129,9 +132,8 @@ namespace Orchard.Themes.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_themeService.EnableThemeFeatures(themeName);
|
_themeService.EnableThemeFeatures(themeName);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Enabling theme failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Enabling theme failed: " + exception.Message));
|
|
||||||
}
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -143,9 +145,8 @@ namespace Orchard.Themes.Controllers {
|
|||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_themeService.DisableThemeFeatures(themeName);
|
_themeService.DisableThemeFeatures(themeName);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Disabling theme failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Disabling theme failed: " + exception.Message));
|
|
||||||
}
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -158,9 +159,8 @@ namespace Orchard.Themes.Controllers {
|
|||||||
|
|
||||||
_themeService.EnableThemeFeatures(themeName);
|
_themeService.EnableThemeFeatures(themeName);
|
||||||
_siteThemeService.SetSiteTheme(themeName);
|
_siteThemeService.SetSiteTheme(themeName);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Activating theme failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Activating theme failed: " + exception.Message));
|
|
||||||
}
|
}
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
@@ -177,9 +177,8 @@ namespace Orchard.Themes.Controllers {
|
|||||||
_reportsCoordinator.Register("Data Migration", "Upgrade " + themeName, "Orchard installation");
|
_reportsCoordinator.Register("Data Migration", "Upgrade " + themeName, "Orchard installation");
|
||||||
_dataMigrationManager.Update(themeName);
|
_dataMigrationManager.Update(themeName);
|
||||||
Services.Notifier.Information(T("The theme {0} was updated succesfuly", themeName));
|
Services.Notifier.Information(T("The theme {0} was updated succesfuly", themeName));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception ex) {
|
this.Error(exception, T("An error occured while updating the theme {0}: {1}", themeName, exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("An error occured while updating the theme {0}: {1}", themeName, ex.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
|
@@ -200,8 +200,7 @@ namespace Orchard.Users.Controllers {
|
|||||||
ModelState.AddModelError("_FORM",
|
ModelState.AddModelError("_FORM",
|
||||||
T("The current password is incorrect or the new password is invalid."));
|
T("The current password is incorrect or the new password is invalid."));
|
||||||
return ChangePassword();
|
return ChangePassword();
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
ModelState.AddModelError("_FORM", T("The current password is incorrect or the new password is invalid."));
|
ModelState.AddModelError("_FORM", T("The current password is incorrect or the new password is invalid."));
|
||||||
return ChangePassword();
|
return ChangePassword();
|
||||||
}
|
}
|
||||||
|
@@ -5,8 +5,10 @@ using System.Linq;
|
|||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Core.Contents.Controllers;
|
using Orchard.Core.Contents.Controllers;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.UI.Admin;
|
using Orchard.UI.Admin;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Utility.Extensions;
|
||||||
using Orchard.Widgets.Models;
|
using Orchard.Widgets.Models;
|
||||||
using Orchard.Widgets.Services;
|
using Orchard.Widgets.Services;
|
||||||
using Orchard.Widgets.ViewModels;
|
using Orchard.Widgets.ViewModels;
|
||||||
@@ -28,10 +30,12 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
_widgetsService = widgetsService;
|
_widgetsService = widgetsService;
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
|
Logger = NullLogger.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IOrchardServices Services { get; set; }
|
private IOrchardServices Services { get; set; }
|
||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public ActionResult Index(int? id) {
|
public ActionResult Index(int? id) {
|
||||||
IEnumerable<LayerPart> layers = _widgetsService.GetLayers();
|
IEnumerable<LayerPart> layers = _widgetsService.GetLayers();
|
||||||
@@ -90,9 +94,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
_widgetsService.MoveWidgetUp(int.Parse(moveUpAction));
|
_widgetsService.MoveWidgetUp(int.Parse(moveUpAction));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Moving widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Moving widget failed: {0}", exception.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Index", "Admin", new { id });
|
return RedirectToAction("Index", "Admin", new { id });
|
||||||
@@ -116,7 +119,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
return View((object)model);
|
return View((object)model);
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message));
|
this.Error(exception, T("Creating widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
return RedirectToAction("Index", "Admin", new { id = layerId });
|
return RedirectToAction("Index", "Admin", new { id = layerId });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -139,9 +143,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Services.Notifier.Information(T("Your {0} has been created.", widgetPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been created.", widgetPart.TypeDefinition.DisplayName));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Creating widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Creating widget failed: {0}", exception.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Index", "Admin", new { id = layerId });
|
return RedirectToAction("Index", "Admin", new { id = layerId });
|
||||||
@@ -159,9 +162,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||||
return View((object)model);
|
return View((object)model);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Creating layer failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message));
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -186,9 +188,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
|
|
||||||
Services.Notifier.Information(T("Your {0} has been created.", layerPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been created.", layerPart.TypeDefinition.DisplayName));
|
||||||
return RedirectToAction("Index", "Admin", new { id = layerPart.Id });
|
return RedirectToAction("Index", "Admin", new { id = layerPart.Id });
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Creating layer failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Creating layer failed: {0}", exception.Message));
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,9 +207,9 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||||
return View((object)model);
|
return View((object)model);
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing layer failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message));
|
|
||||||
return RedirectToAction("Index", "Admin", new { id });
|
return RedirectToAction("Index", "Admin", new { id });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,9 +234,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Services.Notifier.Information(T("Your {0} has been saved.", layerPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been saved.", layerPart.TypeDefinition.DisplayName));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing layer failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing layer failed: {0}", exception.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Index", "Admin", new { id });
|
return RedirectToAction("Index", "Admin", new { id });
|
||||||
@@ -250,9 +250,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
try {
|
try {
|
||||||
_widgetsService.DeleteLayer(id);
|
_widgetsService.DeleteLayer(id);
|
||||||
Services.Notifier.Information(T("Layer was successfully deleted"));
|
Services.Notifier.Information(T("Layer was successfully deleted"));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Removing Layer failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Removing Layer failed: {0}", exception.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
@@ -275,7 +274,7 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
return View((object)model);
|
return View((object)model);
|
||||||
}
|
}
|
||||||
catch (Exception exception) {
|
catch (Exception exception) {
|
||||||
Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message));
|
this.Error(exception, T("Editing widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
|
|
||||||
if (widgetPart != null)
|
if (widgetPart != null)
|
||||||
return RedirectToAction("Index", "Admin", new { id = widgetPart.LayerPart.Id });
|
return RedirectToAction("Index", "Admin", new { id = widgetPart.LayerPart.Id });
|
||||||
@@ -305,9 +304,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Services.Notifier.Information(T("Your {0} has been saved.", widgetPart.TypeDefinition.DisplayName));
|
Services.Notifier.Information(T("Your {0} has been saved.", widgetPart.TypeDefinition.DisplayName));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Editing widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Editing widget failed: {0}", exception.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return widgetPart != null ?
|
return widgetPart != null ?
|
||||||
@@ -329,9 +327,8 @@ namespace Orchard.Widgets.Controllers {
|
|||||||
|
|
||||||
_widgetsService.DeleteWidget(widgetPart.Id);
|
_widgetsService.DeleteWidget(widgetPart.Id);
|
||||||
Services.Notifier.Information(T("Widget was successfully deleted"));
|
Services.Notifier.Information(T("Widget was successfully deleted"));
|
||||||
}
|
} catch (Exception exception) {
|
||||||
catch (Exception exception) {
|
this.Error(exception, T("Removing Widget failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||||
Services.Notifier.Error(T("Removing Widget failed: {0}", exception.Message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return widgetPart != null ?
|
return widgetPart != null ?
|
||||||
|
@@ -457,6 +457,7 @@
|
|||||||
<Compile Include="Messaging\Services\IMessageManager.cs" />
|
<Compile Include="Messaging\Services\IMessageManager.cs" />
|
||||||
<Compile Include="Messaging\Services\IMessagingChannel.cs" />
|
<Compile Include="Messaging\Services\IMessagingChannel.cs" />
|
||||||
<Compile Include="IWorkContextAccessor.cs" />
|
<Compile Include="IWorkContextAccessor.cs" />
|
||||||
|
<Compile Include="Utility\Extensions\ControllerExtensions.cs" />
|
||||||
<Compile Include="Validation\PathValidation.cs" />
|
<Compile Include="Validation\PathValidation.cs" />
|
||||||
<Compile Include="WorkContextExtensions.cs" />
|
<Compile Include="WorkContextExtensions.cs" />
|
||||||
<Compile Include="Mvc\ViewEngines\Razor\RazorCompilationEventsShim.cs" />
|
<Compile Include="Mvc\ViewEngines\Razor\RazorCompilationEventsShim.cs" />
|
||||||
|
23
src/Orchard/Utility/Extensions/ControllerExtensions.cs
Normal file
23
src/Orchard/Utility/Extensions/ControllerExtensions.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
using Orchard.Localization;
|
||||||
|
using Orchard.Logging;
|
||||||
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
|
namespace Orchard.Utility.Extensions {
|
||||||
|
public static class ControllerExtensions {
|
||||||
|
public static void Error(this Controller controller,
|
||||||
|
Exception exception,
|
||||||
|
LocalizedString localizedString,
|
||||||
|
ILogger logger,
|
||||||
|
INotifier notifier) {
|
||||||
|
|
||||||
|
logger.Error(exception, localizedString.ToString());
|
||||||
|
notifier.Error(localizedString);
|
||||||
|
|
||||||
|
for (Exception innerException = exception; innerException != null ; innerException = innerException.InnerException) {
|
||||||
|
notifier.Error(new LocalizedString(innerException.Message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user