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.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 6ab74b0312..9233417456 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -390,7 +390,7 @@ - + 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.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"/> diff --git a/src/Umbraco.Web/umbraco.presentation/macro.cs b/src/Umbraco.Web/umbraco.presentation/macro.cs index 231b413bef..17668fb9c6 100644 --- a/src/Umbraco.Web/umbraco.presentation/macro.cs +++ b/src/Umbraco.Web/umbraco.presentation/macro.cs @@ -825,7 +825,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); } @@ -834,7 +834,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 @@ -876,13 +876,14 @@ 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()); + // [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()); + //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; 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); 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 {