|
|
@@ -60,6 +60,7 @@ function searchItem(type,sortType){ |
|
|
|
currentPage = 1; |
|
|
|
currentSearchTableName = itemType[type]; |
|
|
|
currentSearchSortBy = sortBy[sortType]; |
|
|
|
OnlySearchLabel =false; |
|
|
|
page(currentPage); |
|
|
|
//doSearch(itemType[type],currentSearchKeyword,currentPage,pageSize,false,sortBy[sortType]); |
|
|
|
} |
|
|
@@ -73,7 +74,11 @@ function search(){ |
|
|
|
currentPage = 1; |
|
|
|
|
|
|
|
if(!isEmpty(keyword)){ |
|
|
|
doSearch("repository",keyword,page,pageSize,false,sortBy[11]); |
|
|
|
currentSearchTableName = "repository"; |
|
|
|
currentSearchSortBy = sortBy[11]; |
|
|
|
OnlySearchLabel =false; |
|
|
|
page(currentPage); |
|
|
|
//doSearch("repository",keyword,page,pageSize,false,sortBy[11]); |
|
|
|
doSearch("issue",keyword,page,pageSize,true,""); |
|
|
|
doSearch("user",keyword,page,pageSize,true,""); |
|
|
|
doSearch("org",keyword,page,pageSize,true,""); |
|
|
@@ -82,6 +87,10 @@ function search(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function searchLabel(){ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy="",OnlySearchLabel=false){ |
|
|
|
$.ajax({ |
|
|
|
type:"GET", |
|
|
@@ -124,7 +133,10 @@ function displayResult(tableName,page,jsonResult,onlyReturnNum,keyword){ |
|
|
|
} else if (tableName == "pr") { |
|
|
|
displayPrResult(page,jsonResult,onlyReturnNum,keyword); |
|
|
|
} |
|
|
|
setPage(jsonResult,pageSize); |
|
|
|
if(!onlyReturnNum){ |
|
|
|
setPage(jsonResult,pageSize,page); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function displayPrResult(page,jsonResult,onlyReturnNum,keyword){ |
|
|
@@ -502,23 +514,22 @@ var repoAndOrgEN={ |
|
|
|
|
|
|
|
function page(current){ |
|
|
|
//function doSearch(tableName,keyword,page,pageSize=15,onlyReturnNum=true,sortBy="",OnlySearchLabel=false){ |
|
|
|
currentPage=current; |
|
|
|
doSearch(currentSearchTableName,currentSearchKeyword,current,pageSize,false,currentSearchSortBy,OnlySearchLabel); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function nextPage(){ |
|
|
|
var current = $('#currentPage').text(); |
|
|
|
console.log("current=" + current); |
|
|
|
page(current,pageSize); |
|
|
|
currentPage = currentPage+1; |
|
|
|
console.log("current=" + currentPage); |
|
|
|
page(currentPage,pageSize); |
|
|
|
} |
|
|
|
|
|
|
|
function prePage(){ |
|
|
|
var current =$('#currentPage').text(); |
|
|
|
console.log("current=" + current); |
|
|
|
console.log("current=" + currentPage); |
|
|
|
if(current > 1){ |
|
|
|
console.log("current=" + (current - 2)); |
|
|
|
page(current - 2,pageSize); |
|
|
|
currentPage = currentPage-1; |
|
|
|
console.log("current=" + (currentPage)); |
|
|
|
page(currentPage); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -550,39 +561,30 @@ function page(current){ |
|
|
|
if (isEmpty(pageData)){ |
|
|
|
return; |
|
|
|
} |
|
|
|
var startIndex = currentPage * pageSize; |
|
|
|
if(pageData.Total > 0){ |
|
|
|
startIndex = startIndex + 1; |
|
|
|
} |
|
|
|
$('#startIndex').text(startIndex); |
|
|
|
$('#endIndex').text(pageData.current * pageSize + pageData.data.length); |
|
|
|
$('#totalNum').text(pageData.total); |
|
|
|
$('#displayPage1').text(pageData.current + 1); |
|
|
|
|
|
|
|
console.log("set prePage status, pageData.current=" + pageData.current); |
|
|
|
|
|
|
|
if(pageData.current == 0){ |
|
|
|
console.log("set prePage disabled."); |
|
|
|
$('#prePage').removeAttr("href"); |
|
|
|
} |
|
|
|
else{ |
|
|
|
$('#prePage').attr("href","javascript:prePage()"); |
|
|
|
$('#page_total').text(pageData.Total); |
|
|
|
if(currentPage > 1){ |
|
|
|
$('#startPage').removeClass("disabled"); |
|
|
|
$('#lastPage').removeClass("disabled"); |
|
|
|
}else{ |
|
|
|
$('#startPage').addClass("disabled"); |
|
|
|
$('#lastPage').addClass("disabled"); |
|
|
|
} |
|
|
|
|
|
|
|
if((pageData.current + 1) * pageSize >= pageData.total){ |
|
|
|
console.log("set nextPage disabled."); |
|
|
|
$('#nextPage').removeAttr("href"); |
|
|
|
var totalPage=Math.ceil(pageData.Total/pageSize) |
|
|
|
var html =""; |
|
|
|
for(var i=0;i<5&&(i+currentPage)<totalPage;i++){ |
|
|
|
var page_i = (currentPage + i); |
|
|
|
if( i== 0){ |
|
|
|
html += "<a id=\"page_" + page_i+ "\" class=\"active item\" href=\"page(" + page_i +")\">" + page_i + "</a>"; |
|
|
|
}else{ |
|
|
|
html += "<a id=\"page_" + page_i+ "\" class=\"item\" href=\"page(" + page_i +")\">" + page_i + "</a>"; |
|
|
|
} |
|
|
|
} |
|
|
|
else{ |
|
|
|
$('#nextPage').attr("href","javascript:nextPage()"); |
|
|
|
if(currentPage >=totalPage){ |
|
|
|
$('#nextPage').addClass("disabled"); |
|
|
|
$('#endPage').addClass("disabled"); |
|
|
|
}else{ |
|
|
|
$('#nextPage').removeClass("disabled"); |
|
|
|
$('#endPage').removeClass("disabled"); |
|
|
|
} |
|
|
|
|
|
|
|
var pageTotal = pageData.total; |
|
|
|
var pageNum = parseInt(pageTotal/pageSize); |
|
|
|
if(pageTotal%pageSize!=0){ |
|
|
|
pageNum += 1; |
|
|
|
}else { |
|
|
|
pageNum = pageNum; |
|
|
|
} |
|
|
|
$("#totalPageNum").text(pageNum); |
|
|
|
} |