Quellcode durchsuchen

HelpPages beinahe abgeschlossen!

Arne Diekmann vor 8 Jahren
Ursprung
Commit
949d3c1cbe

+ 16 - 2
GreenTree.Nachtragsmanagement.Core/Domain/Misc/HelpPage.cs

@@ -8,10 +8,24 @@ namespace GreenTree.Nachtragsmanagement.Core.Domain.Misc
 {
     public class HelpPage : BaseEntity
     {
+        #region Fields
+
+        /// <summary>
+        /// HelpPages related to the helpPage
+        /// </summary>
+        private ICollection<HelpPage> _children;
+
+        #endregion
+
         public string Title { get; set; }
-        public string Category { get; set; }
-        public string Subcategory { get; set; }
+        public int? ParentId { get; set; }
+        public virtual HelpPage Parent { get; set; }
         public string Content { get; set; }
         public int DisplayIndex { get; set; }
+        public virtual ICollection<HelpPage> Children
+        {
+            get { return _children ?? (_children = new List<HelpPage>()); }
+            set { _children = value; }
+        }
     }
 }

+ 5 - 2
GreenTree.Nachtragsmanagement.Data/Mapping/Misc/HelpPageMap.cs

@@ -17,10 +17,13 @@ namespace GreenTree.Nachtragsmanagement.Data.Mapping.Misc
             HasKey(f => f.Id);
 
             Property(f => f.Title);
-            Property(f => f.Category);
-            Property(f => f.Subcategory);
+            Property(f => f.ParentId);
             Property(f => f.Content);
             Property(f => f.DisplayIndex);
+
+            HasOptional(f => f.Parent)
+                .WithMany(f => f.Children)
+                .HasForeignKey(f => f.ParentId);
         }
     }
 }

+ 1 - 0
GreenTree.Nachtragsmanagement.Data/Migrations/Configuration.cs

@@ -10,6 +10,7 @@ namespace GreenTree.Nachtragsmanagement.Data.Migrations
         public Configuration()
         {
             AutomaticMigrationsEnabled = true;
+            AutomaticMigrationDataLossAllowed = true;
 
             ContextKey = "GreenTree.Nachtragsmanagement.Data.AppendixObjectContext";
         }

+ 5 - 0
GreenTree.Nachtragsmanagement.Services/Misc/IMiscService.cs

@@ -54,6 +54,11 @@ namespace GreenTree.Nachtragsmanagement.Services.Misc
         /// </summary>
         IList<HelpPage> GetAllHelpPages();
 
+        /// <summary>
+        /// Gets all helpPages without actual content
+        /// </summary>
+        IList<HelpPage> GetAllHelpPagesWithoutContent();
+
         /// <summary>
         /// Gets a helpPage by specified Id
         /// </summary>

+ 19 - 0
GreenTree.Nachtragsmanagement.Services/Misc/MiscService.cs

@@ -100,6 +100,25 @@ namespace GreenTree.Nachtragsmanagement.Services.Misc
             return _helpPageRepository.Table.ToList();
         }
 
+        /// <summary>
+        /// Gets all helpPages without actual content
+        /// </summary>
+        public IList<HelpPage> GetAllHelpPagesWithoutContent()
+        {
+            return _helpPageRepository.Table
+                .ToList()
+                .Select(u => new HelpPage
+                {
+                    Id = u.Id,
+                    Children = u.Children,
+                    DisplayIndex = u.DisplayIndex,
+                    Parent = u.Parent,
+                    ParentId = u.ParentId,
+                    Title = u.Title
+                })
+                .ToList();
+        }
+
         /// <summary>
         /// Gets a helpPage by specified Id
         /// </summary>

BIN
GreenTree.Nachtragsmanagement.Web/Content/Images/saveAs-16-contrast.png


BIN
GreenTree.Nachtragsmanagement.Web/Content/Images/saveAs-16-disable.png


BIN
GreenTree.Nachtragsmanagement.Web/Content/Images/saveAs-16.png


+ 104 - 86
GreenTree.Nachtragsmanagement.Web/Controllers/MiscController.cs

@@ -646,96 +646,78 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
         #region HelpPages
 
         /// <summary>
-        /// Basic helpPage view function
+        /// Default fileSaveSettings for the image uploader of the htmlEditor
         /// </summary>
-        [FunctionAuthorize(true, "Misc-HelpPages")]
-        public ActionResult ViewHelpPages()
-        {
-            var helpPages = _miscService.GetAllHelpPages();
-            var helpPageModels = helpPages
-                .Select(u => HelpPageDataModel.FromHelpPage(u, false))
-                .ToList();
-            var helpPageTreeModelList = new List<HelpPageTreeModel>();
-
-            var categoryPageModels = helpPageModels
-                .Where(p => String.IsNullOrEmpty(p.Category))
-                .OrderBy(p => p.DisplayIndex)
-                .ToList();
+        private static HtmlEditorFileSaveSettings fileSaveSettings;
 
-            foreach (var categoryPageModel in categoryPageModels)
+        /// <summary>
+        /// Default fileSaveSettings for the image uploader of the htmlEditor
+        /// </summary>
+        public static HtmlEditorFileSaveSettings FileSaveSettings
+        {
+            get
             {
-                helpPageTreeModelList.Add(new HelpPageTreeModel
+                if (fileSaveSettings == null)
                 {
-                    Text = categoryPageModel.Title,
-                    HelpPageId = categoryPageModel.Id
-                });
+                    fileSaveSettings = new HtmlEditorFileSaveSettings();
+                    fileSaveSettings.FileSystemSettings.UploadFolder = "~/Content/Images/HelpPages/";
+                }
+                return fileSaveSettings;
             }
+        }
 
-            var categoryModels = helpPageModels
-                .Where(p => !String.IsNullOrEmpty(p.Category))
-                .OrderBy(p => p.DisplayIndex)
-                .GroupBy(p => p.Category)
-                .ToList();
-
-            foreach (var categoryModel in categoryModels)
-            {
-                var categoryTreeModel = new HelpPageTreeModel
-                {
-                    Text = categoryModel.Key
-                };
-
-                helpPageTreeModelList.Add(categoryTreeModel);
-
-                var subcategoryPageModels = helpPageModels
-                    .Where(p => p.Category == categoryModel.Key && String.IsNullOrEmpty(p.Subcategory))
-                    .OrderBy(p => p.DisplayIndex)
-                    .ToList();
-
-                foreach (var subcategoryPageModel in subcategoryPageModels)
-                {
-                    var subcategoryTreePageModel = new HelpPageTreeModel
-                    {
-                        Text = subcategoryPageModel.Title,
-                        HelpPageId = subcategoryPageModel.Id
-                    };
+        /// <summary>
+        /// Default validationSettings for the image uploader of the htmlEditor
+        /// </summary>
+        public static readonly UploadControlValidationSettings ImageUploadValidationSettings = new UploadControlValidationSettings
+        {
+            AllowedFileExtensions = new string[] { ".jpg", ".jpeg", ".jpe", ".gif", ".png" },
+            MaxFileSize = 4000000
+        };
 
-                    categoryTreeModel.Elements.Add(subcategoryTreePageModel);
-                }
+        /// <summary>
+        /// Creates the helpPage tree recursively
+        /// </summary>
+        /// <param name="models">Full helpPage model list.</param>
+        /// <param name="nodesCollection">Parent node collection.</param>
+        /// <param name="parentID">Parent node id.</param>
+        public static void CreateHelpPageTree(IEnumerable<HelpPageDataModel> models, MVCxTreeViewNodeCollection nodesCollection, 
+            int? parentID)
+        {
+            var children = models
+                .Where(p => p.ParentId == parentID);
 
-                var subcategoryModels = helpPageModels
-                    .Where(p => p.Category == categoryModel.Key && !String.IsNullOrEmpty(p.Subcategory))
-                    .OrderBy(p => p.DisplayIndex)
-                    .GroupBy(p => p.Subcategory)
-                    .ToList();
+            foreach (var model in children)
+            {
+                var node = nodesCollection.Add(model.Title, model.Id.ToString());
+                node.Expanded = true;
 
-                foreach (var subcategoryModel in subcategoryModels)
-                {
-                    var subcategoryTreeModel = new HelpPageTreeModel
-                    {
-                        Text = subcategoryModel.Key
-                    };
+                CreateHelpPageTree(models, node.Nodes, model.Id);
+            }
+        }
 
-                    categoryTreeModel.Elements.Add(subcategoryTreeModel);
+        /// <summary>
+        /// Basic helpPage view function
+        /// </summary>
+        /// <param name="id">Id of initial editing helpPage.</param>
+        [FunctionAuthorize(true, "Misc-HelpPages")]
+        public ActionResult ViewHelpPages(int id = -1)
+        {
+            var helpPages = _miscService.GetAllHelpPagesWithoutContent();
+            var helpPageModels = helpPages
+                .Select(u => HelpPageDataModel.FromHelpPage(u, false))
+                .OrderBy(u => u.DisplayIndex)
+                .ToList();
 
-                    var subcategoryHelpPageModels = helpPageModels
-                        .Where(p => p.Category == categoryModel.Key && p.Subcategory == subcategoryModel.Key)
-                        .OrderBy(p => p.DisplayIndex)
-                        .ToList();
+            var initialHelpPageModelExists = helpPageModels
+                .Any(p => p.Id == id);
 
-                    foreach (var subcategoryHelpPageModel in subcategoryHelpPageModels)
-                    {
-                        var helpPageTreeModel = new HelpPageTreeModel
-                        {
-                            Text = subcategoryHelpPageModel.Title,
-                            HelpPageId = subcategoryHelpPageModel.Id
-                        };
+            if (initialHelpPageModelExists)
+                ViewData["InitialEditHelpPage"] = id;
 
-                        subcategoryTreeModel.Elements.Add(helpPageTreeModel);
-                    }
-                }
-            }
+            ViewData["IsHelpPageSelectionTree"] = false;
 
-            return View("~/Views/Misc/HelpPages.cshtml", helpPageTreeModelList);
+            return View("~/Views/Misc/HelpPages.cshtml", helpPageModels);
         }
 
         /// <summary>
