Sei sulla pagina 1di 18

System Center Service Manager 2010 SP1 Custom Portal Development

1. Contents of Portal Source Code Release


The Portal Source Code Release contains the following items: A .zip file with the portal source code Visual Studio solution in its original form. Building this solution and deploying it will result in a portal that looks just like the portal as shipped in the product itself (version: SP1). A .zip file with all the files required to deploy a new version of the portal with a customized user experience new style, new features, and bug fixes. A .zip file with the portal source code Visual Studio solution in the modified form that was used to build the new version of the portal described above.

2. Modifications to the Portal


The new version of the portal has the following modifications: o o o o o o Updated look and feel which is consistent with the default theme of SharePoint 2010. Modified display strings to fix some of the inconsistencies in capitalization. Modified display strings to make some things more clear in the portal. SCSM logo removed from the lower right corner. SCSM logo replaced with a generic Contoso IT company logo which is better for demo purposes. It can be easily replaced. Bug fix so that when the user clicks into the Knowledge Search textbox the textbox hint text disappears automatically instead of requiring the user to manually delete it first before entering the search term. Bug fix for the issue where the steps do not progress in the request wizard. The fix in this case is just to not show progress at all. Its a three step wizard and doesnt really require that anyway. Added functionality to update an incident action log via the portal on the incident details page. Added a new request type provision new user with supporting management pack as an example of how to extend the portal to handle different types of requests with custom user interfaces.

o o

These modifications were accomplished by making the following different types of changes. These changes (unless they were very extensive) are marked in comments in the code that are prefaced by the phrase PORTALMOD. You can search through the modified code base for PORTALMOD and see many of the modifications that were made.

CSS File Modifications


CSS was modified to change the look of the portal. Much of the style for the portal is contained in the CSS files but not all. There are two .css files one of the analyst web portal and one for the end user portal. They are contained in the .\AnalystWeb\ and .\End User Portal\MasterPages directories respectively. There is an additional ie.css file that was added to the modified portal Visual Studio solution to handle some CSS specific to Internet Explorer.

Master File Modifications


Master files are used to control the layout of the .aspx pages which reference them. There are three master files for the End User Portal. They are found in .\End User Portal\MasterPages. They are named: ServiceManagerPortal.Master the main Master page used for nearly all portal pages on the End User Portal. ServiceManagerCommandMaster.Master used for the RequestDetails.aspx page. KnowledgeArticle.Master used for the KnowledgeSearchResults.aspx and KnowledgeArticleDetails.aspx page.

The Analyst web portal only has a single master page - .\AnalystWeb\MasterPage.master. You can modify the HTML and ASP in these pages to modify the layout of the pages in particular the header area of the pages. The style is generally contained in the CSS files.

ASPX File Modifications


There were just a few minor changes to the .aspx pages. Most of the modifications to the pages were done in the .master files. The .aspx pages generally just contain containers for the web parts. These are the purpose of the main .aspx pages in the portal: App End User End User End User End User End User End User File AllAnnouncements.aspx AllRequests AnnouncementDetails.aspx CreateRequest.aspx Home.aspx KnowledgeArticleDetail.aspx Purpose List of all current announcements. List of all requests where the logged in user is the affected user. Details of a particular announcement. The Create Request Wizard The End User Portal Home Page The detail page for a knowledge article where the user can click the link to open the knowledge article content. The list of knowledge articles returned by a search. The page that shows the details of a particular incident or change request. Request software wizard. The home page of the analyst portal. The list of change requests. The page that shows the details of a change request.

End User End User End User Analyst Analyst Analyst

KnowledgeSearchResults.aspx RequestDetails.aspx RequestSoftware.aspx AnalystHome.aspx ChangeRequests.aspx ChangeRequestDetails.aspx

Analyst Analyst Analyst Analyst Analyst Analyst Analyst

ChangeRequestsAssignedToMe.aspx

The list of change requests assigned to the logged in user. ChangeRequestsINeedToManual The list of active manual activities assigned to the logged in user to complete. ChangeRequestsINeedToReview.aspx The list of active review activities the logged in user is a reviewer of. ManualActivities.aspx The list of manual activities. ManualActivityDetails.aspx The page that shows the details of a manual activity. ReviewActivities.aspx The list of Review Activities. ReviewActivityDetails.aspx The page that shows the details of a review activity.

RESX File Changes


