⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 viewnav.js

📁 关于网上汽车销售系统的详细编程项目实战实例
💻 JS
📖 第 1 页 / 共 4 页
字号:
	{
		changeClass( findButtonId( "cancel" ), "disable" );
	}

	//Change from "Page" to "Retrieving"
	var id = findButtonId( "pagelabel" );

	targetLink = getLinkById(id)

	//Get the new image
	newLink = btnArray[id-1];
	changeCaptionAndStyle(targetLink, g_Retrieving, newLink.bClassOff);
	newLink.fState = "off";
}

///////////////////////////////////////////////////////////////////////////////

function enableToolBarButtons()
{
	UpdatePageButtons();

	changeClass( findButtonId( "goto" ), "enable" );

	if (!js_IsReportCompleted)
	{
		changeClass( findButtonId( "search" ),   "disable");
		changeClass( findButtonId( "download" ), "disable");
		changeClass( findButtonId( "print" ),    "disable" );
		changeClass( findButtonId( "toc" ),      "disable");

		changeClass( findButtonId( "cancel" ),   "enable" );
	}
	else
	{
		changeClass( findButtonId( "download" ), "enable" );
		changeClass( findButtonId( "print" ),     "enable" );
		//IF BOTH THE VALUES ARE TRUE THEN ONLY ONE SHOULD BE SELECTED - Bose
		if (parent.g_searchOpen)
		{
			if (parent.tocOpen)
			{
				changeClass( findButtonId( "search" ), "off" );
			}
			else
			{
				changeClass( findButtonId( "search" ), "on" );
			}
		}
		else
		{
			changeClass( findButtonId( "search" ), "off" );
		}
	}

	//Change from "Retrieving" to "Page"
	var id = findButtonId( "pagelabel" );

	targetLink = getLinkById(id)

	// Get the new image
	newLink = btnArray[id-1];
	changeCaptionAndStyle(targetLink, g_Page, newLink.bClassOn);
	newLink.fState = "on";
}

///////////////////////////////////////////////////////////////////////////////

function disableSearchToolBarButtons()
{
	if( parent.g_bSearchFrameLoaded &&
		parent.frames.searchtoolbar &&
		parent.frames.searchtoolbar.disableSearchToolbar)
	{
		parent.frames.searchtoolbar.disableSearchToolbar();
	}
}

///////////////////////////////////////////////////////////////////////////////

function enableSearchToolBarButtons()
{
	if( parent.g_bSearchFrameLoaded &&
		parent.frames.searchtoolbar &&
		parent.frames.searchtoolbar.enableSearchToolbar)
	{
		parent.frames.searchtoolbar.enableSearchToolbar();
	}
}

///////////////////////////////////////////////////////////////////////////////

function getLinkById(id)
{
	var targetLink;

	// Get the target link, which is to be swapped
	if ( ns4 )
	{
		//alert(targetLink = document.layers[0].document.layers.length);
		targetLink = document.layers[0].document.layers[id-1].document.anchors[0];
	}
	else
	{
		targetLink = elementLocate(document, id);
	}

	return targetLink;
}

///////////////////////////////////////////////////////////////////////////////

function changeClass( id, state )
{
	if(id == -1)
		return;

	var targetLink;
	var newLink;

	// Get the target image, which is to be swapped
	targetLink = getLinkById(id)

	// Get the new image
	newLink = btnArray[id-1];

	if (state == "off")
	{
		setClassName(targetLink, newLink.bClassOff);
		newLink.fState = "off";
	}
	else if ( state == "on" )
	{
		setClassName(targetLink, newLink.bClassOn);
		newLink.fState = "on";
	}
	else if ( state == "over" )
	{
		setClassName(targetLink, newLink.bClassOver);
	}
	else if ( state == "down" )
	{
		setClassName(targetLink, newLink.bClassDown);
	}
	else if ( state == "enable" )
	{
		setClassName(targetLink, newLink.bClassOff);
		newLink.fState = "off";
	}
	else if ( state == "disable" )
	{
		setClassName(targetLink, newLink.bClassDis);
		newLink.fState = "dis";
	}
}

///////////////////////////////////////////////////////////////////////////////

