Pārlūkot izejas kodu

HelpPages begonnen!

Arne Diekmann 8 gadi atpakaļ
vecāks
revīzija
8946b8a299
21 mainītis faili ar 813 papildinājumiem un 2 dzēšanām
  1. 17 0
      GreenTree.Nachtragsmanagement.Core/Domain/Misc/HelpPage.cs
  2. 1 0
      GreenTree.Nachtragsmanagement.Core/GreenTree.Nachtragsmanagement.Core.csproj
  3. 4 1
      GreenTree.Nachtragsmanagement.Data/AppendixObjectContext.cs
  4. 1 0
      GreenTree.Nachtragsmanagement.Data/GreenTree.Nachtragsmanagement.Data.csproj
  5. 26 0
      GreenTree.Nachtragsmanagement.Data/Mapping/Misc/HelpPageMap.cs
  6. 38 0
      GreenTree.Nachtragsmanagement.Services/Misc/IMiscService.cs
  7. 62 1
      GreenTree.Nachtragsmanagement.Services/Misc/MiscService.cs
  8. 24 0
      GreenTree.Nachtragsmanagement.Web/App_Start/FunctionConfig.cs
  9. 14 0
      GreenTree.Nachtragsmanagement.Web/App_Start/RouteConfig.cs
  10. BIN
      GreenTree.Nachtragsmanagement.Web/Content/Images/function-Misc-HelpPages-32-contrast.png
  11. BIN
      GreenTree.Nachtragsmanagement.Web/Content/Images/function-Misc-HelpPages-32.png
  12. 0 0
      GreenTree.Nachtragsmanagement.Web/Content/jquery.mCustomScrollbar.min.css
  13. 222 0
      GreenTree.Nachtragsmanagement.Web/Controllers/MiscController.cs
  14. 9 0
      GreenTree.Nachtragsmanagement.Web/GreenTree.Nachtragsmanagement.Web.csproj
  15. 60 0
      GreenTree.Nachtragsmanagement.Web/Models/Misc/HelpPageDataModel.cs
  16. 28 0
      GreenTree.Nachtragsmanagement.Web/Models/Misc/HelpPageTreeModel.cs
  17. 1 0
      GreenTree.Nachtragsmanagement.Web/Scripts/jquery.mCustomScrollbar.concat.min.js
  18. 137 0
      GreenTree.Nachtragsmanagement.Web/Views/Misc/HelpPages.cshtml
  19. 106 0
      GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageEditPartial.cshtml
  20. 48 0
      GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageTreePartial.cshtml
  21. 15 0
      GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageViewPartial.cshtml

+ 17 - 0
GreenTree.Nachtragsmanagement.Core/Domain/Misc/HelpPage.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GreenTree.Nachtragsmanagement.Core.Domain.Misc
+{
+    public class HelpPage : BaseEntity
+    {
+        public string Title { get; set; }
+        public string Category { get; set; }
+        public string Subcategory { get; set; }
+        public string Content { get; set; }
+        public int DisplayIndex { get; set; }
+    }
+}

+ 1 - 0
GreenTree.Nachtragsmanagement.Core/GreenTree.Nachtragsmanagement.Core.csproj

@@ -103,6 +103,7 @@
     <Compile Include="Domain\Logging\LogLevel.cs" />
     <Compile Include="Domain\Misc\ColorMarker.cs" />
     <Compile Include="Domain\Misc\DbContextSpec.cs" />
+    <Compile Include="Domain\Misc\HelpPage.cs" />
     <Compile Include="Domain\Misc\MailNotification.cs" />
     <Compile Include="Domain\Site\Site.cs" />
     <Compile Include="Domain\User\Function.cs" />

+ 4 - 1
GreenTree.Nachtragsmanagement.Data/AppendixObjectContext.cs

@@ -77,6 +77,7 @@ namespace GreenTree.Nachtragsmanagement.Data
             var configItemSet = Set<ConfigItem>();
             var loggingSet = Set<Log>();
             var colorMarkerSet = Set<ColorMarker>();
