The action in the following template only works if both conditions are false. That is, the returns in the other cases are not executed or ignored on the client. Client-side code for downloadlink should interpret redirects.


define downloadPDF(pub: Publication) {
// todo: should implement returns
action download() {
if(!loggedIn()) {
message(“Only registered and signed in users can store and download PDFs.”);
return signin();
}
var pdf := getPDF(pub, principal());
if(pdf == null) {
message(“You haven’t uploaded a PDF for this publication yet.”);
return publication(pub, “upload”, "");
}
pdf.file.download();
//return publicationpdf(pub);
}
downloadlink download() { “[PDF]” }
}

Submitted by Eelco Visser on 15 May 2011 at 20:50

Log in to post comments