Full code for MyFirstWebApplication, mark2. application org.webdsl.myfirstwebapp.mark2
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"}}
}
}
section templates
define main()
{
sidebar() body() manageMenu()
}
define body() {}
define manageMenu() {}
define sidebar() {}
Contributions by EelcoVisser