This commit is contained in:
shannon@ShandemVaio.home
2012-06-22 13:02:58 -02:00
38 changed files with 524 additions and 188 deletions
+6 -1
View File
@@ -11,4 +11,9 @@ These notes will form the release notes that go out with each public release
GE 11/06/2012:
Fixed deep linking to Content,Media,DocumentType,MediaType,DataType,Css,Javascript,Razor,XSLT and
added a umbraco.cms.helpers.DeepLink.get class to return valid links based on type and
id (or file path in the case of js/xslt/razor)
id (or file path in the case of js/xslt/razor)
GE 11/06/2012:
Added links from Document Types to templates via an Edit > link in the checkbox list
Rewrote the databinding in DocumentType for Template selection to clean it up
Added links from the Template to the Document Type via a new drop down menu in the toolbar
Updated umbraco.cms.helpers.DeepLink.Get to be .GetUrl and .GetAnchor and support internal links without page refresh
@@ -36,7 +36,7 @@
<SccProvider>
</SccProvider>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -52,6 +52,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
// Runtime Version:4.0.30319.544
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -23,7 +23,7 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -39,6 +39,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -41,11 +41,12 @@
<ItemGroup>
<Reference Include="Examine">
<HintPath>..\foreign dlls\Examine.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="HtmlAgilityPack, Version=1.3.0.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
<HintPath>..\foreign dlls\HtmlAgilityPack.dll</HintPath>
</Reference>
<Reference Include="Lucene.Net, Version=2.9.2.2, Culture=neutral, processorArchitecture=MSIL">
<Reference Include="Lucene.Net">
<HintPath>..\foreign dlls\Lucene.Net.dll</HintPath>
</Reference>
<Reference Include="System" />
@@ -70,6 +71,7 @@
<Reference Include="System.Xml" />
<Reference Include="UmbracoExamine">
<HintPath>..\foreign dlls\UmbracoExamine.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
</Reference>
</ItemGroup>
<ItemGroup>
@@ -37,7 +37,7 @@
</SccProvider>
<OldToolsVersion>3.5</OldToolsVersion>
<IsWebBootstrapper>true</IsWebBootstrapper>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>http://localhost/businesslogic/</PublishUrl>
<Install>true</Install>
<InstallFrom>Web</InstallFrom>
@@ -52,6 +52,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
@@ -101,9 +102,7 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System"/>
<Reference Include="System.configuration" />
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
+26
View File
@@ -12,7 +12,9 @@ using umbraco.cms.businesslogic.language;
using umbraco.cms.businesslogic.propertytype;
using umbraco.cms.businesslogic.web;
using umbraco.DataLayer;
using Tuple = System.Tuple;
using umbraco.BusinessLogic;
using umbraco.DataLayer.SqlHelpers.MySql;
[assembly: InternalsVisibleTo("Umbraco.Test")]
@@ -851,6 +853,30 @@ namespace umbraco.cms.businesslogic
base.delete();
}
public IEnumerable<System.Tuple<int, string>> GetContent()
{
List<System.Tuple<int, string>> list = new List<System.Tuple<int, string>>();
bool mySQL = (SqlHelper.GetType() == typeof(MySqlHelper));
string sql = string.Empty;
if (!mySQL)
{
sql = "Select top (100) cmsContent.nodeid, cmsDocument.text from cmsContent join cmsDocument on cmsDocument.nodeId = cmsContent.nodeid where cmsdocument.published = 1 and cmscontent.contentType = " + this.Id;
}
else
{
sql = "Select cmsContent.nodeid, cmsDocument.text from cmsContent join cmsDocument on cmsDocument.nodeId = cmsContent.nodeid where cmsdocument.published = 1 and cmscontent.contentType = " + this.Id + " limit 0,100";
}
using (IRecordsReader dr = SqlHelper.ExecuteReader(sql))
{
while (dr.Read())
{
list.Add(new System.Tuple<int, string>(dr.GetInt("nodeid"), dr.GetString("text")));
}
dr.Close();
}
return list;
}
#endregion
#region Protected Methods
@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
// Runtime Version:4.0.30319.544
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
+1
View File
@@ -6,6 +6,7 @@ using System.Collections;
namespace umbraco.cms.businesslogic
{
[Obsolete("umbraco.cms.businesslogic.Tuple<T,T2> is Obsolete, use System.Tuple instead")]
public class Tuple<T, T2> : IEquatable<Tuple<T, T2>>
{
public T first { get; set; }
@@ -11,6 +11,8 @@ namespace umbraco.cms.businesslogic.macro
{
private static readonly Dictionary<string, Type> m_engines = new Dictionary<string, Type>();
private static readonly List<IMacroEngine> m_allEngines = new List<IMacroEngine>();
private static object locker = new object();
public MacroEngineFactory()
{
Initialize();
@@ -39,7 +41,11 @@ namespace umbraco.cms.businesslogic.macro
{
try
{
m_engines.Add(typeInstance.Name, t);
lock (locker)
{
if (!m_engines.ContainsKey(typeInstance.Name))
m_engines.Add(typeInstance.Name, t);
}
}
catch (Exception ee)
{
+35 -2
View File
@@ -12,6 +12,8 @@ using umbraco.BusinessLogic;
using umbraco.IO;
using System.Web;
using umbraco.cms.businesslogic.web;
using Tuple = System.Tuple;
using umbraco.DataLayer.SqlHelpers.MySql;
namespace umbraco.cms.businesslogic.template
{
@@ -326,8 +328,39 @@ namespace umbraco.cms.businesslogic.template
}
}
public IEnumerable<DocumentType> GetDocumentTypes()
{
return DocumentType.GetAllAsList().Where(x => x.allowedTemplates.Select(t => t.Id).Contains(this.Id));
}
public IEnumerable<System.Tuple<int, string>> GetContent()
{
List<System.Tuple<int, string>> list = new List<System.Tuple<int, string>>();
bool mySQL = (SqlHelper.GetType() == typeof(MySqlHelper));
string sql = string.Empty;
if (!mySQL)
{
sql = "Select top (100) nodeid, text from cmsDocument where published = 1 and templateId = " + this.Id;
}
else
{
sql = "Select nodeid, text from cmsDocument where published = 1 and templateId = " + this.Id + " limit 0,100";
}
using (IRecordsReader dr = SqlHelper.ExecuteReader(sql))
{
int i = 0;
while (dr.Read())
{
list.Add(new System.Tuple<int, string>(dr.GetInt("nodeid"), dr.GetString("text")));
i++;
if (i >= 100)
{
break;
}
}
dr.Close();
}
return list;
}
public static Template MakeNew(string Name, BusinessLogic.User u, Template master)
{
@@ -124,7 +124,7 @@ namespace umbraco.cms.businesslogic.workflow
summary.Append("<tr>");
summary.Append("<th style='text-align: left; vertical-align: top; width: 25%;'>" +
p.PropertyType.Name + "</th>");
summary.Append("<style='text-align: left; vertical-align: top;'>" + p.Value + "</td>");
summary.Append("<td style='text-align: left; vertical-align: top;'>" + p.Value.ToString() + "</td>");
summary.Append("</tr>");
}
summary.Append(
+26 -2
View File
@@ -23,7 +23,23 @@ namespace umbraco.cms.helpers
string sPath = string.Join(",", treePath.ToArray());
return sPath;
}
public static string Get(DeepLinkType type, string idOrFilePath)
public static string GetAnchor(DeepLinkType type, string idOrFilePath, bool useJavascript)
{
string url = GetUrl(type, idOrFilePath, useJavascript);
if (!string.IsNullOrEmpty(url))
{
if (!useJavascript)
{
return string.Format("<a href=\"{0}\" target=\"_blank\">{1}&nbsp;&gt;</a>", url, ui.GetText("general", "edit"));
}
else
{
return string.Format("<a href=\"{0}\">{1}&nbsp;&gt;</a>", url, ui.GetText("general", "edit"));
}
}
return null;
}
public static string GetUrl(DeepLinkType type, string idOrFilePath, bool useJavascript)
{
string basePath = "/umbraco/umbraco.aspx";
@@ -98,7 +114,15 @@ namespace umbraco.cms.helpers
if (currentUser.Applications.Any(app => app.alias == section))
{
string rightAction = string.Format("{0}?{1}={2}", editorUrl, idKey, idOrFilePath);
return string.Format("{0}?app={1}&rightAction={2}#{1}", basePath, section, HttpContext.Current.Server.UrlEncode(rightAction));
if (!useJavascript)
{
string rightActionEncoded = HttpContext.Current.Server.UrlEncode(rightAction);
return string.Format("{0}?app={1}&rightAction={2}#{1}", basePath, section, rightActionEncoded);
}
else
{
return string.Format("javascript:UmbClientMgr.contentFrameAndSection('{0}','{1}');", section, rightAction);
}
}
}
}
+3 -1
View File
@@ -36,7 +36,7 @@
<SccProvider>
</SccProvider>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -52,6 +52,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>bin\Debug\</OutputPath>
@@ -129,6 +130,7 @@
<Reference Include="System.Web">
<Name>System.Web</Name>
</Reference>
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Web.Extensions">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
Binary file not shown.
@@ -107,8 +107,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\foreign dlls\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="Lucene.Net, Version=2.9.2.2, Culture=neutral, processorArchitecture=MSIL">
<HintPath>C:\Users\Shannon\Documents\Visual Studio 2008\Projects\Umbraco\Branch-4.1\foreign dlls\Lucene.Net.dll</HintPath>
<Reference Include="Lucene.Net, Version=2.9.4.1, Culture=neutral, PublicKeyToken=85089178b9ac3181, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\foreign dlls\Lucene.Net.dll</HintPath>
</Reference>
<Reference Include="Our.Umbraco.uGoLive">
<HintPath>..\..\foreign dlls\Our.Umbraco.uGoLive.dll</HintPath>
@@ -1721,10 +1722,13 @@
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Content Include="App_Data\Umbraco.sdf" />
<Content Include="config\splashes\booting.aspx" />
<Content Include="config\splashes\noNodes.aspx" />
<Content Include="umbraco\controls\Tree\CustomTreeService.asmx" />
<Content Include="umbraco\images\delete.gif" />
<Content Include="umbraco\images\editor\doc.gif" />
<Content Include="umbraco\images\editor\documentType.gif" />
<Content Include="umbraco\images\information.png" />
<Content Include="umbraco\Trees\RelationTypes\EditRelationType.aspx" />
<Content Include="umbraco\Trees\RelationTypes\Images\Bidirectional.png" />
@@ -3315,7 +3319,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Code\" />
<Folder Include="App_Data\" />
<Folder Include="css\" />
<Folder Include="data\previews\" />
<Folder Include="data\preview\" />
@@ -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"/>';
@@ -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,
@@ -224,7 +233,7 @@ namespace umbraco.controls
ddlThumbnails.Items.Add(li);
}
Page.ClientScript.RegisterStartupScript(this.GetType(), "thumbnailsDropDown", @"
Page.ClientScript.RegisterStartupScript(this.GetType(), "thumbnailsDropDown", @"
function refreshDropDowns() {
if (jQuery('#" + ddlIcons.ClientID + @" option').length <= 100)
jQuery('#" + ddlIcons.ClientID + @"').msDropDown({ showIcon: true, style: 'width:250px;' });
@@ -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
@@ -263,7 +275,8 @@ jQuery(function() { refreshDropDowns(); });
ContentType[] contentTypes = cType.GetAll();
foreach (cms.businesslogic.ContentType ct in contentTypes.OrderBy(x => x.Text))
{
ListItem li = new ListItem(ct.Text, ct.Id.ToString());
string text = string.Format("{0} {1}", ct.Text, umbraco.cms.helpers.DeepLink.GetAnchor(DeepLinkType.DocumentType, ct.Id.ToString(), true));
ListItem li = new ListItem(text, ct.Id.ToString());
dualAllowedContentTypes.Items.Add(li);
lstAllowedContentTypes.Items.Add(li);
foreach (int i in allowedIds)
@@ -907,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)));
}
}
}
}
@@ -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>
@@ -36,7 +36,8 @@ namespace umbraco.cms.presentation
controls.ContentControl cControl;
DropDownList ddlDefaultTemplate = new DropDownList();
RadioButtonList rblDefaultTemplate = new RadioButtonList();
HtmlGenericControl rblDefaultTemplateScrollingPanel = new HtmlGenericControl("div");
uicontrols.Pane publishProps = new uicontrols.Pane();
uicontrols.Pane linkProps = new uicontrols.Pane();
@@ -131,7 +132,7 @@ namespace umbraco.cms.presentation
// Template
PlaceHolder template = new PlaceHolder();
cms.businesslogic.web.DocumentType DocumentType = new cms.businesslogic.web.DocumentType(_document.ContentType.Id);
cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(DocumentType.Text));
cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(string.Format("{0} {1}", DocumentType.Text, umbraco.cms.helpers.DeepLink.GetAnchor(DeepLinkType.DocumentType, _document.ContentType.Id.ToString(), true))));
@@ -153,15 +154,7 @@ namespace umbraco.cms.presentation
}
else
{
ddlDefaultTemplate.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
foreach (cms.businesslogic.template.Template t in DocumentType.allowedTemplates)
{
ListItem tTemp = new ListItem(t.Text, t.Id.ToString());
if (t.Id == defaultTemplate)
tTemp.Selected = true;
ddlDefaultTemplate.Items.Add(tTemp);
}
template.Controls.Add(ddlDefaultTemplate);
AddDefaultTemplateControl(defaultTemplate, ref template, ref DocumentType);
}
@@ -210,8 +203,8 @@ namespace umbraco.cms.presentation
return;
// clear preview cookie
// zb-00004 #29956 : refactor cookies names & handling
StateHelper.Cookies.Preview.Clear();
// zb-00004 #29956 : refactor cookies names & handling
StateHelper.Cookies.Preview.Clear();
if (!IsPostBack)
{
@@ -267,9 +260,9 @@ namespace umbraco.cms.presentation
_document.ExpireDate = new DateTime(1, 1, 1, 0, 0, 0);
// Update default template
if (ddlDefaultTemplate.SelectedIndex > 0)
if (rblDefaultTemplate.SelectedIndex > 0)
{
_document.Template = int.Parse(ddlDefaultTemplate.SelectedValue);
_document.Template = int.Parse(rblDefaultTemplate.SelectedValue);
}
else
{
@@ -450,23 +443,24 @@ namespace umbraco.cms.presentation
/// <param name="defaultTemplate"></param>
/// <param name="template"></param>
/// <param name="DocumentType"></param>
private void AddTemplateDropDown(int defaultTemplate, ref PlaceHolder template, ref cms.businesslogic.web.DocumentType DocumentType)
private void AddDefaultTemplateControl(int defaultTemplate, ref PlaceHolder template, ref cms.businesslogic.web.DocumentType documentType)
{
string permissions = this.getUser().GetPermissions(_document.Path);
if (permissions.IndexOf(ActionUpdate.Instance.Letter) >= 0)
{
ddlDefaultTemplate.Items.Add(new ListItem(ui.Text("choose") + "...", ""));
foreach (cms.businesslogic.template.Template t in DocumentType.allowedTemplates)
{
ListItem tTemp = new ListItem(t.Text, t.Id.ToString());
if (t.Id == defaultTemplate)
tTemp.Selected = true;
ddlDefaultTemplate.Items.Add(tTemp);
}
rblDefaultTemplateScrollingPanel = new HtmlGenericControl("div");
rblDefaultTemplateScrollingPanel.Style.Add(HtmlTextWriterStyle.Overflow, "auto");
rblDefaultTemplateScrollingPanel.Style.Add("min-height", "15px");
rblDefaultTemplateScrollingPanel.Style.Add("max-height", "50px");
rblDefaultTemplateScrollingPanel.Style.Add("width", "300px");
rblDefaultTemplateScrollingPanel.Style.Add("display", "inline-block");
rblDefaultTemplate.RepeatDirection = RepeatDirection.Horizontal;
rblDefaultTemplate.RepeatColumns = 3;
rblDefaultTemplateScrollingPanel.Controls.Add(rblDefaultTemplate);
template.Controls.Add(rblDefaultTemplateScrollingPanel);
template.Controls.Add(ddlDefaultTemplate);
BindTemplateControl(defaultTemplate, ref documentType);
}
else
{
@@ -477,7 +471,25 @@ namespace umbraco.cms.presentation
}
}
private void BindTemplateControl(int defaultTemplate, ref cms.businesslogic.web.DocumentType documentType)
{
rblDefaultTemplate.Items.Add(new ListItem("None", ""));
bool selected = false;
foreach (cms.businesslogic.template.Template t in documentType.allowedTemplates)
{
ListItem tTemp = new ListItem(string.Format("{0} {1}", t.Text, umbraco.cms.helpers.DeepLink.GetAnchor(DeepLinkType.Template, t.Id.ToString(), true)), t.Id.ToString());
if (t.Id == defaultTemplate)
{
tTemp.Selected = true;
selected = true;
}
rblDefaultTemplate.Items.Add(tTemp);
}
if (!selected)
{
rblDefaultTemplate.SelectedIndex = 0;
}
}
private void addPreviewButton(uicontrols.ScrollingMenu menu, int id)
{
menu.InsertSplitter(2);
Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

@@ -3,6 +3,21 @@
<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %>
<%@ Register TagPrefix="uc1" TagName="ContentTypeControlNew" Src="../controls/ContentTypeControlNew.ascx" %>
<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %>
<asp:Content ContentPlaceHolderID="head" runat="server">
<umb:CssInclude ID="CssInclude1" runat="server" FilePath="splitbutton/splitbutton.css"
PathNameAlias="UmbracoClient" />
<umb:JsInclude ID="JsInclude" runat="server" FilePath="splitbutton/jquery.splitbutton.js"
PathNameAlias="UmbracoClient" Priority="1" />
<script type="text/javascript">
jQuery(document).ready(function () {
//content split button
jQuery('#sbContent').splitbutton({ menu: '#contentMenu' });
jQuery("#splitButtonContent").appendTo("#splitButtonContentPlaceHolder");
applySplitButtonOverflow('contentUsedContainer', 'innerContentUsedContainer', 'contentMenu', '.contentitem', 'showMoreContent');
});
</script>
</asp:Content>
<asp:Content ContentPlaceHolderID="body" runat="server">
<uc1:ContentTypeControlNew ID="ContentTypeControlNew1" runat="server"></uc1:ContentTypeControlNew>
<cc1:Pane ID="tmpPane" runat="server">
@@ -10,6 +10,8 @@ using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using umbraco.cms.presentation.Trees;
using umbraco.cms.businesslogic.web;
using System.Linq;
using umbraco.cms.helpers;
namespace umbraco.settings
{
@@ -49,59 +51,54 @@ namespace umbraco.settings
}
private void bindTemplates()
{
cms.businesslogic.template.Template[] selectedTemplates = dt.allowedTemplates;
DataTable dtAllowedTemplates = new DataTable();
dtTemplates.Columns.Add("name");
dtTemplates.Columns.Add("id");
dtTemplates.Columns.Add("selected");
ddlTemplates.Items.Add(new ListItem("Ingen template", "0"));
foreach (cms.businesslogic.template.Template t in cms.businesslogic.template.Template.GetAllAsList())
{
DataRow dr = dtTemplates.NewRow();
dr["name"] = t.Text;
dr["id"] = t.Id;
dr["selected"] = false;
foreach (cms.businesslogic.template.Template t1 in selectedTemplates)
if (t1 != null && t1.Id == t.Id)
dr["selected"] = true;
dtTemplates.Rows.Add(dr);
}
var templates = (from t in cms.businesslogic.template.Template.GetAllAsList()
join at in dt.allowedTemplates on t.Id equals at.Id into at_l
from at in at_l.DefaultIfEmpty()
select new
{
Id = t.Id,
Name = t.Text,
Selected = at != null
}).ToList();
templateList.Items.Clear();
foreach (DataRow dr in dtTemplates.Rows)
templateList.Items.AddRange(templates.ConvertAll(item =>
{
ListItem li = new ListItem(dr["name"].ToString(), dr["id"].ToString());
if (bool.Parse(dr["selected"].ToString()))
li.Selected = true;
templateList.Items.Add(li);
}
string anchor = DeepLink.GetAnchor(DeepLinkType.Template, item.Id.ToString(), true);
ListItem li = new ListItem();
if (!string.IsNullOrEmpty(anchor))
{
li.Text = string.Format("{0} {1}", item.Name, anchor);
}
else
{
li.Text = item.Name;
}
li.Value = item.Id.ToString();
li.Selected = item.Selected;
return li;
}).ToArray());
ddlTemplates.Enabled = templates.Any();
ddlTemplates.Items.Clear();
foreach (DataRow dr in dtTemplates.Rows)
{
ListItem li = new ListItem(dr["name"].ToString(), dr["id"].ToString());
if (li.Value == dt.DefaultTemplate.ToString())
li.Selected = true;
if (bool.Parse(dr["selected"].ToString()))
ddlTemplates.Items.Add(li);
}
if (ddlTemplates.Items.Count > 0) ddlTemplates.Enabled = true;
else ddlTemplates.Enabled = false;
// Add choose to ddlTemplates
ddlTemplates.Items.Insert(0, new ListItem(ui.Text("choose") + "...", "0"));
ddlTemplates.Items.AddRange(templates.ConvertAll(item =>
{
ListItem li = new ListItem();
li.Text = item.Name;
li.Value = item.Id.ToString();
return li;
}).ToArray());
var ddlTemplatesSelect = ddlTemplates.Items.FindByValue(dt.DefaultTemplate.ToString());
if (ddlTemplatesSelect != null) ddlTemplatesSelect.Selected = true;
}
protected override bool OnBubbleEvent(object source, EventArgs args)
{
bool handled = false;
@@ -12,6 +12,24 @@ namespace umbraco.settings {
public partial class EditContentTypeNew {
/// <summary>
/// CssInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.CssInclude CssInclude1;
/// <summary>
/// JsInclude control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::ClientDependency.Core.Controls.JsInclude JsInclude;
/// <summary>
/// tmpPane control.
/// </summary>
@@ -9,23 +9,13 @@
<umb:JsInclude ID="JsInclude" runat="server" FilePath="splitbutton/jquery.splitbutton.js"
PathNameAlias="UmbracoClient" Priority="1" />
<script language="javascript" type="text/javascript">
jQuery(document).ready(function() {
//macro split button
jQuery('#sbMacro').splitbutton({menu:'#macroMenu'});
jQuery('#sbMacro').splitbutton({menu:'#macroMenu'});
jQuery("#splitButtonMacro").appendTo("#splitButtonMacroPlaceHolder");
jQuery(".macro").click(function(){
var alias = jQuery(this).attr("rel");
if(jQuery(this).attr("params") == "1")
if(jQuery(this).attr("params") == "1")
{
openMacroModal(alias);
}
@@ -34,84 +24,28 @@
insertMacro(alias);
}
});
applySplitButtonOverflow('mcontainer','innerc','macroMenu','.macro', 'showMoreMacros');
//document types split button
jQuery('#sbDocType').splitbutton({menu:'#docTypeMenu'});
jQuery("#splitButtonDocType").appendTo("#splitButtonDocTypePlaceHolder");
applySplitButtonOverflow('docTypesReferencingContainer','innerdocTypesReferencingContainer','docTypeMenu','.documenttype', 'showMoreDocTypes');
//hack for the dropdown scrill
jQuery("<div id='mcontainer'><div id='innerc' style='position:relative;'><div></div>").appendTo("#macroMenu");
jQuery(".macro").each(function(){
jQuery("#innerc").append(this);
});
//only needed when we need to add scroll to macro menu
var maxHeight = 500;
var menu = jQuery("#macroMenu");
var container = jQuery("#mcontainer");
var menuHeight = menu.height();
if (menuHeight > maxHeight) {
jQuery("<div id='showmore' class='menudown'><span>&nbsp;&nbsp;&nbsp;&nbsp;</span></div>").appendTo("#macroMenu");
menu.css({
height: maxHeight,
overflow: "hidden"
})
container.css({
height: maxHeight - 20,
overflow: "hidden"
});
var interval;
jQuery("#showmore").hover(function(e) {
interval = setInterval(function() {
var offset = jQuery("#innerc").offset();
var currentTop = jQuery("#innerc").css("top").replace("px","");
if(Number(currentTop) > -(menuHeight - 40))
{
jQuery("#innerc").css("top", currentTop -20);
}
}, 125);
}, function() {
clearInterval(interval);
});
jQuery("#splitButtonMacro").hover(function(e) {
jQuery("#innerc").css("top", 0)
});
}
//content split button
jQuery('#sbContent').splitbutton({menu:'#contentMenu'});
jQuery("#splitButtonContent").appendTo("#splitButtonContentPlaceHolder");
applySplitButtonOverflow('contentUsedContainer','innerContentUsedContainer','contentMenu','.contentitem', 'showMoreContent');
//razor macro split button
jQuery('#sb').splitbutton({menu:'#codeTemplateMenu'});
jQuery("#splitButton").appendTo("#splitButtonPlaceHolder");
jQuery(".codeTemplate").click(function(){
jQuery(".codeTemplate").click(function(){
insertCodeBlockFromTemplate(jQuery(this).attr("rel"));
});
});
function doSubmit() {
var codeVal = UmbEditor.GetCode();
umbraco.presentation.webservices.codeEditorSave.SaveTemplate(jQuery('#<%= NameTxt.ClientID %>').val(), jQuery('#<%= AliasTxt.ClientID %>').val(), codeVal, '<%= Request.QueryString["templateID"] %>', jQuery('#<%= MasterTemplate.ClientID %>').val(), submitSucces, submitFailure);
@@ -292,9 +226,56 @@
</ItemTemplate>
</asp:Repeater>
</div>
<script type="text/javascript">
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
<div id="splitButtonDocType" style="display: inline; height: 23px; vertical-align: top;">
<a href="#" onclick="return false;" id="sbDocType" class="sbLink">
<img alt="Document Types that Use this Template" src="../images/editor/documentType.gif" title="Document Types that Use this Template"
style="vertical-align: top;">
</a>
</div>
<div id="docTypeMenu" style="width: 285px">
<div class="documenttype">
<strong>Document Types that Use this Template</strong>
</div>
<div class="documenttype" runat="server" id="uxNoDocumentTypes">
None
</div>
<asp:Repeater ID="splitButtonDocumentTypesRepeater" runat="server">
<ItemTemplate>
<div class="documenttype">
<%# DataBinder.Eval(Container, "DataItem.Text")%>
&nbsp;
<%#umbraco.cms.helpers.DeepLink.GetAnchor(umbraco.cms.helpers.DeepLinkType.DocumentType, string.Format("{0}",DataBinder.Eval(Container,"DataItem.Id")), true)%>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<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 Template</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">
jQuery(document).ready(function () {
UmbClientMgr.appActions().bindSaveShortCut();
});
</script>
</asp:Content>
@@ -11,6 +11,7 @@ using umbraco.cms.presentation.Trees;
using umbraco.DataLayer;
using umbraco.IO;
using umbraco.uicontrols;
using System.Linq;
namespace umbraco.cms.presentation.settings
{
@@ -77,9 +78,39 @@ namespace umbraco.cms.presentation.settings
LoadScriptingTemplates();
LoadMacros();
LoadDocTypes();
LoadContent();
}
}
protected void splitButtonDocumentTypesRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Tuple<int, string> item = e.Item.DataItem as 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(helpers.DeepLinkType.DocumentType, item.Item1.ToString(), true)));
}
}
}
protected void splitButtonContentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Tuple<int, string> item = e.Item.DataItem as 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(helpers.DeepLinkType.Content, item.Item1.ToString(), true)));
}
}
}
protected override void OnInit(EventArgs e)
{
@@ -129,7 +160,6 @@ namespace umbraco.cms.presentation.settings
Panel1.Menu.NewElement("div", "splitButtonMacroPlaceHolder", "sbPlaceHolder", 40);
if (UmbracoSettings.UseAspNetMasterPages)
{
Panel1.Menu.InsertSplitter();
@@ -169,6 +199,11 @@ namespace umbraco.cms.presentation.settings
"','canvas')";
}
Panel1.Menu.InsertSplitter();
Panel1.Menu.NewElement("div", "splitButtonDocTypePlaceHolder", "sbPlaceHolder", 40);
Panel1.Menu.InsertSplitter();
Panel1.Menu.NewElement("div", "splitButtonContentPlaceHolder", "sbPlaceHolder", 40);
// Help
Panel1.Menu.InsertSplitter();
@@ -220,6 +255,20 @@ namespace umbraco.cms.presentation.settings
macroRenderings.Close();
}
private void LoadDocTypes()
{
var data = _template.GetDocumentTypes();
splitButtonDocumentTypesRepeater.DataSource = data;
splitButtonDocumentTypesRepeater.DataBind();
uxNoDocumentTypes.Visible = !data.Any();
}
private void LoadContent()
{
var data = _template.GetContent();
splitButtonContentRepeater.DataSource = data;
splitButtonContentRepeater.DataBind();
uxNoContent.Visible = !data.Any();
}
public string DoesMacroHaveSettings(string macroId)
{
if (
@@ -137,5 +137,41 @@ namespace umbraco.cms.presentation.settings {
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::System.Web.UI.WebControls.Repeater rpt_macros;
/// <summary>
/// uxNoDocumentTypes 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 uxNoDocumentTypes;
/// <summary>
/// splitButtonDocumentTypesRepeater 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 splitButtonDocumentTypesRepeater;
/// <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;
}
}
@@ -53,7 +53,7 @@ namespace umbraco
try
{
xmlDocument.Load(item.GetPropertyAsString(propertyAlias));
xmlDocument.LoadXml(item.GetPropertyAsString(propertyAlias));
}
catch
{
@@ -288,7 +288,7 @@ namespace umbraco
try
{
xmlDocument.Load(node.GetPropertyAsString(propertyAlias));
xmlDocument.LoadXml(node.GetPropertyAsString(propertyAlias));
}
catch
{
@@ -94,6 +94,14 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
// windowMgr: function()
// return null;
// },
contentFrameAndSection: function(app, rightFrameUrl){
//this.appActions().shiftApp(app, this.uiKeys()['sections_' + app]);
var self = this;
self.mainWindow().UmbClientMgr.historyManager().addHistory(app,true);
window.setTimeout(function(){
self.mainWindow().UmbClientMgr.contentFrame(rightFrameUrl);
},200);
},
contentFrame: function(strLocation) {
/// <summary>
/// This will return the reference to the right content frame if strLocation is null or empty,
@@ -101,6 +109,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
/// </summary>
this._debug("contentFrame: " + strLocation);
if (strLocation == null || strLocation == "") {
if (typeof this.mainWindow().right != "undefined") {
return this.mainWindow().right;
@@ -121,12 +130,13 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
}
this._debug("contentFrame: parsed location: " + strLocation);
var self = this;
window.setTimeout(function(){
if (typeof this.mainWindow().right != "undefined") {
this.mainWindow().right.location.href = strLocation;
if (typeof self.mainWindow().right != "undefined") {
self.mainWindow().right.location.href = strLocation;
}
else {
this.mainWindow().location.href = strLocation; //set the current windows location if the right frame doesn't exist int he current context
self.mainWindow().location.href = strLocation; //set the current windows location if the right frame doesn't exist int he current context
}
},200);
}
@@ -81,9 +81,12 @@
function scrollL(elId, elHid, InnerWidth) {
doScroll = true;
el = document.getElementById(elId);
FromLeftMax = (InnerWidth - document.getElementById(elHid).offsetWidth)*-1;
scrollHorisontal(0);
el = document.getElementById(elId);
var hiddenEl = document.getElementById(elHid);
if (hiddenEl) {
FromLeftMax = (InnerWidth - hiddenEl.offsetWidth) * -1;
scrollHorisontal(0);
}
}
function scrollStop() {
@@ -484,4 +484,47 @@
return $.extend({}, $.fn.linkbutton.parseOptions(_11), { menu: t.attr("menu"), duration: t.attr("duration") });
};
$.fn.splitbutton.defaults = $.extend({}, $.fn.linkbutton.defaults, { plain: true, menu: null, duration: 100 });
})(jQuery);
})(jQuery);
function applySplitButtonOverflow(containerId, innerId, menuId, itemCssSelector, buttonId) {
//hack for the dropdown scrill
jQuery("<div id='" + containerId + "'><div id='" + innerId + "' style='position:relative;'></div></div>").appendTo("#" + menuId);
jQuery(itemCssSelector).each(function () {
jQuery("#" + innerId).append(this);
});
//only needed when we need to add scroll to macro menu
var maxHeight = 500;
var menu = jQuery("#" + menuId);
var container = jQuery("#" + containerId);
var menuHeight = menu.height();
if (menuHeight > maxHeight) {
jQuery("<div id='" + buttonId + "' class='menudown'><span>&nbsp;&nbsp;&nbsp;&nbsp;</span></div>").appendTo("#" + menuId);
menu.css({
height: maxHeight,
overflow: "hidden"
})
container.css({
height: maxHeight - 20,
overflow: "hidden"
});
var interval;
jQuery("#" + buttonId).hover(function (e) {
interval = setInterval(function () {
var offset = jQuery("#" + innerId).offset();
var currentTop = jQuery("#" + innerId).css("top").replace("px", "");
if (Number(currentTop) > -(menuHeight - 40)) {
jQuery("#" + innerId).css("top", currentTop - 20);
}
}, 125);
}, function () {
clearInterval(interval);
});
jQuery("#" + buttonId).hover(function (e) {
jQuery("#" + innerId).css("top", 0)
});
}
}
+3 -1
View File
@@ -23,7 +23,7 @@
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
@@ -39,6 +39,7 @@
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -70,6 +71,7 @@
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Web" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>