@@ -747,6 +729,32 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
             return PartialView("~/Views/Misc/_HelpPageHtmlEditPartial.cshtml", helpPageModel);
         }
 
+        /// <summary>
+        /// Callback result for processing the upload of an image for a helpPage
+        /// </summary>
+        public ActionResult UploadProcessingImageUpload()
+        {
+            FileSavingEventHandler onFileSaving = (s, e) => {
+                using (var fileContent = e.UploadedFile.FileContent)
+                {
+                    using (var image = System.Drawing.Image.FromStream(fileContent))
+                    {
+                        var memoryStream = new MemoryStream();
+
+                        image.Save(memoryStream, image.RawFormat);
+
+                        e.OutputStream = memoryStream;
+
+                        e.FileName = e.UploadedFile.FileName;
+                    }
+                }
+            };
+
+            HtmlEditorExtension.SaveUploadedFile(FileSaveSettings, ImageUploadValidationSettings, onFileSaving);
+
+            return null;
+        }
+
         /// <summary>
         /// Get JSON data of specific helpPage
         /// </summary>
@@ -791,9 +799,17 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
         /// <param name="id">Id for existing helpPage, otherweise -1.</param>
         public ActionResult EditHelpPage(int id = -1)
         {
+            var helpPages = _miscService.GetAllHelpPages();
+            var helpPageModels = helpPages
+                .Select(u => HelpPageDataModel.FromHelpPage(u, false))
+                .ToList();
+
             var helpPage = _miscService.GetHelpPageById(id);
             var helpPageModel = HelpPageDataModel.FromHelpPage(helpPage, true);
 
+            ViewData["AllHelpPages"] = helpPageModels;
+            ViewData["IsHelpPageSelectionTree"] = true;
+
             return PartialView("~/Views/Misc/_HelpPageEditPartial.cshtml", helpPageModel);
         }
 
@@ -809,8 +825,6 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
                 if (!ModelState.IsValid)
                     return PartialView("~/Views/Misc/_HelpPageEditPartial.cshtml", helpPageModel);
 
