Partially complete refactoring. Adding transactions. Adjusting template locations. CURRENTLY BROKEN

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044385
This commit is contained in:
loudej
2009-12-21 01:30:24 +00:00
parent 3312bdd55f
commit 8d99ca8bee
65 changed files with 720 additions and 503 deletions

View File

@@ -3,121 +3,100 @@
<%@ Import Namespace="System.Reflection" %>
<%@ Import Namespace="Orchard.Mvc.Html" %>
<!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>TwoColumns</title>
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="innerheader">
<% Html.Include("header"); %>
</div>
</div>
<div id="page">
<div id="sideBar">
<% Html.Include("Navigation"); %>
</div>
<div id="main">
<h3>
Content Item</h3>
<p>
Id:
<%=Model.Item.ContentItem.Id %></p>
<p>
ContentType:
<%=Model.Item.ContentItem.ContentType%> <%=Html.ItemDisplayLink(Model.Item) %> <%=Html.ItemEditLink("edit", Model.Item) %></p>
<h3>
Content Item Parts</h3>
<ul>
<%foreach (var partType in Model.PartTypes.OrderBy(x => x.Name)) {%>
<li><span style="font-weight: bold;">
<%if (partType.IsGenericType) {%><%=Html.Encode(partType.Name +" "+partType.GetGenericArguments().First().Name)%></span>
<%=Html.Encode(" (" + partType.GetGenericArguments().First().Namespace + ")")%><%}
else {%><%=Html.Encode(partType.Name)%></span>
<%=Html.Encode( " (" + partType.Namespace + ")")%><%
}
%>
<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;">
<%=Html.Encode(prop.Name) %>:
<%=Html.Encode(value) %>
<%var valueItem = value as ContentItem;
if (valueItem == null && value is IContent) {
valueItem = (value as IContent).ContentItem;
}
if (valueItem != null) {
%><%=Html.ActionLink(valueItem.ContentType + " #" + valueItem.Id, "details", new { valueItem.Id }, new { })%><%
}
%>
<ul style="margin-left: 20px">
<%if (value == null || prop.PropertyType.IsPrimitive || prop.PropertyType == typeof(string)) { }
else if (typeof(IEnumerable).IsAssignableFrom(prop.PropertyType)) {
foreach (var item in value as IEnumerable) {
%>
<li><%=Html.Encode(item.GetType().Name) %>:<%=Html.Encode(item) %></li>
<%
}
}
else {%>
<%foreach (var prop2 in value.GetType().GetProperties().Where(x => x.GetIndexParameters().Count() == 0)) {%>
<li>
<%=Html.Encode(prop2.Name)%>
<%=Html.Encode(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">
<%=Html.Encode(display.Prefix)%></span>
<%=Html.Encode(display.Model.GetType().Name)%>
(<%=Html.Encode(display.Model.GetType().Namespace)%>)
Prefix:<%=Html.Encode(display.Prefix ?? "(null)")%>
Zone:<%=Html.Encode(display.ZoneName ?? "(null)")%>
Position:<%=Html.Encode(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">
<%=Html.Encode(editor.Prefix) %></span>
<%=Html.Encode(editor.Model.GetType().Name) %>
(<%=Html.Encode(editor.Model.GetType().Namespace) %>)
Prefix:<%=Html.Encode(editor.Prefix ?? "(null)")%>
Zone:<%=Html.Encode(editor.ZoneName ?? "(null)")%>
Position:<%=Html.Encode(editor.Position??"(null)") %>
<div style="margin-left: 20px; border: solid 1px black;">
<%=Html.EditorFor(x=>editor.Model, editor.TemplateName, editor.Prefix) %>
</div>
</li>
<%
}%>
</ul>
<h3>Content Item</h3>
<p>
Id:
<%=Model.Item.ContentItem.Id %></p>
<p>
ContentType:
<%=Model.Item.ContentItem.ContentType%> <%=Html.ItemDisplayLink(Model.Item) %> <%=Html.ItemEditLink("edit", Model.Item) %></p>
<h3>Content Item Parts</h3>
<ul>
<%foreach (var partType in Model.PartTypes.OrderBy(x => x.Name)) {%>
<li><span style="font-weight: bold;">
<%if (partType.IsGenericType) {%><%=Html.Encode(partType.Name +" "+partType.GetGenericArguments().First().Name)%></span>
<%=Html.Encode(" (" + partType.GetGenericArguments().First().Namespace + ")")%><%}
else {%><%=Html.Encode(partType.Name)%></span>
<%=Html.Encode( " (" + partType.Namespace + ")")%><%
}
%>
<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;">
<%=Html.Encode(prop.Name) %>:
<%=Html.Encode(value) %>
<%var valueItem = value as ContentItem;
if (valueItem == null && value is IContent) {
valueItem = (value as IContent).ContentItem;
}
if (valueItem != null) {
%><%=Html.ActionLink(valueItem.ContentType + " #" + valueItem.Id, "details", new { valueItem.Id }, new { })%><%
}
%>
<ul style="margin-left: 20px">
<%if (value == null || prop.PropertyType.IsPrimitive || prop.PropertyType == typeof(string)) { }
else if (typeof(IEnumerable).IsAssignableFrom(prop.PropertyType)) {
foreach (var item in value as IEnumerable) {
%>
<li><%=Html.Encode(item.GetType().Name) %>:<%=Html.Encode(item) %></li>
<%
}
}
else {%>
<%foreach (var prop2 in value.GetType().GetProperties().Where(x => x.GetIndexParameters().Count() == 0)) {%>
<li>
<%=Html.Encode(prop2.Name)%>
<%=Html.Encode(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">
<%=Html.Encode(display.Prefix)%></span>
<%=Html.Encode(display.Model.GetType().Name)%>
(<%=Html.Encode(display.Model.GetType().Namespace)%>)
Prefix:<%=Html.Encode(display.Prefix ?? "(null)")%>
Zone:<%=Html.Encode(display.ZoneName ?? "(null)")%>
Position:<%=Html.Encode(display.Position ?? "(null)")%>
<div style="margin-left: 20px; border: solid 1px black;">
<%=Html.DisplayFor(x => display.Model, display.TemplateName, display.Prefix)%>
</div>
<div id="footer">
<% Html.Include("footer"); %>
</li>
<%
}%>
</ul>
<h3>Editors</h3>
<ul>
<%foreach (var editor in Model.Editors) {%>
<li><span style="font-weight: bold">
<%=Html.Encode(editor.Prefix) %></span>
<%=Html.Encode(editor.Model.GetType().Name) %>
(<%=Html.Encode(editor.Model.GetType().Namespace) %>)
Prefix:<%=Html.Encode(editor.Prefix ?? "(null)")%>
Zone:<%=Html.Encode(editor.ZoneName ?? "(null)")%>
Position:<%=Html.Encode(editor.Position??"(null)") %>
<div style="margin-left: 20px; border: solid 1px black;">
<%=Html.EditorFor(x=>editor.Model, editor.TemplateName, editor.Prefix) %>
</div>
</div>
</body>
</html>
</li>
<%
}%>
</ul>

View File

@@ -1,27 +1,7 @@
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage<Orchard.DevTools.ViewModels.ContentIndexViewModel>" %>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<!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>TwoColumns</title>
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="innerheader">
<% Html.Include("header"); %>
</div>
</div>
<div id="page">
<div id="sideBar">
<% Html.Include("Navigation"); %>
</div>
<div id="main">
<h3>Content Types</h3>
<ul>
<%foreach(var item in Model.Types.OrderBy(x=>x.Name)){%>
@@ -38,13 +18,3 @@
<%}%>
</ul>
</div>
<div id="footer">
<% Html.Include("footer"); %>
</div>
</div>
</body>
</html>

View File

@@ -2,37 +2,4 @@
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
<%@ Import Namespace="Orchard.Mvc.Html"%>
<!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>TwoColumns</title>
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
<div id="innerheader">
<% Html.Include("header"); %>
</div>
</div>
<div id="page">
<div id="sideBar">
<% Html.Include("Navigation"); %>
</div>
<div id="main">
<p><%=Html.ActionLink("Contents", "Index", "Content") %></p>
</div>
<div id="footer">
<% Html.Include("footer"); %>
</div>
</div>
</body>
</html>