DO NOT DOWNLOAD. DOWNLOAD LATEST STABLE FROM RELEASE TAB

Tree fixes/updates

[TFS Changeset #55166]
This commit is contained in:
Shandem
2009-06-20 13:17:06 +00:00
parent 337fb79ae2
commit 894664b41a
9 changed files with 239 additions and 42 deletions

View File

@@ -1,6 +1,6 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{651E1350-91B6-44B7-BD60-7207006D7003}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
@@ -1538,6 +1538,7 @@
<Content Include="umbraco\controls\TreeControl.ascx" />
<Content Include="umbraco\css\permissionsEditor.css" />
<Content Include="umbraco\images\editor\spellchecker.gif" />
<Content Include="umbraco_client\Application\JQuery\jquery.cookie.js" />
<Content Include="umbraco_client\Tree\Themes\default\context.gif" />
<Content Include="umbraco_client\Tree\Themes\default\create.png" />
<Content Include="umbraco_client\Tree\Themes\default\dot.gif" />

View File

@@ -1,16 +1,15 @@
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreeControl.ascx.cs" Inherits="umbraco.presentation.umbraco.controls.TreeControl" %>
<asp:ScriptManagerProxy runat="server">
<Scripts>
<%--<asp:ScriptReference Path="~/umbraco_client/Application/NamespaceManager.js" />--%>
<asp:ScriptReference Path="~/umbraco_client/Tree/css.js" />
<%--<asp:ScriptReference Path="~/umbraco_client/Application/JQuery/jquery.metadata.min.js" />--%>
<asp:ScriptReference Path="~/umbraco_client/Tree/tree_component.min.js" />
<asp:ScriptReference Path="~/umbraco_client/Tree/NodeDefinition.js" />
<asp:ScriptReference Path="~/umbraco_client/Tree/UmbracoTree.js" />
<%--<asp:ScriptReference Path="~/umbraco_client/Application/UmbracoClientManager.js" />--%>
<%--<asp:ScriptReference Path="~/umbraco_client/Application/UmbracoUtils.js" />--%>
</Scripts>
</asp:ScriptManagerProxy>
<%@ Register TagPrefix="umb" Namespace="umbraco.presentation.ClientDependency" Assembly="umbraco.presentation.ClientDependency" %>
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude7" DependencyType="Css" FilePath="Tree/Themes/tree_component.css" PathNameAlias="UmbracoClient" />
<umb:ClientDependencyInclude ID="ClientDependencyInclude1" runat="server" DependencyType="Javascript" FilePath="Application/JQuery/jquery.metadata.min.js" PathNameAlias="UmbracoClient" Priority="10" CompositeGroupName="UmbTree" />
<umb:ClientDependencyInclude ID="ClientDependencyInclude6" runat="server" DependencyType="Javascript" FilePath="Application/JQuery/jquery.cookie.js" PathNameAlias="UmbracoClient" Priority="10" CompositeGroupName="UmbTree" />
<umb:ClientDependencyInclude ID="ClientDependencyInclude2" runat="server" DependencyType="Javascript" FilePath="Tree/css.js" PathNameAlias="UmbracoClient" Priority="10" CompositeGroupName="UmbTree" />
<umb:ClientDependencyInclude ID="ClientDependencyInclude5" runat="server" DependencyType="Javascript" FilePath="Tree/tree_component.min.js" PathNameAlias="UmbracoClient" Priority="11" CompositeGroupName="UmbTree" />
<umb:ClientDependencyInclude ID="ClientDependencyInclude3" runat="server" DependencyType="Javascript" FilePath="Tree/NodeDefinition.js" PathNameAlias="UmbracoClient" Priority="12" CompositeGroupName="UmbTree" />
<umb:ClientDependencyInclude ID="ClientDependencyInclude4" runat="server" DependencyType="Javascript" FilePath="Tree/UmbracoTree.js" PathNameAlias="UmbracoClient" Priority="13" CompositeGroupName="UmbTree" />
<script type="text/javascript">

View File

@@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.1433
// Runtime Version:2.0.50727.3074
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -12,5 +12,68 @@ namespace umbraco.presentation.umbraco.controls {
public partial class TreeControl {
/// <summary>
/// ClientDependencyInclude7 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude7;
/// <summary>
/// ClientDependencyInclude1 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude1;
/// <summary>
/// ClientDependencyInclude6 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude6;
/// <summary>
/// ClientDependencyInclude2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude2;
/// <summary>
/// ClientDependencyInclude5 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude5;
/// <summary>
/// ClientDependencyInclude3 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude3;
/// <summary>
/// ClientDependencyInclude4 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude4;
}
}

View File

@@ -11,13 +11,13 @@
<title>Umbraco CMS - <%=Request.Url.Host.ToLower().Replace("www.", "") %></title>
<asp:PlaceHolder id="IActionJSFileRef" runat="server"></asp:PlaceHolder>
<script type="text/javascript">
<script type="text/javascript">
this.name = 'umbracoMain';
</script>
</head>
<body id="umbracoMainPageBody">
<umb:ClientDependencyLoader runat="server" id="ClientLoader" EmbedType="Header" IsDebugMode="false" >
<umb:ClientDependencyLoader runat="server" id="ClientLoader" EmbedType="Header" IsDebugMode="true" >
<Paths>
<umb:ClientDependencyPath Name="UmbracoClient" Path="~/umbraco_client" />
<umb:ClientDependencyPath Name="UmbracoRoot" Path='<%#umbraco.GlobalSettings.Path%>' />
@@ -26,12 +26,10 @@
<umb:ClientDependencyInclude runat="server" ID="ClientDependencyInclude3" DependencyType="Css" FilePath="css/umbracoGui.css" PathNameAlias="UmbracoRoot" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude1" DependencyType="Css" FilePath="modal/style.css" PathNameAlias="UmbracoClient" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude2" DependencyType="Css" FilePath="Tree/Themes/tree_component.css" PathNameAlias="UmbracoClient" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude4" DependencyType="Javascript" FilePath="Application/NamespaceManager.js" PathNameAlias="UmbracoClient" Priority="0" CompositeGroupName="JSCore" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude5" DependencyType="Javascript" FilePath="ui/jquery.js" PathNameAlias="UmbracoClient" Priority="0" CompositeGroupName="JSCore" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude6" DependencyType="Javascript" FilePath="ui/jqueryui.js" PathNameAlias="UmbracoClient" Priority="1" CompositeGroupName="JSAddons" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude8" DependencyType="Javascript" FilePath="Application/JQuery/jquery.metadata.min.js" PathNameAlias="UmbracoClient" Priority="1" CompositeGroupName="JSAddons" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude7" DependencyType="Javascript" FilePath="modal/modal.js" PathNameAlias="UmbracoClient" />
<umb:ClientDependencyInclude runat="server" id="ClientDependencyInclude11" DependencyType="Javascript" FilePath="Application/UmbracoApplicationActions.js" PathNameAlias="UmbracoClient" CompositeGroupName="UmbApp" />

View File

@@ -12,13 +12,14 @@ using umbraco.BasePages;
using System.Xml;
using System.Xml.XPath;
using umbraco.BusinessLogic.Actions;
using umbraco.presentation.ClientDependency;
namespace umbraco.cms.presentation
{
/// <summary>
/// Summary description for _default.
/// </summary>
public partial class _umbraco : UmbracoEnsuredPage
public partial class _umbraco : UmbracoEnsuredPage
{
protected umbWindow UmbWindow1;
protected System.Web.UI.WebControls.PlaceHolder bubbleText;

View File

@@ -49,15 +49,6 @@ namespace umbraco.cms.presentation {
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude1;
/// <summary>
/// ClientDependencyInclude2 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude2;
/// <summary>
/// ClientDependencyInclude4 control.
/// </summary>
@@ -85,15 +76,6 @@ namespace umbraco.cms.presentation {
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude6;
/// <summary>
/// ClientDependencyInclude8 control.
/// </summary>
/// <remarks>
/// Auto-generated field.
/// To modify move field declaration from designer file to code-behind file.
/// </remarks>
protected global::umbraco.presentation.ClientDependency.ClientDependencyInclude ClientDependencyInclude8;
/// <summary>
/// ClientDependencyInclude7 control.
/// </summary>

View File

@@ -0,0 +1,96 @@
/**
* Cookie plugin
*
* Copyright (c) 2006 Klaus Hartl (stilbuero.de)
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
*/
/**
* Create a cookie with the given name and value and other optional parameters.
*
* @example $.cookie('the_cookie', 'the_value');
* @desc Set the value of a cookie.
* @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
* @desc Create a cookie with all available options.
* @example $.cookie('the_cookie', 'the_value');
* @desc Create a session cookie.
* @example $.cookie('the_cookie', null);
* @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
* used when the cookie was set.
*
* @param String name The name of the cookie.
* @param String value The value of the cookie.
* @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
* @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
* If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
* If set to null or omitted, the cookie will be a session cookie and will not be retained
* when the the browser exits.
* @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
* @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
* @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
* require a secure protocol (like HTTPS).
* @type undefined
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
/**
* Get the value of a cookie with the given name.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String name The name of the cookie.
* @return The value of the cookie.
* @type String
*
* @name $.cookie
* @cat Plugins/Cookie
* @author Klaus Hartl/klaus.hartl@stilbuero.de
*/
jQuery.cookie = function(name, value, options) {
if (typeof value != 'undefined') { // name and value given, set cookie
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
}
// CAUTION: Needed to parenthesize options.path and options.domain
// in the following expressions, otherwise they evaluate to undefined
// in the packed version for some reason...
var path = options.path ? '; path=' + (options.path) : '';
var domain = options.domain ? '; domain=' + (options.domain) : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
} else { // only name given, get cookie
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = jQuery.trim(cookies[i]);
// Does this cookie string begin with the name we want?
if (cookie.substring(0, name.length + 1) == (name + '=')) {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};

View File

@@ -83,6 +83,9 @@ Umbraco.Application.Actions = function() {
this._debug("shiftApp: " + whichApp + ", " + appName + ", " + ignoreDashboard);
UmbClientMgr.mainTree().saveTreeState(this._currApp == "" ? "content" : this._currApp);
this._currApp = whichApp.toLowerCase();
if (this._currApp != 'media' && this._currApp != 'content') {
@@ -95,7 +98,8 @@ Umbraco.Application.Actions = function() {
if (!ignoreDashboard) {
UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp);
}
UmbClientMgr.mainTree().rebuildTree(whichApp);
jQuery("#treeWindowLabel").html(appName);
@@ -292,13 +296,16 @@ Umbraco.Application.Actions = function() {
if (UmbClientMgr.mainTree().getActionNode().nodeType == "content" && UmbClientMgr.mainTree().getActionNode().nodeId == '-1')
return;
this._debug("actionDelete");
if (confirm(uiKeys['defaultdialogs_confirmdelete'] + ' "' + UmbClientMgr.mainTree().getActionNode().nodeName + '"?\n\n')) {
//raise nodeDeleting event
jQuery(this).trigger("nodeDeleting", []);
var _this = this;
umbraco.presentation.webservices.legacyAjaxCalls.Delete(UmbClientMgr.mainTree().getActionNode().nodeId, "", UmbClientMgr.mainTree().getActionNode().nodeType, function() {
_this._debug("actionDelete: Raising event");
//raise nodeDeleted event
jQuery(this).trigger("nodeDeleted", []);
jQuery(_this).trigger("nodeDeleted", []);
});
}
},

View File

@@ -80,7 +80,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
/// <summary>This will rebuild the tree structure for the application specified</summary>
this._debug("rebuildTree");
if (this._app == null || (this._app.toLowerCase() == app.toLowerCase())) {
this._debug("not rebuilding");
return;
@@ -95,6 +95,22 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
this._tree.destroy();
this._container.hide();
var _this = this;
//check if we should rebuild from a saved tree
var saveData = this._container.data("tree_" + app);
if (saveData != null) {
this._debug("rebuildTree: rebuilding from cache!");
//create the tree from the saved data.
this._initNode = saveData;
this._tree = $.tree_create();
this._tree.init(this._container, this._getInitOptions());
this._configureNodes(this._container.find("li"), true);
this._container.show();
return;
}
//need to get the init node for the new app
var parameters = "{'app':'" + app + "','showContextMenu':'" + this._showContext + "', 'isDialog':'" + this._isDialog + "'}"
$.ajax({
@@ -125,7 +141,35 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
});
},
saveTreeState: function(appAlias) {
/// <summary>
/// Saves the state of the current application trees so we can restore it next time the user visits the app
/// </summary>
var saveData = this._tree.getJSON(null, [ "id", "umb:type", "class" ], [ "umb:nodedata", "href", "class", "style" ]);
//need to update the 'state' of the data. jsTree getJSON doesn't return the state of nodes (yet)!
this._updateJSONNodeState(saveData);
this._container.data("tree_" + appAlias, saveData);
},
_updateJSONNodeState: function(obj) {
/// <summary>
/// A recursive function to store the state of the node for the JSON object when using saveTreeState.
/// This is required since jsTree doesn't output the state of the tree nodes with the request to getJSON method.
/// </summary>
var c = $("li#" + obj.attributes.id).attr("class");
var state = c.indexOf("open") > -1 ? "open" : c.indexOf("closed") > -1 ? "closed" : null;
if (state != null) obj.state = state;
if (obj.children != null) {
for (var x in obj.children) {
this._updateJSONNodeState(obj.children[x]);
}
}
},
syncTree: function(path, forceReload) {
/// <summary>
/// Syncronizes the tree with the path supplied and makes that node visible/selected.
@@ -346,6 +390,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
onNodeDeleting: function(EV) {
/// <summary>Event handler for when a tree node is about to be deleted</summary>
this._debug("onNodeDeleting")
//first, close the branch
this._tree.close_branch(this._actionNode.jsNode);
//show the ajax loader with deleting text
@@ -357,6 +403,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
onNodeDeleted: function(EV) {
/// <summary>Event handler for when a tree node is deleted after ajax call</summary>
this._debug("onNodeDeleted");
//remove the ajax loader
this._actionNode.jsNode.find("a").removeClass("loading");
//ensure the branch is closed
@@ -678,7 +726,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
/// <param name="serviceUrl">Url path for the tree client service</param>
/// <param name="dataUrl">Url path for the tree data service</param>
this._debug("init: creating new tree with class/id: " + treeContainer.attr("class") + " / " + treeContainer.attr("id"));
this._debug("_init: creating new tree with class/id: " + treeContainer.attr("class") + " / " + treeContainer.attr("id"));
this._fullMenu = jFullMenu;
this._initNode = jInitNode;
@@ -722,6 +770,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls");
_getInitOptions: function() {
/// <summary>return the initialization objects for the tree</summary>
this._debug("_getInitOptions");
var _this = this;
var options = {