+            var helpPageSet = Set<HelpPage>();
 
             _dbSets.AddRange(
                 new object[]
@@ -97,7 +98,8 @@ namespace GreenTree.Nachtragsmanagement.Data
                     dbContextSpecSet,
                     configItemSet,
                     loggingSet,
-                    colorMarkerSet
+                    colorMarkerSet,
+                    helpPageSet
                 }
             );
 
@@ -137,6 +139,7 @@ namespace GreenTree.Nachtragsmanagement.Data
             modelBuilder.Configurations.Add(new ConfigItemMap());
             modelBuilder.Configurations.Add(new LogMap());
             modelBuilder.Configurations.Add(new ColorMarkerMap());
+            modelBuilder.Configurations.Add(new HelpPageMap());
 
             base.OnModelCreating(modelBuilder);
         }

+ 1 - 0
GreenTree.Nachtragsmanagement.Data/GreenTree.Nachtragsmanagement.Data.csproj

@@ -64,6 +64,7 @@
     <Compile Include="Mapping\Logging\LogMap.cs" />
     <Compile Include="Mapping\Misc\ColorMarkerMap.cs" />
     <Compile Include="Mapping\Misc\DbContextSpecMap.cs" />
+    <Compile Include="Mapping\Misc\HelpPageMap.cs" />
     <Compile Include="Mapping\Misc\MailNotificationMap.cs" />
     <Compile Include="Mapping\Site\SiteMap.cs" />
     <Compile Include="Mapping\User\FunctionMap.cs" />

+ 26 - 0
GreenTree.Nachtragsmanagement.Data/Mapping/Misc/HelpPageMap.cs

@@ -0,0 +1,26 @@
+using GreenTree.Nachtragsmanagement.Core.Domain.Misc;
+using System;
+using System.Collections.Generic;
+using System.Data.Entity.ModelConfiguration;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace GreenTree.Nachtragsmanagement.Data.Mapping.Misc
+{
+    public class HelpPageMap : EntityTypeConfiguration<HelpPage>
+    {
+        public HelpPageMap()
+        {
+            ToTable("HelpPage");
+
+            HasKey(f => f.Id);
+
+            Property(f => f.Title);
+            Property(f => f.Category);
+            Property(f => f.Subcategory);
+            Property(f => f.Content);
+            Property(f => f.DisplayIndex);
+        }
+    }
+}

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

@@ -46,5 +46,43 @@ namespace GreenTree.Nachtragsmanagement.Services.Misc
         void DeleteMailNotification(MailNotification mailNotification);
 
         #endregion
+
+        #region HelpPages
+
+        /// <summary>
+        /// Gets all helpPages
+        /// </summary>
+        IList<HelpPage> GetAllHelpPages();
+
+        /// <summary>
+        /// Gets a helpPage by specified Id
+        /// </summary>
+        /// <param name="id">HelpPage identifier.</param>
+        HelpPage GetHelpPageById(int id);
+
+        /// <summary>
+        /// Gets all helpPages to the specified ids
+        /// </summary>
+        IList<HelpPage> GetHelpPagesByIds(int[] ids);
+
+        /// <summary>
+        /// Insert a helpPage
+        /// </summary>
+        /// <param name="helpPage">HelpPage.</param>
+        void InsertHelpPage(HelpPage helpPage);
+
+        /// <summary>
+        /// Update a helpPage
+        /// </summary>
+        /// <param name="helpPage">HelpPage.</param>
+        void UpdateHelpPage(HelpPage helpPage);
+
+        /// <summary>
+        /// Delete a helpPage
+        /// </summary>
+        /// <param name="helpPage">HelpPage.</param>
+        void DeleteHelpPage(HelpPage helpPage);
+
+        #endregion
     }
 }

+ 62 - 1
GreenTree.Nachtragsmanagement.Services/Misc/MiscService.cs

