Home > Articles > Web Development > Content Management Systems

This chapter is from the book

Creating New Web Parts

Now let's look at how to use existing HTML code to create a new Web part for your dashboard. You don't really need to be a programmer to do this, but you will need to know a few basics about HTML and XML if you're going to get into this on a regular basis. One of the main rules of thumb is that you should first try to find existing code before you attempt to write your own. Because I assume you're not a programmer, I'll demonstrate some nifty ideas to help you customize your portal.

NOTE

There are four types of Web parts: HTML, XML, VBScript, and JavaScript. As their names imply, each part can host different types of content. For instance, for pure HTML content, you use the advanced properties to configure the Web part to display HTML-formatted information. VBScript and JScript are excellent languages for passing information between Web parts on a dashboard. XML Web parts are the most versatile type because you can embed HTML code and script-based content inside XML code. You can find more information on this topic in the Digital Dashboard Resource Kit.

Adding a Google Search Web Part1

Many users use the Internet to conduct research. Some of the larger search engines, such as Google and AltaVista, are in regular use by users on your network. You'll need to check with Google regarding permission issues about the following demonstration, but this would be a great Web part addition to most dashboards.

First, navigate to the Google home page at http://www.google.com. Use your mouse to highlight the home page, right-click, and select Copy in the context menu. Then open FrontPage, create a new file, and navigate to the Normal tab. Right-click anywhere inside this tab, and select Paste from the context menu. The Google page should appear.

Now, this is where it gets to be fun. Delete everything on the page except the Google graphic, the search part, and the Google Search button. Then go to the HTML page, and copy all the code to the Clipboard.

Go back to SPS, and create a new Web part by clicking the Contents link and selecting the link to create a new Web part. Name the part Google Search Web Part, and choose to have it appear in the top banner. Then, if you want the search results to appear in a different window, be sure to add the target command when specifying the source for the Web part. Here is the complete set of code for this Web part:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body>

<center><img alt="Google" src="http://www.google.com/images/
 	title_homepage4.gif" width="205" height="75"><br>
<br>
<form name="f" action="http://www.google.com/search" method="get" 
	  	target="_blank">
 <table cellSpacing="0" cellPadding="0">
  <tbody>
   <tr vAlign="center" align="middle">
    <td width="75">&nbsp;</td>
    <td align="middle"><input maxLength="256" size="55" name="q"
				framewidth="4"><br>
     <input type="submit" value="Google Search" name="btnG"></td>
    <td vAlign="top" noWrap align="left"><font face="arial,sans-serif" 
			  size="-2">&nbsp;</font></td>
   </tr>
  </tbody>
 </table>
</form>
&nbsp;</center>

</body>

</html>
>

Figure 3–15 illustrates what this Web part looks like if it is placed in the top zone of the Web page. Like any other Web part, it can be moved to another part of the dashboard to meet your users' needs, or it can be set up to start minimized instead of maximized, as illustrated here. In addition, you can place the Web part in a public gallery from which users can pull the part into their own personalized dashboards. When working with proprietary names like this on your dashboard, it is best to secure written permission.

Figure 3-15Figure 3–15 Google Web part on Home dashboard

Adding Web Parts from the Microsoft Gallery

Web parts can be imported from any source. Microsoft has a Web parts gallery that can be accessed at http://www.microsoft.com/sharepoint/downloads/webparts/default.asp. On this site, you'll find a host of Web parts developed by third-party vendors and many that were developed by Microsoft, such as MSNBC Weather. Remember that you must have configured the ServerXMLHTTP object's proxy settings to import Web parts from the Internet. To learn how to configure these settings, please see Chapter 4.

In the Content link from a dashboard, you'll also find a link to a smaller Web Part Gallery, and that link automatically connects to a smaller list of Microsoft Web parts that can be downloaded quickly into your portal. This list of Web parts is represented in the larger Web parts link mentioned in the preceding paragraph.

To add a Web part from the Microsoft gallery, click the Contents link, and then click the Microsoft Web Part Gallery link. This will take you to a Web parts gallery location on Microsoft's Web site. Select the Web parts you want to use, agree to the licensing agreement, and then let them download and install. This happens automatically. Then click Save, and bing-badda-boom, the Web parts are installed into your portal.

Table 3–1 lists the free Web parts that are available for download from Microsoft's site. All these Web parts are found in the Default Web Part Gallery. You might find other locations that offer Web parts as well.

Table 3–1 Free Web parts from Microsoft's Web site

Web Part

Function

Content Viewer

Used to view a file, folder, or Web page within a Web part on the DD

Date Header

Displays current date at the top of your portal Web page

Microsoft Office Spreadsheet

Excel spreadsheet in a Web part*

Outlook Calendar

Used to view personal calendar in the mailbox*

Outlook Contacts

Used to view personal contacts in your mailbox*

Outlook Messages

Used to view personal e-mail*

Outlook Notes

Used to manage personal notes*

Outlook Tasks

Used to manage your personal to-do list*

Simple HTML Viewer

Simple HTML editor

Web Links

Used to create and manage a custom list of links

MSN Encarta Reference

Used to search the Encarta reference encyclopedia or dictionary

MSN MoneyCentral Stock Ticker

Used to view stock information and financial headlines

MSN Search

Used to search the Web

MSN MoneyCentral Search

Used to search MSN MoneyCentral Search for news and information

MSN MoneyCentral Stock Quotes

Used to look up stock quotes

MSNBC Business News

Used to view the latest business news headlines

MSNBC Stock News

Used to view stock headlines about your personal list of stocks

MSNBC Stock Quote List

Used to view a customized list of stock quotes in one Web part

MSNBC Weather

Used to view your local weather


Most of the other Web parts at http://www.microsoft.com/sharepoint/downloads/webparts/default.asp will require you to do one or more of the following: register with the Web part owner, pay for the Web part, or copy HTML code to your server and finish creating the Web part yourself. Many Web parts are proprietary to Microsoft's own product, and thus the Web part is not useful to you unless you're running Microsoft's application.

Creating a Personal Contacts Dashboard

This section demonstrates how to create a dashboard that can appear in either the default dashboard site or a personal dashboard that is dedicated to holding each user's contacts database. Users could also use these instructions to create a Contacts dashboard inside their personal dashboard. Such a dashboard might have its own set of subdashboards, each one dedicated to a certain type of contact, such as customers, vendors, professional contacts, or employees. By the way, you'll need to have installed Office XP Professional and Internet Explorer 5.0 or later before you can create a Contacts dashboard.

The first step is to navigate to the Home dashboard and create a subdashboard as described earlier in this chapter. A sample name for this dashboard might be "My Contacts." Next, import the Contact Web part from Microsoft's Web Part Gallery and configure its advanced settings to force the Web part to run maximized in the center banner.

Once the Web part is saved, the first time you connect to the dashboard, the Office XP Outlook client installation wizard will start asking whether you want to connect to an Exchange Server for e-mail. Click No and then click Finish. Soon, you'll be connected to the Contacts Web part on the dashboard. Note that I'm assuming here that you already have an Outlook profile created. If not, then select Yes in the wizard and connect to your exchange server.

This gives you a subdashboard whose contact information is personalized to each user based on her logon information. This configuration gives her her own Contacts list from her personal mailbox on the Exchange 2000 Server. What I've described here is not a company-wide contacts list that can be shared by all users in the organization. That's described next.

Creating Outlook Functionality in a Default Company-Wide Dashboard for Each User

To expand on the previous discussion, it might be desirable to have your users use the dashboard for their common Outlook tasks instead of opening Outlook itself. For instance, the following Outlook Web parts are ready for download from Microsoft's Web Part Gallery:

  • Tasks
  • Journal
  • Messages
  • Contacts
  • Calendar

The Messages Web part includes inbox, outbox, drafts, and sent items functionality. We are accustomed to seeing these functions as separate folders in the Outlook client, but all of them are presented in the same Web part for the dashboard. The Calendar Web part includes day, week, and month views. By default, all these Web parts are generated with the setting that allows the user to minimize the Web part if necessary. Figure 3–16 illustrates these Web parts in a customized Outlook Tools dashboard.

Figure 3-16Figure 3–16 Outlook Web parts in a single dashboard with the Notes and Tasks Web parts minimized

TIP

If you want to create a link on the Home dashboard that invokes the user's local Outlook program outside a Web part or the dashboard, use the following: for Outlook XP, outlook://inbox, and for Office 2000, outlook:inbox. For quick invocation of the Outlook client from within the portal, you could place such a link in the Quick Links Web part.

You can name the dashboard "My Mailbox" or "My Outlook" or some other name that your users will easily recognize as the location where they can find and perform many of their mailbox functions.

Now, suppose you want to place a company-wide Contacts folder or company-wide Calendar folder on your portal for overall contact management or scheduling information. How do you do this? Really, it's simpler than you think.

First, open the browser on your SharePoint Portal Server and enter the following URL:

http://<servername>/public/applications/workspace 

Then create a new folder by right-clicking the Applications folder, selecting New Folder, and then configuring the type of folder you want to create. If it's a Calendar folder, select Appointment Items. If it's a Contact folder, select Contacts. Click OK and ensure that the folder has been created successfully. Next, right-click the new folder and select Open in New. Then copy the URL from the address bar of the new window. Create a new Web part, and then paste the URL into the Get Content from the Following Link property. Choose Isolate, and make any other configuration changes you desire. Save it, and there you go. You'll now have a Web part that displays overall company contacts or schedules that are hosted within SharePoint Portal Server.

But suppose you don't want to create a new folder because you already have this information sitting in a public folder in Exchange. How do you get that same public folder to appear in a Web part? Following is the code2 to help you do that.

ASP code to query WSS with ADO:

<h3>Retrieving contact details using ADO</h3>
<%
set rsContacts = Server.CreateObject("ADODB.Recordset")
set conn = server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft Exchange OLE DB Provider;Data 
Source=http://pctim/public/public contacts" conn.open sConnection 
sQuery = "SELECT ""urn:schemas:contacts:fileas"", " sQuery = sQuery + 
  """http://schemas.microsoft.com/mapi/email1emailaddress"""
