fixed in Item: void Item::link(Ezc::FunInfo<HtmlTextStream> & env) now returns a correct directory for the item (before the current directory was returned)

added to Item: void Item::dir_link(Ezc::FunInfo<HtmlTextStream> & env)
added to WinixModel:
  Dirs * get_dirs();
  Mounts * get_mounts();
  Users * get_users();
  Groups * get_groups();
  SLog * get_session_logger(); // not finished yet
This commit is contained in:
2021-06-16 23:42:23 +02:00
parent 53fe5c35b9
commit ab89ffe096
9 changed files with 208 additions and 16 deletions

View File

@@ -67,8 +67,9 @@ void Item::fields()
field(L"sort_index", sort_index);
field(L"content_id", L"content", item_content, morm::FT::foreign_key);
field(L"is", &Item::is);
field(L"link", &Item::link);
field(L"is", &Item::is);
field(L"dir_link", &Item::dir_link);
field(L"link", &Item::link);
// may we should add a method setTypeFromInt(int t)?
@@ -281,6 +282,21 @@ void Item::is(Ezc::FunInfo<HtmlTextStream> & env)
}
void Item::dir_link(Ezc::FunInfo<HtmlTextStream> & env)
{
Dirs * dirs = get_dirs();
std::vector<Item*> dir_tab;
if( dirs && dirs->CreateDirTab(parent_id, dir_tab) )
{
for(Item * pitem : dir_tab)
{
env.out << pitem->url << '/';
}
}
}
void Item::link(Ezc::FunInfo<HtmlTextStream> & env)
{
Config * config = get_config();
@@ -295,8 +311,15 @@ void Item::link(Ezc::FunInfo<HtmlTextStream> & env)
env.out << config->base_url;
// FIXME this prints cur->request->dir_tab but we should print the directory in which actually there is the item
print_dir(env);
if( parent_id == req->dir_tab.back()->id )
{
print_dir(env);
}
else
{
dir_link(env);
}
env.out << url;
}
}