Przeglądaj źródła

Erste Funktionen der Benutzerverwaltung fertiggestellt.

Arne Diekmann 8 lat temu
rodzic
commit
f0f02dc25f

+ 2 - 1
GreenTree.Nachtragsmanagement.Web/Content/devex.css

@@ -21,4 +21,5 @@
 .devExBorderTopSmall { border-top-width: 1px !important; }
 .devExBorderBottom { border-bottom-style: solid !important; }
 .devExBorderBottomGray { border-bottom-color: #D9D9D9 !important; }
-.devExBorderBottomSmall { border-bottom-width: 1px !important; }
+.devExBorderBottomSmall { border-bottom-width: 1px !important; }
+.devExAllowDrag { cursor: move; }

+ 12 - 1
GreenTree.Nachtragsmanagement.Web/Content/global.css

@@ -12,16 +12,23 @@ h1, h2, h3, h4, h5, h6 {
     color: #009688;
 }
 
+.homeContainer {
+    width: 100%;
+    margin: 0;
+}
+
 .functionNavigationContainer {
     width: 270px;
     overflow: auto;
     background-color: #FAFAFA;
     border: 1px solid #D9D9D9;
     float: left;
+    padding: 0;
 }
 
 .functionContentContainer {
-    float: left;
+    width: 100%;
+    padding: 0;
 }
 
 .functionHeader {
@@ -47,6 +54,10 @@ h1, h2, h3, h4, h5, h6 {
     margin-left: 16px;
 }
 
+.editFormWrapper {
+    padding: 12px 12px 18px;
+}
+
 .popupButtonPanel {
     width: 100%;
     background-color: #e5e5e5;

+ 77 - 2
GreenTree.Nachtragsmanagement.Web/Controllers/AdminController.cs

@@ -1,4 +1,7 @@
-using System;
+using GreenTree.Nachtragsmanagement.Core.Authentication;
+using GreenTree.Nachtragsmanagement.Services.User;
+using GreenTree.Nachtragsmanagement.Web.Models.Admin.User;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
@@ -8,22 +11,94 @@ namespace GreenTree.Nachtragsmanagement.Web.Controllers
 {
     public class AdminController : Controller
     {
+        private readonly IUserService _userService;
+        private readonly IUserHelper _userHelper;
+
+        public AdminController(
+            IUserService userService,
+            IUserHelper userHelper)
+        {
+            _userService = userService;
+            _userHelper = userHelper;
+        }
+
+        #region Users
+
         // GET: Admin Users
         public ActionResult ViewUsers()
         {
-            return View("~/Views/Admin/Users/View.cshtml");
+            var users = _userService.GetAllUsers();
+            var userModels = users
+                .Select(u => UserDataModel.FromUser(u, false));
+
+            return View("~/Views/Admin/Users/View.cshtml", userModels);
+        }
+
+        public ActionResult EditUser(int id = -1)
+        {
+            var user = _userService.GetUserById(id);
+            var userModel = UserDataModel.FromUser(user, true);
+
+            return PartialView("~/Views/Admin/Users/_UserEditPartial.cshtml", userModel);
+        }
+
+        [HttpPost, ValidateInput(false)]
+        public ActionResult EditUser(UserDataModel userModel)
+        {
+            if (!ModelState.IsValid)
+                return PartialView("~/Views/Admin/Users/_UserEditPartial.cshtml", userModel);
+
+            if (userModel.Id == -1)
+            {
+                var user = userModel.ToUser();
+
+                _userService.InsertUser(user);
+            }
+            else
+            {
+                var user = _userService.GetUserById(userModel.Id);
+
+                user.CustomNumber = userModel.CustomerNumber;
+                user.Forename = userModel.Forename;
+                user.Lastname = userModel.Lastname;
+                user.MailAddress = userModel.MailAddress;
+
+                _userService.UpdateUser(user);
+            }
+
+            return RedirectToAction("ViewUsers");
+        }
+
+        public ActionResult DeleteUser(int id)
+        {
+            var user = _userService.GetUserById(id);
+
+            if (user != null)
+                _userService.DeleteUser(user);
+
+            return RedirectToAction("ViewUsers");
         }
 
+        #endregion
+
+        #region Roles
+
         // GET: Admin Roles
         public ActionResult ViewRoles()
         {
             return View("~/Views/Admin/Roles/View.cshtml");
         }
 
+        #endregion
+
+        #region Plugins
+
         // GET: Admin Plugins
         public ActionResult ViewPlugins()
         {
             return View("~/Views/Admin/Plugins/View.cshtml");
         }
+
+        #endregion
     }
 }

+ 0 - 1
GreenTree.Nachtragsmanagement.Web/Controllers/HomeController.cs

@@ -8,7 +8,6 @@ using GreenTree.Nachtragsmanagement.Services.Test;
 using GreenTree.Nachtragsmanagement.Services.User;
 using GreenTree.Nachtragsmanagement.Web.Framework;
 using GreenTree.Nachtragsmanagement.Web.Models.Test;
-using GreenTree.Nachtragsmanagement.Web.Models.User;
 using Newtonsoft.Json;
 using GreenTree.Nachtragsmanagement.Core.Plugins;
 using GreenTree.Nachtragsmanagement.Core;

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

@@ -218,6 +218,9 @@
     <Content Include="Views\Admin\Plugins\View.cshtml" />
     <Content Include="Views\Admin\Roles\View.cshtml" />
     <Content Include="Views\Admin\Users\View.cshtml" />
+    <Content Include="Views\Admin\Users\_UserGridPartial.cshtml" />
+    <Content Include="Views\Admin\Users\_UserEditPartial.cshtml" />
+    <Content Include="Views\Global\SuccessMessage.cshtml" />
     <None Include="Web.Debug.config">
       <DependentUpon>Web.config</DependentUpon>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
@@ -240,19 +243,18 @@
     <Compile Include="Global.asax.cs">
       <DependentUpon>Global.asax</DependentUpon>
     </Compile>
+    <Compile Include="Models\Admin\User\UserDataModel.cs" />
     <Compile Include="Models\Global\FooterModel.cs" />
     <Compile Include="Models\Global\PopupModel.cs" />
     <Compile Include="Models\Home\HomeModel.cs" />
     <Compile Include="Models\Login\LoginModel.cs" />
     <Compile Include="Models\Test\DbRelationModel.cs" />
     <Compile Include="Models\Test\PluginModel.cs" />
-    <Compile Include="Models\User\UserModel.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="App_Data\" />
     <Folder Include="Fonts\" />
-    <Folder Include="Models\Admin\" />
     <Folder Include="Views\Auth\" />
   </ItemGroup>
   <ItemGroup>

+ 49 - 0
GreenTree.Nachtragsmanagement.Web/Models/Admin/User/UserDataModel.cs

@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+
+namespace GreenTree.Nachtragsmanagement.Web.Models.Admin.User
+{
+    public class UserDataModel
+    {
+        public int Id { get; set; }
+        public string CustomerNumber { get; set; }
+        public string Forename { get; set; }
+        public string Lastname { get; set; }
+        public string MailAddress { get; set; }
+
+        public static UserDataModel FromUser(Core.Domain.User.User userEntity, bool newWhenUserIsNull)
+        {
+            if (userEntity == null && newWhenUserIsNull)
+                return new UserDataModel
+                {
+                    Id = -1
+                };
+
+            if (userEntity == null && !newWhenUserIsNull)
+                throw new ArgumentNullException("userEntity", "Cannot create UserDataModel from NULL user entity.");
+
+            return new UserDataModel
+            {
+                Id = userEntity.Id,
+                CustomerNumber = userEntity.CustomNumber,
+                Forename = userEntity.Forename,
+                Lastname = userEntity.Lastname,
+                MailAddress = userEntity.MailAddress
+            };
+        }
+
+        public Core.Domain.User.User ToUser()
+        {
+            return new Core.Domain.User.User
+            {
+                Id = this.Id,
+                CustomNumber = this.CustomerNumber,
+                Forename = this.Forename,
+                Lastname = this.Lastname,
+                MailAddress = this.MailAddress,
+            };
+        }
+    }
+}

+ 0 - 15
GreenTree.Nachtragsmanagement.Web/Models/User/UserModel.cs

@@ -1,15 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Web;
-
-namespace GreenTree.Nachtragsmanagement.Web.Models.User
-{
-    public class UserModel
-    {
-        public int CustomId { get; set; }
-        public string Forename { get; set; }
-        public string Lastname { get; set; }
-        public string MailAddress { get; set; }
-    }
-}

+ 1 - 3
GreenTree.Nachtragsmanagement.Web/Views/Admin/Plugins/View.cshtml

@@ -1,5 +1,3 @@
 @{
     Layout = "~/Views/Shared/_FunctionLayout.cshtml";
-}
-
-<h2>Plugins</h2>
+}

+ 1 - 3
GreenTree.Nachtragsmanagement.Web/Views/Admin/Roles/View.cshtml

@@ -1,5 +1,3 @@
 @{
     Layout = "~/Views/Shared/_FunctionLayout.cshtml";
-}
-
-<h2>Roles</h2>
+}

+ 3 - 1
GreenTree.Nachtragsmanagement.Web/Views/Admin/Users/View.cshtml

@@ -2,4 +2,6 @@
     Layout = "~/Views/Shared/_FunctionLayout.cshtml";
 }
 
