added: to Item struct: ameta (PT::Space)
admin meta information added: option "a" to meta winix function editing admin meta information changed: now if you don't have write access to an item you can't see the meta information previous if you had read access you could have seen them added: in plugin ticket and thread support for 'closing' (ticket, thread) (this is only logic, we need some html yet) added: some ezc function for getting meta/admin meta information (for the current item and the last directory) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@907 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
4809016b78
commit
0045c6c72c
|
@ -74,6 +74,7 @@ void Item::Clear()
|
|||
html_template.clear();
|
||||
sort_index = 0;
|
||||
meta.Clear();
|
||||
ameta.Clear();
|
||||
|
||||
SetDateToNow();
|
||||
}
|
||||
|
|
|
@ -98,6 +98,7 @@ struct Item
|
|||
|
||||
// meta information
|
||||
PT::Space meta;
|
||||
PT::Space ameta;
|
||||
|
||||
|
||||
// methods
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#define WINIX_VER_MAJOR 0
|
||||
#define WINIX_VER_MINOR 5
|
||||
#define WINIX_VER_REVISION 1
|
||||
#define WINIX_VER_REVISION 2
|
||||
|
||||
|
||||
#endif
|
||||
|
|
25
db/db.cpp
25
db/db.cpp
|
@ -311,7 +311,7 @@ Error Db::AddItemIntoItem(Item & item)
|
|||
query.Clear();
|
||||
query << R("insert into core.item (user_id, modification_user_id, group_id, privileges, "
|
||||
"date_creation, date_modification, type, parent_id, content_id, "
|
||||
"link_to, link_redirect, subject, guest_name, template, sort_index, meta, url) values (")
|
||||
"link_to, link_redirect, subject, guest_name, template, sort_index, meta, ameta, url) values (")
|
||||
<< item.user_id
|
||||
<< item.modification_user_id
|
||||
<< item.group_id
|
||||
|
@ -327,7 +327,8 @@ Error Db::AddItemIntoItem(Item & item)
|
|||
<< item.guest_name
|
||||
<< item.html_template
|
||||
<< item.sort_index
|
||||
<< item.meta;
|
||||
<< item.meta
|
||||
<< item.ameta;
|
||||
|
||||
url_without_id = AddItemCreateUrlSubject(item);
|
||||
|
||||
|
@ -469,7 +470,7 @@ Error Db::EditItemInItem(Item & item, bool with_url)
|
|||
query.Clear();
|
||||
query << R("update core.item set (user_id, modification_user_id, group_id, privileges, "
|
||||
"date_creation, date_modification, type, link_to, link_redirect, parent_id, subject, "
|
||||
"guest_name, template, sort_index, meta");
|
||||
"guest_name, template, sort_index, meta, ameta");
|
||||
|
||||
if( with_url )
|
||||
query << R(", url");
|
||||
|
@ -489,7 +490,8 @@ Error Db::EditItemInItem(Item & item, bool with_url)
|
|||
<< item.guest_name
|
||||
<< item.html_template
|
||||
<< item.sort_index
|
||||
<< item.meta;
|
||||
<< item.meta
|
||||
<< item.ameta;
|
||||
|
||||
if( with_url )
|
||||
{
|
||||
|
@ -771,7 +773,7 @@ void Db::GetItemsQuerySelect(const DbItemQuery & iq, DbTextStream & query, bool
|
|||
if( iq.sel_file ) query << R(", file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size");
|
||||
if( iq.sel_html_template ) query << R(", template");
|
||||
if( iq.sel_sort_index ) query << R(", sort_index");
|
||||
if( iq.sel_meta ) query << R(", meta");
|
||||
if( iq.sel_meta ) query << R(", meta, ameta");
|
||||
}
|
||||
|
||||
query << R(" from core.item");
|
||||
|
@ -1343,6 +1345,19 @@ return DoCommand(query);
|
|||
}
|
||||
|
||||
|
||||
Error Db::EditAdminMetaById(const PT::Space & ameta, long id)
|
||||
{
|
||||
query.Clear();
|
||||
query << R("update core.item set (ameta) = (")
|
||||
<< ameta
|
||||
<< R(") where id=")
|
||||
<< id
|
||||
<< R(";");
|
||||
|
||||
return DoCommand(query);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Error Db::EditSubjectById(Item & item, long id)
|
||||
|
|
1
db/db.h
1
db/db.h
|
@ -72,6 +72,7 @@ public:
|
|||
Error EditFileById(const Item & item, long id); // file_path, file_fs, file_type
|
||||
Error EditHasThumbById(bool has_thumb, long id);
|
||||
Error EditMetaById(const PT::Space & meta, long id);
|
||||
Error EditAdminMetaById(const PT::Space & meta, long id);
|
||||
|
||||
Error DelDirById(long id);
|
||||
Error DelFileById(long file_id);
|
||||
|
|
|
@ -46,6 +46,7 @@ void DbItemColumns::SetColumns(PGresult * r)
|
|||
modify_index = PQfnumber(r, "modify_index");
|
||||
sort_index = PQfnumber(r, "sort_index");
|
||||
meta = PQfnumber(r, "meta");
|
||||
ameta = PQfnumber(r, "ameta");
|
||||
}
|
||||
|
||||
|
||||
|
@ -82,7 +83,8 @@ void DbItemColumns::SetItem(PGresult * r, long row, Item & item)
|
|||
if( html_template != -1 ) DbBase::AssertValueWide(r, row, html_template, item.html_template);
|
||||
if( sort_index != -1 ) item.sort_index = DbBase::AssertValueInt(r, row, sort_index);
|
||||
|
||||
if( meta != -1 ) db_base.AssertValueSpace(r, row, meta, item.meta);
|
||||
if( meta != -1 ) db_base.AssertValueSpace(r, row, meta, item.meta);
|
||||
if( ameta != -1 ) db_base.AssertValueSpace(r, row, ameta, item.ameta);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ struct DbItemColumns
|
|||
int modify_index;
|
||||
int sort_index;
|
||||
int meta;
|
||||
int ameta;
|
||||
|
||||
DbItemColumns(DbBase & db_base_) : db_base(db_base_)
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@ struct DbItemQuery
|
|||
bool sel_file; // file_path, file_fs, file_type, has_thumb, hash, hash_type, file_size
|
||||
bool sel_html_template; // template
|
||||
bool sel_sort_index; // sort_index
|
||||
bool sel_meta; // meta PT::Space
|
||||
bool sel_meta; // meta and ameta (PT::Space)
|
||||
|
||||
bool where_id; //
|
||||
bool where_parent_id; //
|
||||
|
|
|
@ -54,7 +54,7 @@ return (conf_parser.ParseString(env_str) == PT::SpaceParser::ok);
|
|||
}
|
||||
|
||||
|
||||
bool Env::EditAdminEnv(long user_id, const std::wstring & env_str)
|
||||
bool Env::EditAdminEnv(long user_id, const std::wstring & env_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(env_str) )
|
||||
{
|
||||
|
@ -69,21 +69,23 @@ bool Env::EditAdminEnv(long user_id, const std::wstring & env_str)
|
|||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Evn: a problem with changing environment variables for user: "
|
||||
log << log1 << "Evn: a database problem with changing environment variables for user: "
|
||||
<< cur->session->puser->name << ", id: " << cur->session->puser->id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Env: Syntax error in line: " << conf_parser.line << logend;
|
||||
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool Env::EditEnv(long user_id, const std::wstring & env_str)
|
||||
bool Env::EditEnv(long user_id, const std::wstring & env_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(env_str) )
|
||||
{
|
||||
|
@ -98,20 +100,23 @@ bool Env::EditEnv(long user_id, const std::wstring & env_str)
|
|||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Evn: a problem with changing admin environment variables for user: "
|
||||
log << log1 << "Evn: a database problem with changing admin environment variables for user: "
|
||||
<< cur->session->puser->name << ", id: " << cur->session->puser->id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Env: Syntax error in line: " << conf_parser.line << logend;
|
||||
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Env::SaveEnv()
|
||||
{
|
||||
if( GetUser() )
|
||||
|
@ -123,11 +128,11 @@ void Env::SaveEnv()
|
|||
if( cur->request->IsParam(L"a") )
|
||||
{
|
||||
if( cur->session->puser->super_user )
|
||||
status = EditAdminEnv(user_id, env_str);
|
||||
status = EditAdminEnv(user_id, env_str, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
status = EditEnv(user_id, env_str);
|
||||
status = EditEnv(user_id, env_str, true);
|
||||
}
|
||||
|
||||
if( status )
|
||||
|
|
|
@ -24,8 +24,8 @@ public:
|
|||
|
||||
Env();
|
||||
|
||||
bool EditAdminEnv(long user_id, const std::wstring & env_str);
|
||||
bool EditEnv(long user_id, const std::wstring & env_str);
|
||||
bool EditAdminEnv(long user_id, const std::wstring & env_str, bool use_ses_log = false);
|
||||
bool EditEnv(long user_id, const std::wstring & env_str, bool use_ses_log = false);
|
||||
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
|
|
|
@ -17,30 +17,53 @@ namespace Fun
|
|||
Meta::Meta()
|
||||
{
|
||||
fun.url = L"meta";
|
||||
// !! CHECKME what about follow symlinks?
|
||||
}
|
||||
|
||||
|
||||
bool Meta::HasAccess()
|
||||
{
|
||||
return system->HasReadAccess(*cur->request->last_item);
|
||||
if( cur->request->IsParam(L"a") )
|
||||
return cur->session->puser && cur->session->puser->super_user;
|
||||
else
|
||||
return system->HasWriteAccess(*cur->request->last_item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool Meta::AddMetaInfo(Item & item, const std::wstring & meta_str)
|
||||
bool Meta::Parse(const std::wstring & meta_str)
|
||||
{
|
||||
space.Clear();
|
||||
conf_parser.SetSpace(space);
|
||||
conf_parser.UTF8(config->utf8);
|
||||
conf_parser.SplitSingle(true);
|
||||
|
||||
if( conf_parser.ParseString(meta_str) == PT::SpaceParser::ok )
|
||||
return (conf_parser.ParseString(meta_str) == PT::SpaceParser::ok);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool Meta::EditAdminMeta(long item_id, const std::wstring & meta_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(meta_str) )
|
||||
{
|
||||
if( db->EditMetaById(space, item.id) == WINIX_ERR_OK )
|
||||
if( db->EditAdminMetaById(space, item_id) == WINIX_ERR_OK )
|
||||
{
|
||||
item.meta = space;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Meta: a database problem with changing admin meta information for item id: "
|
||||
<< item_id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Meta: Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -48,21 +71,64 @@ return false;
|
|||
|
||||
|
||||
|
||||
void Meta::MakePost()
|
||||
bool Meta::EditMeta(long item_id, const std::wstring & meta_str, bool use_ses_log)
|
||||
{
|
||||
if( Parse(meta_str) )
|
||||
{
|
||||
if( db->EditMetaById(space, item_id) == WINIX_ERR_OK )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Meta: a database problem with changing meta information for item id: "
|
||||
<< item_id << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log2 << "Meta: Syntax error in line: " << conf_parser.line << logend;
|
||||
|
||||
if( use_ses_log )
|
||||
slog << logerror << T("syntax_error_in_line") << ' ' << conf_parser.line << logend;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Meta::ChangeAdminMeta()
|
||||
{
|
||||
if( cur->session->puser && cur->session->puser->super_user )
|
||||
{
|
||||
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
|
||||
|
||||
if( EditAdminMeta(cur->request->last_item->id, meta_str, true) )
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Meta::ChangeMeta()
|
||||
{
|
||||
if( system->HasWriteAccess(*cur->request->last_item) )
|
||||
{
|
||||
const std::wstring & meta_str = cur->request->PostVar(L"itemmeta");
|
||||
|
||||
if( AddMetaInfo(*cur->request->last_item, meta_str) )
|
||||
if( EditMeta(cur->request->last_item->id, meta_str, true) )
|
||||
system->RedirectToLastItem();
|
||||
else
|
||||
slog << logerror << "Syntax error in line: " << conf_parser.line << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Meta::MakePost()
|
||||
{
|
||||
if( cur->request->IsParam(L"a") )
|
||||
ChangeAdminMeta();
|
||||
else
|
||||
{
|
||||
cur->request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
}
|
||||
ChangeMeta();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -26,12 +26,19 @@ public:
|
|||
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
bool AddMetaInfo(Item & item, const std::wstring & meta_str);
|
||||
|
||||
bool EditAdminMeta(long item_id, const std::wstring & meta_str, bool use_ses_log = false);
|
||||
bool EditMeta(long item_id, const std::wstring & meta_str, bool use_ses_log = false);
|
||||
|
||||
private:
|
||||
|
||||
PT::SpaceParser conf_parser;
|
||||
PT::Space space;
|
||||
|
||||
bool Parse(const std::wstring & meta_str);
|
||||
void ChangeAdminMeta();
|
||||
void ChangeMeta();
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -1,12 +1,40 @@
|
|||
<div class="winix">
|
||||
|
||||
<h1>{meta_header}</h1>
|
||||
[if winix_function_param_is "a"]
|
||||
<h1>{meta_admin_header}</h1>
|
||||
|
||||
[if item_is]
|
||||
<form method="post" action="[doc_base_url][dir][item_url]/meta/a">
|
||||
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[item_admin_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</form>
|
||||
[else]
|
||||
<form method="post" action="[doc_base_url][dir]meta/a">
|
||||
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[dir_last_admin_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</form>
|
||||
[end]
|
||||
|
||||
|
||||
[else]
|
||||
|
||||
<h1>{meta_header}</h1>
|
||||
|
||||
[if item_is]
|
||||
<form method="post" action="[doc_base_url][dir][item_url]/meta">
|
||||
|
||||
[if item_is]
|
||||
[if item_can_write]
|
||||
<form id="additem" method="post" action="[doc_base_url][dir][item_url]/meta">
|
||||
<fieldset>
|
||||
<legend>{form_meta_legend}</legend>
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[item_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
|
@ -14,28 +42,20 @@
|
|||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
[else]
|
||||
<pre>[item_meta_str]</pre>
|
||||
[end]
|
||||
[else]
|
||||
[if dir_can_write]
|
||||
<form id="additem" method="post" action="[doc_base_url][dir]meta">
|
||||
<fieldset>
|
||||
<legend>{form_meta_legend}</legend>
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[dir_last_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
<form method="post" action="[doc_base_url][dir]meta">
|
||||
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
<textarea class="multitext" rows="30" cols="60" name="itemmeta">[dir_last_meta_str]</textarea>
|
||||
<input class="submit" type="submit" value="{change}">
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
[else]
|
||||
<pre>[dir_last_meta_str]</pre>
|
||||
[if winix_function_param_is "postredirect"]
|
||||
<input type="hidden" name="postredirect" value="[winix_function_param_value "postredirect"]">
|
||||
[end]
|
||||
|
||||
</form>
|
||||
[end]
|
||||
|
||||
[end]
|
||||
|
||||
|
||||
|
|
|
@ -10,6 +10,9 @@ logged_as_long = You are logged as
|
|||
display_guest_name = guest
|
||||
unknown = unknown
|
||||
|
||||
syntax_error_in_line = Syntax error in line:
|
||||
|
||||
|
||||
this_ip_is_banned_until = We are sorry but your IP address is banned until to:
|
||||
|
||||
account_not_activated = This account is not activated yet.
|
||||
|
@ -177,7 +180,7 @@ man_ezc_functions = EZC templates functions
|
|||
|
||||
|
||||
meta_header = Meta
|
||||
form_meta_legend = Form for changing meta info
|
||||
meta_admin_header = Admin meta
|
||||
|
||||
|
||||
mkdir_header = Make directory
|
||||
|
|
|
@ -11,6 +11,9 @@ logged_as_long = Aktualnie jesteś zalogowany jako
|
|||
display_guest_name = gość
|
||||
unknown = nie znany
|
||||
|
||||
syntax_error_in_line = Błąd składni w linii:
|
||||
|
||||
|
||||
this_ip_is_banned_until = Przepraszamy ale twój adres IP jest zablokowany aż do:
|
||||
|
||||
|
||||
|
@ -175,7 +178,7 @@ ipban_ban_list_empty = W tej chwili nie ma żadnych zbanowanych adresów IP.
|
|||
|
||||
|
||||
meta_header = Meta
|
||||
form_meta_legend = Formularz zmiany meta informacji
|
||||
meta_admin_header = Admin meta
|
||||
|
||||
|
||||
man_header = Man
|
||||
|
|
|
@ -53,6 +53,15 @@ bool Reply::HasAccess()
|
|||
if( !files_dir || !system->HasWriteAccess(*files_dir) )
|
||||
return false;
|
||||
|
||||
|
||||
PT::Space * thread_space = cur->request->item.ameta.FindSpace(L"thread");
|
||||
|
||||
if( thread_space )
|
||||
{
|
||||
if( thread_space->Bool(L"closed", false) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ bool EditTicket::HasAccess()
|
|||
if( cur->mount->type != ticket_info->mount_type_ticket )
|
||||
return false;
|
||||
|
||||
// !! CHECKME what about closing threads?
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -187,19 +189,39 @@ void EditTicket::MakePost()
|
|||
}
|
||||
|
||||
|
||||
void EditTicket::CloseTicket()
|
||||
{
|
||||
PT::Space & ticket_space = cur->request->item.ameta.FindAddSpace(L"ticket");
|
||||
ticket_space.Add(L"closed", true);
|
||||
|
||||
PT::Space & thread_space = cur->request->item.ameta.FindAddSpace(L"thread");
|
||||
thread_space.Add(L"closed", true);
|
||||
|
||||
if( db->EditAdminMetaById(cur->request->item.ameta, cur->request->item.id) == WINIX_ERR_OK )
|
||||
log << log3 << "EditTicket: closing ticket" << logend;
|
||||
}
|
||||
|
||||
|
||||
void EditTicket::MakeGet()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
if( cur->request->IsParam(L"close") )
|
||||
{
|
||||
CloseTicket();
|
||||
system->RedirectToLastItem();
|
||||
}
|
||||
else
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
|
||||
Ticket & ticket = PrepareTicket();
|
||||
PT::Space & meta = PrepareSpace();
|
||||
ticket_info->ticket = &ticket;
|
||||
ticket_info->item = &cur->request->item;
|
||||
Ticket & ticket = PrepareTicket();
|
||||
PT::Space & meta = PrepareSpace();
|
||||
ticket_info->ticket = &ticket;
|
||||
ticket_info->item = &cur->request->item;
|
||||
|
||||
// copy meta info to display correctly new files
|
||||
ticket_info->CopyTicketSpace(meta, cur->request->item);
|
||||
// copy meta info to display correctly new files
|
||||
ticket_info->CopyTicketSpace(meta, cur->request->item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ private:
|
|||
PT::Space & PrepareSpace();
|
||||
void ChangeTicket(Ticket & ticket, Item & item);
|
||||
void Submit(Ticket & ticket, Item & item);
|
||||
void CloseTicket();
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -274,6 +274,14 @@ void ticket_meta_value(Info & i)
|
|||
space(i, ticket_info.item->meta);
|
||||
}
|
||||
|
||||
void ticket_is_closed(Info & i)
|
||||
{
|
||||
PT::Space * ticket_space = cur->request->item.ameta.FindSpace(L"ticket");
|
||||
|
||||
if( ticket_space )
|
||||
i.res = ticket_space->Bool(L"closed", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
namespace ns_tickets_tab
|
||||
|
@ -414,6 +422,21 @@ void tickets_tab(Info & i)
|
|||
}
|
||||
|
||||
|
||||
void tickets_tab_is_closed(Info & i)
|
||||
{
|
||||
tickets_tab_check_reqid();
|
||||
|
||||
if( tickets_value.is_item )
|
||||
{
|
||||
PT::Space * ticket_space = tickets_value.item->ameta.FindSpace(L"ticket");
|
||||
|
||||
if( ticket_space )
|
||||
i.res = ticket_space->Bool(L"closed", false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tickets_tab_url(Info & i)
|
||||
{
|
||||
tickets_tab_check_reqid();
|
||||
|
@ -844,8 +867,10 @@ using namespace ns_ticket_tab;
|
|||
fun->Insert("ticket_can_edit", ticket_can_edit);
|
||||
fun->Insert("ticket_is_creating_new", ticket_is_creating_new);
|
||||
fun->Insert("ticket_meta_value", ticket_meta_value);
|
||||
fun->Insert("ticket_is_closed", ticket_is_closed);
|
||||
|
||||
fun->Insert("tickets_tab", tickets_tab);
|
||||
fun->Insert("tickets_tab_is_closed", tickets_tab_is_closed);
|
||||
fun->Insert("tickets_tab_url", tickets_tab_url);
|
||||
fun->Insert("tickets_tab_subject_empty", tickets_tab_subject_empty);
|
||||
fun->Insert("tickets_tab_subject", tickets_tab_subject);
|
||||
|
|
|
@ -132,7 +132,7 @@ dir.o: ../functions/rm.h ../functions/rmuser.h ../functions/sort.h
|
|||
dir.o: ../functions/specialdefault.h ../functions/stat.h
|
||||
dir.o: ../functions/subject.h ../functions/template.h ../functions/tinymce.h
|
||||
dir.o: ../functions/uname.h ../functions/upload.h ../functions/uptime.h
|
||||
dir.o: ../functions/who.h ../functions/vim.h
|
||||
dir.o: ../functions/who.h ../functions/vim.h miscspace.h
|
||||
doc.o: templates.h ../../ezc/src/ezc.h ../../ezc/src/generator.h
|
||||
doc.o: ../../ezc/src/pattern.h ../../ezc/src/item.h ../../ezc/src/funinfo.h
|
||||
doc.o: ../../ezc/src/functions.h ../../ezc/src/stringconv.h
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "templates.h"
|
||||
#include "core/misc.h"
|
||||
#include "functions/functions.h"
|
||||
#include "miscspace.h"
|
||||
|
||||
|
||||
namespace TemplatesFunctions
|
||||
|
@ -432,14 +433,71 @@ void dir_last_has_html_template(Info & i)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void dir_last_meta_str(Info & i)
|
||||
{
|
||||
cur->request->dir_tab.back()->meta.Serialize(i.out, true, false);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_meta_tab_value(Info & i)
|
||||
{
|
||||
spaces_tab_value(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void dir_last_meta_tab_has_next(Info & i)
|
||||
{
|
||||
spaces_tab_has_next(i, cur->request->dir_tab.back()->meta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void dir_last_admin_meta_str(Info & i)
|
||||
{
|
||||
cur->request->dir_tab.back()->ameta.Serialize(i.out, true, false);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta_tab_value(Info & i)
|
||||
{
|
||||
spaces_tab_value(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
void dir_last_admin_meta_tab_has_next(Info & i)
|
||||
{
|
||||
spaces_tab_has_next(i, cur->request->dir_tab.back()->ameta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace TemplatesFunctions
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -393,10 +393,12 @@ void item_meta_str(Info & i)
|
|||
|
||||
void item_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->last_item->meta);
|
||||
space(i, cur->request->last_item->meta); // !! a new interface (last_item instead of item)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void item_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->last_item->meta);
|
||||
|
@ -418,6 +420,38 @@ void item_meta_tab_has_next(Info & i)
|
|||
|
||||
|
||||
|
||||
void item_admin_meta_str(Info & i)
|
||||
{
|
||||
cur->request->item.ameta.Serialize(i.out, true, false);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta(Info & i)
|
||||
{
|
||||
space(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta_tab(Info & i)
|
||||
{
|
||||
spaces_tab(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta_tab_value(Info & i)
|
||||
{
|
||||
spaces_tab_value(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
void item_admin_meta_tab_has_next(Info & i)
|
||||
{
|
||||
spaces_tab_has_next(i, cur->request->last_item->ameta);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static size_t item_index;
|
||||
|
|
|
@ -225,8 +225,36 @@ void Templates::CreateFunctions()
|
|||
ezc_functions.Insert("dir_last_html_template", dir_last_html_template);
|
||||
ezc_functions.Insert("dir_last_has_html_template", dir_last_has_html_template);
|
||||
ezc_functions.Insert("dir_last_meta_str", dir_last_meta_str);
|
||||
ezc_functions.Insert("dir_last_meta", dir_last_meta);
|
||||
ezc_functions.Insert("dir_last_meta_tab", dir_last_meta_tab);
|
||||
ezc_functions.Insert("dir_last_meta_tab_value", dir_last_meta_tab_value);
|
||||
ezc_functions.Insert("dir_last_meta_tab_has_next", dir_last_meta_tab_has_next);
|
||||
ezc_functions.Insert("dir_last_admin_meta_str", dir_last_admin_meta_str);
|
||||
ezc_functions.Insert("dir_last_admin_meta", dir_last_admin_meta);
|
||||
ezc_functions.Insert("dir_last_admin_meta_tab", dir_last_admin_meta_tab);
|
||||
ezc_functions.Insert("dir_last_admin_meta_tab_value", dir_last_admin_meta_tab_value);
|
||||
ezc_functions.Insert("dir_last_admin_meta_tab_has_next", dir_last_admin_meta_tab_has_next);
|
||||
|
||||
|
||||
/*
|
||||
doc
|
||||
*/
|
||||
ezc_functions.Insert("doc_title", doc_title);
|
||||
ezc_functions.Insert("doc_proto", doc_proto);
|
||||
ezc_functions.Insert("doc_proto_static", doc_proto_static);
|
||||
ezc_functions.Insert("doc_proto_common", doc_proto_common);
|
||||
ezc_functions.Insert("doc_base_url", doc_base_url);
|
||||
ezc_functions.Insert("doc_base_url_static", doc_base_url_static);
|
||||
ezc_functions.Insert("doc_base_url_common", doc_base_url_common);
|
||||
ezc_functions.Insert("doc_current_url", doc_current_url);
|
||||
ezc_functions.Insert("doc_css_tab", doc_css_tab);
|
||||
ezc_functions.Insert("doc_css_tab_file", doc_css_tab_file);
|
||||
ezc_functions.Insert("doc_css_tab_file_is_global", doc_css_tab_file_is_global);
|
||||
ezc_functions.Insert("doc_css_tab_has_next", doc_css_tab_has_next);
|
||||
ezc_functions.Insert("doc_css_is_empty", doc_css_is_empty);
|
||||
ezc_functions.Insert("doc_css_is_one", doc_css_is_one);
|
||||
ezc_functions.Insert("doc_css_more_than_one", doc_css_more_than_one);
|
||||
|
||||
/*
|
||||
env
|
||||
*/
|
||||
|
@ -253,26 +281,6 @@ void Templates::CreateFunctions()
|
|||
ezc_functions.Insert("fil_new_line_to_br", fil_new_line_to_br);
|
||||
|
||||
|
||||
/*
|
||||
doc
|
||||
*/
|
||||
ezc_functions.Insert("doc_title", doc_title);
|
||||
ezc_functions.Insert("doc_proto", doc_proto);
|
||||
ezc_functions.Insert("doc_proto_static", doc_proto_static);
|
||||
ezc_functions.Insert("doc_proto_common", doc_proto_common);
|
||||
ezc_functions.Insert("doc_base_url", doc_base_url);
|
||||
ezc_functions.Insert("doc_base_url_static", doc_base_url_static);
|
||||
ezc_functions.Insert("doc_base_url_common", doc_base_url_common);
|
||||
ezc_functions.Insert("doc_current_url", doc_current_url);
|
||||
ezc_functions.Insert("doc_css_tab", doc_css_tab);
|
||||
ezc_functions.Insert("doc_css_tab_file", doc_css_tab_file);
|
||||
ezc_functions.Insert("doc_css_tab_file_is_global", doc_css_tab_file_is_global);
|
||||
ezc_functions.Insert("doc_css_tab_has_next", doc_css_tab_has_next);
|
||||
ezc_functions.Insert("doc_css_is_empty", doc_css_is_empty);
|
||||
ezc_functions.Insert("doc_css_is_one", doc_css_is_one);
|
||||
ezc_functions.Insert("doc_css_more_than_one", doc_css_more_than_one);
|
||||
|
||||
|
||||
/*
|
||||
insert
|
||||
*/
|
||||
|
@ -345,6 +353,11 @@ void Templates::CreateFunctions()
|
|||
ezc_functions.Insert("item_meta_tab", item_meta_tab);
|
||||
ezc_functions.Insert("item_meta_tab_value", item_meta_tab_value);
|
||||
ezc_functions.Insert("item_meta_tab_has_next", item_meta_tab_has_next);
|
||||
ezc_functions.Insert("item_admin_meta_str", item_admin_meta_str);
|
||||
ezc_functions.Insert("item_admin_meta", item_admin_meta);
|
||||
ezc_functions.Insert("item_admin_meta_tab", item_admin_meta_tab);
|
||||
ezc_functions.Insert("item_admin_meta_tab_value", item_admin_meta_tab_value);
|
||||
ezc_functions.Insert("item_admin_meta_tab_has_next", item_admin_meta_tab_has_next);
|
||||
|
||||
ezc_functions.Insert("item_tab", item_tab);
|
||||
ezc_functions.Insert("item_tab_index", item_tab_index);
|
||||
|
|
|
@ -135,6 +135,15 @@ namespace TemplatesFunctions
|
|||
void dir_last_html_template(Info & i);
|
||||
void dir_last_has_html_template(Info & i);
|
||||
void dir_last_meta_str(Info & i);
|
||||
void dir_last_meta(Info & i);
|
||||
void dir_last_meta_tab(Info & i);
|
||||
void dir_last_meta_tab_value(Info & i);
|
||||
void dir_last_meta_tab_has_next(Info & i);
|
||||
void dir_last_admin_meta_str(Info & i);
|
||||
void dir_last_admin_meta(Info & i);
|
||||
void dir_last_admin_meta_tab(Info & i);
|
||||
void dir_last_admin_meta_tab_value(Info & i);
|
||||
void dir_last_admin_meta_tab_has_next(Info & i);
|
||||
|
||||
|
||||
/*
|
||||
|
@ -256,6 +265,11 @@ namespace TemplatesFunctions
|
|||
void item_meta_tab(Info & i);
|
||||
void item_meta_tab_value(Info & i);
|
||||
void item_meta_tab_has_next(Info & i);
|
||||
void item_admin_meta_str(Info & i);
|
||||
void item_admin_meta(Info & i);
|
||||
void item_admin_meta_tab(Info & i);
|
||||
void item_admin_meta_tab_value(Info & i);
|
||||
void item_admin_meta_tab_has_next(Info & i);
|
||||
|
||||
void item_tab(Info & i);
|
||||
void item_tab_index(Info & i);
|
||||
|
|
Loading…
Reference in New Issue