#18655: Removing Orchard.Experimental module

Work Item: 18655

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros 2012-06-26 17:57:18 -07:00
parent 4c18cf4fb3
commit f87d48a324
44 changed files with 0 additions and 1662 deletions

View File

@ -277,7 +277,6 @@
$(StageFolder)\**\Modules\Orchard.CodeGeneration\**;
$(StageFolder)\**\Modules\Orchard.DesignerTools\**;
$(StageFolder)\**\Modules\Orchard.Email\**;
$(StageFolder)\**\Modules\Orchard.Experimental\**;
$(StageFolder)\**\Modules\Orchard.ImportExport\**;
$(StageFolder)\**\Modules\Orchard.Indexing\**;
$(StageFolder)\**\Modules\Orchard.Lists\**;
@ -384,7 +383,6 @@
<Exec Command="&quot;$(GalleryFolder)\bin\Orchard.exe&quot; package create Orchard.CodeGeneration &quot;$(GalleryArtifactFolder)&quot;" WorkingDirectory="$(GalleryFolder)"/>
<Exec Command="&quot;$(GalleryFolder)\bin\Orchard.exe&quot; package create Orchard.DesignerTools &quot;$(GalleryArtifactFolder)&quot;" WorkingDirectory="$(GalleryFolder)"/>
<Exec Command="&quot;$(GalleryFolder)\bin\Orchard.exe&quot; package create Orchard.Email &quot;$(GalleryArtifactFolder)&quot;" WorkingDirectory="$(GalleryFolder)"/>
<Exec Command="&quot;$(GalleryFolder)\bin\Orchard.exe&quot; package create Orchard.Experimental &quot;$(GalleryArtifactFolder)&quot;" WorkingDirectory="$(GalleryFolder)"/>
<Exec Command="&quot;$(GalleryFolder)\bin\Orchard.exe&quot; package create Orchard.ImportExport &quot;$(GalleryArtifactFolder)&quot;" WorkingDirectory="$(GalleryFolder)"/>
<Exec Command="&quot;$(GalleryFolder)\bin\Orchard.exe&quot; package create Orchard.Indexing &quot;$(GalleryArtifactFolder)&quot;" WorkingDirectory="$(GalleryFolder)"/>
<Exec Command="&quot;$(GalleryFolder)\bin\Orchard.exe&quot; package create Orchard.Lists &quot;$(GalleryArtifactFolder)&quot;" WorkingDirectory="$(GalleryFolder)"/>

View File

@ -8,7 +8,6 @@ From the base of the checkout, execute
* the ./orchard.proj creates an orchard web site at ./build/Profiling
* the ./src/Orchard.Profile/profiling-setup-commands.txt holds the additional orchard.exe steps used to initialize
* the ./src/Orchard.Experimental/Commands/ProfilingCommands.cs holds an additional handful of steps to populate items
The localhost:80 web server should be pointed to the ./build/Profiling folder at this point
The "admin" password is "profiling-secret" without quotes

View File

@ -1,16 +0,0 @@
using Orchard.Localization;
using Orchard.UI.Navigation;
namespace Orchard.Experimental {
public class AdminMenu : INavigationProvider {
public string MenuName { get { return "admin"; } }
public Localizer T { get; set; }
public void GetNavigation(NavigationBuilder builder) {
builder.AddImageSet("experimental")
.Add(T("Experimental"), "60",
menu => menu.Add(T("Debug"), "0", item => item.Action("Index", "Home", new { area = "Orchard.Experimental" })));
}
}
}

View File

@ -1,80 +0,0 @@
using Orchard.Commands;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Common.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Core.Navigation.Services;
using Orchard.Environment.Extensions;
using Orchard.Security;
using Orchard.Core.Title.Models;
namespace Orchard.Experimental.Commands {
[OrchardFeature("Profiling")]
public class ProfilingCommands : DefaultOrchardCommandHandler {
private readonly IContentManager _contentManager;
private readonly IMembershipService _membershipService;
private readonly IMenuService _menuService;
public ProfilingCommands(
IContentManager contentManager,
IMembershipService membershipService,
IMenuService menuService) {
_contentManager = contentManager;
_membershipService = membershipService;
_menuService = menuService;
}
[CommandName("add profiling data")]
public void AddProfilingData() {
var admin = _membershipService.GetUser("admin");
var menu = _menuService.Create("Main Menu");
for (var index = 0; index != 5; ++index) {
var pageName = "page" + index;
var page = _contentManager.Create("Page", VersionOptions.Draft);
page.As<ICommonPart>().Owner = admin;
page.As<TitlePart>().Title = pageName;
page.As<BodyPart>().Text = pageName;
page.As<MenuPart>().Menu = menu.ContentItem.Record;
page.As<MenuPart>().MenuPosition = "5." + index;
page.As<MenuPart>().MenuText = pageName;
_contentManager.Publish(page);
var blogName = "blog" + index;
var blog = _contentManager.New("Blog");
blog.As<ICommonPart>().Owner = admin;
blog.As<TitlePart>().Title = blogName;
page.As<MenuPart>().Menu = menu.ContentItem.Record;
blog.As<MenuPart>().MenuPosition = "6." + index;
blog.As<MenuPart>().MenuText = blogName;
_contentManager.Create(blog);
// "BlogPost" content type can't be created w/out http context at the moment
//for (var index2 = 0; index2 != 5; ++index2) {
// var postName = "post" + index;
// var post = _contentManager.New("BlogPost");
// post.As<ICommonPart>().Owner = admin;
// post.As<ICommonPart>().Container = blog;
// post.As<RoutableAspect>().Slug = postName;
// post.As<RoutableAspect>().Title = postName;
// post.As<BodyPart>().Text = postName;
// _contentManager.Create(post);
//}
}
Context.Output.WriteLine(T("Finished adding profiling data"));
}
[CommandName("add users")]
public void AddUsers() {
for (int i = 0; i < 1000; i++) {
var user = _membershipService.CreateUser(new CreateUserParams("user" + i, "1234567", "user" + i + "@orchardproject.net", null, null, true));
if (user == null) {
Context.Output.WriteLine(T("Creating user failed. The authentication provider returned an error. Aborting..."));
return;
}
}
Context.Output.WriteLine(T("Adding users completed successfully"));
}
}
}

View File