@@ -13,6 +13,7 @@ namespace GreenTree.Nachtragsmanagement.Services.Misc
         #region Fields
 
         private readonly IRepository<MailNotification> _mailNotificationRepository;
+        private readonly IRepository<HelpPage> _helpPageRepository;
 
         #endregion
 
@@ -22,9 +23,11 @@ namespace GreenTree.Nachtragsmanagement.Services.Misc
         /// Initializes a new instance of the MiscService class
         /// </summary>
         public MiscService(
-            IRepository<MailNotification> mailNotificationRepository)
+            IRepository<MailNotification> mailNotificationRepository,
+            IRepository<HelpPage> helpPageRepository)
         {
             _mailNotificationRepository = mailNotificationRepository;
+            _helpPageRepository = helpPageRepository;
         }
 
         #endregion
@@ -86,5 +89,63 @@ namespace GreenTree.Nachtragsmanagement.Services.Misc
         }
 
         #endregion
+
+        #region HelpPage
+
+        /// <summary>
+        /// Gets all helpPages
+        /// </summary>
+        public IList<HelpPage> GetAllHelpPages()
+        {
+            return _helpPageRepository.Table.ToList();
+        }
+
+        /// <summary>
+        /// Gets a helpPage by specified Id
+        /// </summary>
+        /// <param name="id">HelpPage identifier.</param>
+        public HelpPage GetHelpPageById(int id)
+        {
+            return _helpPageRepository.GetById(id);
+        }
+
+        /// <summary>
+        /// Gets all helpPages to the specified ids
+        /// </summary>
+        public IList<HelpPage> GetHelpPagesByIds(int[] ids)
+        {
+            return _helpPageRepository.Table
+                .Where(u => ids.Contains(u.Id))
+                .ToList();
+        }
+
+        /// <summary>
+        /// Insert a helpPage
+        /// </summary>
+        /// <param name="helpPage">HelpPage.</param>
+        public void InsertHelpPage(HelpPage helpPage)
+        {
+            _helpPageRepository.Insert(helpPage);
+        }
+
+        /// <summary>
+        /// Update a helpPage
+        /// </summary>
+        /// <param name="helpPage">HelpPage.</param>
+        public void UpdateHelpPage(HelpPage helpPage)
+        {
+            _helpPageRepository.Update(helpPage);
+        }
+
+        /// <summary>
+        /// Delete a helpPage
+        /// </summary>
+        /// <param name="helpPage">HelpPage.</param>
+        public void DeleteHelpPage(HelpPage helpPage)
+        {
+            _helpPageRepository.Delete(helpPage);
+        }
+
+        #endregion
     }
 }

+ 24 - 0
GreenTree.Nachtragsmanagement.Web/App_Start/FunctionConfig.cs

@@ -354,6 +354,30 @@ namespace GreenTree.Nachtragsmanagement.Web.App_Start
                     Plugin = "System"
                 },
                 new Function
+                {
+                    Name = "Misc-HelpPages",
+                    Description = "Hilfe",
+                    ImageUrl = "~/Content/Images/function-Misc-HelpPages-32.png",
+                    GroupName = "Misc",
+                    RouteName = "GreenTree.Nachtragsmanagement.Web.Misc.HelpPages",
+                    IsMenuMember = true,
+                    Plugin = "System",
+                    BaseWidth = 1000,
+                    MinWidth = 700,
+                    BaseHeight = 600,
+                    MinHeight = 450,
+                    AllowMaximize = true,
+                    MaximizedOnStart = true
+                },
+                new Function
+                {
+                    Name = "Misc-HelpPages-Edit",
+                    Description = "Hilfe editieren",
+                    GroupName = "Misc-HelpPages",
+                    IsMenuMember = false,
+                    Plugin = "System"
+                },
+                new Function
                 {
                     Name = "Misc-Logs",
                     Description = "Logs",

+ 14 - 0
GreenTree.Nachtragsmanagement.Web/App_Start/RouteConfig.cs

@@ -146,6 +146,20 @@ namespace GreenTree.Nachtragsmanagement.Web
                }
             );
 
