changed: now Request class is a model class - we have fields() method there to map fields for ezc templates (currently only dir_tab)
removed: [dir_tab] ezc statement
changed: Ls winix function loads its own dir_tab container (beforehand it was loaded by [dir_tab] ezc statement)
it's available by [child_dirs] name
This commit is contained in:
@@ -70,6 +70,9 @@ void Item::fields()
|
||||
field(L"is", &Item::is);
|
||||
field(L"dir_link", &Item::dir_link);
|
||||
field(L"link", &Item::link);
|
||||
field(L"is_parent_for_current_dir", &Item::is_parent_for_current_dir);
|
||||
field(L"is_current_dir", &Item::is_current_dir);
|
||||
field(L"is_root", &Item::is_root);
|
||||
|
||||
|
||||
// may we should add a method setTypeFromInt(int t)?
|
||||
@@ -325,6 +328,41 @@ void Item::link(Ezc::FunInfo<HtmlTextStream> & env)
|
||||
}
|
||||
|
||||
|
||||
void Item::is_parent_for_current_dir(Ezc::FunInfo<HtmlTextStream> & env)
|
||||
{
|
||||
Request * req = get_request();
|
||||
|
||||
if( req )
|
||||
{
|
||||
if( req->dir_tab.size() > 1 )
|
||||
{
|
||||
env.res = (id == req->dir_tab[req->dir_tab.size() - 2]->id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Item::is_current_dir(Ezc::FunInfo<HtmlTextStream> & env)
|
||||
{
|
||||
Request * req = get_request();
|
||||
|
||||
if( req )
|
||||
{
|
||||
env.res = (id == req->dir_tab.back()->id);
|
||||
}
|
||||
}
|
||||
|
||||
// rename to is_root_dir
|
||||
void Item::is_root(Ezc::FunInfo<HtmlTextStream> & env)
|
||||
{
|
||||
Request * req = get_request();
|
||||
|
||||
if( req )
|
||||
{
|
||||
// add a test whether this is a directory (not a file or a symlink)
|
||||
env.res = (parent_id == -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -190,6 +190,9 @@ public:
|
||||
void is(Ezc::FunInfo<HtmlTextStream> & env);
|
||||
void dir_link(Ezc::FunInfo<HtmlTextStream> & env);
|
||||
void link(Ezc::FunInfo<HtmlTextStream> & env);
|
||||
void is_parent_for_current_dir(Ezc::FunInfo<HtmlTextStream> & env);
|
||||
void is_current_dir(Ezc::FunInfo<HtmlTextStream> & env);
|
||||
void is_root(Ezc::FunInfo<HtmlTextStream> & env);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user