GOAL
Create a portal/site wide "clickwrap" for my SharePoint installation. Before
a user views any page in the SPS portal and or WSS site, they must acknowledge
and agree to the terms of service for the site.
RESEARCH
A few quick googles for sharepoint clickwrap and "click wrap" turned up
nothing useful. My previous post on site-wide footer provides a solid foundation
for implementing a clickwrap.
SOLUTION
Follow the procedure and code from my
Adding a
SharePoint footer (globally) article to install a site wide HTTP filter
module. This gives us the hook for intercepting and even replacing rendered page
output. The trick is to notice that something that represents a user acceptance
(something persistent) and let the page output pass through unmodified. If that
acceptance is missing, then show the clickwrap statement (terms of service)
which should contain "Agree" and "Disagree" (decline, etc...) buttons. The
filter should notice the submitted acceptance and set their persistent flag.
Some tricky spots
- Saving acceptance data in a cookie, profile or active directory are
reasonable places (with various tradeoffs).
- Where to get the clickwrap statement is another choice: Hardcode, read
from file, read from document library?!?
- Any text and images your clickwrap statement wants to display must not
require a clickwrap to view.
- Usually only aspx files are filtered, leaving any other content non-clickwrapped.
Clickwrap Filter Module logic:
- When a page is requested, the user's persistent acceptance flag (ie:
cookie) should be checked.
- If the user has already accepted, then let all content pass through the
filter. Done.
- Is this a "postback" where the user has clicked an "Agree" button? If
so, persist acceptance flag, let all content pass through the filter. Done.
- Is this a "postback" where the user has clicked an "Disagree" button? If
so, output the "sorry you disagree text." Done.
- At this point the user has not accepted on previous request and and is
not posting back an answer on this request.
- Output the clickwrap statement that includes a form with "Agree" and
"Disagree" buttons. Done.
Enjoy,
-AAron