Merge branch '1.9.x' into dev

Conflicts:
	src/Orchard.Web/Modules/Orchard.Layouts/Orchard.Layouts.csproj
	src/Orchard.Web/Modules/Orchard.Setup/SetupMode.cs
	src/Orchard.Web/Modules/Orchard.Taxonomies/Drivers/TaxonomyFieldDriver.cs
	src/Orchard/Mvc/HttpContextAccessor.cs
	src/Orchard/Mvc/IHttpContextAccessor.cs
	src/Orchard/Orchard.Framework.csproj
	src/Orchard/Tasks/BackgroundService.cs
This commit is contained in:
Sipke Schoorstra
2015-06-07 00:46:14 +02:00
30 changed files with 170 additions and 117 deletions

View File

@@ -24,5 +24,10 @@ namespace Orchard.Tests.DataMigration.Utilities {
public void Visit(DropForeignKeyCommand command) {
}
public string PrefixTableName(string tableName) {
return tableName;
}
}
}

View File

@@ -42,7 +42,7 @@
// display a message on leave if changes have been made
window.onbeforeunload = function (e) {
return leaveConfirmation;
return $("<div/>").html(leaveConfirmation).text();
};
// cancel leaving message on save

View File

@@ -22,7 +22,7 @@
<label for="menuId">@T("Current Menu:")</label>
<select id="menuId" name="menuId">
@foreach (var menu in Model.Menus) {
@Html.SelectOption(Model.CurrentMenu.Id, menu.Id, Convert.ToString(Html.ItemDisplayText(menu)))
@Html.SelectOption(Model.CurrentMenu.Id, menu.Id, Convert.ToString(Html.ItemDisplayText(menu, false)))
}
</select>
@if (hasPermission) {
@@ -134,12 +134,12 @@
@using (Script.Foot()) {
<script type="text/javascript">
//<![CDATA[
var leaveConfirmation = '@T("Some items where not saved.")';
//<![CDATA[
var leaveConfirmation = '@HttpUtility.JavaScriptStringEncode(T("Some items where not saved.").Text)';
$('#menuId').change(function () {
$(this).parents('form').submit();
});
//]]>
//]]>
</script>
}

View File

@@ -6,7 +6,7 @@
@Html.LabelFor(m => m.CurrentMenuId, T("For Menu"))
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
@foreach(ContentItem menu in Model.Menus) {
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu).ToString())
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu, false).ToString())
}
</select>
<span class="hint">@T("Select which menu you want to display")</span>

View File

@@ -11,7 +11,7 @@
<div data-controllerid="@Html.FieldIdFor(m => m.OnMenu)" class="">
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
@foreach (ContentItem menu in Model.Menus) {
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu).ToString())
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu, false).ToString())
}
</select>
<span class="hint">@T("Select which menu you want the content item to be displayed on.")</span>

View File

@@ -29,7 +29,7 @@
<div data-controllerid="@Html.FieldIdFor(m => m.AddMenuItem)">
<select id="@Html.FieldIdFor(m => m.CurrentMenuId)" name="@Html.FieldNameFor(m => m.CurrentMenuId)">
@foreach (ContentItem menu in Model.Menus) {
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu).ToString())
@Html.SelectOption(Model.CurrentMenuId, menu.Id, Html.ItemDisplayText(menu, false).ToString())
}
</select>
<span class="hint">@T("Select which menu you want the content item to be added on.")</span>

View File

@@ -5,7 +5,7 @@
var tagBuilder = TagBuilderExtensions.CreateElementTagBuilder(Model, "input");
tagBuilder.AddCssClass("text design");
tagBuilder.Attributes["type"] = "email";
tagBuilder.Attributes["type"] = "text";
tagBuilder.Attributes["value"] = element.Value;
tagBuilder.Attributes["name"] = element.Name;
}

View File

