quick search:
 

View recently updated sites

Submitted by: macguyver007
Last Edited: 2007-06-21

Category: DTML

Average rating is: 4.0 out of 5 (2 ratings)

Description:
If you run a Zope server with multiple folders which are their own websites. This comes in handy if you would like to see which sites have been updated lately. You can also change the viewable days. So you can choose to see which sites have been updated in the last 5 or 500 days.

Source (Text):
<dtml-unless lessDays>
<dtml-call "REQUEST.set('lessDays', 14)">
</dtml-unless>

<TABLE>
<form method="post">
<b>Sites updated in the last <input type ="text" name="lessDays" value="<dtml-var lessDays>" size="2"> Days.</b>
<input type="submit" value="refresh">
</form>

<dtml-in expr="objectValues('Folder')" sort="bobobase_modification_time" reverse>
<dtml-let date="bobobase_modification_time()">
<dtml-call "REQUEST.set('endDate', _.DateTime() - _.int(lessDays))">
  <dtml-unless "_.string.find(_['id'],'index_html')==0">
  <dtml-if "date > endDate">
  <TR>
    <TD bgcolor="#E3E3E3"><a href="&dtml-absolute_url;"><dtml-var title_or_id></a></TD>
    <dtml-if "date.isCurrentYear() and date.isCurrentMonth() and date.isCurrentDay()">
      <TD bgColor="#CCCCCC"><dtml-var date fmt="aCommon"></TD>
    <dtml-elif "date.isCurrentYear() and date.isCurrentMonth()">
      <TD bgColor="#efefef"><dtml-var date fmt="aCommon"></TD>
    </dtml-if>
      </TR>
  </dtml-if>
  </dtml-unless>
</dtml-let>
</dtml-in>
</TABLE>

Explanation:
Basically I was wanting to see who has been upadting their sites.
So I created a simple method of showing which folderish sites with an index_html
have been updated in a set amount of time. I also wanted to be able to
control how far back it would look. If I were to add more functionality
to this. As you can see it is a bit messy. I would change the logic into a python script
and create an html template to insert the variable values into.


Comments:

No Comments