-                var html = HtmlEditorExtension.GetHtml("HelpPageHtmlContentEditor");
-
                 if (helpPageModel.Id == -1)
                 {
                     var helpPage = helpPageModel.ToHelpPage();
@@ -818,6 +832,11 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
                     _miscService.InsertHelpPage(helpPage);
 
                     _logger.Entity(helpPage, Core.Domain.Logging.LogEntityActivity.Insert, _userHelper.FromCookies());
+
+                    return new JsonResult
+                    {
+                        Data = String.Format("success-{0}", helpPage.Id)
+                    };
                 }
                 else
                 {
@@ -825,19 +844,18 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
 
                     helpPage.Title = helpPageModel.Title;
                     helpPage.Content = helpPageModel.Content;
-                    helpPage.Category = helpPage.Category;
-                    helpPage.Subcategory = helpPage.Subcategory;
-                    helpPage.DisplayIndex = helpPage.DisplayIndex;
+                    helpPage.ParentId = helpPageModel.ParentId;
+                    helpPage.DisplayIndex = helpPageModel.DisplayIndex;
 
                     _miscService.UpdateHelpPage(helpPage);
 
                     _logger.Entity(helpPage, Core.Domain.Logging.LogEntityActivity.Update, _userHelper.FromCookies());
-                }
 
-                return new JsonResult
-                {
-                    Data = "success"
-                };
+                    return new JsonResult
+                    {
+                        Data = String.Format("success-{0}", helpPage.Id)
+                    };
+                }
             }
             catch (Exception ex)
             {

+ 4 - 1
GreenTree.Nachtragsmanagement.Web/GreenTree.Nachtragsmanagement.Web.csproj

@@ -216,6 +216,9 @@
     <Content Include="Content\Images\save-16-contrast.png" />
     <Content Include="Content\Images\save-16-disable.png" />
     <Content Include="Content\Images\save-16.png" />
+    <Content Include="Content\Images\saveAs-16-contrast.png" />
+    <Content Include="Content\Images\saveAs-16-disable.png" />
+    <Content Include="Content\Images\saveAs-16.png" />
     <Content Include="Content\Images\user-32.png" />
     <Content Include="Content\Images\password-32.png" />
     <Content Include="Content\Images\password-24.png" />
@@ -377,7 +380,6 @@
     <Compile Include="Models\Global\EditEntityCommentModel.cs" />
     <Compile Include="Models\Global\PrintGridModel.cs" />
     <Compile Include="Models\Misc\HelpPageDataModel.cs" />
-    <Compile Include="Models\Misc\HelpPageTreeModel.cs" />
     <Compile Include="Models\Misc\LogDataModel.cs" />
     <Compile Include="Models\Misc\MailNotificationDataModel.cs" />
     <Compile Include="Implementations\DeviationNotificationPlugin.cs" />
@@ -442,6 +444,7 @@
   </ItemGroup>
   <ItemGroup>
     <Folder Include="App_Data\" />
+    <Folder Include="Content\Images\HelpPages\" />
     <Folder Include="Fonts\" />
   </ItemGroup>
   <ItemGroup>

+ 7 - 6
GreenTree.Nachtragsmanagement.Web/Models/Misc/HelpPageDataModel.cs

@@ -10,8 +10,8 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Misc
     {
         public int Id { get; set; }
         public string Title { get; set; }
-        public string Category { get; set; }
-        public string Subcategory { get; set; }
+        public int? ParentId { get; set; }
+        public string ParentText { get; set; }
         public string Content { get; set; }
         public int DisplayIndex { get; set; }
 
@@ -35,8 +35,10 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Misc
             {
                 Id = helpPageEntity.Id,
                 Title = helpPageEntity.Title,
-                Category = helpPageEntity.Category,
-                Subcategory = helpPageEntity.Subcategory,
+                ParentId = helpPageEntity.ParentId,
+                ParentText = helpPageEntity.Parent == null
+                    ? String.Empty
+                    : helpPageEntity.Parent.Title,
                 Content = helpPageEntity.Content,
                 DisplayIndex = helpPageEntity.DisplayIndex
             };
@@ -50,8 +52,7 @@ namespace GreenTree.Nachtragsmanagement.Web.Models.Misc
             {
                 Id = this.Id,
                 Title = this.Title,
-                Category = this.Category,
-                Subcategory = this.Subcategory,
+                ParentId = this.ParentId,
                 Content = this.Content,
                 DisplayIndex = this.DisplayIndex
             };

+ 0 - 28
GreenTree.Nachtragsmanagement.Web/Models/Misc/HelpPageTreeModel.cs

@@ -1,28 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-
-namespace GreenTree.Nachtragsmanagement.Web.Models.Misc
-{
-    public class HelpPageTreeModel
-    {
-        #region Properties
-
-        public int HelpPageId { get; set; }
-        public string Text { get; set; }
-        public List<HelpPageTreeModel> Elements { get; set; }
-
-        #endregion
-
-        #region Ctor
-
-        public HelpPageTreeModel()
-        {
-            HelpPageId = -1;
-            Elements = new List<HelpPageTreeModel>();
-        }
-
-        #endregion
-    }
-}

BIN
GreenTree.Nachtragsmanagement.Web/Unbenannt.JPG


+ 7 - 0
GreenTree.Nachtragsmanagement.Web/Views/Home/Index.cshtml

@@ -65,6 +65,13 @@
 		}
 	}
 