You can change the display strings by modifying the strings in the .resx files. The .resx files are: App End User File .\End User Portal\EndUserPortalResources.resx Purpose Contains display strings for the end user portal (not including web parts) Deployed By Must be copied to .\EndUser\App_GlobalReso urces Also compiled into theMS.EM.SM.Portal.dll assembly in .\End User Portal\bin that must be coped to .\EndUser\bin. Compiled into the MS.EM.SM.WebParts.dll assembly in .\End User Portal\bin that must be copied to .\EndUser\bin. Compiled into the MS.EM.SM.Portal.Common .dll assembly in .\End User Portal\bin that must be copied to .\EndUser\bin. Must be copied to .\Analyst\App_GlobalResou rces

End User

.\WebParts\WebPartsResources.resx

Contains display strings for the end user web parts

Common (Both End User and Analyst) Analyst

.\Common\CommonResources.aspx

Analyst

Contains display strings that are include in the Common web parts .\AnalystWeb\App_GlobalResources\ Contains display AnalystPortalResources.resx strings for the analyst portal (not including web parts) .\AnalystWebParts\WebPartResources Contains the .resx display strings for the analyst web parts

Compiled into the MS.EM.SM.AnalystWebPart s.dll that must be copied to .\Analyst\Bin

Web Part Changes The web parts are compiled assemblies. Code modifications require a rebuild of the assembly projects. The Web Parts are: App End User End User End User End User End User File Announcements.cs GlobalLinks.cs HomePageTasks.cs KnowledgeArticleDetail.cs KnowledgeArticlePart.cs Purpose List of top 10 announcements on home page Nav bar in the upper left corner List of tasks on the right side Details of a knowledge article Knowledge articles sorted by their star ratings in descending order as seen on the end user portal home page List of recent request seen on the right side of the portal home page List of all announcements List of knowledge articles returned by a search View all active requests where the logged in user is the affected user. Create request wizard Details of a request Software request wizard List of announcements Detailed of a change request Overview of a change request List of change requests assigned to the logged in user Change requests where there is a manual activity assigned to the logged in user Change requests where there is a review activity where the logged in user is a reviewer A list of change requests submitted by the user A list of manual activities Details of a manual activity A list of review activities Details of a review activity

End User

RecentRequests.cs

End User End User End User

ViewAllAnnouncements.cs ViewAllKnowledgeArticles.cs ViewAllRequests

End User End User End User Analyst Analyst Analyst Analyst Analyst

\Request\CreateRequest.cs \Request\RequestDetails.cs \SoftwareProvisioning\PortalSoftwareRequest.cs Announcements.cs ChangeRequestDetails.cs ChangeRequestOverview.cs ChangeRequestAssignedToMe.cs ChangeRequestsNeedToManual.cs

Analyst

ChangeRequestsNeedToReview.cs

Analyst Analyst Analyst Analyst Analyst

ChangeRequestsSubmitted.cs ManualActivities.cs ManualActivity.cs ReviewActivities.cs ReviewActivity.cs

3. Portal Setup
Run the Portal setup on the web server where you want host your customized portal. Portal setup provisions the SDK so that it can use the ServiceManager database and sets up the performance counters required to initialize and use the in-process SDK. The portal is designed to host the SDK in the same process as w3p.exe.

4. Creating a Custom Portal ASP.Net Application


You can create a new ASP.Net application for the End User and another one for the Analyst portal that run side-by-side with the out of the box portal. This way you can continue to use the out of the box portal while working on creating a customized portal. 1. Create a new directory on the file system that is a peer of the original portal directory. For example:

2. Copy the folders (Analyst, EndUser, aspnet_client) contained in C:\Inetpub\wwwroot\System Center Service Manager Portal to the new directory.

3. Create a new EndUser2 (or any name you choose) application in IIS under the same website (SCSMPortal) installed by SM portal setup. Configure the physical path to point to the EndUser directory inside of new physical directory (Custom System Center Service Manager Portal) you created in step #2.

4. Create a new Analyst2 (or any name you choose) application in IIS under the same website (SCSMPortal) installed by SM portal setup. Configure the physical path to point to the Analyst directory inside of new physical directory (Custom System Center Service Manager Portal) you created in step #2.

5. For both applications configure the following: a. Optionally create a new application pool (you can use the SM_AppPool from the IIS application pools as shown above). If you create a new application pool make sure it uses: i. Integrated managed pipeline ii. Load user profile is set to true iii. Identity is set to SM data access service account b. Make sure only Windows authentication is enabled for your application.

c. Since the System Center Data Access Service, portal helper functions, and utilities in Microsoft.EnterpriseManagement.ServiceManager.Portal.Common.dll dont encrypt any data sent over the wire it is recommended that your web site use https binding along

with an SSL certificate. This is only necessary to consider if you are creating a new web site to host the applications instead of using the web site installed by portal set up. The web sites should look like this when you are done:

5. Updating Assembly References in the Visual Studio Project


