Wednesday, March 6, 2013

Page Retirement Methods

Continuing my effort to document the various ways I've used the ODBC connector for the NetQoS products, here's my next query and controls I've built and that I use in production.  Today's query comes from a need to notify users that a particular page is being retired. Instead of immediately deleting a page and having to deal with confused users, I used the browser view to display a banner telling the users that they have X days until the page is retired.  This could be done manually by creating a different static HTML page display a different date for each page, but I wanted a way to make it easy.
First of all, I didn't want to have to rebuilt the banner for each page that is going to be retired.  So, I needed a way that each instance of the banner have a way to store an individual expiration date.  I also wanted a way for users who don't want their precious pages deleted to notify me.  A simple email would have done, but that would have almost always involved an immediate ping back to the user asking which page.  So, the banner needs a way to start an email and automatically put the URL to the page.
The implementation is pretty easy.

  1. First of all, get this first section of code, update 'email@company.com' to your email address on the fourth to last line and save it as pageexpiring.html in your custom content directory.  Download a copy of the code here.
  2. Then put a browser view on the page to be retired and set the URL to point to pageexpiring.html in your custom content directory and save the view.  When the page refreshes, you should see a message saying that the page has been scheduled to be retired on an unknown date.  
  3. To add a specific date, edit the browser view and append ?expirationdate=3/31/2013 to the URL (replacing 3/31/2013 with the page retirement date).
  4. Repeat steps 2 and 3 for any remaining pages to be retired.


Now that you've marked a couple pages to be retired, you can use an ODBC connection to display all those pages.  Here's the SelectCommand and OdbcConnection String to put in the configuration.xml:


To create the view, run the following SQL commands against the NPC server:

No comments:

Post a Comment