some ezc functions from templates/item.cpp moved to Item and ItemContent
methods HasAccess() HasReadAccess() and similar moved from System to Item and ItemContent
This commit is contained in:
@@ -36,10 +36,12 @@
|
||||
#define headerfile_winix_models_itemcontent
|
||||
|
||||
#include <string>
|
||||
#include "winixmodel.h"
|
||||
#include "space/space.h"
|
||||
#include "date/date.h"
|
||||
#include "model.h"
|
||||
#include "templates/htmltextstream.h"
|
||||
#include "templates/misc.h"
|
||||
|
||||
|
||||
namespace Winix
|
||||
@@ -55,10 +57,33 @@ namespace Winix
|
||||
|
||||
|
||||
|
||||
class ItemContent : public morm::Model
|
||||
class ItemContent : public WinixModel
|
||||
{
|
||||
public:
|
||||
|
||||
/*
|
||||
* IMPROVEME
|
||||
*
|
||||
* the kind of content type would be better to be a string
|
||||
* so instead of 'ContentType content_raw_type' we would have 'std::wstring content_raw_type'
|
||||
* this allows us to use plugin system to define its own types such as markdown
|
||||
*
|
||||
* if we show an editor (such as emacs) then we call plugins with a specified message
|
||||
* and each plugin will put a string if it provides a content type mechanism
|
||||
* (we can have pt::Space as a parameter in plugins - this can be a table of strings)
|
||||
*
|
||||
* after user clicks 'save' button we send another message with content_raw and content_raw_type
|
||||
* and we expect content_raw_parsed to be made by a plugin
|
||||
*
|
||||
* or we have two content_type strings, one for internal use and the other for locale files (to show to a user)
|
||||
* or even three, the last one used as a description
|
||||
*
|
||||
*
|
||||
*
|
||||
* file_type should be a string, we can use libmagick library to get the correct type
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* may we should add ct_none? and this will be default (set in Clear method)
|
||||
*/
|
||||
@@ -124,7 +149,7 @@ public:
|
||||
|
||||
|
||||
/*
|
||||
* name of a link in the case when type is a symlink or a directory
|
||||
* name of a link in the case whct_texten type is a symlink or a directory
|
||||
*/
|
||||
std::wstring link_to;
|
||||
|
||||
@@ -226,16 +251,24 @@ public:
|
||||
* what about clear() from Model?
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
static bool CanContentBeHtmlFiltered(ItemContent::ContentType ct);
|
||||
bool CanContentBeHtmlFiltered();
|
||||
|
||||
|
||||
static void print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type, bool is_html_filter_on);
|
||||
void print_content(Ezc::FunInfo<HtmlTextStream> & env);
|
||||
|
||||
bool do_migration(int & current_table_version);
|
||||
|
||||
static bool CanContentBeHtmlFiltered(ItemContent::ContentType ct);
|
||||
static void print_content(HtmlTextStream & out, const std::wstring & content, ItemContent::ContentType content_type, bool is_html_filter_on);
|
||||
|
||||
bool CanContentBeHtmlFiltered();
|
||||
|
||||
bool has_read_access(const User * current_user) const;
|
||||
bool has_write_access(const User * current_user) const;
|
||||
bool has_read_write_access(const User * current_user) const;
|
||||
bool has_read_exec_access(const User * current_user) const;
|
||||
|
||||
bool has_read_access() const;
|
||||
bool has_write_access() const;
|
||||
bool has_read_write_access() const;
|
||||
bool has_read_exec_access() const;
|
||||
|
||||
bool is_sticky_bit_set() const;
|
||||
|
||||
|
||||
protected:
|
||||
@@ -244,6 +277,22 @@ protected:
|
||||
bool do_migration_to_2();
|
||||
bool do_migration_to_3();
|
||||
|
||||
bool has_access(const User * current_user, int mask) const;
|
||||
|
||||
void print_content(EzcEnv & env);
|
||||
void has_static_file(EzcEnv & env);
|
||||
void privileges_octal(EzcEnv & env);
|
||||
void user_name(EzcEnv & env);
|
||||
void group_name(EzcEnv & env);
|
||||
void type_is(EzcEnv & env);
|
||||
void is_empty(EzcEnv & env);
|
||||
void file_type_is_none(EzcEnv & env);
|
||||
void file_type_is_image(EzcEnv & env);
|
||||
void file_type_is_video(EzcEnv & env);
|
||||
void file_type_is_sound(EzcEnv & env);
|
||||
void has_thumb(EzcEnv & env);
|
||||
|
||||
|
||||
MORM_MEMBER_FIELD(ItemContent)
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user