This commit is contained in:
Shandem
2012-06-11 14:32:49 -02:00
27 changed files with 565 additions and 320 deletions

14
ReleaseNotes.txt Normal file
View File

@@ -0,0 +1,14 @@
#####################################################################################################################################
This document is intended to keep track of the changes that are made to the solution in each release.
Rather than a summary of work items fixed or the actual commit messages; these should be high level, user-facing
statements that describe what each commit/block of work actually changed with respect to the user.
For example (fake): Fixes work item #1234 is not as good as "Changes the behaviour of NodeFactory so GetProperty doesn't access the database"
Please group your changes into versions and tag them with your name so we know who to contact for code reviews etc.
These notes will form the release notes that go out with each public release
#####################################################################################################################################
[Version 4.8]
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)

View File

@@ -3,6 +3,7 @@ using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.XPath;
using umbraco.cms.businesslogic.datatype;
using System.Linq;
namespace umbraco.editorControls.XPathCheckBoxList
{
@@ -139,7 +140,7 @@ namespace umbraco.editorControls.XPathCheckBoxList
try
{
if (uQuery.GetNodesByXPath(xPath).Count >= 0)
if (uQuery.GetNodesByXPath(xPath).Count() >= 0)
{
isValid = true;
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml.XPath;
@@ -119,7 +120,7 @@ namespace umbraco.editorControls.XPathDropDownList
try
{
if (uQuery.GetNodesByXPath(xPath).Count >= 0)
if (uQuery.GetNodesByXPath(xPath).Count() >= 0)
{
isValid = true;
}

View File

@@ -6,6 +6,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
build.xml = build.xml
default.build = default.build
INDIGO64.testrunconfig = INDIGO64.testrunconfig
ReleaseNotes.txt = ReleaseNotes.txt
SHANDEMVAIO.testrunconfig = SHANDEMVAIO.testrunconfig
SHOCKING.testrunconfig = SHOCKING.testrunconfig
umbraco weekly.build = umbraco weekly.build

View File

@@ -159,6 +159,41 @@ namespace umbraco.cms.businesslogic.template
return masterpageContent;
}
public new string Path
{
get
{
List<int> path = new List<int>();
Template working = this;
while (working != null)
{
path.Add(working.Id);
try
{
if (working.MasterTemplate != 0)
{
working = new Template(working.MasterTemplate);
}
else
{
working = null;
}
}
catch (ArgumentException)
{
working = null;
}
}
path.Add(-1);
path.Reverse();
string sPath = string.Join(",", path.ConvertAll(item => item.ToString()).ToArray());
return sPath;
}
set
{
base.Path = value;
}
}
public string Alias
{

View File

@@ -255,6 +255,42 @@ namespace umbraco.cms.businesslogic.web
}
}
}
public new string Path
{
get
{
List<int> path = new List<int>();
DocumentType working = this;
while (working != null)
{
path.Add(working.Id);
try
{
if (working.MasterContentType != 0)
{
working = new DocumentType(working.MasterContentType);
}
else
{
working = null;
}
}
catch (ArgumentException)
{
working = null;
}
}
path.Add(-1);
path.Reverse();
string sPath = string.Join(",", path.ConvertAll(item => item.ToString()).ToArray());
return sPath;
}
set
{
base.Path = value;
}
}
#endregion
#region Public Methods

View File

@@ -0,0 +1,108 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using umbraco.BusinessLogic;
using System.Web;
namespace umbraco.cms.helpers
{
public class DeepLink
{
public static string GetTreePathFromFilePath(string filePath)
{
List<string> treePath = new List<string>();
treePath.Add("-1");
treePath.Add("init");
string[] pathPaths = filePath.Split('/');
pathPaths.Reverse();
for (int p = 0; p < pathPaths.Length; p++)
{
treePath.Add(string.Join("/", pathPaths.Take(p + 1).ToArray()));
}
string sPath = string.Join(",", treePath.ToArray());
return sPath;
}
public static string Get(DeepLinkType type, string idOrFilePath)
{
string basePath = "/umbraco/umbraco.aspx";
string section = string.Empty;
string editorUrl = string.Empty;
string idKey = string.Empty;
switch (type)
{
case DeepLinkType.Content:
section = "content";
editorUrl = "editContent.aspx";
idKey = "id";
break;
case DeepLinkType.Css:
section = "settings";
editorUrl = "settings/stylesheet/editStylesheet.aspx";
idKey = "id";
break;
case DeepLinkType.DataType:
section = "developer";
editorUrl = "developer/datatypes/editDataType.aspx";
idKey = "id";
break;
case DeepLinkType.DocumentType:
section = "settings";
editorUrl = "settings/editNodeTypeNew.aspx";
idKey = "id";
break;
case DeepLinkType.Javascript:
section = "settings";
editorUrl = "settings/scripts/editScript.aspx";
idKey = "file";
break;
case DeepLinkType.Macro:
section = "developer";
editorUrl = "developer/macros/editMacro.aspx";
idKey = "macroID";
break;
case DeepLinkType.Media:
section = "media";
editorUrl = "editMedia.aspx";
idKey = "id";
break;
case DeepLinkType.MediaType:
section = "settings";
editorUrl = "settings/editMediaType.aspx";
idKey = "id";
break;
case DeepLinkType.RazorScript:
section = "developer";
editorUrl = "developer/python/editPython.aspx";
idKey = "file";
break;
case DeepLinkType.Template:
section = "settings";
editorUrl = "settings/editTemplate.aspx";
idKey = "templateId";
break;
case DeepLinkType.XSLT:
section = "developer";
editorUrl = "developer/xslt/editXslt.aspx";
idKey = "file";
break;
}
if (section != string.Empty)
{
User currentUser = User.GetCurrent();
if (currentUser != null)
{
//does the current user have access to this section
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));
}
}
}
return null;
}
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace umbraco.cms.helpers
{
public enum DeepLinkType
{
Template,
DocumentType,
Content,
Media,
MediaType,
XSLT,
RazorScript,
Css,
Javascript,
Macro,
DataType
}
}

View File

@@ -255,6 +255,8 @@
<Compile Include="businesslogic\web\DocumentVersionList.cs" />
<Compile Include="businesslogic\skinning\Skinning.cs" />
<Compile Include="helpers\Casing.cs" />
<Compile Include="helpers\DeepLink.cs" />
<Compile Include="helpers\DeepLinkType.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>

View File

@@ -18,7 +18,7 @@ namespace umbraco.cms.presentation.Trees.RelationTypes
{
Application developerSection = Application.getByAlias("developer");
ApplicationTree relationTypesApplicationTree = new ApplicationTree(false, true, 1, "developer", "relationTypesTree", "Relation Types", ".sprTreeFolder", ".sprTreeFolder_0", "Umbraco.RelationTypes", "RelationTypeTree", null);
ApplicationTree relationTypesApplicationTree = new ApplicationTree(false, true, 3, "developer", "relationTypesTree", "Relation Types", ".sprTreeFolder", ".sprTreeFolder_0", "umbraco", "cms.presentation.Trees.RelationTypes.RelationTypeTree", null);
TreeDefinition relationTypesTreeDefinition = new TreeDefinition(typeof(umbraco.cms.presentation.Trees.RelationTypes.RelationTypeTree), relationTypesApplicationTree, developerSection);

View File

@@ -13,34 +13,35 @@ using umbraco.IO;
namespace umbraco.cms.presentation.developer
{
public partial class editDatatype : BasePages.UmbracoEnsuredPage
{
public editDatatype()
{
public partial class editDatatype : BasePages.UmbracoEnsuredPage
{
public editDatatype()
{
CurrentApp = BusinessLogic.DefaultApps.developer.ToString();
}
protected ImageButton save;
private cms.businesslogic.datatype.DataTypeDefinition dt;
cms.businesslogic.datatype.controls.Factory f;
private int _id = 0;
private interfaces.IDataPrevalue _prevalue;
}
protected ImageButton save;
private cms.businesslogic.datatype.DataTypeDefinition dt;
cms.businesslogic.datatype.controls.Factory f;
private int _id = 0;
private interfaces.IDataPrevalue _prevalue;
protected void Page_Load(object sender, System.EventArgs e)
{
protected void Page_Load(object sender, System.EventArgs e)
{
pp_name.Text = ui.Text("name");
pp_renderControl.Text = ui.Text("renderControl");
pane_settings.Text = ui.Text("settings");
pp_guid.Text = ui.Text("guid");
pp_guid.Text = ui.Text("guid");
_id = int.Parse(Request.QueryString["id"]);
dt = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(_id);
f = new cms.businesslogic.datatype.controls.Factory();
_id = int.Parse(Request.QueryString["id"]);
dt = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(_id);
if (!IsPostBack) {
f = new cms.businesslogic.datatype.controls.Factory();
if (!IsPostBack)
{
txtName.Text = dt.Text;
SortedList datatypes = new SortedList();
@@ -51,57 +52,60 @@ namespace umbraco.cms.presentation.developer
IDictionaryEnumerator ide = datatypes.GetEnumerator();
string datatTypeId = dt.DataType != null ? dt.DataType.Id.ToString() : String.Empty;
while (ide.MoveNext()) {
while (ide.MoveNext())
{
ListItem li = new ListItem();
li.Text = ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|"));
li.Value = ide.Value.ToString();
if (!String.IsNullOrEmpty(datatTypeId) && li.Value.ToString() == datatTypeId) li.Selected = true;
ddlRenderControl.Items.Add(li);
ddlRenderControl.Items.Add(li);
}
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadDataTypes>().Tree.Alias)
.SyncTree(_id.ToString(), false);
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadDataTypes>().Tree.Alias)
.SyncTree("-1,init," + _id.ToString(), false);
}
if (dt.DataType != null)
litGuid.Text = dt.DataType.Id.ToString();
litGuid.Text = dt.DataType.Id.ToString();
Panel1.Text = umbraco.ui.Text("edit") + " datatype: " + dt.Text;
insertPrevalueEditor();
}
insertPrevalueEditor();
}
private void insertPrevalueEditor()
{
try
{
if (ddlRenderControl.SelectedIndex >= 0)
{
interfaces.IDataType o = f.DataType(new Guid(ddlRenderControl.SelectedValue));
o.DataTypeDefinitionId = dt.Id;
_prevalue = o.PrevalueEditor;
private void insertPrevalueEditor() {
try
{
if (ddlRenderControl.SelectedIndex >= 0)
{
interfaces.IDataType o = f.DataType(new Guid(ddlRenderControl.SelectedValue));
o.DataTypeDefinitionId = dt.Id;
_prevalue = o.PrevalueEditor;
if (o.PrevalueEditor.Editor != null)
plcEditorPrevalueControl.Controls.Add(o.PrevalueEditor.Editor);
}
else
{
plcEditorPrevalueControl.Controls.Add(new LiteralControl("No editor control selected"));
}
}
catch {}
}
plcEditorPrevalueControl.Controls.Add(o.PrevalueEditor.Editor);
}
else
{
plcEditorPrevalueControl.Controls.Add(new LiteralControl("No editor control selected"));
}
}
catch { }
protected void save_click(object sender, System.Web.UI.ImageClickEventArgs e) {
// save prevalues;
if (_prevalue != null)
_prevalue.Save();
}
dt.Text = txtName.Text;
dt.DataType = f.DataType(new Guid(ddlRenderControl.SelectedValue));
protected void save_click(object sender, System.Web.UI.ImageClickEventArgs e)
{
// save prevalues;
if (_prevalue != null)
_prevalue.Save();
dt.Text = txtName.Text;
dt.DataType = f.DataType(new Guid(ddlRenderControl.SelectedValue));
System.Web.HttpRuntime.Cache.Remove(string.Format("UmbracoDataTypeDefinition{0}", dt.UniqueId));
@@ -109,36 +113,36 @@ namespace umbraco.cms.presentation.developer
this.speechBubble(BasePages.BasePage.speechBubbleIcon.save, ui.Text("speechBubbles", "dataTypeSaved", null), "");
//Response.Redirect("editDataType.aspx?id=" + _id);
}
}
#region Web Form Designer generated code
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
override protected void OnInit(EventArgs e)
{
save = Panel1.Menu.NewImageButton();
save.ID = "save";
save.Click += new System.Web.UI.ImageClickEventHandler(save_click);
save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif";
Panel1.hasMenu = true;
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}

View File

@@ -43,8 +43,8 @@ namespace umbraco.cms.presentation.developer
{
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadMacros>().Tree.Alias)
.SyncTree(m_macro.Id.ToString(), false);
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadMacros>().Tree.Alias)
.SyncTree("-1,init," + m_macro.Id.ToString(), false);
macroName.Text = m_macro.Name;
macroAlias.Text = m_macro.Alias;
@@ -92,7 +92,7 @@ namespace umbraco.cms.presentation.developer
populatePythonFiles();
// Load usercontrols
populateUserControls(IOHelper.MapPath(SystemDirectories.Usercontrols) );
populateUserControls(IOHelper.MapPath(SystemDirectories.Usercontrols));
userControlList.Items.Insert(0, new ListItem("Browse usercontrols on server...", string.Empty));
userControlList.Attributes.Add("onChange",
"document.getElementById('" + macroUserControl.ClientID + "').value = this[this.selectedIndex].value;");
@@ -307,12 +307,12 @@ namespace umbraco.cms.presentation.developer
{
DirectoryInfo di = new DirectoryInfo(path);
string rootDir = IOHelper.MapPath( SystemDirectories.Root );
string rootDir = IOHelper.MapPath(SystemDirectories.Root);
foreach (FileInfo uc in di.GetFiles("*.ascx"))
{
userControlList.Items.Add(
new ListItem(
new ListItem(
uc.FullName.Substring(rootDir.Length).Replace(IOHelper.DirSepChar, '/')));
/*
uc.FullName.IndexOf(usercontrolsDir),
@@ -363,5 +363,5 @@ namespace umbraco.cms.presentation.developer
#endregion
}
}

View File

@@ -16,6 +16,7 @@ using System.Text.RegularExpressions;
using umbraco.cms.businesslogic.macro;
using umbraco.cms.presentation.Trees;
using umbraco.IO;
using umbraco.cms.helpers;
namespace umbraco.cms.presentation.developer
{
@@ -37,9 +38,11 @@ namespace umbraco.cms.presentation.developer
if (!IsPostBack)
{
string file = Request.QueryString["file"];
string path = DeepLink.GetTreePathFromFilePath(file);
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadPython>().Tree.Alias)
.SyncTree(Request.QueryString["file"], false);
.SyncTree(path, false);
}
}

View File

@@ -12,6 +12,7 @@ using umbraco.uicontrols;
using System.Net;
using umbraco.cms.presentation.Trees;
using umbraco.IO;
using umbraco.cms.helpers;
namespace umbraco.cms.presentation.developer
{
@@ -33,9 +34,11 @@ namespace umbraco.cms.presentation.developer
{
if (!IsPostBack)
{
string file = Request.QueryString["file"];
string path = DeepLink.GetTreePathFromFilePath(file);
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadXslt>().Tree.Alias)
.SyncTree(Request.QueryString["file"], false);
.SyncTree(path, false);
}

View File

@@ -12,75 +12,83 @@ using umbraco.cms.presentation.Trees;
namespace umbraco.cms.presentation.settings
{
/// <summary>
/// Summary description for EditMediaType.
/// </summary>
public partial class EditMediaType : BasePages.UmbracoEnsuredPage
{
/// <summary>
/// Summary description for EditMediaType.
/// </summary>
public partial class EditMediaType : BasePages.UmbracoEnsuredPage
{
public EditMediaType()
{
public EditMediaType()
{
CurrentApp = BusinessLogic.DefaultApps.settings.ToString();
}
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadMediaTypes>().Tree.Alias)
.SyncTree(helper.Request("id"), false);
}
}
protected void tmp_OnSave(object sender, System.EventArgs e)
{
}
}
protected void Page_Load(object sender, System.EventArgs e)
{
if (!IsPostBack)
{
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadMediaTypes>().Tree.Alias)
.SyncTree("-1,init," + helper.Request("id"), false);
}
}
protected void tmp_OnSave(object sender, System.EventArgs e)
{
protected override bool OnBubbleEvent(object source, EventArgs e) {
}
if (e is controls.SaveClickEventArgs) {
protected override bool OnBubbleEvent(object source, EventArgs e)
{
if (e is controls.SaveClickEventArgs)
{
controls.SaveClickEventArgs sce = (controls.SaveClickEventArgs)e;
if (sce.Message == "Saved") {
if (sce.Message == "Saved")
{
int mtid = 0;
speechBubble(speechBubbleIcon.save, "Mediatype saved", "Mediatype was successfully saved");
if (int.TryParse(Request.QueryString["id"], out mtid))
new cms.businesslogic.media.MediaType(mtid).Save();
} else if (sce.Message.Contains("Tab")) {
speechBubble(speechBubbleIcon.info, "Tab added", sce.Message);
} else
{
base.speechBubble(sce.IconType, sce.Message, "");
}
else if (sce.Message.Contains("Tab"))
{
speechBubble(speechBubbleIcon.info, "Tab added", sce.Message);
}
else
{
base.speechBubble(sce.IconType, sce.Message, "");
}
return true;
} else {
}
else
{
return false;
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
}
#endregion
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}
#endregion
}
}

View File

@@ -13,19 +13,19 @@ using umbraco.cms.businesslogic.web;
namespace umbraco.settings
{
public partial class EditContentTypeNew : BasePages.UmbracoEnsuredPage
{
public EditContentTypeNew()
{
public partial class EditContentTypeNew : BasePages.UmbracoEnsuredPage
{
public EditContentTypeNew()
{
CurrentApp = BusinessLogic.DefaultApps.settings.ToString();
}
}
protected controls.ContentTypeControlNew ContentTypeControlNew1;
cms.businesslogic.web.DocumentType dt;
protected controls.ContentTypeControlNew ContentTypeControlNew1;
cms.businesslogic.web.DocumentType dt;
private DataTable dtTemplates = new DataTable();
private DataTable dtTemplates = new DataTable();
override protected void OnInit(EventArgs e)
{
@@ -33,128 +33,131 @@ namespace umbraco.settings
base.OnInit(e);
}
protected void Page_Load(object sender, System.EventArgs e)
{
dt = new DocumentType(int.Parse(Request.QueryString["id"]));
if (!Page.IsPostBack)
{
bindTemplates();
protected void Page_Load(object sender, System.EventArgs e)
{
dt = new DocumentType(int.Parse(Request.QueryString["id"]));
if (!Page.IsPostBack)
{
bindTemplates();
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadNodeTypes>().Tree.Alias)
.SyncTree(dt.Id.ToString(), false);
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadNodeTypes>().Tree.Alias)
.SyncTree("-1,init," + dt.Path.Replace("-1,", ""), false);
}
}
}
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");
private void bindTemplates()
{
cms.businesslogic.template.Template[] selectedTemplates = dt.allowedTemplates;
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);
}
templateList.Items.Clear();
DataTable dtAllowedTemplates = new DataTable();
dtTemplates.Columns.Add("name");
dtTemplates.Columns.Add("id");
dtTemplates.Columns.Add("selected");
foreach (DataRow dr in dtTemplates.Rows)
{
ListItem li = new ListItem(dr["name"].ToString(),dr["id"].ToString());
if (bool.Parse(dr["selected"].ToString()))
li.Selected = true;
templateList.Items.Add(li);
}
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.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);
protected override bool OnBubbleEvent(object source, EventArgs args)
{
bool handled = false;
if (args is controls.SaveClickEventArgs)
{
controls.SaveClickEventArgs e = (controls.SaveClickEventArgs) args;
if (e.Message == "Saved")
{
}
templateList.Items.Clear();
foreach (DataRow dr in dtTemplates.Rows)
{
ListItem li = new ListItem(dr["name"].ToString(), dr["id"].ToString());
if (bool.Parse(dr["selected"].ToString()))
li.Selected = true;
templateList.Items.Add(li);
}
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"));
}
protected override bool OnBubbleEvent(object source, EventArgs args)
{
bool handled = false;
if (args is controls.SaveClickEventArgs)
{
controls.SaveClickEventArgs e = (controls.SaveClickEventArgs)args;
if (e.Message == "Saved")
{
int dtid = 0;
if (int.TryParse(Request.QueryString["id"], out dtid))
new cms.businesslogic.web.DocumentType(dtid).Save();
base.speechBubble(e.IconType, ui.Text("contentTypeSavedHeader"),"");
base.speechBubble(e.IconType, ui.Text("contentTypeSavedHeader"), "");
ArrayList tmp = new ArrayList();
ArrayList tmp = new ArrayList();
foreach (ListItem li in templateList.Items) {
if (li.Selected) tmp.Add(new cms.businesslogic.template.Template(int.Parse(li.Value)));
}
foreach (ListItem li in templateList.Items)
{
if (li.Selected) tmp.Add(new cms.businesslogic.template.Template(int.Parse(li.Value)));
}
cms.businesslogic.template.Template[] tt = new cms.businesslogic.template.Template[tmp.Count];
for(int i = 0; i < tt.Length;i++) {
tt[i] = (cms.businesslogic.template.Template) tmp[i];
}
dt.allowedTemplates = tt;
cms.businesslogic.template.Template[] tt = new cms.businesslogic.template.Template[tmp.Count];
for (int i = 0; i < tt.Length; i++)
{
tt[i] = (cms.businesslogic.template.Template)tmp[i];
}
dt.allowedTemplates = tt;
if (dt.allowedTemplates.Length > 0 && ddlTemplates.SelectedIndex >= 0)
{
dt.DefaultTemplate = int.Parse(ddlTemplates.SelectedValue);
}
else
dt.RemoveDefaultTemplate();
if (dt.allowedTemplates.Length > 0 && ddlTemplates.SelectedIndex >= 0)
{
dt.DefaultTemplate = int.Parse(ddlTemplates.SelectedValue);
}
else
dt.RemoveDefaultTemplate();
bindTemplates();
}
else
{
base.speechBubble(e.IconType,e.Message,"");
}
handled = true;
}
return handled;
}
bindTemplates();
}
else
{
base.speechBubble(e.IconType, e.Message, "");
}
handled = true;
}
return handled;
}
protected void dgTemplate_itemdatabound(object sender,DataGridItemEventArgs e)
{
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
((CheckBox)e.Item.FindControl("ckbAllowTemplate")).Checked = true;
}
}
protected void dgTemplate_itemdatabound(object sender, DataGridItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
((CheckBox)e.Item.FindControl("ckbAllowTemplate")).Checked = true;
}
}
}
}
}

View File

@@ -73,7 +73,7 @@ namespace umbraco.cms.presentation.settings
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadTemplates>().Tree.Alias)
.SyncTree(_template.Id.ToString(), false);
.SyncTree("-1,init," + _template.Path.Replace("-1,", ""), false);
LoadScriptingTemplates();
LoadMacros();

View File

@@ -13,6 +13,7 @@ using System.IO;
using umbraco.cms.presentation.Trees;
using umbraco.IO;
using System.Linq;
using umbraco.cms.helpers;
namespace umbraco.cms.presentation.settings.scripts
{
@@ -41,15 +42,15 @@ namespace umbraco.cms.presentation.settings.scripts
NameTxt.Text = file;
string path = "";
if (file.StartsWith("~/"))
path = IOHelper.ResolveUrl(file);
else
path = IOHelper.ResolveUrl(SystemDirectories.Scripts + "/" + file);
lttPath.Text = "<a target='_blank' href='" + path + "'>" + path + "</a>";
// validate file
@@ -59,25 +60,26 @@ namespace umbraco.cms.presentation.settings.scripts
StreamReader SR;
string S;
SR = File.OpenText( IOHelper.MapPath( path ));
SR = File.OpenText(IOHelper.MapPath(path));
S = SR.ReadToEnd();
SR.Close();
editorSource.Text = S;
Panel1.Text = ui.Text("editscript", base.getUser());
pp_name.Text = ui.Text("name", base.getUser());
pp_path.Text = ui.Text("path", base.getUser());
if (!IsPostBack)
{
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadScripts>().Tree.Alias)
.SyncTree(file, false);
}
if (!IsPostBack)
{
string sPath = DeepLink.GetTreePathFromFilePath(file);
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadScripts>().Tree.Alias)
.SyncTree(sPath, false);
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
@@ -121,7 +123,7 @@ namespace umbraco.cms.presentation.settings.scripts
Panel1.Menu.InsertSplitter();
uicontrols.MenuIconI helpIcon = Panel1.Menu.NewIcon();
helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" , ui.Text("template", "quickGuide"), 600, 580);
helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=", ui.Text("template", "quickGuide"), 600, 580);
helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png";
helpIcon.AltText = ui.Text("template", "quickGuide");
@@ -145,7 +147,8 @@ namespace umbraco.cms.presentation.settings.scripts
protected override void OnPreRender(EventArgs e) {
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/codeEditorSave.asmx"));
ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx"));

View File

@@ -34,7 +34,7 @@ namespace umbraco.cms.presentation.settings.stylesheet
ClientTools
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadStylesheets>().Tree.Alias)
.SyncTree(helper.Request("id"), false);
.SyncTree("-1,init," + helper.Request("id"), false);
}
MenuIconI save = Panel1.Menu.NewIcon();

View File

@@ -125,16 +125,16 @@ namespace umbraco
}
}
/// <summary>
/// Extension method on Meia obj to get it's depth
/// </summary>
/// <param name="media">an umbraco.cms.businesslogic.media.Media object</param>
/// <returns>an int representing the depth of the Media object in the tree</returns>
[Obsolete("Use .Level instead")]
public static int GetDepth(this Media media)
{
return media.Path.Split(',').ToList().Count;
}
/////// <summary>
/////// Extension method on Meia obj to get it's depth
/////// </summary>
/////// <param name="media">an umbraco.cms.businesslogic.media.Media object</param>
/////// <returns>an int representing the depth of the Media object in the tree</returns>
////[Obsolete("Use .Level instead")]
////public static int GetDepth(this Media media)
////{
//// return media.Path.Split(',').ToList().Count;
////}
/// <summary>
/// Tell me the level of this node (0 = root)

View File

@@ -576,18 +576,6 @@ namespace umbraco
return node.NiceUrl.Replace(library.RequestServerVariables("HTTP_HOST"), string.Concat((ssl ? "https://" : "http://"), domain.Name));
}
/// <summary>
/// Determines whether [the specified node] [is hidden from navigation].
/// </summary>
/// <param name="node">The node.</param>
/// <returns>
/// <c>true</c> if [the specified node] [is hidden from navigation]; otherwise, <c>false</c>.
/// </returns>
public static bool IsHiddenFromNavigation(this Node node)
{
// TODO: [OA] Document on Codeplex. Is this one really necessary? - [HR] this one could be confusing as depends on default naming convention
return node.GetProperty<bool>("umbracoNaviHide");
}
#pragma warning disable 0618
/// <summary>

View File

@@ -10,7 +10,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of IDs</param>
/// <returns>collection or emtpy collection</returns>
public static List<Document> GetDocumentsByCsv(string csv)
public static IEnumerable<Document> GetDocumentsByCsv(string csv)
{
var documents = new List<Document>();
var ids = uQuery.GetCsvIds(csv);
@@ -35,7 +35,7 @@ namespace umbraco
/// </summary>
/// <param name="xml">The XML.</param>
/// <returns></returns>
public static List<Document> GetDocumentsByXml(string xml)
public static IEnumerable<Document> GetDocumentsByXml(string xml)
{
var documents = new List<Document>();
var ids = uQuery.GetXmlIds(xml);
@@ -130,7 +130,7 @@ namespace umbraco
/// </summary>
/// <param name="documents">generic list of Document objects</param>
/// <returns>a collection of document IDs and their text fields</returns>
public static Dictionary<int, string> ToNameIds(this List<Document> documents)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Document> documents)
{
var dictionary = new Dictionary<int, string>();

View File

@@ -10,7 +10,7 @@ namespace umbraco
/// </summary>
/// <param name="xPath">XPath expression</param>
/// <returns>collection or empty collection</returns>
public static List<Media> GetMediaByXPath(string xPath)
public static IEnumerable<Media> GetMediaByXPath(string xPath)
{
var media = new List<Media>();
var xmlDocument = uQuery.GetPublishedXml(UmbracoObjectType.Media);
@@ -34,7 +34,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of IDs</param>
/// <returns>collection or emtpy collection</returns>
public static List<Media> GetMediaByCsv(string csv)
public static IEnumerable<Media> GetMediaByCsv(string csv)
{
var media = new List<Media>();
var ids = uQuery.GetCsvIds(csv);
@@ -59,7 +59,7 @@ namespace umbraco
/// </summary>
/// <param name="xml">The XML.</param>
/// <returns></returns>
public static List<Media> GetMediaByXml(string xml)
public static IEnumerable<Media> GetMediaByXml(string xml)
{
var media = new List<Media>();
var ids = uQuery.GetXmlIds(xml);
@@ -84,7 +84,7 @@ namespace umbraco
/// </summary>
/// <param name="name">name of node to look for</param>
/// <returns>list of nodes, or empty list</returns>
public static List<Media> GetMediaByName(string name)
public static IEnumerable<Media> GetMediaByName(string name)
{
return uQuery.GetMediaByXPath(string.Concat("descendant::*[@nodeName='", name, "']"));
}
@@ -94,7 +94,7 @@ namespace umbraco
/// </summary>
/// <param name="mediaTypeAlias">The media type alias</param>
/// <returns>list of media, or empty list</returns>
public static List<Media> GetMediaByType(string mediaTypeAlias)
public static IEnumerable<Media> GetMediaByType(string mediaTypeAlias)
{
// Both XML schema versions have this attribute
return uQuery.GetMediaByXPath(string.Concat("descendant::*[@nodeTypeAlias='", mediaTypeAlias, "']"));
@@ -143,7 +143,7 @@ namespace umbraco
/// </summary>
/// <param name="media">generic list of Media objects</param>
/// <returns>a collection of mediaIDs and their text fields</returns>
public static Dictionary<int, string> ToNameIds(this List<Media> media)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Media> media)
{
var dictionary = new Dictionary<int, string>();

View File

@@ -10,7 +10,7 @@ namespace umbraco
/// </summary>
/// <param name="xPath">XPath expression</param>
/// <returns>collection or empty collection</returns>
public static List<Member> GetMembersByXPath(string xPath)
public static IEnumerable<Member> GetMembersByXPath(string xPath)
{
var members = new List<Member>();
var xmlDocument = uQuery.GetPublishedXml(UmbracoObjectType.Member);
@@ -34,7 +34,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of IDs</param>
/// <returns>collection or emtpy collection</returns>
public static List<Member> GetMembersByCsv(string csv)
public static IEnumerable<Member> GetMembersByCsv(string csv)
{
var members = new List<Member>();
var ids = uQuery.GetCsvIds(csv);
@@ -59,7 +59,7 @@ namespace umbraco
/// </summary>
/// <param name="xml">The XML.</param>
/// <returns></returns>
public static List<Member> GetMembersByXml(string xml)
public static IEnumerable<Member> GetMembersByXml(string xml)
{
var members = new List<Member>();
var ids = uQuery.GetXmlIds(xml);
@@ -81,7 +81,7 @@ namespace umbraco
/// </summary>
/// <param name="memberTypeAlias">The member type alias</param>
/// <returns>list of members, or empty list</returns>
public static List<Member> GetMembersByType(string memberTypeAlias)
public static IEnumerable<Member> GetMembersByType(string memberTypeAlias)
{
// Both XML schema versions have this attribute
return uQuery.GetMembersByXPath(string.Concat("descendant::*[@nodeTypeAlias='", memberTypeAlias, "']"));
@@ -131,7 +131,7 @@ namespace umbraco
/// </summary>
/// <param name="members">generic list of Member objects</param>
/// <returns>a collection of memberIDs and their login names</returns>
public static Dictionary<int, string> ToNameIds(this List<Member> members)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Member> members)
{
var dictionary = new Dictionary<int, string>();

View File

@@ -23,7 +23,7 @@ namespace umbraco
/// <param name="xpath">XPath expression to get Nodes, can use $ancestorOrSelf which will use the current Node if published, else it'll use the nearest published parent
/// $currentPage will be depreciated</param>
/// <returns>an empty collection or a collection of nodes</returns>
public static List<Node> GetNodesByXPath(string xpath)
public static IEnumerable<Node> GetNodesByXPath(string xpath)
{
var nodes = new List<Node>();
@@ -72,7 +72,7 @@ namespace umbraco
/// </summary>
/// <param name="csv">string csv of Ids</param>
/// <returns>an empty collection or a collection or Nodes</returns>
public static List<Node> GetNodesByCsv(string csv)
public static IEnumerable<Node> GetNodesByCsv(string csv)
{
var nodes = new List<Node>();
var ids = uQuery.GetCsvIds(csv);
@@ -104,7 +104,7 @@ namespace umbraco
/// </MultiNodePicker>"
/// </param>
/// <returns>an empty list or a list of nodes</returns>
public static List<Node> GetNodesByXml(string xml)
public static IEnumerable<Node> GetNodesByXml(string xml)
{
var nodes = new List<Node>();
var ids = uQuery.GetXmlIds(xml);
@@ -129,7 +129,7 @@ namespace umbraco
/// </summary>
/// <param name="name">name of node to look for</param>
/// <returns>list of nodes, or empty list</returns>
public static List<Node> GetNodesByName(string name)
public static IEnumerable<Node> GetNodesByName(string name)
{
return uQuery.GetNodesByXPath(string.Concat("descendant::*[@nodeName='", name, "']"));
}
@@ -139,7 +139,7 @@ namespace umbraco
/// </summary>
/// <param name="documentTypeAlias">The document type alias</param>
/// <returns>list of nodes, or empty list</returns>
public static List<Node> GetNodesByType(string documentTypeAlias)
public static IEnumerable<Node> GetNodesByType(string documentTypeAlias)
{
if (uQuery.IsLegacyXmlSchema())
{
@@ -156,7 +156,7 @@ namespace umbraco
/// </summary>
/// <param name="documentTypeId">The document type id.</param>
/// <returns></returns>
public static List<Node> GetNodesByType(int documentTypeId)
public static IEnumerable<Node> GetNodesByType(int documentTypeId)
{
return uQuery.GetNodesByXPath(string.Concat("descendant::*[@nodeType='", documentTypeId, "']"));
}
@@ -346,7 +346,7 @@ namespace umbraco
/// </summary>
/// <param name="nodes">generic list of node objects</param>
/// <returns>a collection of nodeIDs and their names</returns>
public static Dictionary<int, string> ToNameIds(this List<Node> nodes)
public static Dictionary<int, string> ToNameIds(this IEnumerable<Node> nodes)
{
var dictionary = new Dictionary<int, string>();

View File

@@ -148,7 +148,13 @@
var initApp = '<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["app"]%>';
var rightAction = '<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["rightAction"]%>';
var rightActionId = '<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["id"]%>';
var base = '<%=string.Format("{0}/", umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco))%>';
var url = ''
if (rightActionId && rightActionId != '') {
url = base + rightAction + ".aspx?id=" + rightActionId
} else {
url = base + rightAction;
}
jQuery(document).ready(function () {
UmbClientMgr.setUmbracoPath("<%=umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) %>");
@@ -175,7 +181,13 @@
UmbClientMgr.historyManager().addHistory(initApp != "" ? initApp :
UmbClientMgr.historyManager().getCurrent() != "" ? UmbClientMgr.historyManager().getCurrent() :
"<%=DefaultApp%>", true);
UmbClientMgr.contentFrame(rightAction + ".aspx?id=" + rightActionId);
//use a small timeout to handle load delays
//ref: http://our.umbraco.org/forum/developers/api-questions/32249-Direct-link-to-back-office-page
var timer = setTimeout(function () {
UmbClientMgr.contentFrame(url);
}, 200);
}
else {
UmbClientMgr.historyManager().addHistory(initApp != "" ? initApp :

View File

@@ -121,13 +121,14 @@ Umbraco.Sys.registerNamespace("Umbraco.Application");
}
this._debug("contentFrame: parsed location: " + strLocation);
if (typeof this.mainWindow().right != "undefined") {
this.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
}
window.setTimeout(function(){
if (typeof this.mainWindow().right != "undefined") {
this.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
}
},200);
}
},
openModalWindow: function(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) {