Guides/Webforms-Basic-Integration.md
... ...
@@ -84,446 +84,22 @@ In order to avoid routing issues, you'll need to set the RedirectMode to off. Op
84 84
85 85
![Controllers](http://wiki.izenda.us/Guides/Webforms-Basic-Integration/2016-03-08-19_34_37-NewWebsite---Microsoft-Visual-Studio.png)
86 86
87
-###Step 5.
87
+###Step 5. Merge Styles and Master pages
88 88
89
-In order to avoid routing issues, set the RedirectMode to off, as seen below.
89
+At this point all the Izenda pages will run, and function appropriately, from a technical perspective Izenda is integrated with the application, and the whole app will run as one website from one application pool.
90
+
91
+The next steps will be to merge the Default.master and Site.master files, and change the Izenda page references.
92
+
93
+The basics will be to add Izenda's Default.Master's CSS and JavaScript references to Site.master's head section. You'll then add Izenda's links to the navigation.
90 94
91
-![Controllers](/Guides/MVC-Integration/Resources_Reporting.png)
95
+Past that you'll need to change each Izenda page to point at the Site.Master instead of the Default.Master.
92 96
93
-**b.** In Solution Explorer, exclude Dashboards-Body.ascx and Dashboards-Head.ascx from \Resources\html by right click on them and click 'Exclude From Project'
97
+For each page you'll need to:
94 98
95
-![Controllers](/Guides/MVC-Integration/Exclude.png)
99
+*Address CSS and general styling issues.
100
+*Address redundant Forms tags.
101
+*Address page level CSS issues.
96 102
97
-**c.** Copy /Resources folder from the root of the application into the /Reporting folder. This will create two copies of the Resources folder, one in the root and another under the Reporting folder. (If the folder "/Reporting/Resources" exists, overwrite the existing folder with the new copy.)
98 103
99
-![](/Guides/MVC-Integration/CopyResourcesFolder.png)
100
-
101
-**d.** Copy rs.aspx from /Reporting and paste it in /Resources/html as below
102
-
103
-![](/Guides/MVC-Integration/CopyRSFile.png)
104
-
105
-
106
-**** If Izenda toolbar icons don't appear, check if Reporting folder contains rs.aspx and Resources folder ****
107
-
108
-
109
-###Step 6. Add mvc5r3\Views\Reporting folder
110
-
111
-Add the Reporting folder in mvc5r3\Views to the project's Views
112
-
113
-![Controllers](/Guides/MVC-Integration/VR.png)
114
-
115
-###Step 7. Add _sitelayout to project’s Views\Shared
116
-
117
-Add _sitelayout from mvc5r3\Views\Shared to project’s Views\Shared
118
-
119
-![Controllers](/Guides/MVC-Integration/SiteLayout.png)
120
-
121
-###Step 8. Copy code from Global.asax except the first line
122
-
123
-**a.** Copy code from Global.asax except the first line
124
-
125
-###Global.asax from mvc5r3(C♯)
126
-
127
-```csharp
128
-
129
-<%@ Application Codebehind="Global.asax.cs" Inherits="MVC4Razor2.MvcApplication" Language="C#" %> //Copy except this line
130
-
131
-<%@ Import Namespace="Izenda.AdHoc"%>
132
-<%@ Import Namespace="System.IO"%>
133
-
134
-<script runat="server">
135
- void Application_AcquireRequestState(object sender, EventArgs e) {
136
- CustomAdHocConfig.InitializeReporting();
137
- }
138
-
139
- [Serializable]
140
- public class CustomAdHocConfig : FileSystemAdHocConfig {
141
- public static void InitializeReporting() {
142
- if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
143
- return;
144
- AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
145
- AdHocSettings.SqlServerConnectionString = @"INSERT_CONNECTION_STRING_HERE";
146
- AdHocSettings.GenerateThumbnails = true;
147
- AdHocSettings.ShowSimpleModeViewer = true;
148
- AdHocSettings.IdentifiersRegex = "^.*[iI][Dd]$";
149
- AdHocSettings.TabsCssUrl = "/Resources/css/tabs.css";
150
- AdHocSettings.ReportCssUrl = "../Resources/css/Report.css";
151
- AdHocSettings.ShowBetweenDateCalendar = true;
152
- AdHocSettings.DashboardViewer = "Dashboards";
153
- AdHocSettings.ReportViewer = "ReportViewer";
154
- AdHocSettings.InstantReport = "InstantReport";
155
- AdHocSettings.ReportDesignerUrl = "ReportDesigner";
156
- AdHocSettings.DashboardDesignerUrl = "DashboardDesigner";
157
- AdHocSettings.ReportList = "ReportList";
158
- AdHocSettings.SettingsPageUrl = "Settings";
159
- AdHocSettings.ParentSettingsUrl = "Settings";
160
- AdHocSettings.ResponseServer = "rs.aspx";
161
- AdHocSettings.ReportsPath = Path.Combine(HttpContext.Current.Server.MapPath("~/"), "Reports");
162
- AdHocSettings.PrintMode = PrintMode.Html2PdfAndHtml;
163
- AdHocSettings.ChartingEngine = ChartingEngine.HtmlChart;
164
- AdHocSettings.AdHocConfig = new CustomAdHocConfig();
165
- HttpContext.Current.Session["ReportingInitialized"] = true;
166
- }
167
- }
168
-</script>
169
-
170
-```
171
-
172
-**b.** Paste it in project’s Global.asax
173
-
174
-###Global.asax from Sample_MVCApp(C♯)
175
-```csharp
176
-<%@ Application Codebehind="Global.asax.cs" Inherits="Sample_MVCApp.MvcApplication" Language="C#" %>
177
-
178
-//THE BELOW IS PASTED CODE
179
-
180
-<%@ Import Namespace="Izenda.AdHoc"%>
181
-<%@ Import Namespace="System.IO"%>
182
-
183
-<script runat="server">
184
- void Application_AcquireRequestState(object sender, EventArgs e) {
185
- CustomAdHocConfig.InitializeReporting();
186
- }
187
-
188
- [Serializable]
189
- public class CustomAdHocConfig : FileSystemAdHocConfig {
190
- public static void InitializeReporting() {
191
- if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
192
- return;
193
- AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
194
- AdHocSettings.SqlServerConnectionString = @"INSERT_CONNECTION_STRING_HERE";
195
- AdHocSettings.GenerateThumbnails = true;
196
- AdHocSettings.ShowSimpleModeViewer = true;
197
- AdHocSettings.IdentifiersRegex = "^.*[iI][Dd]$";
198
- AdHocSettings.TabsCssUrl = "/Resources/css/tabs.css";
199
- AdHocSettings.ReportCssUrl = "../Resources/css/Report.css";
200
- AdHocSettings.ShowBetweenDateCalendar = true;
201
- AdHocSettings.DashboardViewer = "Dashboards";
202
- AdHocSettings.ReportViewer = "ReportViewer";
203
- AdHocSettings.InstantReport = "InstantReport";
204
- AdHocSettings.ReportDesignerUrl = "ReportDesigner";
205
- AdHocSettings.DashboardDesignerUrl = "DashboardDesigner";
206
- AdHocSettings.ReportList = "ReportList";
207
- AdHocSettings.SettingsPageUrl = "Settings";
208
- AdHocSettings.ParentSettingsUrl = "Settings";
209
- AdHocSettings.ResponseServer = "rs.aspx";
210
- AdHocSettings.ReportsPath = Path.Combine(HttpContext.Current.Server.MapPath("~/"), "Reports");
211
- AdHocSettings.PrintMode = PrintMode.Html2PdfAndHtml;
212
- AdHocSettings.ChartingEngine = ChartingEngine.HtmlChart;
213
- AdHocSettings.AdHocConfig = new CustomAdHocConfig();
214
- HttpContext.Current.Session["ReportingInitialized"] = true;
215
- }
216
- }
217
-</script>
218
-```
219
-
220
-
221
-###Step 9. Copy constraints classes from Global.asax.cs
222
-
223
-
224
-**a.** Copy below two constraints from Global.asax.cs of mvc5r3
225
-```csharp
226
-
227
-//IRouteConstraint
228
-public class SpecificFileRouterConstraint : IRouteConstraint {
229
- private string extensionToBeRouted = null;
230
- private string fileToBeRouted = null;
231
-
232
- public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
233
- return !String.IsNullOrEmpty(extensionToBeRouted) && !String.IsNullOrEmpty(fileToBeRouted) && values[extensionToBeRouted] != null && values[extensionToBeRouted].ToString().ToLower().Contains(fileToBeRouted);
234
- }
235
-
236
- public SpecificFileRouterConstraint() { }
237
-
238
- public SpecificFileRouterConstraint(string extension, string fileName) {
239
- extensionToBeRouted = extension.ToLower();
240
- fileToBeRouted = fileName.ToLower();
241
- }
242
- }
243
-
244
-
245
-
246
-
247
-//IRouteConstraint
248
-public class IzendaResourceConstraint : IRouteConstraint {
249
- private string extensionToBeRouted = null;
250
-
251
- public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
252
- if (String.IsNullOrEmpty(extensionToBeRouted) || values[extensionToBeRouted] == null) {
253
- return false;
254
- }
255
- string requestUrl = values[extensionToBeRouted].ToString().ToLower();
256
- bool result = false;
257
- if (extensionToBeRouted == "js") {
258
- result = result || requestUrl.Contains("reportviewerfilters.js");
259
- result = result || requestUrl.Contains("reportlist.js");
260
- result = result || requestUrl.Contains("data-sources.js");
261
- result = result || requestUrl.Contains("data-sources-preview.js");
262
- result = result || requestUrl.Contains("charts.js");
263
- result = result || requestUrl.Contains("datasources-search.js");
264
- result = result || requestUrl.Contains("jquery-1.6.1.min.js");
265
- result = result || requestUrl.Contains("jquery-ui-1.8.13.custom.min.js");
266
- result = result || requestUrl.Contains("elrte.full.js");
267
- result = result || requestUrl.Contains("elrte.ru.js");
268
- result = result || requestUrl.Contains("fieldproperties.js");
269
- result = result || requestUrl.Contains("shrinkable-grid.js");
270
- }
271
- if (extensionToBeRouted == "css") {
272
- result = result || requestUrl.Contains("tabs.css");
273
- result = result || requestUrl.Contains("report.css");
274
- result = result || requestUrl.Contains("filters.css");
275
- result = result || requestUrl.Contains("base.css");
276
- result = result || requestUrl.Contains("report-list-modal.css");
277
- result = result || requestUrl.Contains("data-sources.css");
278
- result = result || requestUrl.Contains("charts.css");
279
- result = result || requestUrl.Contains("jquery-ui-1.8.13.custom.css");
280
- result = result || requestUrl.Contains("elrte.min.css");
281
- result = result || requestUrl.Contains("elrte-inner.css");
282
- result = result || requestUrl.Contains("shrinkable-grid.css");
283
- }
284
- if (extensionToBeRouted == "png") {
285
- result = result || requestUrl.Contains("elrtebg.png");
286
- result = result || requestUrl.Contains("elrte-toolbar.png");
287
- }
288
- if (extensionToBeRouted == "gif") {
289
- result = result || requestUrl.Contains("elrte/images/pixel.gif");
290
- }
291
- return result;
292
- }
293
-
294
- public IzendaResourceConstraint() { }
295
-
296
- public IzendaResourceConstraint(string extension) {
297
- extensionToBeRouted = extension.ToLower();
298
- }
299
- }
300
-
301
-```
302
-
303
-**b.** Paste it above MVCapplication class in Global.asax.cs of project
304
-
305
-```csharp
306
-
307
-namespace Sample_MVCApp
308
-{
309
- public class SpecificFileRouterConstraint : IRouteConstraint
310
- {
311
- private string extensionToBeRouted = null;
312
- private string fileToBeRouted = null;
313
-
314
- public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
315
- {
316
- return !String.IsNullOrEmpty(extensionToBeRouted) && !String.IsNullOrEmpty(fileToBeRouted) && values[extensionToBeRouted] != null && values[extensionToBeRouted].ToString().ToLower().Contains(fileToBeRouted);
317
- }
318
-
319
- public SpecificFileRouterConstraint() { }
320
-
321
- public SpecificFileRouterConstraint(string extension, string fileName)
322
- {
323
- extensionToBeRouted = extension.ToLower();
324
- fileToBeRouted = fileName.ToLower();
325
- }
326
- }
327
-
328
- public class IzendaResourceConstraint : IRouteConstraint
329
- {
330
- private string extensionToBeRouted = null;
331
-
332
- public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection)
333
- {
334
- if (String.IsNullOrEmpty(extensionToBeRouted) || values[extensionToBeRouted] == null)
335
- {
336
- return false;
337
- }
338
- string requestUrl = values[extensionToBeRouted].ToString().ToLower();
339
- bool result = false;
340
- if (extensionToBeRouted == "js")
341
- {
342
- result = result || requestUrl.Contains("reportviewerfilters.js");
343
- result = result || requestUrl.Contains("reportlist.js");
344
- result = result || requestUrl.Contains("data-sources.js");
345
- result = result || requestUrl.Contains("data-sources-preview.js");
346
- result = result || requestUrl.Contains("charts.js");
347
- result = result || requestUrl.Contains("datasources-search.js");
348
- result = result || requestUrl.Contains("jquery-1.6.1.min.js");
349
- result = result || requestUrl.Contains("jquery-ui-1.8.13.custom.min.js");
350
- result = result || requestUrl.Contains("elrte.full.js");
351
- result = result || requestUrl.Contains("elrte.ru.js");
352
- result = result || requestUrl.Contains("fieldproperties.js");
353
- result = result || requestUrl.Contains("shrinkable-grid.js");
354
- }
355
- if (extensionToBeRouted == "css")
356
- {
357
- result = result || requestUrl.Contains("tabs.css");
358
- result = result || requestUrl.Contains("report.css");
359
- result = result || requestUrl.Contains("filters.css");
360
- result = result || requestUrl.Contains("base.css");
361
- result = result || requestUrl.Contains("report-list-modal.css");
362
- result = result || requestUrl.Contains("data-sources.css");
363
- result = result || requestUrl.Contains("charts.css");
364
- result = result || requestUrl.Contains("jquery-ui-1.8.13.custom.css");
365
- result = result || requestUrl.Contains("elrte.min.css");
366
- result = result || requestUrl.Contains("elrte-inner.css");
367
- result = result || requestUrl.Contains("shrinkable-grid.css");
368
- }
369
- if (extensionToBeRouted == "png")
370
- {
371
- result = result || requestUrl.Contains("elrtebg.png");
372
- result = result || requestUrl.Contains("elrte-toolbar.png");
373
- }
374
- if (extensionToBeRouted == "gif")
375
- {
376
- result = result || requestUrl.Contains("elrte/images/pixel.gif");
377
- }
378
- return result;
379
- }
380
-
381
- public IzendaResourceConstraint() { }
382
-
383
- public IzendaResourceConstraint(string extension)
384
- {
385
- extensionToBeRouted = extension.ToLower();
386
- }
387
- }
388
-
389
-
390
-
391
- // Note: For instructions on enabling IIS6 or IIS7 classic mode,
392
- // visit http://go.microsoft.com/?LinkId=9394801
393
-
394
- public class MvcApplication : System.Web.HttpApplication
395
- {
396
- protected void Application_Start()
397
- {
398
- AreaRegistration.RegisterAllAreas();
399
-
400
- WebApiConfig.Register(GlobalConfiguration.Configuration);
401
- FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
402
- RouteConfig.RegisterRoutes(RouteTable.Routes);
403
- BundleConfig.RegisterBundles(BundleTable.Bundles);
404
- AuthConfig.RegisterAuth();
405
- }
406
- }
407
-}
408
-
409
-
410
-```
411
-
412
-
413
-###Step 10. Copy over RegisterRoutes in MvcApplication
414
-
415
-**a.** Copy the below class from Global.asax.cs of mvc5r3
416
-
417
-```csharp
418
-public static void RegisterRoutes(RouteCollection routes) {
419
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
420
- routes.MapRoute("IzendaResources", "Reporting/Resources/{*resource}", new { controller = "IzendaStaticResources", action = "Index" });
421
- routes.MapRoute("IzendaJsResources", "{*js}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("js") });
422
- routes.MapRoute("IzendaCssResources", "{*css}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("css") });
423
- routes.MapRoute("IzendaPngResources", "{*png}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("png") });
424
- routes.MapRoute("IzendaGifResources", "{*gif}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("gif") });
425
- routes.MapRoute("IzendaReporting", "{controller}/{action}/{id}", new { controller = "Reporting", id = UrlParameter.Optional });
426
- routes.MapRoute("StarterKitDefault", "{controller}/{action}/{id}", new { controller = "Reporting", action = "ReportList", id = UrlParameter.Optional });
427
- routes.MapRoute("HomeDefault", "{*pathInfo}", new { controller = "Home", action = "Index", id = UrlParameter.Optional });
428
- }
429
-```
430
-
431
-**b.** Paste it inside MvcApplication class of tproject’s Global.asax.cs
432
-
433
-```csharp
434
-public class MvcApplication : System.Web.HttpApplication
435
- {
436
-
437
- public static void RegisterRoutes(RouteCollection routes)
438
- {
439
- routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
440
- routes.MapRoute("IzendaResources", "Reporting/Resources/{*resource}", new { controller = "IzendaStaticResources", action = "Index" });
441
- routes.MapRoute("IzendaJsResources", "{*js}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("js") });
442
- routes.MapRoute("IzendaCssResources", "{*css}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("css") });
443
- routes.MapRoute("IzendaPngResources", "{*png}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("png") });
444
- routes.MapRoute("IzendaGifResources", "{*gif}", new { controller = "IzendaStaticResources", action = "Index" }, new { irc = new IzendaResourceConstraint("gif") });
445
- routes.MapRoute("IzendaReporting", "{controller}/{action}/{id}", new { controller = "Reporting", id = UrlParameter.Optional });
446
- routes.MapRoute("StarterKitDefault", "{controller}/{action}/{id}", new { controller = "Reporting", action = "ReportList", id = UrlParameter.Optional });
447
- routes.MapRoute("HomeDefault", "{*pathInfo}", new { controller = "Home", action = "Index", id = UrlParameter.Optional });
448
- }
449
-
450
- protected void Application_Start()
451
- {
452
- AreaRegistration.RegisterAllAreas();
453
-
454
- WebApiConfig.Register(GlobalConfiguration.Configuration);
455
- FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
456
- RouteConfig.RegisterRoutes(RouteTable.Routes);
457
- BundleConfig.RegisterBundles(BundleTable.Bundles);
458
- AuthConfig.RegisterAuth();
459
- }
460
- }
461
-
462
-```
463
-
464
-
465
-###Step 11. Change the LicenseKey and ConnnectionString in Global.asax of project
466
-
467
- To get a new trial key, you may contact [sales@izenda.com](mailto:sales@izenda.com).
468
-
469
-```csharp
470
-
471
-AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
472
-AdHocSettings.SqlServerConnectionString = @"INSERT_CONNECTION_STRING_HERE";
473
-
474
-```
475
-
476
-###Step 12. Run it!
477
-
478
-After Step#11, the Sample_MVCApp should build and work without a problem. To see if Izenda is integrated with this web application,
479
-
480
-**a.** Open _Layout.cshtml in Views\Shared\ in Solution Explorer
481
-
482
-**b.** Add an ActionLink which leads to Izenda as below
483
-
484
-```html
485
-<li>@Html.ActionLink("Home", "Index", "Home")</li>
486
-<li>@Html.ActionLink("About", "About", "Home")</li>
487
-<li>@Html.ActionLink("Contact", "Contact", "Home")</li>
488
-<li>@Html.ActionLink("Izenda", "ReportList", "Reporting")</li> //Add this line
489
-```
490
-
491
-**c.** Notice 'Izenda' item added to the menu as below. Click it and see if it leads to Izenda ReportList page.
492
-
493
-![Test](/Guides/MVC-Integration/Test.PNG)
494
-
495
-
496
-###Step 13. Change the Logo
497
-
498
-**a.** Open _SiteLayout.cshtml in Views\Shared\ in Solution Explorer
499
-
500
-**b.** Find below two lines in the body of the html and edit the source image directory, alt, and the link address for top-right image
501
-
502
-```html
503
-<img src="~/Resources/FromDLL/Resources/ModernImages/bi-logo.png" alt="Business intelligence" /> //top-left image
504
-
505
-<a href="http://izenda.com" style="position: relative; top: 4px;"><img class="right-logo" src="~/Resources/FromDLL/Resources/ModernImages/IzendaNewLogoBlue.png" alt="Izenda Reports" /></a> //top-right image
506
-
507
-```
508
-**c.** Run the application and check if the images appear as edited.
509
-
510
-
511
-In this guide, two images, Logo.png and SeaEagle.png, were put in the project folder, /Sample_MVCApp, and the above two lines were edited as below
512
-
513
-```html
514
-<img src="~/Logo.png" alt="Angry Sea Eagle" /> //top-left image
515
-
516
-<a href="http://SeaEagle.com" style="position: relative; top: 4px;"><img class="right-logo" src="~/SeaEagle.png" alt="SeaEagle.Com" /></a> //top-right image
517
-```
518
-
519
-
520
-
521
-Two top logos have changed as below
522
-
523
-![Test](/Guides/MVC-Integration/Logo_Change2.png)
524
-
525
-<!--
526
-[Izenda MVC Kit Integration Guide Phase II](http://wiki.izenda.us/Guides/MVC-Integration/Phase-II-Draft)
527
--->
528 104
529 105
... ...
\ No newline at end of file