home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.tcs3.com
/
ftp.tcs3.com.tar
/
ftp.tcs3.com
/
DRIVERS
/
Audio
/
Office2010
/
ProPlus.WW
/
ProPsWW.cab
/
FORMSHOMEPAGESCRIPT.JS
< prev
next >
Wrap
Text File
|
2007-02-04
|
6KB
|
186 lines
// global variable decalarations for page objects
var g_objDispatch = getScriptDispatch();
var g_imgButtonLeft = null;
var g_imgButtonMid = null;
var g_imgButtonRight = null;
var g_imgButtonLeftOver = null;
var g_imgButtonMidOver = null;
var g_imgButtonRightOver = null;
// Capture keydown and contextmenu events for the document.
document.onkeydown = keyDownEvent;
document.oncontextmenu = contextMenuEvent;
// === keyDownEvent() ==============
// event handler for key down action
function keyDownEvent()
{
// Capture Ctrl+N and Ctrl+P keystrokes to disable them.
if (event.ctrlKey && (event.keyCode == 78 || event.keyCode == 80))
event.returnValue = false;
}
// === contextMenuEvent() ==============
// event handler for context menu action
function contextMenuEvent()
{
// Right-click context menu will only appear if 'Ctrl' key is held down.
if (!event.ctrlKey)
event.returnValue = false;
}
// === initMainPage() ============================
// initialization function to load main forms page
function initMainPage()
{
if (g_objDispatch == null)
return false;
if (!g_objDispatch.GetIsSafeForUI())
{
window.setTimeout("initMainPage()", 1000);
return;
}
var arrNames = g_objDispatch.GetDatabaseNames();
if (arrNames.length > 0)
{
var viewsEnum = g_objDispatch.GetViewNameURLEnum(arrNames[0]);
var formsEnum = g_objDispatch.GetFormNameURLEnum(arrNames[0]);
if (viewsEnum != null && formsEnum != null)
{
if (viewsEnum.HasMore() && formsEnum.HasMore())
{
window.location.href = "FormsViewFrame.html";
}
else
{
setVisibility("divMain", "visible");
disableUICommands();
}
}
else
{
window.setTimeout("initMainPage()", 1000);
return;
}
}
else
{
setVisibility("divMain", "visible");
disableUICommands();
}
if (g_objDispatch.CanUseDesigner())
{
try
{
setDisplay("divDesigner", "block");
var intDBCount = g_objDispatch.GetDatabaseCount();
var bFormsViewsExist = g_objDispatch.AreThereFormsOrViews();
//if (intDBCount <= 0)
if (!bFormsViewsExist)
{
setVisibility("spnDesigner", "visible");
setDisplay("divButtons", "block");
}
}
catch (error)
{
// Hide designer related divs on error.
setDisplay("divDesigner", "none");
setVisibility("spnDesigner", "hidden");
setDisplay("divButtons", "none");
// Show generic non-designer div on error.
setDisplay("divNonDesigner", "block");
}
}
else
setDisplay("divNonDesigner", "block");
// Pre-load the images for the button mouseovers.
g_imgButtonLeft = new Image(11, 22);
g_imgButtonLeft.src = "button_left.gif";
g_imgButtonMid = new Image(11, 22);
g_imgButtonMid.src = "button_mid.gif";
g_imgButtonRight = new Image(11, 22);
g_imgButtonRight.src = "button_right.gif";
g_imgButtonLeftOver = new Image(11, 22);
g_imgButtonLeftOver.src = "button_left_over.gif";
g_imgButtonMidOver = new Image(11, 22);
g_imgButtonMidOver.src = "button_mid_over.gif";
g_imgButtonRightOver = new Image(11, 22);
g_imgButtonRightOver.src = "button_right_over.gif";
}
// === goCreate() ========================================
// called when the "Create from Scratch" button is clicked
function goCreate()
{
g_objDispatch.CreateNewForm();
}
// === goBrowse() ========================================
// called when the "Browse Templates..." button is clicked
function goBrowse()
{
g_objDispatch.ImportDbObjects();
}
// === doButtonOver(string) =======================
// highlight button images when user mouses over it
function doButtonOver(i_Name)
{
changeButtonImages(i_Name, g_imgButtonLeftOver.src, g_imgButtonMidOver.src, g_imgButtonRightOver.src);
}
// === doButtonOut(string) ==============================
// reset the button images when the user mouses out of it
function doButtonOut(i_Name)
{
changeButtonImages(i_Name, g_imgButtonLeft.src, g_imgButtonMid.src, g_imgButtonRight.src);
}
// === changeButtonImages(string, string, string, string) ====================
// change the look of a button with the passed in name by replacing the images
function changeButtonImages(i_Name, i_strLeft, i_strMid, i_strRight)
{
var objButtonLeft = document.getElementById(i_Name + "Left");
var objButtonMid = document.getElementById(i_Name + "Mid");
var objButtonRight = document.getElementById(i_Name + "Right");
if (objButtonLeft && objButtonMid && objButtonRight)
{
objButtonLeft.src = i_strLeft;
objButtonMid.background = i_strMid;
objButtonRight.src = i_strRight;
}
}
// === setDisplay(string, string) ===================
// sets the dhtml display property for a given object
function setDisplay(i_ID, i_Display)
{
var objDisplay = document.getElementById(i_ID);
if (objDisplay != null)
objDisplay.style.display = i_Display;
}
// === setVisibility(string, string) ===================
// sets the dhtml visibility property for a given object
function setVisibility(i_ID, i_Visibility)
{
var objVisibility = document.getElementById(i_ID);
if (objVisibility != null)
objVisibility.style.visibility = i_Visibility;
}
// === disableUICommands() =================================
// disable buttons in the command bar that can't be used yet
function disableUICommands()
{
g_objDispatch.ShowUICommands(true);
g_objDispatch.SetUICommandEnabled("GUIC_FormsTool_Search", false);
g_objDispatch.SetUICommandContainerEnabled("GUIC_FormsTool_FormMenu", false);
g_objDispatch.SetUICommandContainerEnabled("GUIC_FormsTool_ViewMenu", false);
}