@ -1,308 +0,0 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using Autofac;
using Autofac.Core;
namespace Orchard.Experimental {
// note - not thread aware
public interface IContainerSpyOutput {
void Write(XElement target);
}
public class ContainerSpy : Module, IDependency {
private readonly ConcurrentDictionary<int, ThreadContext> _contexts = new ConcurrentDictionary<int, ThreadContext>();
protected override void Load(ContainerBuilder builder) {
builder.RegisterInstance(new Output(_contexts)).As<IContainerSpyOutput>();
//builder.RegisterCallback(cr => cr.Registered += (_, registered) => {
// registered.ComponentRegistration.Preparing += (__, preparing) => Preparing(GetContext(_contexts), preparing);
// registered.ComponentRegistration.Activating += (__, activating) => Activating(GetContext(_contexts), activating);
// registered.ComponentRegistration.Activated += (__, activated) => Activated(GetContext(_contexts), activated);
//});
}
protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration) {
registration.Preparing += (__, preparing) => Preparing(GetContext(_contexts), preparing);
registration.Activating += (__, activating) => Activating(GetContext(_contexts), activating);
registration.Activated += (__, activated) => Activated(GetContext(_contexts), activated);
}
static ThreadContext GetContext(ConcurrentDictionary<int, ThreadContext> nodes) {
return nodes.GetOrAdd(Thread.CurrentThread.ManagedThreadId, _ => {
var tc = new ThreadContext();
tc.Root = tc.Clock = tc.Chain = tc.Focus = new Node(tc);
return tc;
});
}
private static void Preparing(ThreadContext context, PreparingEventArgs preparing) {
context.Focus = context.Focus.Preparing(preparing);
context.Chain = context.Chain.Link(preparing, context.Focus);
context.Clock = MoveClock(context.Clock, context.Focus);
}
private static void Activating(ThreadContext context, ActivatingEventArgs<object> activating) {
context.Focus = context.Focus.Activating(activating);
}
private static void Activated(ThreadContext context, ActivatedEventArgs<object> activated) {
context.Clock = MoveClock(context.Clock, context.Root);
context.Chain = context.Chain.Activated(activated);
}
private static Node MoveClock(Node currentClock, Node newClock) {
var scanEnable = newClock;
while (scanEnable.Hot == false) {
scanEnable.Hot = true;
scanEnable = scanEnable._parent;
}
var scanDisable = currentClock;
while (scanDisable != scanEnable) {
scanDisable.Hot = false;
scanDisable = scanDisable._parent;
}
return newClock;
}
class ThreadContext {
public Node Root { get; set; }
public Node Focus { get; set; }
public Node Chain { get; set; }
public Node Clock { get; set; }
}
class Node {
private readonly ThreadContext _threadContext;
public Node _parent;
private Node _chain;
public readonly IComponentRegistration _component;
public readonly IDictionary<Guid, Node> _children = new Dictionary<Guid, Node>();
public int _preparingCount;
public int _activatingCount;
public int _activatedCount;
private bool _hot;
readonly Stopwatch _stopwatch = new Stopwatch();
private long _time;
public Node(ThreadContext threadContext) {
_threadContext = threadContext;
_hot = true; // meta-nodes are hot to avoid any timing
}
public Node(Node parent, IComponentRegistration component) {
_threadContext = parent._threadContext;
_parent = parent;
_component = component;
}
public bool Hot {
get {
return _hot;
}
set {
if (_hot == value)
return;
_hot = value;
if (_hot) {
_stopwatch.Start();
}
else {
_stopwatch.Stop();
}
}
}
public long Time {
get { return _time+ _stopwatch.ElapsedTicks * 1000000 / Stopwatch.Frequency; }
}
public void AddTime(long time) { _time += time; }
public override string ToString() {
return _component == null ? "root" : _component.ToString();
}
private static void TraceMessage(string format, IComponentRegistration component) {
//Trace.WriteLine(Message(format, component));
}
private static string Message(string format, IComponentRegistration component) {
return string.Format(format, component.Id, string.Join(",", component.Services), Thread.CurrentThread.ManagedThreadId);
}
public Node Preparing(PreparingEventArgs e) {
// move focus down a level on the tree
// add a link in chain
Node child;
lock (_children) {
if (!_children.TryGetValue(e.Component.Id, out child)) {
child = new Node(this, e.Component);
_children[e.Component.Id] = child;
}
}
TraceMessage("Preparing[{2}] {0} {1}", e.Component);
Interlocked.Increment(ref child._preparingCount);
return child;
}
public Node Link(PreparingEventArgs e, Node focus) {
if (focus._chain != null) {
TraceMessage("REACTIVATED: Preparing[{2}] {0} {1}", e.Component);
}
focus._chain = this;
return focus;
}
public Node Activating(ActivatingEventArgs<object> e) {
// move focus up a level on the tree
if (_component == null) {
TraceMessage("UNMATCHED: Activating[{2}] {0} {1}", e.Component);
return this;
}
if (_component.Id != e.Component.Id) {
TraceMessage("MISSING: Activating[{2}] {0} {1}", _component);
return _parent.Activating(e);
}
TraceMessage("Activating[{2}] {0} {1}", e.Component);
Interlocked.Increment(ref _activatingCount);
return _parent;
}
public Node Activated(ActivatedEventArgs<object> e) {
// remove a link in chain
if (_component == null) {
TraceMessage("UNMATCHED: Activated[{2}] {0} {1}", e.Component);
return this;
}
if (_component.Id != e.Component.Id) {
_chain = _chain.Activated(e);
return this;
}
TraceMessage("Activated[{2}] {0} {1}", e.Component);
Interlocked.Increment(ref _activatedCount);
var chain = _chain;
_chain = null;
return chain;
}
}
class Output : IContainerSpyOutput {
private readonly ConcurrentDictionary<int, ThreadContext> _root;
public Output(ConcurrentDictionary<int, ThreadContext> root) {
_root = root;
}
public void Write(XElement target) {
var elts = _root.Values
.Select(entry => Write(entry.Root))
.OrderByDescending(GetWeight)
.ToArray();
var merged = _root.Values.Aggregate(new Node(null), (a, n) => Merge(a, n.Root));
var totals = new TotalVisitor();
totals.Visit(merged);
target.Add(Write(merged));
target.Add(Write(totals._totals));
target.Add(elts);
}
private class TotalVisitor {
public readonly Node _totals = new Node(null);
public void Visit(Node source) {
foreach (var child in source._children) {
Visit(child.Key, child.Value);
}
}
public void Visit(Guid key, Node source) {
Node target;
if (!_totals._children.TryGetValue(key, out target)) {
target = new Node(_totals, source._component);
_totals._children[key] = target;
}
target._preparingCount += source._preparingCount;
target._activatingCount += source._activatingCount;
target._activatedCount += source._activatedCount;
foreach (var child in source._children) {
Visit(child.Key, child.Value);
}
}
}
private static Node Merge(Node target, Node source) {
target._preparingCount += source._preparingCount;
target._activatingCount += source._activatingCount;
target._activatedCount += source._activatedCount;
target.AddTime(source.Time);
foreach (var sourceChild in source._children) {
Node targetChild;
if (!target._children.TryGetValue(sourceChild.Key, out targetChild)) {
targetChild = new Node(target, sourceChild.Value._component);
target._children[sourceChild.Key] = targetChild;
}
Merge(targetChild, sourceChild.Value);
}
return target;
}
private static XElement Write(Node node) {
var elt = new XElement(
"Component",
new XAttribute("services", node._component != null ? string.Join(",", node._component.Services) : "root"),
new XAttribute("preparing", node._preparingCount),
new XAttribute("activating", node._activatingCount),
new XAttribute("activated", node._activatedCount));
lock (node._children) {
var elts = node._children.Values
.Select(Write)
.OrderByDescending(GetMicrosecondInclusive)
.ToArray();
elt.Add(elts);
var weight = elts.Aggregate(node._preparingCount, (a, e) => a + GetWeight(e));
elt.SetAttributeValue("weight", weight);
elt.SetAttributeValue("usinc", node.Time);
if (weight != 0)
elt.SetAttributeValue("usincper", node.Time / weight);
}
return elt;
}
private static long GetMicrosecondInclusive(XElement elt) {
var attr = elt.Attribute("usinc");
return attr == null ? 0 : long.Parse(attr.Value);
}
private static int GetWeight(XElement elt) {
var attr = elt.Attribute("weight");
return attr == null ? 0 : int.Parse(attr.Value);
}
}
}
}

View File

@ -1,127 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web.Mvc;
using Orchard.Commands;
using Orchard.Environment.Configuration;
using Orchard.Experimental.ViewModels;
using Orchard.Environment.Extensions;
using Orchard.Localization;
using Orchard.Logging;
using Orchard.Security;
using Orchard.Themes;
using Orchard.UI.Admin;
using Orchard.Utility.Extensions;
namespace Orchard.Experimental.Controllers {
[Themed, Admin, OrchardFeature("Orchard.Experimental.WebCommandLine")]
public class CommandsController : Controller {
private readonly ShellSettings _shellSettings;
private readonly ICommandManager _commandManager;
public CommandsController(ShellSettings shellSettings, ICommandManager commandManager, IOrchardServices services) {
_shellSettings = shellSettings;
_commandManager = commandManager;
Services = services;
T = NullLocalizer.Instance;
Logger = NullLogger.Instance;
}
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
public ILogger Logger { get; set; }
public ActionResult Index() {
return Execute();
}
public ActionResult Execute() {
if (_shellSettings.Name != ShellSettings.DefaultName || !Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to use the web console")))
return new HttpUnauthorizedResult();
return View("Execute", new CommandsExecuteViewModel());
}
[HttpPost]
public ActionResult Execute(CommandsExecuteViewModel model) {
if (_shellSettings.Name != ShellSettings.DefaultName || !Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to use the web console")))
return new HttpUnauthorizedResult();
using (var writer = new StringWriter()) {
var commandLine = model.CommandLine.Trim();
CommandParameters parameters = GetCommandParameters(commandLine, writer);
_commandManager.Execute(parameters);
model.History = (model.History ?? Enumerable.Empty<string>())
.Concat(new[] {model.CommandLine})
.Distinct()
.ToArray();
model.Results = writer.ToString();
}
return View(model);
}
private static CommandParameters GetCommandParameters(string commandLine, StringWriter writer) {
var arguments = new List<string>();
var switches = new Dictionary<string,string>();
var current = 0;
while (current < commandLine.Length) {
var nextSpace = commandLine.IndexOf(' ', current);
if (nextSpace == -1) nextSpace = commandLine.Length;
var arg = commandLine.Substring(current, nextSpace - current).Trim();
if (arg.Length == 0) {
current = nextSpace + 1;
continue;
}
if (arg[0] == '/') {
var colonIndex = arg.IndexOf(':');
if (colonIndex != -1) {
var switchName = arg.Substring(1, colonIndex - 1);
if (arg.Length > colonIndex + 1) {
if (arg[colonIndex + 1] == '"') {
var beginningOfSwitchValue = commandLine.IndexOf('"', current) + 1;
if (beginningOfSwitchValue != 0) {
var endOfSwitchValue = commandLine.IndexOf('"', beginningOfSwitchValue);
if (endOfSwitchValue != -1) {
switches.Add(switchName,
commandLine.Substring(beginningOfSwitchValue,
endOfSwitchValue - beginningOfSwitchValue));
current = endOfSwitchValue + 1;
continue;
}
}
}
else {
switches.Add(switchName, arg.Substring(colonIndex + 1));
current = nextSpace + 1;
continue;
}
}
}
}
else if (arg[0] == '"') {
var argumentStart = commandLine.IndexOf('"', current) + 1;
var argumentEnd = commandLine.IndexOf('"', argumentStart);
if (argumentEnd != -1) {
arguments.Add(commandLine.Substring(argumentStart, argumentEnd - argumentStart));
current = argumentEnd + 1;
continue;
}
}
arguments.Add(arg);
current = nextSpace + 1;
}
return new CommandParameters {
Arguments = arguments,
Switches = switches,
Output = writer
};
}
}
}

View File

@ -1,65 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Orchard.Data;
using Orchard.Experimental.ViewModels;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Records;
using Orchard.DisplayManagement;
using Orchard.Themes;
using Orchard.UI.Admin;
namespace Orchard.Experimental.Controllers {
[Themed, Admin]
public class ContentController : Controller {
private readonly IRepository<ContentTypeRecord> _contentTypeRepository;
private readonly IContentManager _contentManager;
public ContentController(
IRepository<ContentTypeRecord> contentTypeRepository,
IContentManager contentManager,
IShapeFactory shapeFactory) {
_contentTypeRepository = contentTypeRepository;
_contentManager = contentManager;
Shape = shapeFactory;
}
dynamic Shape { get; set; }
public ActionResult Index() {
return View(new ContentIndexViewModel {
Items = _contentManager.Query().List(),
Types = _contentTypeRepository.Table.ToList()
});
}
public ActionResult Details(int id, int? version) {
var model = new ContentDetailsViewModel {
Item = version == null ? _contentManager.Get(id) : _contentManager.Get(id, VersionOptions.Number((int)version))
};
model.PartTypes = model.Item.ContentItem.Parts
.Select(x => x.GetType())
.SelectMany(x => AllTypes(x))
.Distinct();
model.DisplayShape = _contentManager.BuildDisplay(model.Item, "Detail");
model.EditorShape = _contentManager.BuildEditor(model.Item);
return View(model);
}
static IEnumerable<Type> AllTypes(Type type) {
var scan = type;
while (scan != null && scan != typeof(Object) && scan != typeof(ContentPart)) {
yield return scan;
scan = scan.BaseType;
}
foreach (var itf in type.GetInterfaces()) {
yield return itf;
}
}
}
}

View File

@ -1,123 +0,0 @@
using System;
using System.Web;
using System.Web.Mvc;
using System.Xml.Linq;
using Orchard.Experimental.Models;
using Orchard.DisplayManagement;
using Orchard.Localization;
using Orchard.Themes;
using Orchard.UI.Notify;
using Orchard.UI.Admin;
namespace Orchard.Experimental.Controllers {
[Themed, Admin]
public class HomeController : Controller {
private readonly INotifier _notifier;
private readonly IContainerSpyOutput _containerSpyOutput;
public HomeController(INotifier notifier, IShapeFactory shapeFactory, IContainerSpyOutput containerSpyOutput) {
_notifier = notifier;
_containerSpyOutput = containerSpyOutput;
T = NullLocalizer.Instance;
Shape = shapeFactory;
}
dynamic Shape { get; set; }
public Localizer T { get; set; }
public ActionResult Index() {
return View();
}
public ActionResult NotAuthorized() {
_notifier.Warning(T("Simulated error goes here."));
return new HttpUnauthorizedResult();
}
public ActionResult Simple() {
return View(new Simple { Title = "This is a simple text", Quantity = 5 });
}
public ActionResult _RenderableAction() {
return PartialView("_RenderableAction", "This is render action");
}
public ActionResult SimpleMessage() {
_notifier.Information(T("Notifier works without BaseViewModel"));
return RedirectToAction("Simple");
}
[Themed(false)]
public ActionResult SimpleNoTheme() {
return View("Simple", new Simple { Title = "This is not themed", Quantity = 5 });
}
public ActionResult FormShapes() {
var model = Shape.Form()
.Fieldsets(Shape.Fieldsets(typeof(Array))
.Add(Shape.Fieldset(typeof(Array)).Name("site")
.Add(Shape.InputText().Name("SiteName").Text(T("Site Name")).Value(T("some default/pre-pop value...").Text))
)
.Add(Shape.Fieldset(typeof(Array)).Name("admin")
.Add(Shape.InputText().Name("AdminUsername").Text(T("Admin Username")))
.Add(Shape.InputPassword().Name("AdminPassword").Text(T("Admin Password")))
)
.Add(Shape.Fieldset(typeof(Array)).Name("actions")
.Add(Shape.FormSubmit().Text(T("Finish Setup")))
)
);
// get at the first input?
model.Fieldsets[0][0].Attributes(new {autofocus = "autofocus"}); // <-- could be applied by some other behavior - need to be able to modify attributes instead of clobbering them like this
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
return View((object)model);
}
[HttpPost, ActionName("FormShapes")]
public ActionResult FormShapesPOST() {
//all reqs are fail
ModelState.AddModelError("AdminUsername", "The admin username is wrong.");
return FormShapes();
}
public ActionResult UsingShapes() {
ViewBag.Page = Shape.Page()
.Main(Shape.Zone(typeof (Array), Name: "Main"))
.Messages(Shape.Zone(typeof (Array), Name: "Messages"))
.Sidebar(Shape.Zone(typeof (Array), Name: "Sidebar"));
//ViewModel.Page.Add("Messages:5", New.Message(Content: T("This is a test"), Severity: "Really bad!!!"));
ViewBag.Page.Messages.Add(
Shape.Message(Content: T("This is a test"), Severity: "Really bad!!!"));
ViewBag.Page.Sidebar.Add(
Shape.Link(Url: "http://orchard.codeplex.com", Content: Shape.Image(Url: "http://orchardproject.net/Content/images/orchardLogo.jpg").Attributes(new { @class = "bigredborderfromabadclassname" })));
var model = Shape.Message(
Content: Shape.Explosion(Height: 100, Width: 200),
Severity: "Meh");
ViewBag.Page.Messages.Add(new HtmlString("<hr/>abuse<hr/>"));
ViewBag.Page.Messages.Add("<hr/>encoded<hr/>");
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
return View((object)model);
}
public static string Break(dynamic view) {
return view.Model.Box.Title;
}
public ActionResult ContainerData() {
var root = new XElement("root");
_containerSpyOutput.Write(root);
return Content(root.ToString(), "text/xml");
}
}
}

View File

@ -1,69 +0,0 @@
using System.IO;
using System.Web.Mvc;
using System.Xml;
using System.Xml.Linq;
using Orchard.ContentManagement.MetaData;
using Orchard.Experimental.ViewModels;
using Orchard.Themes;
using Orchard.UI.Admin;
namespace Orchard.Experimental.Controllers {
[ValidateInput(false), Themed, Admin]
public class MetadataController : Controller {
private readonly IContentDefinitionManager _contentDefinitionManager;
private readonly IContentDefinitionWriter _contentDefinitionWriter;
private readonly IContentDefinitionReader _contentDefinitionReader;
public MetadataController(
IContentDefinitionManager contentDefinitionManager,
IContentDefinitionWriter contentDefinitionWriter,
IContentDefinitionReader contentDefinitionReader) {
_contentDefinitionManager = contentDefinitionManager;
_contentDefinitionWriter = contentDefinitionWriter;
_contentDefinitionReader = contentDefinitionReader;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope", Justification = "StringWriter is disposed by wrapped XmlWriter.")]
public ActionResult Index() {
var model = new MetadataIndexViewModel {
TypeDefinitions = _contentDefinitionManager.ListTypeDefinitions(),
PartDefinitions = _contentDefinitionManager.ListPartDefinitions()
};
var types = new XElement("Types");
foreach (var type in model.TypeDefinitions) {
types.Add(_contentDefinitionWriter.Export(type));
}
var parts = new XElement("Parts");
foreach (var part in model.PartDefinitions) {
parts.Add(_contentDefinitionWriter.Export(part));
}
var stringWriter = new StringWriter();
using (var xmlWriter = XmlWriter.Create(stringWriter, new XmlWriterSettings { Indent = true, IndentChars = " " })) {
if (xmlWriter != null) {
new XElement("Orchard", types, parts).WriteTo(xmlWriter);
}
}
model.ExportText = stringWriter.ToString();
return View(model);
}
[HttpPost]
public ActionResult Index(MetadataIndexViewModel model) {
var root = XElement.Parse(model.ExportText);
foreach (var element in root.Elements("Types").Elements()) {
var typeElement = element;
var typeName = XmlConvert.DecodeName(element.Name.LocalName);
_contentDefinitionManager.AlterTypeDefinition(typeName, alteration => _contentDefinitionReader.Merge(typeElement, alteration));
}
foreach (var element in root.Elements("Parts").Elements()) {
var partElement = element;
var partName = XmlConvert.DecodeName(element.Name.LocalName);
_contentDefinitionManager.AlterPartDefinition(partName, alteration => _contentDefinitionReader.Merge(partElement, alteration));
}
return RedirectToAction("Index");
}
}
}

View File

@ -1,19 +0,0 @@
using System.Web.Mvc;
using Orchard.DisplayManagement.Descriptors;
using Orchard.Themes;
using Orchard.UI.Admin;
namespace Orchard.Experimental.Controllers {
[Themed, Admin]
public class ShapeTableController : Controller {
private readonly IShapeTableManager _shapeTableManager;
public ShapeTableController(IShapeTableManager shapeTableManager) {
_shapeTableManager = shapeTableManager;
}
public ActionResult ShapeTable(string themeName) {
return View(_shapeTableManager.GetShapeTable(themeName));
}
}
}

View File

@ -1,61 +0,0 @@
using System.Web.Mvc;
using System.Xml;
using Orchard.DisplayManagement.Shapes;
using Orchard.Mvc.Filters;
namespace Orchard.Experimental {
public class DebugFilter : FilterProvider, IActionFilter {
public void OnActionExecuting(ActionExecutingContext filterContext) {
}
public void OnActionExecuted(ActionExecutedContext filterContext) {
var viewResultBase = filterContext.Result as ViewResultBase;
var debugValueResult = filterContext.Controller.ValueProvider.GetValue("$debug");
if (debugValueResult == null)
return;
var debugValue = (string)debugValueResult.ConvertTo(typeof(string));
if (debugValue == "model" && viewResultBase != null) {
filterContext.Result = new DebugModelResult(viewResultBase);
}
}
public class DebugModelResult : ActionResult {
private readonly ViewResultBase _viewResultBase;
public DebugModelResult(ViewResultBase viewResultBase) {
_viewResultBase = viewResultBase;
}
public override void ExecuteResult(ControllerContext context) {
context.HttpContext.Response.ContentType = "application/xml";
var output = context.HttpContext.Response.Output;
using (var writer = XmlWriter.Create(output, new XmlWriterSettings { Indent = true, IndentChars = " " })) {
try {
Writer = writer;
var model = _viewResultBase.ViewData.Model;
Accept(model);
} finally {
Writer = null;
}
}
}
protected XmlWriter Writer { get; set; }
void Accept(dynamic model) {
Shape shape = model;
Visit(shape);
}
void Visit(Shape shape) {
Writer.WriteStartElement("Shape");
Writer.WriteAttributeString("Type", shape.Metadata.Type);
foreach (var item in shape.Items) {
Accept(item);
}
Writer.WriteEndElement();
}
}
}
}

View File

@ -1,19 +0,0 @@
using JetBrains.Annotations;
using Orchard.ContentManagement.Handlers;
using Orchard.Experimental.Models;
namespace Orchard.Experimental.Handlers {
[UsedImplicitly]
public class DebugLinkHandler : ContentHandler {
protected override void BuildDisplayShape(BuildDisplayContext context) {
var experimentalSettings = context.ContentItem.TypeDefinition.Settings.GetModel<Settings.ExperimentalSettings>();
if (experimentalSettings.ShowDebugLinks)
context.Shape.Zones["Recap"].Add(new ShowDebugLink { ContentItem = context.ContentItem }, "9999");
}
protected override void BuildEditorShape(BuildEditorContext context) {
var experimentalSettings = context.ContentItem.TypeDefinition.Settings.GetModel<Settings.ExperimentalSettings>();
if (experimentalSettings.ShowDebugLinks)
context.Shape.Zones["Recap"].Add(new ShowDebugLink { ContentItem = context.ContentItem }, "9999");
}
}
}

View File

@ -1,34 +0,0 @@
using System.Linq;
using System.Web.Mvc;
using Orchard.Data;
using Orchard.Environment;
using Orchard.Environment.Extensions;
using Orchard.Logging;
using Orchard.Mvc.Filters;
namespace Orchard.Experimental {
[OrchardFeature("Orchard.Experimental.LockLogging")]
public class LockLogging : FilterProvider, IExceptionFilter {
private readonly Work<ISessionLocator> _sessionLocator;
public LockLogging(Work<ISessionLocator> sessionLocator) {
_sessionLocator = sessionLocator;
Logger = NullLogger.Instance;
}
public ILogger Logger { get; set; }
public void OnException(ExceptionContext filterContext) {
var connection = _sessionLocator.Value.For(null).Connection;
var command = connection.CreateCommand();
command.CommandText = "SELECT * FROM sys.lock_information";
var reader = command.ExecuteReader();
while (reader.Read()) {
var fields = Enumerable.Range(0, reader.FieldCount)
.Select(i => new { Key = reader.GetName(i), Value = reader.GetValue(i) });
var message = fields.Aggregate("sys.lock_information", (sz, kv) => sz + " " + kv.Key + ":" + kv.Value);
Logger.Debug(message);
}
}
}
}

View File

@ -1,27 +0,0 @@
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
using Orchard.Environment.Extensions;
namespace Orchard.Experimental {
[OrchardFeature("Orchard.Experimental.TestingLists")]
public class TestingListsMigrations : DataMigrationImpl {
public int Create() {
ContentDefinitionManager.AlterTypeDefinition("ListItem",
cfg => cfg
.WithPart("CommonPart")
.WithPart("AutoroutePart")
.WithPart("BodyPart")
.WithPart("ContainablePart")
.Creatable()
);
ContentDefinitionManager.AlterTypeDefinition("Page",
cfg => cfg
.WithPart("ContainablePart")
);
return 1;
}
}
}

View File

@ -1,7 +0,0 @@
using Orchard.ContentManagement;
namespace Orchard.Experimental.Models {
public class ShowDebugLink {
public ContentItem ContentItem { get; set; }
}
}

View File

@ -1,7 +0,0 @@
namespace Orchard.Experimental.Models {
public class Simple {
public string Title { get; set; }
public int Quantity { get; set; }
}
}

View File

@ -1,27 +0,0 @@
Name: Experimental
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.4.1
OrchardVersion: 1.4.1
Description: An assortment of debugging tools.
Category: Developer
Features:
Profiling:
Name: Profiling
Description: Tools to help profile Orchard.
Category: Developer
Dependencies: Orchard.Experimental
Orchard.Experimental.WebCommandLine:
Name: Web Command Line
Description: Enables site administrators to execute Orchard.exe commands via web interface
Category: Developer
Orchard.Experimental.TestingLists:
Name: Testing Lists
Description: Adds some content definitions to help test lists
Dependencies: Orchard.Lists
Category: Developer
Orchard.Experimental.LockLogging:
Name: Lock Logging
Description: Logs extra diagnostic information for Sql CE if a deadlock timeout occurs
Category: Developer

View File

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{AB3C207C-0126-4143-8D62-1119DF80D366}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Orchard.Experimental</RootNamespace>
<AssemblyName>Orchard.Experimental</AssemblyName>
<TargetFrameworkVersion>v4.0</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>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
</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="Autofac, Version=2.2.4.900, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NHibernate">
<HintPath>..\..\..\..\lib\fluentnhibernate\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Commands\ProfilingCommands.cs" />
<Compile Include="ContainerSpy.cs" />
<Compile Include="Controllers\CommandsController.cs" />
<Compile Include="Controllers\ContentController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\ShapeTableController.cs" />
<Compile Include="Controllers\MetadataController.cs" />
<Compile Include="DebugFilter.cs" />
<Compile Include="Handlers\DebugLinkHandler.cs" />
<Compile Include="LockLogging.cs" />
<Compile Include="Migrations.cs" />
<Compile Include="Models\ShowDebugLink.cs" />
<Compile Include="Models\Simple.cs" />
<Compile Include="Permissions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings\ExperimentalSettings.cs" />
<Compile Include="ViewModels\CommandsExecuteViewModel.cs" />
<Compile Include="ViewModels\ContentDetailsViewModel.cs" />
<Compile Include="ViewModels\ContentIndexViewModel.cs" />
<Compile Include="ViewModels\MetadataIndexViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="Module.txt" />
<Content Include="Styles\images\menu.experimental.png" />
<Content Include="Styles\menu.experimental-admin.css" />
<Content Include="Views\Commands\Execute.cshtml" />
<Content Include="Views\Content\Details.cshtml" />
<Content Include="Views\Content\Index.cshtml" />
<Content Include="Views\DefinitionTemplates\ExperimentalSettings.cshtml" />
<Content Include="Views\EditorTemplates\Parts\Experimental.ShowDebugLink.cshtml" />
<Content Include="Views\Home\Index.cshtml" />
<Content Include="Views\Home\Simple.cshtml" />
<Content Include="Views\Home\_RenderableAction.cshtml" />
<Content Include="Views\Metadata\Index.cshtml" />
<Content Include="Views\Web.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Parts\Experimental.ShowDebugLink.cshtml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Views\Home\FormShapes.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Home\UsingShapes.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\ShapeTable\ShapeTable.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="web.config" />
</ItemGroup>
<ItemGroup>
<Content Include="Styles\Web.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.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>55620</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>

View File

@ -1,23 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using Orchard.Environment.Extensions.Models;
using Orchard.Security.Permissions;
namespace Orchard.Experimental {
public class Permissions : IPermissionProvider {
public static readonly Permission DebugShowAllMenuItems = new Permission { Description = "Experimental: Show all menu items", Name = "DebugShowAllMenuItems" };
public virtual Feature Feature { get; set; }
public IEnumerable<Permission> GetPermissions() {
return new[] {
DebugShowAllMenuItems,
};
}
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
return Enumerable.Empty<PermissionStereotype>();
}
}
}

View File

@ -1,35 +0,0 @@
using System.Reflection;
using System.Runtime.InteropServices;
using System.Security;
// 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("Orchard.Experimental")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Orchard")]
[assembly: AssemblyCopyright("Copyright © Outercurve Foundation 2009")]
[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("dedeaad6-f97c-4db1-b544-8e72496aa5ed")]
// 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.4.1")]
[assembly: AssemblyFileVersion("1.4.1")]

View File

@ -1,29 +0,0 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.ContentManagement.MetaData.Models;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.Experimental.Settings {
public class ExperimentalSettings {
public bool ShowDebugLinks { get; set; }
}
public class ExperimentalSettingsHooks : ContentDefinitionEditorEventsBase {
public override IEnumerable<TemplateViewModel> TypeEditor(ContentTypeDefinition definition) {
var model = definition.Settings.GetModel<ExperimentalSettings>();
yield return DefinitionTemplate(model);
}
public override IEnumerable<TemplateViewModel> TypeEditorUpdate(ContentTypeDefinitionBuilder builder, IUpdateModel updateModel) {
var model = new ExperimentalSettings();
updateModel.TryUpdateModel(model, "ExperimentalSettings", null, null);
builder
.WithSetting("ExperimentalSettings.ShowDebugLinks", model.ShowDebugLinks ? true.ToString() : null);
yield return DefinitionTemplate(model);
}
}
}

View File

@ -1,25 +0,0 @@
<?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" />
</staticContent>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 251 B

View File

@ -1,6 +0,0 @@
.navicon-experimental {
background-image:url(images/menu.experimental.png) !important;
}
.navicon-experimental:hover {
background-position:0 -30px !important;
}

View File

@ -1,8 +0,0 @@
namespace Orchard.Experimental.ViewModels {
public class CommandsExecuteViewModel {
public string[] History { get; set; }
public string CommandLine { get; set; }
public string Results { get; set; }
}
}

View File

@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.ViewModels;
namespace Orchard.Experimental.ViewModels {
public class ContentDetailsViewModel {
public IContent Item { get; set; }
public IEnumerable<Type> PartTypes { get; set; }
public IContent DisplayShape { get; set; }
public IContent EditorShape { get; set; }
public IEnumerable<TemplateViewModel> Editors {
get {
return new List<TemplateViewModel>();
}
}
public IEnumerable<TemplateViewModel> Displays {
get { return new List<TemplateViewModel>(); }
}
public object Locate(Type type) {
return Item.ContentItem.Get(type);
}
}
}

View File

@ -1,11 +0,0 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Records;
namespace Orchard.Experimental.ViewModels {
public class ContentIndexViewModel {
public IEnumerable<ContentTypeRecord> Types { get; set; }
public IEnumerable<ContentItem> Items { get; set; }
}
}

View File

@ -1,11 +0,0 @@
using System.Collections.Generic;
using Orchard.ContentManagement.MetaData.Models;
namespace Orchard.Experimental.ViewModels {
public class MetadataIndexViewModel {
public IEnumerable<ContentTypeDefinition> TypeDefinitions { get; set; }
public IEnumerable<ContentPartDefinition> PartDefinitions { get; set; }
public string ExportText { get; set; }
}
}

View File

@ -1,21 +0,0 @@
@model Orchard.Experimental.ViewModels.CommandsExecuteViewModel
<h1>
@Html.TitleForPage(T("Command line").ToString())
</h1>
<div>
@using (Html.BeginFormAntiForgeryPost(Url.Action("Execute"))) {
@Html.ValidationSummary()
<ul>
@for (int index = 0; index != (Model.History ?? new string[0]).Length; ++index) {
<li>
@Model.History[index]
@Html.HiddenFor(m => m.History[index])
</li>
}
</ul>
@Html.LabelFor(m => m.CommandLine, T("Command Line"))
@Html.TextBoxFor(m => m.CommandLine, new { style = "width:100%;" })
@Html.ValidationMessageFor(m => m.CommandLine)
<pre>@Model.Results</pre>
}
</div>

View File

@ -1,103 +0,0 @@
@model ContentDetailsViewModel
@using Orchard.Experimental.ViewModels;
@using Orchard.ContentManagement;
@using System.Collections;
<h1>@Html.TitleForPage(T("{0} Content Type", Model.Item.ContentItem.ContentType).ToString(), T("Content").ToString())</h1>
<h2>@T("Content Item")</h2>
<p>@T("Id:") @Model.Item.ContentItem.Id<br />
@T("Version:") @Model.Item.ContentItem.Version<br />
@T("ContentType:") @Model.Item.ContentItem.ContentType<br />
@T("DisplayText:") @Html.ItemDisplayText(Model.Item)<br />
@T("Links:") @Html.ItemDisplayLink(T("view").ToString(), Model.Item) @Html.ItemEditLink(T("edit").ToString(), Model.Item)
</p>
<h2>@T("Content Item Parts")</h2>
<ul>
@foreach (var partType in Model.PartTypes.OrderBy(x => x.Name)) {
<li>
<span style="font-weight: bold;">
@if (partType.IsGenericType) {
@:@partType.Name @partType.GetGenericArguments().First().Name (@partType.GetGenericArguments().First().Namespace)
}
else {
@:@partType.Name (@partType.Namespace)
}
</span>
<ul style="margin-left: 20px">
@foreach (var prop in partType.GetProperties().Where(x => x.DeclaringType == partType)) {
var value = prop.GetValue(Model.Locate(partType), null);
<li style="font-weight: normal;">
@prop.Name
@value
@{var valueItem = value as ContentItem; }
@if (valueItem == null && value is IContent) {
valueItem = (value as IContent).ContentItem;
}
@if (valueItem != null) {
Html.ActionLink(T("{0} #{1} v{2}", valueItem.ContentType, valueItem.Id, valueItem.Version).ToString(), "details", new { valueItem.Id }, new { });
}
<ul style="margin-left: 20px">
@if (value == null || prop.PropertyType.IsPrimitive || prop.PropertyType == typeof(string) || prop.PropertyType == typeof(DateTime?)) { }
else if (typeof(IEnumerable).IsAssignableFrom(prop.PropertyType)) {
foreach (var item in value as IEnumerable) {
<li>@item.GetType().Name : @item</li>
}
}
else {
foreach (var prop2 in value.GetType().GetProperties().Where(x => x.GetIndexParameters().Count() == 0)) {
<li>
@prop2.Name
@prop2.GetValue(value, null)
</li>
}
}
</ul>
</li>
}
</ul>
</li>
}
</ul>
<h3>Displays</h3>
<ul>
@foreach (var display in Model.Displays) {
<li>
<span style="font-weight: bold">@display.Prefix</span>
@display.Model.GetType().Name
(@display.Model.GetType().Namespace)
Template: @display.TemplateName ?? "(null)"
Prefix: @display.Prefix ?? "(null)"
Zone: @display.ZoneName ?? "(null)"
Position: @display.Position ?? "(null)"
<div style="margin-left: 20px; border: solid 1px black;">
@Html.DisplayFor(x => display.Model, display.TemplateName, display.Prefix)
</div>
</li>
}
</ul>
<h3>Editors</h3>
<ul>
@foreach (var editor in Model.Editors) {
<li>
<span style="font-weight: bold">@editor.Prefix</span>
@editor.Model.GetType().Name
(@editor.Model.GetType().Namespace)
Template: @editor.TemplateName ?? "(null)"
Prefix: @editor.Prefix ?? "(null)"
Zone: @editor.ZoneName ?? "(null)"
Position: @editor.Position ?? "(null)"
<div style="margin-left: 20px; border: solid 1px black;">
@Html.EditorFor(x=>editor.Model, editor.TemplateName, editor.Prefix)
</div>
</li>
}
</ul>

View File

@ -1,23 +0,0 @@
@model ContentIndexViewModel
@using Orchard.Experimental.ViewModels;
<h1>@Html.TitleForPage(T("Content").ToString())</h1>
<h2>@T("Content Types")</h2>
<ul>
@foreach(var item in Model.Types.OrderBy(x=>x.Name)) {
<li>@item.Name</li>
}
</ul>
<h2>@T("Content Items")</h2>
<ul>
@foreach(var item in Model.Items.OrderBy(x=>x.Id)) {
<li>
@Html.ActionLink(T("{0}: {1}", item.Id, item.ContentType).ToString(), "details", "content", new{item.Id},new{})
@Html.ItemDisplayLink(T("view").ToString(), item)
@Html.ItemEditLink(T("edit").ToString(), item)
</li>
}
</ul>

View File

@ -1,6 +0,0 @@
@model Orchard.Experimental.Settings.ExperimentalSettings
<fieldset>
@Html.EditorFor(m=>m.ShowDebugLinks)
<label for="@Html.FieldIdFor(m => m.ShowDebugLinks)" class="forcheckbox">@T("Show debug links")</label>
@Html.ValidationMessageFor(m=>m.ShowDebugLinks)
</fieldset>

View File

@ -1,6 +0,0 @@
@model Orchard.Experimental.Models.ShowDebugLink
@if (Model.ContentItem.Id > 0) {
<div class="debug message">
@T("Experimental: editing {0}", Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Model.ContentItem.Id, Model.ContentItem.Version }, new { }))
</div>
}