-<h2>Users</h2>
+@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Admin.User.UserDataModel>
+
+@Html.Partial("~/Views/Admin/Users/_UserGridPartial.cshtml", Model)

+ 55 - 0
GreenTree.Nachtragsmanagement.Web/Views/Admin/Users/_UserEditPartial.cshtml

@@ -0,0 +1,55 @@
+@model GreenTree.Nachtragsmanagement.Web.Models.Admin.User.UserDataModel
+
+<div class="userEditPopupContainer">
+	@Html.DevExpress().PopupControl(s =>
+{
+	s.Name = "devPopupControlEditUser";
+
+	if (Model.Id == -1)
+		s.HeaderText = "Neuen Benutzer erstellen";
+	else
+		s.HeaderText = Model.Lastname + ", " + Model.Forename + " bearbeiten";
+
+	s.Modal = false;
+	s.Width = new Unit(350, UnitType.Pixel);
+	s.CloseAction = CloseAction.CloseButton;
+	s.ShowOnPageLoad = true;
+	s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
+	s.PopupVerticalAlign = PopupVerticalAlign.WindowCenter;
+	s.AllowDragging = false;
+	s.AllowResize = false;
+	s.ShowFooter = false;
+	s.SetContent(() =>
+	{
+		using (Html.BeginForm("EditUser", "Admin", FormMethod.Post))
+		{
+			ViewContext.Writer.Write("<div class=\"editFormWrapper\">");
+
+			ViewContext.Writer.Write("<input type=\"hidden\" value=\"" + Model.Id + "\" id=\"Id\" name=\"Id\" />");
+
+			ViewContext.Writer.Write("<div>Personalnummer</div>");
+			Html.DevExpress().TextBoxFor(m => m.CustomerNumber, t => { t.Width = new Unit(100, UnitType.Percentage); }).Render();
+
+			ViewContext.Writer.Write("<div>Vorname</div>");
+			Html.DevExpress().TextBoxFor(m => m.Forename, t => { t.Width = new Unit(100, UnitType.Percentage); }).Render();
+
+			ViewContext.Writer.Write("<div>Nachname</div>");
+			Html.DevExpress().TextBoxFor(m => m.Lastname, t => { t.Width = new Unit(100, UnitType.Percentage); }).Render();
+
+			ViewContext.Writer.Write("<div>Mail-Adresse</div>");
+			Html.DevExpress().TextBoxFor(m => m.MailAddress, t => { t.Width = new Unit(100, UnitType.Percentage); }).Render();
+
+			ViewContext.Writer.Write("</div>");
+
+			Html.RenderPartial(
+				"~/Views/Shared/_PopupButtonPanel.cshtml",
+				new GreenTree.Nachtragsmanagement.Web.Models.Global.PopupModel
+				{
+					PopupName = "devPopupControlEditUser",
+					AcceptFunctionName = ""
+				});
+		}
+	});
+	s.Styles.Content.Paddings.Padding = new Unit(0);
+}).GetHtml()
+</div>