+	function callCustomEventListener(name, params) {
+		for (var i = 0; i < eventListeners.length; i++) {
+			eventListeners[i].func(params);
+			eventListeners.splice(i, 1);
+		}
+	}
+
 	$(document).ready(function () {
 		$(".functionNavigationContainer").height($(window).height() - $(".globalFooter").height() - 3);
 		$(".functionContentContainer").height($(window).height() - $(".globalFooter").height() - 3);

+ 62 - 25
GreenTree.Nachtragsmanagement.Web/Views/Misc/HelpPages.cshtml

@@ -2,13 +2,20 @@
 	Layout = "~/Views/Shared/_FunctionLayout.cshtml";
 }
 
-@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageTreeModel>
+@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel>
 
 <script src='@Url.Content("~/Scripts/jquery.mCustomScrollbar.concat.min.js")'></script>
 <script>
+	var deleteId;
+	var saveOperation;
+
 	$(document).ready(function () {
 		setTimeout(function () {
 			setHelpContentHeight();
+			@if (ViewData["InitialEditHelpPage"] != null)
+			{
+				ViewContext.Writer.Write("editHelpPage(" + (int)ViewData["InitialEditHelpPage"] + ");");
+			}
 		}, 500);
 	});
 
@@ -46,6 +53,47 @@
 			success: function (response) {
 				setTimeout(function () {
 					$("#helpPageContent").html(response);
+					devHelpPageHtmlContentEditor.SetHeight($(window).height() - 18);
+				}, 200);
+			},
+			error: function () {
+				 alert("error occured");
+			}
+		});
+	}
+
+	function saveDataCallback() {
+		devPopupControlEditHelpPage.Hide();
+	}
+
+	function confirmDelete(id) {
+		if (!id) return;
+		deleteId = id;
+		$.ajax({
+			type: "GET",
+			url: '@Url.Action("GetHelpPage", "Misc")',
+			data: { Id: id },
+			success: function (response) {
+				if (response == "notFound") return;
+				var helpPage = JSON.parse(response);
+				var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteHelpPage);
+				popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{helpPage}", helpPage.Title));
+				$(".dialogText").text($(".dialogText").text().replace("{helpPage}", helpPage.Title));
+				popupControl.Show();
+			}
+		});
+	}
+
+	function deleteHelpPage() {
+		$.ajax({
+			type: "POST",
+			url: '@Url.Action("DeleteHelpPage", "Misc")',
+			data: { Id: deleteId },
+			success: function (response) {
+				var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteHelpPage);
+				popupControl.Hide();
+				setTimeout(function () {
+					window.location = window.location;
 				}, 200);
 			},
 			error: function () {
@@ -75,40 +123,21 @@
 		padding-left: 12px;
 	}
 
-	.helpTable > tbody > tr > td:first-of-type ul {
-		line-height: 24px;
-		font-size: 16px;
-		list-style-type: none;
-		padding-left: 12px;
-	}
-
-	.helpTable > tbody > tr > td:first-of-type ul > ul {
-		font-size: 16px;
-	}
-
-	.helpTable > tbody > tr > td:first-of-type ul > ul > ul {
-		font-size: 16px;
-	}
-
-	.helpTable > tbody > tr > td:first-of-type ul a {
-		text-decoration: none;
-	}
-
-	.helpTable > tbody > tr > td:first-of-type li {
-		margin-left: 8px;
-	}
-
 	.helpPageMenu {
 		width: auto;
 		margin: 0 8px 6px 0;
 		padding-bottom: 6px;
 		border-bottom: 1px dashed #009688;
+		overflow: auto;
 	}
 
 	#helpPageNavigation {
 		border-right: 1px solid #009688;
 	}
 
+	#helpPageContent {
+		color: black;
+	}
 </style>
 
 <table class="helpTable">
