Files
winix/plugins/thread/funthread.cpp
Tomasz Sowa 3071df227a fixed: find_ticket_value (in plugins/ticket/templates.cpp)
should find the first item (can be more than one item with the same 'param')

fixed: added sorting tickets params in ReadTicketParams() (in plugins/ticket/ticketinfo.cpp)

fixed: plugin should have its own 'PluginInfo info' struct
a plugin's function can call another plugin's functions

added: removing tickets files/images

added: removing threads

changed: rm function will call WINIX_FILE_REMOVED now when deleting directories





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@710 e52654a7-88a9-db11-a3e9-0013d4bc506e
2011-01-23 23:23:24 +00:00

87 lines
1.4 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2008-2010, Tomasz Sowa
* All rights reserved.
*
*/
#include <algorithm>
#include "core/misc.h"
#include "funthread.h"
namespace Thread
{
FunThread::FunThread()
{
fun.url = L"thread";
}
void FunThread::SetTDb(TDb * ptdb)
{
tdb = ptdb;
}
void FunThread::SetThreadInfo(ThreadInfo * pthread_info)
{
thread_info = pthread_info;
}
bool FunThread::HasAccess()
{
if( !cur->request->is_item )
return false;
if( system->mounts.pmount->type != thread_info->mount_type_thread )
return false;
return true;
}
void FunThread::PrepareThread(long file_id)
{
thread_info->Clear();
cur->request->status = tdb->GetAnswers(file_id, id_tab);
if( !id_tab.empty() )
{
DbItemQuery iq;
if( system->mounts.pmount->IsArg(thread_info->mount_par_thread, L"sort_desc") )
iq.sort_asc = false;
iq.WhereIdIn(id_tab);
iq.WhereType(Item::file);
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
db->GetItems(thread_info->item_tab, iq);
system->CheckAccessToItems(thread_info->item_tab);
thread_info->item_sort_tab.resize(thread_info->item_tab.size());
// thread_info.item_tab is already sorted (by the database)
for(size_t i=0 ; i<thread_info->item_tab.size() ; ++i)
thread_info->item_sort_tab[i] = &thread_info->item_tab[i];
}
}
void FunThread::MakeGet()
{
PrepareThread(cur->request->item.id);
}
} // namespace