diff --git a/components/editorControls/BaseTreePickerEditor.cs b/components/editorControls/BaseTreePickerEditor.cs index 5be3ac5499..4c6da45c8b 100644 --- a/components/editorControls/BaseTreePickerEditor.cs +++ b/components/editorControls/BaseTreePickerEditor.cs @@ -4,6 +4,8 @@ using System.Linq; using System.Text; using umbraco.uicontrols.TreePicker; using umbraco.interfaces; +using System.Web.UI; +using umbraco.presentation; namespace umbraco.editorControls { @@ -44,7 +46,10 @@ namespace umbraco.editorControls { base.OnLoad(e); - if (!Page.IsPostBack) + //need to check if this is an async postback in live editing, because if it is, we need to set the value + if ((ScriptManager.GetCurrent(Page).IsInAsyncPostBack + && UmbracoContext.Current.LiveEditingContext.Enabled) + || !Page.IsPostBack) { ItemIdValue.Value = StoredItemId != -1 ? StoredItemId.ToString() : ""; } @@ -68,7 +73,6 @@ namespace umbraco.editorControls public void Save() { - //_text = helper.Request(this.ClientID); if (ItemIdValue.Value.Trim() != "") _data.Value = ItemIdValue.Value.Trim(); else diff --git a/components/editorControls/mediapicker/mediaChooser.cs b/components/editorControls/mediapicker/mediaChooser.cs index 4ce4a3beb5..5939450ea4 100644 --- a/components/editorControls/mediapicker/mediaChooser.cs +++ b/components/editorControls/mediapicker/mediaChooser.cs @@ -96,6 +96,7 @@ namespace umbraco.editorControls /// protected override void RenderJSComponents() { + base.RenderJSComponents(); if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack) { diff --git a/components/umbraco.controls/TreePicker/BaseTreePicker.js b/components/umbraco.controls/TreePicker/BaseTreePicker.js index 2992bfe471..c4e30ddff0 100644 --- a/components/umbraco.controls/TreePicker/BaseTreePicker.js +++ b/components/umbraco.controls/TreePicker/BaseTreePicker.js @@ -19,9 +19,19 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); return $("#" + this._itemIdValueClientID).val(); }, - LaunchPicker: function() { + LaunchPicker: function(e) { var _this = this; UmbClientMgr.openModalWindow(this._itemPickerUrl, this._label, this._showHeader, this._width, this._height, 30, 0, ['#cancelbutton'], function(e) { _this.SaveSelection(e); }); + + var aBetterEventObject = jQuery.Event(e); + // Now you can do what you want: (Cross-browser) + aBetterEventObject.preventDefault() + aBetterEventObject.isDefaultPrevented() + aBetterEventObject.stopPropagation() + aBetterEventObject.isPropagationStopped() + aBetterEventObject.stopImmediatePropagation() + aBetterEventObject.isImmediatePropagationStopped() + return false; }, SaveSelection: function(e) { diff --git a/umbraco/cms/businesslogic/web/Document.cs b/umbraco/cms/businesslogic/web/Document.cs index 938b38c6b6..eb95bb4c6c 100644 --- a/umbraco/cms/businesslogic/web/Document.cs +++ b/umbraco/cms/businesslogic/web/Document.cs @@ -58,23 +58,25 @@ namespace umbraco.cms.businesslogic.web {1} "; private const string m_SQLOptimizedChildren = @" - select - count(children.id) as children, umbracoNode.id, umbracoNode.uniqueId, umbracoNode.level, umbracoNode.parentId, cmsDocument.documentUser, cmsDocument.templateId, umbracoNode.path, umbracoNode.sortOrder, coalesce(publishCheck.published,0) as published, umbracoNode.createDate, cmsDocument.text, cmsDocument.updateDate, cmsContentVersion.versionDate, cmsContentType.icon, cmsContentType.alias, cmsContentType.thumbnail, cmsContentType.description, cmsContentType.masterContentType, cmsContentType.nodeId as contentTypeId - from umbracoNode - left join umbracoNode children on children.parentId = umbracoNode.id - inner join cmsContent on cmsContent.nodeId = umbracoNode.id - inner join cmsContentType on cmsContentType.nodeId = cmsContent.contentType - inner join (select contentId, max(versionDate) AS versionDate from cmsContentVersion - inner join umbracoNode on umbracoNode.id = cmsContentVersion.contentId and umbracoNode.parentId = @parentId - group by contentId) AS temp - on temp.contentId = cmsContent.nodeId - inner join cmsContentVersion on cmsContentVersion.contentId = temp.contentId and cmsContentVersion.versionDate = temp.versionDate - inner join cmsDocument on cmsDocument.versionId = cmsContentversion.versionId - left join cmsDocument publishCheck on publishCheck.nodeId = cmsContent.nodeID and publishCheck.published = 1 - where {0} - group by umbracoNode.id, umbracoNode.uniqueId, umbracoNode.level, umbracoNode.parentId, cmsDocument.documentUser, cmsDocument.templateId, umbracoNode.path, umbracoNode.sortOrder, coalesce(publishCheck.published,0), umbracoNode.createDate, cmsDocument.text, cmsDocument.updateDate, cmsContentVersion.versionDate, cmsContentType.icon, cmsContentType.alias, cmsContentType.thumbnail, cmsContentType.description, cmsContentType.masterContentType, cmsContentType.nodeId - order by {1} - "; + select count(children.id) as children, umbracoNode.id, umbracoNode.uniqueId, umbracoNode.level, umbracoNode.parentId, cmsDocument.documentUser, + coalesce(cmsDocument.templateId, cmsDocumentType.templateNodeId) as templateId, umbracoNode.path, umbracoNode.sortOrder, coalesce(publishCheck.published,0) as published, umbracoNode.createDate, cmsDocument.text, cmsDocument.updateDate, cmsContentVersion.versionDate, cmsContentType.icon, cmsContentType.alias, cmsContentType.thumbnail, cmsContentType.description, cmsContentType.masterContentType, cmsContentType.nodeId as contentTypeId + from umbracoNode + left join umbracoNode children on children.parentId = umbracoNode.id + inner join cmsContent on cmsContent.nodeId = umbracoNode.id + inner join cmsContentType on cmsContentType.nodeId = cmsContent.contentType + inner join (select contentId, max(versionDate) AS versionDate from cmsContentVersion + inner join umbracoNode on umbracoNode.id = cmsContentVersion.contentId and umbracoNode.parentId = @parentId + group by contentId) AS temp + on temp.contentId = cmsContent.nodeId + inner join cmsContentVersion on cmsContentVersion.contentId = temp.contentId and cmsContentVersion.versionDate = temp.versionDate + inner join cmsDocument on cmsDocument.versionId = cmsContentversion.versionId + left join cmsDocument publishCheck on publishCheck.nodeId = cmsContent.nodeID and publishCheck.published = 1 + left join cmsDocumentType on + cmsDocumentType.contentTypeNodeId = cmsContent.contentType and cmsDocumentType.IsDefault = 1 + where {0} + group by umbracoNode.id, umbracoNode.uniqueId, umbracoNode.level, umbracoNode.parentId, cmsDocument.documentUser, cmsDocument.templateId, cmsDocumentType.templateNodeId, umbracoNode.path, umbracoNode.sortOrder, coalesce(publishCheck.published,0), umbracoNode.createDate, cmsDocument.text, cmsDocument.updateDate, cmsContentVersion.versionDate, cmsContentType.icon, cmsContentType.alias, cmsContentType.thumbnail, cmsContentType.description, cmsContentType.masterContentType, cmsContentType.nodeId + order by {1} + "; private const string m_SQLOptimizedForPreview = @" select umbracoNode.id, umbracoNode.parentId, umbracoNode.level, umbracoNode.sortOrder, cmsDocument.versionId, cmsPreviewXml.xml from cmsDocument @@ -1245,7 +1247,7 @@ namespace umbraco.cms.businesslogic.web , dr.GetString("description") , masterContentType , dr.GetInt("contentTypeId") - ,dr.GetInt("templateId")); + , dr.GetInt("templateId")); tmp.Add(d); } } diff --git a/umbraco/presentation/config/ClientDependency.config b/umbraco/presentation/config/ClientDependency.config index f313c848cf..f0fd979c11 100644 --- a/umbraco/presentation/config/ClientDependency.config +++ b/umbraco/presentation/config/ClientDependency.config @@ -1,4 +1,4 @@ - + diff --git a/umbraco/presentation/umbraco.presentation.csproj b/umbraco/presentation/umbraco.presentation.csproj index 4757bb0e30..aec629fee4 100644 --- a/umbraco/presentation/umbraco.presentation.csproj +++ b/umbraco/presentation/umbraco.presentation.csproj @@ -845,13 +845,6 @@ insertTable.aspx - - modalHolder.aspx - ASPXCodeBehind - - - modalHolder.aspx - moveOrCopy.aspx ASPXCodeBehind @@ -1848,7 +1841,6 @@ - @@ -2801,7 +2793,6 @@ umbraco.xsd - diff --git a/umbraco/presentation/umbraco/LiveEditing/Modules/ItemEditing/LiveEditingItemRenderer.cs b/umbraco/presentation/umbraco/LiveEditing/Modules/ItemEditing/LiveEditingItemRenderer.cs index 23a03f1f7f..d31a18fcc9 100644 --- a/umbraco/presentation/umbraco/LiveEditing/Modules/ItemEditing/LiveEditingItemRenderer.cs +++ b/umbraco/presentation/umbraco/LiveEditing/Modules/ItemEditing/LiveEditingItemRenderer.cs @@ -133,7 +133,7 @@ namespace umbraco.presentation.LiveEditing.Modules.ItemEditing ItemUpdate latestUpdate = updates.GetLatest(u => u.NodeId == item.GetParsedNodeId() && u.Field == item.Field); if (latestUpdate != null) - return latestUpdate.Data.ToString(); + return latestUpdate.Data as string; //can't use ToString() as a null value will throw an exception else return base.GetFieldContents(item); } diff --git a/umbraco/presentation/umbraco/controls/Tree/TreeControl.ascx b/umbraco/presentation/umbraco/controls/Tree/TreeControl.ascx index 997d42a409..76da609c70 100644 --- a/umbraco/presentation/umbraco/controls/Tree/TreeControl.ascx +++ b/umbraco/presentation/umbraco/controls/Tree/TreeControl.ascx @@ -32,9 +32,8 @@ jQuery(document).ready(function() { //create the javascript tree jQuery("#<%=ClientID%>").UmbracoTree({ jsonFullMenu: ctxMenu, - //jsonInitNode: initNode, appActions: UmbClientMgr.appActions(), - uiKeys: UmbClientMgr.uiKeys(), + deletingText: '<%=umbraco.ui.GetText("deleting")%>', app: app, showContext: showContext, isDialog: isDialog, @@ -47,12 +46,15 @@ jQuery(document).ready(function() { dataUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeDataService.ashx", serviceUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeClientService.asmx/GetInitAppTreeData"}); - //add event handler for ajax errors, this will refresh the whole application - UmbClientMgr.mainTree().addEventHandler("ajaxError", function(e) { - if (e.msg == "rebuildTree") { - UmbClientMgr.mainWindow("umbraco.aspx"); - } - }); + //add event handler for ajax errors, this will refresh the whole application + var mainTree = UmbClientMgr.mainTree(); + if (mainTree != null) { + mainTree.addEventHandler("ajaxError", function(e) { + if (e.msg == "rebuildTree") { + UmbClientMgr.mainWindow("umbraco.aspx"); + } + }); + } }); diff --git a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs index fad99034e3..4f6f85db44 100644 --- a/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs +++ b/umbraco/presentation/umbraco/masterpages/umbracoDialog.Master.designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4927 +// Runtime Version:2.0.50727.4200 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. diff --git a/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js b/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js index ca31d8df01..e46e188c4d 100644 --- a/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js +++ b/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js @@ -46,12 +46,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); if (this.mainWindow().jQuery == null || this.mainWindow().jQuery(".umbTree").length == 0 || this.mainWindow().jQuery(".umbTree").UmbracoTreeAPI() == null) { - - this._mainTree = $("
").appendTo("body").hide().UmbracoTree({ - uiKeys: this.uiKeys(), - jsonFullMenu: {}, - appActions: this.appActions() - }).UmbracoTreeAPI(); + this._mainTree = null; } else { this._mainTree = this.mainWindow().jQuery(".umbTree").UmbracoTreeAPI(); diff --git a/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js b/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js index 6716ee494e..ece84fc38b 100644 --- a/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js +++ b/umbraco/presentation/umbraco_client/Tree/UmbracoTree.js @@ -9,13 +9,18 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); + +//TODO: The configuration properties need to be refactored. +// we should have internal objects holding the properties instead of global class properties, this +// will make it much easier to use $.extend to set the properties of this class from user properties. + (function($) { $.fn.UmbracoTree = function(opts) { /// opts must have these properties: (* is required) /// - /// *jsonFullMenu : - /// *appActions : A reference to a MenuActions object - /// *uiKeys : A reference to a uiKeys object + /// jsonFullMenu : The tree menu, by default is empty + /// appActions : A reference to a MenuActions object + /// deletingText : the txt to display when a node is deleting /// treeMode :determines the type of tree: false/null = normal, 'checkbox' = checkboxes enabled, 'inheritedcheckbox' = parent nodes have checks inherited from children /// *serviceUrl :Url path for the tree client service /// *dataUrl :Url path for the tree data service @@ -33,9 +38,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); return this.each(function() { var conf = $.extend({ - jsonFullMenu: null, + jsonFullMenu: {}, appActions: null, - uiKeys: null, //These are all properties of the ITreeService and are //used to pass the properties in to the InitAppTreeData service @@ -50,9 +54,10 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); treeMode: "standard", umbClientFolderRoot: "/umbraco_client", //default setting... this gets overriden. recycleBinId: -20, //default setting for content tree - serviceUrl: "", //if these aren't set, nothing will work - dataUrl: "" //if these arent' set, nothing will work + serviceUrl: "", //if not set, no async calls are made, the tree won't work + dataUrl: "" //if not set, no async calls are made, the tree won't work }, opts); + new Umbraco.Controls.UmbracoTree().init($(this), conf); }); }; @@ -82,10 +87,10 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); _activeTreeType: "content", //tracks which is the active tree type, this is used in searching and syncing. _recycleBinId: -20, _umbClientFolderRoot: "/umbraco_client", //this should be set externally!!! - _fullMenu: null, + _fullMenu: {}, _appActions: null, _tree: null, //reference to the jsTree object - _uiKeys: null, + _deletingText: "...", _app: null, //the reference to the current app _showContext: true, _isDialog: false, @@ -120,7 +125,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); this._fullMenu = conf.jsonFullMenu; this._appActions = conf.appActions; - this._uiKeys = conf.uiKeys; + this._deletingText = conf.deletingText; this._treeMode = conf.treeMode; this._serviceUrl = conf.serviceUrl; this._dataUrl = conf.dataUrl; @@ -190,7 +195,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); this.rebuildTree(app); this._debug("Edit mode. New Mode: " + this._tree.settings.rules.draggable); - this._appActions.showSpeachBubble("info", "Tree Edit Mode", "The tree is now operating in edit mode"); + if (this._appActions) + this._appActions.showSpeachBubble("info", "Tree Edit Mode", "The tree is now operating in edit mode"); }, refreshTree: function() { @@ -552,7 +558,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); //show the ajax loader with deleting text this._actionNode.jsNode.find("a").attr("class", "loading"); this._actionNode.jsNode.find("a").css("background-image", ""); - this._actionNode.jsNode.find("a").html(this._uiKeys['deleting']); + this._actionNode.jsNode.find("a").html(this._deletingText); }, onNodeDeleted: function(EV) { @@ -560,12 +566,17 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); this._debug("onNodeDeleted"); + var nodeToDel = this._actionNode.jsNode; + //remove the ajax loader - this._actionNode.jsNode.find("a").removeClass("loading"); + nodeToDel.find("a").removeClass("loading"); //ensure the branch is closed - this._tree.close_branch(this._actionNode.jsNode); + this._tree.close_branch(nodeToDel); //make the node disapear - this._actionNode.jsNode.hide("drop", { direction: "down" }, 400); + nodeToDel.hide("drop", { direction: "down" }, 400, function() { + //remove the node from the DOM + nodeToDel.remove(); + }); this._updateRecycleBin(); }, @@ -697,7 +708,8 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); case "inside": if (nodeParentDef.nodeId == refNodeDef.nodeId) { //moving to the same node! - this._appActions.showSpeachBubble("warning", "Tree Edit Mode", "Cannot move a node to it's same parent node"); + if (this._appActions) + this._appActions.showSpeachBubble("warning", "Tree Edit Mode", "Cannot move a node to it's same parent node"); return false; } //check move permissions, then attempt move @@ -732,7 +744,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); }, _debug: function(strMsg) { - if (this._isDebug) { + if (this._isDebug && Sys && Sys.Debug) { Sys.Debug.trace("UmbracoTree: " + strMsg); } }, @@ -799,6 +811,7 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); }, _updateRecycleBin: function() { + /// Generally used for when a node is deleted. This will set the actionNode to the recycle bin node and force a refresh of it's children this._debug("_updateRecycleBin BinId: " + this._recycleBinId); var rNode = this.findNode(this._recycleBinId, true); @@ -1029,11 +1042,18 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls"); options.plugins.checkbox = { three_state: false } } + //if there's no service URL, then disable ajax requests + if (this._serviceUrl == "" || this._dataUrl == "") { + options.data.async = false; + options.data.opts.static = {}; + } + //set global ajax settings: $.ajaxSetup({ contentType: "application/json; charset=utf-8" }); + this._debug("_getInitOptions. Async enabled = " + options.data.async); return options; } diff --git a/umbraco/presentation/web.config b/umbraco/presentation/web.config deleted file mode 100644 index a2e0224d4c..0000000000 --- a/umbraco/presentation/web.config +++ /dev/null @@ -1,221 +0,0 @@ - - - -
-
- - - -
- -
-
-
-
- - - - -
- -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - http://regexlib.com/WebServices.asmx - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/umbraco/presentation/web.config.SHANDEMVAIO.xslt b/umbraco/presentation/web.config.SHANDEMVAIO.xslt index 3a764515ed..74c4330475 100644 --- a/umbraco/presentation/web.config.SHANDEMVAIO.xslt +++ b/umbraco/presentation/web.config.SHANDEMVAIO.xslt @@ -4,7 +4,7 @@ - server=.\sqlexpress;database=UmbracoTest3;user id=sa;password=test + server=.\sqlexpress;database=UmbracoTest4;user id=sa;password=test diff --git a/umbraco/umbraco.Legacy/umbraco.Legacy.csproj b/umbraco/umbraco.Legacy/umbraco.Legacy.csproj index 57135cdb57..9d64b896ce 100644 --- a/umbraco/umbraco.Legacy/umbraco.Legacy.csproj +++ b/umbraco/umbraco.Legacy/umbraco.Legacy.csproj @@ -84,6 +84,13 @@ + + modalHolder.aspx + ASPXCodeBehind + + + modalHolder.aspx + paste.aspx ASPXCodeBehind @@ -199,6 +206,7 @@ + diff --git a/umbraco/presentation/umbraco/dialogs/modalHolder.aspx b/umbraco/umbraco.Legacy/umbraco/dialogs/modalHolder.aspx similarity index 100% rename from umbraco/presentation/umbraco/dialogs/modalHolder.aspx rename to umbraco/umbraco.Legacy/umbraco/dialogs/modalHolder.aspx diff --git a/umbraco/presentation/umbraco/dialogs/modalHolder.aspx.cs b/umbraco/umbraco.Legacy/umbraco/dialogs/modalHolder.aspx.cs similarity index 100% rename from umbraco/presentation/umbraco/dialogs/modalHolder.aspx.cs rename to umbraco/umbraco.Legacy/umbraco/dialogs/modalHolder.aspx.cs diff --git a/umbraco/presentation/umbraco/dialogs/modalHolder.aspx.designer.cs b/umbraco/umbraco.Legacy/umbraco/dialogs/modalHolder.aspx.designer.cs similarity index 100% rename from umbraco/presentation/umbraco/dialogs/modalHolder.aspx.designer.cs rename to umbraco/umbraco.Legacy/umbraco/dialogs/modalHolder.aspx.designer.cs