Customizing Web Parts

                 

 
Special Edition Using Microsoft SharePoint Portal Server
By Robert Ferguson

Table of Contents
Chapter 14.  Customizing Dashboards


Customizing Web Parts

Web Parts are, as discussed earlier, items in the SharePoint Portal Server Document Store with a defined set of properties. This set of properties includes

  • Basic properties that are available with every item in the document store, such as title, description, and date the Web Part was last modified. When the dashboard gets rendered, the values of the Title and Description properties will be used appropriately.

  • Appearance properties, such as height and width of the Web Part.

  • Behavior properties, such as whether or not users have the ability to remove the Web Part from the dashboard, or whether they can minimize the Web Part.

  • Content properties, such as the type of content the Web Part contains and the source from which the Web Part gets its content. For example, you can use the content properties to specify whether the content is embedded in the Web Part itself, or if it is located on another server.

There are more than 30 different properties that make up a Web Part. For a complete list, take a look at the Web Part Development Kit that can be downloaded from Microsoft (http://www.microsoft.com/Sharepoint/downloads/WPDK.asp). After installation, take a look in the documentation/ddrk30.chm help file.

NOTE

The Digital Dashboard technology is also implemented using Microsoft SQL Server as a repository in which Web Parts and dashboards are stored. This technology is only available as a download (http://msdn.microsoft.com/downloads/default.asp?URL=/code/sample.asp?url=/MSDN-FILES/027/001/620/msdncompositedoc.xml). SharePoint Portal Server and the Microsoft SQL Server Digital Dashboard implement the same version 3.0, and the information documented in the ddrk30.chm help applies largely to both.


You don't have to be an expert in these properties to start customizing or even building Web Parts. SharePoint Portal Server provides a very easy to use interface for building Web Parts through the dashboard. Later in this chapter, we will discuss other means of creating Web Parts targeted to the more professional developers, using tools such as Office XP Developer.

Similar to the Dashboard Settings page, there is a Web Part Settings page that allows you to change the settings of the currently selected Web Part. Changing a setting will change the appropriate property of the item representing the Web Part. The meaning of the General Settings section should be obvious. To do so do the following:

  1. Log in as Workspace Coordinator and open the dashboard that you want to customize in your browser.

  2. Click the Content link at the top of the dashboard page to open the Contents page.

  3. Click on the name of the Web Part you want to customize to open the Settings page for this Web Part.

  4. Change the settings as desired.

  5. Click Save to leave the Web Part Settings page.

  6. Click Save to leave the dashboard Contents page.

Figure 14.8. This figure illustrates how to tailor the name and description of the default News Web Part to reflect our company's business, as in Figure 14.5.

graphics/14fig08.jpg

Using Advanced Settings to Render a Web Part

The Advanced Settings section opens up a world of customization options to you. Some of the advanced Web Part settings influence the way a Web Part is being initialized and rendered. These settings are particularly important once you start to develop Web Parts yourself.

Once a Web Part is retrieved by the dashboard factory, the first thing the dashboard factory looks at is the "Check for master versions of the web parts" setting on the advanced dashboard. If that setting is checked, the dashboard factory checks if the advanced Web Part setting "The properties and content above are automatically matched to the properties of this master Web Part" is set and a link is specified. If the text box contains a value, the dashboard factory will check whether any updated versions of that Web Part are available, and if necessary update the Web Part in the dashboard. This algorithm allows for example for centralized updates of Web Parts.

After this initialization phase, the dashboard factory gets content to render the dashboard. The dashboard factory checks the "Isolate this Web Part's content from the other Web Parts" setting. If set, no further processing will occur; the dashboard factory will insert an iFrame with the URL specified in "Get Content from the following link" in the HTML that is returned to the browser. More information on Isolated Web Parts can be found in the section "Isolated Web Parts," later in this chapter.

For non-isolated Web Parts, the dashboard factory checks the type of content to determine whether the content runs on the server. If in the drop-down box, VBScript, JavaScript, or XML is specified, processing occurs on the server, based on the embedded content information.

For content of type HTML, the Get Content from the Following Link setting is optional. If set, the dashboard factory will try to retrieve the content through an HTTP request. If no Content Link is defined or an error occurs, the dashboard factory gets the embedded content.

TIP

If you are working with Content Links, specify embedded content also, which could be as simple as a Cannot Retrieve the Content Link to provide user feedback in case some network problems prevent the dashboard factory from obtaining the desired information.


Next, the dashboard factory will check the "XSL to transform the content" setting. Like for the processing of the content, it is possible to specify a link and a fallback to embedded content. If any XSL is available, the dashboard factory will transform the earlier obtained results through the XSL Stylesheet to HTML.

Finally, the dashboard factory replaces token strings that allow for portable Web Parts, and inserts the HTML stream into the response that is sent back to the browser (See Figure 14.9).

Figure 14.9. This diagram shows the flow that is executed by the dashboard factory to render a Web Part.

graphics/14fig09.gif

NOTE

All the settings refer to individual properties, which you can see in the Microsoft Office XP Developer, discussed later in this chapter. The property names are often slightly different, but remain intuitive once you understand the rendering process.


Isolated Web Parts

If a Web Part is isolated, the content of that Web Part is placed in an isolated container within the browser using the IFRAME HTML element. If a Web Part is not isolated, the content is streamed together with all other non-isolated Web Parts in the dashboard page. Isolation of Web Parts thus impacts how Web Parts get rendered, which has already been briefly discussed earlier.

Isolated Web Parts behave quite different than non-isolated Web Parts. The differences are discussed in Table 14.1:

Table 14.1. Difference in Behavior of Isolated and Non-isolated Web Parts

Isolated Web Parts

Non-isolated Web Parts

Content is retrieved by each client individually.

Content can be cached, and is eventually shared between users.

Can be placed on cached dashboards. users, all Web Parts must

To be able to cache the dashboard for multiple be shareable between users.

Rendering causes CPU load each time for every client.

Rendering causes CPU load on server, using caching; the load occurs only once for a particular user or even all users throughout the cache timeout period.

No inter-Web Part communication.

Inter-Web Part communication possible through the Digital Dashboard Service Component (DDSC).

Difficult to handle common style sheets, as the current style sheet settings are not passed by default.

Common style sheets are enforced.

Relative sizing difficult. SharePoint Portal Server will do a best estimate for sizing.

Sizing is straightforward. It is possible to use percentages.

Additional network connections set up.

Single connection to the server.

Direct authentication from client to target server. This implies that cookies can be passed, and that basic authentication prompting can occur

Server needs to forward security credentials, which often is not possible.

Function names or HTML IDs never conflict with other parts.

Script functions can assume they are the only script in the page, and that IDs uniquely identify elements in the Web Part content.

You should use the _WPQ_ token to make HTML IDs and function names unique within the dashboard.

Content is requested asynchronously from the rest of the page, which provides immediate feedback for Web Parts that take a long time to return content.

The content of all (non-isolated) Web Parts is streamed together after all information is retrieved on the server side.

Relative URLs are executed against the Frame sourcethe Content Link Setting.

Relative URLs are executed against the dashboard URL, which may cause unexpected results.

The out-of-the-box Web Parts of SharePoint Portal Server are non isolated, and you should also choose non-isolated Web Parts, unless your Web Parts contain data that

  • is highly volatile

  • needs application-specific security credentials

  • takes long to obtain

  • refers to a regular Web Page with some advanced settings, such as images or navigation

Other Advanced Web Part Settings

We have already discussed the upper part of the advanced Web Part Settings. They are primarily useful for the development of new Web Parts. We now will take a brief look at some other options.

For Web Parts that are shown through SharePoint Portal Server, you will typically not check the "Allow users to remove this Web Part from their dashboard" and "Allow users to minimize this Web Part on their dashboard" settings. These setting apply within SharePoint Portal Server only to Coordinators; users cannot modify the appearance of the dashboard through personal settings. To provide some personalization, it is possible to create Personal Dashboards, which will be discussed in "Personal Dashboards" later in this chapter. These options are present for future versions of SharePoint Portal Server, which may provide personalization features. If there is a need to provide content that can be minimized, consider using the DHTML object model. The Search Web Part with its Simple and Advanced searches is an example of where this technology is applied.

Next, on the Settings Web page you will find a set of text boxes that allow for some additional mini icons on the Web Part title bar. The usage is quite self-explanatory.

Next, there is a Web Part Storage option, which allows the Web Part itself to contain customization data. Finally, you can set some caching options, which will be discussed later in this chapter.

Web Part Storage

To allow Web Parts to be very flexible, it is possible to store some configuration data with the Web Part. In fact, this allows you to reuse the Web Part code for different Web Parts, such as for the Quick Links, News, and Announcements Web Parts.

You will notice that these Web Parts will show the latest five items (based on their modification date) by default. You can change this, allowing for more or less items, or use different selection criteria. To do so, do the following:

  1. Log in as Workspace Coordinator and open the dashboard that you want to customize in your browser.

  2. Click the Content link at the top of the dashboard page.

  3. Select the name of the Web Part that you want to modify.

  4. Under General Settings, click Show Advanced Settings.

  5. Under Store the following data for this Web Part, at the bottom of the page, you will find three lines.

  6. The first line refers to the folder where the actual items are keptfor the out-of-the-box Web Parts, you will find placeholders.

  7. The second line is the sort criteria. By default, it is sorted by the modification date in descending order, which means that the last entries are first.

  8. The last line, and probably the most interesting line, is the maximum number of items to be shown in the Web Part.

  9. Change the information as you like, and click Save to leave the Web Part Settings page.

  10. Click Save to leave the Content page.

Web Part developers will find more information in the Digital Dashboard documentation.


                 
Top


Special Edition Using Microsoft SharePoint Portal Server
Special Edition Using Microsoft SharePoint Portal Server
ISBN: 0789725703
EAN: 2147483647
Year: 2002
Pages: 286

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net