+            routes.MapRoute(
+                "GreenTree.Nachtragsmanagement.Web.Misc.HelpPages",
+                "misc/viewhelppages",
+               new
+               {
+                   controller = "Misc",
+                   action = "ViewHelpPages"
+               },
+               new[]
+               {
+                    "GreenTree.Nachtragsmanagement.Web.Controllers"
+               }
+            );
+
             routes.MapRoute(
                 "GreenTree.Nachtragsmanagement.Web.Misc.Logs",
                 "misc/viewlogs",

BIN
GreenTree.Nachtragsmanagement.Web/Content/Images/function-Misc-HelpPages-32-contrast.png


BIN
GreenTree.Nachtragsmanagement.Web/Content/Images/function-Misc-HelpPages-32.png


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
GreenTree.Nachtragsmanagement.Web/Content/jquery.mCustomScrollbar.min.css


+ 222 - 0
GreenTree.Nachtragsmanagement.Web/Controllers/MiscController.cs

@@ -642,5 +642,227 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
         }
 
         #endregion
+
+        #region HelpPages
+
+        /// <summary>
+        /// Basic helpPage view function
+        /// </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();
+
+            foreach (var categoryPageModel in categoryPageModels)
+            {
+                helpPageTreeModelList.Add(new HelpPageTreeModel
+                {
+                    Text = categoryPageModel.Title,
+                    HelpPageId = categoryPageModel.Id
+                });
+            }
+
+            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
+                    };
+
+                    categoryTreeModel.Elements.Add(subcategoryTreePageModel);
+                }
+
+                var subcategoryModels = helpPageModels
+                    .Where(p => p.Category == categoryModel.Key && !String.IsNullOrEmpty(p.Subcategory))
+                    .OrderBy(p => p.DisplayIndex)
+                    .GroupBy(p => p.Subcategory)
+                    .ToList();
+
+                foreach (var subcategoryModel in subcategoryModels)
+                {
+                    var subcategoryTreeModel = new HelpPageTreeModel
+                    {
+                        Text = subcategoryModel.Key
+                    };
+
+                    categoryTreeModel.Elements.Add(subcategoryTreeModel);
+
+                    var subcategoryHelpPageModels = helpPageModels
+                        .Where(p => p.Category == categoryModel.Key && p.Subcategory == subcategoryModel.Key)
+                        .OrderBy(p => p.DisplayIndex)
+                        .ToList();
+
+                    foreach (var subcategoryHelpPageModel in subcategoryHelpPageModels)
+                    {
+                        var helpPageTreeModel = new HelpPageTreeModel
+                        {
+                            Text = subcategoryHelpPageModel.Title,
+                            HelpPageId = subcategoryHelpPageModel.Id
+                        };
+
+                        subcategoryTreeModel.Elements.Add(helpPageTreeModel);
+                    }
+                }
+            }
+
+            return View("~/Views/Misc/HelpPages.cshtml", helpPageTreeModelList);
+        }
+
+        /// <summary>
+        /// Get JSON data of specific helpPage
+        /// </summary>
+        /// <param name="id">HelpPage id.</param>
+        public ActionResult GetHelpPage(int id = -1)
+        {
+            var helpPage = _miscService.GetHelpPageById(id);
+            if (helpPage == null)
+                return new JsonResult
+                {
+                    Data = "notFound",
+                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
+                };
+
+            var helpPageModel = HelpPageDataModel.FromHelpPage(helpPage, false);
+
+            return new JsonResult
+            {
+                Data = JsonConvert.SerializeObject(helpPageModel),
+                JsonRequestBehavior = JsonRequestBehavior.AllowGet
+            };
+        }
+
+        /// <summary>
+        /// Partial edit for editing of existing or for new helpPage
+        /// </summary>
+        /// <param name="id">Id for existing helpPage, otherweise -1.</param>
+        public ActionResult ViewHelpPage(int id = -1)
+        {
+            var helpPage = _miscService.GetHelpPageById(id);
+            var helpPageModel = HelpPageDataModel.FromHelpPage(helpPage, true);
+
+            if (helpPage != null)
+                return PartialView("~/Views/Misc/_HelpPageViewPartial.cshtml", helpPageModel);
+
+            return new EmptyResult();
+        }
+
+        /// <summary>
+        /// Partial edit for editing of existing or for new helpPage
+        /// </summary>
+        /// <param name="id">Id for existing helpPage, otherweise -1.</param>
+        public ActionResult EditHelpPage(int id = -1)
+        {
+            var helpPage = _miscService.GetHelpPageById(id);
+            var helpPageModel = HelpPageDataModel.FromHelpPage(helpPage, true);
+
+            return PartialView("~/Views/Misc/_HelpPageEditPartial.cshtml", helpPageModel);
+        }
+
+        /// <summary>
+        /// Partial edit result if ModelState is valid, otherwise simple JSON result for success
+        /// </summary>
+        /// <param name="helpPageModel">HelpPage model to be saved.</param>
+        [HttpPost, ValidateInput(false)]
+        public ActionResult EditHelpPage(HelpPageDataModel helpPageModel)
+        {
+            try
+            {
+                if (!ModelState.IsValid)
+                    return PartialView("~/Views/Misc/_HelpPageEditPartial.cshtml", helpPageModel);
+
+                if (helpPageModel.Id == -1)
+                {
+                    var helpPage = helpPageModel.ToHelpPage();
+
+                    _miscService.InsertHelpPage(helpPage);
+
+                    _logger.Entity(helpPage, Core.Domain.Logging.LogEntityActivity.Insert, _userHelper.FromCookies());
+                }
+                else
+                {
+                    var helpPage = _miscService.GetHelpPageById(helpPageModel.Id);
+
+                    helpPage.Title = helpPageModel.Title;
+                    helpPage.Content = helpPageModel.Content;
+                    helpPage.Category = helpPage.Category;
+                    helpPage.Subcategory = helpPage.Subcategory;
+                    helpPage.DisplayIndex = helpPage.DisplayIndex;
+
+                    _miscService.UpdateHelpPage(helpPage);
+
+                    _logger.Entity(helpPage, Core.Domain.Logging.LogEntityActivity.Update, _userHelper.FromCookies());
+                }
+
+                return new JsonResult
+                {
+                    Data = "success"
+                };
+            }
+            catch (Exception ex)
+            {
+                _logger.Error("Fehler bei Speicherung einer Hilfe-Seite.", ex, _userHelper.FromCookies());
+
+                return PartialView("~/Views/Shared/_PopupError.cshtml", ex);
+            }
+        }
+
+        /// <summary>
+        /// Simple JSON result for deleting a specific helpPage
+        /// </summary>
+        /// <param name="id">HelpPage id.</param>
+        [HttpPost]
+        public ActionResult DeleteHelpPage(int id)
+        {
+            try
+            {
+                var helpPage = _miscService.GetHelpPageById(id);
+
+                if (helpPage != null)
+                    _miscService.DeleteHelpPage(helpPage);
+
+                return new JsonResult
+                {
+                    Data = "success"
+                };
+            }
+            catch (Exception ex)
+            {
+                _logger.Error("Fehler bei Löschung einer Hilfe-Seite.", ex, _userHelper.FromCookies());
+
+                return PartialView("~/Views/Shared/_PopupError.cshtml", ex);
+            }
+        }
+
+        #endregion
     }
 }

