MNP000.inc 8.98 KB
<script type="text/javascript" src="xmlhttp.js"></script>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--

//*********************************************
//	画面遷移処理
//*********************************************
function Get_List(){
		document.e_gru.action = "MNP010.php";
		document.e_gru.method="POST";
		document.e_gru.submit();
}

function Get_PageCnt(page){
	document.e_gru.intPage.value = page;
	document.e_gru.action = "MNP010.php";
	document.e_gru.method="POST";
	document.e_gru.submit();
}


function Make_List(){
		document.e_gru.action = "MNP020.php";
		document.e_gru.method="POST";
		document.e_gru.submit();
}

function Make_PageCnt(page){
	document.e_gru.intPage.value = page;
	document.e_gru.action = "MNP020.php";
	document.e_gru.method="POST";
	document.e_gru.submit();
}

function Mnp_Input(){
		document.e_gru.action = "MNP900.php";
		document.e_gru.method="POST";
		document.e_gru.submit();
}

function Disp_Detail(mail_id,disp_mode,read_flg){
	DispCode=mail_id;
	if(document.getElementById("mnp"+mail_id).innerHTML !=""){
			document.getElementById("mnp"+mail_id).innerHTML = "";
	}else{
			loadHTMLFile_Detail("MNP100.php?mail_id="+mail_id+"&disp_mode="+disp_mode);
	}

	//背景色変更
	if (disp_mode==0){
			document.getElementById("tbl"+mail_id+"_1").style.backgroundColor = "#ffffff";
			document.getElementById("tbl"+mail_id+"_2").style.backgroundColor = "#ffffff";
			document.getElementById("tbl"+mail_id+"_3").style.backgroundColor = "#ffffff";
			document.getElementById("tbl"+mail_id+"_4").style.backgroundColor = "#ffffff";
			if (read_flg==0){
					document.getElementById("read_"+mail_id).innerHTML="既読";
			}
	}

	function loadHTMLFile_Detail(fName){
			httpObj2 = createXMLHttpRequest(display_Detail);
			if (httpObj2){
					httpObj2.open(Get_BName(),fName,true);
					httpObj2.send(null);
			}
	}

	function display_Detail(){
			if ((httpObj2.readyState == 4) && (httpObj2.status == 200)){
				document.getElementById("mnp"+DispCode).innerHTML = httpObj2.responseText;
			}else{
				document.getElementById("mnp"+DispCode).innerHTML = "<b>Loading...</b>";
			}
	}
}

function Answer_Set(mail_id,disp_mode,ans_mode){

		var chkValue = "";

		if (ans_mode=="0"){
				for(i = 1 ; i <= 10; i++ ){
						//alert(document.getElementById("check"+mail_id+"_"+i));
						if (document.getElementById("check"+mail_id+"_"+i)){
								var objChk=document.getElementById("check"+mail_id+"_"+i);
								if (objChk.checked){
										chkValue = chkValue+objChk.value+"/";
								}
						}
				}

		}else{
				var objRadioCol = document.getElementsByName("check"+mail_id);
				for(i = 0 ; i <= objRadioCol.length-1; i++ ){
						var objRadio = objRadioCol[i];
						//alert(objRadio.value);
						if (objRadio.checked==true){
								chkValue = chkValue+objRadio.value+"/";
						}
				}

		}

		if (chkValue==""){
				if (ans_mode=="0"){
						window.alert("回答内容を最低1件を選択してください");
						return false;
				}else{
						window.alert("回答内容を選択してください");
						return false;
				}
		}

		//alert(chkValue);
		if (confirm("回答を登録します\nよろしいですか?")){
				strTxt=document.getElementById("commData_"+mail_id).value;
				prm = 'MNP191.php?mail_id='+mail_id+'&chkValue='+chkValue;

				//loadHTMLFile(prm);
				function loadHTMLFile(fName){
						httpObj = createXMLHttpRequest(displayData);
						if (httpObj){
								httpObj.open("POST",fName,true);
								httpObj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
								httpObj.send("txtCom="+encodeURIComponent(strTxt));
								//httpObj.send(prm);
						}
				}
				function displayData(){
						if ((httpObj.readyState == 4) && (httpObj.status == 200)){
								//alert(httpObj.responseText);
								Disp_Detail(mail_id,disp_mode);
								Disp_Detail(mail_id,disp_mode);
								//alert("完了");
						}
				}
				loadHTMLFile(prm);
		}
}

function Data_Delete(mail_id){
		if (confirm("データを削除します\nよろしいですか?")){
				document.e_gru.mail_id.value=mail_id;
				document.e_gru.action = "MNP192.php";
				document.e_gru.method="POST";
				document.e_gru.submit();
		}
}

