/* * hypatportal-gadget03.js */ //*********************************************************************** // 検索開始 //*********************************************************************** function FncSearchGo() { var fdate=""; var tdate=""; var basedate=""; /***** メッセージ初期化 *****/ $('.msg').text(''); //日付チェック var s_fyear, s_fmonth, s_fday; var s_tyear, s_tmonth, s_tday; var s_baseyear, s_basemonth, s_baseday; s_fyear = document.InputForm.fyear.value; s_fmonth = document.InputForm.fmonth.value; s_fday = document.InputForm.fday.value; s_tyear = document.InputForm.tyear.value s_tmonth = document.InputForm.tmonth.value s_tday = document.InputForm.tday.value s_baseyear = document.InputForm.baseyear.value s_basemonth = document.InputForm.basemonth.value s_baseday = document.InputForm.baseday.value basedate = s_baseyear + "" + s_basemonth + "" + s_baseday; /***** 検索範囲日付 入力 Check *****/ var retdate = []; var bdate=false; //開始日付 retdate=[]; bdate = CheckInputYmd( "f", retdate, s_fyear, s_fmonth, s_fday ); if( s_fyear=="" && s_fmonth=="" && s_fday=="" ) { //年月日 すべて未入力時、デフォルト値を設定 fdate = basedate; document.InputForm.fyear.value = s_baseyear; document.InputForm.fmonth.value = s_basemonth; document.InputForm.fday.value = s_baseday; }else{ if( bdate == false ) { $('.msg').text('年月日:開始日付の入力に誤りがあります'); return false; } fdate = retdate[0]; document.InputForm.fyear.value = fdate.substr( 0, 4 ); document.InputForm.fmonth.value = fdate.substr( 4, 2 ); document.InputForm.fday.value = fdate.substr( 6, 2 ); //if(s_fyear!="") {document.InputForm.fyear.value = fdate.substr( 0, 4 );} //if(s_fmonth!="") {document.InputForm.fmonth.value = fdate.substr( 4, 2 );} //if(s_fday!="") {document.InputForm.fday.value = fdate.substr( 6, 2 );} } //終了日付 retdate=[]; bdate = CheckInputYmd( "t", retdate, s_tyear, s_tmonth, s_tday ); if( s_tyear=="" && s_tmonth=="" && s_tday=="" ) { }else{ if( bdate == false ) { $('.msg').text('年月日:終了日付の入力に誤りがあります'); return false; } tdate = retdate[0]; document.InputForm.tyear.value = tdate.substr( 0, 4 ); document.InputForm.tmonth.value = tdate.substr( 4, 2 ); document.InputForm.tday.value = tdate.substr( 6, 2 ); //if(s_tyear!="") {document.InputForm.tyear.value = tdate.substr( 0, 4 );} //if(s_tmonth!="") {document.InputForm.tmonth.value = tdate.substr( 4, 2 );} //if(s_tday!="") {document.InputForm.tday.value = tdate.substr( 6, 2 );} } // //開始日付 : 必須 // if( fdate=="" ) // { // $('.msg').text('年月日:開始日付を入力してください'); // return false; // } //開始日付 : 基準年月日より以降であること if( basedate > fdate ) { $('.msg').text('年月日:ログオフ状態での開始日付には制限があります'); return false; } if( fdate!="" && tdate!="" ) { if( fdate > tdate ) { $('.msg').text('年月日:開始日付 > 終了日付となっています'); return false; } } /***** 検索文章 入力 Check *****/ //srbun var srbun = document.InputForm.srbun; var i=0, is_checked=false, wk=""; //改行文字を取り除く wk = srbun.value; wk = wk.split("\r\n").join(""); wk = wk.split("\n").join(""); wk = wk.split("\r").join(""); ////加工後の文字列をセット //srbun.value = wk; if (jis_ok_codechk(wk) != true) { if(confirm("使用できない文字が含まれています。\n実際の検索式は下のように「■」に変換されます。\n\n" + jis_ok_code_set(wk) + "\n\nよろしいですか?")==false) { return false; } wk = jis_ok_code_set(wk); } //加工後の文字列をセット srbun.value = wk; if (wk.length == 0) { $('.msg').text('検索文章を入力して下さい'); return; } //検索画面遷移 OpenSearch(fdate, tdate, wk); } //*********************************************************************** // 検索画面遷移 //*********************************************************************** function OpenSearch(fdate, tdate, srch_text) { //フラグ設定 document.getElementById("open_search_form").value = "1"; //検索実行 var win = window.open('', 'GadgetViewG03', 'width=800, height=600, toolber=no, status=yes, scrollbars=yes, resizable=yes' ); win.focus(); window.document.InputForm.action = './DataView.php'; window.document.InputForm.target = 'GadgetViewG03'; window.document.InputForm.method = 'POST'; window.document.InputForm.submit(); } //*********************************************************************** // 発行開始年月日 設定 //*********************************************************************** function FncFromDate() { var from_y = '2019'; var from_m = '01'; var from_d = '01'; document.getElementById("baseyear").value = from_y; document.getElementById("basemonth").value = from_m; document.getElementById("baseday").value = from_d; var msg1 = 'ログオフ状態:'; var msg2 = ' 以降の開始日付'; var msg = msg1 + from_y + "/"+ from_m + "/" + from_d + msg2; $('#FromDateMsg .fdatemsg').addClass("search-ymd-basey-msg").text(msg); return; } //*********************************************************************** // 参照ボタン押下 // 入力された番号をキーに請求項を取得して、検索文章欄に入力する //*********************************************************************** function fncInputAbj() { //メッセージクリア $('.input-abj-loading').text(''); $('.input-abj-result').removeClass('input-abj-result-msg').html(''); //オブジェクト取得 var f_srno = document.InputForm.srno; var f_hdnSrno = document.InputForm.hdnSrno; var bango = f_srno.value; var rc = document.getElementById('rand_check').value; //入力チェック //bango = if(bango=="") { $('.input-abj-result').addClass('input-abj-result-msg').html('検索番号を入力してください'); return false; } //退避 f_hdnSrno.value = bango; //Ajax成功 var h_success = function(data, dataType) { //$('.input-abj-loading').text('データの取得に成功しました'); if(data=='resultok') { window.setTimeout('SubmitInputAbj()',100); } else { //$('.input-abj-loading').text('データの取得に失敗しました'); $('.input-abj-loading').text(''); $('.input-abj-result').addClass('input-abj-result-msg').html(data); window.document.InputForm.hdnInputABJ.value = ''; window.document.InputForm.hdnSrno.value = ''; } } //Ajaxエラー var h_error = function(xhr, txtStatus, errThrown){ //$('.input-abj-loading').text('データの取得に失敗しました'+" ; "+xhr.status + " " + xhr.statusText); $('.input-abj-loading').text('データの取得に失敗しました'); } //Ajax完了 var h_complete = function(xhr, txtStatus) { ;} //Ajax送信前 var h_beforeSend = function(xhr){ //キャッシュ無効 xhr.setRequestHeader("If-Modified-Since", "Thu, 01 Jun 1970 00:00:00 GMT"); } //メッセージ $('.input-abj-loading').text('データを取得中です。'); //非同期リクエスト開始 new $.ajax({ url: './InputAbj.php?hdnportal1&bango='+bango+'&rc='+rc, cache : false, type: "GET", dataType: "text", success: h_success, error: h_error, complete: h_complete, beforeSend : h_beforeSend }); return; } //*********************************************************************** //請求項入力 PostBack //*********************************************************************** function SubmitInputAbj() { var ret=false, txt=window.document.InputForm.srbun.value; txt = txt.replace(/(^[\s ]+)|([\s ]+$)/g, ""); if(txt!="") { ret = window.confirm('取得した値で検索文章を入れ替えます。よろしいですか?'); } else { ret = true; } if(ret) { window.document.InputForm.hdnInputABJ.value = '1'; window.document.InputForm.action = ''; window.document.InputForm.target = '_self'; window.document.InputForm.method = 'POST'; window.document.InputForm.submit(); } else { //キャンセル押下時 window.document.InputForm.hdnInputABJ.value = ''; window.document.InputForm.hdnSrno.value = ''; //メッセージクリア $('.input-abj-loading').text(''); $('.input-abj-result').removeClass('input-abj-result-msg').html(''); } } //*********************************************************************** // ガジェットサイズ変更対応 //*********************************************************************** function FncChangeGadgetSize() { var w = $("body").width(); $("#wrapper1").css("width", w < 500 ? 472 : 996); $(".input-longtext").attr('cols', w < 500 ? 50 : 110); $(".contents-center").css("margin-left", w < 500 ? 170 : 400); }