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
This commit is contained in:
@@ -76,20 +76,20 @@ return true;
|
||||
|
||||
void Rm::Prepare()
|
||||
{
|
||||
// selecting files and symlinks (without directories)
|
||||
content_dir_iq.SetAll(false, false);
|
||||
content_dir_iq.sel_parent_id = true;
|
||||
content_dir_iq.sel_type = true;
|
||||
content_dir_iq.sel_url = true;
|
||||
content_dir_iq.sel_file = true;
|
||||
content_dir_iq.WhereType(Item::dir, false);
|
||||
|
||||
static_iq.SetAll(false, false);
|
||||
static_iq.sel_parent_id = true;
|
||||
static_iq.sel_type = true;
|
||||
static_iq.sel_url = true;
|
||||
static_iq.sel_file = true;
|
||||
|
||||
static_iq.WhereType(Item::file);
|
||||
static_iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE, false);
|
||||
// selecting files, symlinks and directories
|
||||
content_dir_iq2.SetAll(false, false);
|
||||
content_dir_iq2.sel_parent_id = true;
|
||||
content_dir_iq2.sel_type = true;
|
||||
content_dir_iq2.sel_url = true;
|
||||
content_dir_iq2.sel_file = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,16 +147,31 @@ void Rm::RemoveFileOrSymlink(Item & item)
|
||||
|
||||
TemplatesFunctions::pattern_cacher.DeletePattern(item);
|
||||
plugin.Call(WINIX_FILE_REMOVED, item.id);
|
||||
|
||||
// !! nie potrzebne
|
||||
//db->EditThreadRemoveItem(item.parent_id);
|
||||
|
||||
if( item.file_type != WINIX_ITEM_FILETYPE_NONE )
|
||||
RemoveStaticFile(item);
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
|
||||
|
||||
// for other uses (plugins etc)
|
||||
void Rm::RemoveItemById(long item_id)
|
||||
{
|
||||
// selecting files, symlinks and directories
|
||||
rm_by_id_iq.SetAll(false, false);
|
||||
rm_by_id_iq.sel_parent_id = true;
|
||||
rm_by_id_iq.sel_type = true;
|
||||
rm_by_id_iq.sel_url = true;
|
||||
rm_by_id_iq.sel_file = true;
|
||||
rm_by_id_iq.WhereId(item_id);
|
||||
|
||||
if( db->GetItem(rm_by_id_item, rm_by_id_iq) == WINIX_ERR_OK )
|
||||
{
|
||||
// cur->request->status = WINIX_ERR_NO_ITEM;
|
||||
if( rm_by_id_item.type == Item::dir )
|
||||
RemoveDir(rm_by_id_item);
|
||||
else
|
||||
RemoveFileOrSymlink(rm_by_id_item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,19 +190,15 @@ void Rm::RemoveDirTree(long dir_id)
|
||||
|
||||
plugin.Call(WINIX_DIR_PREPARE_TO_REMOVE, dir_id);
|
||||
|
||||
static_iq.WhereParentId(dir_id);
|
||||
db->GetItems(static_item_tab, static_iq);
|
||||
content_dir_iq.WhereParentId(dir_id);
|
||||
db->GetItems(content_item_tab, content_dir_iq);
|
||||
|
||||
for(size_t i=0 ; i<static_item_tab.size() ; ++i)
|
||||
RemoveStaticFile(static_item_tab[i]);
|
||||
for(size_t i=0 ; i<content_item_tab.size() ; ++i)
|
||||
RemoveFileOrSymlink(content_item_tab[i]);
|
||||
|
||||
if( db->DelDirById(dir_id) == WINIX_ERR_OK )
|
||||
{
|
||||
system->dirs.DelDir(dir_id);
|
||||
|
||||
// !! nie potrzebne
|
||||
//db->RemoveThread(dir_id);
|
||||
|
||||
plugin.Call(WINIX_DIR_REMOVED, dir_id);
|
||||
}
|
||||
}
|
||||
@@ -215,6 +226,21 @@ void Rm::RemoveFile()
|
||||
|
||||
|
||||
|
||||
void Rm::RemoveDirContent(const Item & dir)
|
||||
{
|
||||
content_dir_iq2.WhereParentId(dir.id);
|
||||
db->GetItems(content_item_tab2, content_dir_iq2);
|
||||
|
||||
for(size_t i=0 ; i<content_item_tab2.size() ; ++i)
|
||||
{
|
||||
if( content_item_tab2[i].type == Item::dir )
|
||||
RemoveDir(content_item_tab2[i]);
|
||||
else
|
||||
RemoveFileOrSymlink(content_item_tab2[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Rm::RemoveDirContent()
|
||||
{
|
||||
if( !cur->request->IsParam(L"r") )
|
||||
@@ -223,16 +249,7 @@ void Rm::RemoveDirContent()
|
||||
return;
|
||||
}
|
||||
|
||||
content_dir_iq.WhereParentId(cur->request->dir_tab.back()->id);
|
||||
db->GetItems(item_tab, content_dir_iq);
|
||||
|
||||
for(size_t i=0 ; i<item_tab.size() ; ++i)
|
||||
{
|
||||
if( item_tab[i].type == Item::dir )
|
||||
RemoveDir(item_tab[i]);
|
||||
else
|
||||
RemoveFileOrSymlink(item_tab[i]);
|
||||
}
|
||||
RemoveDirContent(*cur->request->dir_tab.back());
|
||||
|
||||
if( cur->request->status == WINIX_ERR_OK )
|
||||
system->RedirectToLastDir();
|
||||
@@ -261,8 +278,8 @@ void Rm::RemoveDir()
|
||||
|
||||
void Rm::Clear()
|
||||
{
|
||||
static_item_tab.clear();
|
||||
item_tab.clear();
|
||||
content_item_tab.clear();
|
||||
content_item_tab2.clear();
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user