mirror of
https://github.com/reactos/web.git
synced 2025-02-17 01:17:38 +00:00
[TESTMAN]
- add a "Clear selection" button, so it's possible to unselect all tests at once without reloading the whole page svn path=/trunk/; revision=874
This commit is contained in:
parent
7dae9d8754
commit
9b25b2d970
@ -11,7 +11,7 @@
|
||||
require_once("config.inc.php");
|
||||
require_once("connect.db.php");
|
||||
require_once("utils.inc.php");
|
||||
|
||||
|
||||
if((int)$_GET["page"] < 1)
|
||||
die("<error>Necessary information not specified!</error>");
|
||||
|
||||
|
@ -78,6 +78,10 @@ th.TestCheckbox {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#clearselected {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
#comparepage_frame {
|
||||
display: none;
|
||||
width: 100%;
|
||||
|
@ -25,7 +25,7 @@ var REQUESTTYPE_PAGESWITCH = 3;
|
||||
function SetRowColor(elem, color)
|
||||
{
|
||||
tdl = elem.getElementsByTagName("td");
|
||||
|
||||
|
||||
for(var i = 0; i < tdl.length; i++)
|
||||
tdl[i].style.background = color;
|
||||
}
|
||||
@ -51,7 +51,7 @@ function UpdateAllCheckboxes()
|
||||
for(id in SelectedResults)
|
||||
{
|
||||
var checkbox = document.getElementById("test_" + id);
|
||||
|
||||
|
||||
if(checkbox)
|
||||
checkbox.checked = true;
|
||||
}
|
||||
@ -66,7 +66,7 @@ function ResultCheckbox_OnClick(checkbox)
|
||||
checkbox.checked = false;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var id = checkbox.id.substr(5);
|
||||
|
||||
if(checkbox.checked)
|
||||
@ -79,15 +79,16 @@ function ResultCheckbox_OnClick(checkbox)
|
||||
delete SelectedResults[id];
|
||||
SelectedResultCount--;
|
||||
}
|
||||
|
||||
|
||||
// Update the status message
|
||||
document.getElementById("status").innerHTML = '<?php printf($testman_langres["status"], '<span id="selectedresultcount">\' + SelectedResultCount + \'<\/span>'); ?>';
|
||||
document.getElementById("status").innerHTML = '<?php printf($testman_langres["status"], '<span id="selectedresultcount">\' + SelectedResultCount + \'<\/span>');
|
||||
echo '<span id="clearselected"><button onclick="ClearSelected_OnClick()">'.addslashes($testman_langres["clearselected"]).'</button><\/span>';?>';
|
||||
}
|
||||
|
||||
function ResultCell_OnClick(elem)
|
||||
{
|
||||
var IDArray = new Array();
|
||||
|
||||
|
||||
// Get the ID through the "id" attribute of the checkbox
|
||||
IDArray.push(parseInt(elem.parentNode.firstChild.firstChild.id.substr(5)));
|
||||
OpenComparePage(IDArray);
|
||||
@ -100,7 +101,7 @@ function SearchInputs_OnKeyPress(event)
|
||||
var KeyCode = window.event.keyCode;
|
||||
else
|
||||
var KeyCode = event.which;
|
||||
|
||||
|
||||
// Submit the search form in case the user pressed the Return key
|
||||
if(KeyCode == 13)
|
||||
SearchButton_OnClick();
|
||||
@ -109,7 +110,7 @@ function SearchInputs_OnKeyPress(event)
|
||||
function SearchRevisionInput_OnKeyUp(elem)
|
||||
{
|
||||
var val = elem.value.replace(/[^[0-9-]/g, "");
|
||||
|
||||
|
||||
// First check if something was changed by the replace function.
|
||||
// If not, don't set elem.value = val. Otherwise the cursor would always jump to the last character in IE, when you press any key.
|
||||
if(elem.value != val)
|
||||
@ -119,7 +120,7 @@ function SearchRevisionInput_OnKeyUp(elem)
|
||||
function GetRevNums()
|
||||
{
|
||||
var rev = document.getElementById("search_revision").value;
|
||||
|
||||
|
||||
// If the user didn't enter any revision number at all, he doesn't want to search for a specific revision
|
||||
if(!rev)
|
||||
{
|
||||
@ -127,14 +128,14 @@ function GetRevNums()
|
||||
inputbox_endrev = "";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if(isFinite(rev) && parseInt(rev) > 0)
|
||||
{
|
||||
inputbox_startrev = parseInt(rev);
|
||||
inputbox_endrev = parseInt(rev);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Maybe the user entered a revision range
|
||||
var hyphen = rev.indexOf("-");
|
||||
if(hyphen > 0)
|
||||
@ -147,7 +148,7 @@ function GetRevNums()
|
||||
{
|
||||
inputbox_startrev = parseInt(inputbox_startrev);
|
||||
inputbox_endrev = parseInt(inputbox_endrev);
|
||||
|
||||
|
||||
if(inputbox_startrev > inputbox_endrev)
|
||||
{
|
||||
// Exchange start and end revision due to wrong order
|
||||
@ -155,11 +156,11 @@ function GetRevNums()
|
||||
inputbox_startrev = inputbox_endrev;
|
||||
inputbox_endrev = tmp;
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
alert("Invalid revision number!");
|
||||
return false;
|
||||
}
|
||||
@ -174,37 +175,37 @@ function SearchButton_OnClick()
|
||||
{
|
||||
if(!GetRevNums())
|
||||
return;
|
||||
|
||||
|
||||
data = new Array();
|
||||
|
||||
|
||||
CurrentPage = 1;
|
||||
FullRange = document.getElementById("search_revision").value;
|
||||
|
||||
|
||||
data["startrev"] = inputbox_startrev;
|
||||
data["endrev"] = inputbox_endrev;
|
||||
data["source"] = document.getElementById("search_source").value;
|
||||
data["platform"] = document.getElementById("search_platform").value;
|
||||
|
||||
|
||||
data["page"] = CurrentPage;
|
||||
data["resultlist"] = 1;
|
||||
data["requesttype"] = REQUESTTYPE_FULLLOAD;
|
||||
|
||||
|
||||
if(window.localStorage)
|
||||
localStorage.setItem('testman_source', data["source"]);
|
||||
|
||||
|
||||
SearchCall();
|
||||
}
|
||||
|
||||
function DetectObsoleteIE()
|
||||
{
|
||||
var position = navigator.userAgent.indexOf("MSIE");
|
||||
|
||||
|
||||
if(position >= 0)
|
||||
{
|
||||
var version = navigator.userAgent.substr(position + 5, 1);
|
||||
return (version < 8);
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -212,7 +213,7 @@ function ResizeIFrame()
|
||||
{
|
||||
if(DetectObsoleteIE())
|
||||
return;
|
||||
|
||||
|
||||
var iframe = document.getElementById("comparepage_frame");
|
||||
iframe.height = iframe.contentDocument.body.offsetHeight + 40;
|
||||
}
|
||||
@ -221,7 +222,7 @@ function Load()
|
||||
{
|
||||
// General settings
|
||||
var iframe = document.getElementById("comparepage_frame");
|
||||
|
||||
|
||||
if(DetectObsoleteIE())
|
||||
{
|
||||
document.getElementById("opennewwindow").checked = true;
|
||||
@ -231,36 +232,36 @@ function Load()
|
||||
{
|
||||
document.getElementById("opennewwindow").checked = parseInt(GetCookieValue("opennewwindow"));
|
||||
}
|
||||
|
||||
|
||||
// Show the last revisions
|
||||
data = new Array();
|
||||
|
||||
|
||||
CurrentPage = 1;
|
||||
|
||||
|
||||
data["desc"] = 1;
|
||||
data["limit"] = <?php echo DEFAULT_SEARCH_LIMIT; ?>;
|
||||
|
||||
|
||||
if(window.localStorage && window.localStorage.getItem('testman_source'))
|
||||
data["source"] = window.localStorage.getItem('testman_source');
|
||||
else
|
||||
data["source"] = "<?php echo DEFAULT_SEARCH_SOURCE; ?>";
|
||||
|
||||
document.getElementById('search_source').value = data["source"];
|
||||
|
||||
|
||||
data["page"] = CurrentPage;
|
||||
data["resultlist"] = 1;
|
||||
data["requesttype"] = REQUESTTYPE_FULLLOAD;
|
||||
|
||||
|
||||
SearchCall();
|
||||
}
|
||||
|
||||
function GetTagData(RootElement, TagName)
|
||||
{
|
||||
var Child = RootElement.getElementsByTagName(TagName)[0].firstChild;
|
||||
|
||||
|
||||
if(!Child)
|
||||
return "";
|
||||
|
||||
|
||||
return Child.data;
|
||||
}
|
||||
|
||||
@ -272,16 +273,16 @@ function SearchCallback(HttpRequest)
|
||||
alert(HttpRequest.responseXML.getElementsByTagName("error")[0].firstChild.data)
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
var html = "";
|
||||
var first_rev = 0;
|
||||
var last_rev = 0;
|
||||
|
||||
|
||||
if(data["resultlist"])
|
||||
{
|
||||
// Build a new infobox
|
||||
html += '<table id="infotable" cellspacing="0" cellpadding="0"><tr><td id="infobox">';
|
||||
|
||||
|
||||
if(data["requesttype"] == REQUESTTYPE_FULLLOAD)
|
||||
{
|
||||
ResultCount = parseInt(HttpRequest.responseXML.getElementsByTagName("resultcount")[0].firstChild.data);
|
||||
@ -291,16 +292,17 @@ function SearchCallback(HttpRequest)
|
||||
{
|
||||
html += document.getElementById("infobox").innerHTML;
|
||||
}
|
||||
|
||||
|
||||
html += '<\/td>';
|
||||
|
||||
|
||||
html += '<td id="status">';
|
||||
html += '<?php printf(addslashes($testman_langres["status"]), '<span id="selectedresultcount">0<\/span>'); ?>';
|
||||
html += '<span id="clearselected"><button onclick="ClearSelected_OnClick()"><?php echo addslashes($testman_langres["clearselected"]); ?></button><\/span>';
|
||||
html += '<\/td>';
|
||||
|
||||
|
||||
// Page number boxes
|
||||
html += '<td id="pagesbox">';
|
||||
|
||||
|
||||
if(CurrentPage == 1)
|
||||
{
|
||||
html += '« ';
|
||||
@ -311,15 +313,15 @@ function SearchCallback(HttpRequest)
|
||||
html += '<a href="javascript:FirstPage_OnClick()" title="<?php echo addslashes($shared_langres["firstpage_title"]); ?>">«<\/a> ';
|
||||
html += '<a href="javascript:PrevPage_OnClick()" title="<?php echo addslashes($shared_langres["prevpage_title"]); ?>">‹ <?php echo addslashes($shared_langres["prevpage"]); ?><\/a> ';
|
||||
}
|
||||
|
||||
|
||||
html += '<select id="pagesel" size="1" onchange="PageBox_OnChange(this)">';
|
||||
|
||||
|
||||
if(data["requesttype"] == REQUESTTYPE_FULLLOAD)
|
||||
{
|
||||
PageCount = 1;
|
||||
|
||||
|
||||
html += '<option value="' + CurrentPage + '"><?php echo addslashes($shared_langres["page"]); ?> ' + CurrentPage;
|
||||
|
||||
|
||||
if(HttpRequest.responseXML.getElementsByTagName("resultcount")[0].firstChild.data > 0)
|
||||
html += ' - ' + HttpRequest.responseXML.getElementsByTagName("firstrev")[0].firstChild.data + ' ... ' + HttpRequest.responseXML.getElementsByTagName("lastrev")[0].firstChild.data + '<\/option>';
|
||||
}
|
||||
@ -327,9 +329,9 @@ function SearchCallback(HttpRequest)
|
||||
{
|
||||
html += document.getElementById("pagesel").innerHTML;
|
||||
}
|
||||
|
||||
|
||||
html += '<\/select> ';
|
||||
|
||||
|
||||
if(HttpRequest.responseXML.getElementsByTagName("moreresults")[0].firstChild.data == 0)
|
||||
{
|
||||
html += '<?php echo addslashes($shared_langres["nextpage"]); ?> › ';
|
||||
@ -340,12 +342,12 @@ function SearchCallback(HttpRequest)
|
||||
html += '<a href="javascript:NextPage_OnClick()" title="<?php echo addslashes($shared_langres["nextpage_title"]); ?>"><?php echo addslashes($shared_langres["nextpage"]); ?> ›<\/a> ';
|
||||
html += '<a href="javascript:LastPage_OnClick()" title="<?php echo addslashes($shared_langres["lastpage_title"]); ?>">»<\/a>';
|
||||
}
|
||||
|
||||
|
||||
html += '<\/td><\/tr><\/table>';
|
||||
|
||||
// File table
|
||||
html += '<table id="resulttable" class="datatable" cellspacing="0" cellpadding="0">';
|
||||
|
||||
|
||||
html += '<thead><tr class="head">';
|
||||
html += '<th class="TestCheckbox"><\/th>';
|
||||
html += '<th><?php echo addslashes($testman_langres["revision"]); ?><\/th>';
|
||||
@ -357,9 +359,9 @@ function SearchCallback(HttpRequest)
|
||||
html += '<th><?php echo addslashes($testman_langres["comment"]); ?><\/th>';
|
||||
html += '<\/tr><\/thead>';
|
||||
html += '<tbody>';
|
||||
|
||||
|
||||
var results = HttpRequest.responseXML.getElementsByTagName("result");
|
||||
|
||||
|
||||
if(!results.length)
|
||||
{
|
||||
html += '<tr class="even"><td colspan="8"><?php echo addslashes($testman_langres["noresults"]); ?><\/td><\/tr>';
|
||||
@ -367,7 +369,7 @@ function SearchCallback(HttpRequest)
|
||||
else
|
||||
{
|
||||
var oddeven = false;
|
||||
|
||||
|
||||
for(var i = 0; i < results.length; i++)
|
||||
{
|
||||
html += '<tr class="' + (oddeven ? "odd" : "even") + '" onmouseover="Result_OnMouseOver(this)" onmouseout="Result_OnMouseOut(this)">';
|
||||
@ -384,9 +386,9 @@ function SearchCallback(HttpRequest)
|
||||
oddeven = !oddeven;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
html += '<\/tbody><\/table>';
|
||||
|
||||
|
||||
document.getElementById("searchtable").innerHTML = html;
|
||||
|
||||
if(data["requesttype"] == REQUESTTYPE_PAGESWITCH)
|
||||
@ -394,7 +396,7 @@ function SearchCallback(HttpRequest)
|
||||
// Switch the selected page in the Page ComboBox
|
||||
document.getElementById("pagesel").getElementsByTagName("option")[CurrentPage - 1].selected = true;
|
||||
}
|
||||
|
||||
|
||||
UpdateAllCheckboxes();
|
||||
}
|
||||
else
|
||||
@ -402,21 +404,21 @@ function SearchCallback(HttpRequest)
|
||||
// Just add a new page to the Page combo box and the information for it
|
||||
PageCount++;
|
||||
ResultCount += parseInt(HttpRequest.responseXML.getElementsByTagName("resultcount")[0].firstChild.data);
|
||||
|
||||
|
||||
document.getElementById("resultcount").firstChild.data = ResultCount;
|
||||
|
||||
|
||||
// As always, we have to work around an IE bug
|
||||
// If I use "innerHTML" here, the first <OPTION> start tag gets dropped in the IE...
|
||||
// Therefore I have to use the DOM functions in this case.
|
||||
var OptionElem = document.createElement("option");
|
||||
var OptionText = document.createTextNode('<?php echo addslashes($shared_langres["page"]); ?> ' + PageCount + ' - ' + HttpRequest.responseXML.getElementsByTagName("firstrev")[0].firstChild.data + ' ... ' + HttpRequest.responseXML.getElementsByTagName("lastrev")[0].firstChild.data);
|
||||
|
||||
|
||||
OptionElem.value = PageCount;
|
||||
OptionElem.appendChild(OptionText);
|
||||
|
||||
|
||||
document.getElementById("pagesel").appendChild(OptionElem);
|
||||
}
|
||||
|
||||
|
||||
if(HttpRequest.responseXML.getElementsByTagName("moreresults")[0].firstChild.data == 1 && (data["requesttype"] == REQUESTTYPE_FULLLOAD || data["requesttype"] == REQUESTTYPE_ADDPAGE))
|
||||
{
|
||||
// There are more results available in the full range. Therefore we have to start another request and add a new page.
|
||||
@ -455,9 +457,9 @@ function SearchCallback(HttpRequest)
|
||||
function OpenComparePage(ResultArray)
|
||||
{
|
||||
var parameters = "ids=";
|
||||
|
||||
|
||||
ResultArray.sort(NumericComparison);
|
||||
|
||||
|
||||
for(i = 0; i < ResultArray.length; i++)
|
||||
{
|
||||
if(!i)
|
||||
@ -465,10 +467,10 @@ function OpenComparePage(ResultArray)
|
||||
parameters += ResultArray[i];
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
parameters += "," + ResultArray[i];
|
||||
}
|
||||
|
||||
|
||||
if(document.getElementById("opennewwindow").checked || DetectObsoleteIE())
|
||||
{
|
||||
window.open("/sites/all/modules/reactos/testman/compare.php?" + parameters);
|
||||
@ -476,7 +478,7 @@ function OpenComparePage(ResultArray)
|
||||
else
|
||||
{
|
||||
var iframe = document.getElementById("comparepage_frame");
|
||||
|
||||
|
||||
iframe.src = "/sites/all/modules/reactos/testman/compare.php?" + parameters;
|
||||
iframe.style.display = "block";
|
||||
}
|
||||
@ -486,17 +488,17 @@ function CompareFirstTwoButton_OnClick()
|
||||
{
|
||||
var IDArray;
|
||||
var trs = document.getElementById("resulttable").getElementsByTagName("tbody")[0].getElementsByTagName("tr");
|
||||
|
||||
|
||||
if(trs[0].firstChild.firstChild.nodeName != "INPUT")
|
||||
return;
|
||||
|
||||
|
||||
// Get the IDs through the "id" attribute of the checkboxes
|
||||
IDArray = new Array();
|
||||
IDArray.push(parseInt(trs[0].firstChild.firstChild.id.substr(5)));
|
||||
|
||||
|
||||
if(trs[1])
|
||||
IDArray.push(parseInt(trs[1].firstChild.firstChild.id.substr(5)));
|
||||
|
||||
|
||||
OpenComparePage(IDArray);
|
||||
}
|
||||
|
||||
@ -506,7 +508,7 @@ function PageSwitch(NewPage)
|
||||
data["page"] = NewPage;
|
||||
data["resultlist"] = 1;
|
||||
data["requesttype"] = REQUESTTYPE_PAGESWITCH;
|
||||
|
||||
|
||||
SearchCall();
|
||||
}
|
||||
|
||||
@ -543,11 +545,11 @@ function NumericComparison(a, b)
|
||||
function CompareSelectedButton_OnClick()
|
||||
{
|
||||
var IDArray = new Array();
|
||||
|
||||
|
||||
// Sort the selected IDs
|
||||
for(id in SelectedResults)
|
||||
IDArray.push(parseInt(id));
|
||||
|
||||
|
||||
if(!IDArray.length)
|
||||
{
|
||||
alert("<?php echo addslashes($testman_langres["noselection"]); ?>");
|
||||
@ -558,7 +560,7 @@ function CompareSelectedButton_OnClick()
|
||||
alert("<?php printf(addslashes($testman_langres["selectatleast"]), 2); ?>");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OpenComparePage(IDArray);
|
||||
}
|
||||
|
||||
@ -567,3 +569,14 @@ function OpenNewWindowCheckbox_OnClick(checkbox)
|
||||
document.cookie = "opennewwindow=" + (checkbox.checked ? "1" : "0");
|
||||
document.getElementById("comparepage_frame").style.display = "none";
|
||||
}
|
||||
|
||||
function ClearSelected_OnClick()
|
||||
{
|
||||
document.getElementById("selectedresultcount").innerHTML = '0';
|
||||
|
||||
for(id in SelectedResults)
|
||||
document.getElementById('test_' + id).checked = false;
|
||||
|
||||
SelectedResults = new Object();
|
||||
SelectedResultCount = 0;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
"foundresults" => "%s Ergebnisse gefunden!",
|
||||
"noresults" => "Keine Suchergebnisse!",
|
||||
"status" => "%s Tests zum Vergleich ausgewählt",
|
||||
"clearselected" => "Clear selection",
|
||||
|
||||
"noselection" => "Sie haben keine Ergebnisse ausgewählt!",
|
||||
"selectatleast" => "Sie müssen mindestens %d Ergebnisse zum Vergleich auswählen!",
|
||||
|
@ -31,6 +31,7 @@
|
||||
"foundresults" => "Found %s Results!",
|
||||
"noresults" => "No Search Results!",
|
||||
"status" => "%s Tests selected for comparison",
|
||||
"clearselected" => "Clear selection",
|
||||
|
||||
"noselection" => "You did not select any results!",
|
||||
"selectatleast" => "You must select at least %d results for comparison!",
|
||||
|
@ -33,6 +33,7 @@
|
||||
"foundresults" => "Znaleziono %s wyników!",
|
||||
"noresults" => "Brak wyników wyszukiwania!",
|
||||
"status" => "%s testów wybranych do porównania",
|
||||
"clearselected" => "Clear selection",
|
||||
|
||||
"noselection" => "Nie wybrałeś/aś żadnych wyników!",
|
||||
"selectatleast" => "Musisz wybrać przynajmniej %d wyników do porównania!",
|
||||
|
Loading…
x
Reference in New Issue
Block a user