From 05d7ed92fb67cc3a6f3143521c946d5a5e6e0e15 Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 13:03:29 +0100 Subject: [PATCH 01/51] Bye bye knockout.js - you were cool before the new kids on the block such as VueJS, React & Angular were about --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 - .../Umbraco/dashboard/UserControlProxy.aspx | 2 - .../UserControlProxy.aspx.designer.cs | 42 +++------ .../umbraco_client/ui/knockout.js | 86 ------------------- .../umbraco_client/ui/knockout.mapping.js | 20 ----- .../UI/Bundles/JsApplicationLib.cs | 2 - 6 files changed, 12 insertions(+), 142 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/ui/knockout.js delete mode 100644 src/Umbraco.Web.UI/umbraco_client/ui/knockout.mapping.js diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index db6d974fc2..acfebc4664 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -371,8 +371,6 @@ - - diff --git a/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx b/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx index 399d2cff3a..bc9019f246 100644 --- a/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx +++ b/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx @@ -15,8 +15,6 @@ - - diff --git a/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs b/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs index a08f6c3392..84a5a63087 100644 --- a/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs +++ b/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs @@ -3,15 +3,15 @@ // This code was generated by a tool. // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ namespace Umbraco.Web.UI.Umbraco.Dashboard { - - + + public partial class UserControlProxy { - + /// /// ClientLoader control. /// @@ -20,7 +20,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::Umbraco.Web.UI.JavaScript.UmbracoClientDependencyLoader ClientLoader; - + /// /// CssInclude1 control. /// @@ -29,7 +29,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; - + /// /// JsInclude1 control. /// @@ -38,7 +38,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; - + /// /// JsInclude3 control. /// @@ -47,7 +47,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::ClientDependency.Core.Controls.JsInclude JsInclude3; - + /// /// JsInclude4 control. /// @@ -56,7 +56,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::ClientDependency.Core.Controls.JsInclude JsInclude4; - + /// /// JsInclude6 control. /// @@ -65,25 +65,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::ClientDependency.Core.Controls.JsInclude JsInclude6; - - /// - /// JsInclude11 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude11; - - /// - /// JsInclude12 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude12; - + /// /// JsInclude2 control. /// @@ -92,7 +74,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::ClientDependency.Core.Controls.JsInclude JsInclude2; - + /// /// form1 control. /// @@ -101,7 +83,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlForm form1; - + /// /// container control. /// diff --git a/src/Umbraco.Web.UI/umbraco_client/ui/knockout.js b/src/Umbraco.Web.UI/umbraco_client/ui/knockout.js deleted file mode 100644 index 107026da16..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/ui/knockout.js +++ /dev/null @@ -1,86 +0,0 @@ -// Knockout JavaScript library v2.1.0 -// (c) Steven Sanderson - http://knockoutjs.com/ -// License: MIT (http://www.opensource.org/licenses/mit-license.php) - -(function(window,document,navigator,undefined){ -function m(w){throw w;}var n=void 0,p=!0,s=null,t=!1;function A(w){return function(){return w}};function E(w){function B(b,c,d){d&&c!==a.k.r(b)&&a.k.S(b,c);c!==a.k.r(b)&&a.a.va(b,"change")}var a="undefined"!==typeof w?w:{};a.b=function(b,c){for(var d=b.split("."),f=a,g=0;g",c[0];);return 4a.a.j(c,b[e])&&c.push(b[e]);return c},T:function(a,b){for(var a=a||[],c=[], -e=0,f=a.length;ea.length?t:a.substring(0,b.length)===b},eb:function(a,b){for(var c="return ("+a+")",e=0;e",""]||!d.indexOf("",""]||(!d.indexOf("",""]||[0,"",""];b="ignored
"+d[1]+b+d[2]+"
";for("function"==typeof window.innerShiv?c.appendChild(window.innerShiv(b)):c.innerHTML=b;d[0]--;)c=c.lastChild;c=a.a.L(c.lastChild.childNodes)}return c}; -a.a.Y=function(b,c){a.a.ga(b);if(c!==s&&c!==n)if("string"!=typeof c&&(c=c.toString()),"undefined"!=typeof jQuery)jQuery(b).html(c);else for(var d=a.a.pa(c),f=0;f"},Va:function(a,b){var c=d[a];c===n&&m(Error("Couldn't find any memo with ID "+a+". Perhaps it's already been unmemoized."));try{return c.apply(s,b||[]),p}finally{delete d[a]}},Wa:function(b,d){var e=[];c(b,e);for(var h=0,j=e.length;hc;c++)b=b();return b})};a.toJSON=function(b,c,e){b=a.Ta(b);return a.a.sa(b,c,e)}})();a.b("toJS",a.Ta);a.b("toJSON",a.toJSON);(function(){a.k={r:function(b){switch(a.a.o(b)){case "option":return b.__ko__hasDomDataOptionValue__===p?a.a.f.get(b,a.c.options.oa):b.getAttribute("value");case "select":return 0<=b.selectedIndex?a.k.r(b.options[b.selectedIndex]):n;default:return b.value}},S:function(b,c){switch(a.a.o(b)){case "option":switch(typeof c){case "string":a.a.f.set(b,a.c.options.oa, -n);"__ko__hasDomDataOptionValue__"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.f.set(b,a.c.options.oa,c),b.__ko__hasDomDataOptionValue__=p,b.value="number"===typeof c?c:""}break;case "select":for(var d=b.options.length-1;0<=d;d--)if(a.k.r(b.options[d])==c){b.selectedIndex=d;break}break;default:if(c===s||c===n)c="";b.value=c}}}})();a.b("selectExtensions",a.k);a.b("selectExtensions.readValue",a.k.r);a.b("selectExtensions.writeValue",a.k.S);a.g=function(){function b(a,b){for(var d= -s;a!=d;)d=a,a=a.replace(c,function(a,c){return b[c]});return a}var c=/\@ko_token_(\d+)\@/g,d=/^[\_$a-z][\_$a-z0-9]*(\[.*?\])*(\.[\_$a-z][\_$a-z0-9]*(\[.*?\])*)*$/i,f=["true","false"];return{D:[],W:function(c){var e=a.a.w(c);if(3>e.length)return[];"{"===e.charAt(0)&&(e=e.substring(1,e.length-1));for(var c=[],d=s,f,k=0;k$/: -/^\s*ko\s+(.*\:.*)\s*$/,h=g?/^<\!--\s*\/ko\s*--\>$/:/^\s*\/ko\s*$/,j={ul:p,ol:p};a.e={C:{},childNodes:function(a){return b(a)?d(a):a.childNodes},ha:function(c){if(b(c))for(var c=a.e.childNodes(c),e=0,d=c.length;e"),t))}};a.c.uniqueName.gb=0;a.c.checked={init:function(b,c,d){a.a.n(b,"click",function(){var f;if("checkbox"==b.type)f=b.checked;else if("radio"==b.type&&b.checked)f=b.value;else return;var g=c();"checkbox"==b.type&&a.a.d(g)instanceof Array?(f=a.a.j(a.a.d(g),b.value), -b.checked&&0>f?g.push(b.value):!b.checked&&0<=f&&g.splice(f,1)):a.g.$(g,d,"checked",f,p)});"radio"==b.type&&!b.name&&a.c.uniqueName.init(b,A(p))},update:function(b,c){var d=a.a.d(c());"checkbox"==b.type?b.checked=d instanceof Array?0<=a.a.j(d,b.value):d:"radio"==b.type&&(b.checked=b.value==d)}};var F={"class":"className","for":"htmlFor"};a.c.attr={update:function(b,c){var d=a.a.d(c())||{},f;for(f in d)if("string"==typeof f){var g=a.a.d(d[f]),e=g===t||g===s||g===n;e&&b.removeAttribute(f);8>=a.a.ja&& -f in F?(f=F[f],e?b.removeAttribute(f):b[f]=g):e||b.setAttribute(f,g.toString())}}};a.c.hasfocus={init:function(b,c,d){function f(b){var e=c();a.g.$(e,d,"hasfocus",b,p)}a.a.n(b,"focus",function(){f(p)});a.a.n(b,"focusin",function(){f(p)});a.a.n(b,"blur",function(){f(t)});a.a.n(b,"focusout",function(){f(t)})},update:function(b,c){var d=a.a.d(c());d?b.focus():b.blur();a.a.va(b,d?"focusin":"focusout")}};a.c["with"]={p:function(b){return function(){var c=b();return{"if":c,data:c,templateEngine:a.q.K}}}, -init:function(b,c){return a.c.template.init(b,a.c["with"].p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c["with"].p(c),d,f,g)}};a.g.D["with"]=t;a.e.C["with"]=p;a.c["if"]={p:function(b){return function(){return{"if":b(),templateEngine:a.q.K}}},init:function(b,c){return a.c.template.init(b,a.c["if"].p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c["if"].p(c),d,f,g)}};a.g.D["if"]=t;a.e.C["if"]=p;a.c.ifnot={p:function(b){return function(){return{ifnot:b(),templateEngine:a.q.K}}}, -init:function(b,c){return a.c.template.init(b,a.c.ifnot.p(c))},update:function(b,c,d,f,g){return a.c.template.update(b,a.c.ifnot.p(c),d,f,g)}};a.g.D.ifnot=t;a.e.C.ifnot=p;a.c.foreach={p:function(b){return function(){var c=a.a.d(b());return!c||"number"==typeof c.length?{foreach:c,templateEngine:a.q.K}:{foreach:c.data,includeDestroyed:c.includeDestroyed,afterAdd:c.afterAdd,beforeRemove:c.beforeRemove,afterRender:c.afterRender,templateEngine:a.q.K}}},init:function(b,c){return a.c.template.init(b,a.c.foreach.p(c))}, -update:function(b,c,d,f,g){return a.c.template.update(b,a.c.foreach.p(c),d,f,g)}};a.g.D.foreach=t;a.e.C.foreach=p;a.t=function(){};a.t.prototype.renderTemplateSource=function(){m(Error("Override renderTemplateSource"))};a.t.prototype.createJavaScriptEvaluatorBlock=function(){m(Error("Override createJavaScriptEvaluatorBlock"))};a.t.prototype.makeTemplateSource=function(b,c){if("string"==typeof b){var c=c||document,d=c.getElementById(b);d||m(Error("Cannot find template with ID "+b));return new a.l.i(d)}if(1== -b.nodeType||8==b.nodeType)return new a.l.M(b);m(Error("Unknown template type: "+b))};a.t.prototype.renderTemplate=function(a,c,d,f){return this.renderTemplateSource(this.makeTemplateSource(a,f),c,d)};a.t.prototype.isTemplateRewritten=function(a,c){return this.allowTemplateRewriting===t||!(c&&c!=document)&&this.V&&this.V[a]?p:this.makeTemplateSource(a,c).data("isRewritten")};a.t.prototype.rewriteTemplate=function(a,c,d){var f=this.makeTemplateSource(a,d),c=c(f.text());f.text(c);f.data("isRewritten", -p);!(d&&d!=document)&&"string"==typeof a&&(this.V=this.V||{},this.V[a]=p)};a.b("templateEngine",a.t);a.Z=function(){function b(b,c,e){for(var b=a.g.W(b),d=a.g.D,j=0;j/g;return{mb:function(b,c,e){c.isTemplateRewritten(b,e)||c.rewriteTemplate(b,function(b){return a.Z.zb(b,c)},e)},zb:function(a,g){return a.replace(c,function(a,c,d,f,i,l,q){return b(q,c,g)}).replace(d,function(a,c){return b(c,"<\!-- ko --\>",g)})},Za:function(b){return a.s.na(function(c, -e){c.nextSibling&&a.ya(c.nextSibling,b,e)})}}}();a.b("templateRewriting",a.Z);a.b("templateRewriting.applyMemoizedBindingsToNextSibling",a.Z.Za);(function(){a.l={};a.l.i=function(a){this.i=a};a.l.i.prototype.text=function(){var b=a.a.o(this.i),b="script"===b?"text":"textarea"===b?"value":"innerHTML";if(0==arguments.length)return this.i[b];var c=arguments[0];"innerHTML"===b?a.a.Y(this.i,c):this.i[b]=c};a.l.i.prototype.data=function(b){if(1===arguments.length)return a.a.f.get(this.i,"templateSourceData_"+ -b);a.a.f.set(this.i,"templateSourceData_"+b,arguments[1])};a.l.M=function(a){this.i=a};a.l.M.prototype=new a.l.i;a.l.M.prototype.text=function(){if(0==arguments.length){var b=a.a.f.get(this.i,"__ko_anon_template__")||{};b.ua===n&&b.da&&(b.ua=b.da.innerHTML);return b.ua}a.a.f.set(this.i,"__ko_anon_template__",{ua:arguments[0]})};a.l.i.prototype.nodes=function(){if(0==arguments.length)return(a.a.f.get(this.i,"__ko_anon_template__")||{}).da;a.a.f.set(this.i,"__ko_anon_template__",{da:arguments[0]})}; -a.b("templateSources",a.l);a.b("templateSources.domElement",a.l.i);a.b("templateSources.anonymousTemplate",a.l.M)})();(function(){function b(b,c,d){for(var f,c=a.e.nextSibling(c);b&&(f=b)!==c;)b=a.e.nextSibling(f),(1===f.nodeType||8===f.nodeType)&&d(f)}function c(c,d){if(c.length){var f=c[0],g=c[c.length-1];b(f,g,function(b){a.xa(d,b)});b(f,g,function(b){a.s.Wa(b,[d])})}}function d(a){return a.nodeType?a:0a.a.ja)&&b.nodes?b.nodes():s; -if(c)return a.a.L(c.cloneNode(p).childNodes);b=b.text();return a.a.pa(b)};a.q.K=new a.q;a.ra(a.q.K);a.b("nativeTemplateEngine",a.q);(function(){a.ma=function(){var a=this.vb=function(){if("undefined"==typeof jQuery||!jQuery.tmpl)return 0;try{if(0<=jQuery.tmpl.tag.tmpl.open.toString().indexOf("__"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,f,g){g=g||{};2>a&&m(Error("Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later."));var e=b.data("precompiled"); -e||(e=b.text()||"",e=jQuery.template(s,"{{ko_with $item.koBindingContext}}"+e+"{{/ko_with}}"),b.data("precompiled",e));b=[f.$data];f=jQuery.extend({koBindingContext:f},g.templateOptions);f=jQuery.tmpl(e,b,f);f.appendTo(document.createElement("div"));jQuery.fragments={};return f};this.createJavaScriptEvaluatorBlock=function(a){return"{{ko_code ((function() { return "+a+" })()) }}"};this.addTemplate=function(a,b){document.write(" - - - - - - -
- - - - -
- -
diff --git a/src/Umbraco.Web.UI/umbraco_client/Dialogs/UmbracoField.js b/src/Umbraco.Web.UI/umbraco_client/Dialogs/UmbracoField.js deleted file mode 100644 index 894830ab6a..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Dialogs/UmbracoField.js +++ /dev/null @@ -1,145 +0,0 @@ -Umbraco.Sys.registerNamespace("Umbraco.Dialogs"); - -(function($) { - - - Umbraco.Dialogs.UmbracoField = base2.Base.extend({ - //private methods/variables - _opts: null, - - // Constructor - constructor: function (opts) { - // Merge options with default - this._opts = $.extend({ - // Default options go here - }, opts); - }, - - //public methods/variables - - init: function () { - var self = this; - //bind to the submit handler of the button - this._opts.submitButton.click(function () { - self.doSubmit(); - }); - this._opts.cancelButton.click(function () { - UmbClientMgr.closeModalWindow(); - }); - }, - - doSubmit: function() { - //find out if this is an MVC View. - var url = window.location.href; - var isMvcView = url.indexOf('mvcView=') != -1; - var tagString = ""; - - //get the form - var fieldForm = this._opts.form; - - //formfields - var field = fieldForm.field.value; - var useIfEmpty = fieldForm.useIfEmpty.value; - var alternativeText = fieldForm.alternativeText.value; - var insertTextBefore = fieldForm.insertTextBefore.value; - var insertTextAfter = fieldForm.insertTextAfter.value; - - if(isMvcView) { - tagString = "@Umbraco.Field(\"" + field + "\""; - - if (useIfEmpty != '') - tagString += ", altFieldAlias: \"" + useIfEmpty + "\""; - - if (alternativeText != '') - tagString += ", altText: \"" + alternativeText + "\""; - - if (fieldForm.recursive.checked) - tagString += ", recursive: true"; - - if (insertTextBefore != '') - tagString += ", insertBefore: \"" + insertTextBefore.replace(/\"/gi, """).replace(/\/gi, ">") + "\""; - - if (insertTextAfter != "") - tagString += ", insertAfter: \"" + insertTextAfter.replace(/\"/gi, """).replace(/\/gi, ">") + "\""; - - if (fieldForm.formatAsDate[1].checked) - tagString += ", formatAsDateWithTime: true, formatAsDateWithTimeSeparator: \"" + fieldForm.formatAsDateWithTimeSeparator.value + "\""; - else if (fieldForm.formatAsDate[0].checked) - tagString += ", formatAsDate: true"; - - if (fieldForm.toCase[1].checked) - tagString += ", casing: RenderFieldCaseType.Lower"; - else if(fieldForm.toCase[2].checked) - tagString += ", casing: RenderFieldCaseType.Upper"; - - if (fieldForm.urlEncode[1].checked) - tagString += ", encoding: RenderFieldEncodingType.Url"; - else if (fieldForm.urlEncode[2].checked) - tagString += ", encoding: RenderFieldEncodingType.Html"; - - if (fieldForm.convertLineBreaks.checked) - tagString += ", convertLineBreaks: true"; - - if (fieldForm.stripParagraph.checked) - tagString += ", removeParagraphTags: true"; - - tagString += ")"; - - } - else - { - - tagString = '<' + this._opts.tagName; - - if (field != '') - tagString += ' field="' + field + '"'; - - if (useIfEmpty != '') - tagString += ' useIfEmpty="' + useIfEmpty + '"'; - - if (alternativeText != '') - tagString += ' textIfEmpty="' + alternativeText + '"'; - - if (insertTextBefore != '') - tagString += ' insertTextBefore="' + insertTextBefore.replace(/\"/gi, """).replace(/\/gi, ">") + '"'; - - if (insertTextAfter != '') - tagString += ' insertTextAfter="' + insertTextAfter.replace(/\"/gi, """).replace(/\/gi, ">") + '"'; - - if (fieldForm.formatAsDate[1].checked) - tagString += ' formatAsDateWithTime="true" formatAsDateWithTimeSeparator="' + fieldForm.formatAsDateWithTimeSeparator.value + '"'; - else if (fieldForm.formatAsDate[0].checked) - tagString += ' formatAsDate="true"'; - - if (fieldForm.toCase[1].checked) - tagString += ' case="' + fieldForm.toCase[1].value + '"'; - else if (fieldForm.toCase[2].checked) - tagString += ' case="' + fieldForm.toCase[2].value + '"'; - - if (fieldForm.recursive.checked) - tagString += ' recursive="true"'; - - if (fieldForm.urlEncode[1].checked) - tagString += ' urlEncode="true"'; - else if (fieldForm.urlEncode[2].checked) - tagString += ' htmlEncode="true"'; - - if (fieldForm.stripParagraph.checked) - tagString += ' stripParagraph="true"'; - - if (fieldForm.convertLineBreaks.checked) - tagString += ' convertLineBreaks="true"'; - - tagString += " runat=\"server\" />"; - } - - - UmbClientMgr.contentFrame().focus(); - UmbClientMgr.contentFrame().UmbEditor.Insert(tagString, '', this._opts.objectId); - UmbClientMgr.closeModalWindow(); - } - }); - - - -})(jQuery); \ No newline at end of file From a884a9c56cd420cad243e3cca47432334bbcefd2 Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 15:06:01 +0100 Subject: [PATCH 14/51] UmbracoClientManager is next for the chopping block but a legacy copy is in the umbraco/lib/ folder for safe keeping for the time being :) --- .../Application/UmbracoClientManager.js | 257 ------------------ .../UI/Bundles/JsUmbracoApplicationCore.cs | 1 - .../controls/Tree/CustomTreeControl.cs | 1 - 3 files changed, 259 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js deleted file mode 100644 index c3de3c43d0..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js +++ /dev/null @@ -1,257 +0,0 @@ -Umbraco.Sys.registerNamespace("Umbraco.Application"); - -(function($) { - Umbraco.Application.ClientManager = function() { - /// - /// A class which ensures that all calls made to the objects that it owns are done in the context - /// of the main Umbraco application window. - /// - - return { - _isDirty: false, - _isDebug: false, - _mainTree: null, - _appActions: null, - _historyMgr: null, - _rootPath: "/umbraco", //this is the default - _modal: new Array(), //track all modal window objects (they get stacked) - - historyManager: function() { - if (!this._historyMgr) { - this._historyMgr = new Umbraco.Controls.HistoryManager(); - } - return this._historyMgr; - }, - - setUmbracoPath: function(strPath) { - /// - /// sets the Umbraco root path folder - /// - this._debug("setUmbracoPath: " + strPath); - this._rootPath = strPath; - }, - - mainWindow: function() { - /// - /// Returns a reference to the main frame of the application - /// - return top; - }, - mainTree: function() { - /// - /// Returns a reference to the main UmbracoTree API object. - /// Sometimes an Umbraco page will need to be opened without being contained in the iFrame from the main window - /// so this method is will construct a false tree to be returned if this is the case as to avoid errors. - /// - /// - - - if (this._mainTree == null) { - this._mainTree = top.UmbClientMgr.mainTree(); - } - return this._mainTree; - }, - appActions: function() { - /// - /// Returns a reference to the application actions object - /// - - //if the main window has no actions, we'll create some - if (this._appActions == null) { - if (typeof this.mainWindow().appActions == 'undefined') { - this._appActions = new Umbraco.Application.Actions(); - } - else this._appActions = this.mainWindow().appActions; - } - return this._appActions; - }, - uiKeys: function() { - /// - /// Returns a reference to the main windows uiKeys object for globalization - /// - - //TODO: If there is no main window, we need to go retrieve the appActions from the server! - return this.mainWindow().uiKeys; - }, - // windowMgr: function() - // return null; - // }, - contentFrameAndSection: function(app, rightFrameUrl) { - //this.appActions().shiftApp(app, this.uiKeys()['sections_' + app]); - var self = this; - self.mainWindow().UmbClientMgr.historyManager().addHistory(app, true); - window.setTimeout(function() { - self.mainWindow().UmbClientMgr.contentFrame(rightFrameUrl); - }, 200); - }, - contentFrame: function (strLocation) { - /// - /// This will return the reference to the right content frame if strLocation is null or empty, - /// or set the right content frames location to the one specified by strLocation. - /// - - this._debug("contentFrame: " + strLocation); - - if (strLocation == null || strLocation == "") { - if (typeof this.mainWindow().right != "undefined") { - return this.mainWindow().right; - } - else { - return this.mainWindow(); //return the current window if the content frame doesn't exist in the current context - } - } - else { - - //its a hash change so process that like angular - if (strLocation.substr(0, 1) !== "#") { - if (strLocation.substr(0, 1) != "/") { - //if the path doesn't start with "/" or with the root path then - //prepend the root path - strLocation = this._rootPath + "/" + strLocation; - } - else if (strLocation.length >= this._rootPath.length - && strLocation.substr(0, this._rootPath.length) != this._rootPath) { - strLocation = this._rootPath + "/" + strLocation; - } - } - - this._debug("contentFrame: parsed location: " + strLocation); - - if (!this.mainWindow().UmbClientMgr) { - window.setTimeout(function() { - var self = this; - self.mainWindow().location.href = strLocation; - }, 200); - } - else { - this.mainWindow().UmbClientMgr.contentFrame(strLocation); - } - } - }, - reloadContentFrameUrlIfPathLoaded: function (url) { - var contentFrame; - if (typeof this.mainWindow().right != "undefined") { - contentFrame = this.mainWindow().right; - } - else { - contentFrame = this.mainWindow(); - } - - var currentPath = contentFrame.location.pathname + (contentFrame.location.search ? contentFrame.location.search : ""); - if (currentPath == url) { - contentFrame.location.reload(); - } - }, - - /** This is used to launch an angular based modal window instead of the legacy window */ - openAngularModalWindow: function (options) { - if (!this.mainWindow().UmbClientMgr) { - throw "An angular modal window can only be launched when the modal is running within the main Umbraco application"; - } - else { - this.mainWindow().UmbClientMgr.openAngularModalWindow.apply(this.mainWindow().UmbClientMgr, [options]); - } - - }, - - /** This is used to launch an angular based modal window instead of the legacy window */ - rootScope: function () { - - if (!this.mainWindow().UmbClientMgr) { - throw "An angular modal window can only be launched when the modal is running within the main Umbraco application"; - } - else { - return this.mainWindow().UmbClientMgr.rootScope(); - } - - }, - - reloadLocation: function (pathToMatch) { - if (this.mainWindow().UmbClientMgr) { - this.mainWindow().UmbClientMgr.reloadLocation(pathToMatch); - } - }, - - openModalWindow: function(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { - //need to create the modal on the top window if the top window has a client manager, if not, create it on the current window - - //if this is the top window, or if the top window doesn't have a client manager, create the modal in this manager - if (window == this.mainWindow() || !this.mainWindow().UmbClientMgr) { - var m = new Umbraco.Controls.ModalWindow(); - this._modal.push(m); - m.open(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback); - } - else { - //if the main window has a client manager, then call the main window's open modal method whilst keeping the context of it's manager. - if (this.mainWindow().UmbClientMgr) { - this.mainWindow().UmbClientMgr.openModalWindow.apply(this.mainWindow().UmbClientMgr, - [url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback]); - } - else { - return; //exit recurse. - } - } - }, - openModalWindowForContent: function (jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { - //need to create the modal on the top window if the top window has a client manager, if not, create it on the current window - - //if this is the top window, or if the top window doesn't have a client manager, create the modal in this manager - if (window == this.mainWindow() || !this.mainWindow().UmbClientMgr) { - var m = new Umbraco.Controls.ModalWindow(); - this._modal.push(m); - m.show(jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback); - } - else { - //if the main window has a client manager, then call the main window's open modal method whilst keeping the context of it's manager. - if (this.mainWindow().UmbClientMgr) { - this.mainWindow().UmbClientMgr.openModalWindowForContent.apply(this.mainWindow().UmbClientMgr, - [jQueryElement, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback]); - } - else { - return; //exit recurse. - } - } - }, - closeModalWindow: function(rVal) { - /// - /// will close the latest open modal window. - /// if an rVal is passed in, then this will be sent to the onCloseCallback method if it was specified. - /// - if (this._modal != null && this._modal.length > 0) { - this._modal.pop().close(rVal); - } - else { - //this will recursively try to close a modal window until the parent window has a modal object or the window is the top and has the modal object - var mgr = null; - if (window.parent == null || window.parent == window) { - //we are at the root window, check if we can close the modal window from here - if (window.UmbClientMgr != null && window.UmbClientMgr._modal != null && window.UmbClientMgr._modal.length > 0) { - mgr = window.UmbClientMgr; - } - else { - return; //exit recursion. - } - } - else if (typeof window.parent.UmbClientMgr != "undefined") { - mgr = window.parent.UmbClientMgr; - } - mgr.closeModalWindow.call(mgr, rVal); - } - }, - _debug: function(strMsg) { - if (this._isDebug) { - Sys.Debug.trace("UmbClientMgr: " + strMsg); - } - }, - get_isDirty: function() { - return this._isDirty; - }, - set_isDirty: function(value) { - this._isDirty = value; - } - }; - }; -})(jQuery); - -//define alias for use throughout application -var UmbClientMgr = new Umbraco.Application.ClientManager(); diff --git a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs b/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs index 505f9efdc3..6fa0a9a0d0 100644 --- a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs +++ b/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs @@ -8,7 +8,6 @@ namespace Umbraco.Web.UI.Bundles /// [ClientDependency(ClientDependencyType.Javascript, "Application/Extensions.js", "UmbracoClient", Priority = 0, Group = 2)] [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient", Priority = 1, Group = 2)] - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient", Priority = 3, Group = 3)] public class JsUmbracoApplicationCore : Control { } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs index 7b8b92384b..fac5b6ebb0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs @@ -18,7 +18,6 @@ namespace umbraco.controls.Tree /// to re-register the ClientDependencies. /// [ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")] [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient")] [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")] [ClientDependency(10, ClientDependencyType.Javascript, "Application/JQuery/jquery.metadata.min.js", "UmbracoClient")] From 5b4c897892b0dad7f96edb668efa05fff30caf00 Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 15:07:11 +0100 Subject: [PATCH 15/51] Yet again I forgot to save the CSProj - you would have thought I would have learnt --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 4d833dee7e..aa1af2f426 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -384,7 +384,6 @@ - From a2839876c6b292524ffe94d94b8bbd8046c22f77 Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 15:30:16 +0100 Subject: [PATCH 16/51] Extnesions.js removed from umbraco_client as it has a new home in umbraco/lib/umbraco --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../umbraco_client/Application/Extensions.js | 403 ------------------ .../UI/Bundles/JsUmbracoApplicationCore.cs | 1 - 3 files changed, 405 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index aa1af2f426..0540b9cd06 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -348,7 +348,6 @@ ASPXCodeBehind - diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js b/src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js deleted file mode 100644 index 9fddaad998..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/Extensions.js +++ /dev/null @@ -1,403 +0,0 @@ -(function ($) { - - //extensions to base classes such as String and extension methods for jquery. - //NOTE: jquery must be loaded before this file. - - //create guid object on the window (which makes it global) - if (window.Guid == null) { - window.Guid = { - generate: function () { - ///generates a new Guid - return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { - var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); - return v.toString(16); - }); - } - }; - } - - if (!window.__debug__) { - window.__debug__ = function (msg, category, isErr) { - ///global method to send debug statements to console that is cross browser (or at least checks if its possible) - - if (((typeof console) != "undefined") && console.log && console.error) { - if (isErr) console.error(category + ": " + msg); - else console.log(category + ": " + msg); - } - }; - } - - if (!window.location.getParams) { - var pl = /\+/g; // Regex for replacing addition symbol with a space - var search = /([^&=]+)=?([^&]*)/g; - var decode = function(s) { return decodeURIComponent(s.replace(pl, " ")); }; - - window.location.getParams = function() { - var match; - var query = window.location.search.substring(1); - - var urlParams = {}; - while (match = search.exec(query)) - urlParams[decode(match[1])] = decode(match[2]); - - return urlParams; - } - } - - if (!String.prototype.startsWith) { - String.prototype.startsWith = function (str) { - ///startsWith extension method for string - - return this.substr(0, str.length) === str; - }; - } - - if (!String.prototype.endsWith) { - String.prototype.endsWith = function (str) { - ///endsWith extension method for string - - return this.substr(this.length - str.length) === str; - }; - } - - if (!String.prototype.utf8Encode) { - String.prototype.utf8Encode = function () { - ///UTF8 encoder for string - - var str = this.replace(/\r\n/g, "\n"); - var utftext = ""; - for (var n = 0; n < str.length; n++) { - var c = str.charCodeAt(n); - if (c < 128) { - utftext += String.fromCharCode(c); - } - else if ((c > 127) && (c < 2048)) { - utftext += String.fromCharCode((c >> 6) | 192); - utftext += String.fromCharCode((c & 63) | 128); - } - else { - utftext += String.fromCharCode((c >> 12) | 224); - utftext += String.fromCharCode(((c >> 6) & 63) | 128); - utftext += String.fromCharCode((c & 63) | 128); - } - } - return utftext; - }; - } - - if (!String.prototype.utf8Decode) { - String.prototype.utf8Decode = function () { - var utftext = this; - var string = ""; - var i = 0; - var c = c1 = c2 = 0; - - while (i < utftext.length) { - - c = utftext.charCodeAt(i); - - if (c < 128) { - string += String.fromCharCode(c); - i++; - } - else if ((c > 191) && (c < 224)) { - c2 = utftext.charCodeAt(i + 1); - string += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } - else { - c2 = utftext.charCodeAt(i + 1); - c3 = utftext.charCodeAt(i + 2); - string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - - } - - return string; - }; - } - - if (!String.prototype.base64Encode) { - String.prototype.base64Encode = function () { - ///Base64 encoder for string - - var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - var output = ""; - var chr1, chr2, chr3, enc1, enc2, enc3, enc4; - var i = 0; - - var input = this.utf8Encode(); - - while (i < input.length) { - - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - - enc1 = chr1 >> 2; - enc2 = ((chr1 & 3) << 4) | (chr2 >> 4); - enc3 = ((chr2 & 15) << 2) | (chr3 >> 6); - enc4 = chr3 & 63; - - if (isNaN(chr2)) { - enc3 = enc4 = 64; - } else if (isNaN(chr3)) { - enc4 = 64; - } - - output = output + - keyStr.charAt(enc1) + keyStr.charAt(enc2) + - keyStr.charAt(enc3) + keyStr.charAt(enc4); - - } - - return output; - }; - } - - if (!String.prototype.base64Decode) { - String.prototype.base64Decode = function () { - ///Base64 decoder for string - - var input = this; - var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - var output = ""; - var chr1, chr2, chr3; - var enc1, enc2, enc3, enc4; - var i = 0; - - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); - - while (i < input.length) { - - enc1 = keyStr.indexOf(input.charAt(i++)); - enc2 = keyStr.indexOf(input.charAt(i++)); - enc3 = keyStr.indexOf(input.charAt(i++)); - enc4 = keyStr.indexOf(input.charAt(i++)); - - chr1 = (enc1 << 2) | (enc2 >> 4); - chr2 = ((enc2 & 15) << 4) | (enc3 >> 2); - chr3 = ((enc3 & 3) << 6) | enc4; - - output = output + String.fromCharCode(chr1); - - if (enc3 != 64) { - output = output + String.fromCharCode(chr2); - } - if (enc4 != 64) { - output = output + String.fromCharCode(chr3); - } - - } - - return output.utf8Decode(); - - }; - } - - - if (!Math.randomRange) { - Math.randomRange = function (from, to) { - ///randomRange extension for math - - return Math.floor(Math.random() * (to - from + 1) + from); - }; - } - - if (!String.prototype.toCamelCase) { - String.prototype.toCamelCase = function () { - ///toCamelCase extension method for string - - var s = this.toPascalCase(); - if ($.trim(s) == "") - return ""; - if (s.length > 1) { - var regex = /^([A-Z]*)([A-Z].*)/g; - if (s.match(regex)) { - var match = regex.exec(s); - s = match[1].toLowerCase() + match[2]; - s = s.substr(0, 1).toLowerCase() + s.substr(1); - } - } else { - s = s.toLowerCase(); - } - return s; - }; - } - - if (!String.prototype.toPascalCase) { - String.prototype.toPascalCase = function () { - ///toPascalCase extension method for string - - var s = ""; - $.each($.trim(this).split(/[\s\.-]+/g), function (idx, val) { - if ($.trim(val) == "") - return; - if (val.length > 1) - s += val.substr(0, 1).toUpperCase() + val.substr(1); - else - s += val.toUpperCase(); - }); - return s; - }; - } - - if (!String.prototype.toUmbracoAlias) { - String.prototype.toUmbracoAlias = function () { - //////toUmbracoAlias extension method for string - - var s = this.replace(/[^a-zA-Z0-9\s\.-]+/g, ''); // Strip none alphanumeric chars - return s.toCamelCase(); // Convert to camelCase - }; - } - - if (!String.prototype.toFunction) { - String.prototype.toFunction = function () { - var arr = this.split("."); - var fn = (window || this); - for (var i = 0, len = arr.length; i < len; i++) { - fn = fn[arr[i]]; - } - if (typeof fn !== "function") { - throw new Error("function not found"); - } - return fn; - }; - } - - //sets defaults for ajax - $.ajaxSetup({ - dataType: 'json', - cache: false, - contentType: 'application/json; charset=utf-8', - error: function (x, t, e) { - if (x.status.toString().startsWith("500")) { - //show ysod overlay if we can - if (UmbClientMgr) { - var startIndex = x.responseText.indexOf(""); - var body = x.responseText.substring(startIndex, endIndex + 7); - var $div = $(body.replace("", "
").replace("", "
")); - $div.appendTo($(UmbClientMgr.mainWindow().document.getElementsByTagName("body")[0])); - UmbClientMgr.openModalWindowForContent($div, "ysod", true, 640, 640, null, null, null, function() { - //remove the $div - $div.closest(".umbModalBox").remove(); - }); - } - else { - alert("Unhandled exception occurred.\nStatus: " + x.status + "\nMessage: " + x.statusText + "\n\n" + x.responseText); - } - } - } - }); - - $.fn.getAllAttributes = function () { - ///extension method to get all attributes of a selected element - - if ($(this).length != 1) { - throw "the getAllAttributes method can only be called when matching one jQuery selector"; - }; - var el = $(this).get(0); - var arr = []; - for (var i = 0, attrs = el.attributes; i < attrs.length; i++) { - arr.push({ name: attrs.item(i).nodeName, value: attrs.item(i).nodeValue }); - } - return arr; - }; - - $.fn.outerHtml = function () { - ///extension to get the 'outer html' of an element - - if ($(this).length != 1) { - throw "the getAllAttributes method can only be called when matching one jQuery selector"; - }; - var nodeName = $(_opts.content).get(0).nodeName.toLowerCase(); - //start creating raw html - var outerHtml = "<" + nodeName; - //get all the attributes/values from the original element and add them to the new one - var allAttributes = $(_opts.content).getAllAttributes(); - for (var a in allAttributes) { - outerHtml += " " + allAttributes[a].name + "='" + allAttributes[a].value + "'"; - } - outerHtml += ">"; - outerHtml += $(_opts.content).html(); - outerHtml += ""; - return outerHtml; - }; - - $.fn.focusFirst = function () { - ///extension to focus the first editable field in a form - - return $(this).each(function () { - if ($(this).get(0).nodeName.toLowerCase() != "form") { - throw "The focusFirst method can only be applied to a form element"; - } - var first = $(this).find(":input:enabled:visible").not(":submit").not(":button").not(":file").not(":image").not(":radio"); - if (first.length > 0) { - $(first[0]).focus(); - } - }); - }; - - $.fn.getAttributes = function () { - ///Extension method to return all of the attributes for an element - - var attributes = []; - - if (!this.length) - return this; - - $.each(this[0].attributes, function (index, attr) { - attributes.push({ name: attr.name, value: attr.value }); - }); - - return attributes; - }; - - - //defaults that need to be set on ready - $(document).ready(function () { - - //adds a default ignore parameter to jquery validation - if ($.validator) { - $.validator.setDefaults({ ignore: ".ignore" }); - } - - //adds a "re-parse" method to the Unobtrusive JS framework since Parse doesn't actually reparse - if ($.validator && $.validator.unobtrusive) { - $.validator.unobtrusive.reParse = function ($selector) { - $selector.removeData("validator"); - $.validator.unobtrusive.parse($selector); - }; - } - - }); - - //This sets the default jquery ajax headers to include our csrf token, we - // need to user the beforeSend method because our token changes per user/login so - // it cannot be static - $.ajaxSetup({ - beforeSend: function (xhr) { - - function getCookie(name) { - var value = "; " + document.cookie; - var parts = value.split("; " + name + "="); - if (parts.length === 2) - return parts.pop().split(";").shift(); - return null; - } - - var cookieVal = getCookie("UMB-XSRF-TOKEN"); - if (cookieVal) { - xhr.setRequestHeader("X-UMB-XSRF-TOKEN", cookieVal); - } - - var queryString = window.location.getParams(); - if (queryString.umbDebug === "true") { - xhr.setRequestHeader("X-UMB-DEBUG", cookieVal); - } - } - }); - -})(jQuery); \ No newline at end of file diff --git a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs b/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs index 6fa0a9a0d0..712f6e6a1d 100644 --- a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs +++ b/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs @@ -6,7 +6,6 @@ namespace Umbraco.Web.UI.Bundles /// /// The core libs that require JQuery to be loaded /// - [ClientDependency(ClientDependencyType.Javascript, "Application/Extensions.js", "UmbracoClient", Priority = 0, Group = 2)] [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient", Priority = 1, Group = 2)] public class JsUmbracoApplicationCore : Control { From 2fec8b6b028420e0186316ac91ddddfe46a2e5ee Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 15:32:43 +0100 Subject: [PATCH 17/51] Remove jQuer fieldselection lib - its not being used --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../JQuery/jquery-fieldselection.js | 83 ------------------- 2 files changed, 84 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery-fieldselection.js diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 0540b9cd06..2662c2c795 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -379,7 +379,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery-fieldselection.js b/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery-fieldselection.js deleted file mode 100644 index dc4dcee5c0..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery-fieldselection.js +++ /dev/null @@ -1,83 +0,0 @@ -// -// jQuery plugin: fieldSelection - v0.1.0 - last change: 2006-12-16 -// (c) 2006 Alex Brem - http://blog.0xab.cd -// - -(function() { - - var fieldSelection = { - - getSelection: function() { - - var e = this.jquery ? this[0] : this; - - return ( - - // mozilla or dom 3.0 - ('selectionStart' in e && function() { - var l = e.selectionEnd - e.selectionStart; - return { start: e.selectionStart, end: e.selectionEnd, length: l, text: e.value.substr(e.selectionStart, l) }; - }) || - - // exploder - (document.selection && function() { - - e.focus(); - - var r = document.selection.createRange(); - if (r == null) { - return { start: 0, end: e.value.length, length: 0 } - } - - var re = e.createTextRange(); - var rc = re.duplicate(); - re.moveToBookmark(r.getBookmark()); - rc.setEndPoint('EndToStart', re); - - return { start: rc.text.length, end: rc.text.length + r.text.length, length: r.text.length, text: r.text }; - }) || - - // browser not supported - function() { - return { start: 0, end: e.value.length, length: 0 }; - } - - )(); - - }, - - replaceSelection: function() { - - var e = this.jquery ? this[0] : this; - var text = arguments[0] || ''; - - return ( - - // mozilla or dom 3.0 - ('selectionStart' in e && function() { - e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length); - return this; - }) || - - // exploder - (document.selection && function() { - e.focus(); - document.selection.createRange().text = text; - return this; - }) || - - // browser not supported - function() { - e.value += text; - return this; - } - - )(); - - } - - }; - - jQuery.each(fieldSelection, function(i) { jQuery.fn[i] = this; }); - -})(); From 3bc6bf6da5369459bf2828ac8f70963e1bf5a773 Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 15:34:32 +0100 Subject: [PATCH 18/51] jQuery.cookie lib has ran off into the woods --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../Application/JQuery/jquery.cookie.js | 96 ------------------- src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs | 1 - 3 files changed, 98 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.cookie.js diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 2662c2c795..1982d6b018 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -374,7 +374,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.cookie.js b/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.cookie.js deleted file mode 100644 index f27f7df16c..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.cookie.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * 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; - } -}; \ No newline at end of file diff --git a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs b/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs index 245abc2420..413b5f82df 100644 --- a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs +++ b/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs @@ -7,7 +7,6 @@ namespace Umbraco.Web.UI.Bundles /// The core Jquery libs /// [ClientDependency(ClientDependencyType.Javascript, "modal/jquery.simplemodal.1.4.1.custom.js", "UmbracoClient", Priority = 2, Group = 4)] - [ClientDependency(ClientDependencyType.Javascript, "Application/jQuery/jquery.cookie.js", "UmbracoClient", Priority = 3, Group = 4)] [ClientDependency(ClientDependencyType.Javascript, "Application/JQuery/jquery.metadata.min.js", "UmbracoClient", Priority = 4, Group = 4)] [ClientDependency(ClientDependencyType.Javascript, "Application/jQuery/jquery.hotkeys.js", "UmbracoClient", Priority = 5, Group = 4)] public class JsJQueryPlugins : Control From 0e6465ee14835c89ff702de7fb3a0b331577758e Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 15:48:19 +0100 Subject: [PATCH 19/51] See ya later alligator jQuery.hotkeys.js - CTRL+S still wortks in DocType editor so all good --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../Umbraco/masterpages/umbracoPage.Master | 1 - .../Application/JQuery/jquery.hotkeys.js | 99 ------------------- src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs | 1 - 4 files changed, 102 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.hotkeys.js diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 1982d6b018..a0ca59736f 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -358,7 +358,6 @@ - diff --git a/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master b/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master index 97b5daefd4..529c68db63 100644 --- a/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master +++ b/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master @@ -21,7 +21,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.hotkeys.js b/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.hotkeys.js deleted file mode 100644 index fbd71c71ec..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.hotkeys.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * jQuery Hotkeys Plugin - * Copyright 2010, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * - * Based upon the plugin by Tzury Bar Yochay: - * http://github.com/tzuryby/hotkeys - * - * Original idea by: - * Binny V A, http://www.openjs.com/scripts/events/keyboard_shortcuts/ -*/ - -(function(jQuery){ - - jQuery.hotkeys = { - version: "0.8", - - specialKeys: { - 8: "backspace", 9: "tab", 13: "return", 16: "shift", 17: "ctrl", 18: "alt", 19: "pause", - 20: "capslock", 27: "esc", 32: "space", 33: "pageup", 34: "pagedown", 35: "end", 36: "home", - 37: "left", 38: "up", 39: "right", 40: "down", 45: "insert", 46: "del", - 96: "0", 97: "1", 98: "2", 99: "3", 100: "4", 101: "5", 102: "6", 103: "7", - 104: "8", 105: "9", 106: "*", 107: "+", 109: "-", 110: ".", 111 : "/", - 112: "f1", 113: "f2", 114: "f3", 115: "f4", 116: "f5", 117: "f6", 118: "f7", 119: "f8", - 120: "f9", 121: "f10", 122: "f11", 123: "f12", 144: "numlock", 145: "scroll", 191: "/", 224: "meta" - }, - - shiftNums: { - "`": "~", "1": "!", "2": "@", "3": "#", "4": "$", "5": "%", "6": "^", "7": "&", - "8": "*", "9": "(", "0": ")", "-": "_", "=": "+", ";": ": ", "'": "\"", ",": "<", - ".": ">", "/": "?", "\\": "|" - } - }; - - function keyHandler( handleObj ) { - // Only care when a possible input has been specified - if ( typeof handleObj.data !== "string" ) { - return; - } - - var origHandler = handleObj.handler, - keys = handleObj.data.toLowerCase().split(" "); - - handleObj.handler = function( event ) { - // Don't fire in text-accepting inputs that we didn't directly bind to - if ( this !== event.target && (/textarea|select/i.test( event.target.nodeName ) || - event.target.type === "text") ) { - return; - } - - // Keypress represents characters, not special keys - var special = event.type !== "keypress" && jQuery.hotkeys.specialKeys[ event.which ], - character = String.fromCharCode( event.which ).toLowerCase(), - key, modif = "", possible = {}; - - // check combinations (alt|ctrl|shift+anything) - if ( event.altKey && special !== "alt" ) { - modif += "alt+"; - } - - if ( event.ctrlKey && special !== "ctrl" ) { - modif += "ctrl+"; - } - - // TODO: Need to make sure this works consistently across platforms - if ( event.metaKey && !event.ctrlKey && special !== "meta" ) { - modif += "meta+"; - } - - if ( event.shiftKey && special !== "shift" ) { - modif += "shift+"; - } - - if ( special ) { - possible[ modif + special ] = true; - - } else { - possible[ modif + character ] = true; - possible[ modif + jQuery.hotkeys.shiftNums[ character ] ] = true; - - // "$" can be triggered as "Shift+4" or "Shift+$" or just "$" - if ( modif === "shift+" ) { - possible[ jQuery.hotkeys.shiftNums[ character ] ] = true; - } - } - - for ( var i = 0, l = keys.length; i < l; i++ ) { - if ( possible[ keys[i] ] ) { - return origHandler.apply( this, arguments ); - } - } - }; - } - - jQuery.each([ "keydown", "keyup", "keypress" ], function() { - jQuery.event.special[ this ] = { add: keyHandler }; - }); - -})( jQuery ); \ No newline at end of file diff --git a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs b/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs index 413b5f82df..0c0ebde767 100644 --- a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs +++ b/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs @@ -8,7 +8,6 @@ namespace Umbraco.Web.UI.Bundles /// [ClientDependency(ClientDependencyType.Javascript, "modal/jquery.simplemodal.1.4.1.custom.js", "UmbracoClient", Priority = 2, Group = 4)] [ClientDependency(ClientDependencyType.Javascript, "Application/JQuery/jquery.metadata.min.js", "UmbracoClient", Priority = 4, Group = 4)] - [ClientDependency(ClientDependencyType.Javascript, "Application/jQuery/jquery.hotkeys.js", "UmbracoClient", Priority = 5, Group = 4)] public class JsJQueryPlugins : Control { } From 6e08a7d8ce45f27a182aef67b9f2eb2ddea0ab62 Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 15:57:21 +0100 Subject: [PATCH 20/51] jQuery.metadata.js is on garden leave --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - .../Application/JQuery/jquery.metadata.min.js | 13 ------------- src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs | 1 - .../umbraco/controls/Tree/CustomTreeControl.cs | 1 - 4 files changed, 16 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.metadata.min.js diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index a0ca59736f..cbbe28365e 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -377,7 +377,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.metadata.min.js b/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.metadata.min.js deleted file mode 100644 index 1490a7e64e..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/JQuery/jquery.metadata.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Metadata - jQuery plugin for parsing metadata from elements - * - * Copyright (c) 2006 John Resig, Yehuda Katz, J�örn Zaefferer, Paul McLanahan - * - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - * Revision: $Id: jquery.metadata.js 3620 2007-10-10 20:55:38Z pmclanahan $ - * - */ -(function($){$.extend({metadata:{defaults:{type:'class',name:'metadata',cre:/({.*})/,single:'metadata'},setType:function(type,name){this.defaults.type=type;this.defaults.name=name;},get:function(elem,opts){var settings=$.extend({},this.defaults,opts);if(!settings.single.length)settings.single='metadata';var data=$.data(elem,settings.single);if(data)return data;data="{}";if(settings.type=="class"){var m=settings.cre.exec(elem.className);if(m)data=m[1];}else if(settings.type=="elem"){if(!elem.getElementsByTagName)return;var e=elem.getElementsByTagName(settings.name);if(e.length)data=$.trim(e[0].innerHTML);}else if(elem.getAttribute!=undefined){var attr=elem.getAttribute(settings.name);if(attr)data=attr;}if(data.indexOf('{')<0)data="{"+data+"}";data=eval("("+data+")");$.data(elem,settings.single,data);return data;}}});$.fn.metadata=function(opts){return $.metadata.get(this[0],opts);};})(jQuery); \ No newline at end of file diff --git a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs b/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs index 0c0ebde767..4c1b444d9b 100644 --- a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs +++ b/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs @@ -7,7 +7,6 @@ namespace Umbraco.Web.UI.Bundles /// The core Jquery libs /// [ClientDependency(ClientDependencyType.Javascript, "modal/jquery.simplemodal.1.4.1.custom.js", "UmbracoClient", Priority = 2, Group = 4)] - [ClientDependency(ClientDependencyType.Javascript, "Application/JQuery/jquery.metadata.min.js", "UmbracoClient", Priority = 4, Group = 4)] public class JsJQueryPlugins : Control { } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs index fac5b6ebb0..783044ac75 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs @@ -20,7 +20,6 @@ namespace umbraco.controls.Tree [ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")] [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient")] [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")] - [ClientDependency(10, ClientDependencyType.Javascript, "Application/JQuery/jquery.metadata.min.js", "UmbracoClient")] [ClientDependency(11, ClientDependencyType.Javascript, "Tree/jquery.tree.js", "UmbracoClient")] [ClientDependency(12, ClientDependencyType.Javascript, "Tree/UmbracoContext.js", "UmbracoClient")] [ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.contextmenu.js", "UmbracoClient")] From eb220b6db0b52c42af8b0cab84630049ea28486b Mon Sep 17 00:00:00 2001 From: Warren Date: Wed, 1 Aug 2018 22:35:03 +0100 Subject: [PATCH 21/51] Add in jQuery VUpalidate & Unobtrusive into bower Update ref's to new path --- src/Umbraco.Web.UI.Client/bower.json | 70 ++++++++++--------- .../Templates/EditProfile.cshtml | 4 +- .../PartialViewMacros/Templates/Login.cshtml | 4 +- .../Templates/RegisterMember.cshtml | 4 +- .../Umbraco/dialogs/AssignDomain2.aspx | 4 +- .../umbraco/dialogs/AssignDomain2.aspx | 2 +- 6 files changed, 46 insertions(+), 42 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/bower.json b/src/Umbraco.Web.UI.Client/bower.json index 71b393ae9c..b88b6faeec 100644 --- a/src/Umbraco.Web.UI.Client/bower.json +++ b/src/Umbraco.Web.UI.Client/bower.json @@ -31,6 +31,8 @@ "jquery": "2.2.4", "jquery-ui": "~1.12.0", "jquery-migrate": "1.4.0", + "jquery-validate": "~1.17.0", + "jquery-validation-unobtrusive": "3.2.10", "angular-dynamic-locale": "~0.1.36", "ng-file-upload": "~12.2.13", "tinymce": "~4.7.1", @@ -53,39 +55,41 @@ "ace-builds" ], "sources": { - "moment": [ - "bower_components/moment/min/moment.min.js", - "bower_components/moment/min/moment-with-locales.js", - "bower_components/moment/min/moment-with-locales.min.js", - "bower_components/moment/locale/*.js" - ], - "underscore": [ - "bower_components/underscore/underscore-min.js", - "bower_components/underscore/underscore-min.map" - ], - "jquery": [ - "bower_components/jquery/dist/jquery.min.js", - "bower_components/jquery/dist/jquery.min.map" - ], - "angular-dynamic-locale": [ - "bower_components/angular-dynamic-locale/tmhDynamicLocale.min.js", - "bower_components/angular-dynamic-locale/tmhDynamicLocale.min.js.map" - ], - "angular-local-storage": [ - "bower_components/angular-local-storage/dist/angular-local-storage.min.js", - "bower_components/angular-local-storage/dist/angular-local-storage.min.js.map" - ], - "tinymce": [ - "bower_components/tinymce/tinymce.min.js" - ], - "angular-i18n": "bower_components/angular-i18n/angular-locale_*.js", - "typeahead.js": "bower_components/typeahead.js/dist/typeahead.bundle.min.js", - "rgrove-lazyload": "bower_components/rgrove-lazyload/lazyload.js", - "ng-file-upload": "bower_components/ng-file-upload/ng-file-upload.min.js", - "jquery-ui": "bower_components/jquery-ui/jquery-ui.min.js", - "jquery-migrate": "bower_components/jquery-migrate/jquery-migrate.min.js", - "clipboard": "bower_components/clipboard/dist/clipboard.min.js", - "animejs": "bower_components/animejs/anime.min.js" + "moment": [ + "bower_components/moment/min/moment.min.js", + "bower_components/moment/min/moment-with-locales.js", + "bower_components/moment/min/moment-with-locales.min.js", + "bower_components/moment/locale/*.js" + ], + "underscore": [ + "bower_components/underscore/underscore-min.js", + "bower_components/underscore/underscore-min.map" + ], + "jquery": [ + "bower_components/jquery/dist/jquery.min.js", + "bower_components/jquery/dist/jquery.min.map" + ], + "angular-dynamic-locale": [ + "bower_components/angular-dynamic-locale/tmhDynamicLocale.min.js", + "bower_components/angular-dynamic-locale/tmhDynamicLocale.min.js.map" + ], + "angular-local-storage": [ + "bower_components/angular-local-storage/dist/angular-local-storage.min.js", + "bower_components/angular-local-storage/dist/angular-local-storage.min.js.map" + ], + "tinymce": [ + "bower_components/tinymce/tinymce.min.js" + ], + "angular-i18n": "bower_components/angular-i18n/angular-locale_*.js", + "typeahead.js": "bower_components/typeahead.js/dist/typeahead.bundle.min.js", + "rgrove-lazyload": "bower_components/rgrove-lazyload/lazyload.js", + "ng-file-upload": "bower_components/ng-file-upload/ng-file-upload.min.js", + "jquery-ui": "bower_components/jquery-ui/jquery-ui.min.js", + "jquery-migrate": "bower_components/jquery-migrate/jquery-migrate.min.js", + "clipboard": "bower_components/clipboard/dist/clipboard.min.js", + "animejs": "bower_components/animejs/anime.min.js", + "jquery-validate": "bower_components/jquery-validate/dist/jquery.validate.min.js", + "jquery-validation-unobtrusive": "bower_components/jquery-validation-unobtrusive/dist/jquery.validate.unobtrusive.min.js" } }, "devDependencies": { diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml index a494728d8a..dd17f9d6f5 100644 --- a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/EditProfile.cshtml @@ -11,8 +11,8 @@ Html.EnableClientValidation(); Html.EnableUnobtrusiveJavaScript(); Html.RequiresJs("/umbraco/lib/jquery/jquery.min.js"); - Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js"); - Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js"); + Html.RequiresJs("/Umbraco/lib/jquery-validate/jquery.validate.min.js"); + Html.RequiresJs("/Umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"); var success = TempData["ProfileUpdateSuccess"] != null; } diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Login.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Login.cshtml index 2542683f6e..c3fcf04ba3 100644 --- a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Login.cshtml +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/Login.cshtml @@ -12,8 +12,8 @@ Html.EnableClientValidation(); Html.EnableUnobtrusiveJavaScript(); Html.RequiresJs("/umbraco/lib/jquery/jquery.min.js"); - Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js"); - Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js"); + Html.RequiresJs("/Umbraco/lib/jquery-validate/jquery.validate.min.js"); + Html.RequiresJs("/Umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"); } @* NOTE: This RenderJsHere code should be put on your main template page where the rest of your script tags are placed *@ diff --git a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml index d9d80959c9..51c0cc0443 100644 --- a/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml +++ b/src/Umbraco.Web.UI/Umbraco/PartialViewMacros/Templates/RegisterMember.cshtml @@ -35,8 +35,8 @@ Html.EnableClientValidation(); Html.EnableUnobtrusiveJavaScript(); Html.RequiresJs("/umbraco/lib/jquery/jquery.min.js"); - Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.min.js"); - Html.RequiresJs("/umbraco_client/Application/JQuery/jquery.validate.unobtrusive.min.js"); + Html.RequiresJs("/Umbraco/lib/jquery-validate/jquery.validate.min.js"); + Html.RequiresJs("/Umbraco/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"); var success = TempData["FormSuccess"] != null; } diff --git a/src/Umbraco.Web.UI/Umbraco/dialogs/AssignDomain2.aspx b/src/Umbraco.Web.UI/Umbraco/dialogs/AssignDomain2.aspx index 82faad7c36..60601d1ac0 100644 --- a/src/Umbraco.Web.UI/Umbraco/dialogs/AssignDomain2.aspx +++ b/src/Umbraco.Web.UI/Umbraco/dialogs/AssignDomain2.aspx @@ -6,7 +6,7 @@ - + - - - - -
- - -
- - - - - - - - - - - - - - - - - - - - - - - - - -
<%=Services.TextService.Localize("assignDomain/domain") %><%=Services.TextService.Localize("assignDomain/language") %> -
- -
-
- - - <%=Services.TextService.Localize("assignDomain/domainHelp") %> - - - - -
- -
- - - - - -
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.cs deleted file mode 100644 index db04f26bcf..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Text; -using System.Linq; -using Umbraco.Core; -using Umbraco.Core.Models; -using Umbraco.Core.Services; -using Umbraco.Web.UI.Pages; -using Umbraco.Web; -using Umbraco.Web.Composing; -using Umbraco.Web.Editors; -using Umbraco.Web.WebServices; -using Umbraco.Web._Legacy.Actions; - - -namespace umbraco.dialogs -{ - public partial class AssignDomain2 : UmbracoEnsuredPage - { - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - - var nodeId = GetNodeId(); - CheckPathAndPermissions(nodeId, UmbracoObjectTypes.Document, ActionAssignDomain.Instance); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - var nodeId = GetNodeId(); - var node = Services.ContentService.GetById(nodeId); - - if (node == null) - { - feedback.Text = Services.TextService.Localize("assignDomain/invalidNode"); - pane_language.Visible = false; - pane_domains.Visible = false; - p_buttons.Visible = false; - return; - } - - pane_language.Title = Services.TextService.Localize("assignDomain/setLanguage"); - pane_domains.Title = Services.TextService.Localize("assignDomain/setDomains"); - prop_language.Text = Services.TextService.Localize("assignDomain/language"); - - var nodeDomains = Services.DomainService.GetAssignedDomains(nodeId, true).ToArray(); - var wildcard = nodeDomains.FirstOrDefault(d => d.IsWildcard); - - var sb = new StringBuilder(); - sb.Append("languages: ["); - var i = 0; - foreach (var language in Current.Services.LocalizationService.GetAllLanguages()) - sb.AppendFormat("{0}{{ \"Id\": {1}, \"Code\": \"{2}\" }}", (i++ == 0 ? "" : ","), language.Id, language.IsoCode); - sb.Append("]\r\n"); - - sb.AppendFormat(",language: {0}", wildcard == null ? "undefined" : wildcard.LanguageId.ToString()); - - sb.Append(",domains: ["); - i = 0; - foreach (var domain in nodeDomains.Where(d => d.IsWildcard == false)) - sb.AppendFormat("{0}{{ \"Name\": \"{1}\", \"Lang\": \"{2}\" }}", (i++ == 0 ? "" :","), domain.DomainName, domain.LanguageId); - sb.Append("]\r\n"); - - data.Text = sb.ToString(); - } - - protected int GetNodeId() - { - int nodeId; - if (int.TryParse(Request.QueryString["id"], out nodeId) == false) - nodeId = -1; - return nodeId; - } - - protected string GetRestServicePath() - { - const string action = "ListDomains"; - var path = Url.GetUmbracoApiService(action); - return path.TrimEnd(action).EnsureEndsWith('/'); - } - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.designer.cs deleted file mode 100644 index af45317d12..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain2.aspx.designer.cs +++ /dev/null @@ -1,69 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace umbraco.dialogs { - - - public partial class AssignDomain2 { - - /// - /// data control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal data; - - /// - /// feedback control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Umbraco.Web._Legacy.Controls.Feedback feedback; - - /// - /// pane_language control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Umbraco.Web._Legacy.Controls.Pane pane_language; - - /// - /// prop_language control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Umbraco.Web._Legacy.Controls.PropertyPanel prop_language; - - /// - /// pane_domains control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Umbraco.Web._Legacy.Controls.Pane pane_domains; - - /// - /// p_buttons control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl p_buttons; - } -} From 08991dc98c662dd3f76424f715c07424a80747a9 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 2 Aug 2018 11:58:10 +0100 Subject: [PATCH 28/51] Removes old modal js lib & references --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 5 - .../Umbraco/masterpages/umbracoPage.Master | 1 - .../modal/jquery.simplemodal.1.4.1.custom.js | 637 ------------------ .../umbraco_client/modal/modal.js | 402 ----------- .../umbraco_client/modal/modalBackground.gif | Bin 475 -> 0 bytes .../umbraco_client/modal/modalGradiant.gif | Bin 151 -> 0 bytes .../umbraco_client/modal/style.css | 66 -- src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs | 13 - .../UI/Bundles/JsUmbracoApplicationUI.cs | 2 - src/Umbraco.Web/Umbraco.Web.csproj | 1 - 10 files changed, 1127 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/modal/jquery.simplemodal.1.4.1.custom.js delete mode 100644 src/Umbraco.Web.UI/umbraco_client/modal/modal.js delete mode 100644 src/Umbraco.Web.UI/umbraco_client/modal/modalBackground.gif delete mode 100644 src/Umbraco.Web.UI/umbraco_client/modal/modalGradiant.gif delete mode 100644 src/Umbraco.Web.UI/umbraco_client/modal/style.css delete mode 100644 src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index ae71e9a95e..2f5ccf8bec 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -353,7 +353,6 @@ - @@ -376,8 +375,6 @@ - - @@ -497,8 +494,6 @@ - - diff --git a/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master b/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master index 529c68db63..380ed3d898 100644 --- a/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master +++ b/src/Umbraco.Web.UI/Umbraco/masterpages/umbracoPage.Master @@ -20,7 +20,6 @@ - diff --git a/src/Umbraco.Web.UI/umbraco_client/modal/jquery.simplemodal.1.4.1.custom.js b/src/Umbraco.Web.UI/umbraco_client/modal/jquery.simplemodal.1.4.1.custom.js deleted file mode 100644 index 2c0320f50e..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/modal/jquery.simplemodal.1.4.1.custom.js +++ /dev/null @@ -1,637 +0,0 @@ - -; (function ($) { - var ie6 = $.browser && $.browser.msie && parseInt($.browser.version) === 6 && typeof window['XMLHttpRequest'] !== 'object', - ie7 = $.browser && $.browser.msie && parseInt($.browser.version) === 7, - ieQuirks = null, - w = []; - - /* - * Create and display a modal dialog. - * - * @param {string, object} data A string, jQuery object or DOM object - * @param {object} [options] An optional object containing options overrides - */ - $.fullmodal = function (data, options) { - return $.fullmodal.impl.init(data, options); - }; - - /* - * Close the modal dialog. - */ - $.fullmodal.close = function () { - $.fullmodal.impl.close(); - }; - - /* - * Set focus on first or last visible input in the modal dialog. To focus on the last - * element, call $.fullmodal.focus('last'). If no input elements are found, focus is placed - * on the data wrapper element. - */ - $.fullmodal.focus = function (pos) { - $.fullmodal.impl.focus(pos); - }; - - /* - * Determine and set the dimensions of the modal dialog container. - * setPosition() is called if the autoPosition option is true. - */ - $.fullmodal.setContainerDimensions = function () { - $.fullmodal.impl.setContainerDimensions(); - }; - - /* - * Re-position the modal dialog. - */ - $.fullmodal.setPosition = function () { - $.fullmodal.impl.setPosition(); - }; - - /* - * Update the modal dialog. If new dimensions are passed, they will be used to determine - * the dimensions of the container. - * - * setContainerDimensions() is called, which in turn calls setPosition(), if enabled. - * Lastly, focus() is called is the focus option is true. - */ - $.fullmodal.update = function (height, width) { - $.fullmodal.impl.update(height, width); - }; - - /* - * Chained function to create a modal dialog. - * - * @param {object} [options] An optional object containing options overrides - */ - $.fn.fullmodal = function (options) { - return $.fullmodal.impl.init(this, options); - }; - - /* - * SimpleModal default options - * - * appendTo: (String:'body') The jQuery selector to append the elements to. For .NET, use 'form'. - * focus: (Boolean:true) Focus in the first visible, enabled element? - * opacity: (Number:50) The opacity value for the overlay div, from 0 - 100 - * overlayId: (String:'fullmodal-overlay') The DOM element id for the overlay div - * overlayCss: (Object:{}) The CSS styling for the overlay div - * containerId: (String:'fullmodal-container') The DOM element id for the container div - * containerCss: (Object:{}) The CSS styling for the container div - * dataId: (String:'fullmodal-data') The DOM element id for the data div - * dataCss: (Object:{}) The CSS styling for the data div - * minHeight: (Number:null) The minimum height for the container - * minWidth: (Number:null) The minimum width for the container - * maxHeight: (Number:null) The maximum height for the container. If not specified, the window height is used. - * maxWidth: (Number:null) The maximum width for the container. If not specified, the window width is used. - * autoResize: (Boolean:false) Automatically resize the container if it exceeds the browser window dimensions? - * autoPosition: (Boolean:true) Automatically position the container upon creation and on window resize? - * zIndex: (Number: 1000) Starting z-index value - * close: (Boolean:true) If true, closeHTML, escClose and overClose will be used if set. - If false, none of them will be used. - * closeHTML: (String:'') The HTML for the default close link. - SimpleModal will automatically add the closeClass to this element. - * closeClass: (String:'fullmodal-close') The CSS class used to bind to the close event - * escClose: (Boolean:true) Allow Esc keypress to close the dialog? - * overlayClose: (Boolean:false) Allow click on overlay to close the dialog? - * position: (Array:null) Position of container [top, left]. Can be number of pixels or percentage - * persist: (Boolean:false) Persist the data across modal calls? Only used for existing - DOM elements. If true, the data will be maintained across modal calls, if false, - the data will be reverted to its original state. - * modal: (Boolean:true) User will be unable to interact with the page below the modal or tab away from the dialog. - If false, the overlay, iframe, and certain events will be disabled allowing the user to interact - with the page below the dialog. - * onOpen: (Function:null) The callback function used in place of SimpleModal's open - * onShow: (Function:null) The callback function used after the modal dialog has opened - * onClose: (Function:null) The callback function used in place of SimpleModal's close - */ - $.fullmodal.defaults = { - appendTo: 'body', - focus: true, - opacity: 50, - overlayId: 'fullmodal-overlay', - overlayCss: {}, - containerId: 'fullmodal-container', - containerCss: {}, - dataId: 'fullmodal-data', - dataCss: {}, - minHeight: null, - minWidth: null, - maxHeight: null, - maxWidth: null, - autoResize: false, - autoPosition: true, - zIndex: 1000, - close: true, - closeHTML: '', - closeClass: 'fullmodal-close', - escClose: true, - overlayClose: false, - position: null, - persist: false, - modal: true, - onOpen: null, - onShow: null, - onClose: null - }; - - /* - * Main modal object - * o = options - */ - $.fullmodal.impl = { - /* - * Contains the modal dialog elements and is the object passed - * back to the callback (onOpen, onShow, onClose) functions - */ - d: {}, - /* - * Initialize the modal dialog - */ - init: function (data, options) { - var s = this; - - // don't allow multiple calls - if (s.d.data) { - return false; - } - - // $.boxModel is undefined if checked earlier - ieQuirks = $.browser.msie && !$.boxModel; - - // merge defaults and user options - s.o = $.extend({}, $.fullmodal.defaults, options); - - // keep track of z-index - s.zIndex = s.o.zIndex; - - // set the onClose callback flag - s.occb = false; - - // determine how to handle the data based on its type - if (typeof data === 'object') { - // convert DOM object to a jQuery object - data = data instanceof jQuery ? data : $(data); - s.d.placeholder = false; - - // if the object came from the DOM, keep track of its parent - if (data.parent().parent().size() > 0) { - data.before($('') - .attr('id', 'fullmodal-placeholder') - .css({ display: 'none' })); - - s.d.placeholder = true; - s.display = data.css('display'); - - // persist changes? if not, make a clone of the element - if (!s.o.persist) { - s.d.orig = data.clone(true); - } - } - } - else if (typeof data === 'string' || typeof data === 'number') { - // just insert the data as innerHTML - data = $('
').html(data); - } - else { - // unsupported data type! - alert('SimpleModal Error: Unsupported data type: ' + typeof data); - return s; - } - - // create the modal overlay, container and, if necessary, iframe - s.create(data); - data = null; - - // display the modal dialog - s.open(); - - // useful for adding events/manipulating data in the modal dialog - if ($.isFunction(s.o.onShow)) { - s.o.onShow.apply(s, [s.d]); - } - - // don't break the chain =) - return s; - }, - /* - * Create and add the modal overlay and container to the page - */ - create: function (data) { - var s = this; - - // get the window properties - w = s.getDimensions(); - - // add an iframe to prevent select options from bleeding through - if (s.o.modal && ie6) { - s.d.iframe = $('') - .css($.extend(s.o.iframeCss, { - display: 'none', - opacity: 0, - position: 'fixed', - height: w[0], - width: w[1], - zIndex: s.o.zIndex, - top: 0, - left: 0 - })) - .appendTo(s.o.appendTo); - } - - // create the overlay - s.d.overlay = $('
') - .attr('id', s.o.overlayId) - .addClass('fullmodal-overlay') - .css($.extend(s.o.overlayCss, { - display: 'none', - opacity: s.o.opacity / 100, - height: s.o.modal ? w[0] : 0, - width: s.o.modal ? w[1] : 0, - position: 'fixed', - left: 0, - top: 0, - zIndex: s.o.zIndex + 1 - })) - .appendTo(s.o.appendTo); - - // create the container - s.d.container = $('
') - .attr('id', s.o.containerId) - .addClass('fullmodal-container') - .css($.extend(s.o.containerCss, { - display: 'none', - position: 'fixed', - zIndex: s.o.zIndex + 2 - })) - .append(s.o.close && s.o.closeHTML - ? $(s.o.closeHTML).addClass(s.o.closeClass) - : '') - .appendTo(s.o.appendTo); - - s.d.wrap = $('
') - .attr('tabIndex', -1) - .addClass('fullmodal-wrap') - .css({ height: '100%', outline: 0, width: '100%' }) - .appendTo(s.d.container); - - // add styling and attributes to the data - // append to body to get correct dimensions, then move to wrap - s.d.data = data - .attr('id', data.attr('id') || s.o.dataId) - .addClass('fullmodal-data') - .css($.extend(s.o.dataCss, { - display: 'none' - })) - .appendTo('body'); - data = null; - - s.setContainerDimensions(); - s.d.data.appendTo(s.d.wrap); - - // fix issues with IE - if (ie6 || ieQuirks) { - s.fixIE(); - } - }, - /* - * Bind events - */ - bindEvents: function () { - var s = this; - - // bind the close event to any element with the closeClass class - $('.' + s.o.closeClass).bind('click.fullmodal', function (e) { - e.preventDefault(); - s.close(); - }); - - // bind the overlay click to the close function, if enabled - if (s.o.modal && s.o.close && s.o.overlayClose) { - s.d.overlay.bind('click.fullmodal', function (e) { - e.preventDefault(); - s.close(); - }); - } - - // bind keydown events - $(document).bind('keydown.fullmodal', function (e) { - if (s.o.modal && e.keyCode === 9) { // TAB - s.watchTab(e); - } - else if ((s.o.close && s.o.escClose) && e.keyCode === 27) { // ESC - e.preventDefault(); - s.close(); - } - }); - - // update window size - $(window).bind('resize.fullmodal', function () { - // redetermine the window width/height - w = s.getDimensions(); - - // reposition the dialog - s.o.autoResize ? s.setContainerDimensions() : s.o.autoPosition && s.setPosition(); - - if (ie6 || ieQuirks) { - s.fixIE(); - } - else if (s.o.modal) { - // update the iframe & overlay - s.d.iframe && s.d.iframe.css({ height: w[0], width: w[1] }); - s.d.overlay.css({ height: w[0], width: w[1] }); - } - }); - }, - /* - * Unbind events - */ - unbindEvents: function () { - $('.' + this.o.closeClass).unbind('click.fullmodal'); - $(document).unbind('keydown.fullmodal'); - $(window).unbind('resize.fullmodal'); - this.d.overlay.unbind('click.fullmodal'); - }, - /* - * Fix issues in IE6 and IE7 in quirks mode - */ - fixIE: function () { - var s = this, p = s.o.position; - - // simulate fixed position - adapted from BlockUI - $.each([s.d.iframe || null, !s.o.modal ? null : s.d.overlay, s.d.container], function (i, el) { - if (el) { - var bch = 'document.body.clientHeight', bcw = 'document.body.clientWidth', - bsh = 'document.body.scrollHeight', bsl = 'document.body.scrollLeft', - bst = 'document.body.scrollTop', bsw = 'document.body.scrollWidth', - ch = 'document.documentElement.clientHeight', cw = 'document.documentElement.clientWidth', - sl = 'document.documentElement.scrollLeft', st = 'document.documentElement.scrollTop', - s = el[0].style; - - s.position = 'absolute'; - if (i < 2) { - s.removeExpression('height'); - s.removeExpression('width'); - s.setExpression('height', '' + bsh + ' > ' + bch + ' ? ' + bsh + ' : ' + bch + ' + "px"'); - s.setExpression('width', '' + bsw + ' > ' + bcw + ' ? ' + bsw + ' : ' + bcw + ' + "px"'); - } - else { - var te, le; - if (p && p.constructor === Array) { - var top = p[0] - ? typeof p[0] === 'number' ? p[0].toString() : p[0].replace(/px/, '') - : el.css('top').replace(/px/, ''); - te = top.indexOf('%') === -1 - ? top + ' + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"' - : parseInt(top.replace(/%/, '')) + ' * ((' + ch + ' || ' + bch + ') / 100) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; - - if (p[1]) { - var left = typeof p[1] === 'number' ? p[1].toString() : p[1].replace(/px/, ''); - le = left.indexOf('%') === -1 - ? left + ' + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"' - : parseInt(left.replace(/%/, '')) + ' * ((' + cw + ' || ' + bcw + ') / 100) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; - } - } - else { - te = '(' + ch + ' || ' + bch + ') / 2 - (this.offsetHeight / 2) + (t = ' + st + ' ? ' + st + ' : ' + bst + ') + "px"'; - le = '(' + cw + ' || ' + bcw + ') / 2 - (this.offsetWidth / 2) + (t = ' + sl + ' ? ' + sl + ' : ' + bsl + ') + "px"'; - } - s.removeExpression('top'); - s.removeExpression('left'); - s.setExpression('top', te); - s.setExpression('left', le); - } - } - }); - }, - /* - * Place focus on the first or last visible input - */ - focus: function (pos) { - var s = this, p = pos && $.inArray(pos, ['first', 'last']) !== -1 ? pos : 'first'; - - // focus on dialog or the first visible/enabled input element - var input = $(':input:enabled:visible:' + p, s.d.wrap); - setTimeout(function () { - input.length > 0 ? input.focus() : s.d.wrap.focus(); - }, 10); - }, - getDimensions: function () { - var el = $(window); - - // fix a jQuery/Opera bug with determining the window height - var h = $.browser && $.browser.opera && $.browser.version > '9.5' && $.fn.jquery < '1.3' - || $.browser && $.browser.opera && $.browser.version < '9.5' && $.fn.jquery > '1.2.6' - ? el[0].innerHeight : el.height(); - - return [h, el.width()]; - }, - getVal: function (v, d) { - return v ? (typeof v === 'number' ? v - : v === 'auto' ? 0 - : v.indexOf('%') > 0 ? ((parseInt(v.replace(/%/, '')) / 100) * (d === 'h' ? w[0] : w[1])) - : parseInt(v.replace(/px/, ''))) - : null; - }, - /* - * Update the container. Set new dimensions, if provided. - * Focus, if enabled. Re-bind events. - */ - update: function (height, width) { - var s = this; - - // prevent update if dialog does not exist - if (!s.d.data) { - return false; - } - - // reset orig values - s.d.origHeight = s.getVal(height, 'h'); - s.d.origWidth = s.getVal(width, 'w'); - - // hide data to prevent screen flicker - s.d.data.hide(); - height && s.d.container.css('height', height); - width && s.d.container.css('width', width); - s.setContainerDimensions(); - s.d.data.show(); - s.o.focus && s.focus(); - - // rebind events - s.unbindEvents(); - s.bindEvents(); - }, - setContainerDimensions: function () { - var s = this, - badIE = ie6 || ie7; - - // get the dimensions for the container and data - var ch = s.d.origHeight ? s.d.origHeight : $.browser.opera ? s.d.container.height() : s.getVal(badIE ? s.d.container[0].currentStyle['height'] : s.d.container.css('height'), 'h'), - cw = s.d.origWidth ? s.d.origWidth : $.browser.opera ? s.d.container.width() : s.getVal(badIE ? s.d.container[0].currentStyle['width'] : s.d.container.css('width'), 'w'), - dh = s.d.data.outerHeight(true), dw = s.d.data.outerWidth(true); - - s.d.origHeight = s.d.origHeight || ch; - s.d.origWidth = s.d.origWidth || cw; - - // mxoh = max option height, mxow = max option width - var mxoh = s.o.maxHeight ? s.getVal(s.o.maxHeight, 'h') : null, - mxow = s.o.maxWidth ? s.getVal(s.o.maxWidth, 'w') : null, - mh = mxoh && mxoh < w[0] ? mxoh : w[0], - mw = mxow && mxow < w[1] ? mxow : w[1]; - - // moh = min option height - var moh = s.o.minHeight ? s.getVal(s.o.minHeight, 'h') : 'auto'; - if (!ch) { - if (!dh) { ch = moh; } - else { - if (dh > mh) { ch = mh; } - else if (s.o.minHeight && moh !== 'auto' && dh < moh) { ch = moh; } - else { ch = dh; } - } - } - else { - ch = s.o.autoResize && ch > mh ? mh : ch < moh ? moh : ch; - } - - // mow = min option width - var mow = s.o.minWidth ? s.getVal(s.o.minWidth, 'w') : 'auto'; - if (!cw) { - if (!dw) { cw = mow; } - else { - if (dw > mw) { cw = mw; } - else if (s.o.minWidth && mow !== 'auto' && dw < mow) { cw = mow; } - else { cw = dw; } - } - } - else { - cw = s.o.autoResize && cw > mw ? mw : cw < mow ? mow : cw; - } - - s.d.container.css({ height: ch, width: cw }); - s.d.wrap.css({ overflow: (dh > ch || dw > cw) ? 'auto' : 'visible' }); - s.o.autoPosition && s.setPosition(); - }, - setPosition: function () { - var s = this, top, left, - hc = (w[0] / 2) - (s.d.container.outerHeight(true) / 2), - vc = (w[1] / 2) - (s.d.container.outerWidth(true) / 2); - - if (s.o.position && Object.prototype.toString.call(s.o.position) === '[object Array]') { - top = s.o.position[0] || hc; - left = s.o.position[1] || vc; - } else { - top = hc; - left = vc; - } - s.d.container.css({ left: left, top: top }); - }, - watchTab: function (e) { - var s = this; - - if ($(e.target).parents('.fullmodal-container').length > 0) { - // save the list of inputs - s.inputs = $(':input:enabled:visible:first, :input:enabled:visible:last', s.d.data[0]); - - // if it's the first or last tabbable element, refocus - if ((!e.shiftKey && e.target === s.inputs[s.inputs.length - 1]) || - (e.shiftKey && e.target === s.inputs[0]) || - s.inputs.length === 0) { - e.preventDefault(); - var pos = e.shiftKey ? 'last' : 'first'; - s.focus(pos); - } - } - else { - // might be necessary when custom onShow callback is used - e.preventDefault(); - s.focus(); - } - }, - /* - * Open the modal dialog elements - * - Note: If you use the onOpen callback, you must "show" the - * overlay and container elements manually - * (the iframe will be handled by SimpleModal) - */ - open: function () { - var s = this; - // display the iframe - s.d.iframe && s.d.iframe.show(); - - if ($.isFunction(s.o.onOpen)) { - // execute the onOpen callback - s.o.onOpen.apply(s, [s.d]); - } - else { - // display the remaining elements - s.d.overlay.show(); - s.d.container.show(); - s.d.data.show(); - } - - s.o.focus && s.focus(); - - // bind default events - s.bindEvents(); - }, - /* - * Close the modal dialog - * - Note: If you use an onClose callback, you must remove the - * overlay, container and iframe elements manually - * - * @param {boolean} external Indicates whether the call to this - * function was internal or external. If it was external, the - * onClose callback will be ignored - */ - close: function () { - var s = this; - - // prevent close when dialog does not exist - if (!s.d.data) { - return false; - } - - // remove the default events - s.unbindEvents(); - - if ($.isFunction(s.o.onClose) && !s.occb) { - // set the onClose callback flag - s.occb = true; - - // execute the onClose callback - s.o.onClose.apply(s, [s.d]); - } - else { - // if the data came from the DOM, put it back - if (s.d.placeholder) { - var ph = $('#fullmodal-placeholder'); - // save changes to the data? - if (s.o.persist) { - // insert the (possibly) modified data back into the DOM - ph.replaceWith(s.d.data.removeClass('fullmodal-data').css('display', s.display)); - } - else { - // remove the current and insert the original, - // unmodified data back into the DOM - s.d.data.hide().remove(); - ph.replaceWith(s.d.orig); - } - } - else { - // otherwise, remove it - s.d.data.hide().remove(); - } - - // remove the remaining elements - s.d.container.hide().remove(); - s.d.overlay.hide(); - s.d.iframe && s.d.iframe.hide().remove(); - setTimeout(function () { - // opera work-around - s.d.overlay.remove(); - - // reset the dialog object - s.d = {}; - }, 10); - } - } - }; -})(jQuery); diff --git a/src/Umbraco.Web.UI/umbraco_client/modal/modal.js b/src/Umbraco.Web.UI/umbraco_client/modal/modal.js deleted file mode 100644 index ba6c4d96fb..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/modal/modal.js +++ /dev/null @@ -1,402 +0,0 @@ -/// - -Umbraco.Sys.registerNamespace("Umbraco.Controls"); - -(function($) { - - $.fn.ModalWindowAPI = function() { - /// jQuery plugin exposes the modal window api for the selected object - //if there's more than item in the selector, throw exception - if ($(this).length != 1) { - throw "ModalWindowAPI selector requires that there be exactly one control selected"; - }; - return $(this).data("ModalWindowAPI") == null ? null : $(this).data("ModalWindowAPI"); - }; - - $.fn.ModalWindowShow = function (name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { - /// Shows a modal window based on existing content in the DOM - return $(this).each(function () { - //check if the modal exists already - if ($(this).closest(".umbModalBox").length > 0) { - Umbraco.Controls.ModalWindow.cntr++; - var api = $(this).closest(".umbModalBox").ModalWindowAPI(); - api._obj.jqmShow(); //since it exist, just re-show it - } - else { - var modal = Umbraco.Controls.ModalWindow(); - modal.show(this, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback); - } - }); - }; - - $.fn.ModalWindowShowWithoutBackground = function(name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { - /// Shows a modal window based on existing content in the DOM - return $(this).each(function() { - //check if the modal exists already - if ($(this).closest(".umbModalBox").length > 0) { - Umbraco.Controls.ModalWindow.cntr++; - var api = $(this).closest(".umbModalBox").ModalWindowAPI(); - api._hideOverlay = true; - api._obj.jqmShow(); //since it exist, just re-show it - } - else { - var modal = Umbraco.Controls.ModalWindow(); - modal._hideOverlay = true; - modal.show(this, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback); - } - }); - }; - - Umbraco.Controls.ModalWindow = function () { - /// - /// Modal window class, when open is called, it will create a temporary html element to attach the window to. - /// The modal will attempt to be created in the top most frame if all of the libraries are found there, if not, - /// it uses the current frame's document/jquery objects. - /// - - var m = { - _wId: Umbraco.Utils.generateRandom().toString().replace(".", ""), //the modal window ID that will be assigned - _obj: null, //the jquery element for the modal window - _rVal: null, //a return value specified when closing that gets passed to the onCloseCallback method - _cntr: Umbraco.Controls.ModalWindow.cntr++, //counts instances - _hideOverlay: false, // hides the overlay between the modal and the backgground - //get a reference to the topmost jquery object if there is a modal framework there, otherwise use current - _$: (window.top.jQuery && window.top.jQuery.jqm) ? window.top.jQuery : $, - //get a reference to the topmost document if we're selecting the topmost jquery, otherwise use the current - _document: (window.top.jQuery && window.top.jQuery.jqm) ? window.top.document : document, - - show: function(selector, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { - /// Shows a modal window based on existing content in the DOM - //check if the modal elems exist - if (!this._modalElemsExist()) { - this._createModalElems(false, selector); - } - - var _this = this; - this._open(name, showHeader, - width, height, top, leftOffset, - closeTriggers, onCloseCallback, - function(h) { - //insert the content - var umbModal = _this._$(h.w); - var umbModalContent = _this._$(".umbModalBoxContent", umbModal); - umbModalContent.append(_this._$(selector)); - _this._$(selector).show(); - }); - }, - open: function(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { - /// Shows a modal window with content specified in the url in an iframe - //check if the modal elems exist - if (!this._modalElemsExist()) { - this._createModalElems(true); - } - var _this = this; - this._open(name, showHeader, - width, height, top, leftOffset, - closeTriggers, onCloseCallback, - function(h) { - //get the iframe, and set the url - var umbModal = _this._$(h.w); - var iframe = _this._$("iframe", umbModal); - iframe.attr('src', _this._getUniqueUrl(url)); - iframe.width(width); - iframe.height(showHeader ? height - 30 : height); - iframe.show(); - }); - }, - _open: function(name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback, onCreate) { - /// Opens a modal window - /// Optional - /// Optional - /// - /// Optional: An array of jQuery selectors that will trigger the modal window to close - /// - /// - /// A method that is called when the window is closing. the callback method will receive an instance - /// of the jQuery object for the popup window/iframe so that you can query against the contents of the window - /// to extract any information. - /// The callback will receive one parameter with 2 properties: - /// modalContent = the jQuery object for the popup window to query against - /// outVal = the value passed to the close window method that was used to close the window (if it was specified) - /// - /// The generated jquery object bound to the modal window - - - - var _this = this; - - this._obj.jqm({ - - onShow: function(h) { - var umbModal = _this._$(h.w); - - //remove the header if it shouldn't be shown - if (!showHeader) { - _this._obj.find(".umbModalBoxHeader").remove(); - _this._obj.find(".umbracModalBoxClose").remove(); - } - else { - //set the title - _this._obj.find(".umbModalBoxHeader").html(name); - } - - //if the height is set, then set it - if (height > 0) { - umbModal.height(height); - } - - //if the width is set, then set it in the center - if (width > 0) { - umbModal.width(width); - umbModal.css("left", ((_this._$(_this._document).width() - width) / 2) + "px"); - } - - //if the top is set - if (top > 0) { - umbModal.css("top", top + "px"); - } - - //if the leftOffset is set - if (leftOffset > 0) { - var newLeft = parseInt(umbModal.css("left").replace("px", "")) + leftOffset; - umbModal.css("left", newLeft); - } - - umbModal.fadeIn(250); - - if (_this._hideOverlay) - jQuery('.jqmOverlay').attr('class',''); - - if (typeof onCreate == "function") { - onCreate.call(_this, h) - } - - _this._$(_this._document).keyup(function(event) { - if (event.keyCode == 27 && umbModal.css("display") == "block") { - _this.close(); - } - }); - - if (closeTriggers) { - for (var x in closeTriggers) { - //Ok, this is a bit weird, but it makes sense. Since the selector passed in might be a selector - //that exists in the root jquery obj, the current jquery object, or an item in the iframe if there is one - //we'll try to find them all. - var trigger = closeTriggers[x]; - //first check if the object passed in is already a jquery object - if (!trigger.jquery) { - trigger = _this._$(closeTriggers[x]); //find object in the doc that owns the modal container - if (trigger.length == 0) { - trigger = $(closeTriggers[x]); //find object in the doc that owns the curr jquery object - } - if (trigger.length == 0) { - try { - trigger = h.w.find("iframe").contents().find(closeTriggers[x]); - } - catch (err) { } //IE throws an exception when navigating iframes, but it stil works... - } - } - _this._obj.jqmAddClose(trigger); - } - } - - }, - onHide: function(h) { - var umbModal = _this._$(h.w); - var umbModalContent = _this._$(".umbModalBoxContent", umbModal); - var iframe = umbModalContent.find("iframe"); - if (typeof onCloseCallback == "function") { - //call the callback if specified, pass the jquery content object as a param and the output value array - //pass the iframe if there is one - var e = { modalContent: iframe.length > 0 ? iframe : umbModalContent, outVal: _this._rVal }; - onCloseCallback.call(_this, e); - } - - h.w.fadeOut(300, function() { - //remove the modal objects and iframes if it's an iframe modal box - if (iframe.length > 0) { - iframe.attr('src', 'javascript:false;document.write(\'\');'); - _this._obj.remove(); - } - h.o.remove(); - _this._close(); - }); - } - }); - - this._obj.jqmShow(); - //store the api in this objects data store - this._obj.data("ModalWindowAPI", this); - return this._obj; - }, - close: function(rVal) { - /// Closes the modal window - /// if specified, will add this parameter to the onCloseCallback method's outVal parameter so it may be used in the closing callback method - this._rVal = rVal; - top.focus(); - this._obj.jqmHide(); //do the hiding, this will call the onHide handler - }, - _close: function() { - /// Finalizes the objects counter and instance manager - - //remove the instance from the instance manager - Umbraco.Controls.ModalWindow.inst[this._cntr] = null; - Umbraco.Controls.ModalWindow.inst[this._wId] = null; - Umbraco.Controls.ModalWindow.cntr--; //reduce the counter - }, - _createModalElems: function(withIFrame, selector) { - /// This will create the html elements required for the modal overlay if they do not already exist in the DOM - - var overlayHtml = this._getOverlayHtml(withIFrame); - - if (!selector) { - this._obj = this._$(overlayHtml).appendTo(this._$("body")); - } - else { - this._obj = this._$(overlayHtml).appendTo(this._$(selector).parent()); - } - //update the z-index so it stacks - this._obj.css("z-index", 10000 + (this._cntr * 10)); - - var _this = this; - if (this._$.fn.draggable) { - this._obj.draggable({ - cursor: 'move', - distance: 5, - iframeFix: withIFrame, - helper: function(event) { - var o = _this._$(this).clone(); - o.children().remove(); - o.css("border-width", "1px"); - return o; - }, - start: function(event, ui) { - ui.helper.css("z-index", 20000); - }, - stop: function(event, ui) { - _this._obj.css("top", ui.position.top); - _this._obj.css("left", ui.position.left); - } - }); - } - else { - this._obj.find(".umbModalBoxHeader").css("cursor", "default"); //remove the move cursor if we can't move - } - }, - _getOverlayHtml: function(withIFrame) { - var overlayHtml = "
" + - "
×" + - "
"; - if (withIFrame) { - overlayHtml += ""; - } - overlayHtml += "
"; - return overlayHtml; - }, - _modalElemsExist: function() { - return (this._$("#" + this._wId + "_modal").length > 0); - }, - _getUniqueUrl: function(url) { - var r = Umbraco.Utils.generateRandom(); - if (url.indexOf("?") > -1) - return url += "&rndo=" + r; - else - return url += "?rndo=" + r; - } - }; - - //store a reference to this api by the id and the counter - Umbraco.Controls.ModalWindow.inst[m._cntr] = m; - Umbraco.Controls.ModalWindow.inst[m._wId] = Umbraco.Controls.ModalWindow.inst[m._cntr]; - - return m; - }; - - // instance manager - Umbraco.Controls.ModalWindow.cntr = 0; - Umbraco.Controls.ModalWindow.inst = {}; - -})(jQuery); - - -// -// jqModal - Minimalist Modaling with jQuery -// (http://dev.iceburg.net/jquery/jqModal/) -// -// Copyright (c) 2007,2008 Brice Burgess -// Dual licensed under the MIT and GPL licenses: -// http://www.opensource.org/licenses/mit-license.php -// http://www.gnu.org/licenses/gpl.html -// -// $Version: 07/06/2008 +r13 -// -(function($) { - $.fn.jqm = function(o) { - var p = { - overlay: 50, - overlayClass: 'jqmOverlay', - closeClass: 'jqmClose', - trigger: '.jqModal', - ajax: F, - ajaxText: '', - target: F, - modal: true, - toTop: F, - onShow: F, - onHide: F, - onLoad: F - }; - return this.each(function() { - if (this._jqm) return H[this._jqm].c = $.extend({}, H[this._jqm].c, o); s++; this._jqm = s; - H[s] = { c: $.extend(p, $.jqm.params, o), a: F, w: $(this).addClass('jqmID' + s), s: s }; - if (p.trigger) $(this).jqmAddTrigger(p.trigger); - }); - }; - - $.fn.jqmAddClose = function(e) { return hs(this, e, 'jqmHide'); }; - $.fn.jqmAddTrigger = function(e) { return hs(this, e, 'jqmShow'); }; - $.fn.jqmShow = function(t) { return this.each(function() { $.jqm.open(this._jqm, t); }); }; - $.fn.jqmHide = function(t) { return this.each(function() { $.jqm.close(this._jqm, t); }); }; - - $.jqm = { - hash: {}, - open: function(s, t) { - var h = H[s], c = h.c, cc = '.' + c.closeClass, z = (parseInt(h.w.css('z-index'))), z = (z > 0) ? z : 3000, o = $('
').css({ height: '100%', width: '100%', position: 'fixed', left: 0, top: 0, 'z-index': z - 1 }); if (h.a) return F; h.t = t; h.a = true; h.w.css('z-index', z); - if (c.modal) { if (!A[0]) L('bind'); A.push(s); } - else if (c.overlay > 0) h.w.jqmAddClose(o); - else o = F; - - h.o = (o) ? o.addClass(c.overlayClass).prependTo('body') : F; - if (ie6) { $('html,body').css({ height: '100%', width: '100%' }); if (o) { o = o.css({ position: 'absolute' })[0]; for (var y in { Top: 1, Left: 1 }) o.style.setExpression(y.toLowerCase(), "(_=(document.documentElement.scroll" + y + " || document.body.scroll" + y + "))+'px'"); } } - - if (c.ajax) { - var r = c.target || h.w, u = c.ajax, r = (typeof r == 'string') ? $(r, h.w) : $(r), u = (u.substr(0, 1) == '@') ? $(t).attr(u.substring(1)) : u; - r.html(c.ajaxText).load(u, function() { if (c.onLoad) c.onLoad.call(this, h); if (cc) h.w.jqmAddClose($(cc, h.w)); e(h); }); - } - else if (cc) h.w.jqmAddClose($(cc, h.w)); - - if (c.toTop && h.o) h.w.before('').insertAfter(h.o); - (c.onShow) ? c.onShow(h) : h.w.show(); e(h); return F; - }, - close: function(s) { - var h = H[s]; if (!h.a) return F; h.a = F; - if (A[0]) { A.pop(); if (!A[0]) L('unbind'); } - if (h.c.toTop && h.o) $('#jqmP' + h.w[0]._jqm).after(h.w).remove(); - if (h.c.onHide) h.c.onHide(h); else { h.w.hide(); if (h.o) h.o.remove(); } return F; - }, - params: {} - }; - var s = 0, H = $.jqm.hash, A = [], ie6 = $.browser && $.browser.msie && ($.browser.version == "6.0"), F = false, -i = $('').css({ opacity: 0 }), -e = function(h) { if (ie6) if (h.o) h.o.html('

').prepend(i); else if (!$('iframe.jqm', h.w)[0]) h.w.prepend(i); }, - //f = function(h) { try { $(':input:visible', h.w)[0].focus(); } catch (_) { } }, -L = function(t) { $()[t]("keypress", m)[t]("keydown", m)[t]("mousedown", m); }, -m = function(e) { var h = H[A[A.length - 1]], r = (!$(e.target).parents('.jqmID' + h.s)[0]); if (r) f(h); return !r; }, -hs = function(w, t, c) { - return w.each(function() { - var s = this._jqm; $(t).each(function() { - if (!this[c]) { this[c] = []; $(this).click(function() { for (var i in { jqmShow: 1, jqmHide: 1 }) for (var s in this[i]) if (H[this[i][s]]) H[this[i][s]].w[i](this); return F; }); } this[c].push(s); - }); - }); -}; -})(jQuery); diff --git a/src/Umbraco.Web.UI/umbraco_client/modal/modalBackground.gif b/src/Umbraco.Web.UI/umbraco_client/modal/modalBackground.gif deleted file mode 100644 index b41ee631c24eb87815a732d4cc302da7c9dd0729..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 475 zcmV<10VMuMNk%w1VW0q@0Du7i|NsC0|NkNR1OWg50RSuj0001>0H6Q>0{;w*r^)LL zpNw?cim%RG?casqD3;`jnJUVzZVM;z{MPjC+B(kfzS9f-hC&kYSVSs4%VzSab4sC9 zQ}sH{UbI}S*YFK@rDL%fc}|yoYqk6Jj<-v5xjl2w*CBhoAKVxCcOY2kH)yz*i0H<+ zxc2C1CK<_9N$G`oNv7FJ|qK2GQjYW_=3j_#?B%iii94zDR+ zOP^|QjZdjB%fHFrG=Po-z9Lx3U^9e>6lQbyjo~7Re;{_Vn2w?$jk0<$p7R)wqacxY zKz1S-$fPQia#UhssR(8xmjPwAv8jfpB%F|VPSTmsXBVMjfHER#327#ykC+Zpn#Jiv zsU4wSvC4_+NUbHYuHu@~>k_e0z}g|J#B3k5Nz}$+d&F%WxI*O4q$|p98N8_Y?(mC4 zZyLa^1P?V_l<*A2H4qe*OCW`?sGzet!D& z>Cc}(KY#xG`{(bsZ{I$D{`~LX|L;G3eEj(F|Ns9CL;%H~EMQeSAQEIJ1FOgb6~6#Q V6K@9t&lU^z4?JCpcgr~#tO24SMI`_L diff --git a/src/Umbraco.Web.UI/umbraco_client/modal/style.css b/src/Umbraco.Web.UI/umbraco_client/modal/style.css deleted file mode 100644 index 7a4c2a1728..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/modal/style.css +++ /dev/null @@ -1,66 +0,0 @@ -/* TODO: Change these to classes to support many modal boxes */ -div#umbModalBox, -div.umbModalBox { - position: absolute; - top: 0; - border: 5px #a3a3a3 solid; - /*border-top: none;*/ - text-align: left; - z-index: 10000; - display: none; - background: #fff ! important; - font: bold 100% "Lucida Grande", Arial, sans-serif; -} - -div#umbModalBox.loaded, -div.umbModalBox.loaded -{ - background-image: none; -} - -.jqmOverlay {background: url(modalBackground.gif)} - -div#umbModalBoxHeader, -div.umbModalBoxHeader { - margin: 0; - text-shadow: #FFF 0 1px 0; - padding: .5em 2em .5em .75em; - margin: 0; - text-align: left; -} - -div#umbModalBoxContent, -div.umbModalBoxContent { - padding: 0px; - overflow: hidden; - /*height: 100%;*/ - background: #fff ! important; -} - -a#umbracModalBoxClose, -a.umbracModalBoxClose { - display: block; - position: absolute; - right: 5px; top: 2px; - padding: 2px 3px; - font-weight: bold; - text-decoration: none; - font-size: 13px; -} - -div#umbModalBoxContent, -div.umbModalBoxContent {border-top: 1px solid #F9F9F9; } - -div#umbModalBoxHeader, -div.umbModalBoxHeader { - background: url(modalGradiant.gif) repeat-x bottom #fff ! important; - border-bottom: 1px solid #CCC; - color: #378080; - cursor:move; -} - -div#umbracModalBoxClose, -div.umbracModalBoxClose { color: #777 } - -div#umbracModalBoxClose:hover, -div.umbracModalBoxClose:hover { color: #000 } \ No newline at end of file diff --git a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs b/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs deleted file mode 100644 index 4c1b444d9b..0000000000 --- a/src/Umbraco.Web/UI/Bundles/JsJQueryPlugins.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Web.UI; -using ClientDependency.Core; - -namespace Umbraco.Web.UI.Bundles -{ - ///

- /// The core Jquery libs - /// - [ClientDependency(ClientDependencyType.Javascript, "modal/jquery.simplemodal.1.4.1.custom.js", "UmbracoClient", Priority = 2, Group = 4)] - public class JsJQueryPlugins : Control - { - } -} diff --git a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationUI.cs b/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationUI.cs index dd37c25d8f..cd4f8da660 100644 --- a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationUI.cs +++ b/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationUI.cs @@ -7,9 +7,7 @@ namespace Umbraco.Web.UI.Bundles /// The UI Umbraco libs /// [ClientDependency(ClientDependencyType.Javascript, "js/guiFunctions.js", "UmbracoRoot", Priority = 1, Group = 5)] - [ClientDependency(ClientDependencyType.Javascript, "modal/modal.js", "UmbracoClient", Priority = 2, Group = 5)] [ClientDependency(ClientDependencyType.Javascript, "js/UmbracoSpeechBubbleBackend.js", "UmbracoRoot", Priority = 3, Group = 5)] - [ClientDependency(ClientDependencyType.Javascript, "modal/modal.js", "UmbracoClient", Priority = 2, Group = 5)] public class JsUmbracoApplicationUI : Control { } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 336b0436d6..427c7fdd66 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -961,7 +961,6 @@ - From 6967ed1846cd291a3bc41075dea3cfe782dd817c Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 2 Aug 2018 13:52:13 +0100 Subject: [PATCH 29/51] Adds in Sort Angular dialog from Mads & removes some of the old sort dialog parts --- .../views/content/content.sort.controller.js | 78 +++++++++++++++++++ .../src/views/content/sort.html | 54 +++++++++++++ .../Trees/ContentTreeController.cs | 4 +- .../Trees/LegacyTreeDataConverter.cs | 6 -- src/Umbraco.Web/Trees/MediaTreeController.cs | 4 +- src/Umbraco.Web/_Legacy/Actions/ActionSort.cs | 2 +- 6 files changed, 137 insertions(+), 11 deletions(-) create mode 100644 src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js create mode 100644 src/Umbraco.Web.UI.Client/src/views/content/sort.html diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js new file mode 100644 index 0000000000..7f980cae1a --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -0,0 +1,78 @@ +(function () { + "use strict"; + + function ContentSortController($scope, $timeout) { + + var vm = this; + + vm.loading = false; + vm.nodes = []; + vm.saveButtonState = "init"; + vm.sortableOptions = { + distance: 10, + tolerance: "pointer", + opacity: 0.7, + scroll: true, + cursor: "move", + helper: fixSortableHelper + }; + + vm.save = save; + + + function activate() { + + vm.loading = true; + + // fake loading + $timeout(function () { + + vm.loading = false; + + vm.nodes = [ + { + "name": "Node 1", + "creationDate": "date", + "sortOrder": 0 + }, + { + "name": "Node 2", + "creationDate": "date", + "sortOrder": 1 + }, + { + "name": "Node 3", + "creationDate": "date", + "sortOrder": 2 + } + ]; + + }, 1000); + } + + function save() { + + console.log(vm.nodes); + vm.saveButtonState = "busy"; + + // fake loading + $timeout(function () { + vm.saveButtonState = "success"; + }, 1000); + + } + + function fixSortableHelper(e, ui) { + // keep the correct width of each table cell when sorting + ui.children().each(function () { + $(this).width($(this).width()); + }); + return ui; + } + + activate(); + + } + + angular.module("umbraco").controller("Umbraco.Editors.Content.SortController", ContentSortController); +})(); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/content/sort.html b/src/Umbraco.Web.UI.Client/src/views/content/sort.html new file mode 100644 index 0000000000..f680d64560 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/content/sort.html @@ -0,0 +1,54 @@ +
+ + + + + +
+ \ No newline at end of file diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index d416a2ee0f..e80867aadf 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -117,7 +117,7 @@ namespace Umbraco.Web.Trees //these two are the standard items menu.Items.Add(Services.TextService.Localize("actions", ActionNew.Instance.Alias)); - menu.Items.Add(Services.TextService.Localize("actions", ActionSort.Instance.Alias), true).ConvertLegacyMenuItem(null, "content", "content"); + menu.Items.Add(Services.TextService.Localize("actions", ActionSort.Instance.Alias), true); //filter the standard items FilterUserAllowedMenuItems(menu, nodeActions); @@ -228,7 +228,7 @@ namespace Umbraco.Web.Trees AddActionNode(item, menu); AddActionNode(item, menu, convert: true); - AddActionNode(item, menu, true, true); + AddActionNode(item, menu, true); AddActionNode(item, menu, convert: true); AddActionNode(item, menu, convert: true); diff --git a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs b/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs index 410c74c0dc..9aec48825d 100644 --- a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs +++ b/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs @@ -216,12 +216,6 @@ namespace Umbraco.Web.Trees new LegacyUrlAction( "createFolder.aspx?nodeId=" + nodeId + "&nodeType=" + nodeType + "&nodeName=" + nodeName + "&rnd=" + DateTime.UtcNow.Ticks, Current.Services.TextService.Localize("actions/create"))); - case "UmbClientMgr.appActions().actionSort()": - return Attempt.Succeed( - new LegacyUrlAction( - "dialogs/sort.aspx?id=" + nodeId + "&nodeType=" + nodeType + "&app=" + currentSection + "&rnd=" + DateTime.UtcNow.Ticks, - Current.Services.TextService.Localize("actions/sort"))); - case "UmbClientMgr.appActions().actionProtect()": return Attempt.Succeed( new LegacyUrlAction( diff --git a/src/Umbraco.Web/Trees/MediaTreeController.cs b/src/Umbraco.Web/Trees/MediaTreeController.cs index 4c3453e5de..53f1b0a97e 100644 --- a/src/Umbraco.Web/Trees/MediaTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTreeController.cs @@ -96,7 +96,7 @@ namespace Umbraco.Web.Trees // root actions menu.Items.Add(Services.TextService.Localize("actions", ActionNew.Instance.Alias)); - menu.Items.Add(Services.TextService.Localize("actions", ActionSort.Instance.Alias), true).ConvertLegacyMenuItem(null, "media", "media"); + menu.Items.Add(Services.TextService.Localize("actions", ActionSort.Instance.Alias), true); menu.Items.Add(Services.TextService.Localize("actions", ActionRefresh.Instance.Alias), true); return menu; } @@ -125,7 +125,7 @@ namespace Umbraco.Web.Trees menu.Items.Add(Services.TextService.Localize("actions", ActionNew.Instance.Alias)); menu.Items.Add(Services.TextService.Localize("actions", ActionMove.Instance.Alias)); menu.Items.Add(Services.TextService.Localize("actions", ActionDelete.Instance.Alias)); - menu.Items.Add(Services.TextService.Localize("actions", ActionSort.Instance.Alias)).ConvertLegacyMenuItem(item, "media", "media"); + menu.Items.Add(Services.TextService.Localize("actions", ActionSort.Instance.Alias)); menu.Items.Add(Services.TextService.Localize("actions", ActionRefresh.Instance.Alias), true); //if the media item is in the recycle bin, don't have a default menu, just show the regular menu diff --git a/src/Umbraco.Web/_Legacy/Actions/ActionSort.cs b/src/Umbraco.Web/_Legacy/Actions/ActionSort.cs index cd118a523c..b813dcbc8c 100644 --- a/src/Umbraco.Web/_Legacy/Actions/ActionSort.cs +++ b/src/Umbraco.Web/_Legacy/Actions/ActionSort.cs @@ -36,7 +36,7 @@ namespace Umbraco.Web._Legacy.Actions { get { - return string.Format("{0}.actionSort()", ClientTools.Scripts.GetAppActions); + return null; } } From fee48e9deec9d6dc04968a128210f1935646bb91 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 2 Aug 2018 14:06:05 +0100 Subject: [PATCH 30/51] To get the build to work - need to push these commented out classes for now that reference MenuButton (I think EditMacro, EditPackage & EditDictionaryItem) are no longer loaded this way AFAIK but I need to check --- .../developer/Macros/EditMacro.aspx.cs | 10 ++++----- .../developer/Packages/editPackage.aspx.cs | 22 +++++++++---------- .../settings/EditDictionaryItem.aspx.cs | 12 +++++----- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/Umbraco.Web.UI/Umbraco/developer/Macros/EditMacro.aspx.cs b/src/Umbraco.Web.UI/Umbraco/developer/Macros/EditMacro.aspx.cs index 744b36720c..1379e1003b 100644 --- a/src/Umbraco.Web.UI/Umbraco/developer/Macros/EditMacro.aspx.cs +++ b/src/Umbraco.Web.UI/Umbraco/developer/Macros/EditMacro.aspx.cs @@ -217,11 +217,11 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Macros Parameters = TabView1.NewTabPage("Parameters"); Parameters.Controls.Add(Panel2); - var save = TabView1.Menu.NewButton(); - save.ButtonType = MenuButtonType.Primary; - save.Text = Services.TextService.Localize("save"); - save.ID = "save"; - save.Click += Save_Click; + //var save = TabView1.Menu.NewButton(); + //save.ButtonType = MenuButtonType.Primary; + //save.Text = Services.TextService.Localize("save"); + //save.ID = "save"; + //save.Click += Save_Click; } void Save_Click(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs index e498d3326b..676f272e5b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs @@ -427,18 +427,18 @@ namespace umbraco.presentation.developer.packages packageActions = TabView1.NewTabPage("Package Actions"); packageActions.Controls.Add(Pane4); - var pubs = TabView1.Menu.NewButton(); - pubs.Text = Services.TextService.Localize("publish"); - pubs.CommandName = "publish"; - pubs.Command += new CommandEventHandler(saveOrPublish); - pubs.ID = "saveAndPublish"; + //var pubs = TabView1.Menu.NewButton(); + //pubs.Text = Services.TextService.Localize("publish"); + //pubs.CommandName = "publish"; + //pubs.Command += new CommandEventHandler(saveOrPublish); + //pubs.ID = "saveAndPublish"; - var saves = TabView1.Menu.NewButton(); - saves.Text = Services.TextService.Localize("save"); - saves.CommandName = "save"; - saves.Command += new CommandEventHandler(saveOrPublish); - saves.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; - saves.ID = "save"; + //var saves = TabView1.Menu.NewButton(); + //saves.Text = Services.TextService.Localize("save"); + //saves.CommandName = "save"; + //saves.Command += new CommandEventHandler(saveOrPublish); + //saves.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; + //saves.ID = "save"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index 76ee437bb3..79d6475473 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -35,12 +35,12 @@ namespace umbraco.settings Panel1.hasMenu = true; Panel1.Text = Services.TextService.Localize("editdictionary") + ": " + currentItem.ItemKey; - var save = Panel1.Menu.NewButton(); - save.Text = Services.TextService.Localize("save"); - save.Click += save_Click; - save.ToolTip = Services.TextService.Localize("save"); - save.ID = "save"; - save.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; + //var save = Panel1.Menu.NewButton(); + //save.Text = Services.TextService.Localize("save"); + //save.Click += save_Click; + //save.ToolTip = Services.TextService.Localize("save"); + //save.ID = "save"; + //save.ButtonType = Umbraco.Web._Legacy.Controls.MenuButtonType.Primary; var p = new Umbraco.Web._Legacy.Controls.Pane(); From 67b348df92308c7d2b7bcc888ab7701b0767a0d2 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 2 Aug 2018 14:25:46 +0100 Subject: [PATCH 31/51] Adds in new API endpoint in Content Editor - GetContentSortOrder (same logic & SortNode class from the WebService) - this may need to change depending on JSON structure required --- src/Umbraco.Web/Editors/ContentController.cs | 33 +++++++++++++++++-- .../Models/ContentEditing/SortNode.cs | 26 +++++++++++++++ src/Umbraco.Web/Umbraco.Web.csproj | 1 + 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 src/Umbraco.Web/Models/ContentEditing/SortNode.cs diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index 7b5b728e7d..de2481f090 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -25,12 +25,10 @@ using Umbraco.Core.Persistence.Querying; using Umbraco.Web.PublishedCache; using Umbraco.Core.Events; using Umbraco.Core.Models.Validation; -using Umbraco.Web.Models; -using Umbraco.Web.WebServices; using Umbraco.Web._Legacy.Actions; using Constants = Umbraco.Core.Constants; -using ContentVariation = Umbraco.Core.Models.ContentVariation; using Language = Umbraco.Web.Models.ContentEditing.Language; +using SortNode = Umbraco.Web.Models.ContentEditing.SortNode; namespace Umbraco.Web.Editors { @@ -957,6 +955,35 @@ namespace Umbraco.Web.Editors return Request.CreateNotificationSuccessResponse(Services.TextService.Localize("defaultdialogs/recycleBinIsEmpty")); } + /// + /// Gets child nodes of the current node (parentId) to be sorted + /// + /// The current node in which to sort its children + /// + [HttpGet] + public SortNode GetContentSortOrder(int parentId) + { + var nodes = new List(); + var parent = new SortNode { Id = parentId }; + + var entityService = Services.EntityService; + + // Root node + if (parentId == -1) + { + var rootContent = entityService.GetRootEntities(UmbracoObjectTypes.Document); + nodes.AddRange(rootContent.Select(content => new SortNode(content.Id, content.SortOrder, content.Name, content.CreateDate))); + } + else + { + var children = entityService.GetChildren(parentId); + nodes.AddRange(children.Select(child => new SortNode(child.Id, child.SortOrder, child.Name, child.CreateDate))); + } + + parent.SortNodes = nodes.ToArray(); + return parent; + } + /// /// Change the sort order for content /// diff --git a/src/Umbraco.Web/Models/ContentEditing/SortNode.cs b/src/Umbraco.Web/Models/ContentEditing/SortNode.cs new file mode 100644 index 0000000000..8b53d38808 --- /dev/null +++ b/src/Umbraco.Web/Models/ContentEditing/SortNode.cs @@ -0,0 +1,26 @@ +using System; + +namespace Umbraco.Web.Models.ContentEditing +{ + [Serializable] + public class SortNode + { + public int Id { get; set; } + public int SortOrder { get; set; } + public string Name { get; set; } + public DateTime CreateDate { get; set; } + public SortNode[] SortNodes { get; set; } + + public SortNode() + { + } + + public SortNode(int id, int sortOrder, string name, DateTime createDate) + { + Id = Id; + SortOrder = sortOrder; + Name = name; + CreateDate = createDate; + } + } +} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 427c7fdd66..20dca7ee54 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -226,6 +226,7 @@ + From 043437b7259d09264e69d7508046b6de88b79fda Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 2 Aug 2018 14:45:31 +0100 Subject: [PATCH 32/51] Revert "Adds in new API endpoint in Content Editor - GetContentSortOrder (same logic & SortNode class from the WebService) - this may need to change depending on JSON structure required" This reverts commit 67b348df92308c7d2b7bcc888ab7701b0767a0d2. --- src/Umbraco.Web/Editors/ContentController.cs | 33 ++----------------- .../Models/ContentEditing/SortNode.cs | 26 --------------- src/Umbraco.Web/Umbraco.Web.csproj | 1 - 3 files changed, 3 insertions(+), 57 deletions(-) delete mode 100644 src/Umbraco.Web/Models/ContentEditing/SortNode.cs diff --git a/src/Umbraco.Web/Editors/ContentController.cs b/src/Umbraco.Web/Editors/ContentController.cs index de2481f090..7b5b728e7d 100644 --- a/src/Umbraco.Web/Editors/ContentController.cs +++ b/src/Umbraco.Web/Editors/ContentController.cs @@ -25,10 +25,12 @@ using Umbraco.Core.Persistence.Querying; using Umbraco.Web.PublishedCache; using Umbraco.Core.Events; using Umbraco.Core.Models.Validation; +using Umbraco.Web.Models; +using Umbraco.Web.WebServices; using Umbraco.Web._Legacy.Actions; using Constants = Umbraco.Core.Constants; +using ContentVariation = Umbraco.Core.Models.ContentVariation; using Language = Umbraco.Web.Models.ContentEditing.Language; -using SortNode = Umbraco.Web.Models.ContentEditing.SortNode; namespace Umbraco.Web.Editors { @@ -955,35 +957,6 @@ namespace Umbraco.Web.Editors return Request.CreateNotificationSuccessResponse(Services.TextService.Localize("defaultdialogs/recycleBinIsEmpty")); } - /// - /// Gets child nodes of the current node (parentId) to be sorted - /// - /// The current node in which to sort its children - /// - [HttpGet] - public SortNode GetContentSortOrder(int parentId) - { - var nodes = new List(); - var parent = new SortNode { Id = parentId }; - - var entityService = Services.EntityService; - - // Root node - if (parentId == -1) - { - var rootContent = entityService.GetRootEntities(UmbracoObjectTypes.Document); - nodes.AddRange(rootContent.Select(content => new SortNode(content.Id, content.SortOrder, content.Name, content.CreateDate))); - } - else - { - var children = entityService.GetChildren(parentId); - nodes.AddRange(children.Select(child => new SortNode(child.Id, child.SortOrder, child.Name, child.CreateDate))); - } - - parent.SortNodes = nodes.ToArray(); - return parent; - } - /// /// Change the sort order for content /// diff --git a/src/Umbraco.Web/Models/ContentEditing/SortNode.cs b/src/Umbraco.Web/Models/ContentEditing/SortNode.cs deleted file mode 100644 index 8b53d38808..0000000000 --- a/src/Umbraco.Web/Models/ContentEditing/SortNode.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; - -namespace Umbraco.Web.Models.ContentEditing -{ - [Serializable] - public class SortNode - { - public int Id { get; set; } - public int SortOrder { get; set; } - public string Name { get; set; } - public DateTime CreateDate { get; set; } - public SortNode[] SortNodes { get; set; } - - public SortNode() - { - } - - public SortNode(int id, int sortOrder, string name, DateTime createDate) - { - Id = Id; - SortOrder = sortOrder; - Name = name; - CreateDate = createDate; - } - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 20dca7ee54..427c7fdd66 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -226,7 +226,6 @@ - From 0ea7bdfe7b31685691976046a857138f82b72a87 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 2 Aug 2018 15:51:41 +0200 Subject: [PATCH 33/51] get children for sort dialog --- .../views/content/content.sort.controller.js | 40 +++++-------------- .../src/views/content/sort.html | 16 ++++---- 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js index 7f980cae1a..03921a263e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -1,12 +1,13 @@ (function () { "use strict"; - function ContentSortController($scope, $timeout) { + function ContentSortController($scope, $timeout, contentResource) { var vm = this; + var parentId = $scope.currentNode.parentId; vm.loading = false; - vm.nodes = []; + vm.children = []; vm.saveButtonState = "init"; vm.sortableOptions = { distance: 10, @@ -19,35 +20,16 @@ vm.save = save; - - function activate() { + function onInit() { vm.loading = true; - // fake loading - $timeout(function () { - - vm.loading = false; - - vm.nodes = [ - { - "name": "Node 1", - "creationDate": "date", - "sortOrder": 0 - }, - { - "name": "Node 2", - "creationDate": "date", - "sortOrder": 1 - }, - { - "name": "Node 3", - "creationDate": "date", - "sortOrder": 2 - } - ]; - - }, 1000); + contentResource.getChildren(parentId) + .then(function(data){ + vm.children = data.items; + vm.loading = false; + console.log(vm.children); + }); } function save() { @@ -70,7 +52,7 @@ return ui; } - activate(); + onInit(); } diff --git a/src/Umbraco.Web.UI.Client/src/views/content/sort.html b/src/Umbraco.Web.UI.Client/src/views/content/sort.html index f680d64560..8a13a5463b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/sort.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/sort.html @@ -15,16 +15,16 @@ - - - + + + - - - - - + + + + +
{{ node.name }}{{ node.creationDate }}{{ node.sortOrder }}
{{ child.name }}{{ child.createDate }}{{ child.sortOrder }}
From b0ca59b0abc3ba84ec032c63ec9f3fe0ce70d9d2 Mon Sep 17 00:00:00 2001 From: Warren Date: Thu, 2 Aug 2018 15:05:18 +0100 Subject: [PATCH 34/51] OLD sort dialog.aspx & its JS assets from umbraco_client have vanished into thin air --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 11 - .../Umbraco/dialogs/Sort.aspx.cs | 11 - .../Umbraco/dialogs/Sort.aspx.designer.cs | 33 --- src/Umbraco.Web.UI/Umbraco/dialogs/sort.aspx | 86 ------ .../umbraco_client/Dialogs/SortDialog.css | 58 ---- .../umbraco_client/Dialogs/SortDialog.js | 122 -------- src/Umbraco.Web/Umbraco.Web.csproj | 3 - .../umbraco/dialogs/sort.aspx.cs | 265 ------------------ 8 files changed, 589 deletions(-) delete mode 100644 src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.cs delete mode 100644 src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.designer.cs delete mode 100644 src/Umbraco.Web.UI/Umbraco/dialogs/sort.aspx delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.css delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.js delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 2f5ccf8bec..08d431fad6 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -180,14 +180,6 @@ ChangeDocType.aspx - - sort.aspx - ASPXCodeBehind - - - sort.aspx - ASPXCodeBehind - default.Master ASPXCodeBehind @@ -348,8 +340,6 @@ ASPXCodeBehind - - @@ -487,7 +477,6 @@ Form - diff --git a/src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.cs b/src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.cs deleted file mode 100644 index 11f155f047..0000000000 --- a/src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace Umbraco.Web.UI.Umbraco.Dialogs -{ - public partial class Sort : global::umbraco.cms.presentation.sort - { - } -} diff --git a/src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.designer.cs b/src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.designer.cs deleted file mode 100644 index fb4bea6b1a..0000000000 --- a/src/Umbraco.Web.UI/Umbraco/dialogs/Sort.aspx.designer.cs +++ /dev/null @@ -1,33 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Umbraco.Dialogs { - - - public partial class Sort { - - /// - /// CssInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; - - /// - /// JsInclude3 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude3; - } -} diff --git a/src/Umbraco.Web.UI/Umbraco/dialogs/sort.aspx b/src/Umbraco.Web.UI/Umbraco/dialogs/sort.aspx deleted file mode 100644 index f4200e113c..0000000000 --- a/src/Umbraco.Web.UI/Umbraco/dialogs/sort.aspx +++ /dev/null @@ -1,86 +0,0 @@ -<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" CodeBehind="sort.aspx.cs" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Dialogs.Sort" %> - -<%@ Import Namespace="System.Globalization" %> -<%@ Import Namespace="Umbraco.Core.IO" %> -<%@ Import Namespace="Umbraco.Web" %> -<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> -<%@ Register TagPrefix="cc1" Namespace="Umbraco.Web._Legacy.Controls" Assembly="Umbraco.Web" %> - - - - - - - - - - - -
- - - - - - -
-

- <%= Services.TextService.Localize("sort/sortHelp") %> -

- -
- - - - - - - - - - - -
<%= Services.TextService.Localize("general/name") %>;"><%= Services.TextService.Localize("sort/sortCreationDate") %><%= Services.TextService.Localize("sort/sortOrder") %>
-
-
-
- -
- - - - -
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.css b/src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.css deleted file mode 100644 index a562e4475e..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.css +++ /dev/null @@ -1,58 +0,0 @@ -#sortableFrame -{ - height: auto; - overflow: auto; -} - -#sortableNodes -{ - padding: 4px; - display: block; - border-spacing:0; - border-collapse:collapse; -} - - #sortableNodes thead tr th - { - border-bottom: 1px solid #ccc; - padding: 4px; - padding-right: 25px; - background-image: url(../tableSorting/img/bg.gif); - cursor: pointer; - font-weight: bold; - background-repeat: no-repeat; - background-position: center right; - } - - #sortableNodes thead tr th.headerSortDown - { - background-image: url(../tableSorting/img/desc.gif); - } - - #sortableNodes thead tr th.headerSortUp - { - background-image: url(../tableSorting/img/asc.gif); - } - - #sortableNodes tbody tr td - { - border-bottom: 1px solid #efefef; - } - - #sortableNodes td - { - padding: 4px; - cursor: move; - } - -tr.tDnD_whileDrag, tr.tDnD_whileDrag td -{ - background: #dcecf3; - border-color: #a8d8eb !Important; - margin-top: 20px; -} - -#sortableNodes .nowrap -{ - white-space: nowrap; -} diff --git a/src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.js b/src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.js deleted file mode 100644 index da5ae6d61e..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Dialogs/SortDialog.js +++ /dev/null @@ -1,122 +0,0 @@ -Umbraco.Sys.registerNamespace("Umbraco.Dialogs"); - -(function ($) { - - - Umbraco.Dialogs.SortDialog = base2.Base.extend({ - //private methods/variables - _opts: null, - - _setupTableSorter: function () { - //adds a custom sorter to the tablesorter based on the current cultures date/time format - $.tablesorter.addParser({ - // use a unique id - id: 'cultureDateParser', - is: function() { - //don't auto-detect this parser - return false; - }, - format: function(s, table) { - var c = table.config; - - s = s.replace(/\-/g, "/"); - //all of these basically transform the string into year-month-day since that - //is what JS understands when creating a Date object - if (c.dateFormat.indexOf("dd/MM/yyyy") == 0 || c.dateFormat.indexOf("dd-MM-yyyy") == 0 || c.dateFormat.indexOf("dd.MM.yyyy") == 0) { - s = s.replace(/(\d{1,2})[\/\-\.](\d{1,2})[\/\-\.](\d{4})/, "$3-$2-$1"); - } - else if (c.dateFormat.indexOf("dd/MM/yy") == 0 || c.dateFormat.indexOf("dd-MM-yy") == 0 || c.dateFormat.indexOf("dd.MM.yy") == 0) { - s = s.replace(/(\d{1,2})[\/\-\.](\d{1,2})[\/\-\.](\d{2})/, "$3-$2-$1"); - } - else if (c.dateFormat.indexOf("MM/dd/yyyy") == 0 || c.dateFormat.indexOf("MM-dd-yyyy") == 0) { - s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/, "$3-$1-$2"); - } - else if (c.dateFormat.indexOf("MM/dd/yy") == 0 || c.dateFormat.indexOf("MM-dd-yy") == 0) { - s = s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/, "$3-$1-$2"); - } - return $.tablesorter.formatFloat(new Date(s).getTime()); - }, - // set the type to either numeric or text (text uses a natural sort function - // so it will work for everything, but numeric is faster for numbers - type: 'numeric' - }); - }, - - _saveSort: function() { - var rows = $('#sortableNodes tbody tr'); - var sortOrder = ""; - - $.each(rows, function () { - sortOrder += $(this).attr("id").replace("node_", "") + ","; - }); - - $("#sortingDone").hide(); - $("#sortArea").hide(); - $("#loading").show(); - - var self = this; - - $.ajax({ - type: "POST", - url: self._opts.serviceUrl, - data: '{ "ParentId": "' + self._opts.currentId + '", "SortOrder": "' + sortOrder + '"}', - contentType: "application/json; charset=utf-8", - dataType: "json", - success: function(msg) { - self._showConfirm(); - } - }); - }, - - _showConfirm: function () { - $(".umb-dialog-footer").hide(); - $("#loading").hide(); - $("#sortingDone").show(); - UmbClientMgr.mainTree().reloadActionNode(); - }, - - // Constructor - constructor: function (opts) { - // Merge options with default - this._opts = $.extend({ - // Default options go here - }, opts); - - this._setupTableSorter(); - }, - - //public methods/variables - - init: function () { - var self = this; - - //create the sorter - $("#sortableNodes").tablesorter({ - dateFormat: self._opts.dateTimeFormat, - headers: { - 0: { sorter: "text" }, - 1: { sorter: "cultureDateParser" }, //ensure to set our custom parser here - 2: { sorter: "numeric" } - } - }); - - //setup the drag/drop sorting - $("#sortableNodes").tableDnD({ containment: $("#sortableFrame") }); - - //wire up the submit button - self._opts.submitButton.click(function() { - this.disabled = true; - self._saveSort(); - }); - - //wire up the close button - self._opts.closeWindowButton.click(function () { - UmbClientMgr.closeModalWindow(); - }); - }, - - }); - - - -})(jQuery); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 427c7fdd66..b1d950cc1f 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1130,9 +1130,6 @@ ASPXCodeBehind
- - ASPXCodeBehind - ASPXCodeBehind diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs deleted file mode 100644 index f85114aaec..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sort.aspx.cs +++ /dev/null @@ -1,265 +0,0 @@ -using System; -using System.Linq; -using Umbraco.Core; -using Umbraco.Core.Services; -using Umbraco.Web; -using System.Web.UI; -using System.Collections.Generic; -using Umbraco.Web.Composing; -using Umbraco.Web.UI.Pages; -using Umbraco.Core.Exceptions; -using Umbraco.Core.Models; -using Umbraco.Web._Legacy.Actions; - -namespace umbraco.cms.presentation -{ - /// - /// Summary description for sort. - /// - public partial class sort : UmbracoEnsuredPage - { - /// - /// The Parent Id being sorted - /// - protected int? ParentIdAsInt { get; private set; } - protected string ParentIdAsString { get; private set; } - - private readonly List _nodes = new List(); - - protected bool HideDateColumn - { - set { ViewState["HideDateColumn"] = value; } - get { return ViewState["HideDateColumn"] == null ? false : (bool) ViewState["HideDateColumn"]; } - } - - protected override void OnInit(EventArgs e) - { - CurrentApp = Request.GetItemAsString("app"); - - ParentIdAsString = Request.GetItemAsString("ID"); - int parentId; - if (int.TryParse(ParentIdAsString, out parentId)) - { - ParentIdAsInt = parentId; - - if (CurrentApp == Constants.Applications.Content || CurrentApp == Constants.Applications.Media) - { - CheckPathAndPermissions( - ParentIdAsInt.Value, - CurrentApp == Constants.Applications.Content ? UmbracoObjectTypes.Document : UmbracoObjectTypes.Media, - ActionSort.Instance); - } - } - - base.OnInit(e); - } - - protected void Page_Load(object sender, EventArgs e) - { - sortDone.Text = Services.TextService.Localize("sort/sortDone"); - } - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/nodesorter.asmx")); - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx")); - - var app = Request.GetItemAsString("app"); - - var icon = "../images/umbraco/doc.gif"; - - if (ParentIdAsInt.HasValue) - { - if (app == Constants.Applications.Media) - { - icon = "../images/umbraco/mediaPhoto.gif"; - var mediaService = Current.Services.MediaService; - - if (ParentIdAsInt.Value == -1) - { - foreach (var child in mediaService.GetRootMedia().ToList().OrderBy(x => x.SortOrder)) - _nodes.Add(CreateNode(child.Id.ToInvariantString(), child.SortOrder, child.Name, child.CreateDate, icon)); - } - else - { - var children = mediaService.GetChildren(ParentIdAsInt.Value); - foreach (var child in children.OrderBy(x => x.SortOrder)) - _nodes.Add(CreateNode(child.Id.ToInvariantString(), child.SortOrder, child.Name, child.CreateDate, icon)); - } - } - - if (app == Constants.Applications.Content) - { - var contentService = Current.Services.ContentService; - - if (ParentIdAsInt.Value == -1) - { - foreach (var child in contentService.GetRootContent().ToList().OrderBy(x => x.SortOrder)) - _nodes.Add(CreateNode(child.Id.ToInvariantString(), child.SortOrder, child.Name, child.CreateDate, icon)); - } - else - { - var children = contentService.GetChildren(ParentIdAsInt.Value); - foreach (var child in children) - _nodes.Add(CreateNode(child.Id.ToInvariantString(), child.SortOrder, child.Name, child.CreateDate, icon)); - } - } - - bindNodesToList(string.Empty); - } - else - { - // hack for stylesheet, used to sort stylesheet properties - if (app == Constants.Applications.Settings) - { - icon = "../images/umbraco/settingCss.gif"; - - HideDateColumn = true; - - var stylesheetName = ParentIdAsString; - if (stylesheetName.IsNullOrWhiteSpace())throw new NullReferenceException("No Id passed in to editor"); - var stylesheet = Services.FileService.GetStylesheetByName(stylesheetName.EnsureEndsWith(".css")); - if (stylesheet == null) throw new InvalidOperationException("No stylesheet found by name " + stylesheetName); - - var sort = 0; - foreach (var child in stylesheet.Properties) - { - _nodes.Add(CreateNode(child.Name, sort, child.Name, DateTime.Now, icon)); - sort++; - } - - bindNodesToList(string.Empty); - } - } - } - - public void bindNodesToList(string sortBy) - { - if (string.IsNullOrEmpty(sortBy) == false) - { - switch (sortBy) - { - case "nodeName": - _nodes.Sort(new nodeNameCompare()); - break; - case "createDate": - _nodes.Sort(new createDateCompare()); - break; - } - } - - foreach (var n in _nodes) - lt_nodes.Text += string.Format( - "{1}{2} {3}{4}", - n.id, n.Name, n.createDate.ToShortDateString(), n.createDate.ToShortTimeString(), n.sortOrder, HideDateColumn ? "none" : "table-cell"); - } - - private static SortableNode CreateNode(string id, int sortOrder, string name, DateTime createDateTime, string icon) - { - var node = new SortableNode - { - id = id, - sortOrder = sortOrder, - Name = name, - icon = icon, - createDate = createDateTime - }; - return node; - } - - public class SortableNode - { - public string id; - public int sortOrder; - public string Name; - public string icon; - public DateTime createDate; - } - - /// - /// JsInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; - - /// - /// JsInclude2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude2; - - /// - /// prog1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Umbraco.Web._Legacy.Controls.ProgressBar prog1; - - /// - /// sortDone control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal sortDone; - - /// - /// sortPane control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::Umbraco.Web._Legacy.Controls.Pane sortPane; - - /// - /// lt_nodes control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal lt_nodes; - - } - - public class nodeNameCompare : IComparer - { - - #region IComparer Members - - public int Compare(sort.SortableNode x, sort.SortableNode y) - { - var returnValue = String.Compare(x.Name, y.Name, StringComparison.Ordinal); - - return returnValue; - } - - #endregion - } - - public class createDateCompare : IComparer - { - - #region IComparer Members - - public int Compare(sort.SortableNode x, sort.SortableNode y) - { - var returnValue = x.createDate.CompareTo(y.createDate); - - return returnValue; - } - - #endregion - } -} From 2b25de4ae63ec6a6b9573f9d0862a7ddc6d70a15 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 2 Aug 2018 16:17:53 +0200 Subject: [PATCH 35/51] save sort order --- .../src/views/content/content.sort.controller.js | 16 +++++++--------- .../src/views/content/sort.html | 11 ++++++----- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js index 03921a263e..d92cb22d19 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -21,27 +21,25 @@ vm.save = save; function onInit() { - vm.loading = true; - contentResource.getChildren(parentId) .then(function(data){ vm.children = data.items; vm.loading = false; - console.log(vm.children); }); } function save() { - - console.log(vm.nodes); vm.saveButtonState = "busy"; + + var args = { + parentId: parentId, + sortedIds: _.map(vm.children, function(child){ return child.id; }) + }; - // fake loading - $timeout(function () { + contentResource.sort(args).then(function(){ vm.saveButtonState = "success"; - }, 1000); - + }); } function fixSortableHelper(e, ui) { diff --git a/src/Umbraco.Web.UI.Client/src/views/content/sort.html b/src/Umbraco.Web.UI.Client/src/views/content/sort.html index 8a13a5463b..244f9851a6 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/sort.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/sort.html @@ -36,10 +36,12 @@ From 3dff904264a4cf684415cf3ecc8403fa18008d50 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 2 Aug 2018 17:15:26 +0200 Subject: [PATCH 36/51] get children from the current node id and not the parent --- .../src/views/content/content.sort.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js index d92cb22d19..6858d16859 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -4,7 +4,7 @@ function ContentSortController($scope, $timeout, contentResource) { var vm = this; - var parentId = $scope.currentNode.parentId; + var id = $scope.currentNode.id; vm.loading = false; vm.children = []; @@ -22,7 +22,7 @@ function onInit() { vm.loading = true; - contentResource.getChildren(parentId) + contentResource.getChildren(id) .then(function(data){ vm.children = data.items; vm.loading = false; From 23c86ecc4a9dae5e448e4b6dc5a1287897080ff9 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 2 Aug 2018 17:37:29 +0200 Subject: [PATCH 37/51] forgot the parentId was still in use --- .../src/views/content/content.sort.controller.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js index 6858d16859..39b8d43e39 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -4,6 +4,7 @@ function ContentSortController($scope, $timeout, contentResource) { var vm = this; + var parentId = $scope.currentNode.parentId; var id = $scope.currentNode.id; vm.loading = false; From 1e5db346797a4b937341d6f761776ac155f4f999 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Thu, 2 Aug 2018 19:22:17 +0200 Subject: [PATCH 38/51] add empty state and error handling for save --- .../views/content/content.sort.controller.js | 13 ++++++++---- .../src/views/content/sort.html | 20 ++++++++++++++----- .../Umbraco/config/lang/en_us.xml | 1 + 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js index 39b8d43e39..a6cc09c16e 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -1,7 +1,7 @@ (function () { "use strict"; - function ContentSortController($scope, $timeout, contentResource) { + function ContentSortController($scope, $timeout, contentResource, navigationService) { var vm = this; var parentId = $scope.currentNode.parentId; @@ -38,9 +38,14 @@ sortedIds: _.map(vm.children, function(child){ return child.id; }) }; - contentResource.sort(args).then(function(){ - vm.saveButtonState = "success"; - }); + contentResource.sort(args) + .then(function(){ + navigationService.syncTree({ tree: "content", path: $scope.currentNode.path, forceReload: true, activate: false }); + vm.saveButtonState = "success"; + }).catch(function(error) { + vm.error = error; + vm.saveButtonState = "error"; + }); } function fixSortableHelper(e, ui) { diff --git a/src/Umbraco.Web.UI.Client/src/views/content/sort.html b/src/Umbraco.Web.UI.Client/src/views/content/sort.html index 244f9851a6..e189c2646a 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/sort.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/sort.html @@ -3,16 +3,20 @@ + + + + + + From 237fcbead69f93ef22a142bf2bae9ff5597d2573 Mon Sep 17 00:00:00 2001 From: Warren Date: Fri, 3 Aug 2018 09:25:33 +0100 Subject: [PATCH 43/51] Last of the umbraco_client files removed --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 3 - .../Application/NamespaceManager.js | 17 - .../Application/UmbracoApplicationActions.js | 366 ------------------ .../Application/UmbracoUtils.js | 11 - .../UI/Bundles/JsApplicationLib.cs | 18 - .../UI/Bundles/JsUmbracoApplicationCore.cs | 13 - src/Umbraco.Web/Umbraco.Web.csproj | 2 - .../_Legacy/Controls/BaseTreePicker.cs | 14 +- .../controls/Tree/CustomTreeControl.cs | 3 - 9 files changed, 1 insertion(+), 446 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/NamespaceManager.js delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js delete mode 100644 src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js delete mode 100644 src/Umbraco.Web/UI/Bundles/JsApplicationLib.cs delete mode 100644 src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 5c3403d0c0..e72fa9874f 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -357,9 +357,6 @@ - - - diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/NamespaceManager.js b/src/Umbraco.Web.UI/umbraco_client/Application/NamespaceManager.js deleted file mode 100644 index 9d4b86b2ba..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/NamespaceManager.js +++ /dev/null @@ -1,17 +0,0 @@ -if (typeof Umbraco == 'undefined') var Umbraco = {}; -if (!Umbraco.Sys) Umbraco.Sys = {}; - -Umbraco.Sys.registerNamespace = function(namespace) { - /// - /// Used to easily register namespaces for classes without doing the syntax listed on line 1/2 for each class. - /// Pretty much the same as ASP.NET's Type.registerNamespace, except in order to use it, you must register - /// all of your scripts with ScriptManager, this class doesn't require this. - /// - namespace = namespace.split('.'); - if (!window[namespace[0]]) window[namespace[0]] = {}; - var strFullNamespace = namespace[0]; - for (var i = 1; i < namespace.length; i++) { - strFullNamespace += "." + namespace[i]; - eval("if(!window." + strFullNamespace + ")window." + strFullNamespace + "={};"); - } -}; \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js deleted file mode 100644 index 6280b19554..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoApplicationActions.js +++ /dev/null @@ -1,366 +0,0 @@ -Umbraco.Sys.registerNamespace("Umbraco.Application"); - -Umbraco.Application.Actions = function() { - /// - /// Application actions actions for the context menu, help dialogs, logout, etc... - /// This class supports an event listener model. Currently the available events are: - /// "nodeDeleting","nodeDeleted","nodeRefresh" - /// - - return { - _utils: Umbraco.Utils, //alias to Umbraco Utils - _dialogWindow: null, - /// A reference to a dialog window to open, any action that doesn't open in an overlay, opens in a dialog - _isDebug: false, //set to true to enable alert debugging - _windowTitle: " - Umbraco CMS - ", - _currApp: "", - _isSaving: "", - - addEventHandler: function(fnName, fn) { - /// Adds an event listener to the event name event - if (typeof(jQuery) != "undefined") jQuery(window.top).bind(fnName, fn); //if there's no jQuery, there is no events - }, - - removeEventHandler: function(fnName, fn) { - /// Removes an event listener to the event name event - if (typeof(jQuery) != "undefined") jQuery(window.top).unbind(fnName, fn); //if there's no jQuery, there is no events - }, - - showSpeachBubble: function(ico, hdr, msg) { - if (typeof(UmbClientMgr.mainWindow().UmbSpeechBubble) != "undefined") { - UmbClientMgr.mainWindow().UmbSpeechBubble.ShowMessage(ico, hdr, msg); - } - else alert(msg); - }, - - launchCreateWizard: function() { - /// Launches the create content wizard - - if (this._currApp == 'media' || this._currApp == 'content' || this._currApp == '') { - if (this._currApp == '') { - this._currApp = 'content'; - } - - UmbClientMgr.openModalWindow("dialogs/create.aspx?nodeType=" + this._currApp + "&app=" + this._currApp + "&rnd=" + this._utils.generateRandom(), UmbClientMgr.uiKeys()['actions_create'] + " " + this._currApp, true, 620, 470); - return false; - - } - else - alert('Not supported - please create by right clicking the parentnode and choose new...'); - }, - - logout: function(t) { - - if (!t) { - throw "The security token must be set in order to log a user out using this method"; - } - - if (confirm(UmbClientMgr.uiKeys()["defaultdialogs_confirmlogout"])) { - //raise beforeLogout event - jQuery(window.top).trigger("beforeLogout", []); - - document.location.href = 'logout.aspx?t=' + t; - } - return false; - }, - - submitDefaultWindow: function() { - - if (!this._isSaving) { - this._isSaving = true; - - //v6 way - var link = jQuery(".btn[id*=save]:first, .editorIcon[id*=save]:first, .editorIcon:input:image[id*=Save]:first"); - - //this is made of bad, to work around webforms horrible wiring - if(!link.hasClass("client-side") && link.attr("href").indexOf("javascript:") == 0){ - eval(link.attr('href').replace('javascript:','')); - }else{ - link.click(); - } - } - this._isSaving = false; - return false; - }, - - bindSaveShortCut: function () { - - var keys = "ctrl+s"; - if (navigator.platform.toUpperCase().indexOf('MAC') >= 0) { - keys = "meta+s"; - } - - jQuery(document).bind('keydown', keys, function (evt) { UmbClientMgr.appActions().submitDefaultWindow(); return false; }); - jQuery(":input").bind('keydown', keys, function (evt) { UmbClientMgr.appActions().submitDefaultWindow(); return false; }); - }, - - shiftApp: function (whichApp, appName) { - /// Changes the application - - this._debug("shiftApp: " + whichApp + ", " + appName); - - UmbClientMgr.mainTree().saveTreeState(this._currApp == "" ? "content" : this._currApp); - - this._currApp = whichApp.toLowerCase(); - - if (this._currApp != 'media' && this._currApp != 'content' && this._currApp != 'member') { - jQuery("#buttonCreate").attr("disabled", "true").fadeOut(400); - jQuery("#FindDocuments .umbracoSearchHolder").fadeOut(400); - } - else { - // create button should still remain disabled for the memebers section - if (this._currApp == 'member') { - jQuery("#buttonCreate").attr("disabled", "true").css("display", "inline-block").css("visibility", "hidden"); - } - else { - jQuery("#buttonCreate").removeAttr("disabled").fadeIn(500).css("visibility", "visible"); - } - jQuery("#FindDocuments .umbracoSearchHolder").fadeIn(500); - //need to set the recycle bin node id based on app - switch (this._currApp) { - case ("media"): - UmbClientMgr.mainTree().setRecycleBinNodeId(-21); - break; - case ("content"): - UmbClientMgr.mainTree().setRecycleBinNodeId(-20); - break; - } - } - - UmbClientMgr.mainTree().rebuildTree(whichApp, function(args) { - //the callback will fire when the tree rebuilding is done, we - //need to check the args to see if the tree was rebuild from cache - //and if it had a previously selected node, if it didn't then load the dashboard. - if (!args) { - UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp); - } - }); - - jQuery("#treeWindowLabel").html(appName); - - UmbClientMgr.mainWindow().document.title = appName + this._windowTitle + window.location.hostname.toLowerCase().replace('www', ''); - }, - - getCurrApp: function() { - return this._currApp; - }, - - - //TODO: Move this into a window manager class - openDialog: function(diaTitle, diaDoc, dwidth, dheight, optionalParams) { - /// Opens the dialog window - - if (this._dialogWindow != null && !this._dialogWindow.closed) { - this._dialogWindow.close(); - } - this._dialogWindow = UmbClientMgr.mainWindow().open(diaDoc, 'dialogpage', "width=" + dwidth + "px,height=" + dheight + "px" + optionalParams); - }, - - openDashboard: function(whichApp) { - UmbClientMgr.contentFrame('dashboard.aspx?app=' + whichApp); - }, - - actionTreeEditMode: function() { - /// - UmbClientMgr.mainTree().toggleEditMode(true); - }, - - actionSort: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/sort.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&app=' + this._currApp + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_sort'], true, 600, 450); - } - - }, - - actionChangeDocType: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '0' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/changeDocType.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&app=' + this._currApp + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_changeDocType'], true, 600, 600); - } - - }, - - actionProtect: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/protectPage.aspx?mode=cut&nodeId=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_protect'], true, 535, 480); - } - }, - - actionRollback: function() { - /// - - UmbClientMgr.openModalWindow('dialogs/rollback.aspx?nodeId=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_rollback'], true, 600, 550); - }, - - actionRefresh: function() { - /// - - //raise nodeRefresh event - jQuery(window.top).trigger("nodeRefresh", []); - }, - - actionNotify: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/notifications.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_notify'], true, 300, 480); - } - }, - - actionUpdate: function() { - /// - }, - - actionPublish: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '' != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/publish.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId, uiKeys['actions_publish'], true, 540, 280); - } - }, - - actionToPublish: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - if (confirm(uiKeys['defaultdialogs_confirmSure'] + '\n\n')) { - UmbClientMgr.openModalWindow('dialogs/SendPublish.aspx?id=' + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_sendtopublish'], true, 300, 200); - } - } - }, - - actionQuit: function(t) { - - if (!t) { - throw "The security token must be set in order to log a user out using this method"; - } - - if (confirm(uiKeys['defaultdialogs_confirmlogout'] + '\n\n')) - document.location.href = 'logout.aspx?t=' + t; - }, - - actionRePublish: function() { - /// - - UmbClientMgr.openModalWindow('dialogs/republish.aspx?rnd=' + this._utils.generateRandom(), uiKeys['actions_republish'], true, 450, 210); - }, - - actionAssignDomain: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/assignDomain2.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId, uiKeys['actions_assignDomain'], true, 500, 620); - } - }, - - actionNew: function() { - /// Show the create new modal overlay - var actionNode = UmbClientMgr.mainTree().getActionNode(); - if (actionNode.nodeType != '') { - if (actionNode.nodeType == "content") { - UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 600, 425); - } - else if (actionNode.nodeType == "initmember") { - UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 480, 380); - } - else if (actionNode.nodeType == "users") { - UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 480, 380); - } - else { - UmbClientMgr.openModalWindow("create.aspx?nodeId=" + actionNode.nodeId + "&nodeType=" + actionNode.nodeType + "&nodeName=" + actionNode.nodeName + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_create'], true, 420, 270); - } - } - }, - - actionNewFolder: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeType != '') { - this.openDialog("Opret", "createFolder.aspx?nodeId=" + UmbClientMgr.mainTree().getActionNode().nodeId + "&nodeType=" + UmbClientMgr.mainTree().getActionNode().nodeType + "&nodeName=" + nodeName + '&rnd=' + this._utils.generateRandom(), 320, 225); - } - }, - - actionSendToTranslate: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeId != '-1' && UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/sendToTranslation.aspx?id=" + UmbClientMgr.mainTree().getActionNode().nodeId + '&rnd=' + this._utils.generateRandom(), uiKeys['actions_sendToTranslate'], true, 500, 470); - } - }, - - - actionImport: function() { - /// - - if (UmbClientMgr.mainTree().getActionNode().nodeType != '') { - UmbClientMgr.openModalWindow("dialogs/importDocumentType.aspx?rnd=" + this._utils.generateRandom(), uiKeys['actions_importDocumentType'], true, 460, 400); - } - }, - - actionPackage: function() { - /// - }, - - actionDelete: function() { - /// - - var actionNode = UmbClientMgr.mainTree().getActionNode(); - if (UmbClientMgr.mainTree().getActionNode().nodeType == "content" && UmbClientMgr.mainTree().getActionNode().nodeId == '-1') - return; - - this._debug("actionDelete"); - - // tg: quick workaround for the are you sure you want to delete 'null' confirm message happening when deleting xslt files - currrentNodeName = UmbClientMgr.mainTree().getActionNode().nodeName; - if (currrentNodeName == null || currrentNodeName == "null") { - currrentNodeName = UmbClientMgr.mainTree().getActionNode().nodeId; - } - - if (confirm(uiKeys['defaultdialogs_confirmdelete'] + ' "' + currrentNodeName + '"?\n\n')) { - //raise nodeDeleting event - jQuery(window.top).trigger("nodeDeleting", []); - var _this = this; - - //check if it's in the recycle bin - if (actionNode.jsNode.closest("li[id='-20']").length == 1 || actionNode.jsNode.closest("li[id='-21']").length == 1) { - umbraco.presentation.webservices.legacyAjaxCalls.DeleteContentPermanently( - UmbClientMgr.mainTree().getActionNode().nodeId, - UmbClientMgr.mainTree().getActionNode().nodeType, - function() { - _this._debug("actionDelete: Raising event"); - //raise nodeDeleted event - jQuery(window.top).trigger("nodeDeleted", []); - }); - } - else { - umbraco.presentation.webservices.legacyAjaxCalls.Delete( - UmbClientMgr.mainTree().getActionNode().nodeId, - UmbClientMgr.mainTree().getActionNode().nodeName, - UmbClientMgr.mainTree().getActionNode().nodeType, - function() { - _this._debug("actionDelete: Raising event"); - //raise nodeDeleted event - jQuery(window.top).trigger("nodeDeleted", []); - }, - function(error) { - _this._debug("actionDelete: Raising public error event"); - //raise public error event - jQuery(window.top).trigger("publicError", [error]); - }); - } - } - - }, - - _debug: function(strMsg) { - if (this._isDebug) { - Sys.Debug.trace("AppActions: " + strMsg); - } - } - }; -}; diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js deleted file mode 100644 index 1435f27cce..0000000000 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoUtils.js +++ /dev/null @@ -1,11 +0,0 @@ -/// - -Umbraco.Sys.registerNamespace("Umbraco.Utils"); - -Umbraco.Utils.generateRandom = function() { - /// Returns a random integer for use with URLs - var day = new Date(); - var z = day.getTime(); - var y = (z - (parseInt(z / 1000, 10) * 1000)) / 10; - return y; -} diff --git a/src/Umbraco.Web/UI/Bundles/JsApplicationLib.cs b/src/Umbraco.Web/UI/Bundles/JsApplicationLib.cs deleted file mode 100644 index 7ba6e14567..0000000000 --- a/src/Umbraco.Web/UI/Bundles/JsApplicationLib.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web.UI; -using ClientDependency.Core; - -namespace Umbraco.Web.UI.Bundles -{ - /// - /// The core libs that have no dependencies - /// - [ClientDependency(ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient", Priority = 0, Group = 0)] - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient", Priority = 1, Group = 0)] - public class JsApplicationLib : Control - { - } -} diff --git a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs b/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs deleted file mode 100644 index 712f6e6a1d..0000000000 --- a/src/Umbraco.Web/UI/Bundles/JsUmbracoApplicationCore.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.Web.UI; -using ClientDependency.Core; - -namespace Umbraco.Web.UI.Bundles -{ - /// - /// The core libs that require JQuery to be loaded - /// - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient", Priority = 1, Group = 2)] - public class JsUmbracoApplicationCore : Control - { - } -} diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index b1d950cc1f..e981d5aa25 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -959,9 +959,7 @@ - - diff --git a/src/Umbraco.Web/_Legacy/Controls/BaseTreePicker.cs b/src/Umbraco.Web/_Legacy/Controls/BaseTreePicker.cs index 7de4b9d4e0..d0ff91dc8c 100644 --- a/src/Umbraco.Web/_Legacy/Controls/BaseTreePicker.cs +++ b/src/Umbraco.Web/_Legacy/Controls/BaseTreePicker.cs @@ -1,24 +1,12 @@ using System; -using System.Web.UI; -using ClientDependency.Core; -using ClientDependency.Core.Controls; +using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; -using umbraco.cms.businesslogic; -using Umbraco.Core; using Umbraco.Core.Composing; using Umbraco.Core.Services; namespace Umbraco.Web._Legacy.Controls { - - /* - [ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Css, "modal/style.css", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "modal/modal.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoClientManager.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")]*/ - [ValidationProperty("Value")] public abstract class BaseTreePicker : Control, INamingContainer { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs index 783044ac75..12b056fedd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs @@ -17,9 +17,6 @@ namespace umbraco.controls.Tree /// Since we're inheriting from a UserControl and all of the ClientDependency registrations are done inline, we need /// to re-register the ClientDependencies. /// - [ClientDependency(0, ClientDependencyType.Javascript, "Application/NamespaceManager.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoApplicationActions.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "Application/UmbracoUtils.js", "UmbracoClient")] [ClientDependency(11, ClientDependencyType.Javascript, "Tree/jquery.tree.js", "UmbracoClient")] [ClientDependency(12, ClientDependencyType.Javascript, "Tree/UmbracoContext.js", "UmbracoClient")] [ClientDependency(12, ClientDependencyType.Javascript, "Tree/jquery.tree.contextmenu.js", "UmbracoClient")] From 85938e5432160b87821626477c1113cd046b2fe9 Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 3 Aug 2018 10:52:09 +0200 Subject: [PATCH 44/51] fix sorting of root nodes --- .../src/views/content/content.sort.controller.js | 4 ++-- .../src/views/media/media.sort.controller.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js index 0f4d73cbdb..d28ba32686 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -47,9 +47,9 @@ contentResource.sort(args) .then(function(){ - navigationService.syncTree({ tree: "content", path: $scope.currentNode.path, forceReload: true, activate: false }); + // navigationService.syncTree({ tree: "content", path: $scope.currentNode.path, forceReload: true, activate: false }); vm.saveButtonState = "success"; - }).catch(function(error) { + }, function(error) { vm.error = error; vm.saveButtonState = "error"; }); diff --git a/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js index 7b2598c9b4..00758ca0f1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js @@ -47,9 +47,9 @@ mediaResource.sort(args) .then(function(){ - navigationService.syncTree({ tree: "media", path: $scope.currentNode.path, forceReload: true, activate: false }); + // navigationService.syncTree({ tree: "media", path: $scope.currentNode.path, forceReload: true, activate: false }); vm.saveButtonState = "success"; - }).catch(function(error) { + }, function(error) { vm.error = error; vm.saveButtonState = "error"; }); From 41f5d7d113833a122a524c545669b6a5404fcfcf Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Fri, 3 Aug 2018 11:17:48 +0200 Subject: [PATCH 45/51] This treeSync code doesn't work and I don't know why --- .../src/views/content/content.sort.controller.js | 2 +- .../src/views/media/media.sort.controller.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js index d28ba32686..4581b78c8c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.sort.controller.js @@ -47,7 +47,7 @@ contentResource.sort(args) .then(function(){ - // navigationService.syncTree({ tree: "content", path: $scope.currentNode.path, forceReload: true, activate: false }); + navigationService.syncTree({ tree: "content", path: $scope.currentNode.path, forceReload: true, activate: false }); vm.saveButtonState = "success"; }, function(error) { vm.error = error; diff --git a/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js b/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js index 00758ca0f1..e7d3cc2dfb 100644 --- a/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/media/media.sort.controller.js @@ -47,7 +47,7 @@ mediaResource.sort(args) .then(function(){ - // navigationService.syncTree({ tree: "media", path: $scope.currentNode.path, forceReload: true, activate: false }); + navigationService.syncTree({ tree: "media", path: $scope.currentNode.path, forceReload: true, activate: false }); vm.saveButtonState = "success"; }, function(error) { vm.error = error; From 4730ee317bfdbf38ddb0f265b65990645494af83 Mon Sep 17 00:00:00 2001 From: Warren Date: Mon, 6 Aug 2018 11:52:12 +0100 Subject: [PATCH 46/51] Removes some unused .aspx files for dictionary editing - no longer needed as we now have this in Angular --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 2 - .../Umbraco/settings/DictionaryItemList.aspx | 16 -- .../Umbraco/settings/EditDictionaryItem.aspx | 14 -- src/Umbraco.Web/UI/Bundles/JsJQueryCore.cs | 1 + src/Umbraco.Web/Umbraco.Web.csproj | 23 +-- .../umbraco/settings/DictionaryItemList.aspx | 16 -- .../settings/DictionaryItemList.aspx.cs | 64 ------- .../DictionaryItemList.aspx.designer.cs | 42 ----- .../umbraco/settings/EditDictionaryItem.aspx | 15 -- .../settings/EditDictionaryItem.aspx.cs | 175 ------------------ .../EditDictionaryItem.aspx.designer.cs | 24 --- 11 files changed, 4 insertions(+), 388 deletions(-) delete mode 100644 src/Umbraco.Web.UI/Umbraco/settings/DictionaryItemList.aspx delete mode 100644 src/Umbraco.Web.UI/Umbraco/settings/EditDictionaryItem.aspx delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/settings/DictionaryItemList.aspx.designer.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.designer.cs diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index e72fa9874f..c90722c08c 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -457,7 +457,6 @@ - @@ -469,7 +468,6 @@ Form - diff --git a/src/Umbraco.Web.UI/Umbraco/settings/DictionaryItemList.aspx b/src/Umbraco.Web.UI/Umbraco/settings/DictionaryItemList.aspx deleted file mode 100644 index 80b505f382..0000000000 --- a/src/Umbraco.Web.UI/Umbraco/settings/DictionaryItemList.aspx +++ /dev/null @@ -1,16 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" Codebehind="DictionaryItemList.aspx.cs" - Inherits="umbraco.presentation.settings.DictionaryItemList" MasterPageFile="../masterpages/umbracoPage.Master" %> -<%@ Register TagPrefix="cc1" Namespace="Umbraco.Web._Legacy.Controls" Assembly="Umbraco.Web" %> - - - - - - - - -
-
-
- -
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco/settings/EditDictionaryItem.aspx b/src/Umbraco.Web.UI/Umbraco/settings/EditDictionaryItem.aspx deleted file mode 100644 index ffb5ae035d..0000000000 --- a/src/Umbraco.Web.UI/Umbraco/settings/EditDictionaryItem.aspx +++ /dev/null @@ -1,14 +0,0 @@ -<%@ Register TagPrefix="cc1" Namespace="Umbraco.Web._Legacy.Controls" Assembly="Umbraco.Web" %> - -<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoPage.Master" ValidateRequest="false" - CodeBehind="EditDictionaryItem.aspx.cs" AutoEventWireup="True" Inherits="umbraco.settings.EditDictionaryItem" %> - - - - - - diff --git a/src/Umbraco.Web/UI/Bundles/JsJQueryCore.cs b/src/Umbraco.Web/UI/Bundles/JsJQueryCore.cs index bb8c8be773..570551c0bf 100644 --- a/src/Umbraco.Web/UI/Bundles/JsJQueryCore.cs +++ b/src/Umbraco.Web/UI/Bundles/JsJQueryCore.cs @@ -6,6 +6,7 @@ namespace Umbraco.Web.UI.Bundles /// /// The core Jquery libs /// + [ClientDependency(ClientDependencyType.Javascript, "lib/jquery/jquery.min.js", "UmbracoRoot", Priority = 1, Group = 1)] [ClientDependency(ClientDependencyType.Javascript, "lib/jquery-migrate/jquery-migrate.min.js", "UmbracoRoot", Priority = 2, Group = 1)] public class JsJQueryCore : Control { diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e981d5aa25..6cc212bfef 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1304,20 +1304,6 @@ sendToTranslation.aspx - - DictionaryItemList.aspx - ASPXCodeBehind - - - DictionaryItemList.aspx - - - EditDictionaryItem.aspx - ASPXCodeBehind - - - EditDictionaryItem.aspx - Code @@ -1421,17 +1407,11 @@ - - ASPXCodeBehind - ASPXCodeBehind - - ASPXCodeBehind - @@ -1522,6 +1502,9 @@ umbraco_org_umbraco_update_CheckForUpgrade + + +