function buttonClick( id )
{
	var btnClicked = btnArray[id - 1];
	var buttonDescription = btnClicked.bDescription;

	if ( buttonDescription == 'toc' )
	{
		tocClick();
	}
	else if ( buttonDescription == 'search' )
	{
		searchClick();
	}
	else if ( buttonDescription == 'firstpage' )
	{
		firstPageClick();
	}
	else if ( buttonDescription == 'lastpage' )
	{
		lastPageClick();
	}
	else if ( buttonDescription == 'previouspage' )
	{
		previousPageClick();
	}
	else if ( buttonDescription == 'nextpage' )
	{
		nextPageClick();
	}
	else if ( buttonDescription == 'goto' )
	{
		gotoClick();
	}
	else if ( buttonDescription == 'cancel' )
	{
		CancelClick();
	}
	else if ( buttonDescription == 'help' )
	{
		helpClick();
	}
	else if ( buttonDescription == 'download' )
	{
	    downloadClick();
	}
	else if ( buttonDescription == 'print' )
	{
	    printClick();
	}
	else if( buttonDescription == 'exit' )
	{
		if (!js_IsReportCompleted && !js_IsPersistent && !g_cancelled)
		{
			// If it is a transient report and the generation is not done, we cancel the execution.
			// The click on the "X" button becomes equivalent to a click on the "Cancel" button.
			CancelClick();
		}
		else
		{
			if (btnClicked.bDestroy)
				parent.window.close();
			else
				exitClick();
		}
	}
}

///////////////////////////////////////////////////////////////////////////////

function exitClick()
{
	var curHistoryLength = parent.history.length;

	// If the DHTML Client frameset is embedded in another frame, then we are trying to go back using
	// that frame's history list. If the DHTMl Client frameset URL is the first one in the history list
	// of the embedding frame, the exit button will have no action.

	if (curHistoryLength == 0)
	{
		parent.window.close();
	}
	else
	{
		parent.history.go(parent.g_beforeHistoryLength - curHistoryLength - 1);
	}
}

///////////////////////////////////////////////////////////////////////////////

function CancelClick()
{
	g_cancelled = 1;

	// disable all active buttons first
	changeClass( findButtonId( "cancel" ),       "disable" );
	changeClass( findButtonId( "firstpage" ),    "disable" );
	changeClass( findButtonId( "previouspage" ), "disable" );
	changeClass( findButtonId( "lastpage" ),     "disable" );
	changeClass( findButtonId( "nextpage" ),     "disable" );
	changeClass( findButtonId( "goto" ),         "disable" );

	var url = "../cancelreport.do" + js_ObjURL;

	if (parent != null && parent.sConnectionHandle)
	{
		url = replaceDuplicateParams( url, "connectionHandle", encode(parent.sConnectionHandle));
	}

	window.location = url;
}

///////////////////////////////////////////////////////////////////////////////

function helpClick()
{
	var sLink = g_helpBase + "wwhelp.htm?single=true&context=jsp_viewer&topic=ViewingFramework_mainview";
	theHelpWindow = openNewDefaultWindow( sLink, "helpwindow");
	theHelpWindow.focus();
}

///////////////////////////////////////////////////////////////////////////////
function framesetURLWithObjectID(loc)
{
	var TOCRE    = /ShowTOC=(FALSE|TRUE)/;
	var SearchRE = /ShowSearch=(FALSE|TRUE)/;

	var orgURL = loc.href;

	var retURL = "../viewer/viewframeset.jsp" + js_ObjURL;
	var match;

	match = orgURL.match( TOCRE );
	if( match != null )
	{
		if(!TOCRE.test(js_ObjURL))
			retURL += "&" + match[0];
	}

	match = orgURL.match( SearchRE );
	if( match != null )
	{
		if(!SearchRE.test(js_ObjURL))
			retURL += "&" + match[0];
	}

	return retURL;
}

///////////////////////////////////////////////////////////////////////////////

function toggleSearchFramesetNewPage(searchOpen)
{
	if (parent.g_loadAction)
		parent.g_loadAction = "SEARCH_CLICK";

	newURL = framesetURLWithObjectID(parent.window.location);

	newURL = replaceDuplicateParams(newURL , "page" , hiddenValue);

	searchString = "ShowSearch=";
	match = newURL.lastIndexOf( searchString );

	falseRegExp = new RegExp( "ShowSearch=FALSE" );
	trueRegExp	= new RegExp( "ShowSearch=TRUE" );

	if ( searchOpen )
	{
		// Close the Search Frame
		if ( match != -1 )
		{
		   newURL = replaceDuplicateParams(newURL , "ShowSearch" , "FALSE" );
		}
		else
		{
		   newURL = replaceDuplicateParams(newURL , "ShowSearch" , "FALSE");
		}

		parent.window.location.replace( newURL )
	}
	else
	{
		// Open the Search Frame
		if ( match != -1 )
		{
		   newURL = replaceDuplicateParams(newURL , "ShowSearch" , "TRUE" );
		}
		else
		{
		   newURL = replaceDuplicateParams(newURL , "ShowSearch" , "TRUE");
		}

		searchString = "ShowTOC=";

		match = newURL.lastIndexOf( searchString );

		falseRegExp = new RegExp( "ShowTOC=FALSE" );
		trueRegExp	= new RegExp( "ShowTOC=TRUE" );

		if ( match != -1 )
		{
		   newURL = replaceDuplicateParams(newURL , "ShowTOC" , "FALSE" );
		}
		else
		{
		   newURL = replaceDuplicateParams(newURL , "ShowTOC" , "FALSE");
		}

		parent.window.location.replace( newURL )
	}
}

