diff --git a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js index 480a638fbc..d33a2e5407 100644 --- a/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js +++ b/src/Umbraco.Web.UI.Client/lib/umbraco/LegacyUmbClientMgr.js @@ -242,20 +242,32 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); //get our angular navigation service var injector = getRootInjector(); + + var rootScope = injector.get("$rootScope"); + var angularHelper = injector.get("angularHelper"); var navService = injector.get("navigationService"); + var locationService = injector.get("$location"); - //if the path doesn't start with "/" or with the root path then - //prepend the root path - if (!strLocation.startsWith("/")) { - strLocation = this._rootPath + "/" + strLocation; - } - else if (strLocation.length >= this._rootPath.length - && strLocation.substr(0, this._rootPath.length) != this._rootPath) { - strLocation = this._rootPath + "/" + strLocation; - } + var self = this; - navService.loadLegacyIFrame(strLocation); + angularHelper.safeApply(rootScope, function() { + if (strLocation.startsWith("#")) { + locationService.path(strLocation.trimStart("#")).search(""); + } + else { + //if the path doesn't start with "/" or with the root path then + //prepend the root path + if (!strLocation.startsWith("/")) { + strLocation = self._rootPath + "/" + strLocation; + } + else if (strLocation.length >= self._rootPath.length + && strLocation.substr(0, self._rootPath.length) != self._rootPath) { + strLocation = self._rootPath + "/" + strLocation; + } + navService.loadLegacyIFrame(strLocation); + } + }); }, getFakeFrame : function() { diff --git a/src/Umbraco.Web.UI.Client/src/views/contenttype/contenttype.listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/contenttype/contenttype.listview.controller.js deleted file mode 100644 index 252d063add..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/contenttype/contenttype.listview.controller.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * @ngdoc controller - * @name Umbraco.Editors.ContentType.ListViewController - * @function - * - * @description - * The controller for the customize list view dialog for content types - */ -function ContentTypeListViewController($scope, contentTypeResource, dataTypeResource) { - - - function init() { - contentTypeResource.getAssignedListViewDataType($scope.dialogOptions.contentTypeId) - .then(function(d) { - $scope.listViewName = d.name; - $scope.isSystem = d.isSystem; - $scope.dataTypeId = d.id; - }); - } - - $scope.listViewName = ""; - $scope.isSystem = true; - $scope.dataTypeId = 0; - - $scope.createCustom = function() { - dataTypeResource.save({ - id: 0, - name: "List View - " + $scope.dialogOptions.contentTypeAlias, - selectedEditor: "Umbraco.ListView" - }, [], true) - .then(function(d) { - $scope.listViewName = d.name; - $scope.isSystem = d.isSystem; - $scope.dataTypeId = d.id; - }); - } - - $scope.removeCustom = function() { - if (!$scope.isSystem && $scope.dataTypeId > 0) { - dataTypeResource.deleteById($scope.dataTypeId) - .then(function() { - init(); - }); - } - } - - init(); -} - -angular.module("umbraco").controller("Umbraco.Editors.ContentType.ListViewController", ContentTypeListViewController); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/contenttype/listview.html b/src/Umbraco.Web.UI.Client/src/views/contenttype/listview.html deleted file mode 100644 index 25ee20fcfb..0000000000 --- a/src/Umbraco.Web.UI.Client/src/views/contenttype/listview.html +++ /dev/null @@ -1,43 +0,0 @@ -
- - - -
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 64546d9a01..cf29f0ea07 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -538,11 +538,13 @@ treeInit.aspx + + umbraco.aspx diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 11ad6d65dc..3d1c0ed31e 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -252,6 +252,8 @@ Type to filter... + Allow at root + Only Content Types with this checked can be created at the root level of Content and Media trees Allowed child node types Document Type Compositions Create @@ -261,8 +263,9 @@ Tab Thumbnail Enable list view - Customize list view + Configures the content item to show a sortable & searchable list of its children, the children will not be shown in the tree Current list view + The active list view data type Create custom list view Remove custom list view diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index 2a7505b562..13246d476f 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -251,6 +251,8 @@ + Allow at root + Only Content Types with this checked can be created at the root level of Content and Media trees Allowed child node types Document Type Compositions Create @@ -260,8 +262,9 @@ Tab Thumbnail Enable list view - Customize list view + Configures the content item to show a sortable & searchable list of its children, the children will not be shown in the tree Current list view + The active list view data type Create custom list view Remove custom list view diff --git a/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx b/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx index 0266a9eab7..fa3f464443 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx @@ -1,9 +1,11 @@ <%@ Control Language="c#" AutoEventWireup="True" Codebehind="ContentTypeControlNew.ascx.cs" Inherits="Umbraco.Web.UI.Umbraco.Controls.ContentTypeControlNew" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %> +<%@ Import Namespace="umbraco" %> <%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> <%@ Register TagPrefix="cc2" Namespace="umbraco.uicontrols" Assembly="controls" %> +<%@ Register TagPrefix="cdf" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - + @@ -12,7 +14,7 @@ -

