home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.tcs3.com
/
ftp.tcs3.com.tar
/
ftp.tcs3.com
/
DRIVERS
/
Audio
/
Office2010
/
ProPlus.WW
/
ProPsWW2.cab
/
VIEW.JS4
< prev
next >
Wrap
Text File
|
2007-02-04
|
8KB
|
290 lines
/*********************************************************************
Notice
You may not modify, use, copy or distribute this file or its contents.
Internal interfaces referenced in this file are nonpublic, unsupported
and subject to change without notice. These interfaces may not be
utilized in other software applications or components.
*********************************************************************/
var g_objDataList;
var g_DataListInitialized = false;
var g_IsClearingSearchResults = false;
var g_CurrentRecordID = -1;
var g_CurrentFormID = -1;
var g_PreviousRecordID = -1;
var g_PreviousFormID = -1;
var g_PreviewTimeoutID;
var g_ResizeTimeoutID;
// =====================================================
// === Document Event Handlers ===
// =====================================================
document.oncontextmenu = contextMenuEvent;
function contextMenuEvent()
{
// Right-click context menu will only appear if 'Ctrl' key is held down.
if (!event.ctrlKey)
event.returnValue = false;
}
// =====================================================
// === View Initialization ===
// =====================================================
function initViewPage(i_ViewID)
{
// Pass out document to be used by glue code.
getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").SetCurrentDocument(document);
// Find the data view object in the page.
var arrObject = document.getElementsByTagName("OBJECT");
if (arrObject.length > 0)
{
g_objDataList = arrObject[0];
resizeDataListDelayed();
}
if (g_objDataList)
setTimeout("enableDataList()", 50);
// Tell the UIDelegate we are in the ViewData state.
getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").SwitchWebState(FormsUIState_ViewData, g_CurrentRecordID);
// Add the document so HTMLComponentBridge can spin up objects.
addDocument();
}
function resizeDataList()
{
window.clearTimeout(g_ResizeTimeoutID);
g_ResizeTimeoutID = window.setTimeout("resizeDataListDelayed()", 10);
}
function resizeDataListDelayed()
{
var intHeight = document.body.offsetHeight;
var intWidth = document.body.offsetWidth;
if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ShowPreviewPane)
{
intHeight += 2;
intWidth += 4;
}
g_objDataList.height = intHeight;
g_objDataList.width = intWidth;
}
function enableDataList()
{
try
{
if (g_objDataList.IGrooveDataListDisplay.Initialized)
{
g_DataListInitialized = true;
getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").EnableDataList(document, g_objDataList);
g_objDataList.focus();
}
else
{
setTimeout("enableDataList()", 50);
}
}
catch (error)
{
window.setTimeout("enableDataList()", 50);
}
}
// =====================================================
// === View Termination ===
// =====================================================
function terminateViewPage()
{
// Remove the document so HTMLComponentBridge can terminate objects.
removeDocument();
}
// =====================================================
// === Button Event Handlers ===
// =====================================================
function goOpen(i_RowID)
{
// Make sure the selected record ID is valid.
if (typeof i_RowID == "undefined" || i_RowID == null)
{
if (g_CurrentRecordID != null && g_CurrentRecordID != -1 &&
getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DoesRecordExist(i_RowID))
i_RowID = g_CurrentRecordID;
else
return;
}
// If the row is not a valid record, return else open the record.
if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsValidRecord(i_RowID))
return getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").OpenViewRecord(i_RowID);
else
return;
}
function goDelete()
{
try
{
getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").DeleteViewRecord(document);
if (g_objDataList)
g_objDataList.focus();
}
catch(error)
{
}
}
// =====================================================
// === Record Preview Handlers ===
// =====================================================
function goPreview(i_RowID)
{
if (g_IsClearingSearchResults)
return;
window.clearTimeout(g_PreviewTimeoutID);
if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsValidRecord(i_RowID))
g_PreviewTimeoutID = window.setTimeout("goPreviewDelayed(" + i_RowID + ")", 350);
else
resetPreviewPane();
}
function goPreviewDelayed(i_RowID)
{
return getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").PreviewViewRecord(i_RowID, document);
}
// =====================================================
// === Callback Preview Handlers ===
// =====================================================
function goPreviewRecord(i_RecordID, i_FormID)
{
if (g_IsClearingSearchResults)
return;
g_PreviousRecordID = g_CurrentRecordID;
g_PreviousFormID = g_CurrentFormID;
g_CurrentRecordID = i_RecordID;
g_CurrentFormID = i_FormID;
if (g_PreviousFormID == g_CurrentFormID && g_CurrentFormID != -1)
{
window.top.FormsPreviewPage.removeDocument();
window.top.FormsPreviewPage.initFormPage(i_RecordID);
}
else if (g_CurrentFormID != -1)
{
// Get the default form if the one from the record doesn't exist.
if (!getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DoesDesignObjectExist(g_CurrentFormID))
{
g_CurrentFormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DefaultFormID;
if (!getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DoesDesignObjectExist(g_CurrentFormID))
{
resetPreviewPane();
return;
}
}
// If there is a valid FormID, then navigate to that form and record.
var FormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(g_CurrentFormID);
var RecordID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(g_CurrentRecordID);
goPreviewURL("FormsFormTemplate.html?FormID=" + FormID + "&RecordID=" + RecordID + "&PreviewPane=true");
}
else
{
// If there is not valid FormID, then reset the preview pane.
resetPreviewPane();
}
}
function goPreviewURL(i_URL)
{
if (typeof window.top.FormsPreviewPage != "undefined" && window.top.FormsPreviewPage != null)
window.top.FormsPreviewPage.location.href = i_URL;
}
function reloadPreviewPane()
{
if (g_CurrentRecordID != -1)
goPreview(g_CurrentRecordID);
}
function resetPreviewPane()
{
goPreviewURL("FormsBlankPage.html");
g_CurrentRecordID = -1;
g_PreviousRecordID = -1;
g_CurrentFormID = -1;
g_PreviousFormID = -1;
}
function clearingSearchResultsBegin()
{
g_IsClearingSearchResults = true;
}
function clearingSearchResultsEnd()
{
g_IsClearingSearchResults = false;
}
// =====================================================
// === View Event Handlers ===
// =====================================================
function goSetFocusRecordID(i_RowID)
{
var RecordID = i_RowID;
if (RecordID != null)
{
g_CurrentRecordID = RecordID;
getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").SetFocusRecordID(RecordID);
if (RecordID != -1)
g_objDataList.IGrooveDataListDisplay.ScrollToRow(RecordID);
}
}
function goSetSelectedRecordID(i_DataListDisplay)
{
getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").SelectionChanged(i_DataListDisplay);
}
function goContextMenu(i_DataList, i_RowID, i_XPos, i_YPos)
{
if (i_RowID != null && i_RowID != -1)
getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").ShowDataListContextMenu(i_DataList, i_RowID, i_XPos, i_YPos);
}
// =====================================================
// === Add/Remove Document ===
// =====================================================
function addDocument()
{
getScriptHostQI("IGrooveFormsToolUIDelegateHTMLDocumentPrivate").AddHTMLDocumentForView(document);
}
function removeDocument()
{
getScriptHostQI("IGrooveFormsToolUIDelegateHTMLDocumentPrivate").RemoveHTMLDocument(document);
}