Full code for MyFirstWebApplication, mark3. application org.webdsl.myfirstwebapp.mark3
description {
A community site about research.
}
section data model
entity Publication {
title :: String (name)
authors -> List<Person> (inverse=Person.publications)
abstract :: Text
published :: Date
url :: URL
}
entity Person {
fullname :: String (name)
homepage :: URL (optional)
email :: Email (optional)
address <> Address
publications -> Set<Publication>
}
entity Address {
street :: String
city :: String
country :: String
phone :: String
}
section home page
define page home() {
main()
define body() {
section{
header{"Publications"}
list{
for(pub : Publication) {
listitem{
navigate(publication(pub)){text(pub.name)}
}
}
listitem{navigate(createPublication()){"New Publication"}}
}
}
section{
header{"Authors"}
list{
for(pers: Person) {
listitem{ output(pers) }
}
listitem{navigate(createPerson()){"New Person"}}
}
}
}
}
define page publication(p : Publication) {
main()
define body() {
section{
header{output(p)}
par{
"by "
for(a : Person in p.authors) {
output(a) " "
}
"at " output(p.published)}
section{
header{"Abstract"}
output(p.abstract)
}
"Published: " output(p.url)
}
par{navigate(editPublication(p)){"Edit"}}
reviews(p)
}
}
section templates
define main() {
block("top") {
top() }
block("body") {
block("left_innerbody") {
sidebar() }
block("main_innerbody") {
body() } }
block("footer") {
footer()
}
}
define top() {
block("header") {}
block("menubar") {
applicationMenubar() } }
define body() {}
define manageMenu() {}
define sidebar() {}
define applicationMenubar()
{
menubar {
menu {
menuheader{ "People" }
for(p : Person) {
menuitem{ output(p) }
}
}
}
}
Contributions by EelcoVisser