From 4891aa107aba0adbbf7c049b65d17936d6d4112c Mon Sep 17 00:00:00 2001 From: Seal Report Date: Tue, 12 Dec 2023 09:31:57 +0100 Subject: [PATCH] 7.2 --- .../Forms/TemplateTextEditor.cs | 3 + Projects/SealReportDesigner/Program.cs | 2 + Projects/SealServerManager/Program.cs | 3 + Projects/SealServerManager/ServerManager.cs | 23 +- ...- Custom buttons and report execution.srex | 227 ++++++++++++++++-- 5 files changed, 232 insertions(+), 26 deletions(-) diff --git a/Projects/SealLibraryWin/Forms/TemplateTextEditor.cs b/Projects/SealLibraryWin/Forms/TemplateTextEditor.cs index d2d638f4..cfe82537 100644 --- a/Projects/SealLibraryWin/Forms/TemplateTextEditor.cs +++ b/Projects/SealLibraryWin/Forms/TemplateTextEditor.cs @@ -594,6 +594,9 @@ @using System.IO else if (link.Text == ""html"") { //Sample 2 to return a custom html link.ScriptResult = string.Format("" This is a custom HTML built in the 'Report Navigation Script' from the server at {0}.
"", DateTime.Now); + + //or save NavigationLink object in a Tag and use it in a Task if the report is executed again + //report.Tag = link; } //Parsing the link parameters or the HttpRequest diff --git a/Projects/SealReportDesigner/Program.cs b/Projects/SealReportDesigner/Program.cs index f89177eb..48588220 100644 --- a/Projects/SealReportDesigner/Program.cs +++ b/Projects/SealReportDesigner/Program.cs @@ -71,6 +71,8 @@ static void Main(string[] args) { Application.Run(new ReportDesigner()); } + Application.ExitThread(); + Environment.Exit(0); } private static void ExceptionHandler(object sender, ThreadExceptionEventArgs t) diff --git a/Projects/SealServerManager/Program.cs b/Projects/SealServerManager/Program.cs index 1ed7e1b5..a17a3783 100644 --- a/Projects/SealServerManager/Program.cs +++ b/Projects/SealServerManager/Program.cs @@ -38,6 +38,9 @@ static void Main(string[] args) Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new ServerManager()); + + Application.ExitThread(); + Environment.Exit(0); } private static void ExceptionHandler(object sender, ThreadExceptionEventArgs t) diff --git a/Projects/SealServerManager/ServerManager.cs b/Projects/SealServerManager/ServerManager.cs index 49ad0452..510271bb 100644 --- a/Projects/SealServerManager/ServerManager.cs +++ b/Projects/SealServerManager/ServerManager.cs @@ -61,18 +61,19 @@ public ServerManager() mainPropertyGrid.LineColor = SystemColors.ControlLight; PropertyGridHelper.AddResetMenu(mainPropertyGrid); - sourceHelper = new TreeViewEditorHelper() { - entityHandler = this, + sourceHelper = new TreeViewEditorHelper() + { + entityHandler = this, resetDisplayOrderToolStripMenuItem = resetDisplayOrderToolStripMenuItem, - sortColumnAlphaOrderToolStripMenuItem = sortColumnAlphaOrderToolStripMenuItem, - sortColumnSQLOrderToolStripMenuItem = sortColumnSQLOrderToolStripMenuItem, - addFromToolStripMenuItem = addFromToolStripMenuItem, - addToolStripMenuItem = addToolStripMenuItem, - removeToolStripMenuItem = removeToolStripMenuItem, - copyToolStripMenuItem = copyToolStripMenuItem, - removeRootToolStripMenuItem = removeRootToolStripMenuItem, - treeContextMenuStrip = treeContextMenuStrip, - mainTreeView = mainTreeView + sortColumnAlphaOrderToolStripMenuItem = sortColumnAlphaOrderToolStripMenuItem, + sortColumnSQLOrderToolStripMenuItem = sortColumnSQLOrderToolStripMenuItem, + addFromToolStripMenuItem = addFromToolStripMenuItem, + addToolStripMenuItem = addToolStripMenuItem, + removeToolStripMenuItem = removeToolStripMenuItem, + copyToolStripMenuItem = copyToolStripMenuItem, + removeRootToolStripMenuItem = removeRootToolStripMenuItem, + treeContextMenuStrip = treeContextMenuStrip, + mainTreeView = mainTreeView }; toolStripHelper = new ToolStripEditorHelper() { MainToolStrip = mainToolStrip, MainPropertyGrid = mainPropertyGrid, EntityHandler = this, MainTreeView = mainTreeView }; toolsHelper = new ToolsHelper() { EntityHandler = this }; diff --git a/Repository/Reports/Samples/05-Scripts/505-Navigation - Custom buttons and report execution.srex b/Repository/Reports/Samples/05-Scripts/505-Navigation - Custom buttons and report execution.srex index 63c5ef2f..517d2117 100644 --- a/Repository/Reports/Samples/05-Scripts/505-Navigation - Custom buttons and report execution.srex +++ b/Repository/Reports/Samples/05-Scripts/505-Navigation - Custom buttons and report execution.srex @@ -1,14 +1,45 @@ - efe2ad7a-1c7d-4caa-af0e-a9a1e5b85124 c4aeb163-eb1b-4a8f-a6d0-790315140193 efe2ad7a-1c7d-4caa-af0e-a9a1e5b85124 + + + 1d58eba0-2029-4b8e-9551-05253047c94a + Text + Tasks to execute + 59c75e24-3255-4e3f-b79c-24992f23803f + Row + Text + 59c75e24-3255-4e3f-b79c-24992f23803f + NotModifiable + Text + 59c75e24-3255-4e3f-b79c-24992f23803f + + 8b56277a-7f4c-4ccb-835e-48c7ba24903b Northwind (Repository) 1 - + + + + 59c75e24-3255-4e3f-b79c-24992f23803f + Tasks + + + Task1 + + + Task2 + + + Task3 + + + + + 52833575-11ae-4b7d-8b5e-0f9b29d1267a @@ -78,9 +109,118 @@ } } } + + 2 + + + 2e78c122-1acd-4f63-a9dc-a68c4162648f + Task executed from the button + + true + Default + 8b56277a-7f4c-4ccb-835e-48c7ba24903b + 1 + + 78871dbe-cf14-4fd6-96bd-fec50dd7b914 + Task1 + + true + Default + 8b56277a-7f4c-4ccb-835e-48c7ba24903b + + 3 + + + be542359-b592-457b-91f0-c838151c330e + Task3 + + true + Default + 8b56277a-7f4c-4ccb-835e-48c7ba24903b + + 5 + + + a2319920-f01e-44d9-a46e-4ff2f0773263 + Task2 + + true + Default + 8b56277a-7f4c-4ccb-835e-48c7ba24903b + + 4 + @@ -368,8 +508,10 @@ </div> <button type="button" id="custom_download_button" class="btn btn-warning download-control">@report.Translate("Download")</button> +<hr> <button type="button" id="custom_html_button" class="btn btn-warning">Get HTML from Server</button> - <br> + <button type="button" id="task_button" class="btn btn-warning">Execute the Task</button> +<hr> <br><button type="button" id="custom_report_button" class="btn btn-warning">Run 'Search Orders'</button> (Works only with the Web Report Server!) <hr> </div> @@ -416,6 +558,9 @@ $(document).ready(function () { if (_urlPrefix != "") { //Web Report Server $.post(_urlPrefix + "ActionNavigate", $("#header_form").serialize()).done(function (data) { $("#html_div").html(data); + //or you may want to execute the report + //executeReport(); + }); } else { //Report Designer @@ -424,6 +569,24 @@ $(document).ready(function () { } }); + + //Task button + $("#task_button").unbind("click").bind("click", function () { + $("#navigation_parameters").val($("#download_form").serialize()); //Form parameters + $("#navigation_id").val('@report.GetReportNavigationScriptLink("task")'); //Link for custom content + + if (_urlPrefix != "") { //Web Report Server + $.post(_urlPrefix + "ActionNavigate", $("#header_form").serialize()).done(function (data) { + executeReport(); + + }); + } + else { //Report Designer + window.chrome.webview.hostObjects.sync.dotnet.Navigate($("#navigation_id").val(), $("#navigation_parameters").val()); + executeReport(); + } + }); + //Report button $("#custom_report_button").unbind("click").bind("click", function () { postForm(_urlPrefix + "SWExecuteReport", "_blank", { path:"\\Search - Orders.srex"}); @@ -444,30 +607,60 @@ $(document).ready(function () { 2 - 970b6953-60c7-44f7-85c9-ab92dd9b1057 - Highlights + 033d9973-6e93-4f48-9bbc-a739490b395a + Form End Free true - <p> + </form> + + 4 + + + f50fa2bf-75a7-4c14-9ceb-7c8ceb65a13f + Container + + + 970b6953-60c7-44f7-85c9-ab92dd9b1057 + Highlights + Free + true + <p> <b>Highlights:</b><br> <ul> <li>Custom 'Form Start' and 'Form End' views to define the input fields and button, plus event handlers.</li> <li>'Report Navigation Script' in General to process the navigation.</li> <li>'Set Checkbox' task to converter the employee ID into check box.</li> +<li>A Restriction View to execute Tasks selected from a dedicated Input Value.</li> </ul> </p> + 1 + + + 62adcd4f-fa31-4cbb-9bd6-794443ae853b + Restrictions + Restrictions + + 1d58eba0-2029-4b8e-9551-05253047c94a + + + + button_text + Execute tasks + + + 2 + + + Container + + + grid_layout + col-sm-6;col-sm-6; + + 1 - - 033d9973-6e93-4f48-9bbc-a739490b395a - Form End - Free - true - </form> - - 4 - Report @@ -517,6 +710,10 @@ $(document).ready(function () { //HTML button -> result is a string link.ScriptResult = string.Format("<b>This is a custom HTML built in the 'Report Navigation Script' from the server at {0}.</b><hr>", DateTime.Now); } + else if (link.Text == "task") { + //save NavigationLink object in a Tag2 and use it in a Task when the report is executed again + report.Tag2 = link; + } } false