View File

@ -1,3 +0,0 @@
<div>
the form -> @Display(Model)
</div>

View File

@ -1,4 +0,0 @@
<h1>@Html.TitleForPage(T("Experimental").ToString())</h1>
<p>@Html.ActionLink(T("Contents").ToString(), "Index", "Content")</p>
<p>@Html.ActionLink(T("Metadata").ToString(), "Index", "Metadata")</p>
<p>@Html.ActionLink(T("Test Unauthorized Request").ToString(), "NotAuthorized", "Home")</p>

View File

@ -1,6 +0,0 @@
<h1>@H(Model.Title)</h1>
<p>Quantity: @Model.Quantity</p>
<div style="border: solid 1px #ccc;">
@Html.RenderAction("_RenderableAction")
</div>
<p>@Html.ActionLink("Test Messages", "SimpleMessage")</p>

View File

@ -1,16 +0,0 @@
<div>
a @Display.Title(text:"This is everything")
b @Display(Model)]
c [@Display(View.Page)]
d @Display.Message(Content:"Madness!!!")
e @Display.Explosion(Width:40)
f @Display.Message(Content: Display.Explosion(Height:10,Width:15))
g @Display.Rounded(Contents: Model)
</div>

View File

@ -1,45 +0,0 @@
@model MetadataIndexViewModel
@using Orchard.Experimental.ViewModels;
<style title="text/css">
ul
{
margin-left: 12px;
}
</style>
<h1>Metadata</h1>
<h2>Content Type Definitions</h2>
<ul>
@foreach (var type in Model.TypeDefinitions) {
<li>
@type.Name
<ul>
@foreach (var part in type.Parts) {
<li>
@part.PartDefinition.Name
</li>
}
</ul>
</li>
}
</ul>
<h2>Content Part Definitions</h2>
<ul>
@foreach (var part in Model.PartDefinitions) {
<li>
@part.Name
</li>
}
</ul>
<h2>Exported as xml</h2>
@using (Html.BeginFormAntiForgeryPost()) {
@Html.TextAreaFor(m=>m.ExportText, new{style="width:100%;height:640px;"})
<br />
<button class="primaryAction" type="submit">@T("Merge Changes")</button>
}