@@ -134,4 +163,12 @@
 			</div>
 		</td>
 	</tr>
-</table>
+</table>
+
+@Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
+{
+	PopupName = "devPopupControlDeleteHelpPage",
+	Content = "<div class='dialogText' style='padding: 12px'>Sind Sie sicher, dass Sie die Hilfe-Seite \"{helpPage}\" löschen möchten?</div>",
+	HeaderText = "\"{helpPage}\" löschen",
+	YesFunction = "function (s, e) { deleteHelpPage(); }"
+})

+ 33 - 13
GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageEditPartial.cshtml

@@ -8,12 +8,20 @@
 		function onHtmlToolbarCustomCommand(e) {
 			if (!e) return;
 			if (e.commandName == "save") {
+				saveHelpPage();
+			} else if (e.commandName == "saveAs") {
 				devPopupControlEditHelpPage.Show();
 			}
+			saveOperation = e.commandName;
 		}
 
 		function saveHelpPage() {
 			var form = $("#helpPageEditForm");
+			var selectedNode = devHelpPageSelectionTree.GetSelectedNode();
+			$("#Content").val(devHelpPageHtmlContentEditor.GetHtml());
+			$("#ParentId").val(selectedNode == null
+				? null
+				: selectedNode.name);
 			$(form).submit(function (e) {
 				$.ajax({
 					type: "POST",
@@ -22,8 +30,13 @@
 					success: function (response) {
 						setTimeout(function () {
 							$(".helpPageEditFormEditContainer").remove();
-							if (response == "success") {
-								parent.callCustomEventListener('HelpPageDataCallbackEventReceiver');
+							if (response.startsWith("success")) {
+								if (saveOperation == "save") {
+									devPopupControlEditHelpPage.Hide();
+								} else {
+									var id = response.split('-')[1];
+									window.location = '@Url.Action("ViewHelpPages", "Misc")' + '?id=' + id;
+								}
 							} else {
 								$("body").append(response);
 							}
@@ -34,11 +47,19 @@
 			});
 			form.submit();
 		}
+
+		function setDropDownText(text) {
+			ParentText.SetText(text);
+			ParentText.HideDropDown();
+		}
 	</script>
 
+	@Html.Partial("~/Views/Misc/_HelpPageHtmlEditPartial.cshtml", Model)
+
 	@using (Html.BeginForm("EditHelpPage", "Misc", FormMethod.Post, new { id = "helpPageEditForm" }))
 	{
-		@Html.Partial("~/Views/Misc/_HelpPageHtmlEditPartial.cshtml", Model)
+		@Html.HiddenFor(m => m.Content)
+		@Html.HiddenFor(m => m.ParentId)
 
 		@Html.DevExpress().PopupControl(s =>
 		{
@@ -64,25 +85,24 @@
 
 				ViewContext.Writer.Write("<input type=\"hidden\" value=\"" + Model.Id + "\" id=\"Id\" name=\"Id\" />");
 
-				ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Title, "Beschreibung:"));
+				ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Title, "Titel:"));
 				ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.Title).ToHtmlString());
 				Html.DevExpress().TextBoxFor(m => m.Title, t =>
 				{
 					t.Width = new Unit(100, UnitType.Percentage);
 				}).Render();
 
-				ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Category, "Kategorie:"));
-				ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.Category).ToHtmlString());
-				Html.DevExpress().TextBoxFor(m => m.Category, t =>
+				ViewContext.Writer.Write(Html.CustomLabelFor(m => m.ParentId, "Hilfe-Seiten:"));
+				ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.ParentId).ToHtmlString());
+				Html.DevExpress().DropDownEdit(t =>
 				{
+					t.Name = "ParentText";
 					t.Width = new Unit(100, UnitType.Percentage);
-				}).Render();
 
