📄 print.jsp
字号:
<%@page language="java" session="true" import="fr.ier.cuss.globaldemo.*" %>
<%@ include file = "include/util.jsp" %>
<%
ListOfDevices listOfDevices = (ListOfDevices) session.getAttribute("ListOfDevices");
Passenger passenger = (Passenger)session.getAttribute("Passenger");
String svgBoardingPassData = PrintingTool.formatSvgBoardingPass(passenger, getSvgBoardingPassFile());
String aeaBoardingPassData = PrintingTool.formatAeaBoardingPass(passenger, getAeaBoardingPassFile());
if ((session.getAttribute("UseATBDocument") != null) && (session.getAttribute("UseATBDocument").equals("true"))) {
aeaBoardingPassData = PrintingTool.formatAeaBoardingPass(passenger, getAeaBoardingPassFile2());
}
String aeaBaggageTagData = PrintingTool.formatAeaBaggageTag(passenger, getAeaBaggageTagFile());
%>
<html>
<head>
<%@ include file = "include/header.jsp" %>
<script language="JavaScript1.2">
// gppprinter_svg_data
var gppprinter_svg_data = "<%= svgBoardingPassData%>";
// atb2device_aea_data
var atb2device_aea_data = "<%= aeaBoardingPassData%>";
// baggagetag_aea_data
var baggagetag_aea_data = "<%= aeaBaggageTagData%>";
// timeout to force to put application in available state
var timeout = 10000; // 10s
// session timeout timer id
var timeoutTimer;
//--------------------------------------------------------------------------
/**
* Start the timeout timer
*/
function startTimeoutTimer() {
timeoutTimer = setTimeout("timeoutReached()", timeout);
}
//--------------------------------------------------------------------------
/**
* Stop the timeout timer
*/
function stopTimeoutTimer() {
clearTimeout(timeoutTimer);
}
//--------------------------------------------------------------------------
/**
* callback function when timeout is reached
* @return
*/
function timeoutReached() {
captureATBDocument();
generateEvent("quit");
}
//--------------------------------------------------------------------------
/**
* Init page
*/
function init2() {
document.body.style.cursor = "wait";
// start print all documents
var code = printAll();
if (code != 0) { // ok
displayInvalidPage();
}
generateEvent("quit");
}
//------------------------------------------------------------------------
/**
* Print GPP data
*/
function printBoardingPassSVG(streamSVG) {
return printData("BoardingPass", "SVG", streamSVG);
}
//------------------------------------------------------------------------
/**
* Print GPP data
*/
function printBoardingPassAEA(streamAEA) {
return printData("BoardingPass", "AEA", streamAEA);
}
//------------------------------------------------------------------------
/**
* Print a baggage tag
*/
function printBaggageTag(streamBagTagAEA) {
return printData("BaggageTag", "AEA", streamBagTagAEA);
}
//------------------------------------------------------------------------
/**
* Print data
*/
function printData(mediaType, datatype, stream) {
if(applet) {
return applet.send(mediaType, datatype, stream);
}
else {
alert("Please activate the JVM on the browser first.");
}
}
//------------------------------------------------------------------------
/**
* Interccept event
*/
function processEventBis(event) {
var code = event.get("statusCode");
var reference = event.get("componentRef");
// if (applet.isAtb2PrinterEvent(reference)) {
if (code == MEDIA_PRESENT) {
document.all["boardingPass"].style.visibility = "visible";
}
else if (code == MEDIA_ABSENT) {
document.all["boardingPass"].style.visibility = "hidden";
stopTimeoutTimer();
}
// }
}
//------------------------------------------------------------------------
/**
* Print all data at the end of the checkin process
* @return
*/
function printAll() {
var code = 0;
if (applet) {
<%
if (listOfDevices.isPrinterExists("GPPRINTER")) {
%>
// SVG Boarding pass printer
if (applet.boardingPassPrinterRequired("SVG")) {
var reg = new RegExp("\'", "g");
var stream = gppprinter_svg_data.replace(reg,'\"');
code = printBoardingPassSVG(stream);
reg = null;
if (code != 0) {
return code;
}
}
<%
}
if (listOfDevices.isPrinterExists("ATB2PRINTER")) {
%>
// AEA Boarding pass printer
if(applet.boardingPassPrinterRequired("AEA")) {
code = printBoardingPassAEA(atb2device_aea_data);
if (code != 0) {
return code;
}
else {
startTimeoutTimer();
applet.offer("BoardingPass","AEA");
}
}
<%
}
if (listOfDevices.isPrinterExists("BAGTAGPRINTER")) {
%>
// AEA Baggage tag printer
if (applet.baggageTagPrinterRequired("AEA")) {// baggage tag printer
stream = baggagetag_aea_data;
code = printBaggageTag(stream);
generateEvent("quit");
if (code != 0) {
return code;
}
}
<%
}
%>
}
return code;
}
</script>
</head>
<body unselectable="on" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" onLoad="javascript:init();init2();" background="<%= backgroundImageName%>">
<table border="0" width="100%" height="100%">
<thead>
<%@ include file = "include/companylogo.jsp" %>
</thead>
<!-- =============================================================== -->
<!-- Body of the table for message -->
<!-- =============================================================== -->
<tbody>
<tr>
<td colspan="4" align="center" height="70%" width="100%" valign="top">
<h1 class="subtitle">Printing ...</h1>
<h1 class="subtitle">Please Wait...</h1>
<h1 class="subtitle"> </h1>
<h1 id="boardingPass" class="subtitle" style="visibility:hidden;">Your boarding pass is available.</h1>
<h1> </h1>
</td>
</tr>
</tbody>
<!-- =============================================================== -->
<!-- Foot of the table for buttons -->
<!-- =============================================================== -->
<tfoot>
</tfoot>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -