/*
Info:
The following is code is to render the domino view html and to make the view look better
*/
//Global Variable Declarations
var imageExpandSection = "/ExpandSection.gif" //Give the name and path of the image for category expand icon
var imageCollapseSection = "/CollapseSection.gif" //Give the name and path of the image for category collapse icon
var urlBaseDb = "/ifcext/spiwebsite1.nsf" //Give the path and name of the base db from where the images, js, css etc are referenced
var idViewDisplay = "viewDisplay" //Mention the id of the TD/Div in which the view html is going to be displayed
var nameViewHTML = "viewHTMLValue" //Mention the name of the text area which has the domino generated view html
//All style classes used in the javascript functions
var classDominoViewTable = "DominoViewAsTable" //Style Class Domino View Table
var classDominoViewTableTD = "DominoTdStyle" //Style Class Domino View Table TD
var classNoDocsFoundTable = "NoDocsFoundTable" //Style Class No douments found table
var classNoDocsFoundTD = "NoDocsFoundTd" //Style Class No douments found TD
var classOddLine = "oddline" //Style Class for Odd Row
var classEvenLine = "evenline" //Style Class for Even Row
var classCategoryRow = "cathead" //Style Class for Category Row
var classTH = "formheader" //Style Class for TH tag
var classDocLink = "DocLink" //Style Class for Document Link
//var objFrm = document.forms[0];
var objFrm = document._DominoForm;
function renderDominoView()
{
//Apply the alternate row color and other rendering to the domino built view html
//var viewHTMLVal = eval("document.forms[0]."+ nameViewHTML+".value");
var viewHTMLVal = document.getElementById("idHTMLValue").value;
var objViewDisplay = document.getElementById( idViewDisplay );
var revisedHTML = alternateColor(viewHTMLVal);
//This is added to check whether the view has collapse / expand option
if (viewHTMLVal.search(/expand=|collapse=/gi) != -1)
{
//Change the expand and collapse images
revisedHTML = revisedHTML.replace(/\/icons\/expand\.gif/gi, urlBaseDb+ imageExpandSection);
revisedHTML = revisedHTML.replace(/\/icons\/collapse\.gif/gi, urlBaseDb+ imageCollapseSection);
revisedHTML = revisedHTML.replace(/HEIGHT=16 WIDTH=16/gi, "");
//For giving link to the category title itself
revisedHTML = revisedHTML.replace(/(ExpandSection.gif(.*?))\<\/a\>(.*?)\<\/td\>/gi, "$1$3");
revisedHTML = revisedHTML.replace(/(CollapseSection.gif(.*?))\<\/a\>(.*?)\<\/td\>/gi, "$1$3");
}
//Remove the ecblank.gif image added by dominio and the extra column added on the right by domino
revisedHTML = revisedHTML.replace(/\
/gi,"");
revisedHTML = revisedHTML.replace(/\
\<\/th\>\<\/tr\>/gi,"");
revisedHTML = revisedHTML.replace(/\ | \<\/td\>\<\/tr\>/gi,"");
revisedHTML = revisedHTML.replace(/\ | \<\/td\>\<\/tr\>/gi,"");
revisedHTML = revisedHTML.replace(/\ | or tag generated by domino so that the style will get applied
revisedHTML = revisedHTML.replace(/\/gi,"");
revisedHTML = revisedHTML.replace(/\<\/font\>/gi,"");
revisedHTML = revisedHTML.replace(/\/gi,"");
revisedHTML = revisedHTML.replace(/\<\/b\>/gi,"");
//For giving tool tip for "In Process" and "Completed" images
revisedHTML = revisedHTML.replace(/\ ");
revisedHTML = revisedHTML.replace(/\ ");
//Write the new html code of the view to the td
revisedHTML = revisedHTML.replace(/height="16"/gi,"")
revisedHTML = revisedHTML.replace(/width="16"/gi,"")
objViewDisplay.innerHTML= revisedHTML
}
function alternateColor(resulting)
{
if ( resulting.match( /\no documents found\<\/h2\>/gi ) )
{
resulting = "";
return resulting;
}
if ( resulting.toLowerCase().split('no documents found')[0] == '' )
{
actualResult = '';
return (actualResult);
}
resulting=resulting.replace(/\r|\n|\r\n/g,"")
resultArr=resulting.replace(/)/gi,'<~tr>')
resultArr=resultArr.split(/\/gi,"| ");
actualResult=actualResult.replace(/ | /gi," | ");
actualResult=actualResult.replace(/nowrap/gi,"");
actualResult=actualResult.replace(/<~tr/gi," | |
|