Started on PartialViewMacros
This commit is contained in:
@@ -1,11 +1,50 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI.WebControls;
|
||||
using Umbraco.Core.IO;
|
||||
|
||||
namespace Umbraco.Web.UI.Umbraco.Developer.Macros
|
||||
{
|
||||
public partial class EditMacro : global::umbraco.cms.presentation.developer.editMacro
|
||||
{
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
PopulatePartialViewFiles();
|
||||
}
|
||||
|
||||
private void PopulatePartialViewFiles()
|
||||
{
|
||||
var partialsDir = IOHelper.MapPath(SystemDirectories.MvcViews + "/MacroPartials");
|
||||
var views = GetPartialViewFiles(partialsDir, partialsDir);
|
||||
PartialViewList.DataSource = views;
|
||||
PartialViewList.DataBind();
|
||||
PartialViewList.Items.Insert(0, new ListItem("Browse partial view files on server...", string.Empty));
|
||||
}
|
||||
|
||||
private IEnumerable<string> GetPartialViewFiles(string orgPath, string path)
|
||||
{
|
||||
var files = new List<string>();
|
||||
var dirInfo = new DirectoryInfo(path);
|
||||
|
||||
// Populate subdirectories
|
||||
var dirInfos = dirInfo.GetDirectories();
|
||||
foreach (var dir in dirInfos)
|
||||
{
|
||||
files.AddRange(GetPartialViewFiles(orgPath, path + "/" + dir.Name));
|
||||
}
|
||||
|
||||
var fileInfo = dirInfo.GetFiles("*.*");
|
||||
|
||||
files.AddRange(fileInfo.Select(file => (path.Replace(orgPath, string.Empty).Trim('/') + "/" + file.Name).Trim('/')));
|
||||
return files;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -11,5 +11,23 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Macros {
|
||||
|
||||
|
||||
public partial class EditMacro {
|
||||
|
||||
/// <summary>
|
||||
/// SelectedPartialView control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox SelectedPartialView;
|
||||
|
||||
/// <summary>
|
||||
/// PartialViewList control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList PartialViewList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,10 +3,20 @@
|
||||
|
||||
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
|
||||
<asp:Content ContentPlaceHolderID="head" runat="server">
|
||||
<script language="javascript">
|
||||
<script type="text/javascript">
|
||||
function doSubmit() {
|
||||
document.forms.aspnetForm.submit();
|
||||
}
|
||||
|
||||
//handles the change selection of the drop downs to populate the text box
|
||||
(function($) {
|
||||
$(document).ready(function () {
|
||||
$("#Table2 td.propertyContent select").change(function() {
|
||||
$(this).prev("input[type='text']").val($(this).val());
|
||||
});
|
||||
});
|
||||
})(jQuery);
|
||||
|
||||
</script>
|
||||
</asp:Content>
|
||||
<asp:Content ContentPlaceHolderID="body" runat="server">
|
||||
@@ -32,11 +42,22 @@
|
||||
</table>
|
||||
</cc1:Pane>
|
||||
<cc1:Pane ID="Pane1_2" BackColor="mediumaquamarine" runat="server">
|
||||
<table id="Table2" cellspacing="0" cellpadding="4" width="98%" border="0" runat="server">
|
||||
<table id="Table2" cellspacing="0" cellpadding="4" width="98%" border="0">
|
||||
<tr>
|
||||
<td class="propertyHeader" width="30%">
|
||||
<img alt="Xslt Icon" src="../../images/umbraco/developerXslt.gif" align="absMiddle">
|
||||
Use XSLT file
|
||||
<img alt="python Icon" src="../../images/umbraco/developerScript.gif" align="absMiddle" />
|
||||
Use MVC Partial View
|
||||
</td>
|
||||
<td class="propertyContent">
|
||||
<asp:TextBox ID="SelectedPartialView" runat="server" Width="230px" CssClass="guiInputText"></asp:TextBox>
|
||||
<asp:DropDownList ID="PartialViewList" runat="server" >
|
||||
</asp:DropDownList>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="propertyHeader" width="30%">
|
||||
<img alt="Xslt Icon" src="../../images/umbraco/developerXslt.gif" align="absMiddle"/>
|
||||
or XSLT file
|
||||
</td>
|
||||
<td class="propertyContent">
|
||||
<asp:TextBox ID="macroXslt" runat="server" Width="230px" CssClass="guiInputText"></asp:TextBox>
|
||||
@@ -46,7 +67,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="propertyHeader" width="30%">
|
||||
<img alt="User control Icon" src="../../images/developer/userControlIcon.png" align="absMiddle">
|
||||
<img alt="User control Icon" src="../../images/developer/userControlIcon.png" align="absMiddle"/>
|
||||
or .NET User Control
|
||||
</td>
|
||||
<td class="propertyContent">
|
||||
@@ -58,8 +79,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="propertyHeader" valign="top" width="30%">
|
||||
<img alt="Custom Control Icon" src="../../images/developer/customControlIcon.png"
|
||||
align="absMiddle">
|
||||
<img alt="Custom Control Icon" src="../../images/developer/customControlIcon.png" align="absMiddle"/>
|
||||
or .NET Custom Control
|
||||
</td>
|
||||
<td class="propertyContent">
|
||||
@@ -72,7 +92,7 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="propertyHeader" width="30%">
|
||||
<img alt="python Icon" src="../../images/umbraco/developerScript.gif" align="absMiddle">
|
||||
<img alt="python Icon" src="../../images/umbraco/developerScript.gif" align="absMiddle"/>
|
||||
or script file
|
||||
</td>
|
||||
<td class="propertyContent">
|
||||
|
||||
Reference in New Issue
Block a user