BASEDIR "/src/"; MODULE MCMS.Guestbook EXTENDS Mod.Base.Base { @version "1.1.0"; @author "Stefan Daurer "; GENTABLEXML REPLACE; GENSCRIPT REPLACE "install" INSTALL { CREATE TABLE entrys; CREATE TABLE comments; } GENSCRIPT REPLACE "update" UPDATE FROM "1.0.2" { } GENSCRIPT REPLACE "remove" REMOVE{ DROP TABLE comments; DROP TABLE entrys; } MODEL Entry { id ObjectID; site_id Integer; instance String(32); langu String(5); state Short; email NULLABLE EMail; url NULLABLE URL; content Text; ip NULLABLE String(48); created_by_id NULLABLE UserID; created_by_name String(128); created_at DateTime; modified_by_id NULLABLE UserID; modified_by_name NULLABLE String(128); modified_at NULLABLE DateTime; revision Integer; ~comments Object; ~locked Boolean; PKEY id; INDEX site site_id; } MODEL Comment { id ObjectID; entry_id REF Entry:id DROP=CASCADE ALTER=CASCADE; state Integer; email NULLABLE EMail; url NULLABLE URL; comment Text; ip NULLABLE String(48); created_at DateTime; created_by_id UserID; PKEY id; INDEX entry entry_id; } SERVICE Repos { METHOD storeEntry(Entry e) STORES e:id IN "m_mcms#guestbook_entrys"; METHOD getEntry(String instance, Integer id) GETS instance=instance,id=id AS Entry FROM "m_mcms#guestbook_entrys"; METHOD removeEntry(Entry e) REMOVES e(id=id) FROM "m_mcms#guestbook_entrys"; } view index { LIST Entry entries>entry { SHOW Entry entry; } } view add { SHOW FORM FIELDS Entry entry IGNORE id, site_id, instance, langu, state, ip, created_by_id, created_at, modified_by_id, modified_by_name, modified_at, revision, comments, locked; } action addPost { } view addOK { } view delAsk { CHECKPERM delEntry; } action removeEntry { CHECKPERM delEntry; } }