View File

@ -1,5 +0,0 @@
@using Orchard.Experimental.Models;
<div class="debug message">
Experimental: displaying @Html.ActionLink(T("{0} #{1} v{2}", Model.ContentItem.ContentType, Model.ContentItem.Id, Model.ContentItem.Version).ToString(), "details", "content", new { area = "Orchard.Experimental", Id = (int)Model.ContentItem.Id, Version = (int)Model.ContentItem.Version }, new { }))
</div>

View File

@ -1,12 +0,0 @@

<div>
@model Orchard.DisplayManagement.Descriptors.ShapeTable
<ul>
@foreach(var descriptor in Model.Descriptors) {
<li>
@descriptor.Key
<p>@descriptor.Value.BindingSource</p>
</li>
}
</ul>
</div>

View File

@ -1,35 +0,0 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
</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>
</handlers>
</system.webServer>
</configuration>

View File

@ -1,41 +0,0 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<remove name="host" />
<remove name="pages" />
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
<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.Web.WebPages" />
<add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/>
<add namespace="Orchard.Mvc.Html"/>
</namespaces>
</pages>
</system.web.webPages.razor>
<system.web>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
</system.web>
</configuration>

View File

@ -78,8 +78,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Widgets", "Orchard.
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.CodeGeneration", "Orchard.Web\Modules\Orchard.CodeGeneration\Orchard.CodeGeneration.csproj", "{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Experimental", "Orchard.Web\Modules\Orchard.Experimental\Orchard.Experimental.csproj", "{AB3C207C-0126-4143-8D62-1119DF80D366}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Migrations", "Orchard.Web\Modules\Orchard.Migrations\Orchard.Migrations.csproj", "{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Themes", "Themes", "{74492CBC-7201-417E-BC29-28B4C25A58B0}"
@ -489,16 +487,6 @@ Global
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}.FxCop|Any CPU.Build.0 = Release|Any CPU
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}.Release|Any CPU.Build.0 = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.Coverage|Any CPU.Build.0 = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.Debug|Any CPU.Build.0 = Debug|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.FxCop|Any CPU.Build.0 = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.Release|Any CPU.ActiveCfg = Release|Any CPU
{AB3C207C-0126-4143-8D62-1119DF80D366}.Release|Any CPU.Build.0 = Release|Any CPU
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
@ -843,7 +831,6 @@ Global
{D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{AB3C207C-0126-4143-8D62-1119DF80D366} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{C889167C-E52C-4A65-A419-224B3D1B957D} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{137906EA-15FE-4AD8-A6A0-27528F0477D6} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}