fixed: in winix function 'mv':
a recurrence loop - incorrect function was called (typo) updated: to the new EZC api: templates from plugin menu templates from 'man' winix function git-svn-id: svn://ttmath.org/publicrep/winix/trunk@809 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -30,7 +30,7 @@ using TemplatesFunctions::system;
|
||||
extern int mount_par_menu_skip;
|
||||
extern Cache cache;
|
||||
|
||||
|
||||
static Ezc::Stack * stack = &empty_stack;
|
||||
static DbItemQuery iq;
|
||||
static std::vector<Item> item_tab;
|
||||
static MenuItem menu_item;
|
||||
@@ -182,7 +182,7 @@ void menu_dir_init(Info & i, long dir_id, int param)
|
||||
skip_static_files(*citem);
|
||||
}
|
||||
|
||||
i.fun_data = new StackItem(citem);
|
||||
i.stack->fun_data = new StackItem(citem);
|
||||
}
|
||||
|
||||
|
||||
@@ -213,12 +213,12 @@ void menu_dir_init(Info & i)
|
||||
{
|
||||
if( i.params[0] == L"current" )
|
||||
{
|
||||
if( i.last_fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * previous_sitem = reinterpret_cast<StackItem*>(i.last_fun_data);
|
||||
StackItem * previous_sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < previous_sitem->citem->menu_items.size() )
|
||||
menu_dir_init(i, previous_sitem->citem->menu_items[i.last_iter].id, param);
|
||||
if( stack->iter < previous_sitem->citem->menu_items.size() )
|
||||
menu_dir_init(i, previous_sitem->citem->menu_items[stack->iter].id, param);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -248,37 +248,51 @@ void menu_dir_init(Info & i)
|
||||
|
||||
void menu_dir_tab(Info & i)
|
||||
{
|
||||
if( !i.fun_data )
|
||||
if( !i.stack->fun_data )
|
||||
menu_dir_init(i);
|
||||
|
||||
if( i.fun_data )
|
||||
if( i.stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
i.res = (i.iter < sitem->citem->menu_items.size());
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.stack->fun_data);
|
||||
i.res = (i.stack->iter < sitem->citem->menu_items.size());
|
||||
}
|
||||
|
||||
//
|
||||
// we have 'current' items so we should remember the stack only from [for] statements
|
||||
// this allows:
|
||||
// [for menu_dir_tab "/path"]
|
||||
// [if menu_dir_tab "current"] (here do not remember the stack)
|
||||
// [for menu_dir_tab "current"]
|
||||
// work correctly
|
||||
// [end]
|
||||
// [end]
|
||||
// [end]
|
||||
//
|
||||
if( i.is_for )
|
||||
stack = i.stack;
|
||||
}
|
||||
|
||||
|
||||
void menu_dir_tab_subject(Info & i)
|
||||
{
|
||||
if( i.fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < sitem->citem->menu_items.size() )
|
||||
i.out << sitem->citem->menu_items[i.last_iter].subject;
|
||||
if( stack->iter < sitem->citem->menu_items.size() )
|
||||
i.out << sitem->citem->menu_items[stack->iter].subject;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void menu_dir_tab_url(Info & i)
|
||||
{
|
||||
if( i.fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < sitem->citem->menu_items.size() )
|
||||
i.out << sitem->citem->menu_items[i.last_iter].url;
|
||||
if( stack->iter < sitem->citem->menu_items.size() )
|
||||
i.out << sitem->citem->menu_items[stack->iter].url;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -288,25 +302,25 @@ void menu_dir_tab_url(Info & i)
|
||||
|
||||
void menu_dir_tab_link(Info & i)
|
||||
{
|
||||
if( i.fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < sitem->citem->menu_items.size() )
|
||||
if( stack->iter < sitem->citem->menu_items.size() )
|
||||
i.out << sitem->citem->dir << '/'
|
||||
<< sitem->citem->menu_items[i.last_iter].url;
|
||||
<< sitem->citem->menu_items[stack->iter].url;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void menu_dir_tab_is_dir(Info & i)
|
||||
{
|
||||
if( i.fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < sitem->citem->menu_items.size() )
|
||||
i.res = (sitem->citem->menu_items[i.last_iter].type == Item::dir);
|
||||
if( stack->iter < sitem->citem->menu_items.size() )
|
||||
i.res = (sitem->citem->menu_items[stack->iter].type == Item::dir);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -314,12 +328,12 @@ void menu_dir_tab_is_dir(Info & i)
|
||||
|
||||
void menu_dir_tab_is_current(Info & i)
|
||||
{
|
||||
if( i.fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < sitem->citem->menu_items.size() )
|
||||
i.res = (sitem->citem->menu_items[i.last_iter].id == cur->request->last_item->id);
|
||||
if( stack->iter < sitem->citem->menu_items.size() )
|
||||
i.res = (sitem->citem->menu_items[stack->iter].id == cur->request->last_item->id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -329,12 +343,12 @@ void menu_dir_tab_is_current(Info & i)
|
||||
// returning true if the dir tab element is a first parent for current item
|
||||
void menu_dir_tab_is_first_parent_for_current_item(Info & i)
|
||||
{
|
||||
if( i.fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < sitem->citem->menu_items.size() )
|
||||
i.res = (sitem->citem->menu_items[i.last_iter].id == cur->request->last_item->parent_id);
|
||||
if( stack->iter < sitem->citem->menu_items.size() )
|
||||
i.res = (sitem->citem->menu_items[stack->iter].id == cur->request->last_item->parent_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,11 +357,11 @@ void menu_dir_tab_is_first_parent_for_current_item(Info & i)
|
||||
// (it don't have to be the first parent - it can be a descendant)
|
||||
void menu_dir_tab_is_parent_for_current_item(Info & i)
|
||||
{
|
||||
if( i.fun_data )
|
||||
if( stack->fun_data )
|
||||
{
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(i.fun_data);
|
||||
StackItem * sitem = reinterpret_cast<StackItem*>(stack->fun_data);
|
||||
|
||||
if( i.last_iter < sitem->citem->menu_items.size() )
|
||||
if( stack->iter < sitem->citem->menu_items.size() )
|
||||
{
|
||||
size_t len = cur->request->dir_tab.size(); // at least one
|
||||
|
||||
@@ -359,7 +373,7 @@ void menu_dir_tab_is_parent_for_current_item(Info & i)
|
||||
|
||||
for(size_t a=0 ; a<len ; ++a)
|
||||
{
|
||||
if( sitem->citem->menu_items[i.last_iter].id == cur->request->dir_tab[a]->id )
|
||||
if( sitem->citem->menu_items[stack->iter].id == cur->request->dir_tab[a]->id )
|
||||
{
|
||||
i.res = true;
|
||||
break;
|
||||
@@ -372,6 +386,7 @@ void menu_dir_tab_is_parent_for_current_item(Info & i)
|
||||
|
||||
|
||||
|
||||
|
||||
void AddEzcFunctions(PluginInfo & info)
|
||||
{
|
||||
using TemplatesFunctions::EzcFun;
|
||||
|
Reference in New Issue
Block a user