+ 72 - 0
GreenTree.Nachtragsmanagement.Web/Views/Admin/Users/_UserGridPartial.cshtml

@@ -0,0 +1,72 @@
+@model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Admin.User.UserDataModel>
+
+<script>
+	function editUser(id) {
+		if (!id) return;
+		$(".userEditPopupContainer").remove();
+		$.ajax({
+			url: '@Url.Action("EditUser", "Admin")',
+			data: { Id: id },
+			success: function (response) {
+				 $("body").append(response);
+			},
+			error: function () {
+				 alert("error occured");
+			}
+		});
+	}
+</script>
+
+@Html.DevExpress().GridView(
+	settings =>
+	{
+		settings.Name = "devGridViewUser";
+		settings.KeyFieldName = "ID";
+		settings.CallbackRouteValues = new { Controller = "Admin", Action = "ViewUsers" };
+		settings.Width = Unit.Percentage(100);
+
+		settings.Columns.Add(column => {
+			column.Caption = "#";
+			column.SetDataItemTemplateContent(c =>
+			{
+				ViewContext.Writer.Write(
+					"<a href=\"#\" onclick=\"editUser(" + DataBinder.Eval(c.DataItem, "Id") + ")\">Bearbeiten</a>&nbsp;" +
+					Html.ActionLink("Löschen", "",
+						new { Id = DataBinder.Eval(c.DataItem, "Id") },
+						new { onclick = "return confirm('Möchten Sie den Benutzer wirklich löschen?')" })
+				);
+			});
+			column.SetHeaderTemplateContent(c =>
+			{
+				ViewContext.Writer.Write(
+					"<a href=\"#\" onclick=\"editUser(-1)\">Neu</a>&nbsp;");
+			});
+			column.Settings.AllowDragDrop = DefaultBoolean.False;
+			column.Settings.AllowSort = DefaultBoolean.False;
+			column.Width = 70;
+		});
+		settings.Columns.Add("Forename");
+		settings.Columns.Add("Lastname");
+		settings.Columns.Add("MailAddress");
+		//settings.Columns.Add(column => {
+		//    column.FieldName = "CategoryID";
+		//    column.Caption = "Category";
+
+		//    column.ColumnType = MVCxGridViewColumnType.ComboBox;
+		//    var comboBoxProperties = column.PropertiesEdit as ComboBoxProperties;
+		//    comboBoxProperties.DataSource = NorthwindDataProvider.GetCategories();
+		//    comboBoxProperties.TextField = "CategoryName";
+		//    comboBoxProperties.ValueField = "CategoryID";
+		//    comboBoxProperties.ValueType = typeof(int);
+		//});
+
+		settings.ClientLayout = (s, e) =>
+		{
+			if(e.LayoutMode == ClientLayoutMode.Loading) {
+				if(Session["UserGridState"] != null)
+					e.LayoutData = (string)Session["UserGridState"];
+			}
+			else
+				Session["UserGridState"] = e.LayoutData;
+		};
+	}).Bind(Model).GetHtml()

