<%@ LANGUAGE="Jscript" %>
<!--#include file="../../Include/CODE.INC"-->
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
<title>JMSS</title>
<link rel="stylesheet" type="text/css" href="../../include/jmss.css">
<script src="../../include/functions.js"></script>
</head>

<body class="data">
<%Patt=0;%>
<!--#include file="../../Include/Security.INC"-->
<%
	if(parseInt(Request("RETRY"),10)==1){
		jwbmlook = Server.CreateObject("JWBMLook.Look.1");
		Session("jwbmlook") = jwbmlook;
		jwbmlook.ThrowJob(Request("QUEUE"),Request("NAME"),Request("PATH"),Request("PARAMETER"),Request("EXECDIR"),Request("ELAPSE"),Request("PTYPE"),Request("STDOUT"),Request("STDFILE"),SUser,jsrvDef);
	
		if (jwbmlook.resultCode != 0){
			if(parseInt(Request("DLGTYP"),10)==1){
				ErrDlg(jwbmlook.resultCode,0);
			}
			else if(parseInt(Request("DLGTYP"),10)==2){
				ErrDlg(jwbmlook.resultCode,1);
			}
		}
		else{%>
<SCRIPT LANGUAGE="JavaScript">
<!--
//	alert("Wu𓊓܂B\n[jwbmlook.ThrowJob(\"<%=Request("QUEUE")%>\",\"<%=Request("NAME")%>\",\"<%=Request("PATH")%>\",\"<%=Request("PARAMETER")%>\",\"<%=Request("EXECDIR")%>\",\"<%=Request("ELAPSE")%>\",\"<%=Request("PTYPE")%>\",\"<%=Request("STDOUT")%>\",\"<%=Request("STDFILE")%>\",\"<%=SUser%>\",\"<%=jsrvDef%>\")]");//window.close();
	alert("Wu𓊓܂B");
top.close();
//-->
</SCRIPT>
<%		}
//		Session.Abandon;
	}
%>
<SCRIPT LANGUAGE="JavaScript">
<!--
function checkEvent(theForm){

	var workc=0;
	var cvstr="";

	if(	theForm.elements[1].value=="" ){
		alert("Wu`ł");
		return false;
	}
	else{
		if (checkStr(theForm.elements[0].value)) {
			alert("ƖɎgpĂ͂Ȃgp܂B");
			return false;
		}
		if (checkStr(theForm.elements[1].value)) {
			alert("WuɎgpĂ͂Ȃgp܂B");
			return false;
		}
		//Job Name
		if(theForm.elements[0].value==""){
//			if(theForm.elements[1].value.length>32){
				if(theForm.elements[1].value.lastIndexOf("\\") == -1)
					theForm.elements[0].value=theForm.elements[1].value.substring(0,32);
				else
					theForm.elements[0].value=
					theForm.elements[1].value.substring(theForm.elements[1].value.lastIndexOf("\\")+1,theForm.elements[1].value.length);
//				if(theForm.elements[1].value.indexOf("\\")>=0){
//					cvstr="";
//					indexA=indexB=0;
//					while(1){
//						if(theForm.elements[1].value.indexOf("\\",indexA)==-1)
//							break;
//						indexB=theForm.elements[1].value.indexOf("\\",indexA);
//						cvstr+=theForm.elements[1].value.substring(indexA,indexB);
//						cvstr+="\\\\";
//						indexA=indexB+1;
//					}
//					theForm.elements[1].value=cvstr;
//					alert("\"\\\"L\"/\"ɒuĂ");
//					return false;
//				}
//			}
//			else
//				theForm.elements[0].value=theForm.elements[1].value;
		}
		if(theForm.elements[0].value.length){
			theForm.elements[0].value=cutOverLenStr(theForm.elements[0].value, 32);
//			if (cutOverLenStr(theForm.elements[0].value, 32)) {
//				alert("Ɩ܂B32oCgȓŎw肵ĂB");
//				return false;
//			}
		}
		//Standard Out
		if(theForm.elements[6].checked){
			if(theForm.elements[7].value.length){
				if (checkStr(theForm.elements[7].value)) {
					alert("Wo̓t@CɎgpĂ͂Ȃgp܂B");
					return false;
				}
				if(theForm.elements[7].value.indexOf("\\")>=0){
					cvstr="";
					indexA=indexB=0;
					while(1){
						if(theForm.elements[7].value.indexOf("\\",indexA)==-1)
							break;
						indexB=theForm.elements[7].value.indexOf("\\",indexA);
						cvstr+=theForm.elements[7].value.substring(indexA,indexB);
						cvstr+="\\\\";
						indexA=indexB+1;
					}
					theForm.elements[7].value=cvstr;
//					alert("\"\\\"L\"/\"ɒuĂ");
//					return false;
				}
				if(theForm.elements[8].value=="1")
					theForm.elements[8].value="3";
				else
					theForm.elements[8].value="4";
			}
		}
		else{
			theForm.elements[7].value="";
			theForm.elements[8].value="0";
		}
		//Elapse Time
		if(theForm.elements[11].value.length){
//alert(theForm.elements[11].value);
			if(theForm.elements[10].value.length){
//alert(theForm.elements[10].length);
				workc=parseInt(theForm.elements[10].value,10)*60;
			}
			workc=parseInt(theForm.elements[11].value,10)+workc;
			theForm.elements[12].value=workc;//.toString();
		}
		else if(theForm.elements[10].value.length){
			workc=parseInt(theForm.elements[10].value,10)*60;
			theForm.elements[12].value=workc;//.toString();
		}
		else
			theForm.elements[12].value=workc;//"";
		return true;
	}
}
function getStrBytes(strX) {
    var nTotalLen = 0;
    var c = "";
    var i = 0;

    for (var i = 0; i < strX.length; i++) {
        c = strX.charCodeAt(i);
        // Shift_JIS: 0x0 ` 0x80, 0xa0  , 0xa1   ` 0xdf  , 0xfd   ` 0xff
        // Unicode  : 0x0 ` 0x80, 0xf8f0, 0xff61 ` 0xff9f, 0xf8f1 ` 0xf8f3
        if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)) {
            nTotalLen += 1;
        } else {
            nTotalLen += 2;
        }
    }
    return nTotalLen;
}