+ 9 - 0
GreenTree.Nachtragsmanagement.Web/GreenTree.Nachtragsmanagement.Web.csproj

@@ -169,6 +169,7 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
+    <Content Include="Content\Images\function-Misc-HelpPages-32.png" />
     <Content Include="Content\devex.css" />
     <Content Include="Content\function.css" />
     <Content Include="Content\global.css" />
@@ -218,6 +219,7 @@
     <Content Include="Content\Images\user-24.png" />
     <Content Include="Content\jquery-ui.css" />
     <Content Include="Content\jquery-ui.min.css" />
+    <Content Include="Content\jquery.mCustomScrollbar.min.css" />
     <Content Include="Content\login.css" />
     <Content Include="Global.asax" />
     <Content Include="Scripts\ace.js" />
@@ -236,6 +238,7 @@
     <Content Include="Scripts\jquery-cron-min.js" />
     <Content Include="Scripts\jquery-ui-1.11.4.js" />
     <Content Include="Scripts\jquery-ui-1.11.4.min.js" />
+    <Content Include="Scripts\jquery.mCustomScrollbar.concat.min.js" />
     <Content Include="Scripts\jquery.unobtrusive-ajax.js" />
     <Content Include="Scripts\jquery.unobtrusive-ajax.min.js" />
     <Content Include="Scripts\jquery.validate.js" />
@@ -341,6 +344,10 @@
     <Content Include="Views\Appendices\_AppendixDeviationsPartial.cshtml" />
     <Content Include="Views\Deviations\_DeviationDataRowPartial.cshtml" />
     <Content Include="Views\Sites\_SiteDeviationDescriptionPartial.cshtml" />
+    <Content Include="Views\Misc\HelpPages.cshtml" />
+    <Content Include="Views\Misc\_HelpPageTreePartial.cshtml" />
+    <Content Include="Views\Misc\_HelpPageEditPartial.cshtml" />
+    <Content Include="Views\Misc\_HelpPageViewPartial.cshtml" />
     <None Include="Web.Debug.config">
       <DependentUpon>Web.config</DependentUpon>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -365,6 +372,8 @@
     <Compile Include="Models\Config\ConfigItemDataModel.cs" />
     <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" />

+ 60 - 0
GreenTree.Nachtragsmanagement.Web/Models/Misc/HelpPageDataModel.cs

@@ -0,0 +1,60 @@
+using GreenTree.Nachtragsmanagement.Core.Domain.Misc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace GreenTree.Nachtragsmanagement.Web.Models.Misc
+{
+    public class HelpPageDataModel
+    {
+        public int Id { get; set; }
+        public string Title { get; set; }
+        public string Category { get; set; }
+        public string Subcategory { get; set; }
+        public string Content { get; set; }
+        public int DisplayIndex { get; set; }
+
+        public HelpPageDataModel()
+        {
+
+        }
+
+        public static HelpPageDataModel FromHelpPage(Core.Domain.Misc.HelpPage helpPageEntity, bool newWhenIsNull)
+        {
+            if (helpPageEntity == null && newWhenIsNull)
+                return new HelpPageDataModel
+                {
+                    Id = -1,
+                };
+
+            if (helpPageEntity == null && !newWhenIsNull)
+                throw new ArgumentNullException("helpPageEntity", "Cannot create HelpPageDataModel from NULL helpPage entity.");
+
+            var helpPageDataModel = new HelpPageDataModel
+            {
+                Id = helpPageEntity.Id,
+                Title = helpPageEntity.Title,
+                Category = helpPageEntity.Category,
+                Subcategory = helpPageEntity.Subcategory,
+                Content = helpPageEntity.Content,
+                DisplayIndex = helpPageEntity.DisplayIndex
+            };
+
+            return helpPageDataModel;
+        }
+
+        public Core.Domain.Misc.HelpPage ToHelpPage()
+        {
+            return new Core.Domain.Misc.HelpPage
+            {
+                Id = this.Id,
+                Title = this.Title,
+                Category = this.Category,
+                Subcategory = this.Subcategory,
+                Content = this.Content,
+                DisplayIndex = this.DisplayIndex
+            };
+        }
+    }
+}

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

@@ -0,0 +1,28 @@
+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
+    }
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 0
GreenTree.Nachtragsmanagement.Web/Scripts/jquery.mCustomScrollbar.concat.min.js