<%=umbraco.ui.GetText("settings", "contentTypeEnabled")%>
<%=umbraco.ui.GetText("settings", "contentTypeUses")%> <%=umbraco.ui.GetText("settings", "asAContentMasterType")%>

+

<%=ui.GetText("settings", "contentTypeEnabled")%>
<%=umbraco.ui.GetText("settings", "contentTypeUses")%> <%=umbraco.ui.GetText("settings", "asAContentMasterType")%>

@@ -73,36 +75,72 @@ - +
- + <%if (cb_isContainer.Checked) { %> -

- Configure list view... -

- <%--Scripting to show hide the button if the doc type is already configured to be a list view--%> + +
+ +
+
+
+
+ + +
+ + +  (<%=ui.Text("general", "default", Security.CurrentUser) %>) + +
+ + <%=ui.Text("general", "edit", Security.CurrentUser) %> + +
+ +
+ + +
+ +
+
+
+ +
+
+ + <%--Scripting to for configuring a list view--%> diff --git a/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.cs b/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.cs index 28250d9fa4..096bb5b724 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -1,12 +1,33 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Web; using System.Web.UI.WebControls; +using AutoMapper; +using Umbraco.Core; +using Umbraco.Core.Models; +using Umbraco.Web.Editors; +using Umbraco.Web.Models.ContentEditing; namespace Umbraco.Web.UI.Umbraco.Controls { public partial class ContentTypeControlNew : global::umbraco.controls.ContentTypeControlNew { + protected string DataTypeControllerUrl { get; private set; } + protected string ContentTypeControllerUrl { get; private set; } + + /// + /// Raises the event. + /// + /// The object that contains the event data. + protected override void OnLoad(EventArgs e) + { + base.OnLoad(e); + + DataTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl(x => x.GetById(0)); + ContentTypeControllerUrl = Url.GetUmbracoApiServiceBaseUrl(x => x.GetAssignedListViewDataType(0)); + } + } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.designer.cs b/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.designer.cs index deda04c7b6..2ad0b89587 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.designer.cs +++ b/src/Umbraco.Web.UI/umbraco/controls/ContentTypeControlNew.ascx.designer.cs @@ -12,5 +12,13 @@ namespace Umbraco.Web.UI.Umbraco.Controls { public partial class ContentTypeControlNew { + /// + /// JsInclude control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude; } } diff --git a/src/Umbraco.Web.UI/umbraco/controls/ProgressBar.ascx b/src/Umbraco.Web.UI/umbraco/controls/ProgressBar.ascx index 2fb6664d2d..9e7e0db6b1 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/ProgressBar.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/ProgressBar.ascx @@ -1,2 +1,2 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProgressBar.ascx.cs" Inherits="umbraco.presentation.umbraco.controls.ProgressBar" %> -<%#umbraco.ui.Text("publish", "inProgress", null)%>
\ No newline at end of file +<%#umbraco.ui.Text("publish", "inProgress")%>
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/settings/EditNodeTypeNew.aspx b/src/Umbraco.Web.UI/umbraco/settings/EditNodeTypeNew.aspx index 101b0ae3f5..b2ed9df718 100644 --- a/src/Umbraco.Web.UI/umbraco/settings/EditNodeTypeNew.aspx +++ b/src/Umbraco.Web.UI/umbraco/settings/EditNodeTypeNew.aspx @@ -6,12 +6,14 @@ diff --git a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js index 09f66190af..82cec69d81 100644 --- a/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js +++ b/src/Umbraco.Web.UI/umbraco_client/Application/UmbracoClientManager.js @@ -107,15 +107,19 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); } } else { - //if the path doesn't start with "/" or with the root path then - //prepend the root path - if (strLocation.substr(0, 1) != "/") { - strLocation = this._rootPath + "/" + strLocation; - } - else if (strLocation.length >= this._rootPath.length - && strLocation.substr(0, this._rootPath.length) != this._rootPath) { - strLocation = this._rootPath + "/" + strLocation; - } + + //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); diff --git a/src/Umbraco.Web.UI/umbraco_client/Editors/EditContentType.js b/src/Umbraco.Web.UI/umbraco_client/Editors/EditContentType.js new file mode 100644 index 0000000000..18f47196b8 --- /dev/null +++ b/src/Umbraco.Web.UI/umbraco_client/Editors/EditContentType.js @@ -0,0 +1,108 @@ +Umbraco.Sys.registerNamespace("Umbraco.Editors"); + +(function ($) { + + var _model = {}; + var _opts = null; + + //updates the UI elements + function updateElements() { + _opts.configPanel.find("strong").html(_model.listViewName); + if (_model.isSystem) { + _opts.createListViewButton.show(); + _opts.removeListViewButton.hide(); + _opts.configPanel.find("em").show(); + } + else { + _opts.createListViewButton.hide(); + _opts.removeListViewButton.show(); + _opts.configPanel.find("em").hide(); + } + } + + function populateData() { + //get init data + + $.get(_opts.contentTypeServiceBaseUrl + "GetAssignedListViewDataType?contentTypeId=" + _opts.contentTypeId, function (result) { + _model.isSystem = result.isSystem; + _model.listViewName = result.name; + _model.listViewId = result.id; + updateElements(); + }); + } + + $.ajaxSetup({ + beforeSend: function (xhr) { + xhr.setRequestHeader("X-XSRF-TOKEN", $.cookie("XSRF-TOKEN")); + }, + contentType: 'application/json;charset=utf-8', + dataType: "json", + dataFilter: function (data, dataType) { + if ((typeof data) === "string") { + //trim the csrf bits off + data = data.replace(/^\)\]\}\'\,\n/, ""); + } + return data; + } + }); + + Umbraco.Editors.EditContentType = base2.Base.extend({ + + // Constructor + constructor: function(opts) { + // Merge options with default + _opts = $.extend({ + // Default options go here + }, opts); + }, + + init: function () { + //wire up handlers + + _opts.configPanel.find("a").click(function() { + UmbClientMgr.contentFrame('#/developer/datatype/edit/' + _model.listViewId); + }); + + _opts.isContainerChk.on("change", function () { + if ($(this).is(":checked")) { + _opts.configPanel.slideDown(); + } + else { + _opts.configPanel.slideUp(); + } + }); + + _opts.createListViewButton.click(function (event) { + event.preventDefault(); + + var data = { + parentId: -1, + id: 0, + preValues: [], + action: "SaveNew", + name: "List View - " + _opts.contentTypeAlias, + selectedEditor: "Umbraco.ListView" + }; + + $.post(_opts.dataTypeServiceBaseUrl + "PostSave", JSON.stringify(data), function (result) { + _model.isSystem = result.isSystem; + _model.listViewName = result.name; + _model.listViewId = result.id; + updateElements(); + }); + }); + + _opts.removeListViewButton.click(function (event) { + event.preventDefault(); + + $.post(_opts.dataTypeServiceBaseUrl + "DeleteById?id=" + _model.listViewId, function (result) { + //re-get the data + populateData(); + }); + }); + + populateData(); + + } + }); +})(jQuery); \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs index 928335cf13..98458a5aff 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -122,8 +122,6 @@ namespace umbraco.controls pp_compositions.Text = ui.Text("contenttypecompositions", Security.CurrentUser); pp_description.Text = ui.Text("editcontenttype", "description", Security.CurrentUser); pp_icon.Text = ui.Text("icon", Security.CurrentUser); - - pp_isContainer.Text = ui.Text("editcontenttype", "hasListView", Security.CurrentUser); // we'll disable this... if (!Page.IsPostBack && _contentType.MasterContentType != 0) @@ -141,6 +139,8 @@ namespace umbraco.controls lt_icon.Text = _contentType.IconUrl.TrimStart('.'); checkTxtAliasJs.Text = string.Format("checkAlias('#{0}');", txtAlias.ClientID); + + DataBind(); } /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx index 2d5ef2d26f..1ef0e8f946 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx @@ -1,2 +1,2 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProgressBar.ascx.cs" Inherits="umbraco.presentation.umbraco.controls.ProgressBar" %> -<%#umbraco.ui.Text("publish", "inProgress", null)%>
+<%#umbraco.ui.Text("publish", "inProgress")%>
diff --git a/src/umbraco.businesslogic/ui.cs b/src/umbraco.businesslogic/ui.cs index 4416ed2451..9c03bebc53 100644 --- a/src/umbraco.businesslogic/ui.cs +++ b/src/umbraco.businesslogic/ui.cs @@ -136,7 +136,7 @@ namespace umbraco return GetText(Area, Key, null, GetLanguage(u)); } - internal static string Text(string area, string key, IUser u) + public static string Text(string area, string key, IUser u) { return GetText(area, key, null, GetLanguage(u)); } diff --git a/src/umbraco.controls/ProgressBar.cs b/src/umbraco.controls/ProgressBar.cs index d7b5f80f4f..b7fdabcd7a 100644 --- a/src/umbraco.controls/ProgressBar.cs +++ b/src/umbraco.controls/ProgressBar.cs @@ -10,7 +10,7 @@ namespace umbraco.uicontrols [Obsolete("Use Umbraco.Web.UI.Controls.ProgressBar")] public class ProgressBar : System.Web.UI.WebControls.Panel { - private string _title = umbraco.ui.Text("publish", "inProgress", null); + private string _title = umbraco.ui.Text("publish", "inProgress"); public string Title { get; set; } protected override void Render(System.Web.UI.HtmlTextWriter writer) diff --git a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs index 9d6cd520e7..f6ec580a3d 100644 --- a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs +++ b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs @@ -574,7 +574,7 @@ namespace umbraco.editorControls.tinyMCE3 appendValue = ", '" + cmd.Value + "'"; _mceButtons.Add(cmd.Priority, cmd.Command); _buttons.Add(cmd.Priority, - new editorButton(cmd.Alias, ui.Text("buttons", cmd.Alias, null), cmd.Icon, + new editorButton(cmd.Alias, ui.Text("buttons", cmd.Alias), cmd.Icon, "tinyMCE.execInstanceCommand('" + ClientID + "', '" + cmd.Command + "', " + cmd.UserInterface + appendValue + ")")); }