sQuery = sQuery + "FROM scope('shallow traversal of 
  ""http://pctim/public/public contacts""')" sQuery = sQuery + " ORDER 
BY ""urn:schemas:contacts:fileas""" rsContacts.Source = sQuery
set rsContacts.ActiveConnection = conn
rsContacts.open
response.write "<table border=1>"
for iCount = 1 to 10
Response.write "<tr><td>" + rsContacts.Fields(0) + "</td>"
Response.write "<td>" + rsContacts.Fields(1) + "</td></tr>"
rsContacts.MoveNext
next
response.write "</table>"
rsContacts.close
conn.close
%>

ASP code using WebDAV:

<h3>Retrieving contact details using WebDAV</h3>
<%
set senddoc = createobject("MSXML2.DOMDocument")
set responsedoc = createobject("MSXML2.DOMDocument")
strURL = "http://pctim/public/public contacts/"
Set pi = senddoc.createProcessingInstruction("xml", "version=""1.0""")
senddoc.appendChild pi Set node = senddoc.createNode(1, 
"searchrequest", "DAV:") Set senddoc.documentElement = node Set node2 
= senddoc.createNode(1, "sql", "DAV:") node.appendChild node2
Set query = 
senddoc.createTextNode("select""urn:schemas:contacts:fileas"",""http://sch
  emas.microsoft.com/mapi/email1emailaddress"" from """ & strURL & """ ")
node2.appendChild query
Set req = CreateObject("MSXML2.XMLHTTP")
req.open "SEARCH", strURL, False, "yourdomain\yourusername",
"yourpassword"
req.setrequestheader "Translate", "f"
req.setrequestheader "Content-Type", "text/xml" req.setrequestheader 
"Depth", "0" req.send senddoc
set responsedoc = req.responseXML
response.write "<table border=1>"
Set objNodeList = responsedoc.getElementsByTagName("a:prop")
For i = 0 To (objNodeList.length - 1)
Set objPropNodes = objNodeList.item(i).childNodes
response.write "<tr>"
For j = 0 To (objPropNodes.length - 1)
Set objNode = objPropNodes.item(j)
Response.Write ("<td>" + objPropNodes.item(j).text + "</td>")
Next
response.write "</tr>"
Next
response.write "</table>"
%>

Using Office XP in the Portal

Microsoft Office documents can be saved as individual documents or as Web parts and then published on the dashboard. This means that documents, such as memos, budgets, vacation schedules, project schedules, and so on, can be published immediately on the dashboard. Depending on how you publish the information, it also can be dynamically updated in the portal as the source document is updated.

I'll demonstrate how to save an Excel spreadsheet as a company news item that outlines a fictitious budget for the Networknowledge company. You open Excel, create your budget, and save it as a Web page (Figure 3–17). In this example, I've chosen to publish the file, and that invokes the Publish as Web Page dialog box in Excel, as illustrated in Figure 3–18. When you select AutoRepublish Every Time, Excel updates your Web part each time the original file is saved. After making this selection, click Publish.

Figure 3-17Figure 3–17 Saving the Networknowledge budget as a Web page. Notice that I'm using the client-side Web folder option to specify where I'd like this document to be saved.

Figure 3-18Figure 3–18 Publish as Web Page dialog box in Excel

After you click Publish a second time, the document's profile appears (Figure 3–19. After you configure the document's profile, it is saved to the News folder in the workspace and appears as a news item in the dashboard (Figure 3–20).

Figure 3-19Figure 3–19 Configuring the document's profile

Figure 3-20Figure 3–20 Networknowledge budget document appearing as a news item in the NK workspace

Now, not only can you save documents directly to the workspace using Office XP, but you can also create Web parts whose functionality comprises an Office XP document. To use Office XP to create a Web part, you must save the document to a personal dashboard. To demonstrate this, let's create a spreadsheet called "Current Sales to Date" that will appear, not as a news item, but rather as a Web part on the Home dashboard. Such a Web part could be used to keep users up-to-date on inportant information.

The first step is to create the Web part on your personal dashboard and then import it to the Home dashboard. In my example, I'll create a new personal dashboard, which I'll name Bill (that's creative, eh? <g>). Then you save an Excel document to the dashboard as a Web part.

When you save the document to your personal dashboard as a Web page, you're presented with the Web File Properties dialog box asking you to create a new Web part on your dashboard. I'll name the sample new Web part "Current Sales Figures." Then you click Save (Figure 3–21). Now you have a new Web part that can be imported to the Home dashboard for everyone's viewing pleasure.

Figure 3-21Figure 3–21 Web File Properties dialog box

Note that you do not need to save the file as a Web part. Interestingly, if you save it as a good ol' Excel spreadsheet, the Web part will be created, but when it attempts to load in the user's browser, the user will be asked if he would like to open the file from its present location or save the file locally. Hence, if you want to create a Web part composed of an Office document and want to make that document available for download from within the Web part, then don't save the document as a Web page. Instead, save it as a native document. Then, when the Web part is built in the user's browser, he will be given the choice to either view or download the document.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020