@@ -103,6 +103,9 @@ namespace Orchard.Layouts.Drivers {
// Execute the query.
var contentItems = _projectionManager.GetContentItems(query.Id, pager.GetStartIndex() + element.Skip, pager.PageSize).ToList();
context.ElementShape.ContentItems = contentItems;
context.ElementShape.BuildShapes = (Func<string, IEnumerable<dynamic>>) (displayType => contentItems.Select(x => _contentManager.BuildDisplay(x, displayType)));
// TODO: Figure out if we need this for a Projection Element, and if so, how.
//// Sanity check so that content items with ProjectionPart can't be added here, or it will result in an infinite loop.
//contentItems = contentItems.Where(x => !x.Has<ProjectionPart>()).ToList();

View File

@@ -1,5 +1,4 @@
using Orchard.Caching;
using Orchard.ContentManagement;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Handlers;
using Orchard.Data;
using Orchard.DisplayManagement;

View File

@@ -24,6 +24,7 @@
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -669,6 +670,9 @@
<ItemGroup>
<Content Include="Styles\LayoutEditor\Menu.less" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Elements\Projection.Design.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@@ -1,16 +1,17 @@
using System.Web;
using System.Web.Mvc;
using Orchard.Layouts.Filters;
using Orchard.Mvc;
namespace Orchard.Layouts.Services {
public class CurrentControllerAccessor : ICurrentControllerAccessor {
private readonly IHttpContextAccessor _httpContextAccessor;
public CurrentControllerAccessor(IHttpContextAccessor httpContextAccessor) {
_httpContextAccessor = httpContextAccessor;
private readonly HttpContextBase _httpContext;
public CurrentControllerAccessor(HttpContextBase httpContext) {
_httpContext = httpContext;
}
public Controller CurrentController {
get { return (Controller) _httpContextAccessor.Current().Items[ControllerAccessorFilter.CurrentControllerKey]; }
get { return (Controller) _httpContext.Items[ControllerAccessorFilter.CurrentControllerKey]; }
}
}
}

View File

@@ -0,0 +1,11 @@
@{
var contentShapes = ((Func<string, IEnumerable<dynamic>>)Model.BuildShapes)("Summary").ToList();
var list = New.List();
list.AddRange(contentShapes);
}
@if (contentShapes.Any()) {
@Display(list)
}
else {
<p>@T("The query returned no results.")</p>
}

View File

@@ -43,7 +43,7 @@
var force = actionLink.data("feature-force");
var dependants = actionLink.data("feature-dependants");
if (!dependants || /^\s*$/.test(dependants) || confirm(confirmDisableMessage + "\n\n" + dependants)) {
if (!dependants || /^\s*$/.test(dependants) || confirm($("<div/>").html(confirmDisableMessage + "\n\n" + dependants).text())) {
$("[name='submit.BulkExecute']").val("yes");
$("[name='featureIds']").val(featureId);

View File

@@ -1,4 +1 @@
$(function(){var n=function(){var n=$(".bulk-actions-wrapper").addClass("visible"),t=$(".switch-for-switchable");t.prepend(n);$("#search-box").focus().keyup(function(){var n=$(this).val(),t;if(n==""){$("li.category").show();$("li.feature:hidden").show();return}$("li.feature").each(function(){var t=$(this),i=t.find("h3:first").text();i.toLowerCase().indexOf(n.toLowerCase())>=0?t.show():t.hide()});$("li.category:hidden").show();t=$("li.category:not(:has(li.feature:visible))").hide()})},t=function(){$("li.feature h3").on("change","input[type='checkbox']",function(){var n=$(this).is(":checked"),t=$(this).parents("li.feature:first");t.toggleClass("selected",n)})},i=function(){$("li.feature .actions").on("click","a[data-feature-action]",function(n){var t=$(this),r=t.data("feature-id"),u=t.data("feature-action"),f=t.data("feature-force"),i=t.data("feature-dependants");(!i||/^\s*$/.test(i)||confirm(confirmDisableMessage+"\n\n"+i))&&($("[name='submit.BulkExecute']").val("yes"),$("[name='featureIds']").val(r),$("[name='bulkAction']").val(u),$("[name='force']").val(f),t.parents("form:first").submit());n.preventDefault()})};n();t();i()});
/*
//# sourceMappingURL=features.admin.min.js.map
*/
$(function(){var n=function(){var n=$(".bulk-actions-wrapper").addClass("visible"),t=$(".switch-for-switchable");t.prepend(n);$("#search-box").keyup(function(){var n=$(this).val(),t;if(n==""){$("li.category").show();$("li.feature:hidden").show();return}$("li.feature").each(function(){var t=$(this),i=t.find("h3:first").text();i.toLowerCase().indexOf(n.toLowerCase())>=0?t.show():t.hide()});$("li.category:hidden").show();t=$("li.category:not(:has(li.feature:visible))").hide()})},t=function(){$("li.feature h3").on("change","input[type='checkbox']",function(){var n=$(this).is(":checked"),t=$(this).parents("li.feature:first");t.toggleClass("selected",n)})},i=function(){$("li.feature .actions").on("click","a[data-feature-action]",function(n){var t=$(this),r=t.data("feature-id"),u=t.data("feature-action"),f=t.data("feature-force"),i=t.data("feature-dependants");(!i||/^\s*$/.test(i)||confirm($("<div/>").html(confirmDisableMessage+"\n\n"+i).text()))&&($("[name='submit.BulkExecute']").val("yes"),$("[name='featureIds']").val(r),$("[name='bulkAction']").val(u),$("[name='force']").val(f),t.parents("form:first").submit());n.preventDefault()})};n();t();i()});

View File

@@ -16,29 +16,29 @@
@if (Model.Features.Any()) {
using (Html.BeginFormAntiForgeryPost()) {
@Html.Hidden("submit.BulkExecute")
@Html.Hidden("force", true)
@Html.Hidden("featureIds")
<div class="bulk-actions-wrapper">
<fieldset class="bulk-actions">
<label for="search-box">@T("Filter:")</label>
<input id="search-box" class="text" type="text" autofocus="autofocus" />
</fieldset>
<fieldset class="bulk-actions">
<label for="publishActions">@T("Actions:")</label>
<select id="publishActions" name="bulkAction">
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.None, T("Choose action...").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Enable, T("Enable").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Disable, T("Disable").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Update, T("Update").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Toggle, T("Toggle").ToString())
</select>
<button type="submit" name="submit.BulkExecute" value="yes">@T("Execute")</button>
</fieldset>
</div>
@Html.Hidden("submit.BulkExecute")
@Html.Hidden("force", true)
@Html.Hidden("featureIds")
<div class="bulk-actions-wrapper">
<fieldset class="bulk-actions">
<label for="search-box">@T("Filter:")</label>
<input id="search-box" class="text" type="text" autofocus="autofocus" />
</fieldset>
<fieldset class="bulk-actions">
<label for="publishActions">@T("Actions:")</label>
<select id="publishActions" name="bulkAction">
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.None, T("Choose action...").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Enable, T("Enable").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Disable, T("Disable").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Update, T("Update").ToString())
@Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Toggle, T("Toggle").ToString())
</select>
<button type="submit" name="submit.BulkExecute" value="yes">@T("Execute")</button>
</fieldset>
</div>
<ul class="features summary-view switchable">
@{
<ul class="features summary-view switchable">
@{
var featureGroups = Model.Features.OrderBy(f => f.Descriptor.Category, new DoghouseComparer("Core")).GroupBy(f => f.Descriptor.Category).ToList();
foreach (var featureGroup in featureGroups) {
if (!featureGroup.Any(x => Model.IsAllowed(x.Descriptor.Extension))) {
@@ -98,8 +98,7 @@
<input type="checkbox" name="featureIds" value="@feature.Descriptor.Id" />
@featureName
</label>
}
else {
} else {
@featureName
}
</h3>
@@ -138,14 +137,14 @@
}
</ul>
</li>}
}
</ul>}
}
</ul>}
using (Script.Foot()) {
<script type="text/javascript">
//<![CDATA[
var confirmDisableMessage = '@T("Disabling this feature will also disable the following dependent features. Are you sure you want to continue?")';
//]]>
//<![CDATA[
var confirmDisableMessage = '@HttpUtility.JavaScriptStringEncode(T("Disabling this feature will also disable the following dependent features. Are you sure you want to continue?").Text)';
//]]>
</script>
}
}

