/* * This file is a part of Winix * and is not publicly distributed * * Copyright (c) 2008-2010, Tomasz Sowa * All rights reserved. * */ #ifndef headerfilecmslucoreitem #define headerfilecmslucoreitem #include struct Item { long id; long parent_id; long user_id; long group_id; std::string guest_name; // used as a user name when user_id is equal -1 int privileges; tm date_creation; tm date_modification; std::string subject; std::string content; long content_id; // used by the database std::string url; enum ContentType { ct_text = 0, ct_formatted_text, ct_html, ct_bbcode, ct_raw }; ContentType content_type; enum Type { dir = 0, file = 1, none = 1000 // !! pozbyc sie tego }; Type type; long default_item; // external static file authorized by winix enum Auth { auth_none = 0, /* there is not an external file */ auth_image = 1, /* png, gif, jpg - only types available to render by a web browser*/ auth_document = 2, /* pdf doc xls txt */ auth_other = 3 /* other file */ }; Auth auth; std::string auth_path; // path to a file (if auth!=auth_none) // methods Item() { Clear(); } void SetDateToNow() { time_t t = std::time(0); date_creation = *std::localtime( &t ); date_modification = date_creation; } void SetDateModifyToNow() { time_t t = std::time(0); date_modification = *std::localtime( &t ); } void Clear() { id = -1; user_id = -1; group_id = -1; privileges = 0; guest_name.clear(); subject.clear(); content.clear(); url.clear(); content_type = ct_formatted_text; type = none; parent_id = -1; default_item = -1; content_id = -1; auth = auth_none; auth_path.clear(); SetDateToNow(); } }; #endif