mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge branch 'Orchard-1.9.x' into issue/5829
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
<autofac defaultAssembly="Orchard.Framework">
|
||||
|
||||
<!--
|
||||
To create tenant specific configurations, copy this file to ~/Congig/Sites.{tenant}.config
|
||||
To create tenant specific configurations, copy this file to ~/Config/Sites.{tenant}.config
|
||||
where {tenant} is the technical name of the targetted tenant
|
||||
|
||||
Allowed scopes: per-dependency, single-instance or per-lifetime-scope
|
||||
@@ -47,4 +47,4 @@
|
||||
</components>
|
||||
</autofac>
|
||||
|
||||
</configuration>
|
||||
</configuration>
|
||||
|
@@ -52,7 +52,7 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
if (updater != null) {
|
||||
var oldContainerId = model.ContainerId;
|
||||
updater.TryUpdateModel(model, "Containable", null, new[] { "ShowContainerPicker", "ShowPositionEditor" });
|
||||
if (oldContainerId != model.ContainerId) {
|
||||
if (oldContainerId != model.ContainerId && settings.ShowContainerPicker) {
|
||||
if (commonPart != null) {
|
||||
var containerItem = _contentManager.Get(model.ContainerId, VersionOptions.Latest);
|
||||
commonPart.Container = containerItem;
|
||||
@@ -61,20 +61,23 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
part.Position = model.Position;
|
||||
}
|
||||
|
||||
var containers = _contentManager
|
||||
.Query<ContainerPart, ContainerPartRecord>(VersionOptions.Latest)
|
||||
.List()
|
||||
.Where(container => container.ItemContentTypes.Any(type => type.Name == part.TypeDefinition.Name));
|
||||
if (settings.ShowContainerPicker) {
|
||||
var containers = _contentManager
|
||||
.Query<ContainerPart, ContainerPartRecord>(VersionOptions.Latest)
|
||||
.List()
|
||||
.Where(container => container.ItemContentTypes.Any(type => type.Name == part.TypeDefinition.Name));
|
||||
|
||||
var listItems = new[] { new SelectListItem { Text = T("(None)").Text, Value = "0" } }
|
||||
.Concat(containers.Select(x => new SelectListItem {
|
||||
Value = Convert.ToString(x.Id),
|
||||
Text = x.ContentItem.TypeDefinition.DisplayName + ": " + _contentManager.GetItemMetadata(x.ContentItem).DisplayText,
|
||||
Selected = x.Id == model.ContainerId,
|
||||
}))
|
||||
.ToList();
|
||||
var listItems = new[] { new SelectListItem { Text = T("(None)").Text, Value = "0" } }
|
||||
.Concat(containers.Select(x => new SelectListItem {
|
||||
Value = Convert.ToString(x.Id),
|
||||
Text = x.ContentItem.TypeDefinition.DisplayName + ": " + _contentManager.GetItemMetadata(x.ContentItem).DisplayText,
|
||||
Selected = x.Id == model.ContainerId,
|
||||
}))
|
||||
.ToList();
|
||||
|
||||
model.AvailableContainers = new SelectList(listItems, "Value", "Text", model.ContainerId);
|
||||
}
|
||||
|
||||
model.AvailableContainers = new SelectList(listItems, "Value", "Text", model.ContainerId);
|
||||
model.Position = part.Position;
|
||||
|
||||
return shapeHelper.EditorTemplate(TemplateName: "Containable", Model: model, Prefix: "Containable");
|
||||
|
@@ -88,6 +88,10 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
|
||||
protected override DriverResult Editor(ContainerPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Container_Edit", () => {
|
||||
if(!part.ContainerSettings.DisplayContainerEditor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var containables = !part.ContainerSettings.RestrictItemContentTypes ? _containerService.GetContainableTypes().ToList() : new List<ContentTypeDefinition>(0);
|
||||
var model = new ContainerViewModel {
|
||||
AdminMenuPosition = part.AdminMenuPosition,
|
||||
|
@@ -48,6 +48,10 @@ namespace Orchard.Core.Containers.Settings {
|
||||
}
|
||||
|
||||
public class ContainerTypePartSettings {
|
||||
public ContainerTypePartSettings() {
|
||||
DisplayContainerEditor = true;
|
||||
}
|
||||
|
||||
public bool? ItemsShownDefault { get; set; }
|
||||
public int? PageSizeDefault { get; set; }
|
||||
public bool? PaginatedDefault { get; set; }
|
||||
@@ -55,6 +59,7 @@ namespace Orchard.Core.Containers.Settings {
|
||||
public bool RestrictItemContentTypes { get; set; }
|
||||
public bool? EnablePositioning { get; set; }
|
||||
public string AdminListViewName { get; set; }
|
||||
public bool DisplayContainerEditor { get; set; }
|
||||
}
|
||||
|
||||
public class ContainerSettingsHooks : ContentDefinitionEditorEventsBase {
|
||||
@@ -93,7 +98,8 @@ namespace Orchard.Core.Containers.Settings {
|
||||
EnablePositioning = model.EnablePositioning,
|
||||
AdminListViewName = model.AdminListViewName,
|
||||
AvailableItemContentTypes = _containerService.GetContainableTypes().ToList(),
|
||||
ListViewProviders = _listViewService.Providers.ToList()
|
||||
ListViewProviders = _listViewService.Providers.ToList(),
|
||||
DisplayContainerEditor = model.DisplayContainerEditor
|
||||
};
|
||||
|
||||
yield return DefinitionTemplate(viewModel);
|
||||
@@ -122,6 +128,7 @@ namespace Orchard.Core.Containers.Settings {
|
||||
builder.WithSetting("ContainerTypePartSettings.RestrictItemContentTypes", viewModel.RestrictItemContentTypes.ToString());
|
||||
builder.WithSetting("ContainerTypePartSettings.EnablePositioning", viewModel.EnablePositioning.ToString());
|
||||
builder.WithSetting("ContainerTypePartSettings.AdminListViewName", viewModel.AdminListViewName);
|
||||
builder.WithSetting("ContainerTypePartSettings.DisplayContainerEditor", viewModel.DisplayContainerEditor.ToString());
|
||||
yield return DefinitionTemplate(viewModel);
|
||||
}
|
||||
|
||||
|
@@ -16,5 +16,6 @@ namespace Orchard.Core.Containers.ViewModels {
|
||||
|
||||
[UIHint("ListViewPicker")]
|
||||
public string AdminListViewName { get; set; }
|
||||
public bool DisplayContainerEditor { get; set; }
|
||||
}
|
||||
}
|
@@ -2,6 +2,11 @@
|
||||
@{
|
||||
Script.Require("ShapesBase");
|
||||
}
|
||||
<fieldset>
|
||||
@Html.CheckBoxFor(m => m.DisplayContainerEditor)
|
||||
@Html.LabelFor(m => m.DisplayContainerEditor, @T("Display settings editor").ToString(), new { @class = "forcheckbox" })
|
||||
<span class="hint">@T("When checked, users can change the settings for each content item.")</span>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label for="@Html.FieldIdFor(m => m.ItemsShownDefault)">@T("Default Items Shown")</label>
|
||||
@Html.EditorFor(m => m.ItemsShownDefault)
|
||||
|
@@ -65,8 +65,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
|
||||
|
||||
var versionOptions = VersionOptions.Latest;
|
||||
switch (model.Options.ContentsStatus)
|
||||
{
|
||||
switch (model.Options.ContentsStatus) {
|
||||
case ContentsStatus.Published:
|
||||
versionOptions = VersionOptions.Published;
|
||||
break;
|
||||
@@ -112,6 +111,10 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
query = _cultureFilter.FilterCulture(query, model.Options.SelectedCulture);
|
||||
}
|
||||
|
||||
if(model.Options.ContentsStatus == ContentsStatus.Owner) {
|
||||
query = query.Where<CommonPartRecord>(cr => cr.OwnerId == Services.WorkContext.CurrentUser.Id);
|
||||
}
|
||||
|
||||
model.Options.SelectedFilter = model.TypeName;
|
||||
model.Options.FilterOptions = GetListableTypes(false)
|
||||
.Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
|
||||
|
@@ -49,12 +49,12 @@ namespace Orchard.Core.Contents.ViewModels {
|
||||
Created
|
||||
}
|
||||
|
||||
public enum ContentsStatus
|
||||
{
|
||||
public enum ContentsStatus {
|
||||
Draft,
|
||||
Published,
|
||||
AllVersions,
|
||||
Latest
|
||||
Latest,
|
||||
Owner
|
||||
}
|
||||
|
||||
public enum ContentsBulkAction {
|
||||
|
@@ -54,6 +54,7 @@
|
||||
</select>
|
||||
<label for="contentResults" class="bulk-order">@T("Filter by")</label>
|
||||
<select id="contentResults" name="Options.ContentsStatus">
|
||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Owner, T("owned by me").ToString())
|
||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Latest, T("latest").ToString())
|
||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Published, T("published").ToString())
|
||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Draft, T("unpublished").ToString())
|
||||
|
@@ -301,9 +301,12 @@ namespace Orchard.Core.Shapes {
|
||||
var progress = 1;
|
||||
var flatPositionComparer = new FlatPositionComparer();
|
||||
var ordering = unordered.Select(item => {
|
||||
var position = (item == null || item.GetType().GetProperty("Metadata") == null || item.Metadata.GetType().GetProperty("Position") == null)
|
||||
? null
|
||||
: item.Metadata.Position;
|
||||
string position = null;
|
||||
var itemPosition = item as IPositioned;
|
||||
if (itemPosition != null) {
|
||||
position = itemPosition.Position;
|
||||
}
|
||||
|
||||
return new { item, position };
|
||||
}).ToList();
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -71,6 +72,10 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.MediaLibrary\Orchard.MediaLibrary.csproj">
|
||||
<Project>{73a7688a-5bd3-4f7e-adfa-ce36c5a10e3b}</Project>
|
||||
<Name>Orchard.MediaLibrary</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Content\Admin\Images\grippie.png" />
|
||||
|
@@ -5,70 +5,72 @@
|
||||
editors.each(function() {
|
||||
|
||||
var idPostfix = $(this).attr('id').substr('wmd-input'.length);
|
||||
|
||||
|
||||
var editor = new Markdown.Editor(converter, idPostfix, {
|
||||
handler: function() { window.open("http://daringfireball.net/projects/markdown/syntax"); }
|
||||
});
|
||||
|
||||
editor.hooks.set("insertImageDialog", function(callback) {
|
||||
// see if there's an image selected that they intend on editing
|
||||
var wmd = $('#wmd-input' + idPostfix);
|
||||
if (Boolean($(this).data("manage-media"))) {
|
||||
editor.hooks.set("insertImageDialog", function (callback) {
|
||||
// see if there's an image selected that they intend on editing
|
||||
var wmd = $('#wmd-input' + idPostfix);
|
||||
|
||||
var editImage, content = wmd.selection ? wmd.selection.createRange().text : null;
|
||||
var adminIndex = location.href.toLowerCase().indexOf("/admin/");
|
||||
if (adminIndex === -1) return;
|
||||
var url = location.href.substr(0, adminIndex) + "/Admin/Orchard.MediaLibrary?dialog=true";
|
||||
$.colorbox({
|
||||
href: url,
|
||||
iframe: true,
|
||||
reposition: true,
|
||||
width: "90%",
|
||||
height: "90%",
|
||||
onLoad: function () {
|
||||
// hide the scrollbars from the main window
|
||||
$('html, body').css('overflow', 'hidden');
|
||||
},
|
||||
onClosed: function () {
|
||||
$('html, body').css('overflow', '');
|
||||
var editImage, content = wmd.selection ? wmd.selection.createRange().text : null;
|
||||
var adminIndex = location.href.toLowerCase().indexOf("/admin/");
|
||||
if (adminIndex === -1) return;
|
||||
var url = location.href.substr(0, adminIndex) + "/Admin/Orchard.MediaLibrary?dialog=true";
|
||||
$.colorbox({
|
||||
href: url,
|
||||
iframe: true,
|
||||
reposition: true,
|
||||
width: "90%",
|
||||
height: "90%",
|
||||
onLoad: function () {
|
||||
// hide the scrollbars from the main window
|
||||
$('html, body').css('overflow', 'hidden');
|
||||
},
|
||||
onClosed: function () {
|
||||
$('html, body').css('overflow', '');
|
||||
|
||||
var selectedData = $.colorbox.selectedData;
|
||||
var selectedData = $.colorbox.selectedData;
|
||||
|
||||
if (selectedData == null) // Dialog cancelled, do nothing
|
||||
return;
|
||||
if (selectedData == null) // Dialog cancelled, do nothing
|
||||
return;
|
||||
|
||||
var newContent = '';
|
||||
for (var i = 0; i < selectedData.length; i++) {
|
||||
var renderMedia = location.href.substr(0, adminIndex) + "/Admin/Orchard.MediaLibrary/MediaItem/" + selectedData[i].id + "?displayType=Raw";
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: 'GET',
|
||||
url: renderMedia,
|
||||
success: function (data) {
|
||||
newContent += data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var result = $.parseHTML(newContent);
|
||||
var img = $(result).filter('img');
|
||||
// if this is an image, use the callback which will format it in markdown
|
||||
if (img.length > 0 && img.attr('src')) {
|
||||
callback(img.attr('src'));
|
||||
}
|
||||
|
||||
// otherwise, insert the raw HTML
|
||||
else {
|
||||
if (wmd.selection) {
|
||||
wmd.selection.replace('.*', newContent);
|
||||
} else {
|
||||
wmd.text(newContent);
|
||||
var newContent = '';
|
||||
for (var i = 0; i < selectedData.length; i++) {
|
||||
var renderMedia = location.href.substr(0, adminIndex) + "/Admin/Orchard.MediaLibrary/MediaItem/" + selectedData[i].id + "?displayType=Raw";
|
||||
$.ajax({
|
||||
async: false,
|
||||
type: 'GET',
|
||||
url: renderMedia,
|
||||
success: function (data) {
|
||||
newContent += data;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var result = $.parseHTML(newContent);
|
||||
var img = $(result).filter('img');
|
||||
// if this is an image, use the callback which will format it in markdown
|
||||
if (img.length > 0 && img.attr('src')) {
|
||||
callback(img.attr('src'));
|
||||
}
|
||||
|
||||
// otherwise, insert the raw HTML
|
||||
else {
|
||||
if (wmd.selection) {
|
||||
wmd.selection.replace('.*', newContent);
|
||||
} else {
|
||||
wmd.text(newContent);
|
||||
}
|
||||
callback();
|
||||
}
|
||||
callback();
|
||||
}
|
||||
}
|
||||
});
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
editor.run();
|
||||
});
|
||||
|
@@ -21,7 +21,8 @@
|
||||
{"id", "wmd-input" + "-" + idPostfix},
|
||||
{"class", "wmd-input"},
|
||||
{"data-mediapicker-uploadpath", Model.AddMediaPath},
|
||||
{"data-mediapicker-title", T("Insert/Update Media")}
|
||||
{"data-mediapicker-title", T("Insert/Update Media")},
|
||||
{"data-manage-media", AuthorizedFor(Orchard.MediaLibrary.Permissions.ManageMediaContent) ? "true" : "false" }
|
||||
};
|
||||
|
||||
// The markdown editor itself doesn't seem to (yet) support autofocus, but we'll set it on the textarea nonetheless.
|
||||
|
@@ -144,7 +144,7 @@ namespace Orchard.AntiSpam.Controllers {
|
||||
if (spam != null) {
|
||||
spam.As<SpamFilterPart>().Status = SpamStatus.Spam;
|
||||
_spamService.ReportSpam(spam.As<SpamFilterPart>());
|
||||
Services.ContentManager.Publish(spam);
|
||||
Services.ContentManager.Unpublish(spam);
|
||||
}
|
||||
|
||||
return this.RedirectLocal(returnUrl, "~/");
|
||||
@@ -158,7 +158,7 @@ namespace Orchard.AntiSpam.Controllers {
|
||||
var spam = Services.ContentManager.Get(id, VersionOptions.Latest);
|
||||
if (spam != null) {
|
||||
spam.As<SpamFilterPart>().Status = SpamStatus.Ham;
|
||||
_spamService.ReportSpam(spam.As<SpamFilterPart>());
|
||||
_spamService.ReportHam(spam.As<SpamFilterPart>());
|
||||
Services.ContentManager.Publish(spam);
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using Orchard.AntiSpam.Models;
|
||||
using Orchard.AntiSpam.Services;
|
||||
using Orchard.AntiSpam.Settings;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
@@ -8,11 +7,9 @@ using Orchard.Localization;
|
||||
|
||||
namespace Orchard.AntiSpam.Drivers {
|
||||
public class SpamFilterPartDriver : ContentPartDriver<SpamFilterPart> {
|
||||
private readonly ISpamService _spamService;
|
||||
private const string TemplateName = "Parts/SpamFilter";
|
||||
|
||||
public SpamFilterPartDriver(IOrchardServices services, ISpamService spamService) {
|
||||
_spamService = spamService;
|
||||
public SpamFilterPartDriver(IOrchardServices services) {
|
||||
T = NullLocalizer.Instance;
|
||||
Services = services;
|
||||
}
|
||||
@@ -25,8 +22,6 @@ namespace Orchard.AntiSpam.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(SpamFilterPart part, ContentManagement.IUpdateModel updater, dynamic shapeHelper) {
|
||||
part.Status = _spamService.CheckForSpam(part);
|
||||
|
||||
if (part.Settings.GetModel<SpamFilterPartSettings>().DeleteSpam) {
|
||||
updater.AddModelError("Spam", T("Spam detected."));
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
using Orchard.AntiSpam.Models;
|
||||
|
||||
using Orchard.AntiSpam.Services;
|
||||
using Orchard.AntiSpam.Settings;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Data;
|
||||
@@ -7,14 +7,22 @@ using Orchard.Data;
|
||||
namespace Orchard.AntiSpam.Handlers {
|
||||
public class SpamFilterPartHandler : ContentHandler {
|
||||
private readonly ITransactionManager _transactionManager;
|
||||
private readonly ISpamService _spamService;
|
||||
|
||||
public SpamFilterPartHandler(
|
||||
IRepository<SpamFilterPartRecord> repository,
|
||||
ITransactionManager transactionManager
|
||||
ITransactionManager transactionManager,
|
||||
ISpamService spamService
|
||||
) {
|
||||
_transactionManager = transactionManager;
|
||||
_spamService = spamService;
|
||||
|
||||
Filters.Add(StorageFilter.For(repository));
|
||||
|
||||
OnCreating<SpamFilterPart>((context, part) => {
|
||||
part.Status = _spamService.CheckForSpam(part);
|
||||
});
|
||||
|
||||
OnPublishing<SpamFilterPart>((context, part) => {
|
||||
if (part.Status == SpamStatus.Spam) {
|
||||
if (part.Settings.GetModel<SpamFilterPartSettings>().DeleteSpam) {
|
||||
|
@@ -126,6 +126,7 @@ namespace Orchard.AntiSpam.Services {
|
||||
CommentAuthorEmail = _tokenizer.Replace(settings.CommentAuthorEmailPattern, data),
|
||||
CommentAuthorUrl = _tokenizer.Replace(settings.CommentAuthorUrlPattern, data),
|
||||
CommentContent = _tokenizer.Replace(settings.CommentContentPattern, data),
|
||||
CommentType = part.ContentItem.ContentType.ToLower()
|
||||
};
|
||||
|
||||
if(workContext.HttpContext != null) {
|
||||
|
@@ -136,7 +136,7 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
var runtimeValues = GetRuntimeValues(element);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(optionLabel)) {
|
||||
yield return new SelectListItem { Text = displayType != "Design" ? _tokenizer.Replace(optionLabel, tokenData) : optionLabel };
|
||||
yield return new SelectListItem { Text = displayType != "Design" ? _tokenizer.Replace(optionLabel, tokenData) : optionLabel, Value = string.Empty };
|
||||
}
|
||||
|
||||
if (queryId == null)
|
||||
|
@@ -138,7 +138,7 @@ namespace Orchard.DynamicForms.Drivers {
|
||||
var runtimeValues = GetRuntimeValues(element);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(optionLabel)) {
|
||||
yield return new SelectListItem { Text = displayType != "Design" ? _tokenizer.Replace(optionLabel, tokenData) : optionLabel };
|
||||
yield return new SelectListItem { Text = displayType != "Design" ? _tokenizer.Replace(optionLabel, tokenData) : optionLabel, Value = string.Empty };
|
||||
}
|
||||
|
||||
if (taxonomyId == null)
|
||||
|
@@ -2,7 +2,7 @@
|
||||
@foreach (var contentItemShape in Model.ContentItems) {
|
||||
var contentItem = (ContentItem)contentItemShape.ContentItem;
|
||||
var displayTextHtmlString = Html.ItemDisplayText(contentItem);
|
||||
var displayText = displayTextHtmlString != null ? displayTextHtmlString.ToString() : T("-").ToString();
|
||||
var displayText = displayTextHtmlString != null ? (IHtmlString)displayTextHtmlString : T("-");
|
||||
<div class="layout-snippet">
|
||||
@displayText
|
||||
</div>
|
||||
|
@@ -1,17 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Taxonomies.Models;
|
||||
|
||||
namespace Orchard.Taxonomies.Services {
|
||||
public class TermCountProcessor : ITermCountProcessor {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly ITaxonomyService _taxonomyService;
|
||||
|
||||
public TermCountProcessor(IContentManager contentManager, ITaxonomyService taxonomyService) {
|
||||
_contentManager = contentManager;
|
||||
public TermCountProcessor(ITaxonomyService taxonomyService) {
|
||||
_taxonomyService = taxonomyService;
|
||||
}
|
||||
|
||||
@@ -31,4 +25,4 @@ namespace Orchard.Taxonomies.Services {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,9 +30,9 @@
|
||||
var selectedTerms = Newtonsoft.Json.JsonConvert.SerializeObject(Model.Terms.Where(x => x.IsChecked).Select(x => new { label = x.Name, value = x.Id, levels = 0, disabled = true }));
|
||||
}
|
||||
<fieldset class="taxonomy-wrapper" data-name-prefix="@Html.FieldNameFor(m => m)" data-id-prefix="@Html.FieldIdFor(m => m)">
|
||||
<legend @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.DisplayName</legend>
|
||||
<label @if(Model.Settings.Required) { <text>class="required"</text> }>@Model.DisplayName</label>
|
||||
@if (Model.Settings.Autocomplete) {
|
||||
<div class="terms-editor" data-all-terms="@allTerms" data-selected-terms="@selectedTerms" data-allow-new-terms="@Model.Settings.AllowCustomTerms.ToString().ToLower()" data-singlechoice="@Model.Settings.SingleChoice.ToString().ToLower()">
|
||||
<div class="terms-editor text text-medium" data-all-terms="@allTerms" data-selected-terms="@selectedTerms" data-allow-new-terms="@Model.Settings.AllowCustomTerms.ToString().ToLower()" data-singlechoice="@Model.Settings.SingleChoice.ToString().ToLower()">
|
||||
<ul></ul>
|
||||
@if (Model.Settings.SingleChoice) {
|
||||
<div class="hint">@T("Enter a single term. Hit <i>tab</i> or <i>enter</i> to apply the term.") @if (!Model.Settings.AllowCustomTerms) { <text>@T("This taxonomy does not allow you to create new terms.") </text> }</div>
|
||||
@@ -67,7 +67,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@if (!Model.Terms.Any()) {
|
||||
@if (!Model.Terms.Any() && AuthorizedFor(Orchard.Taxonomies.Permissions.CreateTerm)) {
|
||||
<div class="no-terms">
|
||||
@T("There are no terms defined for {0} yet.", Model.DisplayName)
|
||||
<a href="@Url.Action("Index", "TermAdmin", new { taxonomyId = Model.TaxonomyId, area = "Orchard.Taxonomies" })">@T("Create some terms")</a>
|
||||
|
@@ -43,7 +43,7 @@
|
||||
}
|
||||
</ul>
|
||||
|
||||
@if (!Model.Terms.Any()) {
|
||||
@if (!Model.Terms.Any() && AuthorizedFor(Orchard.Taxonomies.Permissions.CreateTerm)) {
|
||||
<div class="no-terms">
|
||||
@T("There are no terms defined for {0} yet.", Model.DisplayName)
|
||||
<a href="@Url.Action("Index", "TermAdmin", new { taxonomyId = Model.TaxonomyId, area = "Orchard.Taxonomies" })">@T("Create some terms")</a>
|
||||
|
@@ -21,14 +21,6 @@ namespace Orchard.ContentManagement {
|
||||
|
||||
public virtual ContentItem ContentItem { get; set; }
|
||||
|
||||
//interesting thought, should/could parts also have zones (would then have zones on the page, content item and parts...)?
|
||||
private readonly IZoneCollection _zones = new ZoneCollection();
|
||||
public virtual IZoneCollection Zones {
|
||||
get {
|
||||
return _zones;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The ContentItem's identifier.
|
||||
/// </summary>
|
||||
|
5
src/Orchard/DisplayManagement/IPositioned.cs
Normal file
5
src/Orchard/DisplayManagement/IPositioned.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
namespace Orchard.DisplayManagement {
|
||||
public interface IPositioned {
|
||||
string Position { get; }
|
||||
}
|
||||
}
|
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
/// <summary>
|
||||
|
26
src/Orchard/DisplayManagement/PositionWrapper.cs
Normal file
26
src/Orchard/DisplayManagement/PositionWrapper.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Web;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
public class PositionWrapper : IHtmlString, IPositioned {
|
||||
|
||||
private IHtmlString _value;
|
||||
public string Position { get; private set; }
|
||||
|
||||
public PositionWrapper(IHtmlString value, string position) {
|
||||
_value = value;
|
||||
Position = position;
|
||||
}
|
||||
|
||||
public PositionWrapper(string value, string position)
|
||||
: this(new HtmlString(HttpUtility.HtmlEncode(value)), position) {
|
||||
}
|
||||
|
||||
public string ToHtmlString() {
|
||||
return _value.ToHtmlString();
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return _value.ToString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -4,11 +4,11 @@ using System.Dynamic;
|
||||
using System.Linq;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web;
|
||||
|
||||
namespace Orchard.DisplayManagement.Shapes {
|
||||
[DebuggerTypeProxy(typeof(ShapeDebugView))]
|
||||
public class Shape : Composite, IShape, IEnumerable<object> {
|
||||
public class Shape : Composite, IShape, IPositioned, IEnumerable<object> {
|
||||
private const string DefaultPosition = "5";
|
||||
|
||||
private readonly IList<object> _items = new List<object>();
|
||||
@@ -22,6 +22,12 @@ namespace Orchard.DisplayManagement.Shapes {
|
||||
public virtual IDictionary<string, string> Attributes { get { return _attributes; } }
|
||||
public virtual IEnumerable<dynamic> Items { get { return _items; } }
|
||||
|
||||
public string Position {
|
||||
get {
|
||||
return Metadata.Position;
|
||||
}
|
||||
}
|
||||
|
||||
public Shape() {
|
||||
Metadata = new ShapeMetadata();
|
||||
}
|
||||
@@ -33,13 +39,14 @@ namespace Orchard.DisplayManagement.Shapes {
|
||||
}
|
||||
|
||||
try {
|
||||
// todo: (sebros) this is a temporary implementation to prevent common known scenarios throwing exceptions. The final solution would need to filter based on the fact that it is a Shape instance
|
||||
if (item is MvcHtmlString ||
|
||||
item is String) {
|
||||
// need to implement positioned wrapper for non-shape objects
|
||||
if (position != null && item is IHtmlString) {
|
||||
item = new PositionWrapper((IHtmlString)item, position);
|
||||
}
|
||||
else if (position != null && item is string) {
|
||||
item = new PositionWrapper((string)item, position);
|
||||
}
|
||||
else if (item is IShape) {
|
||||
((dynamic)item).Metadata.Position = position;
|
||||
((IShape)item).Metadata.Position = position;
|
||||
}
|
||||
}
|
||||
catch {
|
||||
|
@@ -150,6 +150,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BackgroundHttpContextFactory.cs" />
|
||||
<Compile Include="DisplayManagement\IPositioned.cs" />
|
||||
<Compile Include="DisplayManagement\PositionWrapper.cs" />
|
||||
<Compile Include="Localization\Services\ILocalizationStreamParser.cs" />
|
||||
<Compile Include="Localization\Services\LocalizationStreamParser.cs" />
|
||||
<Compile Include="Mvc\Html\LinkExtensions.cs" />
|
||||
|
Reference in New Issue
Block a user