Merge wk17 changes.
var BuildpageAjax = null;
var startbuild = "<!-- production Builds -->";
var endbuild = "<!--START of footer-->";
var buildtitle = null;
var builddescription = null;
function buildview (aParent) {
this.previousView = aParent;
this.setupSoftKeys();
buildtitle = new Label ("title_build","Latest Build Status:",null);
this.addControl (buildtitle);
builddescription = new Label ("description_build");
this.addControl (builddescription);
this.show();
this.update(true);
}
buildview.prototype = new ListView("buildview","<img src=logo.png>");
buildview.prototype.update = function(myflag){
if (myflag) {
var mybuf = "<div class=\"FeedItemLink\">";
mybuf += "<a href=\"JavaScript:void(0)\" onclick=\"openURL('" + buildresultsUrl + Packageid + "'); return false;\">";
mybuf += "(Click here for more details...)";
mybuf += "</a>";
mybuf += "</div>";
if(!Packageid){return;}
buildtitle.setText(Packageid + " " + mybuf);
builddescription.setText("");
this.loadbuild(buildresultsUrl + Packageid);
}
}
buildview.prototype.loadbuild =function (url) {
uiManager.showNotification(-1, "wait", "Please wait...", -1);
BuildpageAjax = new Ajax();
BuildpageAjax.onreadystatechange = this.muchbuild;
BuildpageAjax.open('GET', nocache(url), true);
BuildpageAjax.send(null);
}
buildview.prototype.setlabels = function(aTitle, aDescription){
this.title.setText(aTitle);
this.description.setText(aDescription);
}
buildview.prototype.muchbuild =function () {
if (BuildpageAjax.readyState == 4) {
var content = BuildpageAjax.responseText;
var ind = content.indexOf(startbuild);
if (ind == -1) {
uiManager.showNotification(3000, "Warning", "Build Results - Package Not Found");
debuglog.debug("Build package page with wrong format");
return;
}
ind += startbuild.length;
var ind2 = content.indexOf(endbuild);
content = content.substring(ind, ind2-1);
ind2 = content.indexOf("<h4");
var ind3 = content.indexOf("</h4>",ind2);
while (ind2!= -1){
builddescription.setText(builddescription.getText() + content.substring(ind2, ind3)+ ":");
//find the first RAG
ind2=content.indexOf("<tr>",ind3);
ind3=content.indexOf("<tr>",ind2);
ind2=content.indexOf("<td>",ind3);
ind3=content.indexOf("<td>",ind2+4);
ind2=content.indexOf("<td>",ind3+4);
ind3=content.indexOf("<td>",ind2+4);
ind2=content.indexOf("</td>",ind3+4);
builddescription.setText(builddescription.getText() + content.substring(ind3+4, ind2));
ind2 = content.indexOf("<h4",ind3);
ind3 = content.indexOf("</h4>",ind2);
}
//uiManager.hideNotification();
}
}