+ 1 - 0
GreenTree.Nachtragsmanagement.Web/Views/Global/SuccessMessage.cshtml

@@ -0,0 +1 @@
+<div style="background: green">Erfolgreich!</div>

+ 161 - 50
GreenTree.Nachtragsmanagement.Web/Views/Home/Index.cshtml

@@ -9,20 +9,30 @@
 	var openOffsetX = 10;
 	var openOffsetY = 5;
 
+	var popupNames = [];
+	
+	var popupElements = {};
 	var popupStatus = {};
 	var popupImages = {};
 	var popupDescriptions = {};
 	var popupWidths = {};
 	var popupHeights = {};
-	var popupLocations = {};
+	var popupLocationsX = {};
+	var popupLocationsY = {};
+	var popupMinimized = {};
 
 	var contentX = 0;
 	var contentY = 0;
 
+	var dragElement = null;
+	var dragStart = {};
+
 	@foreach (var g in Model.AvailableFunctions)
 	{
 		foreach (var i in g.Value)
 		{
+			ViewContext.Writer.WriteLine("popupNames.push(\"" + i.Name + "\");");
+			ViewContext.Writer.WriteLine("popupElements[\"" + i.Name + "\"] = \"" + i.Name + "_PW-1\";");
 			ViewContext.Writer.WriteLine("popupImages[\"" + i.Name + "\"] = \"" + Url.Content(i.ImageUrl) + "\";");
 			ViewContext.Writer.WriteLine("popupDescriptions[\"" + i.Name + "\"] = \"" + i.Description + "\";");
 		}
@@ -34,8 +44,61 @@
 		$(".functionContentContainer").width($(window).width() - $(".functionNavigationContainer").width() - 3);
 		contentX = $(".functionContentContainer").position().left;
 		contentY = $(".functionContentContainer").position().top;
+		for (var i = 0; i < popupNames.length; i++) {
+			var popupElem = $("#" + popupNames[i] + "-Popup_PW-1");
+			var headerElem = $("#" + popupNames[i] + "-Popup_PW-1 > .dxpc-mainDiv > .dxpc-header");
+			var contentWrapper = $("#" + popupNames[i] + "-Popup_PW-1 .dxpc-contentWrapper");
+			var content = $("#" + popupNames[i] + "-Popup_PW-1 .dxpc-content");
+			popupElem.draggable({
+				containment: $(".functionContentContainer"),
+				handle: headerElem
+			});
+			popupElem.resizable({
+				containment: $(".functionContentContainer"),
+				alsoResize: [contentWrapper, content]
+			});
+			popupElem.on("dragstop", function (e, s) {
+				var controls = ASPxClientControl.GetControlCollection();
+				var popupName = e.currentTarget.id.replace("_PW-1", "");
+				var functionName = e.currentTarget.id.replace("-Popup_PW-1", "");
+				var popupElement = controls.GetByName(popupName);
+				var popupControl = MVCxClientPopupControl.Cast(popupElement);
+				var popupPositionX = $(this).position().left;
+				var popupPositionY = $(this).position().top;
+				popupLocationsX[functionName] = popupPositionX;
+				popupLocationsY[functionName] = popupPositionY;
+			});
+			popupElem.on("resizestop", function (e, s) {
+				var controls = ASPxClientControl.GetControlCollection();
+				var popupName = e.currentTarget.id.replace("_PW-1", "");
+				var functionName = e.currentTarget.id.replace("-Popup_PW-1", "");
+				var popupElement = controls.GetByName(popupName);
+				var popupControl = MVCxClientPopupControl.Cast(popupElement);
+				var popupWidth = $(this).width();
+				var popupHeight = $(this).height();
+				popupWidths[functionName] = popupWidth;
+				popupHeights[functionName] = popupHeight;
+				popupControl.SetWidth(popupWidth);
+				popupControl.SetHeight(popupHeight);
+			});
+		}
 	})
 
+	//function checkResizeBorders(s, e) {
+	//	var controls = ASPxClientControl.GetControlCollection();
+	//	var popupName = s.name.replace("-Popup", "");
+	//	var popupElement = controls.GetByName(s.name);
+	//	var popupControl = MVCxClientPopupControl.Cast(popupElement);
+	//	var curWidth = popupControl.GetWidth();
+	//	var curHeight = popupControl.GetHeight();
+	//	if (popupLocationsX[popupName] + curWidth >= contentX + $(".functionContentContainer").width()) {
+	//		popupControl.SetWidth($(".functionContentContainer").width() - popupLocationsX[popupName]);
+	//	}
+	//	if (popupLocationsY[popupName] + curHeight >= contentY + $(".functionContentContainer").height()) {
+	//		popupControl.SetHeight($(".functionContentContainer").height() - popupLocationsY[popupName]);
+	//	}
+	//}
+
 	function showFunction(e) {
 		if (!e) return;
 		var controls = ASPxClientControl.GetControlCollection();
@@ -43,15 +106,22 @@
 		var popupElement = controls.GetByName(popupName);
 		var popupControl = MVCxClientPopupControl.Cast(popupElement);
 		if (popupControl.IsVisible()) return;
-		if (popupStatus[e.item.name] && popupStatus[e.item.name] == "minimized") {
+		if (popupMinimized[e.item.name] == true) {
 			popupControl.Show();
-		} else {
+			$("#" + e.item.name + "-PanelItem").fadeTo(500, 1);
+		} else if (!popupStatus[e.item.name] || popupStatus[e.item.name] == "closed") {
+			if (popupWidths[e.item.name] && popupHeights[e.item.name]) {
+				popupControl.SetWidth(popupWidths[e.item.name]);
+				popupControl.SetHeight(popupHeights[e.item.name]);
+			}
 			popupControl.RefreshContentUrl();
-			popupControl.ShowAtPos(contentX + openOffsetX, contentX + openOffsetY);
+			popupControl.ShowAtPos(contentX + openOffsetX, contentY + openOffsetY);
+			popupLocationsX[e.item.name] = contentX + openOffsetX;
+			popupLocationsY[e.item.name] = contentY + openOffsetY;
 			openOffsetX += 50;
 			openOffsetY += 25;
 			var popupPanel = $(
-				'<div id="' + e.item.name + 'PanelItem" class="popupPanelItem" onclick=\'normalizeFunction("' + e.item.name + '")\'>' +
+				'<div id="' + e.item.name + '-PanelItem" class="popupPanelItem" onclick=\'normalizeFunction("' + e.item.name + '")\'>' +
 					'<img src="' + popupImages[e.item.name] + '" />' +
 					'<span>' + popupDescriptions[e.item.name] + '</span>' +
 					'<img src="@Url.Content("~/Content/Images/close-16.png")" onclick=\'hideFunction("' + e.item.name + '", false)\' />' +
@@ -68,7 +138,14 @@
 		var popupElementName = popupName + "-Popup";
 		var popupElement = controls.GetByName(popupElementName);
 		var popupControl = MVCxClientPopupControl.Cast(popupElement);
-		popupControl.Show();
+		if (popupStatus[popupName] == "maximized") {
+			popupControl.Show();
+		} else {
+			popupControl.ShowAtPos(popupLocationsX[popupName], popupLocationsY[popupName]);
+			popupStatus[popupName] = "normalized";
+		}
+		popupMinimized[popupName] = false;
+		$("#" + popupName + "-PanelItem").fadeTo(500, 1);
 	}
 
 	function toggleMaximizeFunction(popupName) {
@@ -76,39 +153,64 @@
 		var popupElementName = popupName + "-Popup";
 		var popupElement = controls.GetByName(popupElementName);
 		var popupControl = MVCxClientPopupControl.Cast(popupElement);
+		var popupElem = $("#" + popupElementName + "_PW-1");
+		var popupContentElem = $("#" + popupElementName + "_PW-1 > .dxpc-mainDiv");
+		var popupHeaderElem = $("#" + popupElementName + "_PW-1 > .dxpc-mainDiv > .dxpc-header");
 		if (popupStatus[popupName] && popupStatus[popupName] == "minimized") {
 			popupControl.Show();
 		} else if (popupStatus[popupName] && popupStatus[popupName] == "normalized") {
-			popupLocations[popupName] = popupControl.GetPosition();
 			popupWidths[popupName] = popupControl.GetWidth();
 			popupHeights[popupName] = popupControl.GetHeight();
 			popupControl.ShowAtPos(contentX, contentY);
 			popupControl.SetWidth($(".functionContentContainer").width());
-			popupControl.SetHeight($(".functionContentContainer").height());
+			popupControl.SetHeight($(".functionContentContainer").height() - 1);
+			popupStatus[popupName] = "maximized";
+			popupContentElem.removeClass("dxpc-shadow");
+			popupHeaderElem.removeClass("devExAllowDrag");
+			popupElem.draggable("disable");
+			popupElem.resizable("disable");
 		} else if (popupStatus[popupName] && popupStatus[popupName] == "maximized") {
-			popupControl.ShowAtPos(contentX, contentY);
+			popupControl.ShowAtPos(popupLocationsX[popupName], popupLocationsY[popupName]);
 			popupControl.SetWidth(popupWidths[popupName]);
 			popupControl.SetHeight(popupHeights[popupName]);
+			popupStatus[popupName] = "normalized";
+			popupContentElem.addClass("dxpc-shadow");
+			popupHeaderElem.addClass("devExAllowDrag");
+			popupElem.draggable("enable");
+			popupElem.resizable("enable");
+			// Prevent growing of function container so it breaks below navigation container
+			$(".functionContentContainer").width($(".functionContentContainer").width() - 50);
+			$(".functionContentContainer").width($(".functionContentContainer").width() + 50);
 		}
 	}
 
 	function hideFunction(popupName, minimize) {
 		var controls = ASPxClientControl.GetControlCollection();
-		var popupElement = controls.GetByName(popupName + "-Popup");
+		var popupElementName = popupName + "-Popup";
+		var popupElement = controls.GetByName(popupElementName);
 		var popupControl = MVCxClientPopupControl.Cast(popupElement);
+		var popupContentElem = $("#" + popupElementName + "_PW-1 > .dxpc-mainDiv");
 		popupControl.Hide();
 		if (minimize == true) {
-			popupStatus[popupName] = "minimized";
+			if (popupStatus[popupName] == "maximized") {
+				popupLocationsX[popupName] = contentX;
+				popupLocationsY[popupName] = contentY;
+			}
+			popupMinimized[popupName] = true;
+			$("#" + popupName + "-PanelItem").fadeTo(500, 0.6);
 		} else {
 			popupStatus[popupName] = "closed";
+			popupContentElem.addClass("dxpc-shadow");
+			popupContentElem.addClass("devExAllowDrag");
 			var iframe = popupControl.GetWindowContentIFrame();
 			iframe.contentWindow.document.open();
 			iframe.contentWindow.document.write("");
 			iframe.contentWindow.document.close();
-			$("#" + popupName + "PanelItem").fadeOut(500, function () {
+			$("#" + popupName + "-PanelItem").fadeOut(500, function () {
 				$(this).remove();
 			});
 		}
+		event.stopPropagation();
 	}
 </script>
 
@@ -139,48 +241,57 @@
 				s.MinWidth = new Unit(i.MinWidth.Value, UnitType.Pixel);
 				s.MinHeight = new Unit(i.MinHeight.Value, UnitType.Pixel);
 				s.CloseAction = CloseAction.None;
+				s.AllowDragging = false;
+				//s.AllowResize = true;
+				//s.ClientSideEvents.Resize = "function (s, e) { checkResizeBorders(s, e); }";
+				s.Styles.Header.CssClass += "devExAllowDrag";
 			}).GetHtml();
 		}
 	}
 
-<div class="functionNavigationContainer">
-	@Html.DevExpress().NavBar(s =>
-{
-	s.Name = "devNavBarFunctions";
-	s.Width = new Unit(100, UnitType.Percentage);
-	s.ClientSideEvents.ItemClick = "function (s, e) { showFunction(e); }";
-	s.Styles.Item.Cursor = "pointer";
-	s.ControlStyle.Border.BorderStyle = BorderStyle.None;
-	s.Styles.GroupHeader.Border.BorderStyle = BorderStyle.None;
-	s.Styles.GroupHeader.CssClass += "devExBorderBottom devExBorderBottomGray devExBorderBottomSmall";
-	s.Styles.GroupContent.Border.BorderStyle = BorderStyle.None;
-	s.Styles.GroupContent.CssClass += "devExBorderBottom";
-	s.Styles.Item.Border.BorderStyle = BorderStyle.None;
-	s.Styles.Item.CssClass += "devExBorderBottom";
-
-	foreach (var g in Model.AvailableFunctions)
-	{
-		s.Groups.Add(n1 =>
-		{
-			n1.Name = g.Key.Name;
-			n1.Text = g.Key.Description;
-			n1.ItemImagePosition = ImagePosition.Top;
-
-			foreach (var i in g.Value)
-			{
-				n1.Items.Add(n2 =>
+<table class="homeContainer">
+	<tbody>
+		<tr>
+			<td class="functionNavigationContainer">
+				@Html.DevExpress().NavBar(s =>
 				{
-					n2.Name = i.Name;
-					n2.Text = i.Description;
-					n2.Image.Url = i.ImageUrl;
-					n2.Image.UrlHottracked = GreenTree.Nachtragsmanagement.Core.StaticHelper.AddSuffix(i.ImageUrl, "-contrast", true);
-				});
-			}
-		});
-	}
-}).GetHtml()
-</div>
+					s.Name = "devNavBarFunctions";
+					s.Width = new Unit(100, UnitType.Percentage);
+					s.ClientSideEvents.ItemClick = "function (s, e) { showFunction(e); }";
+					s.Styles.Item.Cursor = "pointer";
+					s.ControlStyle.Border.BorderStyle = BorderStyle.None;
+					s.Styles.GroupHeader.Border.BorderStyle = BorderStyle.None;
+					s.Styles.GroupHeader.CssClass += "devExBorderBottom devExBorderBottomGray devExBorderBottomSmall";
+					s.Styles.GroupContent.Border.BorderStyle = BorderStyle.None;
+					s.Styles.GroupContent.CssClass += "devExBorderBottom";
+					s.Styles.Item.Border.BorderStyle = BorderStyle.None;
+					s.Styles.Item.CssClass += "devExBorderBottom";
+
+					foreach (var g in Model.AvailableFunctions)
+					{
+						s.Groups.Add(n1 =>
+						{
+							n1.Name = g.Key.Name;
+							n1.Text = g.Key.Description;
+							n1.ItemImagePosition = ImagePosition.Top;
 
-<div class="functionContentContainer">
+							foreach (var i in g.Value)
+							{
+								n1.Items.Add(n2 =>
+								{
+									n2.Name = i.Name;
+									n2.Text = i.Description;
+									n2.Image.Url = i.ImageUrl;
+									n2.Image.UrlHottracked = GreenTree.Nachtragsmanagement.Core.StaticHelper.AddSuffix(i.ImageUrl, "-contrast", true);
+								});
+							}
+						});
+					}
+				}).GetHtml()
+			</td>
+			<td class="functionContentContainer">
 
