BASEDIR "/src/"; MODULEX MCMS.News EXTENDS Mod.Base.Base { @version "1.0.0"; GENTABLEXML REPLACE; GENSCRIPT REPLACE "install" INSTALL { CREATE TABLE entrys; CREATE TABLE comments; } GENSCRIPT REPLACE "remove" REMOVE{ DROP TABLE comments; DROP TABLE entrys; } ENUM visibility (public,useronly,hidden); MODEL Entry { @note "Newsentries"; id ObjectID; site_id Integer; instance String(32); created_at DateTime; created_by_id NULLABLE UserID; ~created_by Object; publish_start NULLABLE DateTime DEFAULT NULL; publish_end NULLABLE DateTime DEFAULT NULL; state ENUM visibility; title String(255); content HTML; details HTML; PKEY id; UNIQUE siteinstance site_id,instance; } MODEL Comment { @note "User comments on newsentries"; id ObjectID; news_id REF Entry:id DROP=CASCADE ALTER=CASCADE; created_at DateTime; created_by_id Integer; created_by_name String(64); content Text; PKEY id; INDEX news_id news_id; } SERVICE Repos { METHOD getIndex(Integer siteId, String instance); METHOD getHistory(Integer siteId, String instance, Integer page, Integer pagesize, Boolean reverse); METHOD storeEntry(Entry e) STORES e:id IN "m_mcms#news_entrys"; METHOD getEntry(Integer id) GETS id=id AS Entry FROM "m_mcms#news_entrys"; METHOD deleteEntry(Entry c) REMOVES c(id=id) FROM "m_mcms#news_entrys" CASCADE Comment FROM "m_mcms#news_comments"(id=news_id); METHOD getComments(Entry newsEntry, Integer page, Integer pagesize, Boolean reverse); METHOD storeComment(Comment e) STORES e:id IN "m_mcms#news_comments"; METHOD getComment(Integer id) GETS id=id AS Comment FROM "m_mcms#news_comments"; METHOD deleteComment(Comment c) REMOVES c(id=id) FROM "m_mcms#news_comments"; } view index { } view history { } view details { SHOW Entry news; LIST Comment comments>comment { SHOW Comment comment; } } action addComment { } view newEntry NOTEMPLATE { } action createEntry { } view editEntry { SHOW FORM Entry news; } action updateEntry { } view delaskEntry { } action deleteEntry { } view delaskComment { } action deleteComment { } }