plugin ticket: rewritten templates ezc functions
(now images/files are working fine) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@795 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* Copyright (c) 2010-2012, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
@@ -21,32 +21,56 @@ SessionData::SessionData()
|
||||
|
||||
SessionData::~SessionData()
|
||||
{
|
||||
RemoveFileMap(create_file_map);
|
||||
RemoveFileMap(edit_file_map);
|
||||
RemoveFiles(create_space_map);
|
||||
RemoveFiles(edit_space_map);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void SessionData::RemoveFileMap(SessionData::FileMap & file_map)
|
||||
|
||||
|
||||
void SessionData::RemoveFiles(SessionData::SpaceMap & space_map)
|
||||
{
|
||||
FileMap::iterator i;
|
||||
SpaceMap::iterator i;
|
||||
|
||||
if( fun_rm )
|
||||
{
|
||||
for(i=file_map.begin() ; i!=file_map.end() ; ++i)
|
||||
{
|
||||
for(size_t a=0 ; a<i->second.size() ; ++a)
|
||||
{
|
||||
long file_id = i->second[a];
|
||||
fun_rm->RemoveItemById(file_id);
|
||||
}
|
||||
}
|
||||
for(i=space_map.begin() ; i!=space_map.end() ; ++i)
|
||||
RemoveFiles(i->second);
|
||||
|
||||
file_map.clear();
|
||||
space_map.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void SessionData::RemoveFiles(PT::Space & space)
|
||||
{
|
||||
for(size_t i=0 ; i<space.spaces.size() ; ++i)
|
||||
{
|
||||
PT::Space & sp = *space.spaces[i];
|
||||
|
||||
if( sp.name == L"param" )
|
||||
{
|
||||
// !! wywalic to do osobnej metody
|
||||
for(size_t a=0 ; a<sp.spaces.size() ; ++a)
|
||||
{
|
||||
PT::Space & subsp = *sp.spaces[a];
|
||||
|
||||
if( subsp.name == L"file" )
|
||||
{
|
||||
std::wstring * file_id_str = subsp.GetValue(L"itemid");
|
||||
|
||||
if( file_id_str )
|
||||
{
|
||||
long file_id = Tol(*file_id_str);
|
||||
fun_rm->RemoveItemById(file_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Ticket & SessionData::GetTicket(long id, SessionData::TicketMap & ticket_map, bool * is_new)
|
||||
{
|
||||
@@ -60,9 +84,12 @@ return res.first->second;
|
||||
|
||||
|
||||
|
||||
std::vector<long> & SessionData::GetFileTab(long id, FileMap & file_map)
|
||||
PT::Space & SessionData::GetSpace(long id, SpaceMap & space_map, bool * is_new)
|
||||
{
|
||||
std::pair<FileMap::iterator, bool> res = file_map.insert( std::make_pair(id, std::vector<long>()) );
|
||||
std::pair<SpaceMap::iterator, bool> res = space_map.insert( std::make_pair(id, PT::Space()) );
|
||||
|
||||
if( is_new )
|
||||
*is_new = res.second;
|
||||
|
||||
return res.first->second;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user