View File

@@ -215,30 +215,39 @@ namespace Orchard.OutputCache.Filters {
response.Filter = captureStream;
captureStream.Captured += (output) => {
try {
var cacheItem = new CacheItem() {
CachedOnUtc = _now,
Duration = cacheDuration,
GraceTime = cacheGraceTime,
Output = output,
ContentType = response.ContentType,
QueryString = filterContext.HttpContext.Request.Url.Query,
CacheKey = _cacheKey,
InvariantCacheKey = _invariantCacheKey,
Url = filterContext.HttpContext.Request.Url.AbsolutePath,
Tenant = _shellSettings.Name,
StatusCode = response.StatusCode,
Tags = new[] { _invariantCacheKey }.Union(contentItemIds).ToArray()
};
// Since this is a callback any call to injected dependencies can result in an Autofac exception: "Instances
// cannot be resolved and nested lifetimes cannot be created from this LifetimeScope as it has already been disposed."
// To prevent access to the original lifetime scope a new work context scope should be created here and dependencies
// should be resolved from it.
// Write the rendered item to the cache.
_cacheStorageProvider.Remove(_cacheKey);
_cacheStorageProvider.Set(_cacheKey, cacheItem);
using (var scope = _workContextAccessor.CreateWorkContextScope()) {
var cacheItem = new CacheItem() {
CachedOnUtc = _now,
Duration = cacheDuration,
GraceTime = cacheGraceTime,
Output = output,
ContentType = response.ContentType,
QueryString = filterContext.HttpContext.Request.Url.Query,
CacheKey = _cacheKey,
InvariantCacheKey = _invariantCacheKey,
Url = filterContext.HttpContext.Request.Url.AbsolutePath,
Tenant = scope.Resolve<ShellSettings>().Name,
StatusCode = response.StatusCode,
Tags = new[] { _invariantCacheKey }.Union(contentItemIds).ToArray()
};
Logger.Debug("Item '{0}' was written to cache.", _cacheKey);
// Write the rendered item to the cache.
var cacheStorageProvider = scope.Resolve<IOutputCacheStorageProvider>();
cacheStorageProvider.Remove(_cacheKey);
cacheStorageProvider.Set(_cacheKey, cacheItem);
// Also add the item tags to the tag cache.
foreach (var tag in cacheItem.Tags) {
_tagCache.Tag(tag, _cacheKey);
Logger.Debug("Item '{0}' was written to cache.", _cacheKey);
// Also add the item tags to the tag cache.
var tagCache = scope.Resolve<ITagCache>();
foreach (var tag in cacheItem.Tags) {
tagCache.Tag(tag, _cacheKey);
}
}
}
finally {
@@ -449,6 +458,9 @@ namespace Orchard.OutputCache.Filters {
private void ServeCachedItem(ActionExecutingContext filterContext, CacheItem cacheItem) {
var response = filterContext.HttpContext.Response;
// Fix for missing charset in response headers
response.Charset = response.Charset;
// Adds some caching information to the output if requested.
if (CacheSettings.DebugMode) {
response.AddHeader("X-Cached-On", cacheItem.CachedOnUtc.ToString("r"));

View File

@@ -1,14 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />

View File

@@ -59,10 +59,11 @@ namespace Orchard.Search.Controllers {
var viewModel = new MediaManagerMediaItemsViewModel {
MediaItems = mediaItems,
MediaItemsCount = mediaPartsCount
MediaItemsCount = mediaPartsCount,
FolderPath = folderPath
};
return View(viewModel);
}
}
}
}

View File

@@ -17,8 +17,9 @@
mimeTypeClass = x.MediaPart.MimeType.HtmlClassify(),
thumbnail = Display(x.Shape).ToString(),
editLink = Url.ItemEditUrl(x.MediaPart)
}).ToArray()
}).ToArray(),
folderPath = Model.FolderPath
}))
}

