updated plugins/ticket templates functions

git-svn-id: svn://ttmath.org/publicrep/winix/trunk@796 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2012-01-18 17:55:28 +00:00
parent 631ca4f8a3
commit 8b64b5d372
1 changed files with 18 additions and 7 deletions

View File

@ -273,9 +273,18 @@ namespace ns_tickets_tab
struct TicketsTabValue
{
bool is_ticket; // true if there is a ticket
bool is_item; // true if there is an item (item pointer is valid)
bool is_ticket; // true if there is a ticket (ticket pointer is valid)
Item * item; // an item for that ticket (if is_item is true)
Ticket * ticket; // pointer to the ticket (if is_ticket is true)
Item * item; // an item for that ticket (if is_ticket is true)
/*
there can be two situations:
- is_item is false and is_ticket is false
- is_item is true and is_ticket is false
- is_item is true and is_ticket is true
so when is_ticket is true then is_item is true as well so you don't have to check it
*/
TicketsTabValue()
{
@ -284,6 +293,7 @@ struct TicketsTabValue
void Clear()
{
is_item = false;
is_ticket = false;
ticket = 0;
item = 0;
@ -369,14 +379,15 @@ void tickets_tab(Info & i)
if( i.res )
{
tickets_value.is_item = true;
tickets_value.item = ticket_info.item_sort_tab[item_sort_index];
long file_id = ticket_info.item_sort_tab[item_sort_index]->id;
size_t ticket_index;
long file_id = ticket_info.item_sort_tab[item_sort_index]->id;
if( find_ticket(file_id, ticket_info.ticket_tab, ticket_index) )
{
tickets_value.is_ticket = true;
tickets_value.ticket = &ticket_info.ticket_tab[ticket_index];
tickets_value.item = ticket_info.item_sort_tab[item_sort_index];
}
plugin.Call(WINIX_PL_THREAD_SET_SORTTAB_INDEX, item_sort_index);
@ -388,7 +399,7 @@ void tickets_tab_url(Info & i)
{
tickets_tab_check_reqid();
if( tickets_value.is_ticket )
if( tickets_value.is_item )
i.out << tickets_value.item->url;
}
@ -397,7 +408,7 @@ void tickets_tab_subject_empty(Info & i)
{
tickets_tab_check_reqid();
if( tickets_value.is_ticket )
if( tickets_value.is_item )
i.res = tickets_value.item->subject.empty();
}
@ -406,7 +417,7 @@ void tickets_tab_subject(Info & i)
{
tickets_tab_check_reqid();
if( tickets_value.is_ticket )
if( tickets_value.is_item )
i.out << tickets_value.item->subject;
}