128 lines
2.5 KiB
C++
Executable File
128 lines
2.5 KiB
C++
Executable File
/*
|
|
* This file is a part of Winix
|
|
* and is not publicly distributed
|
|
*
|
|
* Copyright (c) 2010, Tomasz Sowa
|
|
* All rights reserved.
|
|
*
|
|
*/
|
|
|
|
#ifndef headerfile_winix_plugins_ticket_ticketinfo
|
|
#define headerfile_winix_plugins_ticket_ticketinfo
|
|
|
|
|
|
#include <vector>
|
|
#include "ticket.h"
|
|
#include "ticketparser.h"
|
|
#include "core/item.h"
|
|
#include "core/system.h"
|
|
#include "db/db.h"
|
|
#include "tdb.h"
|
|
|
|
|
|
|
|
namespace Ticket
|
|
{
|
|
|
|
|
|
struct TicketConfWrap
|
|
{
|
|
bool to_delete;
|
|
std::wstring file_name;
|
|
TicketConf conf;
|
|
|
|
TicketConfWrap()
|
|
{
|
|
to_delete = false;
|
|
}
|
|
};
|
|
|
|
|
|
class TicketInfo
|
|
{
|
|
public:
|
|
|
|
TicketInfo();
|
|
|
|
void SetTDb(TDb * ptdb);
|
|
void SetDb(Db * pdb);
|
|
void SetSystem(System * psystem);
|
|
void SetRequest(Request * prequest);
|
|
|
|
void Clear();
|
|
void ReadTicket(long dir_id);
|
|
void SortTickets();
|
|
|
|
Item item;
|
|
bool is_ticket;
|
|
Ticket ticket;
|
|
std::vector<Ticket> ticket_tab;
|
|
|
|
// <dir_id, TicketConfWrap>
|
|
typedef std::map<long, TicketConfWrap> ConfTab;
|
|
ConfTab conf_tab;
|
|
|
|
// used by templates
|
|
// will not be null
|
|
const TicketConfWrap * cur_conf_wrap;
|
|
const TicketConf * cur_conf;
|
|
|
|
// default: "progress"
|
|
// can be set in config in option: ticket_form_progress_prefix
|
|
std::wstring progress_prefix;
|
|
|
|
int mount_type_ticket;
|
|
|
|
int mount_par_ticket;
|
|
int mount_par_ticket_conf;
|
|
|
|
int mount_par_ticket_type;
|
|
int mount_par_ticket_type_default;
|
|
int mount_par_ticket_status;
|
|
int mount_par_ticket_status_default;
|
|
int mount_par_ticket_priority;
|
|
int mount_par_ticket_priority_default;
|
|
int mount_par_ticket_category;
|
|
int mount_par_ticket_category_default;
|
|
int mount_par_ticket_expected;
|
|
int mount_par_ticket_expected_default;
|
|
|
|
int mount_par_createticket_on;
|
|
|
|
void ReadTicketConf(bool skip_existing_configs = false);
|
|
void FindCurrentConf();
|
|
bool CheckMinMaxValue(const TicketConf::TicketItem & ticket_item, Ticket::TicketParam & par);
|
|
bool CheckMinMaxValue(Ticket::TicketParam & par);
|
|
void ReadTicketParams();
|
|
|
|
private:
|
|
TDb * tdb;
|
|
Db * db;
|
|
System * system;
|
|
Request * request;
|
|
TicketParser ticket_parser;
|
|
Item item_conf;
|
|
std::wstring path_dir;
|
|
std::wstring path_file;
|
|
|
|
// for cur_conf_wrap and cur_conf
|
|
const TicketConfWrap cur_conf_wrap_empty;
|
|
const TicketConf cur_conf_empty;
|
|
|
|
|
|
static bool SortTicketsFun(const Ticket & t1, const Ticket & t2);
|
|
bool GetConfContent(const std::wstring & path);
|
|
bool ParseTicketConf(long mount_dir_id, const std::wstring & path);
|
|
void ReadTicketConf(Mounts & mounts, bool skip_existing_configs);
|
|
void MarkAllConfToDelete();
|
|
void DeleteAllMarkedConf();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|