').addClass("project").appendTo(container);
$('
')
.addClass("delete-project")
.attr("title","Delete this project")
.attr("href","")
.html("
![](/images/close.png)
")
.click(function() {
if (window.confirm("Are you sure you want to delete project \"" + project.name + "\"?")) {
$.ajax({
type: "POST",
url: "/command/delete-project",
data: { "project" : project.id },
dataType: "json",
success: function (data) {
if (data && typeof data['code'] != 'undefined' && data.code == "ok") {
window.location.reload();
}
}
});
}
return false;
}).appendTo(div);
$('
').text(project.name).attr("href", "/project.html?project=" + project.id).appendTo(div);
$('
').text(formatDate(project.date)).addClass("last-modified").appendTo(div);
};
for (var i = 0; i < projects.length; i++) {
renderProject(projects[i]);
}
}
}
function formatDate(d) {
var yesterday = Date.today().add({ days: -1 });
var today = Date.today();
var tomorrow = Date.today().add({ days: 1 });
if (d.between(today, tomorrow)) {
return "Today " + d.toString("h:mm tt");
} else if (d.between(yesterday, today)) {
return "Yesterday " + d.toString("h:mm tt");
} else {
return d.toString("ddd, MMM d, yyyy");
}
}
function isThereNewRelease() {
var thisRevision = GridworksVersion.revision;
var revision_pattern = /r([0-9]+)/;
if (!revision_pattern.test(thisRevision)) { // probably "trunk"
return false;
}
var latestRevision = GridworksReleases.releases[0].revision;
var thisRev = parseInt(revision_pattern.exec(thisRevision)[1]);
var latestRev = parseInt(revision_pattern.exec(GridworksReleases.releases[0].revision)[1]);
return latestRev > thisRev;
}