mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using Futures.Widgets.Models;
|
||||
using Futures.Widgets.ViewModels;
|
||||
using Orchard;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Settings;
|
||||
|
||||
namespace Futures.Widgets.Controllers {
|
||||
[ValidateInput(false)]
|
||||
public class AdminController : Controller, IUpdateModel {
|
||||
public AdminController(IOrchardServices services) {
|
||||
Services = services;
|
||||
}
|
||||
|
||||
private IOrchardServices Services { get; set; }
|
||||
protected virtual ISite CurrentSite { get; set; }
|
||||
|
||||
public ActionResult AddWidget() {
|
||||
var hasWidgetsRecord = CurrentSite.As<HasWidgets>().Record;
|
||||
|
||||
var widget = Services.ContentManager.Create<Widget>("HtmlWidget", init => {
|
||||
init.Record.Scope = hasWidgetsRecord;
|
||||
init.Record.Zone = "content";
|
||||
init.Record.Position = "after";
|
||||
init.As<BodyAspect>().Text = "Hello world!";
|
||||
});
|
||||
|
||||
return RedirectToAction("Edit", new {widget.ContentItem.Id });
|
||||
}
|
||||
|
||||
public ActionResult Edit(int id, string returnUrl) {
|
||||
var widget = Services.ContentManager.Get(id);
|
||||
var viewModel = new WidgetEditViewModel {
|
||||
Widget = Services.ContentManager.BuildEditorModel(widget),
|
||||
ReturnUrl = returnUrl,
|
||||
};
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
public ActionResult EditPOST(int id, string returnUrl) {
|
||||
var widget = Services.ContentManager.Get(id);
|
||||
var viewModel = new WidgetEditViewModel {
|
||||
Widget = Services.ContentManager.UpdateEditorModel(widget, this),
|
||||
ReturnUrl = returnUrl,
|
||||
};
|
||||
if (ModelState.IsValid == false) {
|
||||
return View(viewModel);
|
||||
}
|
||||
if (string.IsNullOrEmpty(returnUrl)) {
|
||||
return RedirectToAction("Edit", new { id });
|
||||
}
|
||||
return Redirect(returnUrl);
|
||||
}
|
||||
|
||||
|
||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||
return TryUpdateModel(model, prefix, includeProperties, excludeProperties);
|
||||
}
|
||||
|
||||
void IUpdateModel.AddModelError(string key, LocalizedString errorMessage) {
|
||||
ModelState.AddModelError(key, errorMessage.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System.Web.Routing;
|
||||
using Futures.Widgets.Models;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
|
||||
namespace Futures.Widgets.Controllers {
|
||||
public class WidgetDriver : ContentItemDriver<Widget> {
|
||||
protected override RouteValueDictionary GetEditorRouteValues(Widget item) {
|
||||
return new RouteValueDictionary {
|
||||
{"Area", "Futures.Widgets"},
|
||||
{"Controller", "Admin"},
|
||||
{"Action", "Edit"},
|
||||
{"Id", item.ContentItem.Id}
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool UseDefaultTemplate {
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
using System.Linq;
|
||||
using System.Web.Routing;
|
||||
using Futures.Widgets.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Data;
|
||||
|
||||
namespace Futures.Widgets.Controllers {
|
||||
public class WidgetHandler : ContentHandler {
|
||||
public WidgetHandler(
|
||||
IRepository<HasWidgetsRecord> hasWidgetRepository,
|
||||
IRepository<WidgetRecord> widgetRepository) {
|
||||
|
||||
// marking the "site" content type as a widget container
|
||||
Filters.Add(new ActivatingFilter<HasWidgets>("site"));
|
||||
|
||||
// adding parts to the "HtmlWidget" content type
|
||||
Filters.Add(new ActivatingFilter<Widget>("HtmlWidget"));
|
||||
Filters.Add(new ActivatingFilter<BodyAspect>("HtmlWidget"));
|
||||
|
||||
// providing standard storage support for widget records
|
||||
Filters.Add(StorageFilter.For(hasWidgetRepository));
|
||||
Filters.Add(StorageFilter.For(widgetRepository));
|
||||
|
||||
OnLoaded<HasWidgets>(
|
||||
(ctx, part) => part.WidgetField.Loader(
|
||||
() => ctx.ContentManager
|
||||
.Query<Widget, WidgetRecord>()
|
||||
.Where(x => x.Scope == part.Record)
|
||||
.List().ToList()));
|
||||
}
|
||||
}
|
||||
|
||||
public class WidgetDriver : ContentItemDriver<Widget> {
|
||||
protected override RouteValueDictionary GetEditorRouteValues(Widget item) {
|
||||
return new RouteValueDictionary {
|
||||
{"Area", "Futures.Widgets"},
|
||||
{"Controller", "Admin"},
|
||||
{"Action", "Edit"},
|
||||
{"Id", item.ContentItem.Id}
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool UseDefaultTemplate {
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
118
src/Orchard.Web/Modules/Futures.Widgets/Futures.Widgets.csproj
Normal file
118
src/Orchard.Web/Modules/Futures.Widgets/Futures.Widgets.csproj
Normal file
@@ -0,0 +1,118 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{E65E5633-C0FF-453C-A906-481C14F969D6}</ProjectGuid>
|
||||
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Futures.Widgets</RootNamespace>
|
||||
<AssemblyName>Futures.Widgets</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<MvcBuildViews>false</MvcBuildViews>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Controllers\WidgetHandler.cs" />
|
||||
<Compile Include="Models\HasWidgets.cs" />
|
||||
<Compile Include="Models\Widget.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ViewModels\WidgetEditViewModel.cs" />
|
||||
<Compile Include="WidgetFilter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
<Content Include="Views\Admin\Edit.ascx" />
|
||||
<Content Include="Web.config" />
|
||||
<Content Include="Views\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\Orchard\Orchard.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- 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)" />
|
||||
</Target>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>17593</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>True</UseCustomServer>
|
||||
<CustomServerUrl>http://orchard.codeplex.com</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
14
src/Orchard.Web/Modules/Futures.Widgets/Models/HasWidgets.cs
Normal file
14
src/Orchard.Web/Modules/Futures.Widgets/Models/HasWidgets.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Core.Common.Utilities;
|
||||
|
||||
namespace Futures.Widgets.Models {
|
||||
public class HasWidgets : ContentPart<HasWidgetsRecord> {
|
||||
public LazyField<IList<Widget>> WidgetField = new LazyField<IList<Widget>>();
|
||||
public IList<Widget> Widgets { get { return WidgetField.Value; } set { WidgetField.Value = value; } }
|
||||
}
|
||||
|
||||
public class HasWidgetsRecord : ContentPartRecord {
|
||||
}
|
||||
}
|
||||
13
src/Orchard.Web/Modules/Futures.Widgets/Models/Widget.cs
Normal file
13
src/Orchard.Web/Modules/Futures.Widgets/Models/Widget.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Futures.Widgets.Models {
|
||||
public class Widget : ContentPart<WidgetRecord> {
|
||||
}
|
||||
|
||||
public class WidgetRecord : ContentPartRecord {
|
||||
public virtual HasWidgetsRecord Scope { get; set; }
|
||||
public virtual string Zone { get; set; }
|
||||
public virtual string Position { get; set; }
|
||||
}
|
||||
}
|
||||
1
src/Orchard.Web/Modules/Futures.Widgets/Module.txt
Normal file
1
src/Orchard.Web/Modules/Futures.Widgets/Module.txt
Normal file
@@ -0,0 +1 @@
|
||||
name: Widgets
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Futures.Widgets")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft IT")]
|
||||
[assembly: AssemblyProduct("Futures.Widgets")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft IT 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("8c179868-e814-4277-a0af-b71707c3bff4")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
@@ -0,0 +1,8 @@
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Futures.Widgets.ViewModels {
|
||||
public class WidgetEditViewModel : BaseViewModel {
|
||||
public ContentItemViewModel Widget { get; set; }
|
||||
public string ReturnUrl { get; set;}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<WidgetEditViewModel>" %>
|
||||
<%@ Import Namespace="Futures.Widgets.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||
<h1><%=Html.TitleForPage(T("Edit Widget").ToString()) %></h1>
|
||||
<% using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%= Html.ValidationSummary() %>
|
||||
<%= Html.EditorForItem(m => m.Widget) %>
|
||||
<fieldset>
|
||||
<%= Html.HiddenFor(m => m.ReturnUrl) %>
|
||||
<input class="button primaryAction" type="submit" name="submit.Save" value="Save"/>
|
||||
</fieldset>
|
||||
<%} %>
|
||||
34
src/Orchard.Web/Modules/Futures.Widgets/Views/Web.config
Normal file
34
src/Orchard.Web/Modules/Futures.Widgets/Views/Web.config
Normal file
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add path="*" verb="*"
|
||||
type="System.Web.HttpNotFoundHandler"/>
|
||||
</httpHandlers>
|
||||
|
||||
<!--
|
||||
Enabling request validation in view pages would cause validation to occur
|
||||
after the input has already been processed by the controller. By default
|
||||
MVC performs request validation before a controller processes the input.
|
||||
To change this behavior apply the ValidateInputAttribute to a
|
||||
controller or action.
|
||||
-->
|
||||
<pages
|
||||
validateRequest="false"
|
||||
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
|
||||
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<controls>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
|
||||
</controls>
|
||||
</pages>
|
||||
</system.web>
|
||||
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<handlers>
|
||||
<remove name="BlockViewHandler"/>
|
||||
<add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
154
src/Orchard.Web/Modules/Futures.Widgets/Web.config
Normal file
154
src/Orchard.Web/Modules/Futures.Widgets/Web.config
Normal file
@@ -0,0 +1,154 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Note: As an alternative to hand editing this file you can use the
|
||||
web admin tool to configure settings for your application. Use
|
||||
the Website->Asp.Net Configuration option in Visual Studio.
|
||||
A full list of settings and comments can be found in
|
||||
machine.config.comments usually located in
|
||||
\Windows\Microsoft.Net\Framework\v2.x\Config
|
||||
-->
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
|
||||
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
|
||||
<system.web>
|
||||
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
symbols into the compiled page. Because this
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation debug="true">
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
|
||||
</assemblies>
|
||||
</compilation>
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
The <customErrors> section enables configuration
|
||||
of what to do if/when an unhandled error occurs
|
||||
during the execution of a request. Specifically,
|
||||
it enables developers to configure html error pages
|
||||
to be displayed in place of a error stack trace.
|
||||
|
||||
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
|
||||
<error statusCode="403" redirect="NoAccess.htm" />
|
||||
<error statusCode="404" redirect="FileNotFound.htm" />
|
||||
</customErrors>
|
||||
-->
|
||||
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</controls>
|
||||
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html" />
|
||||
</namespaces>
|
||||
</pages>
|
||||
|
||||
<httpHandlers>
|
||||
<remove verb="*" path="*.asmx"/>
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</httpHandlers>
|
||||
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</httpModules>
|
||||
|
||||
</system.web>
|
||||
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4"
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="OptionInfer" value="true"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
|
||||
<system.web.extensions/>
|
||||
|
||||
<!--
|
||||
The system.webServer section is required for running ASP.NET AJAX under Internet
|
||||
Information Services 7.0. It is not necessary for previous version of IIS.
|
||||
-->
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
<remove name="ScriptModule" />
|
||||
<remove name="UrlRoutingModule" />
|
||||
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</modules>
|
||||
|
||||
<handlers>
|
||||
<remove name="WebServiceHandlerFactory-Integrated"/>
|
||||
<remove name="ScriptHandlerFactory" />
|
||||
<remove name="ScriptHandlerFactoryAppServices" />
|
||||
<remove name="ScriptResource" />
|
||||
<remove name="MvcHttpHandler" />
|
||||
<remove name="UrlRoutingHandler" />
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd" type="System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
</configuration>
|
||||
43
src/Orchard.Web/Modules/Futures.Widgets/WidgetFilter.cs
Normal file
43
src/Orchard.Web/Modules/Futures.Widgets/WidgetFilter.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Futures.Widgets.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Mvc.Filters;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Settings;
|
||||
using Orchard.UI.Admin;
|
||||
|
||||
namespace Futures.Widgets {
|
||||
public class WidgetFilter : FilterProvider, IActionFilter {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public WidgetFilter(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
}
|
||||
|
||||
public virtual ISite CurrentSite { get; set; }
|
||||
|
||||
public void OnActionExecuting(ActionExecutingContext filterContext) {
|
||||
}
|
||||
|
||||
public void OnActionExecuted(ActionExecutedContext filterContext) {
|
||||
var model = BaseViewModel.From(filterContext.Result);
|
||||
if (model == null || AdminFilter.IsApplied(filterContext.RequestContext)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var siteWidgets = CurrentSite.As<HasWidgets>();
|
||||
if (siteWidgets == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var zones = model.Zones;
|
||||
foreach (var widget in siteWidgets.Widgets) {
|
||||
zones.AddDisplayItem(
|
||||
widget.Record.Zone + ":" + widget.Record.Position,
|
||||
_contentManager.BuildDisplayModel(widget, "Widget"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ShowDebugLink>" %>
|
||||
<%@ Import Namespace="Orchard.DevTools.Models" %>
|
||||
<div class="debug message"><%=T(
|
||||
"DevTools: editing {0}",
|
||||
"DevTools: displaying {0}",
|
||||
Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.DevTools", Model.ContentItem.Id, Model.ContentItem.Version }, new { })
|
||||
) %></div>
|
||||
|
||||
@@ -8,6 +8,7 @@ using Orchard.Core.Settings.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Extensions;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Setup.ViewModels;
|
||||
@@ -101,7 +102,11 @@ namespace Orchard.Setup.Controllers {
|
||||
themeService.SetSiteTheme("Classic");
|
||||
|
||||
var contentManager = finiteEnvironment.Resolve<IContentManager>();
|
||||
|
||||
|
||||
// simulate installation-time module activation events
|
||||
var hackInstallationGenerator = finiteEnvironment.Resolve<IHackInstallationGenerator>();
|
||||
hackInstallationGenerator.GenerateInstallEvents();
|
||||
|
||||
// create home page as a CMS page
|
||||
var page = contentManager.Create("page", VersionOptions.Draft);
|
||||
page.As<BodyAspect>().Text = "<p>Welcome to Orchard!</p><p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"Admin/Pages/Edit/3\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site. We have installed a few themes already, but you'll also be able to browse through an online gallery of themes created by other users of Orchard.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" >
|
||||
<head>
|
||||
<title>{#addmedia_dlg.title}</title>
|
||||
<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
|
||||
<script type="text/javascript" src="js/addmedia.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<form action="/Admin/Media/Add" enctype="multipart/form-data" method="post">
|
||||
<div class="tabs">
|
||||
<ul>
|
||||
<li id="general_tab" class="current"><span><a href="#general_tab">{#addmedia_dlg.title}</a></span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="panel_wrapper">
|
||||
<table border="0" cellpadding="4" cellspacing="0">
|
||||
<tr>
|
||||
<td class="nowrap"><label for="pageTitle">{#addmedia_dlg.path_label}</label></td>
|
||||
<td><input id="MediaItemPath" name="MediaItemPath" type="file" class="text" value="Browse" size="64"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="hidden" id="FolderName" name="FolderName" value="foo" />
|
||||
<input type="hidden" id="MediaPath" name="MediaPath" value="foo" />
|
||||
</div>
|
||||
<div class="mceActionPanel">
|
||||
<div style="float:left">
|
||||
<input name="__RequestVerificationToken" type="hidden" value="7lDAM51YOmke7sRNx/GFjVMKaPf8QZNh7qZiEdQyNQXKKbw1DYehU/g6jNcAx6I3OGD/KDuaNlmyNIeQ/69CFpDizom9bROgo5keYyj+HcAKHtjQTRV5kNJm6SztNLwO" />
|
||||
<input type="submit" name="insert" value="{#insert}" id="insert" />
|
||||
</div>
|
||||
<div style="float:right">
|
||||
<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,68 @@
|
||||
(function() {
|
||||
// Load plugin specific language pack
|
||||
tinymce.PluginManager.requireLangPack('dlg');
|
||||
|
||||
tinymce.create('tinymce.plugins.Orchard.AddMedia', {
|
||||
/**
|
||||
* Initializes the plugin, this will be executed after the plugin has been created.
|
||||
* This call is done before the editor instance has finished it's initialization so use the onInit event
|
||||
* of the editor instance to intercept that event.
|
||||
*
|
||||
* @param {tinymce.Editor} ed Editor instance that the plugin is initialized in.
|
||||
* @param {string} url Absolute URL to where the plugin is located.
|
||||
*/
|
||||
init: function(ed, url) {
|
||||
// Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample');
|
||||
ed.addCommand('mceAddMedia', function() {
|
||||
ed.windowManager.open({
|
||||
file: url + '/addmedia.htm',
|
||||
width: 480 + parseInt(ed.getLang('addmedia.delta_width', 0)),
|
||||
height: 110 + parseInt(ed.getLang('addmedia.delta_height', 0)),
|
||||
inline: 1
|
||||
}, {
|
||||
plugin_url: url, // Plugin absolute URL
|
||||
});
|
||||
});
|
||||
|
||||
// Register example button
|
||||
ed.addButton('addmedia', {
|
||||
title: 'addmedia_desc',
|
||||
cmd: 'mceAddMedia',
|
||||
image: url + '/img/picture_add.png'
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates control instances based in the incomming name. This method is normally not
|
||||
* needed since the addButton method of the tinymce.Editor class is a more easy way of adding buttons
|
||||
* but you sometimes need to create more complex controls like listboxes, split buttons etc then this
|
||||
* method can be used to create those.
|
||||
*
|
||||
* @param {String} n Name of the control to create.
|
||||
* @param {tinymce.ControlManager} cm Control manager to use inorder to create new control.
|
||||
* @return {tinymce.ui.Control} New control instance or null if no control was created.
|
||||
*/
|
||||
createControl: function(n, cm) {
|
||||
return null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns information about the plugin as a name/value array.
|
||||
* The current keys are longname, author, authorurl, infourl and version.
|
||||
*
|
||||
* @return {Object} Name/value array containing information about the plugin.
|
||||
*/
|
||||
getInfo: function() {
|
||||
return {
|
||||
longname: 'Orchard AddMedia Plugin',
|
||||
author: 'Nathan Heskew',
|
||||
authorurl: 'http://orchardproject.net',
|
||||
infourl: 'http://orchardproject.net',
|
||||
version: '0.1'
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Register plugin
|
||||
tinymce.PluginManager.add('addmedia', tinymce.plugins.Orchard.AddMedia);
|
||||
})();
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 750 B |
@@ -0,0 +1 @@
|
||||
tinyMCEPopup.requireLangPack();
|
||||
@@ -0,0 +1,4 @@
|
||||
tinyMCE.addI18n('en.addmedia_dlg',{
|
||||
title:"Add Media",
|
||||
path_label:"Media File Path"
|
||||
});
|
||||
@@ -135,6 +135,17 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Scripts\plugins\addmedia\addmedia.htm" />
|
||||
<Content Include="Scripts\plugins\addmedia\editor_plugin.js" />
|
||||
<Content Include="Scripts\plugins\addmedia\img\picture_add.png" />
|
||||
<Content Include="Scripts\plugins\addmedia\js\addmedia.js" />
|
||||
<Content Include="Scripts\plugins\addmedia\langs\en_dlg.js" />
|
||||
<Content Include="Scripts\plugins\searchreplace\css\searchreplace.css" />
|
||||
<Content Include="Scripts\plugins\searchreplace\editor_plugin.js" />
|
||||
<Content Include="Scripts\plugins\searchreplace\editor_plugin_src.js" />
|
||||
<Content Include="Scripts\plugins\searchreplace\js\searchreplace.js" />
|
||||
<Content Include="Scripts\plugins\searchreplace\langs\en_dlg.js" />
|
||||
<Content Include="Scripts\plugins\searchreplace\searchreplace.htm" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
theme: "advanced",
|
||||
mode: "specific_textareas",
|
||||
editor_selector: "html",
|
||||
plugins: "fullscreen,autoresize,searchreplace",
|
||||
plugins: "fullscreen,autoresize,searchreplace,addmedia",
|
||||
theme_advanced_toolbar_location: "top",
|
||||
theme_advanced_toolbar_align: "left",
|
||||
theme_advanced_buttons1: "search,replace,|,cut,copy,paste,|,undo,redo,|,image,|,link,unlink,charmap,emoticon,codeblock,|,bold,italic,|,numlist,bullist,formatselect,|,code,fullscreen",
|
||||
theme_advanced_buttons1: "search,replace,|,cut,copy,paste,|,undo,redo,|,image,addmedia,|,link,unlink,charmap,emoticon,codeblock,|,bold,italic,|,numlist,bullist,formatselect,|,code,fullscreen",
|
||||
theme_advanced_buttons2: "",
|
||||
theme_advanced_buttons3: ""
|
||||
});
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{50B779EA-EC00-4699-84C0-03B395C365D2}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<ProjectTypeGuids>{F85E285D-A4E0-4152-9332-AB1D724D3325};{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Orchard.Web</RootNamespace>
|
||||
@@ -102,6 +102,10 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="Modules\Futures.Widgets\Futures.Widgets.csproj">
|
||||
<Project>{E65E5633-C0FF-453C-A906-481C14F969D6}</Project>
|
||||
<Name>Futures.Widgets</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="Modules\Orchard.Blogs\Orchard.Blogs.csproj">
|
||||
<Project>{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}</Project>
|
||||
<Name>Orchard.Blogs</Name>
|
||||
@@ -174,6 +178,7 @@
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Items\Blogs.BlogPost.Summary.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Themes\Classic\Views\Footer.ascx" />
|
||||
<Content Include="Themes\Classic\Views\Layout.ascx" />
|
||||
@@ -191,6 +196,7 @@
|
||||
<Content Include="Themes\Green\Styles\yui.css" />
|
||||
<Content Include="Themes\Green\Theme.png" />
|
||||
<Content Include="Themes\Green\Theme.txt" />
|
||||
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Themes\Green\Views\Layout.HomePage.ascx" />
|
||||
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
|
||||
<Content Include="Themes\Green\Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<Orchard.Pages.Models.Page>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<h1><%=Html.TitleForPage(Model.Item.Title)%></h1>
|
||||
<% Html.Zone("primary");
|
||||
Html.ZonesAny(); %>
|
||||
@@ -0,0 +1,6 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentItemViewModel<Orchard.Pages.Models.Page>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<h1><%=Html.TitleForPage(Model.Item.Title)%></h1>
|
||||
<% Html.Zone("primary");
|
||||
Html.ZonesAny(); %>
|
||||
@@ -47,6 +47,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuild.Orchard.Tasks", "To
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MSBuild.Orchard.Tasks.Tests", "Tools\MSBuild.Orchard.Tasks.Tests\MSBuild.Orchard.Tasks.Tests.csproj", "{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Futures", "Futures", "{E75A4CE4-CAA6-41E4-B951-33ACC60DC77C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Futures.Widgets", "Orchard.Web\Modules\Futures.Widgets\Futures.Widgets.csproj", "{E65E5633-C0FF-453C-A906-481C14F969D6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -133,6 +137,10 @@ Global
|
||||
{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -155,5 +163,6 @@ Global
|
||||
{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{5E5E7A21-C7B2-44D8-8593-2F9541AE041D} = {383DBA32-4A3E-48D1-AAC3-75377A694452}
|
||||
{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56} = {383DBA32-4A3E-48D1-AAC3-75377A694452}
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6} = {E75A4CE4-CAA6-41E4-B951-33ACC60DC77C}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Orchard.Data {
|
||||
public ISessionFactory GetSessionFactory() {
|
||||
lock (this) {
|
||||
if (_sessionFactory == null) {
|
||||
_sessionFactory = BuildSessionFactory(false /*createDatabase*/, false /*updateSchema*/);
|
||||
_sessionFactory = BuildSessionFactory(false /*createDatabase*/, true /*updateSchema*/);
|
||||
}
|
||||
}
|
||||
return _sessionFactory;
|
||||
|
||||
@@ -75,9 +75,6 @@ namespace Orchard.Environment {
|
||||
shell.Activate();
|
||||
_current = shell;
|
||||
|
||||
// Fire off one-time install events on an alternate container
|
||||
HackInstallSimulation();
|
||||
|
||||
// Activate extensions inside shell container
|
||||
HackSimulateExtensionActivation(shellContainer);
|
||||
}
|
||||
@@ -119,22 +116,6 @@ namespace Orchard.Environment {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void HackInstallSimulation() {
|
||||
var tempContainer = CreateShellContainer();
|
||||
var containerProvider = new FiniteContainerProvider(tempContainer);
|
||||
try {
|
||||
var requestContainer = containerProvider.RequestContainer;
|
||||
|
||||
var hackInstallationGenerator = requestContainer.Resolve<IHackInstallationGenerator>();
|
||||
hackInstallationGenerator.GenerateInstallEvents();
|
||||
}
|
||||
finally {
|
||||
// shut everything down again
|
||||
containerProvider.DisposeRequestContainer();
|
||||
tempContainer.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
private void HackSimulateExtensionActivation(IContainer shellContainer) {
|
||||
var containerProvider = new FiniteContainerProvider(shellContainer);
|
||||
try {
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace Orchard.Mvc.AntiForgery {
|
||||
}
|
||||
|
||||
public void OnAuthorization(AuthorizationContext filterContext) {
|
||||
#if false
|
||||
if ((filterContext.HttpContext.Request.HttpMethod != "POST" ||
|
||||
_authenticationService.GetAuthenticatedUser() == null) && !ShouldValidateGet(filterContext)) {
|
||||
return;
|
||||
@@ -29,6 +30,7 @@ namespace Orchard.Mvc.AntiForgery {
|
||||
|
||||
if (filterContext.HttpContext is HackHttpContext)
|
||||
filterContext.HttpContext = ((HackHttpContext)filterContext.HttpContext).OriginalHttpContextBase;
|
||||
#endif
|
||||
}
|
||||
|
||||
private static bool ShouldValidateGet(AuthorizationContext context) {
|
||||
|
||||
@@ -8,6 +8,7 @@ using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Extensions;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Services;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Utility;
|
||||
@@ -297,5 +298,38 @@ namespace Orchard.Mvc.Html {
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region AddRenderAction
|
||||
|
||||
public static void AddRenderAction(this HtmlHelper html, string location, string actionName) {
|
||||
AddRenderActionHelper(html, location, actionName, null/*controllerName*/, null);
|
||||
}
|
||||
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, object routeValues) {
|
||||
AddRenderActionHelper(html, location, actionName, null/*controllerName*/, new RouteValueDictionary(routeValues));
|
||||
}
|
||||
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, RouteValueDictionary routeValues) {
|
||||
AddRenderActionHelper(html, location, actionName, null/*controllerName*/, routeValues);
|
||||
}
|
||||
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, string controllerName) {
|
||||
AddRenderActionHelper(html, location, actionName, controllerName, null/*RouteValueDictionary*/);
|
||||
}
|
||||
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, string controllerName, object routeValues) {
|
||||
AddRenderActionHelper(html, location, actionName, controllerName, new RouteValueDictionary(routeValues));
|
||||
}
|
||||
public static void AddRenderAction(this HtmlHelper html, string location, string actionName, string controllerName, RouteValueDictionary routeValues) {
|
||||
AddRenderActionHelper(html, location, actionName, controllerName, routeValues);
|
||||
}
|
||||
|
||||
private static void AddRenderActionHelper(this HtmlHelper html, string location, string actionName, string controllerName, RouteValueDictionary routeValues) {
|
||||
// Retrieve the "BaseViewModel" for zones if we have one
|
||||
var baseViewModel = BaseViewModel.From(html.ViewData);
|
||||
if (baseViewModel == null)
|
||||
return;
|
||||
|
||||
baseViewModel.Zones.AddRenderAction(location, actionName, controllerName, routeValues);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,9 @@
|
||||
<Compile Include="UI\Zones\IZoneManager.cs" />
|
||||
<Compile Include="UI\Zones\ContentPartDisplayZoneItem.cs" />
|
||||
<Compile Include="UI\Zones\ContentPartEditorZoneItem.cs" />
|
||||
<Compile Include="UI\Zones\RenderActionZoneItem.cs" />
|
||||
<Compile Include="UI\Zones\RenderPartialZoneItem.cs" />
|
||||
<Compile Include="UI\Zones\RenderStaticZoneItem.cs" />
|
||||
<Compile Include="UI\Zones\ZoneCollection.cs" />
|
||||
<Compile Include="UI\Zones\ZoneEntry.cs" />
|
||||
<Compile Include="UI\Zones\ZoneItem.cs" />
|
||||
|
||||
@@ -7,7 +7,8 @@ namespace Orchard.UI.Zones {
|
||||
public ContentItemViewModel ViewModel { get; set; }
|
||||
|
||||
public override void Execute<TModel>(HtmlHelper<TModel> html) {
|
||||
html.DisplayForItem(ViewModel);
|
||||
var htmlString = html.DisplayForItem(ViewModel);
|
||||
html.ViewContext.Writer.Write(htmlString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ namespace Orchard.UI.Zones {
|
||||
public string Prefix { get; set; }
|
||||
|
||||
public override void Execute<TModel>(HtmlHelper<TModel> html) {
|
||||
html.ViewContext.Writer.Write(
|
||||
html.DisplayFor(m => Model, TemplateName, Prefix));
|
||||
var htmlString = html.DisplayFor(m => Model, TemplateName, Prefix);
|
||||
html.ViewContext.Writer.Write(htmlString);
|
||||
}
|
||||
}
|
||||
}
|
||||
15
src/Orchard/UI/Zones/RenderActionZoneItem.cs
Normal file
15
src/Orchard/UI/Zones/RenderActionZoneItem.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
using System.Web.Routing;
|
||||
|
||||
namespace Orchard.UI.Zones {
|
||||
public class RenderActionZoneItem : ZoneItem {
|
||||
public string ActionName { get; set; }
|
||||
public string ControllerName { get; set; }
|
||||
public RouteValueDictionary RouteValues { get; set; }
|
||||
|
||||
public override void Execute<TModel>(HtmlHelper<TModel> html) {
|
||||
html.RenderAction(ActionName, ControllerName, RouteValues);
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/Orchard/UI/Zones/RenderStaticZoneItem.cs
Normal file
13
src/Orchard/UI/Zones/RenderStaticZoneItem.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc.Html;
|
||||
|
||||
namespace Orchard.UI.Zones {
|
||||
public class RenderStaticZoneItem : ZoneItem {
|
||||
public object Model { get; set; }
|
||||
public string TemplateName { get; set; }
|
||||
|
||||
public override void Execute<TModel>(HtmlHelper<TModel> html) {
|
||||
html.RenderPartial(TemplateName, Model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.UI.Zones {
|
||||
@@ -15,6 +16,11 @@ namespace Orchard.UI.Zones {
|
||||
public void AddRenderPartial(string location, string templateName, object model) {
|
||||
AddZoneItem(location, new RenderPartialZoneItem { Model = model, TemplateName = templateName });
|
||||
}
|
||||
|
||||
public void AddRenderStatic(string location, string templateName, object model) {
|
||||
AddZoneItem(location, new RenderStaticZoneItem { Model = model, TemplateName = templateName });
|
||||
}
|
||||
|
||||
public void AddDisplayItem(string location, ContentItemViewModel viewModel) {
|
||||
AddZoneItem(location, new ContentItemDisplayZoneItem { ViewModel = viewModel });
|
||||
}
|
||||
@@ -25,6 +31,25 @@ namespace Orchard.UI.Zones {
|
||||
AddZoneItem(location, new ContentPartEditorZoneItem { Model = model, TemplateName = templateName, Prefix = prefix });
|
||||
}
|
||||
|
||||
public void AddRenderAction(string location, string actionName) {
|
||||
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName });
|
||||
}
|
||||
public void AddRenderAction(string location, string actionName, object routeValues) {
|
||||
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, RouteValues = new RouteValueDictionary(routeValues) });
|
||||
}
|
||||
public void AddRenderAction(string location, string actionName, RouteValueDictionary routeValues) {
|
||||
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, RouteValues = routeValues });
|
||||
}
|
||||
public void AddRenderAction(string location, string actionName, string controllerName) {
|
||||
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, ControllerName = controllerName });
|
||||
}
|
||||
public void AddRenderAction(string location, string actionName, string controllerName, object routeValues) {
|
||||
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, ControllerName = controllerName, RouteValues = new RouteValueDictionary(routeValues) });
|
||||
}
|
||||
public void AddRenderAction(string location, string actionName, string controllerName, RouteValueDictionary routeValues) {
|
||||
AddZoneItem(location, new RenderActionZoneItem { ActionName = actionName, ControllerName = controllerName, RouteValues = routeValues });
|
||||
}
|
||||
|
||||
private void AddZoneItem(string location, ZoneItem item) {
|
||||
string zoneName;
|
||||
var position = string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user