View File

@@ -36,25 +36,8 @@ namespace Orchard.SecureSocketsLayer.Drivers {
}
protected override void Importing(SslSettingsPart part, ImportContentContext context) {
var elementName = part.PartDefinition.Name;
part.Enabled = bool.Parse(context.Attribute(elementName, "Enabled") ?? "false");
part.SecureEverything = bool.Parse(context.Attribute(elementName, "SecureEverything") ?? "true");
part.CustomEnabled = bool.Parse(context.Attribute(elementName, "CustomEnabled") ?? "false");
part.Urls = context.Attribute(elementName, "Urls") ?? "";
part.InsecureHostName = context.Attribute(elementName, "InsecureHostName") ?? "";
part.SecureHostName = context.Attribute(elementName, "SecureHostName") ?? "";
base.Importing(part, context);
_signals.Trigger(SslSettingsPart.CacheKey);
}
protected override void Exporting(SslSettingsPart part, ExportContentContext context) {
var el = context.Element(part.PartDefinition.Name);
el.SetAttributeValue("Enabled", part.Enabled);
el.SetAttributeValue("SecureEverything", part.SecureEverything);
el.SetAttributeValue("CustomEnabled", part.CustomEnabled);
el.SetAttributeValue("Urls", part.Urls);
el.SetAttributeValue("InsecureHostName", part.InsecureHostName);
el.SetAttributeValue("SecureHostName", part.SecureHostName);
}
}
}
}

View File

@@ -61,11 +61,11 @@ namespace Orchard.Setup {
builder.RegisterType<DataServicesProviderFactory>().As<IDataServicesProviderFactory>().InstancePerLifetimeScope();
builder.RegisterType<DefaultCommandManager>().As<ICommandManager>().InstancePerLifetimeScope();
builder.RegisterType<HelpCommand>().As<ICommandHandler>().InstancePerLifetimeScope();
//builder.RegisterType<WorkContextAccessor>().As<IWorkContextAccessor>().InstancePerMatchingLifetimeScope("shell");
builder.RegisterType<ResourceManager>().As<IResourceManager>().InstancePerLifetimeScope();
builder.RegisterType<ResourceFilter>().As<IFilterProvider>().InstancePerLifetimeScope();
builder.RegisterType<DefaultOrchardShell>().As<IOrchardShell>().InstancePerMatchingLifetimeScope("shell");
builder.RegisterType<SweepGenerator>().As<ISweepGenerator>().SingleInstance();
builder.RegisterType<SetupBackgroundService>().As<IBackgroundService>().InstancePerLifetimeScope();
// setup mode specific implementations of needed service interfaces
builder.RegisterType<SafeModeThemeService>().As<IThemeManager>().InstancePerLifetimeScope();
@@ -100,6 +100,12 @@ namespace Orchard.Setup {
}
internal class SetupBackgroundService : IBackgroundService {
public void Sweep() {
// Don't run any background service in setup mode.
}
}
class SafeModeText : IText {
public LocalizedString Get(string textHint, params object[] args) {
if (args == null || args.Length == 0) {

View File

@@ -22,7 +22,7 @@ namespace Orchard.Taxonomies.Drivers {
public IOrchardServices Services { get; set; }
public TaxonomyFieldDriver(
IOrchardServices services,
IOrchardServices services,
ITaxonomyService taxonomyService,
IRepository<TermContentItem> repository) {
_taxonomyService = taxonomyService;
@@ -81,8 +81,10 @@ namespace Orchard.Taxonomies.Drivers {
}
protected override DriverResult Editor(ContentPart part, TaxonomyField field, IUpdateModel updater, dynamic shapeHelper) {
var viewModel = new TaxonomyFieldViewModel { Terms = new List<TermEntry>() };
// Initializing viewmodel using the terms that are already selected to prevent loosing them when updating an editor group this field isn't displayed in.
var viewModel = new TaxonomyFieldViewModel { Terms = field.Terms.Select(t => t.CreateTermEntry()).ToList() };
foreach (var item in viewModel.Terms) item.IsChecked = true;
if (updater.TryUpdateModel(viewModel, GetPrefix(field, part), null, null)) {
var checkedTerms = viewModel.Terms
.Where(t => (t.IsChecked || t.Id == viewModel.SingleTermId))
@@ -128,9 +130,9 @@ namespace Orchard.Taxonomies.Drivers {
private TermPart GetOrCreateTerm(TermEntry entry, int taxonomyId, TaxonomyField field) {
var term = default(TermPart);
if (entry.Id > 0)
term = _taxonomyService.GetTerm(entry.Id);
if (entry.Id > 0)
term = _taxonomyService.GetTerm(entry.Id);
//Prevents creation of existing term
if (term == null && !string.IsNullOrEmpty(entry.Name))
term = _taxonomyService.GetTermByName(taxonomyId, entry.Name.Trim());

View File

@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Security.Authentication;
using System.Security.Cryptography.X509Certificates;
using System.Web;
using System.Web.Mvc;
@@ -223,6 +224,15 @@ namespace Orchard.Workflows.Controllers {
}
}
public JsonResult State(int? id) {
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to edit workflows")))
throw new AuthenticationException("");
var workflowDefinitionRecord = id.HasValue ? _workflowDefinitionRecords.Get(id.Value) : null;
var isRunning = workflowDefinitionRecord != null && workflowDefinitionRecord.WorkflowRecords.Any();
return Json(new { isRunning = isRunning }, JsonRequestBehavior.AllowGet);
}
public ActionResult Edit(int id, string localId, int? workflowId) {
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to edit workflows")))
return new HttpUnauthorizedResult();
@@ -329,6 +339,7 @@ namespace Orchard.Workflows.Controllers {
var activitiesIndex = new Dictionary<string, ActivityRecord>();
workflowDefinitionRecord.ActivityRecords.Clear();
workflowDefinitionRecord.WorkflowRecords.Clear();
foreach (var activity in state.Activities) {
ActivityRecord activityRecord;

View File

@@ -42,6 +42,7 @@
//<![CDATA[
var renderActivityUrl = '@HttpUtility.JavaScriptStringEncode(Url.Action("RenderActivity", "Admin", new { area = "Orchard.Workflows" }))';
var editActivityUrl = '@HttpUtility.JavaScriptStringEncode(Url.Action("EditActivity", "Admin", new { area = "Orchard.Workflows" }))';
var stateUrl = '@HttpUtility.JavaScriptStringEncode(Url.Action("State", "Admin", new { area = "Orchard.Workflows" }))';
var requestAntiForgeryToken = '@HttpUtility.JavaScriptStringEncode(Html.AntiForgeryTokenValueOrchard().ToString())';
var localId = '@HttpUtility.JavaScriptStringEncode(Model.LocalId)';
var updatedActivityClientId = null;
@@ -73,6 +74,7 @@
@Html.Hidden("data", String.Empty)
@Html.Hidden("confirm-delete-activity", T("Are you sure you want to remove this activity?"))
@Html.Hidden("confirm-delete-instances", T("Are you sure you want to remove running instances of this workflow?"))
using (Script.Foot()) {
<script type="text/javascript">
@@ -82,6 +84,16 @@
var workflow = loadWorkflow(localId);
var data = JSON.stringify(workflow);
$("[name='data']").val(data);
$.ajax({
url: stateUrl + "/" + $("#id").val(),
async: false,
success: function(state) {
if(state.isRunning && !confirm($("#confirm-delete-instances").val())) {
e.preventDefault();
}
}
});
});
//]]>
</script>
@@ -100,4 +112,4 @@
@using (Capture(Layout.Messages)) {
<div id="save-message" class="message message-Warning" style="display:none">@T("You need to hit \"Save\" in order to save your changes.")</div>
<div id="start-message" class="message message-Warning" style="display:none">@T("The workflow needs at least one activity to be set as a starting state.")</div>
}
}

View File

@@ -91,7 +91,7 @@ namespace Orchard.Data.Migration.Interpreters {
RunPendingStatements();
}
private string PrefixTableName(string tableName) {
public string PrefixTableName(string tableName) {
if (string.IsNullOrEmpty(_shellSettings.DataTablePrefix))
return tableName;
return _shellSettings.DataTablePrefix + "_" + tableName;

View File

@@ -9,5 +9,6 @@ namespace Orchard.Data.Migration.Interpreters {
void Visit(SqlStatementCommand command);
void Visit(CreateForeignKeyCommand command);
void Visit(DropForeignKeyCommand command);
string PrefixTableName(string tableName);
}
}

View File

@@ -28,6 +28,13 @@ namespace Orchard.Data.Migration.Schema {
public Func<string, string> FormatPrefix {
get { return _formatPrefix; }
}
/// <summary>
/// Translate Table name into database table name - including prefixes
/// </summary>
public virtual string TableDbName(string srcTable) {
return _interpreter.PrefixTableName(String.Concat(FormatPrefix(FeaturePrefix), srcTable));
}
public SchemaBuilder CreateTable(string name, Action<CreateTableCommand> table) {
var createTable = new CreateTableCommand(String.Concat(_formatPrefix(_featurePrefix), name));

View File

@@ -7,11 +7,20 @@ using Orchard.Utility.Extensions;
namespace Orchard.Mvc.Html {
public static class ContentItemExtensions {
public static MvcHtmlString ItemDisplayText(this HtmlHelper html, IContent content) {
return ItemDisplayText(html, content, true);
}
public static MvcHtmlString ItemDisplayText(this HtmlHelper html, IContent content, bool encode) {
var metadata = content.ContentItem.ContentManager.GetItemMetadata(content);
if (metadata.DisplayText == null)
return null;
return MvcHtmlString.Create(html.Encode(metadata.DisplayText));
if (encode) {
return MvcHtmlString.Create(html.Encode(metadata.DisplayText));
} else {
return MvcHtmlString.Create(metadata.DisplayText);
}
}
public static MvcHtmlString ItemDisplayLink(this HtmlHelper html, IContent content) {

View File

@@ -1,5 +1,4 @@
using System;
using System.Web;
using System.Web;
using Autofac;
namespace Orchard.Mvc {

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using Orchard.Data;
using Orchard.Environment.Configuration;
using Orchard.Logging;
using Orchard.ContentManagement;
namespace Orchard.Tasks {
@@ -18,7 +17,7 @@ namespace Orchard.Tasks {
public BackgroundService(
IEnumerable<IBackgroundTask> tasks,
ITransactionManager transactionManager,
ITransactionManager transactionManager,
ShellSettings shellSettings) {
_tasks = tasks;