///////////////////////////////////////////////////////////////////////////////

function toggleSearchFramesetSamePage(searchOpen)
{
	if ( searchOpen )
	{
		// Close the Search Frame
		parent.reportframe.hideAllHashItemsInPage();

		// If the Toc Frame was previously open... then reopen it.
		if ( parent.tocOpen )
		{
			elementLocate(parent.document, "reportframeset").cols = g_tocCols;
			elementLocate(parent.document, "searchframe").noResize = false;
			elementLocate(parent.document, "tocAndSearch").rows   = g_tocRows;
			changeClass( findButtonId( "toc" ), "on" );
		}
		else
		{
			elementLocate(parent.document, "reportframeset").cols = g_reportCols;
			elementLocate(parent.document, "searchframe").noResize = true;
			changeClass( findButtonId( "toc" ), "off" );
		}
	}
	else
	{
		// Open the Search Frame
		if (!parent.g_bSearchFrameLoaded)
		{
			//CONNECTION HANDLE CHANGE....
			if (parent.sConnectionHandle)
			{
				parent.g_searchFrameURL = replaceDuplicateParams(parent.g_searchFrameURL , "connectionHandle", encode(parent.sConnectionHandle));
			}
			parent.frames.searchframe.location.replace( parent.g_searchFrameURL );
			parent.frames.searchtoolbar.location.replace( parent.g_searchTBFrameURL );
		}
		elementLocate(parent.document, "reportframeset").cols = g_searchCols;
		elementLocate(parent.document, "searchframe").noResize = false;
		elementLocate(parent.document, "tocAndSearch").rows   = g_searchRows;
		parent.reportframe.hideBalloons();
		parent.reportframe.setupSearch();

		// Close the Toc Frame
		if (parent.tocOpen)
		{
			changeClass(findButtonId("toc"), "off");
		}
	}
}

///////////////////////////////////////////////////////////////////////////////

function toggleTOCFramesetNewPage()
{
	if (parent.g_loadAction)
		parent.g_loadAction = "TOC_CLICK";

	newURL = framesetURLWithObjectID(parent.window.location);//parent.window.location.href;
	newURL = replaceDuplicateParams(newURL , "page" , hiddenValue);

	searchString = "ShowTOC=";
	match = newURL.lastIndexOf( searchString );

	falseRegExp = new RegExp("ShowTOC=FALSE");
	trueRegExp	= new RegExp("ShowTOC=TRUE");

	if ( parent.tocOpen )
	{
		// Close the Toc Frame
		if ( match != -1 )
		{
		   newURL = replaceDuplicateParams(newURL , "ShowTOC" , "FALSE");
		}
		else
		{
		   newURL = replaceDuplicateParams(newURL , "ShowTOC" , "FALSE");
		}

		parent.window.location.replace( newURL );
	}
	else
	{
		// Open the Toc Frame
		if ( match != -1 )
		{
			newURL = replaceDuplicateParams(newURL , "ShowTOC" , "TRUE");
		}
		else
		{
			newURL = replaceDuplicateParams(newURL , "ShowTOC" , "TRUE");
		}

		searchString = "ShowSearch=";

		match = newURL.lastIndexOf( searchString );

		falseRegExp = new RegExp( "ShowSearch=FALSE" );
		trueRegExp	= new RegExp( "ShowSearch=TRUE" );

		if ( match != -1 )
		{
			newURL = replaceDuplicateParams(newURL , "ShowSearch" , "FALSE" );
		}
		else
		{
			newURL = replaceDuplicateParams(newURL, "ShowSearch" , "FALSE");
		}
		parent.window.location.replace( newURL );
	}
}

///////////////////////////////////////////////////////////////////////////////

function toggleTOCFramesetSamePage()
{
	if (!parent.tocframe)
		return;

	if ( parent.g_searchOpen )
	{
		searchClick();
		g_searchPreviouslyOpen = true;
	}

	if ( parent.tocOpen )
	{
		// Close the Toc Frame
		elementLocate(parent.document, "reportframeset").cols = g_reportCols;

		elementLocate(parent.document, "searchframe").noResize = true;

		if ( g_searchPreviouslyOpen )
		{
			searchClick();
			g_searchPreviouslyOpen = false;
		}
	}
	else
	{
		if (!parent.g_bTocFrameLoaded)
		{
			//CONNECTION HANDLE ISSUE
			parent.g_tocFrameURL = replaceDuplicateParams(parent.g_tocFrameURL , "connectionHandle", encode(parent.sConnectionHandle));
			parent.frames.tocframe.location.replace( parent.g_tocFrameURL );
		}

		// Open the Toc Frame
		elementLocate(parent.document, "reportframeset").cols = g_tocCols;

		elementLocate(parent.document, "searchframe").noResize = false;
		elementLocate(parent.document, "tocAndSearch").rows   = g_tocRows;
	}
}

///////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -