This Page was Last Updated on...

How do I get the last updated message to work on Lotus Notes.
I tried the standard JavaScript
<SCRIPT LANGUAGE="JavaScript">
self.defaultStatus="This Page...." + document.lastModified;
</SCRIPT>
but it doesn't give the correct time (If I remeber correctly it gives day 1 ie 01/01/70).
Chris_mAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
HemanthaKumarConnect With a Mentor Commented:
Use @Modified function to show the last modified date.

~Hemanth
0
 
Chris_mAuthor Commented:
I cannot because the code is on an HTML page of a 3 frame frameset created using the Web Pages(R4.6) template.
0
 
ghassan99Commented:
Where r u testing the value? I mean on the server or on your workstation?  When 1/1/70 is returned it means that the server didnt supply the date.  Try this on the server for testing:

document.write("<P>Page Last Modified: " + document.lastModified);
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
Chris_mAuthor Commented:
I'll try it and let you know on Monday.  I am working on a standalone workstation with the Notes/Domino server installed on it, so if the server is not supplying the date, the reason is that it does not understand the request.
0
 
Chris_mAuthor Commented:
I have tried your suggestion, but it doesn't work.  Can it be that it is not possible to have "This Page was Last Updated..." message displayed on the message bar at the bottom of the screen.  Incidently, I don't think the date/time comes from the clock, rather some hidden document field that records when the page was last updated.  Is that not so?
0
 
HemanthaKumarCommented:
Hi Chris

Actually the lastModified  property is derived from the HTTP header data sent by the web server. Servers generally obtain this date by examining the file's modification date.  

The last modified date is not a required portion of the header, and some servers do not supply it. If the server does not return the last modified information, JavaScript receives a zero, which it displays as January 1, 1970 GMT. The following code checks the date returned by lastModified  and prints out a value that corresponds to unknown.  


Use this code to overcome avoid displaying the "01/01/70"

lastmod = document.lastModified     // get string of last modified date
lastmoddate = Date.parse(lastmod)   // convert modified string to date
if(lastmoddate == 0){               // unknown date (or January 1,
                                    // 1970 GMT)
   document.writeln("Lastmodified: Unknown")
   } else {
   document.writeln("LastModified: " + lastmod)
}

~Hemanth
0
 
ghassan99Commented:
From the netscape developer website here is a clearer explaination:
"Description
The lastModified property is derived from the HTTP header data sent by the web server. Servers generally obtain this date by examining the file's modification date.
The last modified date is not a required portion of the header, and some servers do not supply it. If the server does not return the last modified information, JavaScript receives a 0, which it displays as January 1, 1970 GMT. The following code checks the date returned by lastModified and prints out a value that corresponds to unknown.

lastmod = document.lastModified // get string of last modified datelastmoddate = Date.parse(lastmod)   // convert modified string to dateif(lastmoddate == 0){               // unknown date (or January 1, 1970 GMT)   document.writeln("Lastmodified: Unknown")   } else {   document.writeln("LastModified: " + lastmod)}"

Anyway Domino R4.x server doesnt seem to be able to interpret the request, R5 can due to the tight integration of JS and Domino.  So the ingeniuos solution provided above will always give u 'Unknown', which is not very informative and clearly not a proper solution.  

The way I see this is to create an agent that gets triggered when u modify the document, this agent will write the date to a doc, which is already created.  Then in the web page itself there will be a link to run an agent which will read that document and write the date to the web page.  Using something like 'Print"<P> Last Accessed: " + datemod + "</P>"'  All this work is becasue the web pages template is not that flexible, but honestly I use it for my own web page, it makes u work more which is better on the long run.  I used something similar for a trial counter object I created before.  Would u like to be adventurous?:)

PS "give credit where credit is due" Wise Man
0
 
ghassan99Commented:
Here is the solution I came up with, I will post it here in case someone one day paid some points to see this question.

Add a field in the 'Web Page Using HTML' form called lets say 'LMod', make it of type editable with a default value of '@now'.  Now open your webpage that was created earlier with that form and re-save your doc for the field to take effect.

In the form's query save event, add this line to the end of the code which is already there, 'Call source.fieldsettext("LMod",Str(Now))'

Then create the following shared agent with the property 'run as web user' checked in the agent properties dialog.

In the view 'All Pages' cut the first column (which is made of of 1 and 2 values) and paste it after the column 'Page Title/Name' column.  As an optional work, you can add a new column in the 'All Pages' view called 'Last Modified' with the value of 'LMod'.  

Create a shared agent with the following attributes:

When? Manually from Actions Menu.
Which? Run Once.

Lotus Script:

Sub Initialize
      Dim s As New notessession
      Dim db As notesdatabase
      Dim v As notesview
      Dim doc As notesdocument
      Dim doc_v As notesdocument
      Dim cgiqs As String
      Dim text As String
      
      Set doc = s.documentcontext
      Set db = s.currentdatabase
      Set v = db.getview("All Pages")
      cgiqs = doc.Query_String(0)
      
      If Instr(Lcase(cgiqs) , "&pagename=" ) > 0 Then
            text = Mid ( cgiqs , Instr ( cgiqs , "&pagename=" ) + Len (
"&pagename=" ) )
            If Instr ( text , "&" ) > 0 Then
                  text = Left ( text , Instr ( text , "&" ) -1 )
            End If
      End If
      
      Set doc_v = v.getdocumentbykey(text)      
      text_d = doc_v.getitemvalue("LMod")
      Print "Content-Type:text/plain"
      Print "Content-Type:text/html"
      Print "<HTML>"
      Print "<body BGCOLOR='#FFFFFF' text='#000000'>"
      Print"<h5><strong><p align='center'>Last Updated: (" + text_d(0) +
")</p></strong></h5>"
End Sub


Finally, Add this in your HTML Page:

<!-- For IE-->
<CENTER><IFRAME align="center" width="350" height="40"
SRC="http://www.4c.com.kw/testweb1.nsf/adddate?openagent&pagename=4C"
frameborder=0 noresize scrolling=no></IFRAME></CENTER>

<!-- For Communicator-->
<CENTER><LAYER
SRC="http://www.4c.com.kw/testweb1.nsf/adddate?openagent&pagename=4C"
LEFT="70" WIDTH="640"></LAYER></CENTER>
<BR><BR>

If you want more control you have to use JS
and choose based on the user's browser.  
You can add both tags it will work fine though, but if there are text/tags in between they will not be ignored by the corresponding browser.  

For more info on the IFrame and Layer tags check the many HTML reference sights on the web.
0
All Courses

From novice to tech pro — start learning today.