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:
Tomasz Sowa 2012-02-27 17:43:59 +00:00
parent a45fb30e0a
commit 9208b15167
8 changed files with 173 additions and 205 deletions

View File

@ -366,6 +366,9 @@ return 0;
Item * Dirs::GetDir(const std::wstring & path)
{
if( path.empty() )
return 0;
DirContainer::Iterator root = dir_tab.GetRoot();
if( root == dir_tab.End() )

View File

@ -264,7 +264,7 @@ void Mv::MoveFilesPrepareTreeGo(const Item & src_dir)
// go through all directories
for( ; i != system->dirs.ParentEnd() ; i = system->dirs.NextChild(i) )
MoveFilesPrepareTree(*(i->second));
MoveFilesPrepareTreeGo(*(i->second));
files_iq.WhereParentId(src_dir.id);
db->GetItems(files_item_tab, files_iq);
@ -282,7 +282,7 @@ void Mv::MoveFilesPrepareTree(const Item & src_dir)
// we can immediately return and the database will not be bothered
if( plugin.HasMessage(WINIX_FILE_PREPARE_TO_MOVE) )
{
MoveFilesPrepareTree(src_dir);
MoveFilesPrepareTreeGo(src_dir);
}
}

View File

@ -1,126 +1,69 @@
# DO NOT DELETE
Kopia templates.o: ../../templates/templates.h ../../../ezc/src/ezc.h
Kopia templates.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h
Kopia templates.o: ../../../ezc/src/item.h ../../../ezc/src/funinfo.h
Kopia templates.o: ../../../ezc/src/functions.h ../../../ezc/src/stringconv.h
Kopia templates.o: ../../templates/misc.h ../../templates/localefilter.h
Kopia templates.o: ../../templates/locale.h ../../templates/htmltextstream.h
Kopia templates.o: ../../core/textstream.h ../../templates/patterncacher.h
Kopia templates.o: ../../core/item.h ../../templates/indexpatterns.h
Kopia templates.o: ../../templates/patterns.h
Kopia templates.o: ../../templates/changepatterns.h ../../core/config.h
Kopia templates.o: ../../core/htmlfilter.h ../../core/cur.h
Kopia templates.o: ../../core/request.h ../../core/requesttypes.h
Kopia templates.o: ../../core/error.h ../../core/config.h
Kopia templates.o: ../../core/textstream.h ../../templates/htmltextstream.h
Kopia templates.o: ../../core/session.h ../../core/user.h
Kopia templates.o: ../../core/plugindata.h ../../core/rebus.h
Kopia templates.o: ../../core/mount.h ../../core/system.h ../../core/dirs.h
Kopia templates.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
Kopia templates.o: ../../db/dbconn.h ../../db/dbtextstream.h
Kopia templates.o: ../../core/error.h ../../db/dbitemquery.h
Kopia templates.o: ../../db/dbitemcolumns.h ../../core/user.h
Kopia templates.o: ../../core/group.h ../../core/dircontainer.h
Kopia templates.o: ../../core/ugcontainer.h ../../core/log.h
Kopia templates.o: ../../core/logmanipulators.h ../../core/slog.h
Kopia templates.o: ../../core/cur.h ../../templates/locale.h
Kopia templates.o: ../../notify/notify.h ../../notify/notifypool.h
Kopia templates.o: ../../templates/patterns.h ../../notify/notifythread.h
Kopia templates.o: ../../core/basethread.h ../../core/synchro.h
Kopia templates.o: ../../notify/templatesnotify.h ../../core/users.h
Kopia templates.o: ../../core/ugcontainer.h ../../core/lastcontainer.h
Kopia templates.o: ../../templates/misc.h ../../core/mounts.h
Kopia templates.o: ../../core/mountparser.h ../../core/crypt.h
Kopia templates.o: ../../core/run.h ../../core/users.h ../../core/groups.h
Kopia templates.o: ../../core/group.h ../../core/loadavg.h ../../core/image.h
Kopia templates.o: ../../core/basethread.h ../../core/threadmanager.h
Kopia templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
Kopia templates.o: ../../core/system.h ../../core/htmlfilter.h
Kopia templates.o: ../../core/plugin.h ../../core/pluginmsg.h
Kopia templates.o: ../../core/sessionmanager.h ../../functions/functions.h
Kopia templates.o: ../../functions/functionbase.h ../../core/request.h
Kopia templates.o: ../../core/synchro.h ../../functions/functionparser.h
Kopia templates.o: ../../functions/adduser.h ../../functions/cat.h
Kopia templates.o: ../../functions/chmod.h ../../functions/privchanger.h
Kopia templates.o: ../../functions/chown.h ../../functions/ckeditor.h
Kopia templates.o: ../../functions/cp.h ../../functions/default.h
Kopia templates.o: ../../functions/download.h ../../functions/emacs.h
Kopia templates.o: ../../functions/env.h ../../functions/last.h
Kopia templates.o: ../../functions/login.h ../../functions/logout.h
Kopia templates.o: ../../functions/ln.h ../../functions/ls.h
Kopia templates.o: ../../functions/man.h ../../functions/meta.h
Kopia templates.o: ../../functions/mkdir.h ../../functions/mv.h
Kopia templates.o: ../../functions/nicedit.h ../../functions/node.h
Kopia templates.o: ../../functions/passwd.h ../../functions/priv.h
Kopia templates.o: ../../functions/reload.h ../../functions/rm.h
Kopia templates.o: ../../functions/sort.h ../../functions/specialdefault.h
Kopia templates.o: ../../functions/stat.h ../../functions/subject.h
Kopia templates.o: ../../functions/template.h ../../functions/tinymce.h
Kopia templates.o: ../../functions/uname.h ../../functions/upload.h
Kopia templates.o: ../../functions/uptime.h ../../functions/who.h
Kopia templates.o: ../../functions/vim.h ../../core/log.h ../../core/misc.h
cache.o: cache.h ../../core/item.h ../../core/dirs.h ../../../ezc/src/item.h
cache.o: ../../../ezc/src/funinfo.h ../../core/dircontainer.h ../../db/db.h
cache.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h
cache.o: ../../core/textstream.h ../../templates/misc.h
cache.o: ../../templates/localefilter.h ../../templates/locale.h
cache.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h
cache.o: ../../../ezc/src/pattern.h ../../../ezc/src/functions.h
cache.o: ../../../ezc/src/stringconv.h ../../templates/htmltextstream.h
cache.o: ../../core/error.h ../../db/dbitemquery.h ../../db/dbitemcolumns.h
cache.o: ../../core/user.h ../../core/group.h ../../core/dircontainer.h
cache.o: cache.h ../../core/item.h ../../core/dirs.h ../../core/item.h
cache.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
cache.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/textstream.h
cache.o: ../../core/misc.h ../../core/requesttypes.h ../../core/error.h
cache.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h ../../core/user.h
cache.o: ../../core/group.h ../../core/dircontainer.h
cache.o: ../../core/ugcontainer.h ../../core/log.h ../../core/textstream.h
cache.o: ../../core/logmanipulators.h ../../core/slog.h ../../core/cur.h
cache.o: ../../templates/locale.h ../../core/request.h
cache.o: ../../core/requesttypes.h ../../core/error.h ../../core/config.h
cache.o: ../../templates/htmltextstream.h ../../notify/notify.h
cache.o: ../../notify/notifypool.h ../../templates/patterns.h
cache.o: ../../notify/notifythread.h ../../core/basethread.h
cache.o: ../../core/synchro.h ../../notify/templatesnotify.h
cache.o: ../../core/config.h ../../core/htmlfilter.h ../../core/users.h
cache.o: ../../core/user.h ../../core/ugcontainer.h
cache.o: ../../core/lastcontainer.h ../../templates/misc.h ../../core/misc.h
init.o: ../../core/log.h ../../core/plugin.h ../../core/pluginmsg.h
cache.o: ../../core/request.h ../../core/error.h ../../core/config.h
cache.o: ../../core/htmlfilter.h ../../templates/htmltextstream.h
cache.o: ../../core/session.h ../../core/user.h ../../core/plugindata.h
cache.o: ../../core/rebus.h ../../core/mount.h ../../templates/locale.h
cache.o: ../../notify/notify.h ../../notify/notifypool.h
cache.o: ../../templates/patterns.h ../../templates/locale.h
cache.o: ../../templates/localefilter.h ../../../ezc/src/ezc.h
cache.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h
cache.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h
cache.o: ../../../ezc/src/stringconv.h ../../notify/notifythread.h
cache.o: ../../core/basethread.h ../../core/synchro.h
cache.o: ../../notify/templatesnotify.h ../../core/config.h
cache.o: ../../core/users.h ../../core/ugcontainer.h
cache.o: ../../core/lastcontainer.h ../../templates/misc.h
cache.o: ../../templates/htmltextstream.h ../../core/misc.h
init.o: ../../core/log.h ../../core/textstream.h ../../core/logmanipulators.h
init.o: ../../core/slog.h ../../core/cur.h ../../templates/locale.h
init.o: ../../core/plugindata.h ../../core/config.h ../../core/request.h
init.o: ../../core/requesttypes.h ../../../ezc/src/item.h
init.o: ../../../ezc/src/funinfo.h ../../core/error.h
init.o: ../../templates/htmltextstream.h ../../core/system.h
init.o: ../../core/sessionmanager.h ../../core/synchro.h
init.o: ../../functions/functions.h ../../functions/functionbase.h
init.o: ../../core/item.h ../../db/db.h ../../db/dbbase.h ../../db/dbconn.h
init.o: ../../db/dbtextstream.h ../../core/textstream.h
init.o: ../../templates/misc.h ../../templates/localefilter.h
init.o: ../../templates/locale.h ../../../ezc/src/ezc.h
init.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h
init.o: ../../../ezc/src/functions.h ../../../ezc/src/stringconv.h
init.o: ../../templates/htmltextstream.h ../../core/error.h
init.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h ../../core/user.h
init.o: ../../core/group.h ../../core/dircontainer.h ../../core/ugcontainer.h
init.o: ../../core/request.h ../../core/config.h ../../core/htmlfilter.h
init.o: ../../core/system.h ../../core/dirs.h ../../core/dircontainer.h
init.o: ../../notify/notify.h ../../notify/notifypool.h
init.o: ../../templates/patterns.h ../../notify/notifythread.h
init.o: ../../core/basethread.h ../../notify/templatesnotify.h
init.o: ../../core/users.h ../../core/user.h ../../core/ugcontainer.h
init.o: ../../core/lastcontainer.h ../../templates/misc.h ../../core/mounts.h
init.o: ../../core/mount.h ../../core/mountparser.h ../../core/crypt.h
init.o: ../../core/run.h ../../core/users.h ../../core/groups.h
init.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
init.o: ../../core/image.h ../../core/basethread.h ../../core/threadmanager.h
init.o: ../../core/synchro.h ../../functions/functionparser.h
init.o: ../../core/cur.h ../../core/session.h ../../functions/adduser.h
init.o: ../../functions/cat.h ../../functions/chmod.h
init.o: ../../functions/privchanger.h ../../functions/chown.h
init.o: ../../functions/ckeditor.h ../../functions/cp.h
init.o: ../../functions/default.h ../../functions/download.h
init.o: ../../functions/emacs.h ../../functions/env.h ../../functions/last.h
init.o: ../../functions/login.h ../../functions/logout.h ../../functions/ln.h
init.o: ../../functions/ls.h ../../functions/man.h ../../functions/meta.h
init.o: ../../functions/mkdir.h ../../functions/mv.h
init.o: ../../functions/nicedit.h ../../functions/node.h
init.o: ../../core/slog.h ../../core/cur.h ../../core/request.h
init.o: ../../core/requesttypes.h ../../core/item.h ../../core/error.h
init.o: ../../core/config.h ../../core/htmlfilter.h
init.o: ../../templates/htmltextstream.h ../../core/textstream.h
init.o: ../../core/misc.h ../../core/session.h ../../core/user.h
init.o: ../../core/plugindata.h ../../core/rebus.h ../../core/mount.h
init.o: ../../templates/locale.h ../../core/plugin.h ../../core/pluginmsg.h
init.o: ../../core/log.h ../../core/system.h ../../core/dirs.h
init.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
init.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h
init.o: ../../db/dbitemquery.h ../../core/item.h ../../db/dbitemcolumns.h
init.o: ../../core/user.h ../../core/group.h ../../core/dircontainer.h
init.o: ../../core/ugcontainer.h ../../notify/notify.h
init.o: ../../notify/notifypool.h ../../templates/patterns.h
init.o: ../../templates/locale.h ../../templates/localefilter.h
init.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h
init.o: ../../../ezc/src/pattern.h ../../../ezc/src/functions.h
init.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h
init.o: ../../notify/notifythread.h ../../core/basethread.h
init.o: ../../core/synchro.h ../../notify/templatesnotify.h
init.o: ../../core/config.h ../../core/users.h ../../core/ugcontainer.h
init.o: ../../core/lastcontainer.h ../../templates/misc.h
init.o: ../../templates/htmltextstream.h ../../core/mounts.h
init.o: ../../core/mountparser.h ../../core/crypt.h ../../core/run.h
init.o: ../../core/users.h ../../core/groups.h ../../core/group.h
init.o: ../../core/loadavg.h ../../core/image.h ../../core/basethread.h
init.o: ../../core/threadmanager.h ../../core/sessionmanager.h
init.o: ../../core/sessioncontainer.h ../../functions/functions.h
init.o: ../../functions/functionbase.h ../../core/request.h
init.o: ../../core/system.h ../../core/synchro.h
init.o: ../../functions/functionparser.h ../../core/cur.h
init.o: ../../functions/adduser.h ../../functions/cat.h
init.o: ../../functions/chmod.h ../../functions/privchanger.h
init.o: ../../functions/chown.h ../../functions/ckeditor.h
init.o: ../../functions/cp.h ../../functions/default.h
init.o: ../../functions/download.h ../../functions/emacs.h
init.o: ../../functions/env.h ../../functions/last.h ../../functions/login.h
init.o: ../../functions/logout.h ../../functions/ln.h ../../functions/ls.h
init.o: ../../functions/man.h ../../functions/meta.h ../../functions/mkdir.h
init.o: ../../functions/mv.h ../../functions/nicedit.h ../../functions/node.h
init.o: ../../functions/passwd.h ../../functions/priv.h
init.o: ../../functions/reload.h ../../functions/rm.h ../../functions/sort.h
init.o: ../../functions/specialdefault.h ../../functions/stat.h
@ -130,53 +73,53 @@ init.o: ../../functions/upload.h ../../functions/uptime.h
init.o: ../../functions/who.h ../../functions/vim.h ../../core/htmlfilter.h
init.o: ../../templates/templates.h ../../templates/patterncacher.h
init.o: ../../templates/indexpatterns.h ../../templates/patterns.h
init.o: ../../templates/changepatterns.h ../../core/sessionmanager.h
init.o: ../../core/sessioncontainer.h cache.h ../../core/dirs.h
init.o: ../../templates/changepatterns.h ../../core/sessionmanager.h cache.h
init.o: ../../core/dirs.h
templates.o: ../../templates/templates.h ../../../ezc/src/ezc.h
templates.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h
templates.o: ../../../ezc/src/item.h ../../../ezc/src/funinfo.h
templates.o: ../../../ezc/src/functions.h ../../../ezc/src/stringconv.h
templates.o: ../../templates/misc.h ../../templates/localefilter.h
templates.o: ../../templates/locale.h ../../templates/htmltextstream.h
templates.o: ../../core/textstream.h ../../templates/patterncacher.h
templates.o: ../../core/item.h ../../templates/indexpatterns.h
templates.o: ../../templates/patterns.h ../../templates/changepatterns.h
templates.o: ../../core/config.h ../../core/htmlfilter.h ../../core/cur.h
templates.o: ../../core/request.h ../../core/requesttypes.h
templates.o: ../../core/error.h ../../core/config.h ../../core/textstream.h
templates.o: ../../templates/htmltextstream.h ../../core/session.h
templates.o: ../../core/user.h ../../core/plugindata.h ../../core/rebus.h
templates.o: ../../core/mount.h ../../core/system.h ../../core/dirs.h
templates.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
templates.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h
templates.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h
templates.o: ../../core/user.h ../../core/group.h ../../core/dircontainer.h
templates.o: ../../core/ugcontainer.h ../../core/log.h
templates.o: ../../core/item.h ../../../ezc/src/functions.h
templates.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h
templates.o: ../../core/misc.h ../../core/requesttypes.h
templates.o: ../../templates/patterncacher.h ../../core/item.h
templates.o: ../../templates/indexpatterns.h ../../templates/patterns.h
templates.o: ../../templates/locale.h ../../templates/changepatterns.h
templates.o: ../../templates/htmltextstream.h ../../templates/localefilter.h
templates.o: ../../core/config.h ../../core/cur.h ../../core/system.h
templates.o: ../../core/sessionmanager.h ../../core/htmlfilter.h
templates.o: ../../db/db.h ../../db/dbbase.h ../../db/dbconn.h
templates.o: ../../db/dbtextstream.h ../../core/textstream.h
templates.o: ../../core/error.h ../../db/dbitemquery.h
templates.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h
templates.o: ../../core/dircontainer.h ../../core/ugcontainer.h
templates.o: ../../core/log.h ../../core/textstream.h
templates.o: ../../core/logmanipulators.h ../../core/slog.h ../../core/cur.h
templates.o: ../../templates/locale.h ../../notify/notify.h
templates.o: ../../notify/notifypool.h ../../templates/patterns.h
templates.o: ../../notify/notifythread.h ../../core/basethread.h
templates.o: ../../core/synchro.h ../../notify/templatesnotify.h
templates.o: ../../core/users.h ../../core/ugcontainer.h
templates.o: ../../core/lastcontainer.h ../../templates/misc.h
templates.o: ../../core/mounts.h ../../core/mountparser.h ../../core/crypt.h
templates.o: ../../core/run.h ../../core/users.h ../../core/groups.h
templates.o: ../../core/group.h ../../core/loadavg.h ../../core/image.h
templates.o: ../../core/basethread.h ../../core/threadmanager.h
templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
templates.o: ../../core/system.h ../../core/htmlfilter.h ../../core/plugin.h
templates.o: ../../core/pluginmsg.h ../../core/sessionmanager.h
templates.o: ../../functions/functions.h ../../functions/functionbase.h
templates.o: ../../core/request.h ../../core/synchro.h
templates.o: ../../functions/functionparser.h ../../functions/adduser.h
templates.o: ../../functions/cat.h ../../functions/chmod.h
templates.o: ../../functions/privchanger.h ../../functions/chown.h
templates.o: ../../functions/ckeditor.h ../../functions/cp.h
templates.o: ../../functions/default.h ../../functions/download.h
templates.o: ../../functions/emacs.h ../../functions/env.h
templates.o: ../../functions/last.h ../../functions/login.h
templates.o: ../../functions/logout.h ../../functions/ln.h
templates.o: ../../functions/ls.h ../../functions/man.h
templates.o: ../../core/request.h ../../core/error.h ../../core/config.h
templates.o: ../../core/htmlfilter.h ../../templates/htmltextstream.h
templates.o: ../../core/session.h ../../core/user.h ../../core/plugindata.h
templates.o: ../../core/rebus.h ../../core/mount.h ../../templates/locale.h
templates.o: ../../core/plugin.h ../../core/pluginmsg.h ../../core/system.h
templates.o: ../../core/dirs.h ../../core/dircontainer.h
templates.o: ../../notify/notify.h ../../notify/notifypool.h
templates.o: ../../templates/patterns.h ../../notify/notifythread.h
templates.o: ../../core/basethread.h ../../core/synchro.h
templates.o: ../../notify/templatesnotify.h ../../core/users.h
templates.o: ../../core/ugcontainer.h ../../core/lastcontainer.h
templates.o: ../../templates/misc.h ../../core/mounts.h
templates.o: ../../core/mountparser.h ../../core/crypt.h ../../core/run.h
templates.o: ../../core/users.h ../../core/groups.h ../../core/group.h
templates.o: ../../core/loadavg.h ../../core/image.h ../../core/basethread.h
templates.o: ../../core/threadmanager.h ../../core/sessionmanager.h
templates.o: ../../core/sessioncontainer.h ../../functions/functions.h
templates.o: ../../functions/functionbase.h ../../core/request.h
templates.o: ../../core/synchro.h ../../functions/functionparser.h
templates.o: ../../functions/adduser.h ../../functions/cat.h
templates.o: ../../functions/chmod.h ../../functions/privchanger.h
templates.o: ../../functions/chown.h ../../functions/ckeditor.h
templates.o: ../../functions/cp.h ../../functions/default.h
templates.o: ../../functions/download.h ../../functions/emacs.h
templates.o: ../../functions/env.h ../../functions/last.h
templates.o: ../../functions/login.h ../../functions/logout.h
templates.o: ../../functions/ln.h ../../functions/ls.h ../../functions/man.h
templates.o: ../../functions/meta.h ../../functions/mkdir.h
templates.o: ../../functions/mv.h ../../functions/nicedit.h
templates.o: ../../functions/node.h ../../functions/passwd.h