+ 137 - 0
GreenTree.Nachtragsmanagement.Web/Views/Misc/HelpPages.cshtml

@@ -0,0 +1,137 @@
+@{
+	Layout = "~/Views/Shared/_FunctionLayout.cshtml";
+}
+
+@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageTreeModel>
+
+<script src='@Url.Content("~/Scripts/jquery.mCustomScrollbar.concat.min.js")'></script>
+<script>
+	$(document).ready(function () {
+		setTimeout(function () {
+			setHelpContentHeight();
+		}, 500);
+	});
+
+	$(window).resize(function () {
+		setHelpContentHeight();
+	});
+
+	function setHelpContentHeight() {
+		var height = $(window).height() - 50;
+		$("#helpPageNavigation").height(height);
+		$("#helpPageContent").height(height);
+	}
+
+	function viewHelpPage(id) {
+		if (!id) return;
+		$.ajax({
+			url: '@Url.Action("ViewHelpPage", "Misc")',
+			data: { Id: id },
+			success: function (response) {
+				setTimeout(function () {
+					$("#helpPageContent").html(response);
+				}, 200);
+			},
+			error: function () {
+				 alert("error occured");
+			}
+		});
+	}
+
+	function editHelpPage(id) {
+		if (!id) return;
+		$.ajax({
+			url: '@Url.Action("EditHelpPage", "Misc")',
+			data: { Id: id },
+			success: function (response) {
+				setTimeout(function () {
+					$("#helpPageContent").html(response);
+				}, 200);
+			},
+			error: function () {
+				 alert("error occured");
+			}
+		});
+	}
+</script>
+
+<link rel="stylesheet" type="text/css" href='@Url.Content("~/Content/jquery.mCustomScrollbar.min.css")' />
+
+<style>
+
+	.helpTable {
+		width: 100%;
+	}
+
+	.helpTable > tbody > tr > td {
+		vertical-align: top;
+	}
+
+	.helpTable > tbody > tr > td:first-of-type {
+		padding-right: 12px;
+	}
+
+	.helpTable > tbody > tr > td:last-of-type {
+		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;
+	}
+
+	#helpPageNavigation {
+		border-right: 1px solid #009688;
+	}
+
+</style>
+
+<table class="helpTable">
+	<tr>
+		<td  style="width: 20%">
+			<div class="helpPageMenu">
+				@Html.DevExpress().Button(b =>
+				{
+					b.Name = "devButtonNewHelpPage";
+					b.Text = "Neu";
+					b.UseSubmitBehavior = false;
+					b.RenderMode = ButtonRenderMode.Link;
+					b.ClientSideEvents.Click = "function (s, e) { editHelpPage(-1); }";
+				}).GetHtml()
+			</div>
+			<div id="helpPageNavigation" class="mCustomScrollbar" data-mcs-theme="minimal-dark" style="width: 100%">
+				@Html.Partial("~/Views/Misc/_HelpPageTreePartial.cshtml", Model)
+			</div>
+		</td>
+		<td style="width: 80%">
+			<div id="helpPageContent" class="mCustomScrollbar" data-mcs-theme="minimal-dark" style="width: 100%">
+
+			</div>
+		</td>
+	</tr>
+</table>

+ 106 - 0
GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageEditPartial.cshtml

