I've been working with a client in KC to implement SharePoint as an intranet. It's been an interesting experience. I've found that SharePoint is designed to be used a certain way. And while that way is fine for most cases, there are times when organizations might want to work with it a little differently.
A good example came when working with Listing Items in SharePoint Portal Server. Each Area of the Portal can have a listing of items. This listing can be used for announcements, links to documents, news, etc.
There is also a special area within Portal call News. When in the News area, you can click "Add Listing Item" and you will get a screen (spnewlisting.aspx) that allows you to enter information about the new listing, including a start and expiration date. These dates can be used to automatically show and hide the item based on date (for example, this annoucement should be show until 7/31/2004).
However, on any other area (not News), adding a new listing also displays the spnewlisting.aspx page, but without the section with the start and expiration dates. My client wanted to make expiration date required so the system in effect cleans up after itself.
To do this, I had edit each template page (for example, TEMPLATE\1033\SPSTOPIC\Default.aspx) and update the toolbar link for Add Listing. Currently, the link points to spnewlisting.aspx. I changed it to spnewlisting.aspx?Mode=News. This is what the link is in the News area's default.aspx page.
By adding the querystring parameter for Mode=News, spnewlisting.aspx then shows the start and expiration date section. It still saves the listing item correctly.
Next, we wanted to make Expiration date required. I did this by editing the spnewlisting.aspx page, and in the SectionPublishDates section, I added a InputFormRequiredFieldValidator control. The code for the control looks like this:
<spswc:inputformrequiredfieldvalidator
runat="server"
id="ExpirationDate_ReqFieldVal"
ControlToValidate="ExpirationDate"
ErrorMessageLocId="FieldValidation_NotValidDate" />
Tuesday, July 20, 2004
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment