Commit b6493031 by Kim Eunchul

#40365 【TECSS(Biz) webviewer 1.9】一覧画面で検索時にエラーを起こすキーワードがある

parent dd53ad0b
......@@ -264,100 +264,101 @@ HEADER.searchHeaderButtonFunction = function(){
var searchDivision;
var searchText = $('#searchbox-key').val();
var count = 0;
if(searchText.length > 200){
alert('200字以下のテキストを入力してください');
return;
}
if ($('#txtSearchWs').val() != ' ') {
try{
//seperate string
var myRegexp = /[^\s"]+|"([^"]*)"/gi;
var myArray = [];
var myQuery;
var myRegExpArr = [];
var count = 0;
var textReg = $('#searchbox-key').val();
do {
var match = myRegexp.exec(textReg);
if (match != null)
{
myArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
if(myArray[0].charAt(0) == "("){
if(myArray[0] == "("){
myRegExpArr[1] = new RegExp(myArray[1]);
myQuery = '( true';
}else{
myRegExpArr[0] = new RegExp(myArray[0].slice(1));
myQuery = '( true';
count++;
}
}else{
myRegExpArr[0] = new RegExp(myArray[0]);
myQuery = 'true';
count++;
}
for (var i = 1; i < myArray.length; i++){
if(myArray[i] == "OR" || myArray[i] == "or" || myArray[i] == "Or" || myArray[i] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i]);
}else if(myArray[i].charAt(0) == "(" || myArray[i] == "("){
if(myArray[i] == "("){
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myQuery += ' || (';
}else{
myQuery += ' && (';
}
}else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' || ( true';
count++;
}else{
myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' && ( true';
count++;
}
}
}else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){
if(myArray[i] == ")"){
myQuery += ' )';
}else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' || true )';
count++;
}else{
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' && true )';
count++;
}
}
}else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' || true';
count++;
}else{
if(myArray[i - 1] == "("){
myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' true';
count++;
}else{
myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' && true';
count++;
}
}
}
}
if (eval(myQuery)) {
//is not correct query
}
try{
//seperate string
var myRegexp = /[^\s"]+|"([^"]*)"/gi;
var myArray = [];
var myQuery;
var myRegExpArr = [];
var textReg = $('#txtSearchWs');
do {
var match = myRegexp.exec(textReg);
if (match != null)
{
myArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
if(myArray[0].charAt(0) == "("){
if(myArray[0] == "("){
myRegExpArr[1] = new RegExp(myArray[1]);
myQuery = '( true';
}else{
myRegExpArr[0] = new RegExp(myArray[0].slice(1));
myQuery = '( true';
count++;
}
}else{
myRegExpArr[0] = new RegExp(myArray[0]);
myQuery = 'true';
count++;
}
for (var i = 1; i < myArray.length; i++){
if(myArray[i] == "OR" || myArray[i] == "or" || myArray[i] == "Or" || myArray[i] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i]);
}else if(myArray[i].charAt(0) == "(" || myArray[i] == "("){
if(myArray[i] == "("){
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myQuery += ' || (';
}else{
myQuery += ' && (';
}
}else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' || ( true';
count++;
}else{
myRegExpArr[i] = new RegExp(myArray[i].slice(1));
myQuery += ' && ( true';
count++;
}
}
}else if(myArray[i].charAt(myArray[i].length - 1) == ")" || myArray[i] == ")"){
if(myArray[i] == ")"){
myQuery += ' )';
}else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' || true )';
count++;
}else{
myRegExpArr[i] = new RegExp(myArray[i].slice(0, -1));
myQuery += ' && true )';
count++;
}
}
}else{
if(myArray[i - 1] == "OR" || myArray[i - 1] == "or" || myArray[i - 1] == "Or" || myArray[i - 1] == "oR"){
myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' || true';
count++;
}else{
if(myArray[i - 1] == "("){
myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' true';
count++;
}else{
myRegExpArr[i] = new RegExp(myArray[i]);
myQuery += ' && true';
count++;
}
}
}
}
if (eval(myQuery)) {
//is not correct query
}
}catch(error){
if(content == 'checked')
......@@ -377,7 +378,7 @@ HEADER.searchHeaderButtonFunction = function(){
ClientData.searchCond_searchDivision(searchDivision);
//window.location = COMMON.ScreenIds.ContentSearch;
AVWEB.avwScreenMove(COMMON.ScreenIds.ContentSearch);
return;
}
}
if(count > 5){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment