From ebd87e0eaa1a97827a9fcd218b2df3a8b2837063 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Thu, 23 Aug 2012 17:55:45 -0100 Subject: [PATCH 1/5] Implemented U4-86 - Move EXSLT references from being predefined in core to xsltExtensions.config --- .../config/xsltExtensions.Release.config | 12 ++++++++---- .../config/xsltExtensions.config | 18 ++++++++++-------- src/Umbraco.Web/umbraco.presentation/macro.cs | 14 +++++++------- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/Umbraco.Web.UI/config/xsltExtensions.Release.config b/src/Umbraco.Web.UI/config/xsltExtensions.Release.config index 2fb354dac8..17962f8205 100644 --- a/src/Umbraco.Web.UI/config/xsltExtensions.Release.config +++ b/src/Umbraco.Web.UI/config/xsltExtensions.Release.config @@ -1,7 +1,11 @@  - + + + + + + + + diff --git a/src/Umbraco.Web.UI/config/xsltExtensions.config b/src/Umbraco.Web.UI/config/xsltExtensions.config index ec28d3d403..17962f8205 100644 --- a/src/Umbraco.Web.UI/config/xsltExtensions.config +++ b/src/Umbraco.Web.UI/config/xsltExtensions.config @@ -1,9 +1,11 @@ - + - - - - - - \ No newline at end of file + + + + + + + + + diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index f3c6116e42..acad28285a 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -867,13 +867,13 @@ namespace umbraco { m_PredefinedExtensions = new Dictionary(); - // add predefined EXSLT extensions - m_PredefinedExtensions.Add("Exslt.ExsltCommon", new ExsltCommon()); - m_PredefinedExtensions.Add("Exslt.ExsltDatesAndTimes", new ExsltDatesAndTimes()); - m_PredefinedExtensions.Add("Exslt.ExsltMath", new ExsltMath()); - m_PredefinedExtensions.Add("Exslt.ExsltRegularExpressions", new ExsltRegularExpressions()); - m_PredefinedExtensions.Add("Exslt.ExsltStrings", new ExsltStrings()); - m_PredefinedExtensions.Add("Exslt.ExsltSets", new ExsltSets()); + //// add predefined EXSLT extensions + //m_PredefinedExtensions.Add("Exslt.ExsltCommon", new ExsltCommon()); + //m_PredefinedExtensions.Add("Exslt.ExsltDatesAndTimes", new ExsltDatesAndTimes()); + //m_PredefinedExtensions.Add("Exslt.ExsltMath", new ExsltMath()); + //m_PredefinedExtensions.Add("Exslt.ExsltRegularExpressions", new ExsltRegularExpressions()); + //m_PredefinedExtensions.Add("Exslt.ExsltStrings", new ExsltStrings()); + //m_PredefinedExtensions.Add("Exslt.ExsltSets", new ExsltSets()); } return m_PredefinedExtensions; From 9e4cf35370e092469bdf145b0f050d39fab8049c Mon Sep 17 00:00:00 2001 From: PerPloug Date: Fri, 24 Aug 2012 07:00:04 -0200 Subject: [PATCH 2/5] Small script name change to reflect custom codearea script --- src/umbraco.controls/CodeArea.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/umbraco.controls/CodeArea.cs b/src/umbraco.controls/CodeArea.cs index 2d0ef6ffc4..9528db9678 100644 --- a/src/umbraco.controls/CodeArea.cs +++ b/src/umbraco.controls/CodeArea.cs @@ -55,7 +55,7 @@ namespace umbraco.uicontrols { get { - return !UmbracoSettings.ScriptDisableEditor && HttpContext.Current.Request.Browser.Browser != "IE"; + return !UmbracoSettings.ScriptDisableEditor; // && HttpContext.Current.Request.Browser.Browser != "IE"; } } @@ -88,7 +88,7 @@ namespace umbraco.uicontrols if (AutoSuggest) { - ClientDependencyLoader.Instance.RegisterDependency(3, "CodeMirror/js/lib/util/simple-hint.js", "UmbracoClient", ClientDependencyType.Javascript); + ClientDependencyLoader.Instance.RegisterDependency(3, "CodeMirror/js/lib/util/simple-hint-customized.js", "UmbracoClient", ClientDependencyType.Javascript); ClientDependencyLoader.Instance.RegisterDependency(4, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hint.js", "UmbracoClient", ClientDependencyType.Javascript); ClientDependencyLoader.Instance.RegisterDependency(5, "CodeMirror/js/lib/util/" + CodeBase.ToString().ToLower() + "-hints.js", "UmbracoClient", ClientDependencyType.Javascript); From b2eeb6a70d5eadc634a14882371b5826952c42d1 Mon Sep 17 00:00:00 2001 From: PerPloug Date: Fri, 24 Aug 2012 07:01:54 -0200 Subject: [PATCH 3/5] Script rename, fixes a couple of IE bugs, much more stable now, much better in IE now, so with a bit of more thorough use, it could be included by default for IE --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 +- .../umbraco/developer/Xslt/editXslt.aspx | 15 ++++-------- .../umbraco_client/CodeArea/UmbracoEditor.js | 23 ++++++++++++++++--- .../CodeMirror/js/lib/util/razor-hint.js | 2 +- ...mple-hint.js => simple-hint-customized.js} | 12 +++++----- .../web.Template.KRAFTWERK.Debug.config | 2 +- 6 files changed, 33 insertions(+), 23 deletions(-) rename src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/{simple-hint.js => simple-hint-customized.js} (95%) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 2ee1bcb343..339ce5f28d 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -382,7 +382,7 @@ - + diff --git a/src/Umbraco.Web.UI/umbraco/developer/Xslt/editXslt.aspx b/src/Umbraco.Web.UI/umbraco/developer/Xslt/editXslt.aspx index 4e96930591..2c11e6b2a6 100644 --- a/src/Umbraco.Web.UI/umbraco/developer/Xslt/editXslt.aspx +++ b/src/Umbraco.Web.UI/umbraco/developer/Xslt/editXslt.aspx @@ -55,17 +55,10 @@ function xsltVisualize() { - xsltSnippet = UmbEditor.IsSimpleEditor - ? jQuery("#<%= editorSource.ClientID %>").getSelection().text - : UmbEditor._editor.selection(); - - if (xsltSnippet == '') { - xsltSnippet = UmbEditor.IsSimpleEditor - ? jQuery("#<%= editorSource.ClientID %>").val() - : UmbEditor.GetCode(); - // alert('Please select the xslt to visualize'); - } - + xsltSnippet = UmbEditor.GetSelection(); + if (xsltSnippet == '') + UmbEditor.GetCode() + UmbClientMgr.openModalWindow('<%= umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) %>/developer/xslt/xsltVisualize.aspx', 'Visualize XSLT', true, 550, 650); } diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js index 448ba1bb40..561fb5e126 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js +++ b/src/Umbraco.Web.UI/umbraco_client/CodeArea/UmbracoEditor.js @@ -39,7 +39,16 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); //this is a wrapper for CodeMirror this._editor.setValue(code); } - }, + }, + GetSelection: function(code) { + if (this.IsSimpleEditor) { + this._control.getSelection().text + } + else { + //this is a wrapper for CodeMirror + this._editor.getSelection(); + } + }, Insert: function(open, end, txtEl, arg3) { //arg3 gets appended to open, not actually sure why it's needed but we'll keep it for legacy, it's optional if (_isSimpleEditor) { @@ -115,17 +124,25 @@ Umbraco.Sys.registerNamespace("Umbraco.Controls.CodeEditor"); this._control.keyup( function() {storeCaret(this)} ); } else { + + /* + //Removed as its not needed in codemirror2 apparently this._editor.options.cursorActivity = function() { _this._cmSave = { start: _this._editor.cursorPosition(true), //save start position end: _this._editor.cursorPosition(false) //save end position } - } + }*/ + } } } }; - obj._IESelectionHelper(); + + // obj._IESelectionHelper(); + + // alert(obj); + return obj; } })(jQuery); diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/razor-hint.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/razor-hint.js index 45f52f1a8e..47840ffcf7 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/razor-hint.js +++ b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/razor-hint.js @@ -116,4 +116,4 @@ }); } -})(); +})(); diff --git a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/simple-hint.js b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/simple-hint-customized.js similarity index 95% rename from src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/simple-hint.js rename to src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/simple-hint-customized.js index f6bfd983b2..4771938758 100644 --- a/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/simple-hint.js +++ b/src/Umbraco.Web.UI/umbraco_client/CodeMirror/js/lib/util/simple-hint-customized.js @@ -28,14 +28,14 @@ var opt = sel.appendChild(document.createElement("option")); var completion = completions[i]; - if (typeof completion === 'string') { - opt.appendChild(document.createTextNode(completion)); - opt.setAttribute("value", completion); - } - else { + if (typeof completion === 'object') { opt.appendChild(document.createTextNode(completion[0])); opt.setAttribute("value", completion[1]); } + else if(typeof completion === 'string') { + opt.appendChild(document.createTextNode(completion)); + opt.setAttribute("value", completion); + } } sel.firstChild.selected = true; sel.size = Math.min(10, completions.length); @@ -83,4 +83,4 @@ if (window.opera) setTimeout(function () { if (!done) sel.focus(); }, 100); return true; }; -})(); +})(); diff --git a/src/Umbraco.Web.UI/web.Template.KRAFTWERK.Debug.config b/src/Umbraco.Web.UI/web.Template.KRAFTWERK.Debug.config index f9e4ae7f7f..2a29c9859e 100644 --- a/src/Umbraco.Web.UI/web.Template.KRAFTWERK.Debug.config +++ b/src/Umbraco.Web.UI/web.Template.KRAFTWERK.Debug.config @@ -17,7 +17,7 @@ + value="server=.\sqlexpress;database=umbraco4_dev;user id=web;password=farmer"/> From e9e598d32c41475859032c39d828849dc85e4934 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Fri, 24 Aug 2012 13:14:52 -0100 Subject: [PATCH 4/5] Corrected typo (macro/xsltExtensions) --- src/Umbraco.Web/umbraco.presentation/macro.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index acad28285a..10877e3de8 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -820,7 +820,7 @@ namespace umbraco { throw new Exception( String.Format( - "Could not load assembly {0} for XSLT extension {1}. Please check config/xsltExentions.config.", + "Could not load assembly {0} for XSLT extension {1}. Please check config/xsltExtensions.config.", extensionFile, xsltEx.Attributes["alias"].Value), ex); } @@ -829,7 +829,7 @@ namespace umbraco if (extensionType == null) throw new Exception( String.Format( - "Could not load type {0} ({1}) for XSLT extension {1}. Please check config/xsltExentions.config.", + "Could not load type {0} ({1}) for XSLT extension {1}. Please check config/xsltExtensions.config.", xsltEx.Attributes["type"].Value, extensionFile, xsltEx.Attributes["alias"].Value)); // create an instance and add it to the extensions list @@ -867,6 +867,7 @@ namespace umbraco { m_PredefinedExtensions = new Dictionary(); + // [LK] U4-86 Move EXSLT references from being predefined in core to xsltExtensions.config //// add predefined EXSLT extensions //m_PredefinedExtensions.Add("Exslt.ExsltCommon", new ExsltCommon()); //m_PredefinedExtensions.Add("Exslt.ExsltDatesAndTimes", new ExsltDatesAndTimes()); From bf5c3bf5ae43aab3b6004e831ae95f44bc611bb2 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Fri, 24 Aug 2012 13:56:39 -0100 Subject: [PATCH 5/5] Fixes U4-688 - 4.8.1 can't upgrade using SQLCE (Also preparation for resolving U4-677 - SQLCE Medium Trust) --- src/SQLCE4Umbraco/SqlCEHelper.cs | 27 +++++++++++++++---- .../Installer/DefaultInstallerUtility.cs | 20 +++++++------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/src/SQLCE4Umbraco/SqlCEHelper.cs b/src/SQLCE4Umbraco/SqlCEHelper.cs index 665106d58f..3c66f9a5f2 100644 --- a/src/SQLCE4Umbraco/SqlCEHelper.cs +++ b/src/SQLCE4Umbraco/SqlCEHelper.cs @@ -16,7 +16,6 @@ using System.Diagnostics; using umbraco.DataLayer; using umbraco.DataLayer.SqlHelpers.SqlServer; - namespace SqlCE4Umbraco { /// @@ -39,7 +38,7 @@ namespace SqlCE4Umbraco internal void CreateEmptyDatabase() { var localConnection = new SqlCeConnection(ConnectionString); - if (!System.IO.File.Exists(localConnection.Database)) + if (!System.IO.File.Exists(ReplaceDataDirectory(localConnection.Database))) { var sqlCeEngine = new SqlCeEngine(ConnectionString); sqlCeEngine.CreateDatabase(); @@ -52,8 +51,7 @@ namespace SqlCE4Umbraco internal void ClearDatabase() { var localConnection = new SqlCeConnection(ConnectionString); - var dbFile = localConnection.Database; - if (System.IO.File.Exists(dbFile)) + if (!System.IO.File.Exists(ReplaceDataDirectory(localConnection.Database))) { var tables = new List(); using (var reader = ExecuteReader("select table_name from information_schema.tables where TABLE_TYPE <> 'VIEW'")) @@ -80,10 +78,29 @@ namespace SqlCE4Umbraco //this will occur because there is no cascade option, so we just wanna try the next one } } - } + } } } + /// + /// Replaces the data directory with a local path. + /// + /// The path. + /// A local path with the resolved 'DataDirectory' mapping. + private string ReplaceDataDirectory(string path) + { + if (!string.IsNullOrWhiteSpace(path) && path.Contains("|DataDirectory|")) + { + var dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string; + if (!string.IsNullOrEmpty(dataDirectory)) + { + path = path.Replace("|DataDirectory|", dataDirectory); + } + } + + return path; + } + /// /// Creates a new parameter for use with this specific implementation of ISqlHelper. /// diff --git a/src/umbraco.datalayer/Utility/Installer/DefaultInstallerUtility.cs b/src/umbraco.datalayer/Utility/Installer/DefaultInstallerUtility.cs index 882dbe19fa..16c51bae78 100644 --- a/src/umbraco.datalayer/Utility/Installer/DefaultInstallerUtility.cs +++ b/src/umbraco.datalayer/Utility/Installer/DefaultInstallerUtility.cs @@ -196,17 +196,19 @@ namespace umbraco.DataLayer.Utility.Installer { if(v.ExpectedRows > -1) { - var reader = SqlHelper.ExecuteReader(v.Sql); - var rowCount = 0; - - if(reader.HasRecords) + using (var reader = SqlHelper.ExecuteReader(v.Sql)) { - while (reader.Read()) - rowCount++; - } + var rowCount = 0; - if (v.ExpectedRows != rowCount) - continue; + //if (reader.HasRecords) + //{ + while (reader.Read()) + rowCount++; + //} + + if (v.ExpectedRows != rowCount) + continue; + } } else {