Merge pull request #1185 from danlister/U4-8190
U4-8190 Converted umbraco.cms.presentation.Trees.UserTypes to use the new tree structure
This commit is contained in:
@@ -107,6 +107,11 @@
|
||||
|
||||
public const string Languages = "languages";
|
||||
|
||||
/// <summary>
|
||||
/// alias for the user types tree.
|
||||
/// </summary>
|
||||
public const string UserTypes = "userTypes";
|
||||
|
||||
//TODO: Fill in the rest!
|
||||
}
|
||||
}
|
||||
|
||||
@@ -963,6 +963,7 @@
|
||||
<key alias="stylesheets">Stylopisy</key>
|
||||
<key alias="templates">Šablony</key>
|
||||
<key alias="xslt">XSLT soubory</key>
|
||||
<key alias="userTypes">Typy Uživatelů</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nová aktualizace je připrvena</key>
|
||||
|
||||
@@ -928,6 +928,7 @@ Vennlig hilsen Umbraco roboten
|
||||
<key alias="templates">Maler</key>
|
||||
<key alias="xslt">XSLT Filer</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">Brukertyper typer</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Ny oppdatering er klar</key>
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTree, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
<!--Users-->
|
||||
<add application="users" alias="users" title="Users" type="umbraco.loadUsers, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="0" />
|
||||
<add application="users" alias="userTypes" title="User Types" type="umbraco.cms.presentation.Trees.UserTypes, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="1" />
|
||||
<add application="users" alias="userTypes" title="User Types" type="Umbraco.Web.Trees.UserTypesTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="1" />
|
||||
<add application="users" alias="userPermissions" title="User Permissions" type="umbraco.cms.presentation.Trees.UserPermissions, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="2" />
|
||||
<!--Members-->
|
||||
<add initialize="true" sortOrder="0" alias="member" application="member" title="Members" iconClosed="icon-folder" iconOpen="icon-folder-open" type="Umbraco.Web.Trees.MemberTreeController, umbraco" />
|
||||
|
||||
@@ -986,7 +986,6 @@ Mange hilsner fra Umbraco robotten
|
||||
<key alias="memberTypes">Medlemstype</key>
|
||||
<key alias="documentTypes">Dokumenttyper</key>
|
||||
<key alias="relationTypes">Dokumenttyper</key>
|
||||
|
||||
<key alias="packager">Pakker</key>
|
||||
<key alias="packages">Pakker</key>
|
||||
<key alias="python">Python</key>
|
||||
@@ -999,6 +998,7 @@ Mange hilsner fra Umbraco robotten
|
||||
<key alias="templates">Skabeloner</key>
|
||||
<key alias="xslt">XSLT-filer</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">Bruger Typer</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Ny opdatering er klar</key>
|
||||
|
||||
@@ -946,6 +946,7 @@ Ihr freundlicher Umbraco-Robot
|
||||
<key alias="templates">Vorlagen</key>
|
||||
<key alias="xslt">XSLT-Dateien</key>
|
||||
<key alias="analytics">Auswertungen</key>
|
||||
<key alias="userTypes">Benutzertypen</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Neues Update verfügbar</key>
|
||||
|
||||
@@ -1188,6 +1188,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="templates">Templates</key>
|
||||
<key alias="xslt">XSLT Files</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">User Types</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">New update ready</key>
|
||||
|
||||
@@ -1192,6 +1192,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="templates">Templates</key>
|
||||
<key alias="xslt">XSLT Files</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">User Types</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">New update ready</key>
|
||||
|
||||
@@ -850,6 +850,7 @@
|
||||
<key alias="stylesheets">Hojas de estilo</key>
|
||||
<key alias="templates">Plantillas</key>
|
||||
<key alias="xslt">Archivos XSLT</key>
|
||||
<key alias="userTypes">Tipos de Usuarios</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Existe una nueva actualización</key>
|
||||
|
||||
@@ -984,6 +984,7 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à
|
||||
<key alias="stylesheets">Feuilles de style</key>
|
||||
<key alias="templates">Modèles</key>
|
||||
<key alias="xslt">Fichiers XSLT</key>
|
||||
<key alias="userTypes">Types d'utilisateurs</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nouvelle mise à jour prête</key>
|
||||
|
||||
@@ -869,6 +869,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="stylesheets">גיליונות סגנון</key>
|
||||
<key alias="templates">תבניות</key>
|
||||
<key alias="xslt">קבצי XSLT</key>
|
||||
<key alias="userTypes">משתמש מקליד</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">עידכון חדש זמין</key>
|
||||
|
||||
@@ -842,6 +842,7 @@ Per gestire il tuo sito web, è sufficiente aprire il back office di Umbraco e i
|
||||
<key alias="stylesheets">Fogli di stile</key>
|
||||
<key alias="templates">Templates</key>
|
||||
<key alias="xslt">Files XSLT</key>
|
||||
<key alias="userTypes">Tipi di Utente</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable"><![CDATA[Nuovo aggiornamento pronto]]></key>
|
||||
|
||||
@@ -1172,6 +1172,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
|
||||
<key alias="templates">テンプレート</key>
|
||||
<key alias="xslt">XSLT ファイル</key>
|
||||
<key alias="analytics">アナリティクス</key>
|
||||
<key alias="userTypes">ユーザータイプ</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">新しい更新があります</key>
|
||||
|
||||
@@ -846,6 +846,7 @@
|
||||
<key alias="stylesheets">스타일시트</key>
|
||||
<key alias="templates">템플릿</key>
|
||||
<key alias="xslt">XSLT 파일</key>
|
||||
<key alias="userTypes">사용자 유형</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">새 업데이트가 준비되었습니다.</key>
|
||||
|
||||
@@ -951,6 +951,7 @@ Om een vertalingstaak te sluiten, ga aub naar het detailoverzicht en klik op de
|
||||
<key alias="stylesheets">Stylesheets</key>
|
||||
<key alias="templates">Sjablonen</key>
|
||||
<key alias="xslt">XSLT Bestanden</key>
|
||||
<key alias="userTypes">Gebruiker Types</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nieuwe update beschikbaar</key>
|
||||
|
||||
@@ -742,6 +742,7 @@ Miłego dnia!]]></key>
|
||||
<key alias="stylesheets">Arkusze stylów</key>
|
||||
<key alias="templates">Szablony</key>
|
||||
<key alias="xslt">Pliki XSLT</key>
|
||||
<key alias="userTypes">Typy Użytkowników</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Aktualizacja jest gotowa</key>
|
||||
|
||||
@@ -830,6 +830,7 @@ Para fechar a tarefa de tradução vá até os detalhes e clique no botão "Fech
|
||||
<key alias="stylesheets">Stylesheets</key>
|
||||
<key alias="templates">Modelos</key>
|
||||
<key alias="xslt">Arquivos XSLT</key>
|
||||
<key alias="userTypes">Tipos de Usuários</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nova atualização pronta</key>
|
||||
|
||||
@@ -1161,6 +1161,7 @@
|
||||
<key alias="stylesheets">Стили CSS</key>
|
||||
<key alias="templates">Шаблоны</key>
|
||||
<key alias="xslt">Файлы XSLT</key>
|
||||
<key alias="userTypes">Типы пользователей</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Доступны обновления</key>
|
||||
|
||||
@@ -851,6 +851,7 @@
|
||||
<key alias="stylesheets">Stilmallar</key>
|
||||
<key alias="templates">Sidmallar</key>
|
||||
<key alias="xslt">XSLT-filer</key>
|
||||
<key alias="userTypes">Användartyper</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Ny uppdatering tillgänglig</key>
|
||||
|
||||
@@ -920,6 +920,7 @@
|
||||
<key alias="stylesheets">样式表</key>
|
||||
<key alias="templates">模板</key>
|
||||
<key alias="xslt">XSLT文件</key>
|
||||
<key alias="userTypes">用户类型</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">有可用更新</key>
|
||||
|
||||
66
src/Umbraco.Web/Trees/UserTypesTreeController.cs
Normal file
66
src/Umbraco.Web/Trees/UserTypesTreeController.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Formatting;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
[UmbracoTreeAuthorize(Constants.Trees.UserTypes)]
|
||||
[Tree(Constants.Applications.Users, Constants.Trees.UserTypes, null, sortOrder: 1)]
|
||||
[PluginController("UmbracoTrees")]
|
||||
[CoreTree]
|
||||
public class UserTypesTreeController : TreeController
|
||||
{
|
||||
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var nodes = new TreeNodeCollection();
|
||||
|
||||
var userTypes = Services.UserService.GetAllUserTypes();
|
||||
userTypes = userTypes.OrderBy(ut => ut.Name);
|
||||
|
||||
foreach (var userType in userTypes)
|
||||
{
|
||||
nodes.Add(
|
||||
CreateTreeNode(
|
||||
userType.Id.ToString(CultureInfo.InvariantCulture),
|
||||
"-1",
|
||||
queryStrings,
|
||||
userType.Name,
|
||||
"icon-users",
|
||||
false,
|
||||
"/" + queryStrings.GetValue<string>("application") + "/framed/"
|
||||
+ Uri.EscapeDataString("users/EditUserType.aspx?id=" + userType.Id)));
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var menu = new MenuItemCollection();
|
||||
|
||||
if (id == Constants.System.Root.ToInvariantString())
|
||||
{
|
||||
// root actions
|
||||
menu.Items.Add<ActionNew>(Services.TextService.Localize("actions", ActionNew.Instance.Alias))
|
||||
.ConvertLegacyMenuItem(null, "userTypes", queryStrings.GetValue<string>("application"));
|
||||
|
||||
menu.Items.Add<RefreshNode, ActionRefresh>(Services.TextService.Localize("actions", ActionRefresh.Instance.Alias), true);
|
||||
return menu;
|
||||
}
|
||||
|
||||
// delete user type
|
||||
menu.Items.Add<ActionDelete>(Services.TextService.Localize("actions", ActionDelete.Instance.Alias))
|
||||
.ConvertLegacyMenuItem(null, "userTypes", queryStrings.GetValue<string>("application"));
|
||||
|
||||
return menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -329,6 +329,7 @@
|
||||
<Compile Include="Editors\IEditorValidator.cs" />
|
||||
<Compile Include="Editors\EditorModelEventManager.cs" />
|
||||
<Compile Include="HtmlHelperBackOfficeExtensions.cs" />
|
||||
<Compile Include="Trees\UserTypesTreeController.cs" />
|
||||
<Compile Include="_Legacy\Actions\Action.cs" />
|
||||
<Compile Include="_Legacy\Actions\ActionAssignDomain.cs" />
|
||||
<Compile Include="_Legacy\Actions\ActionAudit.cs" />
|
||||
@@ -1593,7 +1594,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeDialogModes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeService.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\UserPermissions.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\UserTypes.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\XmlTree.cs">
|
||||
<DependentUpon>XmlTree.xsd</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
using Umbraco.Core.Services;
|
||||
using System;
|
||||
using umbraco.BusinessLogic;
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Web.Trees;
|
||||
|
||||
namespace umbraco.cms.presentation.Trees
|
||||
{
|
||||
[Tree(Constants.Applications.Users, "userTypes", "User Types", sortOrder: 1)]
|
||||
public class UserTypes : BaseTree
|
||||
{
|
||||
|
||||
public UserTypes(string application) : base(application) { }
|
||||
|
||||
public override void RenderJS(ref System.Text.StringBuilder Javascript)
|
||||
{
|
||||
Javascript.Append(
|
||||
@"
|
||||
function openUserTypes(id) {
|
||||
UmbClientMgr.contentFrame('users/EditUserType.aspx?id=' + id);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
var userTypes = Services.UserService.GetAllUserTypes();
|
||||
foreach (var userType in userTypes)
|
||||
{
|
||||
if (userType.Id > 1) //don't show the admin user type, they should always have full permissions
|
||||
{
|
||||
XmlTreeNode node = XmlTreeNode.Create(this);
|
||||
node.NodeID = userType.Id.ToString();
|
||||
node.Action = string.Format("javascript:openUserTypes({0})", userType.Id);
|
||||
node.Icon = "icon-users";
|
||||
node.Text = userType.Name;
|
||||
|
||||
OnBeforeNodeRender(ref tree, ref node, EventArgs.Empty);
|
||||
if (node != null)
|
||||
{
|
||||
tree.Add(node);
|
||||
OnAfterNodeRender(ref tree, ref node, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
rootNode.Text = Services.TextService.Localize("user/userTypes");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -41,15 +41,14 @@ namespace umbraco.cms.presentation.user
|
||||
if (!int.TryParse(Request.QueryString["id"], out m_userTypeID))
|
||||
return;
|
||||
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BindActions();
|
||||
|
||||
ClientTools
|
||||
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<UserTypes>().Tree.Alias)
|
||||
.SyncTree(m_userTypeID.ToString(), false);
|
||||
}
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BindActions();
|
||||
|
||||
ClientTools
|
||||
.SetActiveTreeType(Constants.Trees.UserTypes)
|
||||
.SyncTree(m_userTypeID.ToString(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void save_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user