Commit 4fe9f2e4 by Kim Eunchul

Merge branch 'contract/ttss/1.0.0_kim-ec' into 'contract/ttss/1.1.0'

Contract/ttss/1.0.0 kim ec

See merge request abook_web/web-viewer!51
parents bbbf98b6 f2a406e1
......@@ -1048,10 +1048,11 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
//seperate string
var myRegexp = /[^\s"]+|"([^"]*)"/gi;
var myArray = [];
var dummyArray = [];
var myQuery;
//var myRegExpArr = [];
var textReg = $('#txtSearchWs').val().replace(/\(/g," ( ").replace(/\)/g," ) ");
var dummytextReg = $('#txtSearchWs').val().replace(/\"/g,"'\"'");
do {
var match = myRegexp.exec(textReg);
if (match != null)
......@@ -1060,12 +1061,26 @@ CONTENTSEARCH.searchEventButtonFunction = function() {
}
} while (match != null);
do {
var match = myRegexp.exec(dummytextReg);
if (match != null)
{
dummyArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
for(var i = 0; i < myArray.length; i++){
if(myArray[i] != "OR" && myArray[i] != "or" && myArray[i] != "Or" && myArray[i] != "oR" && myArray[i] != "(" && myArray[i] != ")"){
count++;
}
}
for(var i = 0; i < dummyArray.length; i++){
if(dummyArray[i].includes(")(") && dummyArray[i].charAt(0) != "'" && dummyArray[i].charAt(dummyArray.length - 1) != "'"){
searchText = ")";
}
}
if(count > 5){
alert('語句数は最大5つです');
return;
......
......@@ -749,6 +749,10 @@ CONTENTVIEW.searchHandle = function() {
var count = 0;
var textReg = $('#txtSearch').val().replace(/\(/g," \( ").replace(/\)/g," \) ");
//)(check
var dummyArray = [];
var dummytextReg = $('#txtSearch').val().replace(/\"/g,"'\"'");
if($('#txtSearch').val() == '"("'){
myRegExpArr[0] = new RegExp("[\(]");
for (var nIndex = 0; nIndex < contentPage.length; nIndex++) {
......@@ -794,6 +798,21 @@ CONTENTVIEW.searchHandle = function() {
}else{
try{
do {
var match = myRegexp.exec(dummytextReg);
if (match != null)
{
dummyArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
for(var i = 0; i < dummyArray.length; i++){
if(dummyArray[i].includes(")(") && dummyArray[i].charAt(0) != "'" && dummyArray[i].charAt(dummyArray.length - 1) != "'"){
throw new Error('quotes error!');
}
}
do {
var match = myRegexp.exec(textReg);
if (match != null)
......
......@@ -279,6 +279,16 @@ HEADER.searchHeaderButtonFunction = function(){
var myQuery;
//var myRegExpArr = [];
var textReg = $('#searchbox-key').val().replace(/\(/g," ( ").replace(/\)/g," ) ");
var dummyArray = [];
var dummytextReg = $('#searchbox-key').val().replace(/\"/g,"'\"'");
do {
var match = myRegexp.exec(dummytextReg);
if (match != null)
{
dummyArray.push(match[1] ? match[1] : match[0]);
}
} while (match != null);
do {
var match = myRegexp.exec(textReg);
......@@ -367,6 +377,12 @@ HEADER.searchHeaderButtonFunction = function(){
myQuery += ' &&';
}
for(var i = 0; i < dummyArray.length; i++){
if(dummyArray[i].includes(")(") && dummyArray[i].charAt(0) != "'" && dummyArray[i].charAt(dummyArray.length - 1) != "'"){
myQuery += ' &&';
}
}
if (eval(myQuery)) {
//is not correct query
}
......
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