HelpPages.cshtml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. @{
  2. Layout = "~/Views/Shared/_FunctionLayout.cshtml";
  3. }
  4. @model IEnumerable<GreenTree.Nachtragsmanagement.Web.Models.Misc.HelpPageDataModel>
  5. <script src='@Url.Content("~/Scripts/jquery.mCustomScrollbar.concat.min.js")'></script>
  6. <script>
  7. var deleteId;
  8. var saveOperation;
  9. $(document).ready(function () {
  10. setTimeout(function () {
  11. setHelpContentHeight();
  12. @if (ViewData["InitialEditHelpPage"] != null)
  13. {
  14. ViewContext.Writer.Write("editHelpPage(" + (int)ViewData["InitialEditHelpPage"] + ");");
  15. }
  16. }, 500);
  17. $.ajaxSetup({
  18. cache: false
  19. });
  20. });
  21. $(window).resize(function () {
  22. setHelpContentHeight();
  23. });
  24. function setHelpContentHeight() {
  25. var height = $(window).height();
  26. $("#helpPageNavigation").height(height - 60);
  27. $("#helpPageContent").height(height - 32);
  28. if (typeof devHelpPageHtmlContentEditor !== 'undefined') {
  29. devHelpPageHtmlContentEditor.SetHeight(height);
  30. }
  31. }
  32. function viewHelpPage(id) {
  33. if (!id) return;
  34. $.ajax({
  35. url: '@Url.Action("ViewHelpPage", "Misc")',
  36. data: { Id: id },
  37. success: function (response) {
  38. $("#helpPageContent").html(response);
  39. },
  40. error: function () {
  41. alert("error occured");
  42. }
  43. });
  44. }
  45. function editHelpPage(id) {
  46. if (!id) return;
  47. $.ajax({
  48. url: '@Url.Action("EditHelpPage", "Misc")',
  49. data: { Id: id },
  50. success: function (response) {
  51. setTimeout(function () {
  52. $("#helpPageContent").html(response);
  53. devHelpPageHtmlContentEditor.SetHeight($("#helpPageContent").height() - 1);
  54. }, 200);
  55. },
  56. error: function () {
  57. alert("error occured");
  58. }
  59. });
  60. }
  61. function saveDataCallback() {
  62. devPopupControlEditHelpPage.Hide();
  63. }
  64. function confirmDelete(id) {
  65. if (!id) return;
  66. deleteId = id;
  67. $.ajax({
  68. type: "GET",
  69. url: '@Url.Action("GetHelpPage", "Misc")',
  70. data: { Id: id },
  71. success: function (response) {
  72. if (response == "notFound") return;
  73. var helpPage = JSON.parse(response);
  74. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteHelpPage);
  75. popupControl.SetHeaderText(popupControl.GetHeaderText().replace("{helpPage}", helpPage.Title));
  76. $(".dialogText").text($(".dialogText").text().replace("{helpPage}", helpPage.Title));
  77. popupControl.Show();
  78. }
  79. });
  80. }
  81. function deleteHelpPage() {
  82. $.ajax({
  83. type: "POST",
  84. url: '@Url.Action("DeleteHelpPage", "Misc")',
  85. data: { Id: deleteId },
  86. success: function (response) {
  87. var popupControl = MVCxClientPopupControl.Cast(devPopupControlDeleteHelpPage);
  88. popupControl.Hide();
  89. setTimeout(function () {
  90. window.location = window.location;
  91. }, 200);
  92. },
  93. error: function () {
  94. alert("error occured");
  95. }
  96. });
  97. }
  98. </script>
  99. <link rel="stylesheet" type="text/css" href='@Url.Content("~/Content/jquery.mCustomScrollbar.min.css")' />
  100. <style>
  101. .helpTable {
  102. width: 100%;
  103. }
  104. .helpTable > tbody > tr > td {
  105. vertical-align: top;
  106. }
  107. .helpTable > tbody > tr > td:first-of-type {
  108. padding-right: 12px;
  109. }
  110. .helpTable > tbody > tr > td:last-of-type {
  111. padding-left: 12px;
  112. }
  113. .helpPageMenu {
  114. width: auto;
  115. margin: 0 8px 6px 0;
  116. padding-bottom: 6px;
  117. border-bottom: 1px dashed #009688;
  118. overflow: auto;
  119. }
  120. #helpPageNavigation {
  121. border-right: 1px solid #009688;
  122. }
  123. #helpPageContent {
  124. color: black;
  125. overflow: auto !important;
  126. }
  127. </style>
  128. <table class="helpTable">
  129. <tr>
  130. <td style="width: 20%; min-width: 313px">
  131. <div class="helpPageMenu">
  132. @Html.DevExpress().Button(b =>
  133. {
  134. b.Name = "devButtonNewHelpPage";
  135. b.Text = "Neu";
  136. b.UseSubmitBehavior = false;
  137. //b.RenderMode = ButtonRenderMode.Link;
  138. b.ClientSideEvents.Click = "function (s, e) { editHelpPage(-1); }";
  139. }).GetHtml()
  140. </div>
  141. <div id="helpPageNavigation" class="mCustomScrollbar" data-mcs-theme="minimal-dark" style="width: 100%">
  142. @Html.Partial("~/Views/Misc/_HelpPageTreePartial.cshtml", Model)
  143. </div>
  144. </td>
  145. <td style="width: 80%">
  146. <div id="helpPageContent" style="width: 100%">
  147. </div>
  148. </td>
  149. </tr>
  150. </table>
  151. @Html.Partial("~/Views/Shared/_PopupDialogYesNo.cshtml", new GreenTree.Nachtragsmanagement.Web.Models.Global.YesNoDialogModel
  152. {
  153. PopupName = "devPopupControlDeleteHelpPage",
  154. Content = "<div class='dialogText' style='padding: 12px'>Sind Sie sicher, dass Sie die Hilfe-Seite \"{helpPage}\" löschen möchten?</div>",
  155. HeaderText = "\"{helpPage}\" löschen",
  156. YesFunction = "function (s, e) { deleteHelpPage(); }"
  157. })