@@ -0,0 +1,106 @@
+@using GreenTree.Nachtragsmanagement.Web.Extensions
+
+@model GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel
+
+<div class="helpPageEditContainer">
+
+	<script>
+		function saveHelpPage() {
+			var form = $("#helpPageEditForm");
+			$(form).submit(function (e) {
+				$.ajax({
+					type: "POST",
+					url: '@Url.Action("EditHelpPage", "Misc")',
+					data: form.serialize(),
+					success: function (response) {
+						setTimeout(function () {
+							$(".helpPageEditFormEditContainer").remove();
+							if (response == "success") {
+								parent.callCustomEventListener('HelpPageDataCallbackEventReceiver');
+							} else {
+								$("body").append(response);
+							}
+						}, 200);
+					}
+				});
+				e.preventDefault();
+			});
+			form.submit();
+		}
+	</script>
+
+	@Html.DevExpress().HtmlEditorFor(m => m.Content).GetHtml()
+
+	@Html.DevExpress().PopupControl(s =>
+	{
+		s.Name = "devPopupControlEditHelpPage";
+
+		if (Model.Id == -1)
+			s.HeaderText = "Neue Hilfe-Seite erstellen";
+		else
+			s.HeaderText = "\"" + Model.Title + "\" bearbeiten";
+
+		s.Modal = true;
+		s.Width = new Unit(250, UnitType.Pixel);
+		s.CloseAction = CloseAction.CloseButton;
+		s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
+		s.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
+		s.AllowDragging = false;
+		s.AllowResize = false;
+		s.ShowFooter = false;
+		s.ShowOnPageLoad = false;
+		s.SetContent(() =>
+		{
+			using (Html.BeginForm("EditHelpPage", "Misc", FormMethod.Post, new { id = "helpPageEditForm" }))
+			{
+				ViewContext.Writer.Write("<div class='editFormWrapper'>");
+
+				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.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 =>
+				{
+					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.Title, t =>
+				{
+					t.Width = new Unit(100, UnitType.Percentage);
+				}).Render();
+
+				ViewContext.Writer.Write(Html.CustomLabelFor(m => m.DisplayIndex, "Reihenfolge:"));
+				ViewContext.Writer.Write(Html.ValidationMessageFor(m => m.DisplayIndex).ToHtmlString());
+				Html.DevExpress().SpinEditFor(m => m.DisplayIndex, t =>
+				{
+					t.Width = new Unit(100, UnitType.Percentage);
+					t.Number = 0;
+					t.Properties.NumberType = SpinEditNumberType.Integer;
+				}).Render();
+
+				ViewContext.Writer.Write("</div>");
+
+				Html.RenderPartial(
+					"~/Views/Shared/_PopupButtonPanel.cshtml",
+					new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
+					{
+						PopupName = "devPopupControlEditHelpPage",
+						AcceptFunction = "function (s, e) { saveHelpPage(); }"
+					}
+				);
+			}
+		});
+		s.Styles.Content.Paddings.Padding = new Unit(0);
+		s.Styles.ModalBackground.Opacity = 0;
+	}).GetHtml()
+
+</div>

+ 48 - 0
GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageTreePartial.cshtml

@@ -0,0 +1,48 @@
+@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageTreeModel>
+
+<style>
+
+
+
+</style>
+
+<ul style="min-width: 260px">
+	@foreach (var category in Model)
+	{
+		if (category.HelpPageId == -1)
+		{
+			<li>@category.Text</li>
+		}
+		else
+		{
+			<li>
+				<a href="#" title="@category.Text" onclick="viewHelpPage(@category.HelpPageId)">@category.Text</a>
+			</li>
+		}
+
+		<ul>
+			@foreach (var subcategory in category.Elements)
+			{
+				if (subcategory.HelpPageId == -1)
+				{
+					<li>@subcategory.Text</li>
+				}
+				else
+				{
+					<li>
+						<a href="#" title="@subcategory.Text" onclick="viewHelpPage(@subcategory.HelpPageId)">@subcategory.Text</a>
+					</li>
+				}
+
+				<ul>
+					@foreach (var helpPage in subcategory.Elements)
+					{
+						<li>
+							<a href="#" title="@helpPage.Text" onclick="viewHelpPage(@helpPage.HelpPageId)">@helpPage.Text</a>
+						</li>
+					}
+				</ul>
+			}
+		</ul>
+	}
+</ul>

+ 15 - 0
GreenTree.Nachtragsmanagement.Web/Views/Misc/_HelpPageViewPartial.cshtml

@@ -0,0 +1,15 @@
+@using GreenTree.Nachtragsmanagement.Web.Extensions
+
+@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>
+

Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels