winix/plugins/gallery/gallery.cpp

92 lines
1.2 KiB
C++
Executable File

/*
* This file is a part of Winix
* and is not publicly distributed
*
* Copyright (c) 2011, Tomasz Sowa
* All rights reserved.
*
*/
#include "gallery.h"
namespace Gallery
{
Gallery::Gallery()
{
fun.url = L"gallery";
}
void Gallery::SetGalleryInfo(GalleryInfo * pinfo)
{
gallery_info = pinfo;
}
bool Gallery::HasAccess()
{
return true;
}
void Gallery::CreatePointers()
{
gallery_info->item_sort_tab.resize(gallery_info->item_tab.size());
for(size_t i=0 ; i<gallery_info->item_tab.size() ; ++i)
gallery_info->item_sort_tab[i] = &gallery_info->item_tab[i];
}
void Gallery::SortPointers()
{
}
void Gallery::MakeGetDir()
{
iq.SetAll(false, false);
iq.sel_parent_id = true;
iq.sel_subject = true;
iq.sel_url = true;
iq.sel_type = true;
iq.sel_file = true;
iq.sel_sort_index = true;
iq.WhereParentId(cur->request->dir_tab.back()->id);
iq.WhereFileType(WINIX_ITEM_FILETYPE_IMAGE);
db->GetItems(gallery_info->item_tab, iq);
CreatePointers();
}
void Gallery::MakeGetFile()
{
gallery_info->item_sort_tab.resize(1);
gallery_info->item_sort_tab[0] = &cur->request->item;
}
void Gallery::MakeGet()
{
if( cur->request->is_item )
MakeGetFile();
else
MakeGetDir();
SortPointers();
}
} // namespace