the first part of reimplementing has been done
now we have app object and singletons are only: log logn plugin and app git-svn-id: svn://ttmath.org/publicrep/winix/trunk@628 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -8,10 +8,9 @@
|
||||
*/
|
||||
|
||||
#include "templates.h"
|
||||
#include "../core/data.h"
|
||||
#include "../core/request.h"
|
||||
#include "../core/misc.h"
|
||||
|
||||
#include "core/request.h"
|
||||
#include "core/misc.h"
|
||||
#include "functions/functions.h"
|
||||
|
||||
|
||||
namespace TemplatesFunctions
|
||||
@@ -35,7 +34,7 @@ return percent;
|
||||
|
||||
void ticket_is(Info & i)
|
||||
{
|
||||
i.res = request.is_ticket;
|
||||
i.res = request->is_ticket;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,61 +42,63 @@ void ticket_is(Info & i)
|
||||
|
||||
void ticket_can_create(Info & i)
|
||||
{
|
||||
i.res = request.CanCreateTicket(true);
|
||||
//i.res = request->CanCreateTicket(true);
|
||||
i.res = functions->fun_createticket.HasAccess();
|
||||
}
|
||||
|
||||
|
||||
void ticket_can_edit(Info & i)
|
||||
{
|
||||
i.res = request.CanEditTicket();
|
||||
//i.res = request->CanEditTicket();
|
||||
i.res = functions->fun_editticket.HasAccess();
|
||||
}
|
||||
|
||||
|
||||
void ticket_type(Info & i)
|
||||
{
|
||||
if( request.ticket.type < data.mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_type].arg[request.ticket.type]);
|
||||
if( request->ticket.type < system->mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_type].arg[request->ticket.type]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_status(Info & i)
|
||||
{
|
||||
if( request.ticket.status < data.mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_status].arg[request.ticket.status]);
|
||||
if( request->ticket.status < system->mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_status].arg[request->ticket.status]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_priority(Info & i)
|
||||
{
|
||||
if( request.ticket.priority < data.mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_priority].arg[request.ticket.priority]);
|
||||
if( request->ticket.priority < system->mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_priority].arg[request->ticket.priority]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_category(Info & i)
|
||||
{
|
||||
if( request.ticket.category < data.mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_category].arg[request.ticket.category]);
|
||||
if( request->ticket.category < system->mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_category].arg[request->ticket.category]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_expected(Info & i)
|
||||
{
|
||||
if( request.ticket.expected < data.mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_expected].arg[request.ticket.expected]);
|
||||
if( request->ticket.expected < system->mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_expected].arg[request->ticket.expected]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ticket_progress(Info & i)
|
||||
{
|
||||
i.out << request.ticket.progress;
|
||||
i.out << request->ticket.progress;
|
||||
}
|
||||
|
||||
|
||||
void ticket_progress_image_number(Info & i)
|
||||
{
|
||||
int percent = request.ticket.progress;
|
||||
int percent = request->ticket.progress;
|
||||
i.out << ticket_calc_progress_image_number(percent);
|
||||
}
|
||||
|
||||
@@ -115,15 +116,15 @@ void ticket_tab(Info & i)
|
||||
{
|
||||
ticket_tab_index = i.iter;
|
||||
|
||||
i.res = ticket_tab_index < request.ticket_tab.size();
|
||||
i.res = ticket_tab_index < request->ticket_tab.size();
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_url(Info & i)
|
||||
{
|
||||
if( ticket_tab_index < request.ticket_tab.size() )
|
||||
if( ticket_tab_index < request->ticket_tab.size() )
|
||||
{
|
||||
Item * dir = data.dirs.GetDir( request.ticket_tab[ticket_tab_index].dir_id );
|
||||
Item * dir = system->dirs.GetDir( request->ticket_tab[ticket_tab_index].dir_id );
|
||||
|
||||
if( dir )
|
||||
{
|
||||
@@ -139,9 +140,9 @@ void ticket_tab_url(Info & i)
|
||||
|
||||
void ticket_tab_subject(Info & i)
|
||||
{
|
||||
if( ticket_tab_index < request.ticket_tab.size() )
|
||||
if( ticket_tab_index < request->ticket_tab.size() )
|
||||
{
|
||||
Item * dir = data.dirs.GetDir( request.ticket_tab[ticket_tab_index].dir_id );
|
||||
Item * dir = system->dirs.GetDir( request->ticket_tab[ticket_tab_index].dir_id );
|
||||
|
||||
if( dir )
|
||||
{
|
||||
@@ -162,9 +163,9 @@ void ticket_tab_subject_empty(Info & i)
|
||||
{
|
||||
i.res = true;
|
||||
|
||||
if( ticket_tab_index < request.ticket_tab.size() )
|
||||
if( ticket_tab_index < request->ticket_tab.size() )
|
||||
{
|
||||
Item * dir = data.dirs.GetDir( request.ticket_tab[ticket_tab_index].dir_id );
|
||||
Item * dir = system->dirs.GetDir( request->ticket_tab[ticket_tab_index].dir_id );
|
||||
|
||||
if( dir )
|
||||
i.res = dir->subject.empty();
|
||||
@@ -177,13 +178,13 @@ void ticket_tab_author(Info & i)
|
||||
bool unknown = true;
|
||||
|
||||
|
||||
if( ticket_tab_index < request.ticket_tab.size() )
|
||||
if( ticket_tab_index < request->ticket_tab.size() )
|
||||
{
|
||||
Item * dir = data.dirs.GetDir( request.ticket_tab[ticket_tab_index].dir_id );
|
||||
Item * dir = system->dirs.GetDir( request->ticket_tab[ticket_tab_index].dir_id );
|
||||
|
||||
if( dir )
|
||||
{
|
||||
User * puser = data.users.GetUser(dir->user_id);
|
||||
User * puser = system->users.GetUser(dir->user_id);
|
||||
unknown = false;
|
||||
|
||||
if( puser )
|
||||
@@ -211,79 +212,79 @@ bool unknown = true;
|
||||
|
||||
void ticket_tab_type(Info & i)
|
||||
{
|
||||
if( ticket_tab_index >= request.ticket_tab.size() )
|
||||
if( ticket_tab_index >= request->ticket_tab.size() )
|
||||
return;
|
||||
|
||||
Ticket & t = request.ticket_tab[ticket_tab_index];
|
||||
Ticket & t = request->ticket_tab[ticket_tab_index];
|
||||
|
||||
if( t.type < data.mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_type].arg[t.type]);
|
||||
if( t.type < system->mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_type].arg[t.type]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_status(Info & i)
|
||||
{
|
||||
if( ticket_tab_index >= request.ticket_tab.size() )
|
||||
if( ticket_tab_index >= request->ticket_tab.size() )
|
||||
return;
|
||||
|
||||
Ticket & t = request.ticket_tab[ticket_tab_index];
|
||||
Ticket & t = request->ticket_tab[ticket_tab_index];
|
||||
|
||||
if( t.status < data.mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_status].arg[t.status]);
|
||||
if( t.status < system->mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_status].arg[t.status]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_priority(Info & i)
|
||||
{
|
||||
if( ticket_tab_index >= request.ticket_tab.size() )
|
||||
if( ticket_tab_index >= request->ticket_tab.size() )
|
||||
return;
|
||||
|
||||
Ticket & t = request.ticket_tab[ticket_tab_index];
|
||||
Ticket & t = request->ticket_tab[ticket_tab_index];
|
||||
|
||||
if( t.priority < data.mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_priority].arg[t.priority]);
|
||||
if( t.priority < system->mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_priority].arg[t.priority]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_category(Info & i)
|
||||
{
|
||||
if( ticket_tab_index >= request.ticket_tab.size() )
|
||||
if( ticket_tab_index >= request->ticket_tab.size() )
|
||||
return;
|
||||
|
||||
Ticket & t = request.ticket_tab[ticket_tab_index];
|
||||
Ticket & t = request->ticket_tab[ticket_tab_index];
|
||||
|
||||
if( t.category < data.mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_category].arg[t.category]);
|
||||
if( t.category < system->mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_category].arg[t.category]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_expected(Info & i)
|
||||
{
|
||||
if( ticket_tab_index >= request.ticket_tab.size() )
|
||||
if( ticket_tab_index >= request->ticket_tab.size() )
|
||||
return;
|
||||
|
||||
Ticket & t = request.ticket_tab[ticket_tab_index];
|
||||
Ticket & t = request->ticket_tab[ticket_tab_index];
|
||||
|
||||
if( t.expected < data.mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_expected].arg[t.expected]);
|
||||
if( t.expected < system->mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_expected].arg[t.expected]);
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_progress(Info & i)
|
||||
{
|
||||
if( ticket_tab_index >= request.ticket_tab.size() )
|
||||
if( ticket_tab_index >= request->ticket_tab.size() )
|
||||
return;
|
||||
|
||||
i.out << request.ticket_tab[ticket_tab_index].progress;
|
||||
i.out << request->ticket_tab[ticket_tab_index].progress;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_progress_image_number(Info & i)
|
||||
{
|
||||
if( ticket_tab_index >= request.ticket_tab.size() )
|
||||
if( ticket_tab_index >= request->ticket_tab.size() )
|
||||
return;
|
||||
|
||||
int percent = request.ticket_tab[ticket_tab_index].progress;
|
||||
int percent = request->ticket_tab[ticket_tab_index].progress;
|
||||
i.out << ticket_calc_progress_image_number(percent);
|
||||
}
|
||||
|
||||
@@ -298,25 +299,25 @@ void ticket_type_tab(Info & i)
|
||||
{
|
||||
ticket_type_tab_ind = i.iter;
|
||||
|
||||
i.res = ticket_type_tab_ind < data.mounts.pmount->param[Mount::par_ticket_type].arg.size();
|
||||
i.res = ticket_type_tab_ind < system->mounts.pmount->param[Mount::par_ticket_type].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void ticket_type_tab_defined(Info & i)
|
||||
{
|
||||
i.res = data.mounts.pmount->param[Mount::par_ticket_type].defined;
|
||||
i.res = system->mounts.pmount->param[Mount::par_ticket_type].defined;
|
||||
}
|
||||
|
||||
|
||||
void ticket_type_tab_isdefault(Info & i)
|
||||
{
|
||||
if( request.is_ticket )
|
||||
if( request->is_ticket )
|
||||
{
|
||||
i.res = (ticket_type_tab_ind == request.ticket.type);
|
||||
i.res = (ticket_type_tab_ind == request->ticket.type);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mount::ParamRow & p = data.mounts.pmount->param[Mount::par_ticket_type_default];
|
||||
Mount::ParamRow & p = system->mounts.pmount->param[Mount::par_ticket_type_default];
|
||||
|
||||
if( !p.defined || p.arg.empty() )
|
||||
return; // default false
|
||||
@@ -335,8 +336,8 @@ void ticket_type_tab_index(Info & i)
|
||||
|
||||
void ticket_type_tab_name(Info & i)
|
||||
{
|
||||
if( ticket_type_tab_ind < data.mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_type].arg[ticket_type_tab_ind]);
|
||||
if( ticket_type_tab_ind < system->mounts.pmount->param[Mount::par_ticket_type].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_type].arg[ticket_type_tab_ind]);
|
||||
}
|
||||
|
||||
|
||||
@@ -350,25 +351,25 @@ void ticket_status_tab(Info & i)
|
||||
{
|
||||
ticket_status_tab_ind = i.iter;
|
||||
|
||||
i.res = ticket_status_tab_ind < data.mounts.pmount->param[Mount::par_ticket_status].arg.size();
|
||||
i.res = ticket_status_tab_ind < system->mounts.pmount->param[Mount::par_ticket_status].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void ticket_status_tab_defined(Info & i)
|
||||
{
|
||||
i.res = data.mounts.pmount->param[Mount::par_ticket_status].defined;
|
||||
i.res = system->mounts.pmount->param[Mount::par_ticket_status].defined;
|
||||
}
|
||||
|
||||
|
||||
void ticket_status_tab_isdefault(Info & i)
|
||||
{
|
||||
if( request.is_ticket )
|
||||
if( request->is_ticket )
|
||||
{
|
||||
i.res = (ticket_status_tab_ind == request.ticket.status);
|
||||
i.res = (ticket_status_tab_ind == request->ticket.status);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mount::ParamRow & p = data.mounts.pmount->param[Mount::par_ticket_status_default];
|
||||
Mount::ParamRow & p = system->mounts.pmount->param[Mount::par_ticket_status_default];
|
||||
|
||||
if( !p.defined || p.arg.empty() )
|
||||
return; // default false
|
||||
@@ -387,8 +388,8 @@ void ticket_status_tab_index(Info & i)
|
||||
|
||||
void ticket_status_tab_name(Info & i)
|
||||
{
|
||||
if( ticket_status_tab_ind < data.mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_status].arg[ticket_status_tab_ind]);
|
||||
if( ticket_status_tab_ind < system->mounts.pmount->param[Mount::par_ticket_status].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_status].arg[ticket_status_tab_ind]);
|
||||
}
|
||||
|
||||
|
||||
@@ -401,25 +402,25 @@ void ticket_priority_tab(Info & i)
|
||||
{
|
||||
ticket_priority_tab_ind = i.iter;
|
||||
|
||||
i.res = ticket_priority_tab_ind < data.mounts.pmount->param[Mount::par_ticket_priority].arg.size();
|
||||
i.res = ticket_priority_tab_ind < system->mounts.pmount->param[Mount::par_ticket_priority].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void ticket_priority_tab_defined(Info & i)
|
||||
{
|
||||
i.res = data.mounts.pmount->param[Mount::par_ticket_priority].defined;
|
||||
i.res = system->mounts.pmount->param[Mount::par_ticket_priority].defined;
|
||||
}
|
||||
|
||||
|
||||
void ticket_priority_tab_isdefault(Info & i)
|
||||
{
|
||||
if( request.is_ticket )
|
||||
if( request->is_ticket )
|
||||
{
|
||||
i.res = (ticket_priority_tab_ind == request.ticket.priority);
|
||||
i.res = (ticket_priority_tab_ind == request->ticket.priority);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mount::ParamRow & p = data.mounts.pmount->param[Mount::par_ticket_priority_default];
|
||||
Mount::ParamRow & p = system->mounts.pmount->param[Mount::par_ticket_priority_default];
|
||||
|
||||
if( !p.defined || p.arg.empty() )
|
||||
return; // default false
|
||||
@@ -438,8 +439,8 @@ void ticket_priority_tab_index(Info & i)
|
||||
|
||||
void ticket_priority_tab_name(Info & i)
|
||||
{
|
||||
if( ticket_priority_tab_ind < data.mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_priority].arg[ticket_priority_tab_ind]);
|
||||
if( ticket_priority_tab_ind < system->mounts.pmount->param[Mount::par_ticket_priority].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_priority].arg[ticket_priority_tab_ind]);
|
||||
}
|
||||
|
||||
|
||||
@@ -452,25 +453,25 @@ void ticket_category_tab(Info & i)
|
||||
{
|
||||
ticket_category_tab_ind = i.iter;
|
||||
|
||||
i.res = ticket_category_tab_ind < data.mounts.pmount->param[Mount::par_ticket_category].arg.size();
|
||||
i.res = ticket_category_tab_ind < system->mounts.pmount->param[Mount::par_ticket_category].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void ticket_category_tab_defined(Info & i)
|
||||
{
|
||||
i.res = data.mounts.pmount->param[Mount::par_ticket_category].defined;
|
||||
i.res = system->mounts.pmount->param[Mount::par_ticket_category].defined;
|
||||
}
|
||||
|
||||
|
||||
void ticket_category_tab_isdefault(Info & i)
|
||||
{
|
||||
if( request.is_ticket )
|
||||
if( request->is_ticket )
|
||||
{
|
||||
i.res = (ticket_category_tab_ind == request.ticket.category);
|
||||
i.res = (ticket_category_tab_ind == request->ticket.category);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mount::ParamRow & p = data.mounts.pmount->param[Mount::par_ticket_category_default];
|
||||
Mount::ParamRow & p = system->mounts.pmount->param[Mount::par_ticket_category_default];
|
||||
|
||||
if( !p.defined || p.arg.empty() )
|
||||
return; // default false
|
||||
@@ -489,8 +490,8 @@ void ticket_category_tab_index(Info & i)
|
||||
|
||||
void ticket_category_tab_name(Info & i)
|
||||
{
|
||||
if( ticket_category_tab_ind < data.mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_category].arg[ticket_category_tab_ind]);
|
||||
if( ticket_category_tab_ind < system->mounts.pmount->param[Mount::par_ticket_category].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_category].arg[ticket_category_tab_ind]);
|
||||
}
|
||||
|
||||
|
||||
@@ -504,25 +505,25 @@ void ticket_expected_tab(Info & i)
|
||||
{
|
||||
ticket_expected_tab_ind = i.iter;
|
||||
|
||||
i.res = ticket_expected_tab_ind < data.mounts.pmount->param[Mount::par_ticket_expected].arg.size();
|
||||
i.res = ticket_expected_tab_ind < system->mounts.pmount->param[Mount::par_ticket_expected].arg.size();
|
||||
}
|
||||
|
||||
|
||||
void ticket_expected_tab_defined(Info & i)
|
||||
{
|
||||
i.res = data.mounts.pmount->param[Mount::par_ticket_expected].defined;
|
||||
i.res = system->mounts.pmount->param[Mount::par_ticket_expected].defined;
|
||||
}
|
||||
|
||||
|
||||
void ticket_expected_tab_isdefault(Info & i)
|
||||
{
|
||||
if( request.is_ticket )
|
||||
if( request->is_ticket )
|
||||
{
|
||||
i.res = (ticket_expected_tab_ind == request.ticket.expected);
|
||||
i.res = (ticket_expected_tab_ind == request->ticket.expected);
|
||||
}
|
||||
else
|
||||
{
|
||||
Mount::ParamRow & p = data.mounts.pmount->param[Mount::par_ticket_expected_default];
|
||||
Mount::ParamRow & p = system->mounts.pmount->param[Mount::par_ticket_expected_default];
|
||||
|
||||
if( !p.defined || p.arg.empty() )
|
||||
return; // default false
|
||||
@@ -541,8 +542,8 @@ void ticket_expected_tab_index(Info & i)
|
||||
|
||||
void ticket_expected_tab_name(Info & i)
|
||||
{
|
||||
if( ticket_expected_tab_ind < data.mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
HtmlEscape(i.out, data.mounts.pmount->param[Mount::par_ticket_expected].arg[ticket_expected_tab_ind]);
|
||||
if( ticket_expected_tab_ind < system->mounts.pmount->param[Mount::par_ticket_expected].arg.size() )
|
||||
HtmlEscape(i.out, system->mounts.pmount->param[Mount::par_ticket_expected].arg[ticket_expected_tab_ind]);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user