View File

@ -1 +1 @@
o = Kopia templates.o cache.o init.o templates.o
o = cache.o init.o templates.o

View File

@ -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;

View File

@ -18,6 +18,7 @@ namespace TemplatesFunctions
static Functions::Iterator winixfun_iter;
static size_t winixfun_curreq = 0;
static Ezc::Stack * winixstack = &empty_stack;
@ -36,6 +37,7 @@ return winixfun_iter != functions->End();
void man_winixfun_tab(Info & i)
{
man_winixfun_tabcheck();
winixstack = i.stack;
if( i.iter == 0 )
winixfun_iter = functions->Begin();
@ -49,7 +51,7 @@ void man_winixfun_tab(Info & i)
void man_winixfun_tab_index(Info & i)
{
i.out << (i.last_iter+1);
i.out << (winixstack->iter + 1);
}
@ -65,6 +67,7 @@ void man_winixfun_tab_name(Info & i)
static EzcFun::Iterator ezcfun_iter;
static size_t ezcfun_curreq = 0;
static Ezc::Stack * ezcstack = &empty_stack;
bool man_ezcfun_tabcheck()
@ -82,6 +85,7 @@ return ezcfun_iter != ezc_functions.End();
void man_ezcfun_tab(Info & i)
{
man_ezcfun_tabcheck();
ezcstack = i.stack;
if( i.iter == 0 )
ezcfun_iter = ezc_functions.Begin();
@ -95,7 +99,7 @@ void man_ezcfun_tab(Info & i)
void man_ezcfun_tab_index(Info & i)
{
i.out << (i.last_iter+1);
i.out << (ezcstack->iter + 1);
}

View File

@ -42,6 +42,8 @@ std::vector<std::wstring> empty_pars;
const std::wstring empty_string;
const HtmlTextStream empty_stream;
// en empty stack item for templates functions
Ezc::Stack empty_stack;
Db * db;
Cur * cur;

View File

@ -50,6 +50,7 @@ namespace TemplatesFunctions
extern EzcFun ezc_functions;
extern LocaleFilter locale_filter;
extern HTMLFilter html_filter;
extern Ezc::Stack empty_stack;
extern Db * db;
extern Cur * cur;