BASEDIR "/src/"; MODULEX MCMS.Gallery EXTENDS Mod.Base.Base { @version "1.0.0"; GENTABLEXML REPLACE; GENSCRIPT REPLACE "install" INSTALL { CREATE TABLE gallerys; CREATE TABLE galleryacls; CREATE TABLE picinfos; CREATE TABLE picmetas; CREATE TABLE picdatas; CREATE TABLE piccomments; CREATE TABLE picvotes; } GENSCRIPT REPLACE "remove" REMOVE { DROP TABLE picvotes; DROP TABLE piccomments; DROP TABLE picdatas; DROP TABLE picmetas; DROP TABLE picinfos; DROP TABLE galleryacls; DROP TABLE gallerys; } ENUM Visibility (public,user,acl); ENUM Access (read,write,admin); CHLOG MODEL Gallery { id ObjectID; parent_id NULLABLE REF Gallery:id DROP=NULL ALTER=CASCADE; site_id Integer; instance String(64); category Integer; name LOCALIZED String(255); info LOCALIZED String(255); gallerydate NULLABLE Date; visible ENUM Visibility; pic_count Integer; PKEY id; INDEX site site_id; INDEX parents parent_id; } DATAMODEL GalleryACL { gallery REF Gallery:id DROP=CASCADE ALTER=CASCADE; user NULLABLE UserID; group NULLABLE GroupID; INDEX gallery gallery; } MODEL PicInfo { id ObjectID; gallery_id REF Gallery:id DROP=CASCADE ALTER=CASCADE; type Integer; views Integer; filename String(255); store String(32); // storage type (db, file, ...) PKEY id; UNIQUE gallerypic gallery_id,filename; } MODEL PicMeta { pic_id REF PicInfo:id DROP=CASCADE ALTER=CASCADE; key String(96); value String(255); PKEY pic_id, key; } MODEL PicData { pic_id REF PicInfo:id DROP=CASCADE ALTER=CASCADE; data Blob; PKEY pic_id; } MODEL PicComment { id ObjectID; pic_id REF PicInfo:id DROP=CASCADE ALTER=CASCADE; created_at DateTime; created_by_id UserID; comment Text; PKEY id; INDEX pic pic_id; } MODEL PicVote { pic_id REF PicInfo:id DROP=CASCADE ALTER=CASCADE; created_at DateTime; created_by_id UserID; vote Short; PKEY pic_id,created_by_id; } SERVICE Repos { METHOD storeGallery(Gallery gallery) STORES gallery:id IN "m_mcms#gallery_gallerys"; METHOD getGallery(Integer siteId, String instance, Integer id) GETS site_id=siteId,instance=instance,id=id AS Gallery FROM "m_mcms#gallery_gallerys"; METHOD removeGallery(Gallery gallery) REMOVES gallery(id=id) FROM "m_mcms#gallery_gallerys"; METHOD storePic(Gallery gallery, PicInfo info, Blob data); METHOD updatePicBinData(PicInfo info, Blob data); METHOD getPicList(Integer gallery, Integer page, Integer pageSize); METHOD getPicInfo(Integer picId); METHOD getPicBinData(Integer picId); METHOD removePic(Gallery gallery, PicInfo info); } view index { LIST Gallery galleries>gallery { SHOW Gallery gallery; } } view newGallery NOTEMPLATE { } action createGallery { } view editGallery { SHOW FORM Gallery gallery; } action updateGallery { } action setGalleryIndex { } view delaskGallery { } action removeGallery { } view gallery { SHOW Gallery gallery; LIST PicInfo pictures>picture { SHOW PicInfo picture; } } view picture { SHOW Gallery gallery; SHOW PicInfo picInfo; LIST PicComment comments>comment { SHOW PicComment comment; } } view pictureUpload { } view picDelask { } }