Add content using this DocumentType dropdown to the toolbar

This commit is contained in:
agrath@gmail.com
2012-06-14 08:41:50 -01:00
parent b82104591f
commit 53f549826e
3 changed files with 68 additions and 2 deletions

View File

@@ -94,7 +94,29 @@
</cc2:Pane>
</asp:Panel>
<div id="splitButtonContent" style="display: inline; height: 23px; vertical-align: top;">
<a href="#" onclick="return false;" id="sbContent" class="sbLink">
<img alt="Content that Uses this Template" src="../images/editor/doc.gif" title="Content that Uses this Template"
style="vertical-align: top;">
</a>
</div>
<div id="contentMenu" style="width: 285px">
<div class="contentitem">
<strong>Content that Uses this Document Type</strong>
</div>
<div class="contentitem" runat="server" id="uxNoContent">
None
</div>
<asp:Repeater ID="splitButtonContentRepeater" runat="server" OnItemDataBound="splitButtonContentRepeater_ItemDataBound">
<ItemTemplate>
<div class="contentitem">
<asp:Literal runat="server" ID="uxName"></asp:Literal>
&nbsp;
<asp:PlaceHolder runat="server" ID="uxLink"></asp:PlaceHolder>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<script type="text/javascript">
$(function () {
var mailControlId = '<asp:Literal id="theClientId" runat="server"/>';

View File

@@ -15,6 +15,7 @@ using umbraco.IO;
using umbraco.presentation;
using umbraco.cms.businesslogic;
using umbraco.BasePages;
using Tuple = System.Tuple;
namespace umbraco.controls
{
@@ -100,8 +101,16 @@ namespace umbraco.controls
}
theClientId.Text = this.ClientID;
}
LoadContent();
}
private void LoadContent()
{
var data = cType.GetContent();
splitButtonContentRepeater.DataSource = data;
splitButtonContentRepeater.DataBind();
uxNoContent.Visible = !data.Any();
}
protected void save_click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// 2011 01 06 - APN - Modified method to update Xml caches if a doctype alias changed,
@@ -239,6 +248,9 @@ jQuery(function() { refreshDropDowns(); });
txtAlias.Text = cType.Alias;
description.Text = cType.GetRawDescription();
InfoTabPage.Menu.InsertSplitter();
InfoTabPage.Menu.NewElement("div", "splitButtonContentPlaceHolder", "sbPlaceHolder", 40);
}
#endregion
@@ -908,6 +920,20 @@ Umbraco.Controls.TabView.onActiveTabChange(function(tabviewid, tabid, tabs) {
#endregion
protected void splitButtonContentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
System.Tuple<int, string> item = e.Item.DataItem as System.Tuple<int, string>;
if (item != null)
{
Literal uxName = e.Item.FindControl("uxName") as Literal;
PlaceHolder uxLink = e.Item.FindControl("uxLink") as PlaceHolder;
uxName.Text = item.Item2;
uxLink.Controls.Add(new LiteralControl(umbraco.cms.helpers.DeepLink.GetAnchor(umbraco.cms.helpers.DeepLinkType.Content, item.Item1.ToString(), true)));
}
}
}
}

View File

@@ -336,6 +336,24 @@ namespace umbraco.controls {
/// </remarks>
protected global::System.Web.UI.WebControls.PlaceHolder PropertyTypes;
/// <summary>
/// uxNoContent control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.HtmlControls.HtmlGenericControl uxNoContent;
/// <summary>
/// splitButtonContentRepeater 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.Repeater splitButtonContentRepeater;
/// <summary>
/// theClientId control.
/// </summary>