winix/core/item.h

127 lines
1.4 KiB
C++
Executable File

/*
* This file is a part of CMSLU -- Content Management System like Unix
* and is not publicly distributed
*
* Copyright (c) 2008-2009, Tomasz Sowa
* All rights reserved.
*
*/
#ifndef headerfilecmslucoreitem
#define headerfilecmslucoreitem
#include <string>
struct Item
{
long id;
long user_id;
long group_id;
int privileges;
// used as a user name when user_id is equal -1
std::string guest_name;
tm date_creation;
tm date_modification;
std::string subject;
std::string content;
std::string url;
// 0 - text: simple
// 1 - text: formatted
// 2 - text: html
// 3 - text: bbcode
int content_type;
enum Type
{
dir = 0,
file = 1,
none = 1000
};
Type type;
//item_type;
long parent_id;
long default_item;
// used by the database
// !! moze da sie w ogole z tego zrezygnowac?
long content_id;
// external static file (saved in file system)
// the direct url is the same but the prefix is: base_url_static_auth
enum StaticAuth
{
static_none = 0,
static_image = 1,
static_other = 2
};
StaticAuth static_auth;
Item()
{
Clear();
}
void Clear()
{
id = -1;
user_id = -1;
group_id = -1;
privileges = 0;
guest_name.clear();
subject.clear();
content.clear();
url.clear();
content_type = 0;
type = none;
parent_id = -1;
default_item = -1;
content_id = -1;
static_auth = static_none;
time_t t = std::time(0);
date_creation = *std::localtime( &t );
date_modification = date_creation;
}
};
#endif