<commit_before>﻿Umbraco.Sys.registerNamespace("Umbraco.Editors");

(function ($) {

    Umbraco.Editors.EditXslt = base2.Base.extend({
        //private methods/variables
        _opts: null,

        // Constructor
        constructor: function(opts) {
            // Merge options with default
            this._opts = $.extend({
                

                // Default options go here
            }, opts);
        },

        init: function () {
            //setup UI elements
            var self = this;

            //bind to the save event
            this._opts.saveButton.click(function (event) {
                event.preventDefault();
                self.doSubmit();
            });
        },
        
        doSubmit: function () {
            var self = this;

            var fileName = this._opts.nameTxtBox.val();
            var codeVal = this._opts.editorSourceElement.val();
            //if CodeMirror is not defined, then the code editor is disabled.
            if (typeof (CodeMirror) != "undefined") {
                codeVal = UmbEditor.GetCode();
            }
            umbraco.presentation.webservices.codeEditorSave.SaveXslt(
                fileName, self._opts.originalFileName, codeVal, self._opts.skipTestingCheckBox.is(':checked'),
                function (t) { self.submitSucces(t); },
                function (t) { self.submitFailure(t); });

        },

        submitSucces: function (t) {
            if (t != 'true') {
                top.UmbSpeechBubble.ShowMessage('error', 'Saving Xslt file failed',"<pre>" + t + "</pre>");
            }
            
            var newFilePath = this._opts.nameTxtBox.val();

            //if the filename changes, we need to redirect since the file name is used in the url
            if (this._opts.originalFileName != newFilePath) {
                var newLocation = window.location.pathname + "?" + "&file=" + newFilePath;

                UmbClientMgr.contentFrame(newLocation);

                //we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done!
                top.UmbSpeechBubble.ShowMessage('save', 'Xslt file saved', '');
            }
            else {

                top.UmbSpeechBubble.ShowMessage('save', 'Xslt file saved', '');
                UmbClientMgr.mainTree().setActiveTreeType('xslt');
                //we need to pass in the newId parameter so it knows which node to resync after retreival from the server
                UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath);
                //set the original file path to the new one
                this._opts.originalFileName = newFilePath;
            }

            
        },

        submitFailure: function (t) {
            alert(t);
            top.UmbSpeechBubble.ShowMessage('warning', 'Xslt file could not be saved', '');
        }
    });
})(jQuery);<commit_msg>U4-5973 Fix casing of word XSLT when saving a XSLT file<commit_after>﻿Umbraco.Sys.registerNamespace("Umbraco.Editors");

(function ($) {

    Umbraco.Editors.EditXslt = base2.Base.extend({
        //private methods/variables
        _opts: null,

        // Constructor
        constructor: function(opts) {
            // Merge options with default
            this._opts = $.extend({
                

                // Default options go here
            }, opts);
        },

        init: function () {
            //setup UI elements
            var self = this;

            //bind to the save event
            this._opts.saveButton.click(function (event) {
                event.preventDefault();
                self.doSubmit();
            });
        },
        
        doSubmit: function () {
            var self = this;

            var fileName = this._opts.nameTxtBox.val();
            var codeVal = this._opts.editorSourceElement.val();
            //if CodeMirror is not defined, then the code editor is disabled.
            if (typeof (CodeMirror) != "undefined") {
                codeVal = UmbEditor.GetCode();
            }
            umbraco.presentation.webservices.codeEditorSave.SaveXslt(
                fileName, self._opts.originalFileName, codeVal, self._opts.skipTestingCheckBox.is(':checked'),
                function (t) { self.submitSucces(t); },
                function (t) { self.submitFailure(t); });

        },

        submitSucces: function (t) {
            if (t != 'true') {
                top.UmbSpeechBubble.ShowMessage('error', 'Saving XSLT file failed',"<pre>" + t + "</pre>");
            }
            
            var newFilePath = this._opts.nameTxtBox.val();

            //if the filename changes, we need to redirect since the file name is used in the url
            if (this._opts.originalFileName != newFilePath) {
                var newLocation = window.location.pathname + "?" + "&file=" + newFilePath;

                UmbClientMgr.contentFrame(newLocation);

                //we need to do this after we navigate otherwise the navigation will wait unti lthe message timeout is done!
                top.UmbSpeechBubble.ShowMessage('save', 'XSLT file saved', '');
            }
            else {

                top.UmbSpeechBubble.ShowMessage('save', 'XSLT file saved', '');
                UmbClientMgr.mainTree().setActiveTreeType('xslt');
                //we need to pass in the newId parameter so it knows which node to resync after retreival from the server
                UmbClientMgr.mainTree().syncTree("-1,init," + this._opts.originalFileName, true, null, newFilePath);
                //set the original file path to the new one
                this._opts.originalFileName = newFilePath;
            }

            
        },

        submitFailure: function (t) {
            alert(t);
            top.UmbSpeechBubble.ShowMessage('warning', 'XSLT file could not be saved', '');
        }
    });
})(jQuery);
{'fraction_non_alphanumeric': 0.11008403361344538, 'fraction_numerical': 0.0015126050420168067, 'mean_word_length': 1.6878952122854562, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6811529', 'n_tokens_mistral': 1608, 'n_tokens_neox': 1540, 'n_words': 403}