In order to build and deploy a customized portal the assembly references in the Visual Studio project provided must be updated. 1. Copy the reference binaries listed below from %systemDrive%\inetpub\wwwroot\System Center Service Manager Portal\EndUser\bin\ into the \Common folder in the Visual Studio solution. These assemblies can then be used to resolve the VS project assembly references. Microsoft.EnterpriseManagement.Config.dll Microsoft.EnterpriseManagement.UI.Foundation.dll Microsoft.EnterpriseManagement.UI.SdkDataAccess.dll Microsoft.Mom.BuildConstants.dll Microsoft.EnterpriseManagement.DataAccessService.Core.dll Microsoft.EnterpriseManagement.ServiceManager.dll Microsoft.EnterpriseManagement.ServiceManager.Portal.Common.dll 2. Open the Portal.sln file in Visual Studio. 3. In the Solution explorer in Visual Studio expand the Resources folder for each Project and you will see some broken assembly references indicated by the exclamation point like this: Analyst Web Parts

Common

End User Portal

Web Parts

4. For each of the missing references first, remove the reference

and then add it again (Add Reference) by browsing to the corresponding .dll in the \Common folder.

5. For the End User Web Parts project create a reference to the Portal Common project:

6. Build and Deploy a Customized Portal


To build the SM portal just click Build >Build Solution in Visual Studio. To deploy the customized portal copy the flies as follows (only if you modified them): Source
.\End User Portal\bin\ .\End User Portal\bin\ .\End User Portal\bin\ .\End User Portal\bin\ .\End User Portal\bin\ .\End User Portal\bin\ .\End User Portal\ .\End User Portal\MasterPages\ .\End User Portal\MasterPages\ .\End User Portal\ .\AnalystWeb\bin\ .\AnalystWeb\bin\ .\AnalystWeb\bin\ .\AnalystWeb\bin\ .\AnalystWeb\ .\AnalystWeb\MasterPages\

File
MS.EM.SM.WebParts.dll MS.EM.SM.WebParts.pdb MS.EM.SM.Portal.Common.dll MS.EM.SM.Portal.Common.pdb MS.EM.SM.Portal.dll MS.EM.SM.Portal.pdb *.aspx *.Master *.css EndUserPortalResources.resx MS.EM.SM.Portal.Common.dll MS.EM.SM.Portal.Commonpdb MS.EM.SM.AnalystWebParts.dll MS.EM.SM.AnalystWebParts.pdb *.aspx *.Master

Destination
.\EndUser\Bin\ .\EndUser\Bin\ .\EndUser\Bin\ .\EndUser\Bin\ .\EndUser\Bin\ .\EndUser\Bin\ .\EndUser\ .\EndUser\MasterPages\ .\EndUser\MasterPages\ .\EndUser\App_GlobalResources\ .\Analyst\Bin\ .\Analyst\Bin\ .\Analyst\Bin\ .\Analyst\Bin\ .\Analyst\ .\Analyst\MasterPages\

.\AnalystWeb\MasterPages\ .\AnalystWeb\App_GlobalResources\

*.css AnalystPortalResources.resx

.\Analyst\MasterPages\ .\Analyst\App_GlobalResources\

Note: the file names above are shortened MS=Microsoft, EM=EnterpriseManagement, SM=ServiceManager. Of course if you add any .aspx, .css, images, new projects that generate assemblies, etc. you will need to get those copied to the corresponding places. Remember to use CTRL+F5 to refresh the page after making changes to make sure that the browser doesnt use any cached content like images, .css files, etc and requests the entire page new from the server.

7. Making a New Web Part and Page on the Portal (New User Provisioning Example)
The modified portal contains a new page for requesting a new user. This is the process that was used to create this solution: 1) Create a new management pack in the SCSM Authoring Tool. 2) Create a new activity work item class with some properties to capture the data inputs. 3) Create a custom form for the new activity work item class (optional; you can just use the generic form). 4) Create a workflow to automate the implementation of the request 5) Import the MP into SCSM. 6) Copy the workflow .dll to C:\Program Files\Microsoft System Center\Service Manager 2010 on the SCSM management server. 7) Create a new Web Part (see RequestNewUser.cs in the modified source Visual Studio solution) 8) Create a new .aspx page to host the web part (see RequestNewUser.aspx). 9) Modify the HomePageTasks.cs web part to show an additional link to the new page (see modified HomePageTasks.cs). 10) Modify web.enduser.config to have a new appSetting (see modified web.enduser.config).

8. SM Web part internals


All SM web parts are ASP.NET web part composite controls. They override CreateChildControls to compose the actual web part UI hierarchy consisting of ASP.NET/HTML web controls. The web part layout is defined using the ASP.NET Table web control. Some webparts use complex ASP.NET controls like wizard controls (e.g. create request web part)