-</div>
+			</td>
+		</tr>
+	</tbody>
+</table>

+ 1 - 1
GreenTree.Nachtragsmanagement.Web/Views/Shared/_Footer.cshtml

@@ -12,7 +12,6 @@
 	s.HeaderText = "Rolle wechseln";
 	s.ShowFooter = false;
 	s.ShowMaximizeButton = false;
-	s.Styles.Content.Paddings.Padding = new Unit(0);
 	s.Modal = true;
 	s.Width = new Unit(350, UnitType.Pixel);
 	s.PopupHorizontalAlign = PopupHorizontalAlign.WindowCenter;
@@ -37,6 +36,7 @@
 				AcceptFunctionName = "acceptFooterRoleSelection"
 			});
 	});
+	s.Styles.Content.Paddings.Padding = new Unit(0);
 }).GetHtml()
 
 <div class="globalFooter">

+ 8 - 1
GreenTree.Nachtragsmanagement.Web/Views/Shared/_PopupButtonPanel.cshtml

@@ -15,6 +15,13 @@
 		b.Text = "Ok";
 		b.Width = new Unit(100, UnitType.Pixel);
 		b.ControlStyle.CssClass += "devExFloatRight devExPopupPanelButton";
-		b.ClientSideEvents.Click = "function (s, e) { " + Model.AcceptFunctionName + "(); }";
+		if (String.IsNullOrEmpty(Model.AcceptFunctionName)) 
+		{
+			b.UseSubmitBehavior = true;
+		}
+		else
+		{
+			b.ClientSideEvents.Click = "function (s, e) { " + Model.AcceptFunctionName + "(); }";
+		}
 	}).GetHtml()
 </div>