-				ViewContext.Writer.Write(Html.CustomLabelFor(m => m.Subcategory, "Unterkategorie:"));
-				ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.Subcategory).ToHtmlString());
-				Html.DevExpress().TextBoxFor(m => m.Subcategory, t =>
-				{
-					t.Width = new Unit(100, UnitType.Percentage);
+					t.SetDropDownWindowTemplateContent(l =>
+					{
+						Html.RenderPartial("~/Views/Misc/_HelpPageTreePartial.cshtml", ViewData["AllHelpPages"]);
+					});
 				}).Render();
 
 				ViewContext.Writer.Write(Html.CustomLabelFor(m => m.DisplayIndex, "Reihenfolge:"));

+ 52 - 12
GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageHtmlEditPartial.cshtml

@@ -2,30 +2,70 @@
 
 @model GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel
 
-@Html.DevExpress().HtmlEditorFor(m => m.Content, t =>
+@Html.DevExpress().HtmlEditor(t =>
 {
-	t.Name = "HelpPageHtmlContentEditor";
+	t.Name = "devHelpPageHtmlContentEditor";
 	t.Width = new Unit(100, UnitType.Percentage);
 	t.Height = new Unit(400, UnitType.Pixel);
+
 	t.SettingsHtmlEditing.AllowHTML5MediaElements = true;
 	t.SettingsHtmlEditing.AllowEditFullDocument = true;
 	t.SettingsHtmlEditing.EnterMode = DevExpress.Web.ASPxHtmlEditor.HtmlEditorEnterMode.Default;
+
+	t.SettingsDialogs.InsertImageDialog.SettingsImageUpload.ValidationSettings.Assign(
+		GreenTree.Nachtragsmanagement.Web.Controllers.MiscController.ImageUploadValidationSettings);
+	t.SettingsDialogs.InsertImageDialog.SettingsImageUpload.UploadCallbackRouteValues = new { Controller = "Misc", Action = "UploadProcessingImageUpload" };
+
 	t.CallbackRouteValues = new { Controller = "Misc", Action = "PartialHtmlEditor" };
-	t.Toolbars.Add(DevExpress.Web.ASPxHtmlEditor.HtmlEditorToolbar.CreateStandardToolbar1());
-	t.Toolbars.Add(DevExpress.Web.ASPxHtmlEditor.HtmlEditorToolbar.CreateStandardToolbar2());
-	t.Toolbars.Add(DevExpress.Web.ASPxHtmlEditor.HtmlEditorToolbar.CreateTableToolbar());
+
 	t.Toolbars.Add(toolbar =>
 	{
+		toolbar.Items.Add(
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarCutButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarCopyButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarPasteButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarPasteFromWordButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarUndoButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarRedoButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarRemoveFormatButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarSuperscriptButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarSubscriptButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertOrderedListButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertUnorderedListButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarIndentButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarOutdentButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertLinkDialogButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarUnlinkButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarInsertImageDialogButton(),
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarTableOperationsDropDownButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarFindAndReplaceDialogButton() { BeginGroup = true },
+			new DevExpress.Web.ASPxHtmlEditor.ToolbarFullscreenButton() { BeginGroup = true });
+
+		if (Model.Id != -1)
+		{
+			toolbar.Items.Add<DevExpress.Web.ASPxHtmlEditor.CustomToolbarButton>(c =>
+			{
+				c.ViewStyle = DevExpress.Web.ASPxHtmlEditor.ViewStyle.Image;
+				c.BeginGroup = true;
+				c.CommandName = "save";
+				c.ToolTip = "Speichern";
+				c.Image.Url = Url.Content("~/Content/Images/save-16.png");
+				c.Image.UrlDisabled = Url.Content("~/Content/Images/save-16-disable.png");
+				c.Image.UrlHottracked = Url.Content("~/Content/Images/save-16-contrast.png");
+			});
+		}
+
 		toolbar.Items.Add<DevExpress.Web.ASPxHtmlEditor.CustomToolbarButton>(c =>
 		{
 			c.ViewStyle = DevExpress.Web.ASPxHtmlEditor.ViewStyle.Image;
-			c.BeginGroup = true;
-			c.CommandName = "save";
-			c.ToolTip = "Speichern";
-			c.Image.Url = Url.Content("~/Content/Images/save-16.png");
-			c.Image.UrlDisabled = Url.Content("~/Content/Images/save-16-disable.png");
-			c.Image.UrlHottracked = Url.Content("~/Content/Images/save-16-contrast.png");
+			c.BeginGroup = Model.Id == -1;
+			c.CommandName = "saveAs";
+			c.ToolTip = "Speichern als";
+			c.Image.Url = Url.Content("~/Content/Images/saveAs-16.png");
+			c.Image.UrlDisabled = Url.Content("~/Content/Images/saveAs-16-disable.png");
+			c.Image.UrlHottracked = Url.Content("~/Content/Images/saveAs-16-contrast.png");
 		});
 	});
+	t.Toolbars.Add(DevExpress.Web.ASPxHtmlEditor.HtmlEditorToolbar.CreateStandardToolbar2());
 	t.ClientSideEvents.CustomCommand = "function (s, e) { onHtmlToolbarCustomCommand(e); }";
-}).GetHtml()
+}).Bind(Model.Content).GetHtml()

+ 19 - 5
GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageTreePartial.cshtml

@@ -1,12 +1,26 @@
-@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageTreeModel>
+@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel>
 
-<style>
+@Html.DevExpress().TreeView(t =>
+{
+	var isSelectionTree = ViewData["IsHelpPageSelectionTree"] != null && (bool)ViewData["IsHelpPageSelectionTree"] == true;
 
+	t.Name = isSelectionTree
+		? "devHelpPageSelectionTree"
+		: "devHelpPageNavigationTree";
 
+	t.Width = new Unit(100, UnitType.Percentage);
+	t.AllowSelectNode = true;
 
-</style>
+	if (isSelectionTree)
+		t.ClientSideEvents.NodeClick = "function (s, e) { setDropDownText(e.node.text); }";
+	else
+		t.ClientSideEvents.NodeClick = "function (s, e) { viewHelpPage(e.node.name); }";
 
-<ul style="min-width: 260px">
+	if (Model != null)
+		GreenTree.Nachtragsmanagement.Web.Controllers.MiscController.CreateHelpPageTree(Model, t.Nodes, null);
+}).GetHtml()
+
+@*<ul style="min-width: 260px">
 	@foreach (var category in Model)
 	{
 		if (category.HelpPageId == -1)
@@ -45,4 +59,4 @@
 			}
 		</ul>
 	}
-</ul>
+</ul>*@

+ 20 - 8
GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageViewPartial.cshtml

@@ -3,14 +3,26 @@
 @model GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel
 
 <div class="helpPageMenu">
-	@Html.DevExpress().Button(b =>
-	{
-		b.Name = "devButtonEditHelpPage";
-		b.Text = "Bearbeiten";
-		b.UseSubmitBehavior = false;
-		b.RenderMode = ButtonRenderMode.Link;
-		b.ClientSideEvents.Click = "function (s, e) { editHelpPage(" + Model.Id + "); }";
-	}).GetHtml()
+	<div style="float: left; overflow: auto">
+		@Html.DevExpress().Button(b =>
+		{
+			b.Name = "devButtonEditHelpPage";
+			b.Text = "Bearbeiten";
+			b.UseSubmitBehavior = false;
+			b.RenderMode = ButtonRenderMode.Link;
+			b.ClientSideEvents.Click = "function (s, e) { editHelpPage(" + Model.Id + "); }";
+		}).GetHtml()
+	</div>
+	<div style="float: left; overflow: auto; margin-left: 16px">
+		@Html.DevExpress().Button(b =>
+		{
+			b.Name = "devButtonDeleteHelpPage";
+			b.Text = "Löschen";
+			b.UseSubmitBehavior = false;
+			b.RenderMode = ButtonRenderMode.Link;
+			b.ClientSideEvents.Click = "function (s, e) { confirmDelete(" + Model.Id + "); }";
+		}).GetHtml()
+	</div>
 </div>
 
 @Html.Raw(Model.Content)