111 lines
1.9 KiB
C++
Executable File
111 lines
1.9 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::string 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 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;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
private:
|
|
TDb * tdb;
|
|
Db * db;
|
|
System * system;
|
|
TicketParser ticket_parser;
|
|
Item item_conf;
|
|
std::string path_dir;
|
|
std::string path_file;
|
|
|
|
static bool SortTicketsFun(const Ticket & t1, const Ticket & t2);
|
|
bool GetConfContent(const std::string & path);
|
|
bool ParseTicketConf(long mount_dir_id, const std::string & path);
|
|
void ReadTicketConf(Mounts & mounts, bool skip_existing_configs);
|
|
void MarkAllConfToDelete();
|
|
void DeleteAllMarkedConf();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|