//*********************************************
//	画面内処理
//*********************************************
function add(intaddsts){

	var strsel;
	var stradd;
	var inti;
	var intchk;
	var intPt;
	var strArray = new Array();
	var intflg=0;

	//追加
	if (intaddsts==1){
		inti=document.e_gru.syain_add.length-1;
		for(i=0;i<document.e_gru.syain_list.length;i++){
			if(document.e_gru.syain_list.options[i].selected){
				//データ存在チェック
				for(intchk=0;intchk<document.e_gru.syain_add.length;intchk++){
					if (document.e_gru.syain_list.options[i].value==document.e_gru.syain_add.options[intchk].value){
						intflg=1;
						break;
					}
				}
				
				//配信リスト設定
				if (intflg==0){
					document.e_gru.syain_add.options[inti]=new Option(document.e_gru.syain_list.options[i].text,document.e_gru.syain_list.options[i].value);
					inti=inti+1;
				}
				intflg=0;
			}
		}
		//最終行空文字
		document.e_gru.syain_add.options[inti]=new Option("          ","");
	}
	//削除
	else{
		//削除選択データ取得
		inti=0;
		for(i=0;i<document.e_gru.syain_add.length;i++){
			if(document.e_gru.syain_add.options[i].selected){
				strArray[inti]=document.e_gru.syain_add.options[i].value;
				inti=inti+1;
			}
		}

		for(i=0;i<strArray.length;i++){
			for(intchk=0;intchk<document.e_gru.syain_add.length;intchk++){
				if (strArray[i]==document.e_gru.syain_add.options[intchk].value){
					if (document.e_gru.syain_add.options[intchk].value!=""){
						document.e_gru.syain_add.options[intchk]=null;
						break;
					}
				}
			}
		}
	}
}

function kouhoChange(){
	for(i=1;i<=10;i++){
		if(i <= document.e_gru.kouho.value){
			document.getElementById("div_k"+i).style.display="block";
		}else{
			document.getElementById("div_k"+i).style.display="none";
		}
	}
}


function send_change(){
	if(document.e_gru.radSendPtn[1].checked){
			document.e_gru.btnAdd.disabled = true;
			document.e_gru.btnDel.disabled = true;
			for(intI=0;intI<document.e_gru.syain_add.length;intI++){
					if (document.e_gru.syain_add.options[intI].value!=""){
						document.e_gru.syain_add.options[intI]=null;
					}
			}

			if(document.e_gru.group_dat){
					if(document.e_gru.group_dat.length > 0){
							for(i=0;i<document.e_gru.group_dat.length;i++){
									document.e_gru.group_dat[i].disabled = false;
							}
					}else{
							document.e_gru.group_dat.disabled = false;
					}
			}
	}else{
			document.e_gru.btnAdd.disabled = false;
			document.e_gru.btnDel.disabled = false;

			if(document.e_gru.group_dat){
					if(document.e_gru.group_dat.length > 0){
							for(i=0;i<document.e_gru.group_dat.length;i++){
								document.e_gru.group_dat[i].disabled = true;
							}
					}else{
							document.e_gru.group_dat.disabled = true;
					}
			}
	}
}


//*********************************************
//	メール配信処理
//*********************************************
function Send_Mail(){

		if(document.e_gru.radSendPtn[1].checked){
			var strData="";

			if (document.e_gru.group_dat){
					if (document.e_gru.group_dat.length) {
							for (intI = 0; intI <= document.e_gru.group_dat.length - 1; intI++) {
									if (document.e_gru.group_dat[intI].checked) {
										strData = strData + document.e_gru.group_dat[intI].value   + "/";
									}
							}
					}else{
							if (document.e_gru.group_dat.checked == true) {
									strData = strData + document.e_gru.group_dat.value   + "/";
	 						}
					}
			}
			if(strData==""){
					window.alert("部門を最低1件選択してください");
					return false;
			}
			document.e_gru.group_id.value=strData;

		}else{
				stradd="";
				for (i=0; i<document.e_gru.syain_add.options.length; i++){ 
						stradd = stradd+document.e_gru.syain_add.options[i].value+"/";
				}
				if (stradd == "/"){
						window.alert("送信先を最低1件選択してください");
						return false;
				}
				document.e_gru.User_List.value=stradd;
		}

		if (hissu_chk("件名",document.e_gru.Mail_Subject.value)==false) {
			document.e_gru.Mail_Subject.focus();
			return false;
		}
		if (script_chk("件名",document.e_gru.Mail_Subject.value)==false) {
			document.e_gru.Mail_Subject.focus();
			return false;
		}

		if (hissu_chk("本文",document.e_gru.Mail_Body.value)==false) {
			document.e_gru.Mail_Body.focus();
			return false;
		}
		if (script_chk("本文",document.e_gru.Mail_Body.value)==false) {
			document.e_gru.Mail_Body.focus();
			return false;
		}

		//*** 回答内容 ***//
		for(i=1;i<=document.e_gru.kouho.value;i++){
				SY = document.getElementById("Ans_Data"+i);
				if(SY.value==""){
						window.alert("回答を入力してください"); 
						SY.focus();
						return false;
				}
		}

		if (confirm("アンケート配信を行います。\nよろしいですか?")){
				document.e_gru.action = "MNP901.php";
				document.e_gru.method="POST";
				document.e_gru.submit();
				return false;
		}
}

//*********************************************
//	アドレス帳CSV出力
//*********************************************
function CSVDownLoad(){
//		document.e_gru.action = "ADR901.php";
//		document.e_gru.method="GET";
//		document.e_gru.submit();
}

-->
</SCRIPT>