//01.04.18 Jenv藬p
function cutOverLenStr(str,nMax){
    var nTotalLen = 0;
    var c = "";
    var i = 0;
    var strRet;
    var bRet = true;

    strRet = "";

    for (var i = 0; i < str.length; i++) {
        c = str.charCodeAt(i);
        // Shift_JIS: 0x0 ` 0x80, 0xa0  , 0xa1   ` 0xdf  , 0xfd   ` 0xff
        // Unicode  : 0x0 ` 0x80, 0xf8f0, 0xff61 ` 0xff9f, 0xf8f1 ` 0xf8f3
        if ( (c >= 0x0 && c < 0x81) || (c == 0xf8f0) || (c >= 0xff61 && c < 0xffa0) || (c >= 0xf8f1 && c < 0xf8f4)) {
            nTotalLen += 1;
            if (nTotalLen > nMax){
                //alert(nMax + "oCg𒴂̓Jbg܂B");
//                return 1;
                break;
            }else{
                strRet = strRet + str.charAt(i);
            }
        } else {
            nTotalLen += 2;
            if (nTotalLen > nMax){
                //alert(nMax + "oCg𒴂̓Jbg܂B");
//                return 1;
                break;
            }else{
                strRet = strRet + str.charAt(i);
            }
        }
    }
    //JbgԂ
    return strRet;
}

// uEUꕶ`FbN
function checkStr(str)
{
  var ret = 0;
  strLower = str.toLowerCase(str);
  if (strLower.match("&amp")) {
    ret = 2;
  }
  else if (strLower.match("&lt")) {
    ret = 2;
  }
  else if (strLower.match("&gt")) {
    ret = 2;
  }
  else if (strLower.match("&quot")) {
    ret = 2;
  }
  return ret;
}

//-->
</SCRIPT>
<table border="0" width="100%" height="100%" cellspacing="4" cellpadding="4">
<!--tr>
	<td class="menu" width="100%" height="24">

		<!-- menu >
		<table border="0">
		  <tr>
			<td>Wu</td>
		  </tr>
		</table>

	</td>
</tr-->
<tr>
	<td nowrap valign="top" bgcolor="white">

		<!-- main -->
<FORM NAME="frmJLJobIn" METHOD="POST" onSubmit="return checkEvent(this)" ACTION="submitjob.asp" TARGET="data">
		<!--form method="POST" action="result.asp"-->
		  <table>
		    <tr>
		      <td nowrap>ƖF</td>
		      <td nowrap><input type="TEXT" name="NAME" size="32" maxlength="32"></td>
		    </tr>
		    <tr>
		      <td nowrap>WuF</td>
		      <td nowrap><input type="TEXT" name="PATH" size="32" maxlength="255"></td>
		    </tr>
		    <tr>
		      <td nowrap>p[^F</td>
		      <td nowrap><input type="TEXT" name="PARAMETER" size="32" maxlength="255"></td>
		    </tr>
		    <tr>
		      <td nowrap>sfBNgF</td>
		      <td nowrap><input type="TEXT" name="EXECDIR" size="32" maxlength="255"></td>
		    </tr>
		    <tr>
		      <td nowrap>WuL[F</td>
		      <td nowrap><input type="TEXT" name="QUEUE" size="15" maxlength="15"></td>
		    </tr>
		    <tr>
		      <td nowrap>D揇ʁF</td>
		      <td nowrap><select name="PTYPE" size="1">
	             <OPTION VALUE="0">REALTIME
	             <OPTION VALUE="1">HIGH
	             <OPTION VALUE="2" SELECTED>NORMAL
	             <OPTION VALUE="3">IDLE
		        </select></td>
		    </tr>
		    <tr>
		      <td nowrap colspan="2"><input type="CHECKBOX" name="SO" value="1">Wo͂̊Ď</td>
		    </tr>
		    <tr>
		      <td nowrap align="right">Wo̓t@CF</td>
		      <td nowrap><input type="TEXT" name="STDFILE" size="32" maxlength="255"></td>
		    </tr>
		    <tr>
		      <td nowrap>&nbsp;</td>
		      <td nowrap><input type="RADIO" name="STDOUT" VALUE="1" checked>㏑ 
		        <input type="RADIO" name="STDOUT" VALUE="2">ǉ</td>
		    </tr>
		    <tr>
		      <td nowrap>soߎԃ^CAEgF
		      <td nowrap><input type="TEXT" name="ELAPSEH" size="4"><input type="TEXT" name="ELAPSEM" size="2"></td>
		    </tr>
		    <tr>
  <INPUT TYPE="hidden" NAME="ELAPSE" VALUE="">
    <INPUT TYPE="hidden" NAME="RETRY" VALUE="1">
    <INPUT TYPE="hidden" NAME="DLGTYP" VALUE="2">
  <INPUT TYPE="hidden" NAME="LGONUSER" VALUE="<%=SUser%>">
  <INPUT TYPE="hidden" NAME="TSERVER" VALUE="<%=jsrvDef%>">
		      <td nowrap><input type="SUBMIT" value=""></td>
		      <td nowrap><input type="RESET" value="LZ"></td>
		    </tr>
		  </table>
		</form>
	</td>
</tr>
</table>
<% } %>
</body>
</html>
