Example:
@If( Form="Category" & !@IsDocBeingEdited ; "Overview" ; Form )This is useful for me due to a bad application design choice in one of the application templates I manage.
My useful and useless experiments with Lotus Notes / Domino
@If( Form="Category" & !@IsDocBeingEdited ; "Overview" ; Form )Function contentChangedSinceLastFTIndex( db As NotesDatabase, Byval query As String ) As Boolean
Dim session As New NotesSession
Dim lastFTIndexed As Variant
lastFTIndexed = db.LastFTIndexed
'// First test (least resource-hungry)
If Not ( db.LastModified > lastFTIndexed ) Then
contentChangedSinceLastFTIndex = False
Exit Function
End If
'// Conclusive test - test if actual documents (not design elements) have
'// been changed since last FTIndex
Dim dateFTIndexed As New NotesDateTime ( lastFTIndexed )
Dim col As NotesDocumentCollection
If query = "" Then
'// Has any document changed?
Set col = db.GetModifiedDocuments( dateFTIndexed )
Else '// Has documents fitting [query] changed since last FTIndex?
'// Adjust the FTIndexed-date by a second, to avoid getting the
'// last saved document (if the FT-index is up to date)
Call dateFTIndexed.AdjustSecond( 1 )
Set col = db.Search( query, dateFTIndexed, 0 )
End If
If col.Count > 0 Then contentChangedSinceLastFTIndex = True
End Functionprivate boolean contentChangedSinceLastFTIndex( Database db, String query) throws NotesException {
DateTime dateFTIndexed = db.getLastFTIndexed();
// First test (least resource-hungry)
if ( db.getLastModified().timeDifference( dateFTIndexed ) <= 0) {
return false;
}
// Conclusive test - test if actual documents (not design elements) have
// been changed since last FTIndex
DocumentCollection col;
if (query.length() == 0) { // Has any document changed?
col = db.getModifiedDocuments( dateFTIndexed );
} else {
// Has documents fitting [query] changed since last FTIndex?
// Adjust the FTIndexed-date by a second, to avoid getting the
// last saved document (if the FT-index is up to date)
dateFTIndexed.adjustSecond(1);
col = db.search( query, dateFTIndexed, 0);
}
if (col.getCount() > 0) {
return true;
} else {
return false;
}
}
Element.implement({
// Removes all underlying text nodes
removeTextNodes: function( startNode ){
var initialNode = this || startNode;
var childList = initialNode.childNodes;
if( childList.length === 0 ){ return; }
// Walk through all childNodes. If text - remove, else search/destroy
// potentially underlying text nodes
var currentNode;
var nodesToRemove = [];
for( var i = 0, len = childList.length; i < len; i++ ){
currentNode = childList[i];
if( currentNode.nodeName === '#text' ){ nodesToRemove.push( currentNode ); }
else { Element.removeTextNodes( currentNode ); }
}
// When all text nodes on the current level are found, remove them from the DOM
for( i = 0, len = nodesToRemove.length; i < len ; i++ ){
currentNode = nodesToRemove[i];
currentNode.parentNode.removeChild( currentNode );
}
return this;
}
});$('label-with-field').removeTextNodes().appendText('newLabel')2009 All Rights Reserved DontPanic - a blog about Lotus Notes / Domino.
Free Blogger Templates by DeluxeTemplates.net • Wordpress designed by Acosmin