5.1 Data Binding


The portal uses a data model which wraps the complex or hierarchical SDK objects like EnterpriseManagementObjectProjection. These data model objects are used for easier consumption in the UI and for data binding to ASP.NET controls like GridView, DropDownList, etc. This data model is

shared between the portal and WPF rich console. The following binaries contain the implementation of this data model: Microsoft.EnterpriseManagement.UI.Foundation.dll Microsoft.EnterpriseManagement.UI.SdkDataAccess.dll

5.2Common portal UI layer


Microsoft.EnterpriseManagement.ServiceManager.Portal.Common.dll contains most of this code.
SdkConnection: It provides a singleton management server connection ServiceManagementGroup. It uses ManagementGroupConnectionManager which maintains a

cache of connections one for each language based on the incoming requests default language setting in the browser.

ReadOnlyWebPart: abstract base web part from which almost all SM web parts derive. This web

part disables actions like closing/editing a web part. It also provides a virtual method HandleException which can be used by derived web parts to handler exceptions as desired.

PoppableWebPart: it can be derived from to create a web part with modal dialog support. E.g.: Announcements web part.

IDataItem:

This is a UI wrapper of SDK objects (instance/projection instances/MP elements/templates) used by the portal and SM WPF console. It provides get/set operations on SDK object properties if it is supported by the wrapped SDK object. The oortal uses System.WorkItem.IncidentPortalProjectiontype projection for incidents. I. Property CreatedDate on MP class System.WorkItem can be accessed from the above incident projection as dataItem*CreatedDate+. II. To get the resolved by users name you can use: String resolvedByUserName = (dataItem*ResolvedByUser+ as IDataItem)*DisplayName+.ToString(); This will work provided incident was resolved and dataItem*ResolvedByUser+ as IDataItem) is not null.
SdkQueryUtility: publicly exposes the typical type and instance space operations required to

implement any business logic from the web parts. Example: GetInstances can be used to query for all instances of a ManagementPackClass Id, matching a search criteria.
/// <summary> /// Gets the instances. /// </summary> /// <param name="classId">The class id.</param> /// <param name="criteria">The criteria.</param> /// <returns></returns> public IList<IDataItem> GetInstances(Guid classId, string criteria)

Notes: Portal doesnt use any kind of IOC container or such so you need to take a hard dependency on the binaries listed above if you want to customize any OOB SM v1 portal web parts/build custom web parts. The list of above binaries is applicable only for Service Manager V1 (RTM).

9. Web site folder layout


\Enduser(vroot) \bin (SDK server binary files) (End user webparts: Microsoft.EnterpriseManagement.ServiceManager.WebParts.dll) (Common portal UI layer: Microsoft.EnterpriseManagement.ServiceManager.Portal.Common.dll) \bin\language code (satellite resource binary files) \Analyst(vroot) \bin (SDK server binary files) (Analyst webparts: Microsoft.EnterpriseManagement.ServiceManager.AnalystWebParts.dll) (Common portal UI layer: Microsoft.EnterpriseManagement.ServiceManager.Portal.Common.dll) \bin\language code (satellite resource binary files)

10.

Dependency Reference

The portal depends on the following assemblies: Binary Description Microsoft.EnterpriseManagement.ServiceManager.Portal.Common.dll Required if you want to customize any portal end user or analyst web parts. Provides you with boiler plate code like connection to a management group. Microsoft.EnterpriseManagement.Common.dll Required to initialize and use the SDK Microsoft.EnterpriseManagement.Config.dll client and server Microsoft.EnterpriseManagement.Core.dll Microsoft.EnterpriseManagement.DataAccessLayer.Common.dll Microsoft.EnterpriseManagement.DataAccessLayer.dll Microsoft.EnterpriseManagement.DataAccessLayer.QueryCache.dll Microsoft.EnterpriseManagement.DataAccessService.Core.dll Microsoft.EnterpriseManagement.HealthService.dll Microsoft.EnterpriseManagement.Modules.DataTypes.dll Microsoft.Mom.Common.dll

Microsoft.Mom.DiscoveryDatabaseAccess.dll Microsoft.Mom.Sdk.Authorization.dll Microsoft.EnterpriseManagement.UI.Foundation.dll Microsoft.EnterpriseManagement.UI.SdkDataAccess.dll Microsoft.EnterpriseManagement.ServiceManager.dll Microsoft.Mom.BuildConstants.dll

Contains references to Management Pack elements. The portal code uses references from this binary to query for portal specific MP element references.

Potrebbero piacerti anche