mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Reverted all Orchard.Widgets modifications.
This commit is contained in:
@@ -18,7 +18,6 @@ using Orchard.Widgets.Models;
|
||||
using Orchard.Widgets.Services;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Contents.Settings;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Localization.Services;
|
||||
|
||||
namespace Orchard.Widgets.Controllers {
|
||||
@@ -30,7 +29,6 @@ namespace Orchard.Widgets.Controllers {
|
||||
private readonly ISiteThemeService _siteThemeService;
|
||||
private readonly IVirtualPathProvider _virtualPathProvider;
|
||||
private readonly ICultureManager _cultureManager;
|
||||
private readonly ILayoutManager _layoutManager;
|
||||
|
||||
public AdminController(
|
||||
IOrchardServices services,
|
||||
@@ -38,15 +36,13 @@ namespace Orchard.Widgets.Controllers {
|
||||
IShapeFactory shapeFactory,
|
||||
ISiteThemeService siteThemeService,
|
||||
IVirtualPathProvider virtualPathProvider,
|
||||
ICultureManager cultureManager,
|
||||
ILayoutManager layoutManager) {
|
||||
ICultureManager cultureManager) {
|
||||
|
||||
Services = services;
|
||||
_widgetsService = widgetsService;
|
||||
_siteThemeService = siteThemeService;
|
||||
_virtualPathProvider = virtualPathProvider;
|
||||
_cultureManager = cultureManager;
|
||||
_layoutManager = layoutManager;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
@@ -59,20 +55,20 @@ namespace Orchard.Widgets.Controllers {
|
||||
dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult Index(int? layerId, string culture) {
|
||||
var currentTheme = _siteThemeService.GetSiteTheme();
|
||||
ExtensionDescriptor currentTheme = _siteThemeService.GetSiteTheme();
|
||||
if (currentTheme == null) {
|
||||
Services.Notifier.Error(T("To manage widgets you must have a theme enabled."));
|
||||
return RedirectToAction("Index", "Admin", new { area = "Dashboard" });
|
||||
}
|
||||
|
||||
var layers = _widgetsService.GetLayers().ToList();
|
||||
IEnumerable<LayerPart> layers = _widgetsService.GetLayers().ToList();
|
||||
|
||||
if (!layers.Any()) {
|
||||
Services.Notifier.Error(T("There are no widget layers defined. A layer will need to be added in order to add widgets to any part of the site."));
|
||||
return RedirectToAction("AddLayer");
|
||||
}
|
||||
|
||||
var currentLayer = layerId == null
|
||||
LayerPart currentLayer = layerId == null
|
||||
? layers.FirstOrDefault()
|
||||
: layers.FirstOrDefault(layer => layer.Id == layerId);
|
||||
|
||||
@@ -81,11 +77,12 @@ namespace Orchard.Widgets.Controllers {
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
var allZones = _widgetsService.GetZones();
|
||||
var currentThemesZones = _widgetsService.GetZones(currentTheme);
|
||||
var layoutZones = _layoutManager.GetZones().ToList();
|
||||
var zonePreviewImagePath = string.Format("{0}/{1}/ThemeZonePreview.png", currentTheme.Location, currentTheme.Id);
|
||||
var zonePreviewImage = _virtualPathProvider.FileExists(zonePreviewImagePath) ? zonePreviewImagePath : null;
|
||||
IEnumerable<string> allZones = _widgetsService.GetZones();
|
||||
IEnumerable<string> currentThemesZones = _widgetsService.GetZones(currentTheme);
|
||||
|
||||
string zonePreviewImagePath = string.Format("{0}/{1}/ThemeZonePreview.png", currentTheme.Location, currentTheme.Id);
|
||||
string zonePreviewImage = _virtualPathProvider.FileExists(zonePreviewImagePath) ? zonePreviewImagePath : null;
|
||||
|
||||
var widgets = _widgetsService.GetWidgets();
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(culture)) {
|
||||
@@ -104,8 +101,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
.CurrentCulture(culture)
|
||||
.Layers(layers)
|
||||
.Widgets(widgets)
|
||||
.ThemeZones(currentThemesZones)
|
||||
.LayoutZones(layoutZones)
|
||||
.Zones(currentThemesZones)
|
||||
.Cultures(_cultureManager.ListCultures())
|
||||
.OrphanZones(allZones.Except(currentThemesZones))
|
||||
.OrphanWidgets(_widgetsService.GetOrphanedWidgets())
|
||||
|
@@ -1,141 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Settings.Models;
|
||||
using Orchard.Layouts.Elements;
|
||||
using Orchard.Layouts.Framework.Display;
|
||||
using Orchard.Layouts.Framework.Drivers;
|
||||
using Orchard.Layouts.Framework.Elements;
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Widgets.Models;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Widgets.Drivers {
|
||||
public class ColumnElementDriver : ElementDriver<Column> {
|
||||
private readonly IOrchardServices _orchardServices;
|
||||
private readonly IRuleManager _ruleManager;
|
||||
private readonly IWidgetsService _widgetsService;
|
||||
|
||||
public ColumnElementDriver(IOrchardServices orchardServices, IRuleManager ruleManager, IWidgetsService widgetsService) {
|
||||
_orchardServices = orchardServices;
|
||||
_ruleManager = ruleManager;
|
||||
_widgetsService = widgetsService;
|
||||
}
|
||||
|
||||
protected override void OnLayoutSaving(Column element, ElementSavingContext context) {
|
||||
ValidateZoneName(element, context);
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Column element, ElementDisplayingContext context) {
|
||||
RenderWidgets(element, context);
|
||||
}
|
||||
|
||||
private void ValidateZoneName(Column element, ElementSavingContext context) {
|
||||
if (String.IsNullOrWhiteSpace(element.ZoneName))
|
||||
return; // Nothing to validate.
|
||||
|
||||
if (element.IsTemplated)
|
||||
return; // No need to validate templated columns.
|
||||
|
||||
var blacklist = new HashSet<string>();
|
||||
|
||||
// Add theme zones to the blacklist.
|
||||
var themeZones = _widgetsService.GetZones();
|
||||
Add(blacklist, themeZones);
|
||||
|
||||
// Add any zones from the current layout (except the zone name of the current column) to the blacklist.
|
||||
var siblingColumns = context.Elements.Flatten().Where(x => x is Column && x != element).Cast<Column>().ToList();
|
||||
var siblingZones = siblingColumns.Where(x => !String.IsNullOrWhiteSpace(x.ZoneName)).Select(x => x.ZoneName);
|
||||
Add(blacklist, siblingZones);
|
||||
|
||||
// Check if the specified zone is blacklisted.
|
||||
if (blacklist.Contains(element.ZoneName))
|
||||
context.Updater.AddModelError("ZoneName", T("The zone name '{0}' is already in use.", element.ZoneName));
|
||||
}
|
||||
|
||||
private void RenderWidgets(Column element, ElementDisplayingContext context) {
|
||||
if (String.IsNullOrWhiteSpace(element.ZoneName))
|
||||
return;
|
||||
|
||||
var widgets = GetActiveWidgets().Where(x => x.Zone == element.ZoneName);
|
||||
|
||||
foreach (var widgetPart in widgets) {
|
||||
var widgetShape = _orchardServices.ContentManager.BuildDisplay(widgetPart);
|
||||
context.ElementShape.Add(widgetShape, widgetPart.Position);
|
||||
}
|
||||
}
|
||||
|
||||
private static void Add(ISet<string> set, IEnumerable<string> zones) {
|
||||
foreach (var zone in zones) {
|
||||
set.Add(zone);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all widgets for all active layers, optimized for being executed multiple times during a single HTTP request.
|
||||
/// </summary>
|
||||
private IEnumerable<WidgetPart> GetActiveWidgets() {
|
||||
const string cacheKey = "ActiveWidgets";
|
||||
var widgets = (IList<WidgetPart>)_orchardServices.WorkContext.HttpContext.Items[cacheKey];
|
||||
|
||||
if (widgets == null) {
|
||||
widgets = new List<WidgetPart>();
|
||||
|
||||
var activeLayers = _orchardServices.ContentManager.Query<LayerPart>().ForType("Layer").List();
|
||||
var activeLayerIds = new List<int>();
|
||||
|
||||
foreach (var activeLayer in activeLayers) {
|
||||
try {
|
||||
if (_ruleManager.Matches(activeLayer.LayerRule)) {
|
||||
activeLayerIds.Add(activeLayer.ContentItem.Id);
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Logger.Warning(e, T("An error occured during layer evaluation on: {0}", activeLayer.Name).Text);
|
||||
}
|
||||
}
|
||||
|
||||
var widgetParts = _widgetsService.GetWidgets(layerIds: activeLayerIds.ToArray());
|
||||
var defaultCulture = _orchardServices.WorkContext.CurrentSite.As<SiteSettingsPart>().SiteCulture;
|
||||
var currentCulture = _orchardServices.WorkContext.CurrentCulture;
|
||||
|
||||
foreach (var widgetPart in widgetParts) {
|
||||
var commonPart = widgetPart.As<ICommonPart>();
|
||||
if (commonPart == null || commonPart.Container == null) {
|
||||
Logger.Warning("The widget '{0}' has no assigned layer or the layer does not exist.", widgetPart.Title);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Ignore widget for different cultures.
|
||||
var localizablePart = widgetPart.As<ILocalizableAspect>();
|
||||
if (localizablePart != null) {
|
||||
// If localized culture is null then show if current culture is the default
|
||||
// this allows a user to show a content item for the default culture only.
|
||||
if (localizablePart.Culture == null && defaultCulture != currentCulture) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// If culture is set, show only if current culture is the same.
|
||||
if (localizablePart.Culture != null && localizablePart.Culture != currentCulture) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Check permissions.
|
||||
if (!_orchardServices.Authorizer.Authorize(Core.Contents.Permissions.ViewContent, widgetPart)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
widgets.Add(widgetPart);
|
||||
}
|
||||
|
||||
_orchardServices.WorkContext.HttpContext.Items[cacheKey] = widgets;
|
||||
}
|
||||
|
||||
return widgets;
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Utility.Extensions;
|
||||
using Orchard.Widgets.Models;
|
||||
@@ -13,12 +12,10 @@ namespace Orchard.Widgets.Drivers {
|
||||
public class WidgetPartDriver : ContentPartDriver<WidgetPart> {
|
||||
private readonly IWidgetsService _widgetsService;
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly ILayoutManager _layoutManager;
|
||||
|
||||
public WidgetPartDriver(IWidgetsService widgetsService, IContentManager contentManager, ILayoutManager layoutManager) {
|
||||
public WidgetPartDriver(IWidgetsService widgetsService, IContentManager contentManager) {
|
||||
_widgetsService = widgetsService;
|
||||
_contentManager = contentManager;
|
||||
_layoutManager = layoutManager;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
@@ -30,8 +27,7 @@ namespace Orchard.Widgets.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(WidgetPart widgetPart, dynamic shapeHelper) {
|
||||
widgetPart.AvailableThemeZones = _widgetsService.GetZones();
|
||||
widgetPart.AvailableLayoutZones = _layoutManager.GetZones();
|
||||
widgetPart.AvailableZones = _widgetsService.GetZones();
|
||||
widgetPart.AvailableLayers = _widgetsService.GetLayers();
|
||||
|
||||
var results = new List<DriverResult> {
|
||||
|
@@ -79,7 +79,7 @@ namespace Orchard.Widgets.Filters {
|
||||
foreach (var widgetPart in widgetParts) {
|
||||
var commonPart = widgetPart.As<ICommonPart>();
|
||||
if (commonPart == null || commonPart.Container == null) {
|
||||
Logger.Warning("The widget '{0}' has no assigned layer or the layer does not exist.", widgetPart.Title);
|
||||
Logger.Warning("The widget '{0}' is has no assigned layer or the layer does not exist.", widgetPart.Title);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@@ -66,16 +66,10 @@ namespace Orchard.Widgets.Models {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The available theme zones.
|
||||
/// The available page zones.
|
||||
/// </summary>
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public IEnumerable<string> AvailableThemeZones { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The available layout zones.
|
||||
/// </summary>
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public IEnumerable<string> AvailableLayoutZones { get; set; }
|
||||
public IEnumerable<string> AvailableZones { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The available layers.
|
||||
|
@@ -7,7 +7,7 @@ OrchardVersion: 1.8
|
||||
Description: An implementation of widgets for Orchard.
|
||||
FeatureDescription: An implementation of widgets.
|
||||
Category: Widget
|
||||
Dependencies: Orchard.Scripting, Orchard.Themes, Orchard.Layouts
|
||||
Dependencies: Orchard.Scripting, Orchard.Themes
|
||||
Features:
|
||||
Orchard.Widgets.PageLayerHinting:
|
||||
Name: Page Layer Hinting
|
||||
|
@@ -70,7 +70,6 @@
|
||||
<Compile Include="Commands\WidgetCommands.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="ControlWrapper.cs" />
|
||||
<Compile Include="Drivers\ColumnElementDriver.cs" />
|
||||
<Compile Include="Drivers\LayerPartDriver.cs" />
|
||||
<Compile Include="Handlers\DisplayedContentItemHandler.cs" />
|
||||
<Compile Include="Handlers\LayerHintHandler.cs" />
|
||||
@@ -123,16 +122,13 @@
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
<Private>false</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
<Private>True</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Layouts\Orchard.Layouts.csproj">
|
||||
<Project>{6bd8b2fa-f2e3-4ac8-a4c3-2925a653889a}</Project>
|
||||
<Name>Orchard.Layouts</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Scripting\Orchard.Scripting.csproj">
|
||||
<Project>{99002B65-86F7-415E-BF4A-381AA8AB9CCC}</Project>
|
||||
<Name>Orchard.Scripting</Name>
|
||||
@@ -201,9 +197,9 @@
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target> -->
|
||||
<Target Name="AfterBuild" Condition="'$(MvcBuildViews)'=='true'">
|
||||
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)" />
|
||||
|
@@ -15,7 +15,7 @@
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
#widgets-layers-control label, #widgets-zones h3, #widgets-assistance h3 {
|
||||
#widgets-layers-control label, #widgets-zones h2, #widgets-assistance h3 {
|
||||
font-size: 1.077em;
|
||||
padding: 2px 2px;
|
||||
}
|
||||
@@ -63,11 +63,12 @@
|
||||
#widgets-zones-orphans-container p {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
#main .widgets-listed h2 {
|
||||
margin: 0.1em 0 0.6em;
|
||||
font-size: 1.1em;
|
||||
font-weight: normal;
|
||||
/* The number seems slightly meaningless. Leaving it out for now. * /
|
||||
#widgets-zones ol {
|
||||
list-style:decimal inside;
|
||||
}
|
||||
*/
|
||||
.widgets-listed ol {
|
||||
}
|
||||
|
||||
#widgets-orphans ul {
|
||||
@@ -99,11 +100,11 @@
|
||||
border-color: #487328;
|
||||
}
|
||||
|
||||
#widgets-available h3 {
|
||||
#widgets-available h2 {
|
||||
font-size: 1.231em;
|
||||
}
|
||||
|
||||
.widgets-listed h3, .widgets-listed li li, #widgets-layer-visibility li {
|
||||
.widgets-listed h2, .widgets-listed li li, #widgets-layer-visibility li {
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,7 @@
|
||||
<div id="widgets" class="group">
|
||||
@Display.WidgetFiltersControl(Layers: Model.Layers, CurrentLayer: Model.CurrentLayer, Cultures: Model.Cultures, CurrentCulture: Model.CurrentCulture)
|
||||
<div id="layout-widgets-placement">
|
||||
@Display.WidgetPlacement(Widgets: Model.Widgets, ThemeZones: Model.ThemeZones, LayoutZones: Model.LayoutZones, OrphanZones: Model.OrphanZones, CurrentLayer: Model.CurrentLayer)
|
||||
@Display.WidgetPlacement(Widgets: Model.Widgets, Zones: Model.Zones, OrphanZones: Model.OrphanZones, CurrentLayer: Model.CurrentLayer)
|
||||
</div>
|
||||
<div id="layout-widgets-assistance">
|
||||
<div id="widgets-assistance">
|
||||
|
@@ -1,15 +1,8 @@
|
||||
@model Orchard.Widgets.Models.WidgetPart
|
||||
@{
|
||||
var themeZonesGroup = Model.AvailableLayoutZones.Any() ? new SelectListGroup { Name = T("Theme Zones").Text } : default(SelectListGroup);
|
||||
var layoutZonesGroup = Model.AvailableLayoutZones.Any() ? new SelectListGroup { Name = T("Layout Zones").Text } : default(SelectListGroup); ;
|
||||
var themeZoneOptions = Model.AvailableThemeZones.Select(x => new SelectListItem { Text = x, Value = x, Selected = x == Model.Zone, Group = themeZonesGroup}).ToList();
|
||||
var layoutZoneOptions = Model.AvailableLayoutZones.Select(x => new SelectListItem { Text = x, Value = x, Selected = x == Model.Zone, Group = layoutZonesGroup}).ToList();
|
||||
var zoneOptions = themeZoneOptions.Concat(layoutZoneOptions);
|
||||
}
|
||||
<h2>@Model.TypeDefinition.DisplayName</h2>
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.Zone, T("Zone"))
|
||||
@Html.DropDownListFor(widget => widget.Zone, zoneOptions)
|
||||
@Html.DropDownListFor(widget => widget.Zone, new SelectList(Model.AvailableZones))
|
||||
<span class="hint">@T("The Zone in the Layout where the Widget will be rendered.")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@@ -19,7 +12,7 @@
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
@Html.LabelFor(widget => widget.Position, T("Position"))
|
||||
@Html.TextBoxFor(widget => widget.Position, new { @class = "text small" })
|
||||
@Html.TextBoxFor(widget => widget.Position, new { @class = "text small"})
|
||||
<span class="hint">@T("The position of the Widget inside the Zone.")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
@@ -8,16 +8,15 @@
|
||||
IEnumerable<string> zones = Model.Zones;
|
||||
var returnUrl = Request.RawUrl;
|
||||
}
|
||||
<h2>@Model.Title</h2>
|
||||
<ol>
|
||||
@foreach (string zone in zones) {
|
||||
var count = widgets.Count(w => w.Zone == zone);
|
||||
int count = widgets.Where(w => w.Zone == zone).Count();
|
||||
MvcHtmlString classAttr = null;
|
||||
if (count == 0) {
|
||||
classAttr = new MvcHtmlString("class=\"widgets-none\"");
|
||||
}
|
||||
<li @classAttr>
|
||||
<h3>@zone</h3>
|
||||
<h2>@zone</h2>
|
||||
<div class="widgets-actions">
|
||||
@Html.ActionLink(T("Add").Text, "ChooseWidget", new { layerId = Model.CurrentLayer.Id, zone, returnUrl }, new { @class = "button grey" })
|
||||
</div>
|
||||
@@ -69,4 +68,42 @@
|
||||
</ul>
|
||||
</li>
|
||||
}
|
||||
</ol>
|
||||
</ol>
|
||||
|
||||
@*
|
||||
@{
|
||||
Script.Require("ShapesBase");
|
||||
ContentPart contentPart = Model.ContentPart;
|
||||
}
|
||||
@if (contentPart.HasPublished()) {
|
||||
@Html.ItemDisplayLink(T("View").Text, (ContentItem)Model.ContentPart.ContentItem)
|
||||
@T(" | ")
|
||||
|
||||
if (contentPart.HasDraft()) {
|
||||
if (Authorizer.Authorize(Permissions.PublishContent, contentPart)) {
|
||||
@Html.Link(T("Publish Draft").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
|
||||
@T(" | ")
|
||||
|
||||
@Html.ActionLink(T("Preview").Text, "Preview", "Item", new { area = "Contents", id = ((ContentItem)Model.ContentPart.ContentItem).Id }, new { })
|
||||
@T(" | ")
|
||||
}
|
||||
}
|
||||
|
||||
if (Authorizer.Authorize(Permissions.PublishContent, contentPart)) {
|
||||
@Html.Link(T("Unpublish").Text, Url.Action("Unpublish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
|
||||
@T(" | ")
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (contentPart.HasDraft()) {
|
||||
@Html.ActionLink(T("Preview").Text, "Preview", "Item", new { area = "Contents", id = ((ContentItem)Model.ContentPart.ContentItem).Id }, new { })
|
||||
@T(" | ")
|
||||
}
|
||||
|
||||
if (Authorizer.Authorize(Permissions.PublishContent, contentPart)) {
|
||||
@Html.Link(T("Publish").Text, Url.Action("Publish", "Admin", new { area = "Contents", id = contentPart.ContentItem.Id, returnUrl = Request.ToUrlString() }), new { itemprop = "UnsafeUrl" })
|
||||
@T(" | ")
|
||||
}
|
||||
}
|
||||
|
||||
*@
|
@@ -1,23 +1,23 @@
|
||||
@using Orchard.Widgets.Models
|
||||
@using Orchard.Utility.Extensions;
|
||||
@using Orchard.Widgets.Models;
|
||||
@{
|
||||
Style.Require("WidgetsAdmin");
|
||||
IEnumerable<WidgetPart> widgets = Model.Widgets;
|
||||
IEnumerable<string> themeZones = Model.ThemeZones;
|
||||
IEnumerable<string> layoutZones = Model.LayoutZones;
|
||||
IEnumerable<string> zones = Model.Zones;
|
||||
IEnumerable<string> orphanZones = Model.OrphanZones;
|
||||
var returnUrl = Request.RawUrl;
|
||||
}
|
||||
<div id="widgets-placement">
|
||||
<div id="widgets-layers" class="widgets-container detail-view switchable">
|
||||
<div id="widgets-zones" class="widgets-listed">
|
||||
@Display.WidgetPlacement_Zones(Widgets: widgets, Zones: themeZones, CurrentLayer: Model.CurrentLayer, Title: T("Theme Zones"))
|
||||
@Display.WidgetPlacement_Zones(Widgets: widgets, Zones: layoutZones, CurrentLayer: Model.CurrentLayer, Title: T("Layout Zones"))
|
||||
@Display.WidgetPlacement_Zones(Widgets: Model.Widgets, Zones: Model.Zones, CurrentLayer: Model.CurrentLayer)
|
||||
</div>
|
||||
@if (orphanZones.Any()) {
|
||||
@if (orphanZones.Count() > 0) {
|
||||
<div id="widgets-zones-orphans-container">
|
||||
<h3>@T("Zones for other enabled themes.")</h3>
|
||||
<p>@T("Widgets in these zones will not appear anywhere when your currently active theme is applied. They might still appear in selectively applied (e.g. mobile) themes.")</p>
|
||||
<div id="widgets-zones-orphans" class="widgets-listed">
|
||||
@Display.WidgetPlacement_Zones(Widgets: widgets, Zones: Model.OrphanZones, CurrentLayer: Model.CurrentLayer)
|
||||
@Display.WidgetPlacement_Zones(Widgets: Model.Widgets, Zones: Model.OrphanZones, CurrentLayer: Model.CurrentLayer)
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
Reference in New Issue
Block a user