we can create links (hard links, symbolic links) now
added winix functions: ln winix function 'default' can be used without redirecting now added new tickets types: TypeProgress, TypeString, TypeMultistring, TypeImages, TypeFiles now tickets are combined with files added winix functions: showtickets fixed mountpoints: when the default root mount was created its parameter table was empty and it caused accessing to a non-existing objects fixed logger: modifiers (log1, log2, log3) were incorrectly treated added modifier: log4 (debug info) now we are moving threads to a new plugin 'thread' created directory: plugins/thread (not finished yet) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@704 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -40,17 +40,18 @@ createticket.o: ../../functions/ckeditor.h ../../functions/cp.h
|
||||
createticket.o: ../../functions/createthread.h ../../functions/default.h
|
||||
createticket.o: ../../functions/download.h ../../functions/emacs.h
|
||||
createticket.o: ../../functions/last.h ../../functions/login.h
|
||||
createticket.o: ../../functions/logout.h ../../functions/ls.h
|
||||
createticket.o: ../../functions/mkdir.h ../../functions/mv.h
|
||||
createticket.o: ../../functions/node.h ../../functions/priv.h
|
||||
createticket.o: ../../functions/reload.h ../../functions/rm.h
|
||||
createticket.o: ../../functions/run.h ../../functions/specialdefault.h
|
||||
createticket.o: ../../functions/stat.h ../../functions/subject.h
|
||||
createticket.o: ../../functions/funthread.h ../../functions/template.h
|
||||
createticket.o: ../../functions/tinymce.h ../../functions/uname.h
|
||||
createticket.o: ../../functions/upload.h ../../functions/uptime.h
|
||||
createticket.o: ../../functions/who.h ../../functions/vim.h
|
||||
createticket.o: ../../core/htmlfilter.h
|
||||
createticket.o: ../../functions/logout.h ../../functions/ln.h
|
||||
createticket.o: ../../functions/ls.h ../../functions/mkdir.h
|
||||
createticket.o: ../../functions/mv.h ../../functions/node.h
|
||||
createticket.o: ../../functions/priv.h ../../functions/reload.h
|
||||
createticket.o: ../../functions/rm.h ../../functions/run.h
|
||||
createticket.o: ../../functions/specialdefault.h ../../functions/stat.h
|
||||
createticket.o: ../../functions/subject.h ../../functions/funthread.h
|
||||
createticket.o: ../../functions/template.h ../../functions/tinymce.h
|
||||
createticket.o: ../../functions/uname.h ../../functions/upload.h
|
||||
createticket.o: ../../functions/uptime.h ../../functions/who.h
|
||||
createticket.o: ../../functions/vim.h ../../core/htmlfilter.h sessiondata.h
|
||||
createticket.o: ../../core/plugindata.h
|
||||
editticket.o: editticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
editticket.o: ../../db/dbtextstream.h ../../core/textstream.h
|
||||
editticket.o: ../../core/misc.h ../../core/item.h ../../core/error.h
|
||||
@@ -78,28 +79,29 @@ editticket.o: ../../core/config.h ../../core/confparser.h
|
||||
editticket.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h
|
||||
editticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
|
||||
editticket.o: ../../core/thumb.h ../../core/basethread.h
|
||||
editticket.o: ../../functions/functionbase.h ../../core/request.h
|
||||
editticket.o: ../../functions/functions.h ../../functions/functionbase.h
|
||||
editticket.o: ../../functions/functionparser.h ../../core/request.h
|
||||
editticket.o: ../../core/requesttypes.h ../../core/session.h
|
||||
editticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h
|
||||
editticket.o: ../../core/synchro.h ../../functions/functions.h
|
||||
editticket.o: ../../functions/functionbase.h ../../functions/functionparser.h
|
||||
editticket.o: ../../functions/adduser.h ../../functions/cat.h
|
||||
editticket.o: ../../functions/chmod.h ../../functions/privchanger.h
|
||||
editticket.o: ../../functions/chown.h ../../functions/ckeditor.h
|
||||
editticket.o: ../../functions/cp.h ../../functions/createthread.h
|
||||
editticket.o: ../../functions/functionbase.h ../../core/synchro.h
|
||||
editticket.o: ../../functions/default.h ../../functions/download.h
|
||||
editticket.o: ../../functions/emacs.h ../../functions/last.h
|
||||
editticket.o: ../../functions/login.h ../../functions/logout.h
|
||||
editticket.o: ../../functions/ls.h ../../functions/mkdir.h
|
||||
editticket.o: ../../functions/mv.h ../../functions/node.h
|
||||
editticket.o: ../../functions/priv.h ../../functions/reload.h
|
||||
editticket.o: ../../functions/rm.h ../../functions/run.h
|
||||
editticket.o: ../../functions/specialdefault.h ../../functions/stat.h
|
||||
editticket.o: ../../functions/subject.h ../../functions/funthread.h
|
||||
editticket.o: ../../functions/template.h ../../functions/tinymce.h
|
||||
editticket.o: ../../functions/uname.h ../../functions/upload.h
|
||||
editticket.o: ../../functions/uptime.h ../../functions/who.h
|
||||
editticket.o: ../../functions/vim.h ../../core/htmlfilter.h
|
||||
editticket.o: ../../functions/ln.h ../../functions/ls.h
|
||||
editticket.o: ../../functions/mkdir.h ../../functions/mv.h
|
||||
editticket.o: ../../functions/node.h ../../functions/priv.h
|
||||
editticket.o: ../../functions/reload.h ../../functions/rm.h
|
||||
editticket.o: ../../functions/run.h ../../functions/specialdefault.h
|
||||
editticket.o: ../../functions/stat.h ../../functions/subject.h
|
||||
editticket.o: ../../functions/funthread.h ../../functions/template.h
|
||||
editticket.o: ../../functions/tinymce.h ../../functions/uname.h
|
||||
editticket.o: ../../functions/upload.h ../../functions/uptime.h
|
||||
editticket.o: ../../functions/who.h ../../functions/vim.h
|
||||
editticket.o: ../../core/htmlfilter.h sessiondata.h ../../core/plugindata.h
|
||||
funticket.o: funticket.h tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
funticket.o: ../../db/dbtextstream.h ../../core/textstream.h
|
||||
funticket.o: ../../core/misc.h ../../core/item.h ../../core/error.h
|
||||
@@ -127,10 +129,29 @@ funticket.o: ../../core/config.h ../../core/confparser.h
|
||||
funticket.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h
|
||||
funticket.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
|
||||
funticket.o: ../../core/thumb.h ../../core/basethread.h
|
||||
funticket.o: ../../functions/functionbase.h ../../core/request.h
|
||||
funticket.o: ../../functions/functions.h ../../functions/functionbase.h
|
||||
funticket.o: ../../functions/functionparser.h ../../core/request.h
|
||||
funticket.o: ../../core/requesttypes.h ../../core/session.h
|
||||
funticket.o: ../../core/plugindata.h ../../templates/htmltextstream.h
|
||||
funticket.o: ../../core/synchro.h ../../core/misc.h
|
||||
funticket.o: ../../functions/adduser.h ../../functions/cat.h
|
||||
funticket.o: ../../functions/chmod.h ../../functions/privchanger.h
|
||||
funticket.o: ../../functions/chown.h ../../functions/ckeditor.h
|
||||
funticket.o: ../../functions/cp.h ../../functions/createthread.h
|
||||
funticket.o: ../../functions/functionbase.h ../../core/synchro.h
|
||||
funticket.o: ../../functions/default.h ../../functions/download.h
|
||||
funticket.o: ../../functions/emacs.h ../../functions/last.h
|
||||
funticket.o: ../../functions/login.h ../../functions/logout.h
|
||||
funticket.o: ../../functions/ln.h ../../functions/ls.h
|
||||
funticket.o: ../../functions/mkdir.h ../../functions/mv.h
|
||||
funticket.o: ../../functions/node.h ../../functions/priv.h
|
||||
funticket.o: ../../functions/reload.h ../../functions/rm.h
|
||||
funticket.o: ../../functions/run.h ../../functions/specialdefault.h
|
||||
funticket.o: ../../functions/stat.h ../../functions/subject.h
|
||||
funticket.o: ../../functions/funthread.h ../../functions/template.h
|
||||
funticket.o: ../../functions/tinymce.h ../../functions/uname.h
|
||||
funticket.o: ../../functions/upload.h ../../functions/uptime.h
|
||||
funticket.o: ../../functions/who.h ../../functions/vim.h
|
||||
funticket.o: ../../core/htmlfilter.h
|
||||
init.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
init.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h
|
||||
init.o: ../../core/item.h ../../core/error.h ../../core/log.h
|
||||
@@ -156,32 +177,86 @@ init.o: ../../core/mountparser.h ../../core/config.h ../../core/confparser.h
|
||||
init.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h
|
||||
init.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
|
||||
init.o: ../../core/thumb.h ../../core/basethread.h
|
||||
init.o: ../../functions/functionbase.h ../../core/request.h
|
||||
init.o: ../../functions/functions.h ../../functions/functionbase.h
|
||||
init.o: ../../functions/functionparser.h ../../core/request.h
|
||||
init.o: ../../core/requesttypes.h ../../core/session.h
|
||||
init.o: ../../core/plugindata.h ../../templates/htmltextstream.h
|
||||
init.o: ../../core/synchro.h editticket.h createticket.h ../../core/log.h
|
||||
init.o: ../../core/plugin.h ../../core/pluginmsg.h ../../core/system.h
|
||||
init.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
|
||||
init.o: ../../functions/functions.h ../../functions/functionbase.h
|
||||
init.o: ../../functions/functionparser.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/createthread.h ../../functions/default.h
|
||||
init.o: ../../functions/download.h ../../functions/emacs.h
|
||||
init.o: ../../functions/last.h ../../functions/login.h
|
||||
init.o: ../../functions/logout.h ../../functions/ls.h ../../functions/mkdir.h
|
||||
init.o: ../../functions/mv.h ../../functions/node.h ../../functions/priv.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/createthread.h
|
||||
init.o: ../../functions/functionbase.h ../../core/synchro.h
|
||||
init.o: ../../functions/default.h ../../functions/download.h
|
||||
init.o: ../../functions/emacs.h ../../functions/last.h
|
||||
init.o: ../../functions/login.h ../../functions/logout.h ../../functions/ln.h
|
||||
init.o: ../../functions/ls.h ../../functions/mkdir.h ../../functions/mv.h
|
||||
init.o: ../../functions/node.h ../../functions/priv.h
|
||||
init.o: ../../functions/reload.h ../../functions/rm.h ../../functions/run.h
|
||||
init.o: ../../functions/specialdefault.h ../../functions/stat.h
|
||||
init.o: ../../functions/subject.h ../../functions/funthread.h
|
||||
init.o: ../../functions/template.h ../../functions/tinymce.h
|
||||
init.o: ../../functions/uname.h ../../functions/upload.h
|
||||
init.o: ../../functions/uptime.h ../../functions/who.h ../../functions/vim.h
|
||||
init.o: ../../core/htmlfilter.h ../../templates/templates.h
|
||||
init.o: ../../core/htmlfilter.h editticket.h createticket.h showtickets.h
|
||||
init.o: ../../core/log.h ../../core/plugin.h ../../core/pluginmsg.h
|
||||
init.o: ../../core/system.h ../../core/sessionmanager.h
|
||||
init.o: ../../core/sessioncontainer.h ../../templates/templates.h
|
||||
init.o: ../../templates/patterncacher.h ../../templates/ckeditorgetparser.h
|
||||
init.o: ../../core/httpsimpleparser.h ../../core/log.h
|
||||
init.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
|
||||
init.o: sessiondata.h ../../core/plugindata.h
|
||||
sessiondata.o: sessiondata.h ../../core/plugindata.h ticket.h
|
||||
showtickets.o: showtickets.h tdb.h ticket.h ../../db/dbbase.h
|
||||
showtickets.o: ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
showtickets.o: ../../core/textstream.h ../../core/misc.h ../../core/item.h
|
||||
showtickets.o: ../../core/error.h ../../core/log.h ../../core/textstream.h
|
||||
showtickets.o: ticketinfo.h ticketparser.h ticketconf.h ../../core/item.h
|
||||
showtickets.o: ../../core/system.h ../../core/dirs.h
|
||||
showtickets.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h
|
||||
showtickets.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h
|
||||
showtickets.o: ../../core/user.h ../../core/group.h ../../core/thread.h
|
||||
showtickets.o: ../../core/dircontainer.h ../../core/ugcontainer.h
|
||||
showtickets.o: ../../core/request.h ../../notify/notify.h
|
||||
showtickets.o: ../../notify/notifypool.h ../../templates/locale.h
|
||||
showtickets.o: ../../core/confparser.h ../../templates/misc.h
|
||||
showtickets.o: ../../templates/localefilter.h ../../templates/locale.h
|
||||
showtickets.o: ../../../ezc/src/ezc.h ../../../ezc/src/utf8.h
|
||||
showtickets.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h
|
||||
showtickets.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h
|
||||
showtickets.o: ../../../ezc/src/stringconv.h ../../templates/htmltextstream.h
|
||||
showtickets.o: ../../notify/notifythread.h ../../core/basethread.h
|
||||
showtickets.o: ../../core/synchro.h ../../notify/templatesnotify.h
|
||||
showtickets.o: ../../core/config.h ../../core/users.h ../../core/user.h
|
||||
showtickets.o: ../../core/ugcontainer.h ../../core/lastcontainer.h
|
||||
showtickets.o: ../../core/mounts.h ../../core/mount.h ../../core/error.h
|
||||
showtickets.o: ../../core/mountparser.h ../../core/config.h
|
||||
showtickets.o: ../../core/confparser.h ../../core/htmlfilter.h
|
||||
showtickets.o: ../../core/users.h ../../core/groups.h ../../core/group.h
|
||||
showtickets.o: ../../core/rebus.h ../../core/loadavg.h ../../core/thumb.h
|
||||
showtickets.o: ../../core/basethread.h ../../functions/functions.h
|
||||
showtickets.o: ../../functions/functionbase.h
|
||||
showtickets.o: ../../functions/functionparser.h ../../core/request.h
|
||||
showtickets.o: ../../core/requesttypes.h ../../core/session.h
|
||||
showtickets.o: ../../core/plugindata.h ../../templates/htmltextstream.h
|
||||
showtickets.o: ../../functions/adduser.h ../../functions/cat.h
|
||||
showtickets.o: ../../functions/chmod.h ../../functions/privchanger.h
|
||||
showtickets.o: ../../functions/chown.h ../../functions/ckeditor.h
|
||||
showtickets.o: ../../functions/cp.h ../../functions/createthread.h
|
||||
showtickets.o: ../../functions/functionbase.h ../../core/synchro.h
|
||||
showtickets.o: ../../functions/default.h ../../functions/download.h
|
||||
showtickets.o: ../../functions/emacs.h ../../functions/last.h
|
||||
showtickets.o: ../../functions/login.h ../../functions/logout.h
|
||||
showtickets.o: ../../functions/ln.h ../../functions/ls.h
|
||||
showtickets.o: ../../functions/mkdir.h ../../functions/mv.h
|
||||
showtickets.o: ../../functions/node.h ../../functions/priv.h
|
||||
showtickets.o: ../../functions/reload.h ../../functions/rm.h
|
||||
showtickets.o: ../../functions/run.h ../../functions/specialdefault.h
|
||||
showtickets.o: ../../functions/stat.h ../../functions/subject.h
|
||||
showtickets.o: ../../functions/funthread.h ../../functions/template.h
|
||||
showtickets.o: ../../functions/tinymce.h ../../functions/uname.h
|
||||
showtickets.o: ../../functions/upload.h ../../functions/uptime.h
|
||||
showtickets.o: ../../functions/who.h ../../functions/vim.h
|
||||
showtickets.o: ../../core/htmlfilter.h
|
||||
tdb.o: tdb.h ticket.h ../../db/dbbase.h ../../db/dbconn.h
|
||||
tdb.o: ../../db/dbtextstream.h ../../core/textstream.h ../../core/misc.h
|
||||
tdb.o: ../../core/item.h ../../core/error.h ../../core/log.h
|
||||
@@ -210,24 +285,20 @@ templates.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h
|
||||
templates.o: ../../core/config.h ../../core/confparser.h
|
||||
templates.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h
|
||||
templates.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
|
||||
templates.o: ../../core/thumb.h ../../core/basethread.h tdb.h
|
||||
templates.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
templates.o: ../../core/error.h editticket.h ../../functions/functionbase.h
|
||||
templates.o: ../../core/request.h ../../core/requesttypes.h
|
||||
templates.o: ../../core/session.h ../../core/plugindata.h
|
||||
templates.o: ../../templates/htmltextstream.h ../../core/synchro.h
|
||||
templates.o: createticket.h ../../core/misc.h ../../core/plugin.h
|
||||
templates.o: ../../core/pluginmsg.h ../../core/system.h
|
||||
templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
|
||||
templates.o: ../../core/thumb.h ../../core/basethread.h
|
||||
templates.o: ../../functions/functions.h ../../functions/functionbase.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/createthread.h ../../functions/default.h
|
||||
templates.o: ../../functions/download.h ../../functions/emacs.h
|
||||
templates.o: ../../functions/last.h ../../functions/login.h
|
||||
templates.o: ../../functions/logout.h ../../functions/ls.h
|
||||
templates.o: ../../functions/functionparser.h ../../core/request.h
|
||||
templates.o: ../../core/requesttypes.h ../../core/session.h
|
||||
templates.o: ../../core/plugindata.h ../../templates/htmltextstream.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/createthread.h
|
||||
templates.o: ../../functions/functionbase.h ../../core/synchro.h
|
||||
templates.o: ../../functions/default.h ../../functions/download.h
|
||||
templates.o: ../../functions/emacs.h ../../functions/last.h
|
||||
templates.o: ../../functions/login.h ../../functions/logout.h
|
||||
templates.o: ../../functions/ln.h ../../functions/ls.h
|
||||
templates.o: ../../functions/mkdir.h ../../functions/mv.h
|
||||
templates.o: ../../functions/node.h ../../functions/priv.h
|
||||
templates.o: ../../functions/reload.h ../../functions/rm.h
|
||||
@@ -237,11 +308,16 @@ templates.o: ../../functions/funthread.h ../../functions/template.h
|
||||
templates.o: ../../functions/tinymce.h ../../functions/uname.h
|
||||
templates.o: ../../functions/upload.h ../../functions/uptime.h
|
||||
templates.o: ../../functions/who.h ../../functions/vim.h
|
||||
templates.o: ../../core/htmlfilter.h ../../templates/templates.h
|
||||
templates.o: ../../templates/patterncacher.h
|
||||
templates.o: ../../core/htmlfilter.h tdb.h ../../db/dbbase.h
|
||||
templates.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h
|
||||
templates.o: editticket.h createticket.h ../../core/misc.h
|
||||
templates.o: ../../core/plugin.h ../../core/pluginmsg.h ../../core/system.h
|
||||
templates.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
|
||||
templates.o: ../../templates/templates.h ../../templates/patterncacher.h
|
||||
templates.o: ../../templates/ckeditorgetparser.h
|
||||
templates.o: ../../core/httpsimpleparser.h ../../core/log.h
|
||||
templates.o: ../../templates/indexpatterns.h ../../core/sessionmanager.h
|
||||
templates.o: sessiondata.h ../../core/plugindata.h
|
||||
ticketconf.o: ticketconf.h
|
||||
ticketinfo.o: ticketinfo.h ticket.h ticketparser.h ticketconf.h
|
||||
ticketinfo.o: ../../core/item.h ../../core/system.h ../../core/dirs.h
|
||||
@@ -268,7 +344,32 @@ ticketinfo.o: ../../core/mount.h ../../core/error.h ../../core/mountparser.h
|
||||
ticketinfo.o: ../../core/config.h ../../core/confparser.h
|
||||
ticketinfo.o: ../../core/htmlfilter.h ../../core/users.h ../../core/groups.h
|
||||
ticketinfo.o: ../../core/group.h ../../core/rebus.h ../../core/loadavg.h
|
||||
ticketinfo.o: ../../core/thumb.h ../../core/basethread.h tdb.h
|
||||
ticketinfo.o: ../../db/dbbase.h ../../db/dbconn.h ../../db/dbtextstream.h
|
||||
ticketinfo.o: ../../core/error.h ../../core/log.h ../../core/misc.h
|
||||
ticketinfo.o: ../../core/thumb.h ../../core/basethread.h
|
||||
ticketinfo.o: ../../functions/functions.h ../../functions/functionbase.h
|
||||
ticketinfo.o: ../../functions/functionparser.h ../../core/request.h
|
||||
ticketinfo.o: ../../core/requesttypes.h ../../core/session.h
|
||||
ticketinfo.o: ../../core/plugindata.h ../../templates/htmltextstream.h
|
||||
ticketinfo.o: ../../functions/adduser.h ../../functions/cat.h
|
||||
ticketinfo.o: ../../functions/chmod.h ../../functions/privchanger.h
|
||||
ticketinfo.o: ../../functions/chown.h ../../functions/ckeditor.h
|
||||
ticketinfo.o: ../../functions/cp.h ../../functions/createthread.h
|
||||
ticketinfo.o: ../../functions/functionbase.h ../../core/synchro.h
|
||||
ticketinfo.o: ../../functions/default.h ../../functions/download.h
|
||||
ticketinfo.o: ../../functions/emacs.h ../../functions/last.h
|
||||
ticketinfo.o: ../../functions/login.h ../../functions/logout.h
|
||||
ticketinfo.o: ../../functions/ln.h ../../functions/ls.h
|
||||
ticketinfo.o: ../../functions/mkdir.h ../../functions/mv.h
|
||||
ticketinfo.o: ../../functions/node.h ../../functions/priv.h
|
||||
ticketinfo.o: ../../functions/reload.h ../../functions/rm.h
|
||||
ticketinfo.o: ../../functions/run.h ../../functions/specialdefault.h
|
||||
ticketinfo.o: ../../functions/stat.h ../../functions/subject.h
|
||||
ticketinfo.o: ../../functions/funthread.h ../../functions/template.h
|
||||
ticketinfo.o: ../../functions/tinymce.h ../../functions/uname.h
|
||||
ticketinfo.o: ../../functions/upload.h ../../functions/uptime.h
|
||||
ticketinfo.o: ../../functions/who.h ../../functions/vim.h
|
||||
ticketinfo.o: ../../core/htmlfilter.h tdb.h ../../db/dbbase.h
|
||||
ticketinfo.o: ../../db/dbconn.h ../../db/dbtextstream.h ../../core/error.h
|
||||
ticketinfo.o: ../../core/log.h ../../core/misc.h sessiondata.h
|
||||
ticketinfo.o: ../../core/plugindata.h
|
||||
ticketparser.o: ticketparser.h ticketconf.h ../../core/log.h
|
||||
ticketparser.o: ../../core/misc.h
|
||||
|
||||
@@ -1 +1 @@
|
||||
o = createticket.o editticket.o funticket.o init.o tdb.o templates.o ticketconf.o ticketinfo.o ticketparser.o
|
||||
o = createticket.o editticket.o funticket.o init.o sessiondata.o showtickets.o tdb.o templates.o ticketconf.o ticketinfo.o ticketparser.o
|
||||
|
||||
@@ -9,6 +9,8 @@
|
||||
|
||||
#include "createticket.h"
|
||||
#include "functions/functions.h"
|
||||
#include "sessiondata.h"
|
||||
|
||||
|
||||
|
||||
namespace Ticket
|
||||
@@ -36,76 +38,61 @@ void CreateTicket::SetTicketInfo(TicketInfo * pinfo)
|
||||
|
||||
|
||||
|
||||
void CreateTicket::Clear()
|
||||
bool CreateTicket::HasAccess()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
}
|
||||
|
||||
|
||||
// returning true if we can create a ticket in the current directory
|
||||
bool CreateTicket::HasAccess(bool check_root)
|
||||
{
|
||||
if( request->dir_tab.empty() )
|
||||
return false;
|
||||
|
||||
if( request->is_item )
|
||||
return false;
|
||||
|
||||
if( !system->HasWriteAccess(*request->dir_tab.back()) )
|
||||
if( request->is_item || !system->HasWriteAccess(*request->dir_tab.back()) )
|
||||
return false;
|
||||
|
||||
if( !system->mounts.pmount || system->mounts.pmount->type != ticket_info->mount_type_ticket )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTicket::AddTicket(Ticket & ticket, Item & item)
|
||||
{
|
||||
ticket.file_id = item.id;
|
||||
request->status = tdb->AddTicket(ticket);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
// sending notification
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_USER1;
|
||||
notify_msg.template_index = ticket_info->template_index;
|
||||
notify_msg.dir_link = config->base_url;
|
||||
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
|
||||
notify_msg.item_link = notify_msg.dir_link;
|
||||
notify_msg.item_link += item.url;
|
||||
|
||||
system->notify.ItemChanged(notify_msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CreateTicket::Submit(Ticket & ticket, Item & item)
|
||||
{
|
||||
if( functions->CheckAbuse() )
|
||||
return;
|
||||
|
||||
functions->SetUser(item);
|
||||
item.privileges = 0644; // !! tymczasowo
|
||||
item.parent_id = request->dir_tab.back()->id;
|
||||
|
||||
// adding without notificating
|
||||
request->status = system->AddFile(item, false);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
AddTicket(ticket, item);
|
||||
|
||||
|
||||
// checking for par_createticket_on mount option
|
||||
|
||||
if( !check_root && request->session && request->session->puser && request->session->puser->super_user )
|
||||
// super can create tickets regardless of the createticket_on option
|
||||
return true;
|
||||
|
||||
if( !system->mounts.pmount->IsPar(ticket_info->mount_par_createticket_on) )
|
||||
return true;
|
||||
|
||||
if( system->mounts.pmount->IsArg(ticket_info->mount_par_createticket_on, request->dir_tab.size()) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool CreateTicket::HasAccess()
|
||||
{
|
||||
return HasAccess(false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTicket::AddTicket()
|
||||
{
|
||||
// a new directory created by system->AddDir()
|
||||
ticket_info->ticket.dir_id = request->dir_tab.back()->id;
|
||||
request->status = tdb->AddTicket(ticket_info->ticket);
|
||||
|
||||
// sending notification
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_USER1;
|
||||
notify_msg.template_index = ticket_info->template_index;
|
||||
|
||||
system->dirs.MakePath(ticket_info->item.parent_id, tmp_path);
|
||||
notify_msg.item_link = config->base_url;
|
||||
notify_msg.item_link += tmp_path;
|
||||
notify_msg.dir_link = notify_msg.item_link;
|
||||
|
||||
system->notify.ItemChanged(notify_msg);
|
||||
}
|
||||
|
||||
|
||||
void CreateTicket::LogAndRedirect()
|
||||
{
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "CreateTicket: added a new ticket" << logend;
|
||||
system->RedirectToLastDir();
|
||||
RemoveTicket();
|
||||
system->RedirectTo(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -116,41 +103,55 @@ void CreateTicket::LogAndRedirect()
|
||||
|
||||
|
||||
|
||||
void CreateTicket::RemoveTicket()
|
||||
{
|
||||
SessionData * session_data = reinterpret_cast<SessionData*>(
|
||||
request->session->plugin_data.Get(ticket_info->plugin_id) );
|
||||
|
||||
long dir_id = request->dir_tab.back()->id;
|
||||
session_data->create_ticket_map.erase(dir_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ticket & CreateTicket::PrepareTicket()
|
||||
{
|
||||
SessionData * session_data = reinterpret_cast<SessionData*>(
|
||||
request->session->plugin_data.Get(ticket_info->plugin_id) );
|
||||
|
||||
long dir_id = request->dir_tab.back()->id;
|
||||
Ticket & ticket = session_data->GetTicket(dir_id, session_data->create_ticket_map);
|
||||
|
||||
return ticket;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTicket::MakePost()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
functions->ReadItem(ticket_info->item, Item::file);
|
||||
functions->SetUser(ticket_info->item);
|
||||
ticket_info->item.privileges = request->dir_tab.back()->privileges; // !! tymczasowo takie same jak z katalogu nadrzednego
|
||||
|
||||
ticket_info->ReadTicketParams();
|
||||
Ticket & ticket = PrepareTicket();
|
||||
Item & item = request->item;
|
||||
ticket_info->ticket = &ticket;
|
||||
|
||||
if( functions->CheckAbuse() )
|
||||
return;
|
||||
ticket_info->ReadTicketParams(ticket, false);
|
||||
functions->ReadItem(item, Item::file);
|
||||
|
||||
ticket_info->item.type = Item::dir;
|
||||
request->status = system->dirs.AddDirectory(ticket_info->item, true);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
ticket_info->item.type = Item::file;
|
||||
ticket_info->item.privileges = 0644; // !! tymczasowo
|
||||
ticket_info->item.parent_id = request->dir_tab.back()->id;
|
||||
|
||||
// adding without notificating
|
||||
request->status = system->AddFile(ticket_info->item, false);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
AddTicket();
|
||||
}
|
||||
|
||||
LogAndRedirect();
|
||||
if( !request->IsPostVar(L"fileuploadsubmit") )
|
||||
Submit(ticket, item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTicket::MakeGet()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
|
||||
Ticket & ticket = PrepareTicket();
|
||||
ticket_info->ticket = &ticket;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,21 +28,20 @@ public:
|
||||
void SetTDb(TDb * ptdb);
|
||||
void SetTicketInfo(TicketInfo * pinfo);
|
||||
|
||||
void Clear();
|
||||
bool HasAccess(bool check_root);
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
void AddTicket();
|
||||
void LogAndRedirect();
|
||||
void AddTicket(Ticket & ticket, Item & item);
|
||||
void Submit(Ticket & ticket, Item & item);
|
||||
void RemoveTicket();
|
||||
Ticket & PrepareTicket();
|
||||
|
||||
TDb * tdb;
|
||||
TicketInfo * ticket_info;
|
||||
NotifyMsg notify_msg;
|
||||
std::wstring tmp_path;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
|
||||
#include "editticket.h"
|
||||
#include "functions/functions.h"
|
||||
|
||||
#include "sessiondata.h"
|
||||
|
||||
|
||||
|
||||
namespace Ticket
|
||||
{
|
||||
|
||||
|
||||
|
||||
EditTicket::EditTicket()
|
||||
{
|
||||
fun.url = L"editticket";
|
||||
@@ -34,27 +36,15 @@ void EditTicket::SetTicketInfo(TicketInfo * pinfo)
|
||||
}
|
||||
|
||||
|
||||
void EditTicket::Clear()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
}
|
||||
|
||||
|
||||
bool EditTicket::HasAccess()
|
||||
{
|
||||
// not logged users cannot edit tickets
|
||||
// !! we are waiting for the sticky bit
|
||||
if( !request->session->puser )
|
||||
return false;
|
||||
|
||||
if( request->dir_tab.empty() )
|
||||
return false;
|
||||
|
||||
ticket_info->ReadTicket(request->dir_tab.back()->id);
|
||||
|
||||
if( request->is_item || !ticket_info->is_ticket )
|
||||
return false;
|
||||
|
||||
if( !system->HasWriteAccess(*request->dir_tab.back()) )
|
||||
if( !request->is_item || !system->HasWriteAccess(request->item) )
|
||||
return false;
|
||||
|
||||
if( !system->mounts.pmount || system->mounts.pmount->type != ticket_info->mount_type_ticket )
|
||||
@@ -66,89 +56,43 @@ return true;
|
||||
|
||||
|
||||
|
||||
|
||||
void EditTicket::GetFirstItem(Item & item)
|
||||
void EditTicket::ChangeTicket(Ticket & ticket, Item & item)
|
||||
{
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
request->status = tdb->RemoveAddTicket(ticket);
|
||||
|
||||
DbItemQuery iq;
|
||||
iq.Limit(1);
|
||||
iq.WhereParentId(request->dir_tab.back()->id);
|
||||
db->GetItems(item_tab, iq); // !! chwilowo GetItems() nie zwraca zadnych kodow bledow
|
||||
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
if( item_tab.empty() )
|
||||
{
|
||||
// creating a new item (the item was deleted by a user)
|
||||
|
||||
item.parent_id = request->dir_tab.back()->id;
|
||||
item.subject = request->dir_tab.back()->subject;
|
||||
item.type = Item::file;
|
||||
item.privileges = 0644; // !! tymczasowo
|
||||
functions->SetUser(item);
|
||||
functions->PrepareUrl(item);
|
||||
|
||||
request->status = system->AddFile(item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
log << log2 << "EditTicket: added the first item with content for the ticket, item.id: "
|
||||
<< item.id << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
item = item_tab[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EditTicket::ModifyTicket()
|
||||
{
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
ticket_info->ReadTicketParams();
|
||||
request->status = tdb->RemoveAddTicket(ticket_info->ticket);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EditTicket::ModifyLastDir()
|
||||
{
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
// we don't modify the url
|
||||
Item & dir = *request->dir_tab.back();
|
||||
|
||||
if( dir.subject != ticket_info->item.subject )
|
||||
{
|
||||
dir.subject = ticket_info->item.subject;
|
||||
request->status = db->EditItemById(dir, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EditTicket::ModifyFirstItem()
|
||||
{
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
return;
|
||||
|
||||
// we don't modify the url and don't use notifications
|
||||
system->EditFile(ticket_info->item, false, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EditTicket::LogAndRedirect()
|
||||
{
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "EditTicket: edited a ticket" << logend;
|
||||
system->RedirectToLastDir();
|
||||
// sending notification
|
||||
/*
|
||||
notify_msg.code = WINIX_NOTIFY_CODE_USER1;
|
||||
notify_msg.template_index = ticket_info->template_index;
|
||||
notify_msg.dir_link = config->base_url;
|
||||
system->dirs.MakePath(item.parent_id, notify_msg.dir_link, false);
|
||||
notify_msg.item_link = notify_msg.dir_link;
|
||||
notify_msg.item_link += item.url;
|
||||
|
||||
system->notify.ItemChanged(notify_msg);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void EditTicket::Submit(Ticket & ticket, Item & item)
|
||||
{
|
||||
if( functions->CheckAbuse() )
|
||||
return;
|
||||
|
||||
// adding without notificating
|
||||
request->status = system->EditFile(item, old_url != item.url);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
ChangeTicket(ticket, item);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
log << log2 << "EditTicket: ticket modified" << logend;
|
||||
RemoveTicket();
|
||||
system->RedirectTo(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -159,29 +103,65 @@ void EditTicket::LogAndRedirect()
|
||||
|
||||
|
||||
|
||||
|
||||
void EditTicket::RemoveTicket()
|
||||
{
|
||||
SessionData * session_data = reinterpret_cast<SessionData*>(
|
||||
request->session->plugin_data.Get(ticket_info->plugin_id) );
|
||||
|
||||
long file_id = request->item.id;
|
||||
session_data->create_ticket_map.erase(file_id);
|
||||
session_data->new_file_map.erase(file_id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ticket & EditTicket::PrepareTicket()
|
||||
{
|
||||
SessionData * session_data = reinterpret_cast<SessionData*>(
|
||||
request->session->plugin_data.Get(ticket_info->plugin_id) );
|
||||
|
||||
bool is_new;
|
||||
long file_id = request->item.id;
|
||||
Ticket & ticket = session_data->GetTicket(file_id, session_data->edit_ticket_map, &is_new);
|
||||
|
||||
if( is_new )
|
||||
tdb->GetTicket(file_id, ticket);
|
||||
else
|
||||
ticket.file_id = file_id;
|
||||
|
||||
return ticket;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<long> & EditTicket::PrepareFileMap()
|
||||
{
|
||||
SessionData * session_data = reinterpret_cast<SessionData*>(
|
||||
request->session->plugin_data.Get(ticket_info->plugin_id) );
|
||||
|
||||
long file_id = request->item.id;
|
||||
std::vector<long> & file_map = session_data->GetFileTab(file_id, session_data->new_file_map);
|
||||
|
||||
return file_map;
|
||||
}
|
||||
|
||||
|
||||
void EditTicket::MakePost()
|
||||
{
|
||||
ticket_info->FindCurrentConf();
|
||||
|
||||
// reading the first item from the db or creating it if not exists
|
||||
GetFirstItem(ticket_info->item);
|
||||
Ticket & ticket = PrepareTicket();
|
||||
Item & item = request->item;
|
||||
old_url = item.url;
|
||||
std::vector<long> & file_map = PrepareFileMap();
|
||||
ticket_info->ticket = &ticket;
|
||||
|
||||
// reading information from POST
|
||||
functions->ReadItem(ticket_info->item, Item::file);
|
||||
ticket_info->ReadTicketParams(ticket, false, &file_map);
|
||||
functions->ReadItem(item, Item::file);
|
||||
|
||||
if( functions->CheckAbuse() )
|
||||
return;
|
||||
|
||||
if( tdb->GetTicket(request->dir_tab.back()->id, ticket_info->ticket) != WINIX_ERR_OK )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
ModifyTicket();
|
||||
ModifyLastDir();
|
||||
ModifyFirstItem();
|
||||
LogAndRedirect();
|
||||
if( !request->IsPostVar(L"fileuploadsubmit") )
|
||||
Submit(ticket, item);
|
||||
}
|
||||
|
||||
|
||||
@@ -190,19 +170,8 @@ void EditTicket::MakeGet()
|
||||
{
|
||||
ticket_info->FindCurrentConf();
|
||||
|
||||
DbItemQuery iq;
|
||||
iq.Limit(1);
|
||||
iq.WhereParentId(request->dir_tab.back()->id);
|
||||
db->GetItems(item_tab, iq); // !! chwilowo GetItems() nie zwraca kodow bledow
|
||||
|
||||
if( request->status != WINIX_ERR_OK )
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
|
||||
if( !item_tab.empty() )
|
||||
ticket_info->item = item_tab[0];
|
||||
Ticket & ticket = PrepareTicket();
|
||||
ticket_info->ticket = &ticket;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -28,22 +28,22 @@ public:
|
||||
void SetTDb(TDb * ptdb);
|
||||
void SetTicketInfo(TicketInfo * pinfo);
|
||||
|
||||
void Clear();
|
||||
bool HasAccess();
|
||||
void MakePost();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
void GetFirstItem(Item & item);
|
||||
void ModifyTicket();
|
||||
void ModifyLastDir();
|
||||
void ModifyFirstItem();
|
||||
void LogAndRedirect();
|
||||
void RemoveTicket();
|
||||
Ticket & PrepareTicket();
|
||||
std::vector<long> & PrepareFileMap();
|
||||
std::wstring old_url;
|
||||
|
||||
void ChangeTicket(Ticket & ticket, Item & item);
|
||||
void Submit(Ticket & ticket, Item & item);
|
||||
|
||||
TDb * tdb;
|
||||
TicketInfo * ticket_info;
|
||||
std::vector<Item> item_tab;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -7,10 +7,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
#include "funticket.h"
|
||||
#include "core/misc.h"
|
||||
|
||||
|
||||
|
||||
@@ -37,102 +34,21 @@ void FunTicket::SetTicketInfo(TicketInfo * pinfo)
|
||||
}
|
||||
|
||||
|
||||
void FunTicket::Clear()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
}
|
||||
|
||||
|
||||
bool FunTicket::HasAccess()
|
||||
{
|
||||
return !request->is_item;
|
||||
return request->is_item && system->HasReadAccess(request->item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void FunTicket::MakeGet()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
ticket_info->ReadTicket(request->dir_tab.back()->id);
|
||||
ticket_info->ticket = &ticket;
|
||||
|
||||
DbItemQuery iq;
|
||||
iq.WhereParentId(request->dir_tab.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
|
||||
db->GetItems(request->item_tab, iq);
|
||||
|
||||
if( !request->item_tab.empty() )
|
||||
{
|
||||
if( system->HasReadAccess(request->item_tab[0]) )
|
||||
{
|
||||
ticket_info->item = request->item_tab[0];
|
||||
request->item_tab.erase(request->item_tab.begin());
|
||||
}
|
||||
else
|
||||
{
|
||||
request->status = WINIX_ERR_PERMISSION_DENIED;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
system->CheckAccessToItems(request->item_tab);
|
||||
SelectTickets();
|
||||
tdb->GetTicket(request->item.id, ticket);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunTicket::SelectTickets()
|
||||
{
|
||||
child_tab.clear();
|
||||
system->dirs.GetDirChilds(request->dir_tab.back()->id, child_tab);
|
||||
|
||||
SortDirs();
|
||||
PageDirs();
|
||||
CreateIdTab();
|
||||
tdb->GetTickets(id_tab, ticket_info->ticket_tab);
|
||||
ticket_info->SortTickets();
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool FunTicket::SortByDate::operator()(const Item * item1, const Item * item2)
|
||||
{
|
||||
tm tm1 = item1->date_creation;
|
||||
tm tm2 = item2->date_creation;
|
||||
|
||||
time_t time1 = Time(tm1);
|
||||
time_t time2 = Time(tm2);
|
||||
|
||||
return time1 < time2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunTicket::SortDirs()
|
||||
{
|
||||
// temporarily sorting by date
|
||||
SortByDate sort(this);
|
||||
std::sort(child_tab.begin(), child_tab.end(), sort);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunTicket::PageDirs()
|
||||
{
|
||||
// temporarily show every tickets
|
||||
}
|
||||
|
||||
|
||||
|
||||
void FunTicket::CreateIdTab()
|
||||
{
|
||||
id_tab.clear();
|
||||
|
||||
for(size_t i=0 ; i<child_tab.size() ; ++i)
|
||||
id_tab.push_back(child_tab[i]->id);
|
||||
}
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "tdb.h"
|
||||
#include "ticketinfo.h"
|
||||
#include "core/item.h"
|
||||
#include "functions/functionbase.h"
|
||||
|
||||
|
||||
@@ -28,7 +27,6 @@ public:
|
||||
void SetTDb(TDb * ptdb);
|
||||
void SetTicketInfo(TicketInfo * pinfo);
|
||||
|
||||
void Clear();
|
||||
bool HasAccess();
|
||||
void MakeGet();
|
||||
|
||||
@@ -36,20 +34,7 @@ private:
|
||||
|
||||
TDb * tdb;
|
||||
TicketInfo * ticket_info;
|
||||
std::vector<Item*> child_tab;
|
||||
std::vector<long> id_tab;
|
||||
|
||||
struct SortByDate
|
||||
{
|
||||
FunTicket * fun_ticket;
|
||||
SortByDate(FunTicket * f) : fun_ticket(f) {}
|
||||
bool operator()(const Item * item1, const Item * item2);
|
||||
};
|
||||
|
||||
void SelectTickets();
|
||||
void SortDirs();
|
||||
void PageDirs();
|
||||
void CreateIdTab();
|
||||
Ticket ticket;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -11,8 +11,10 @@
|
||||
#include "funticket.h"
|
||||
#include "editticket.h"
|
||||
#include "createticket.h"
|
||||
#include "showtickets.h"
|
||||
#include "core/log.h"
|
||||
#include "core/plugin.h"
|
||||
#include "sessiondata.h"
|
||||
|
||||
|
||||
extern "C" void Init(PluginInfo &);
|
||||
@@ -28,7 +30,7 @@ TicketInfo ticket_info;
|
||||
FunTicket fun_ticket;
|
||||
CreateTicket fun_create_ticket;
|
||||
EditTicket fun_edit_ticket;
|
||||
|
||||
ShowTickets fun_show_tickets;
|
||||
|
||||
|
||||
void AddFunctions(PluginInfo & info)
|
||||
@@ -36,16 +38,19 @@ void AddFunctions(PluginInfo & info)
|
||||
info.functions->Add(fun_ticket);
|
||||
info.functions->Add(fun_create_ticket);
|
||||
info.functions->Add(fun_edit_ticket);
|
||||
info.functions->Add(fun_show_tickets);
|
||||
}
|
||||
|
||||
|
||||
void SelectDefaultFunction(PluginInfo & info)
|
||||
{
|
||||
if( info.request->is_item )
|
||||
return;
|
||||
|
||||
if( info.system->mounts.pmount->type == ticket_info.mount_type_ticket )
|
||||
info.request->function = &fun_ticket;
|
||||
{
|
||||
if( info.request->is_item )
|
||||
info.request->function = &fun_ticket;
|
||||
else
|
||||
info.request->function = &fun_show_tickets;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,22 +58,8 @@ void AddMounts(PluginInfo & info)
|
||||
{
|
||||
Mounts & m = info.system->mounts;
|
||||
|
||||
ticket_info.mount_type_ticket = m.AddMountType(L"ticket");
|
||||
ticket_info.mount_par_ticket = m.AddMountPar(L"ticket");
|
||||
ticket_info.mount_par_ticket_conf = m.AddMountPar(L"ticket_conf");
|
||||
|
||||
// !! bedzie do usuniecia
|
||||
ticket_info.mount_par_ticket_type = m.AddMountPar(L"ticket_type");
|
||||
ticket_info.mount_par_ticket_type_default = m.AddMountPar(L"ticket_type_default");
|
||||
ticket_info.mount_par_ticket_status = m.AddMountPar(L"ticket_status");
|
||||
ticket_info.mount_par_ticket_status_default = m.AddMountPar(L"ticket_status_default");
|
||||
ticket_info.mount_par_ticket_priority = m.AddMountPar(L"ticket_priority");
|
||||
ticket_info.mount_par_ticket_priority_default = m.AddMountPar(L"ticket_priority_default");
|
||||
ticket_info.mount_par_ticket_category = m.AddMountPar(L"ticket_category");
|
||||
ticket_info.mount_par_ticket_category_default = m.AddMountPar(L"ticket_category_default");
|
||||
ticket_info.mount_par_ticket_expected = m.AddMountPar(L"ticket_expected");
|
||||
ticket_info.mount_par_ticket_expected_default = m.AddMountPar(L"ticket_expected_default");
|
||||
ticket_info.mount_par_createticket_on = m.AddMountPar(L"createticket_on");
|
||||
ticket_info.mount_type_ticket = m.AddMountType(L"ticket");
|
||||
ticket_info.mount_par_ticket_conf = m.AddMountPar(L"ticket_conf");
|
||||
}
|
||||
|
||||
|
||||
@@ -90,6 +81,8 @@ void ProcessRequest(PluginInfo & info)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void RemoveTicket(PluginInfo & i)
|
||||
{
|
||||
tdb.RemoveTicket(i.l1);
|
||||
@@ -104,7 +97,22 @@ void InitTicket(PluginInfo & info)
|
||||
|
||||
void AddNotifyTemplate(PluginInfo & info)
|
||||
{
|
||||
ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_ticket.txt");
|
||||
ticket_info.template_index = info.system->notify.AddTemplate(L"notify_email_ticket.txt");
|
||||
}
|
||||
|
||||
|
||||
void CreateSession(PluginInfo & info)
|
||||
{
|
||||
SessionData * p = new SessionData();
|
||||
info.request->session->plugin_data.Assign(p);
|
||||
log << log4 << "Ticket: created ticket plugin data: " << (void*)p << logend;
|
||||
}
|
||||
|
||||
|
||||
void RemoveSession(PluginInfo & info)
|
||||
{
|
||||
delete info.plugin_data_base;
|
||||
log << log4 << "Ticket: removed ticket plugin date: " << (void*)info.plugin_data_base << logend;
|
||||
}
|
||||
|
||||
|
||||
@@ -125,16 +133,21 @@ using namespace Ticket;
|
||||
plugin.Assign(WINIX_ADD_MOUNTS, AddMounts);
|
||||
plugin.Assign(WINIX_FSTAB_CHANGED, FstabChanged);
|
||||
plugin.Assign(WINIX_PROCESS_REQUEST, ProcessRequest);
|
||||
plugin.Assign(WINIX_DIR_REMOVED, RemoveTicket);
|
||||
plugin.Assign(WINIX_FILE_REMOVED, RemoveTicket);
|
||||
plugin.Assign(WINIX_NOTIFY_ADD_TEMPLATE, AddNotifyTemplate);
|
||||
plugin.Assign(WINIX_SESSION_CREATED, CreateSession);
|
||||
plugin.Assign(WINIX_SESSION_REMOVE, RemoveSession);
|
||||
|
||||
tdb.SetConn(info.db->GetConn());
|
||||
tdb.LogQueries(info.config->log_db_query);
|
||||
|
||||
ticket_info.SetDb(info.db);
|
||||
ticket_info.SetTDb(&tdb);
|
||||
ticket_info.SetConfig(info.config);
|
||||
ticket_info.SetSystem(info.system);
|
||||
ticket_info.SetRequest(info.request);
|
||||
ticket_info.SetFunctions(info.functions);
|
||||
ticket_info.plugin_id = info.plugin_id;
|
||||
|
||||
fun_ticket.SetTDb(&tdb);
|
||||
fun_ticket.SetTicketInfo(&ticket_info);
|
||||
@@ -145,6 +158,9 @@ using namespace Ticket;
|
||||
fun_create_ticket.SetTDb(&tdb);
|
||||
fun_create_ticket.SetTicketInfo(&ticket_info);
|
||||
|
||||
fun_show_tickets.SetTDb(&tdb);
|
||||
fun_show_tickets.SetTicketInfo(&ticket_info);
|
||||
|
||||
info.p1 = (void*)(plugin_name);
|
||||
}
|
||||
|
||||
|
||||
42
plugins/ticket/sessiondata.cpp
Executable file
42
plugins/ticket/sessiondata.cpp
Executable file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sessiondata.h"
|
||||
|
||||
|
||||
namespace Ticket
|
||||
{
|
||||
|
||||
|
||||
|
||||
Ticket & SessionData::GetTicket(long id, SessionData::TicketMap & ticket_map, bool * is_new)
|
||||
{
|
||||
std::pair<TicketMap::iterator, bool> res = ticket_map.insert( std::make_pair(id, Ticket()) );
|
||||
|
||||
if( is_new )
|
||||
*is_new = res.second;
|
||||
|
||||
return res.first->second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
std::vector<long> & SessionData::GetFileTab(long id, FileMap & file_map)
|
||||
{
|
||||
std::pair<FileMap::iterator, bool> res = file_map.insert( std::make_pair(id, std::vector<long>()) );
|
||||
|
||||
return res.first->second;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
|
||||
53
plugins/ticket/sessiondata.h
Executable file
53
plugins/ticket/sessiondata.h
Executable file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_plugins_ticket_sessiondata
|
||||
#define headerfile_winix_plugins_ticket_sessiondata
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include "core/plugindata.h"
|
||||
#include "ticket.h"
|
||||
|
||||
|
||||
namespace Ticket
|
||||
{
|
||||
|
||||
|
||||
struct SessionData : public PluginDataBase
|
||||
{
|
||||
typedef std::map<long, Ticket> TicketMap;
|
||||
typedef std::map<long, std::vector<long> > FileMap;
|
||||
|
||||
// temporary tickets for 'createticket' function
|
||||
// <parent_dir_id, Ticket>
|
||||
TicketMap create_ticket_map;
|
||||
|
||||
// temporary tickets for 'editticket' function
|
||||
// <file_id, Ticket>
|
||||
TicketMap edit_ticket_map;
|
||||
|
||||
// temporary files for 'editticket' function
|
||||
// these files should be deleted if a user will not click on the submit button
|
||||
FileMap new_file_map;
|
||||
|
||||
|
||||
// inserting and returning a new ticket or just returning the ticket if it exists
|
||||
Ticket & GetTicket(long id, TicketMap & ticket_map, bool * is_new = 0);
|
||||
|
||||
std::vector<long> & GetFileTab(long id, FileMap & file_map);
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
#endif
|
||||
138
plugins/ticket/showtickets.cpp
Executable file
138
plugins/ticket/showtickets.cpp
Executable file
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <ctime>
|
||||
#include <algorithm>
|
||||
#include "showtickets.h"
|
||||
|
||||
|
||||
|
||||
namespace Ticket
|
||||
{
|
||||
|
||||
|
||||
|
||||
ShowTickets::ShowTickets()
|
||||
{
|
||||
fun.url = L"showtickets";
|
||||
}
|
||||
|
||||
|
||||
void ShowTickets::SetTDb(TDb * ptdb)
|
||||
{
|
||||
tdb = ptdb;
|
||||
}
|
||||
|
||||
|
||||
void ShowTickets::SetTicketInfo(TicketInfo * pinfo)
|
||||
{
|
||||
ticket_info = pinfo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ShowTickets::HasAccess()
|
||||
{
|
||||
return !request->is_item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool ShowTickets::Sort::operator()(const Item * item1, const Item * item2)
|
||||
{
|
||||
if( sort_type == 0 )
|
||||
{
|
||||
// sorting by url
|
||||
return item1->url < item2->url;
|
||||
}
|
||||
else
|
||||
{
|
||||
// sorting by date
|
||||
tm tm1 = item1->date_creation;
|
||||
tm tm2 = item2->date_creation;
|
||||
|
||||
time_t time1 = Time(tm1);
|
||||
time_t time2 = Time(tm2);
|
||||
|
||||
return time1 < time2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ShowTickets::ReadFiles()
|
||||
{
|
||||
// reading files
|
||||
DbItemQuery iq;
|
||||
iq.SetAll(false, false);
|
||||
iq.sel_url = true;
|
||||
iq.sel_subject = true;
|
||||
iq.sel_date = true;
|
||||
iq.WhereParentId(request->dir_tab.back()->id);
|
||||
iq.WhereType(Item::file);
|
||||
iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE);
|
||||
|
||||
db->GetItems(ticket_info->item_tab, iq);
|
||||
system->CheckAccessToItems(ticket_info->item_tab);
|
||||
}
|
||||
|
||||
|
||||
void ShowTickets::ReadTickets()
|
||||
{
|
||||
// reading tickets for the files
|
||||
file_id_tab.resize(ticket_info->item_tab.size());
|
||||
|
||||
for(size_t i=0 ; i<ticket_info->item_tab.size() ; ++i)
|
||||
file_id_tab[i] = ticket_info->item_tab[i].id;
|
||||
|
||||
tdb->GetTickets(file_id_tab, ticket_info->ticket_tab);
|
||||
}
|
||||
|
||||
|
||||
void ShowTickets::CreatePointers()
|
||||
{
|
||||
// creating a pointers table
|
||||
ticket_info->item_sort_tab.resize(ticket_info->item_tab.size());
|
||||
|
||||
for(size_t i=0 ; i<ticket_info->item_tab.size() ; ++i)
|
||||
ticket_info->item_sort_tab[i] = &ticket_info->item_tab[i];
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ShowTickets::SortPointers()
|
||||
{
|
||||
int sort_type = 1;
|
||||
|
||||
if( request->PostVar(L"sort") == L"url" )
|
||||
sort_type = 0;
|
||||
|
||||
std::vector<Item*> & table = ticket_info->item_sort_tab;
|
||||
std::sort(table.begin(), table.end(), Sort(this, sort_type));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ShowTickets::MakeGet()
|
||||
{
|
||||
ticket_info->Clear();
|
||||
ticket_info->FindCurrentConf();
|
||||
|
||||
ReadFiles();
|
||||
ReadTickets();
|
||||
CreatePointers();
|
||||
SortPointers();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
58
plugins/ticket/showtickets.h
Executable file
58
plugins/ticket/showtickets.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* This file is a part of Winix
|
||||
* and is not publicly distributed
|
||||
*
|
||||
* Copyright (c) 2010, Tomasz Sowa
|
||||
* All rights reserved.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef headerfile_winix_plugins_ticket_showtickets
|
||||
#define headerfile_winix_plugins_ticket_showtickets
|
||||
|
||||
#include "tdb.h"
|
||||
#include "ticketinfo.h"
|
||||
#include "core/item.h"
|
||||
#include "functions/functionbase.h"
|
||||
|
||||
|
||||
namespace Ticket
|
||||
{
|
||||
|
||||
|
||||
class ShowTickets : public FunctionBase
|
||||
{
|
||||
public:
|
||||
|
||||
ShowTickets();
|
||||
void SetTDb(TDb * ptdb);
|
||||
void SetTicketInfo(TicketInfo * pinfo);
|
||||
|
||||
bool HasAccess();
|
||||
void MakeGet();
|
||||
|
||||
private:
|
||||
|
||||
TDb * tdb;
|
||||
TicketInfo * ticket_info;
|
||||
std::vector<long> file_id_tab;
|
||||
|
||||
void ReadFiles();
|
||||
void ReadTickets();
|
||||
void CreatePointers();
|
||||
void SortPointers();
|
||||
|
||||
struct Sort
|
||||
{
|
||||
ShowTickets * show_tickets;
|
||||
int sort_type;
|
||||
Sort(ShowTickets * show, int type) : show_tickets(show), sort_type(type) {}
|
||||
bool operator()(const Item * item1, const Item * item2);
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif
|
||||
@@ -16,8 +16,34 @@ namespace Ticket
|
||||
{
|
||||
|
||||
|
||||
bool TDb::IsTicket(long file_id)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
bool is = false;
|
||||
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
query << R("select count(*) from plugins.ticket "
|
||||
"where ticket.file_id=") << file_id << R(";");
|
||||
|
||||
r = AssertQuery(query);
|
||||
AssertResult(r, PGRES_TUPLES_OK);
|
||||
|
||||
Error TDb::GetTicket(long dir_id, Ticket & ticket)
|
||||
if( Rows(r)==1 && Cols(r)==1 )
|
||||
is = AssertValueInt(r, 0, 0) != 0;
|
||||
}
|
||||
catch(const Error &)
|
||||
{
|
||||
}
|
||||
|
||||
ClearResult(r);
|
||||
|
||||
return is;
|
||||
}
|
||||
|
||||
|
||||
Error TDb::GetTicket(long file_id, Ticket & ticket)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
Error status = WINIX_ERR_OK;
|
||||
@@ -26,8 +52,8 @@ Error TDb::GetTicket(long dir_id, Ticket & ticket)
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
query << R("select dir_id, param, value from plugins.ticket "
|
||||
"where ticket.dir_id=") << dir_id << R(";");
|
||||
query << R("select file_id, param, int_value, str_value from plugins.ticket "
|
||||
"where ticket.file_id=") << file_id << R(";");
|
||||
|
||||
r = AssertQuery(query);
|
||||
AssertResult(r, PGRES_TUPLES_OK);
|
||||
@@ -38,15 +64,18 @@ Error TDb::GetTicket(long dir_id, Ticket & ticket)
|
||||
throw Error(WINIX_ERR_NO_TICKET);
|
||||
|
||||
Ticket::TicketParam par;
|
||||
ticket.dir_id = dir_id;
|
||||
ticket.file_id = file_id;
|
||||
|
||||
int cparam = AssertColumn(r, "param");
|
||||
int cvalue = AssertColumn(r, "value");
|
||||
int cparam = AssertColumn(r, "param");
|
||||
int cintvalue = AssertColumn(r, "int_value");
|
||||
int cstrvalue = AssertColumn(r, "str_value");
|
||||
|
||||
for(int i=0 ; i<rows ; ++i)
|
||||
{
|
||||
par.param = AssertValueInt(r, i, cparam);
|
||||
par.value = AssertValueInt(r, i, cvalue);
|
||||
par.param = AssertValueInt(r, i, cparam);
|
||||
par.int_value = AssertValueLong(r, i, cintvalue);
|
||||
AssertValueWide(r, i, cstrvalue, par.str_value);
|
||||
|
||||
ticket.par_tab.push_back(par);
|
||||
}
|
||||
}
|
||||
@@ -65,21 +94,21 @@ return status;
|
||||
|
||||
|
||||
|
||||
Error TDb::GetTickets(const std::vector<long> & dir_id_tab, std::vector<Ticket> & ticket_tab)
|
||||
Error TDb::GetTickets(const std::vector<long> & file_id_tab, std::vector<Ticket> & ticket_tab)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
Error status = WINIX_ERR_OK;
|
||||
ticket_tab.clear();
|
||||
|
||||
if( dir_id_tab.empty() )
|
||||
if( file_id_tab.empty() )
|
||||
return status;
|
||||
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
CreateIdList(dir_id_tab, dir_list);
|
||||
query << R("select dir_id, param, value from plugins.ticket "
|
||||
"where ticket.dir_id in ") << R(dir_list) << R(" order by dir_id;");
|
||||
CreateIdList(file_id_tab, file_list);
|
||||
query << R("select file_id, param, int_value, str_value from plugins.ticket "
|
||||
"where ticket.file_id in ") << R(file_list) << R(" order by file_id;");
|
||||
|
||||
// !! moze dodac operator <<(std::vector(long)) do query?
|
||||
|
||||
@@ -89,24 +118,27 @@ Error TDb::GetTickets(const std::vector<long> & dir_id_tab, std::vector<Ticket>
|
||||
int rows = Rows(r);
|
||||
Ticket::TicketParam par;
|
||||
|
||||
int cdir_id = AssertColumn(r, "dir_id");
|
||||
int cparam = AssertColumn(r, "param");
|
||||
int cvalue = AssertColumn(r, "value");
|
||||
long last_dir_id = -1;
|
||||
int cfile_id = AssertColumn(r, "file_id");
|
||||
int cparam = AssertColumn(r, "param");
|
||||
int cintvalue = AssertColumn(r, "int_value");
|
||||
int cstrvalue = AssertColumn(r, "str_value");
|
||||
long last_file_id = -1;
|
||||
|
||||
for(int i=0 ; i<rows ; ++i)
|
||||
{
|
||||
long dir_id = AssertValueLong(r, i, cdir_id);
|
||||
long file_id = AssertValueLong(r, i, cfile_id);
|
||||
|
||||
if( i==0 || last_dir_id != dir_id )
|
||||
if( i==0 || last_file_id != file_id )
|
||||
{
|
||||
ticket_tab.push_back(Ticket());
|
||||
ticket_tab.back().dir_id = dir_id;
|
||||
last_dir_id = dir_id;
|
||||
ticket_tab.back().file_id = file_id;
|
||||
last_file_id = file_id;
|
||||
}
|
||||
|
||||
par.param = AssertValueInt(r, i, cparam);
|
||||
par.value = AssertValueInt(r, i, cvalue);
|
||||
par.int_value = AssertValueLong(r, i, cintvalue);
|
||||
AssertValueWide(r, i, cstrvalue, par.str_value);
|
||||
|
||||
ticket_tab.back().par_tab.push_back(par);
|
||||
}
|
||||
}
|
||||
@@ -116,7 +148,7 @@ Error TDb::GetTickets(const std::vector<long> & dir_id_tab, std::vector<Ticket>
|
||||
}
|
||||
|
||||
ClearResult(r);
|
||||
dir_list.clear();
|
||||
file_list.clear();
|
||||
|
||||
return status;
|
||||
}
|
||||
@@ -134,10 +166,11 @@ Error TDb::AddTicket(const Ticket & ticket)
|
||||
for(size_t i=0 ; i<ticket.par_tab.size() ; ++i)
|
||||
{
|
||||
query.Clear();
|
||||
query << R("insert into plugins.ticket (dir_id, param, value) values (")
|
||||
<< ticket.dir_id
|
||||
query << R("insert into plugins.ticket (file_id, param, int_value, str_value) values (")
|
||||
<< ticket.file_id
|
||||
<< ticket.par_tab[i].param
|
||||
<< ticket.par_tab[i].value
|
||||
<< ticket.par_tab[i].int_value
|
||||
<< ticket.par_tab[i].str_value
|
||||
<< R(");");
|
||||
|
||||
r = AssertQuery(query);
|
||||
@@ -164,7 +197,7 @@ Error TDb::RemoveAddTicket(const Ticket & ticket)
|
||||
if( status != WINIX_ERR_OK )
|
||||
return status;
|
||||
|
||||
status = RemoveTicket(ticket.dir_id);
|
||||
status = RemoveTicket(ticket.file_id);
|
||||
|
||||
if( status == WINIX_ERR_OK )
|
||||
status = AddTicket(ticket);
|
||||
@@ -181,7 +214,7 @@ return status;
|
||||
|
||||
|
||||
|
||||
Error TDb::RemoveTicket(long dir_id)
|
||||
Error TDb::RemoveTicket(long file_id)
|
||||
{
|
||||
PGresult * r = 0;
|
||||
Error status = WINIX_ERR_OK;
|
||||
@@ -189,7 +222,7 @@ Error TDb::RemoveTicket(long dir_id)
|
||||
try
|
||||
{
|
||||
query.Clear();
|
||||
query << R("delete from plugins.ticket where dir_id=") << dir_id << R(";");
|
||||
query << R("delete from plugins.ticket where file_id=") << file_id << R(";");
|
||||
|
||||
r = AssertQuery(query);
|
||||
AssertResult(r, PGRES_COMMAND_OK);
|
||||
|
||||
@@ -25,17 +25,18 @@ class TDb : public DbBase
|
||||
{
|
||||
public:
|
||||
|
||||
Error GetTicket(long dir_id, Ticket & ticket);
|
||||
Error GetTickets(const std::vector<long> & dir_id_tab, std::vector<Ticket> & ticket_tab);
|
||||
bool IsTicket(long file_id);
|
||||
Error GetTicket(long file_id, Ticket & ticket);
|
||||
Error GetTickets(const std::vector<long> & file_id_tab, std::vector<Ticket> & ticket_tab);
|
||||
Error AddTicket(const Ticket & ticket);
|
||||
Error RemoveAddTicket(const Ticket & ticket); // first removing and then adding a ticket
|
||||
Error RemoveTicket(long dir_id);
|
||||
Error RemoveTicket(long file_id);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
DbTextStream query;
|
||||
std::wstring dir_list;
|
||||
std::wstring file_list;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "core/plugin.h"
|
||||
#include "functions/functions.h"
|
||||
#include "templates/templates.h"
|
||||
#include "sessiondata.h"
|
||||
|
||||
|
||||
|
||||
namespace Ticket
|
||||
@@ -45,38 +47,49 @@ return percent;
|
||||
|
||||
|
||||
|
||||
void find_ticket_value(const TicketConf::TicketItem & conf_item, const Ticket & ticket, bool * has_value, int * value)
|
||||
bool find_ticket_value(const TicketConf::TicketItem & conf_item, const Ticket & ticket, size_t * ticket_par_index)
|
||||
{
|
||||
*has_value = false;
|
||||
*value = 0;
|
||||
|
||||
for(size_t a=0 ; a < ticket.par_tab.size() ; a++)
|
||||
{
|
||||
int par = ticket.par_tab[a].param;
|
||||
int val = ticket.par_tab[a].value;
|
||||
|
||||
if( par == conf_item.id )
|
||||
if( ticket.par_tab[a].param == conf_item.id )
|
||||
{
|
||||
*has_value = true;
|
||||
*value = val;
|
||||
*ticket_par_index = a;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void ticket_print_value(Info & i, size_t conf_index, int value)
|
||||
void ticket_print_value(Info & i, size_t conf_index, const Ticket::TicketParam & ticket_param)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index];
|
||||
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeInteger )
|
||||
i.out << value;
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeInteger ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeProgress )
|
||||
{
|
||||
i.out << ticket_param.int_value;
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeSelect )
|
||||
{
|
||||
if( value < (int)conf_item.select.size() )
|
||||
i.out << conf_item.select[value].name;
|
||||
if( ticket_param.int_value < (int)conf_item.select.size() )
|
||||
i.out << conf_item.select[ticket_param.int_value].name;
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeString ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeMultistring )
|
||||
{
|
||||
i.out << ticket_param.str_value;
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeImages ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeFiles )
|
||||
{
|
||||
i.out << ticket_param.str_value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,41 +97,9 @@ void ticket_print_value(Info & i, size_t conf_index, int value)
|
||||
|
||||
|
||||
|
||||
void ticket_is(Info & i)
|
||||
{
|
||||
i.res = ticket_info.is_ticket;
|
||||
}
|
||||
|
||||
|
||||
void ticket_item_subject(Info & i)
|
||||
{
|
||||
i.out << ticket_info.item.subject;
|
||||
}
|
||||
|
||||
|
||||
void ticket_item_content(Info & i)
|
||||
{
|
||||
i.out << ticket_info.item.content;
|
||||
}
|
||||
|
||||
|
||||
void ticket_item_content_type_is(Info & i)
|
||||
{
|
||||
item_content_type_is(ticket_info.item, i);
|
||||
}
|
||||
|
||||
|
||||
void ticket_item_print_content(Info & i)
|
||||
{
|
||||
item_print_content(i.out, ticket_info.item.content, ticket_info.item.content_type);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ticket_can_create(Info & i)
|
||||
{
|
||||
i.res = fun_create_ticket.HasAccess(true);
|
||||
i.res = fun_create_ticket.HasAccess();
|
||||
}
|
||||
|
||||
|
||||
@@ -133,65 +114,63 @@ void ticket_can_edit(Info & i)
|
||||
|
||||
namespace ns_tickets_tab
|
||||
{
|
||||
static size_t tickets_tab_index;
|
||||
static size_t conf_tab_index;
|
||||
static size_t item_sort_index; // index for: ticket_info.item_sort_tab
|
||||
static size_t ticket_index; // index for: ticket_info.ticket_tab
|
||||
static size_t par_index; // index for: ticket_info.ticket_tab[ticket_index].par_tab
|
||||
static size_t conf_tab_index; // index for: ticket_info.cur_conf->tab
|
||||
static bool has_ticket;
|
||||
static bool has_value;
|
||||
static int value;
|
||||
|
||||
|
||||
|
||||
void tickets_tab(Info & i)
|
||||
{
|
||||
tickets_tab_index = i.iter;
|
||||
i.res = tickets_tab_index < ticket_info.ticket_tab.size();
|
||||
}
|
||||
has_ticket = false;
|
||||
item_sort_index = i.iter;
|
||||
i.res = item_sort_index < ticket_info.item_sort_tab.size();
|
||||
|
||||
|
||||
|
||||
Item * tickets_tab_find_index_dir()
|
||||
{
|
||||
Item * dir = 0;
|
||||
|
||||
if( tickets_tab_index < ticket_info.ticket_tab.size() )
|
||||
if( i.res )
|
||||
{
|
||||
long dir_id = ticket_info.ticket_tab[tickets_tab_index].dir_id;
|
||||
dir = system->dirs.GetDir(dir_id);
|
||||
for(size_t a=0 ; a<ticket_info.ticket_tab.size() ; ++a)
|
||||
{
|
||||
if( ticket_info.ticket_tab[a].file_id == ticket_info.item_sort_tab[item_sort_index]->id )
|
||||
{
|
||||
has_ticket = true;
|
||||
ticket_index = a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tickets_tab_url(Info & i)
|
||||
{
|
||||
Item * dir = tickets_tab_find_index_dir();
|
||||
|
||||
if( dir )
|
||||
i.out << dir->url;
|
||||
if( item_sort_index < ticket_info.item_sort_tab.size() )
|
||||
i.out << ticket_info.item_sort_tab[item_sort_index]->url;
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_subject_empty(Info & i)
|
||||
{
|
||||
Item * dir = tickets_tab_find_index_dir();
|
||||
|
||||
if( dir )
|
||||
i.res = dir->subject.empty();
|
||||
if( item_sort_index < ticket_info.item_sort_tab.size() )
|
||||
i.res = ticket_info.item_sort_tab[item_sort_index]->subject.empty();
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_subject(Info & i)
|
||||
{
|
||||
Item * dir = tickets_tab_find_index_dir();
|
||||
|
||||
if( dir )
|
||||
i.out << dir->subject;
|
||||
if( item_sort_index < ticket_info.item_sort_tab.size() )
|
||||
i.out << ticket_info.item_sort_tab[item_sort_index]->subject;
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab(Info & i)
|
||||
{
|
||||
if( tickets_tab_index < ticket_info.ticket_tab.size() )
|
||||
has_value = false;
|
||||
|
||||
if( has_ticket &&
|
||||
item_sort_index < ticket_info.item_sort_tab.size() &&
|
||||
ticket_index < ticket_info.ticket_tab.size() )
|
||||
{
|
||||
conf_tab_index = i.iter;
|
||||
i.res = conf_tab_index < ticket_info.cur_conf->tab.size();
|
||||
@@ -199,37 +178,105 @@ void tickets_tab_conf_tab(Info & i)
|
||||
if( i.res )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
const Ticket & ticket = ticket_info.ticket_tab[tickets_tab_index];
|
||||
find_ticket_value(conf_item, ticket, &has_value, &value);
|
||||
const Ticket & ticket = ticket_info.ticket_tab[ticket_index];
|
||||
has_value = find_ticket_value(conf_item, ticket, &par_index);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_value(Info & i)
|
||||
{
|
||||
if( has_value )
|
||||
ticket_print_value(i, conf_tab_index, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_progress(Info & i)
|
||||
{
|
||||
if( has_value &&
|
||||
conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
item_sort_index < ticket_info.item_sort_tab.size() &&
|
||||
ticket_index < ticket_info.ticket_tab.size() &&
|
||||
par_index < ticket_info.ticket_tab[ticket_index].par_tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = IsSubString(ticket_info.progress_prefix, conf_item.name);
|
||||
ticket_print_value(i, conf_tab_index, ticket_info.ticket_tab[ticket_index].par_tab[par_index]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_integer(Info & i)
|
||||
{
|
||||
if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeInteger;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_progress(Info & i)
|
||||
{
|
||||
if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeProgress;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_select(Info & i)
|
||||
{
|
||||
if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeSelect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_string(Info & i)
|
||||
{
|
||||
if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeString;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_multistring(Info & i)
|
||||
{
|
||||
if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeMultistring;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_images(Info & i)
|
||||
{
|
||||
if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeImages;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_is_files(Info & i)
|
||||
{
|
||||
if( has_value && conf_tab_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index];
|
||||
i.res = conf_item.type == TicketConf::TicketItem::TypeFiles;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void tickets_tab_conf_tab_progress_image_number(Info & i)
|
||||
{
|
||||
if( has_value )
|
||||
i.out << ticket_calc_progress_image_number(value);
|
||||
if( has_value &&
|
||||
ticket_index < ticket_info.ticket_tab.size() &&
|
||||
par_index < ticket_info.ticket_tab[ticket_index].par_tab.size() )
|
||||
{
|
||||
int progress = ticket_info.ticket_tab[ticket_index].par_tab[par_index].int_value;
|
||||
i.out << ticket_calc_progress_image_number(progress);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -237,12 +284,17 @@ void tickets_tab_conf_tab_progress_image_number(Info & i)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
namespace ns_ticket_tab
|
||||
{
|
||||
static size_t conf_index;
|
||||
static size_t select_index;
|
||||
static size_t conf_index; // index for: ticket_info.cur_conf->tab
|
||||
static size_t select_index; // index for: ticket_info.cur_conf->tab[conf_index].select
|
||||
static size_t par_index; // index for: ticket_info.ticket->par_tab
|
||||
static size_t files_number;
|
||||
static bool has_value;
|
||||
static int value;
|
||||
|
||||
|
||||
|
||||
void ticket_tab(Info & i)
|
||||
@@ -253,11 +305,12 @@ void ticket_tab(Info & i)
|
||||
if( i.res )
|
||||
{
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index];
|
||||
find_ticket_value(conf_item, ticket_info.ticket, &has_value, &value);
|
||||
has_value = find_ticket_value(conf_item, *ticket_info.ticket, &par_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ticket_tab_param(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
@@ -267,8 +320,8 @@ void ticket_tab_param(Info & i)
|
||||
|
||||
void ticket_tab_value(Info & i)
|
||||
{
|
||||
if( has_value )
|
||||
ticket_print_value(i, conf_index, value);
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
ticket_print_value(i, conf_index, ticket_info.ticket->par_tab[par_index]);
|
||||
}
|
||||
|
||||
|
||||
@@ -280,13 +333,33 @@ void ticket_tab_param_index(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_value_index(Info & i)
|
||||
void ticket_tab_int_value_index(Info & i)
|
||||
{
|
||||
if( has_value )
|
||||
i.out << value;
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
i.out << ticket_info.ticket->par_tab[par_index].int_value;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_str_value_index(Info & i)
|
||||
{
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
i.out << ticket_info.ticket->par_tab[par_index].str_value;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_integer(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeInteger;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_progress(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeProgress;
|
||||
}
|
||||
|
||||
void ticket_tab_is_select(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
@@ -294,10 +367,31 @@ void ticket_tab_is_select(Info & i)
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_integer(Info & i)
|
||||
void ticket_tab_is_string(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeInteger;
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeString;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_multistring(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeMultistring;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_images(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeImages;
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_is_files(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() )
|
||||
i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeFiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -311,15 +405,17 @@ void ticket_tab_select_tab(Info & i)
|
||||
}
|
||||
|
||||
|
||||
// !! zmienic nazwe na cos w stylu should_be_selected
|
||||
// bo to nie tylko odczytuje nazwe z konfiga
|
||||
void ticket_tab_select_tab_is_default(Info & i)
|
||||
{
|
||||
if( has_value )
|
||||
if( has_value && par_index < ticket_info.ticket->par_tab.size() )
|
||||
{
|
||||
i.res = select_index == (size_t)value;
|
||||
i.res = select_index == (size_t)ticket_info.ticket->par_tab[par_index].int_value;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
select_index < ticket_info.cur_conf->tab[conf_index].select.size() )
|
||||
{
|
||||
i.res = select_index == ticket_info.cur_conf->tab[conf_index].select_default;
|
||||
@@ -330,7 +426,7 @@ void ticket_tab_select_tab_is_default(Info & i)
|
||||
|
||||
void ticket_tab_select_tab_name(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
select_index < ticket_info.cur_conf->tab[conf_index].select.size() )
|
||||
{
|
||||
i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].name;
|
||||
@@ -340,7 +436,7 @@ void ticket_tab_select_tab_name(Info & i)
|
||||
|
||||
void ticket_tab_select_tab_id(Info & i)
|
||||
{
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
if( conf_index < ticket_info.cur_conf->tab.size() &&
|
||||
select_index < ticket_info.cur_conf->tab[conf_index].select.size() )
|
||||
{
|
||||
i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].id;
|
||||
@@ -348,6 +444,49 @@ void ticket_tab_select_tab_id(Info & i)
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void ticket_tab_files_tab(Info & i)
|
||||
{
|
||||
files_number = i.iter;
|
||||
|
||||
if( has_value && conf_index < ticket_info.cur_conf->tab.size() )
|
||||
{
|
||||
if( i.iter == 0 )
|
||||
{
|
||||
// first iteration, we are using the par_index found by previous call to ticket_tab
|
||||
i.res = true;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// next iteration, we are looking for the next par_index
|
||||
const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index];
|
||||
|
||||
for(++par_index ; par_index < ticket_info.ticket->par_tab.size() ; ++par_index)
|
||||
{
|
||||
if( ticket_info.ticket->par_tab[par_index].param == conf_item.id )
|
||||
{
|
||||
i.res = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// there are no more such items
|
||||
has_value = false;
|
||||
i.res = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ticket_tab_files_tab_index(Info & i)
|
||||
{
|
||||
i.out << files_number;
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace ns_ticket_tab
|
||||
|
||||
|
||||
@@ -362,94 +501,52 @@ using namespace ns_ticket_tab;
|
||||
using TemplatesFunctions::EzcFun;
|
||||
EzcFun * fun = reinterpret_cast<EzcFun*>(info.p1);
|
||||
|
||||
fun->Insert("ticket_is", ticket_is);
|
||||
fun->Insert("ticket_item_subject", ticket_item_subject);
|
||||
fun->Insert("ticket_item_content", ticket_item_content);
|
||||
fun->Insert("ticket_item_content_type_is", ticket_item_content_type_is);
|
||||
fun->Insert("ticket_item_print_content", ticket_item_print_content);
|
||||
fun->Insert("ticket_can_create", ticket_can_create);
|
||||
fun->Insert("ticket_can_edit", ticket_can_edit);
|
||||
|
||||
fun->Insert("tickets_tab", tickets_tab);
|
||||
fun->Insert("tickets_tab_url", tickets_tab_url);
|
||||
fun->Insert("tickets_tab_subject_empty", tickets_tab_subject_empty);
|
||||
fun->Insert("tickets_tab_subject", tickets_tab_subject);
|
||||
fun->Insert("tickets_tab_url", tickets_tab_url);
|
||||
fun->Insert("ticket_can_create", ticket_can_create);
|
||||
fun->Insert("ticket_can_edit", ticket_can_edit);
|
||||
|
||||
fun->Insert("tickets_tab", tickets_tab);
|
||||
fun->Insert("tickets_tab_url", tickets_tab_url);
|
||||
fun->Insert("tickets_tab_subject_empty", tickets_tab_subject_empty);
|
||||
fun->Insert("tickets_tab_subject", tickets_tab_subject);
|
||||
fun->Insert("tickets_tab_url", tickets_tab_url);
|
||||
|
||||
fun->Insert("tickets_tab_conf_tab", tickets_tab_conf_tab);
|
||||
fun->Insert("tickets_tab_conf_tab", tickets_tab_conf_tab);
|
||||
fun->Insert("tickets_tab_conf_tab_value", tickets_tab_conf_tab_value);
|
||||
fun->Insert("tickets_tab_conf_tab_is_progress", tickets_tab_conf_tab_is_progress);
|
||||
fun->Insert("tickets_tab_conf_tab_progress_image_number", tickets_tab_conf_tab_progress_image_number);
|
||||
|
||||
fun->Insert("tickets_tab_conf_tab_is_integer", tickets_tab_conf_tab_is_integer);
|
||||
fun->Insert("tickets_tab_conf_tab_is_progress", tickets_tab_conf_tab_is_progress);
|
||||
fun->Insert("tickets_tab_conf_tab_is_select", tickets_tab_conf_tab_is_select);
|
||||
fun->Insert("tickets_tab_conf_tab_is_string", tickets_tab_conf_tab_is_string);
|
||||
fun->Insert("tickets_tab_conf_tab_is_multistring", tickets_tab_conf_tab_is_multistring);
|
||||
fun->Insert("tickets_tab_conf_tab_is_images", tickets_tab_conf_tab_is_images);
|
||||
fun->Insert("tickets_tab_conf_tab_is_files", tickets_tab_conf_tab_is_files);
|
||||
fun->Insert("tickets_tab_conf_tab_progress_image_number", tickets_tab_conf_tab_progress_image_number);
|
||||
|
||||
|
||||
fun->Insert("ticket_tab", ticket_tab);
|
||||
fun->Insert("ticket_tab_param", ticket_tab_param);
|
||||
fun->Insert("ticket_tab_value", ticket_tab_value);
|
||||
fun->Insert("ticket_tab_param_index", ticket_tab_param_index);
|
||||
fun->Insert("ticket_tab_value_index", ticket_tab_value_index);
|
||||
|
||||
fun->Insert("ticket_tab_is_select", ticket_tab_is_select);
|
||||
fun->Insert("ticket_tab_is_integer", ticket_tab_is_integer);
|
||||
fun->Insert("ticket_tab", ticket_tab);
|
||||
|
||||
fun->Insert("ticket_tab_select_tab", ticket_tab_select_tab);
|
||||
fun->Insert("ticket_tab_param", ticket_tab_param);
|
||||
fun->Insert("ticket_tab_value", ticket_tab_value);
|
||||
fun->Insert("ticket_tab_param_index", ticket_tab_param_index);
|
||||
fun->Insert("ticket_tab_int_value_index", ticket_tab_int_value_index);
|
||||
fun->Insert("ticket_tab_str_value_index", ticket_tab_str_value_index);
|
||||
|
||||
fun->Insert("ticket_tab_is_integer", ticket_tab_is_integer);
|
||||
fun->Insert("ticket_tab_is_progress", ticket_tab_is_progress);
|
||||
fun->Insert("ticket_tab_is_select", ticket_tab_is_select);
|
||||
fun->Insert("ticket_tab_is_string", ticket_tab_is_string);
|
||||
fun->Insert("ticket_tab_is_multistring", ticket_tab_is_multistring);
|
||||
fun->Insert("ticket_tab_is_images", ticket_tab_is_images);
|
||||
fun->Insert("ticket_tab_is_files", ticket_tab_is_files);
|
||||
|
||||
fun->Insert("ticket_tab_select_tab", ticket_tab_select_tab);
|
||||
fun->Insert("ticket_tab_select_tab_is_default", ticket_tab_select_tab_is_default);
|
||||
fun->Insert("ticket_tab_select_tab_id", ticket_tab_select_tab_id);
|
||||
fun->Insert("ticket_tab_select_tab_name", ticket_tab_select_tab_name);
|
||||
fun->Insert("ticket_tab_select_tab_id", ticket_tab_select_tab_id);
|
||||
fun->Insert("ticket_tab_select_tab_name", ticket_tab_select_tab_name);
|
||||
|
||||
|
||||
/*
|
||||
fun->Insert("ticket_type", ticket_type);
|
||||
fun->Insert("ticket_status", ticket_status);
|
||||
fun->Insert("ticket_priority", ticket_priority);
|
||||
fun->Insert("ticket_category", ticket_category);
|
||||
fun->Insert("ticket_expected", ticket_expected);
|
||||
fun->Insert("ticket_progress", ticket_progress);
|
||||
fun->Insert("ticket_progress_image_number", ticket_progress_image_number);
|
||||
|
||||
fun->Insert("ticket_tab", ticket_tab);
|
||||
fun->Insert("ticket_tab_url", ticket_tab_url);
|
||||
fun->Insert("ticket_tab_subject", ticket_tab_subject);
|
||||
fun->Insert("ticket_tab_subject_empty", ticket_tab_subject_empty);
|
||||
fun->Insert("ticket_tab_author", ticket_tab_author);
|
||||
fun->Insert("ticket_tab_type", ticket_tab_type);
|
||||
fun->Insert("ticket_tab_status", ticket_tab_status);
|
||||
fun->Insert("ticket_tab_priority", ticket_tab_priority);
|
||||
fun->Insert("ticket_tab_category", ticket_tab_category);
|
||||
fun->Insert("ticket_tab_expected", ticket_tab_expected);
|
||||
fun->Insert("ticket_tab_progress", ticket_tab_progress);
|
||||
fun->Insert("ticket_tab_progress_image_number",ticket_tab_progress_image_number);
|
||||
|
||||
fun->Insert("ticket_type_tab", ticket_type_tab);
|
||||
fun->Insert("ticket_type_tab_defined", ticket_type_tab_defined);
|
||||
fun->Insert("ticket_type_tab_isdefault", ticket_type_tab_isdefault);
|
||||
fun->Insert("ticket_type_tab_index", ticket_type_tab_index);
|
||||
fun->Insert("ticket_type_tab_name", ticket_type_tab_name);
|
||||
|
||||
fun->Insert("ticket_status_tab", ticket_status_tab);
|
||||
fun->Insert("ticket_status_tab_defined", ticket_status_tab_defined);
|
||||
fun->Insert("ticket_status_tab_isdefault", ticket_status_tab_isdefault);
|
||||
fun->Insert("ticket_status_tab_index", ticket_status_tab_index);
|
||||
fun->Insert("ticket_status_tab_name", ticket_status_tab_name);
|
||||
|
||||
fun->Insert("ticket_priority_tab", ticket_priority_tab);
|
||||
fun->Insert("ticket_priority_tab_defined", ticket_priority_tab_defined);
|
||||
fun->Insert("ticket_priority_tab_isdefault", ticket_priority_tab_isdefault);
|
||||
fun->Insert("ticket_priority_tab_index", ticket_priority_tab_index);
|
||||
fun->Insert("ticket_priority_tab_name", ticket_priority_tab_name);
|
||||
|
||||
fun->Insert("ticket_category_tab", ticket_category_tab);
|
||||
fun->Insert("ticket_category_tab_defined", ticket_category_tab_defined);
|
||||
fun->Insert("ticket_category_tab_isdefault", ticket_category_tab_isdefault);
|
||||
fun->Insert("ticket_category_tab_index", ticket_category_tab_index);
|
||||
fun->Insert("ticket_category_tab_name", ticket_category_tab_name);
|
||||
|
||||
fun->Insert("ticket_expected_tab", ticket_expected_tab);
|
||||
fun->Insert("ticket_expected_tab_defined", ticket_expected_tab_defined);
|
||||
fun->Insert("ticket_expected_tab_isdefault", ticket_expected_tab_isdefault);
|
||||
fun->Insert("ticket_expected_tab_index", ticket_expected_tab_index);
|
||||
fun->Insert("ticket_expected_tab_name", ticket_expected_tab_name);
|
||||
*/
|
||||
fun->Insert("ticket_tab_files_tab", ticket_tab_files_tab);
|
||||
fun->Insert("ticket_tab_files_tab_index", ticket_tab_files_tab_index);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#define headerfile_winix_plugins_ticket_ticket
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Ticket
|
||||
@@ -21,16 +21,25 @@ struct Ticket
|
||||
{
|
||||
struct TicketParam
|
||||
{
|
||||
int param;
|
||||
int value;
|
||||
long file_id;
|
||||
int param;
|
||||
long int_value; // changed to long (from int)
|
||||
std::wstring str_value;
|
||||
|
||||
void Clear()
|
||||
{
|
||||
// !! what about file_id?
|
||||
param = 0;
|
||||
int_value = 0;
|
||||
str_value.clear();
|
||||
}
|
||||
|
||||
TicketParam()
|
||||
{
|
||||
param = value = 0;
|
||||
Clear();
|
||||
}
|
||||
};
|
||||
|
||||
long dir_id;
|
||||
std::vector<TicketParam> par_tab;
|
||||
|
||||
// auxiliary object used during sorting
|
||||
@@ -38,7 +47,7 @@ struct Ticket
|
||||
|
||||
void Clear()
|
||||
{
|
||||
dir_id = -1;
|
||||
file_id = -1;
|
||||
par_tab.clear();
|
||||
sort_id = 0;
|
||||
}
|
||||
|
||||
@@ -13,8 +13,10 @@ void TicketConf::TicketItem::Clear()
|
||||
id = 0;
|
||||
name.clear();
|
||||
type = TypeInteger;
|
||||
integer_min = std::numeric_limits<int>::min();
|
||||
integer_max = std::numeric_limits<int>::max();
|
||||
integer_min = std::numeric_limits<long>::min();
|
||||
integer_max = std::numeric_limits<long>::max();
|
||||
max_files = 0;
|
||||
upload_dir.clear();
|
||||
select.clear();
|
||||
select_default = 0;
|
||||
}
|
||||
|
||||
@@ -17,23 +17,27 @@ struct TicketConf
|
||||
int id;
|
||||
};
|
||||
|
||||
|
||||
TicketItem();
|
||||
void Clear();
|
||||
|
||||
enum Type { TypeInteger, TypeSelect };
|
||||
enum Type { TypeInteger, TypeProgress, TypeSelect, TypeString, TypeMultistring, TypeImages, TypeFiles };
|
||||
|
||||
int id;
|
||||
|
||||
std::wstring name;
|
||||
Type type;
|
||||
|
||||
// used when type is TypeInteger
|
||||
// used when type is TypeInteger or TypeProgress
|
||||
int integer_min, integer_max;
|
||||
|
||||
// used when type is TypeSelect
|
||||
std::vector<Select> select;
|
||||
size_t select_default;
|
||||
|
||||
// used when type is TypeImages or TypeFiles
|
||||
// 0 - unlimited
|
||||
int max_files;
|
||||
std::wstring upload_dir;
|
||||
};
|
||||
|
||||
typedef std::vector<TicketItem> Table;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "core/error.h"
|
||||
#include "core/log.h"
|
||||
#include "core/misc.h"
|
||||
|
||||
#include "sessiondata.h"
|
||||
|
||||
|
||||
namespace Ticket
|
||||
@@ -39,6 +39,12 @@ void TicketInfo::SetDb(Db * pdb)
|
||||
}
|
||||
|
||||
|
||||
void TicketInfo::SetConfig(Config * pconfig)
|
||||
{
|
||||
config = pconfig;
|
||||
}
|
||||
|
||||
|
||||
void TicketInfo::SetSystem(System * psystem)
|
||||
{
|
||||
system = psystem;
|
||||
@@ -51,45 +57,24 @@ void TicketInfo::SetRequest(Request * prequest)
|
||||
}
|
||||
|
||||
|
||||
void TicketInfo::SetFunctions(Functions * pfunctions)
|
||||
{
|
||||
functions = pfunctions;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TicketInfo::Clear()
|
||||
{
|
||||
item.Clear();
|
||||
is_ticket = false;
|
||||
ticket.Clear();
|
||||
ticket = &ticket_empty;
|
||||
ticket_tab.clear();
|
||||
|
||||
cur_conf_wrap = &cur_conf_wrap_empty;
|
||||
cur_conf = &cur_conf_empty;
|
||||
}
|
||||
cur_conf = &cur_conf_empty;
|
||||
|
||||
|
||||
void TicketInfo::ReadTicket(long dir_id)
|
||||
{
|
||||
if( tdb->GetTicket(dir_id, ticket) == WINIX_ERR_OK )
|
||||
{
|
||||
is_ticket = true;
|
||||
//db->GetItemById(ticket.item_id, item);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TicketInfo::SortTicketsFun(const Ticket & t1, const Ticket & t2)
|
||||
{
|
||||
return t1.sort_id > t2.sort_id;
|
||||
}
|
||||
|
||||
|
||||
void TicketInfo::SortTickets()
|
||||
{
|
||||
std::vector<Ticket>::iterator i;
|
||||
|
||||
for(i=ticket_tab.begin() ; i!=ticket_tab.end() ; ++i)
|
||||
{
|
||||
Item * dir = system->dirs.GetDir(i->dir_id);
|
||||
i->sort_id = ( dir ) ? (unsigned long)Time(dir->date_creation) : 0;
|
||||
}
|
||||
|
||||
std::sort(ticket_tab.begin(), ticket_tab.end(), SortTicketsFun);
|
||||
item_tab.clear();
|
||||
ticket_tab.clear();
|
||||
item_sort_tab.clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -126,25 +111,11 @@ void TicketInfo::DeleteAllMarkedConf()
|
||||
|
||||
bool TicketInfo::GetConfContent(const std::wstring & path)
|
||||
{
|
||||
long path_dir_id;
|
||||
int status = system->FollowAllLinks(path, config_dir_tab, config_file, false, false, false);
|
||||
|
||||
if( system->dirs.AnalyzePath(path, path_dir_id, path_dir, path_file) != 0 )
|
||||
if( status != 1 )
|
||||
{
|
||||
log << log1 << "Ticket: there is no file: " << path << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
Error err = db->GetItem(path_dir_id, path_file, item_conf);
|
||||
|
||||
if( err == WINIX_ERR_NO_ITEM )
|
||||
{
|
||||
log << log1 << "Ticket: there is no file: " << path << " in the database" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
if( err != WINIX_ERR_OK )
|
||||
{
|
||||
log << log1 << "Ticket: db problem with fetching: " << path << logend;
|
||||
log << log1 << "Ticket: problem with reading a config file: " << path << ", status: " << status << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -156,7 +127,7 @@ bool TicketInfo::ParseTicketConf(long mount_dir_id, const std::wstring & path)
|
||||
{
|
||||
log << log3 << "Ticket: parsing conf file: " << path << logend;
|
||||
|
||||
int code = ticket_parser.Parse(item_conf.content, conf_tab[mount_dir_id].conf);
|
||||
int code = ticket_parser.Parse(config_file.content, conf_tab[mount_dir_id].conf);
|
||||
conf_tab[mount_dir_id].file_name = path;
|
||||
|
||||
return code == WINIX_TICKET_ERR_OK;
|
||||
@@ -218,39 +189,86 @@ void TicketInfo::FindCurrentConf()
|
||||
return;
|
||||
|
||||
long dir_id = system->mounts.pmount->dir_id;
|
||||
|
||||
ConfTab::iterator i = conf_tab.find(dir_id);
|
||||
|
||||
if( i != conf_tab.end() )
|
||||
{
|
||||
cur_conf_wrap = &i->second;
|
||||
cur_conf = &i->second.conf;
|
||||
cur_conf = &i->second.conf;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Ticket: there is no ticket_conf parameter in the mount point (an empty used)" << logend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TicketInfo::CheckMinMaxValue(const TicketConf::TicketItem & ticket_item, Ticket::TicketParam & par)
|
||||
{
|
||||
if( ticket_item.type == TicketConf::TicketItem::TypeInteger )
|
||||
{
|
||||
if( par.value < ticket_item.integer_min )
|
||||
par.value = ticket_item.integer_min;
|
||||
|
||||
if( par.value > ticket_item.integer_max )
|
||||
par.value = ticket_item.integer_max;
|
||||
void TicketInfo::CheckMinMaxValue(const TicketConf::TicketItem & conf_item, Ticket::TicketParam & par)
|
||||
{
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeInteger ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeProgress )
|
||||
{
|
||||
if( par.int_value < conf_item.integer_min )
|
||||
par.int_value = conf_item.integer_min;
|
||||
|
||||
if( par.int_value > conf_item.integer_max )
|
||||
par.int_value = conf_item.integer_max;
|
||||
}
|
||||
else
|
||||
if( ticket_item.type == TicketConf::TicketItem::TypeSelect )
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeSelect )
|
||||
{
|
||||
for(size_t a=0 ; a<ticket_item.select.size() ; ++a)
|
||||
for(size_t a=0 ; a<conf_item.select.size() ; ++a)
|
||||
{
|
||||
if( ticket_item.select[a].id == par.value )
|
||||
return true;
|
||||
if( conf_item.select[a].id == par.int_value )
|
||||
return;
|
||||
}
|
||||
|
||||
log << log1 << "Ticket: incorrect select's value, param: "
|
||||
<< par.param << ", value: " << par.value << " (ignored)" << logend;
|
||||
if( conf_item.select_default < conf_item.select.size() )
|
||||
par.int_value = conf_item.select[conf_item.select_default].id;
|
||||
else
|
||||
par.int_value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool TicketInfo::ReadTicketValue(const TicketConf::TicketItem & conf_item, Ticket::TicketParam & par, const std::wstring & value)
|
||||
{
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeInteger ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeProgress ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeSelect )
|
||||
{
|
||||
par.int_value = Tol(value);
|
||||
par.str_value.clear();
|
||||
CheckMinMaxValue(conf_item, par);
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeString ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeMultistring )
|
||||
{
|
||||
par.int_value = 0;
|
||||
par.str_value = value;
|
||||
}
|
||||
else
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeImages ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeFiles )
|
||||
{
|
||||
if( !value.empty() )
|
||||
{
|
||||
log << log1 << "Ticket: images or files should be added only by a specific html tag (ignored)" << logend;
|
||||
}
|
||||
else
|
||||
{
|
||||
// an empty field from the html form
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Ticket: incorrect parameter, param: " << par.param << ", value: " << value << " (ignored)" << logend;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -258,43 +276,154 @@ return true;
|
||||
}
|
||||
|
||||
|
||||
bool TicketInfo::CheckMinMaxValue(Ticket::TicketParam & par)
|
||||
// file_map can be null
|
||||
bool TicketInfo::ReadTicketValue(const TicketConf::TicketItem & conf_item,
|
||||
Ticket::TicketParam & par, const PostFile & value, std::vector<long> * file_map)
|
||||
{
|
||||
for(size_t i=0 ; i<cur_conf->tab.size() ; ++i)
|
||||
bool add = false;
|
||||
|
||||
if( conf_item.type == TicketConf::TicketItem::TypeImages ||
|
||||
conf_item.type == TicketConf::TicketItem::TypeFiles )
|
||||
{
|
||||
if( par.param == cur_conf->tab[i].id )
|
||||
return CheckMinMaxValue(cur_conf->tab[i], par);
|
||||
Item * upload_dir = system->dirs.GetDir(conf_item.upload_dir);
|
||||
|
||||
if( upload_dir )
|
||||
{
|
||||
file.Clear(); // clearing and setting date
|
||||
file.parent_id = upload_dir->id;
|
||||
file.type = Item::file;
|
||||
file.privileges = 0644; // !! tymczasowo
|
||||
file.file_type = SelectFileType(value.filename);
|
||||
file.url = value.filename;
|
||||
functions->PrepareUrl(file);
|
||||
functions->SetUser(file);
|
||||
functions->fun_upload.UploadFile(file, value.tmp_filename);
|
||||
|
||||
if( request->status == WINIX_ERR_OK )
|
||||
{
|
||||
add = true;
|
||||
system->MakePath(file, par.str_value);
|
||||
|
||||
if( file_map )
|
||||
file_map->push_back(file.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Ticket: problem with uploading" << logend;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log << log1 << "Ticket: there is no upload dir: " << conf_item.upload_dir << logend;
|
||||
}
|
||||
}
|
||||
|
||||
log << log1 << "Ticket: unknown param: " << par.param << " (ignored)" << logend;
|
||||
if( !add )
|
||||
log << log1 << "Ticket: file parameter, param: " << par.param << " ignored" << logend;
|
||||
|
||||
return false;
|
||||
return add;
|
||||
}
|
||||
|
||||
|
||||
void TicketInfo::ReadTicketParams()
|
||||
|
||||
|
||||
// if the ticket has param_id already then the parameter is changed
|
||||
// if no then it is added
|
||||
void TicketInfo::ReadTicketParam(Ticket & ticket, int param_id, const std::wstring & value)
|
||||
{
|
||||
bool exists = false;
|
||||
|
||||
ticket_param.Clear();
|
||||
|
||||
for(size_t i=0 ; i<cur_conf->tab.size() ; ++i)
|
||||
{
|
||||
if( param_id == cur_conf->tab[i].id )
|
||||
{
|
||||
for(size_t i2=0 ; i2<ticket.par_tab.size() ; ++i2)
|
||||
{
|
||||
if( ticket.par_tab[i2].param == param_id )
|
||||
{
|
||||
// parameter exists
|
||||
exists = true;
|
||||
ticket_param.param = param_id;
|
||||
|
||||
if( ReadTicketValue(cur_conf->tab[i], ticket_param, value) )
|
||||
ticket.par_tab[i2] = ticket_param;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !exists )
|
||||
{
|
||||
// adding a new parameter
|
||||
exists = true;
|
||||
ticket_param.param = param_id;
|
||||
|
||||
if( ReadTicketValue(cur_conf->tab[i], ticket_param, value) )
|
||||
ticket.par_tab.push_back(ticket_param);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !exists )
|
||||
log << log1 << "Ticket: skipped incorrect parameter: " << param_id << " (not defined in the config)" << logend;
|
||||
}
|
||||
|
||||
|
||||
// always adds a new parameter
|
||||
// file_map can be null
|
||||
void TicketInfo::ReadTicketParam(Ticket & ticket, int param_id, const PostFile & value, std::vector<long> * file_map)
|
||||
{
|
||||
bool exists = false;
|
||||
|
||||
ticket_param.Clear();
|
||||
|
||||
for(size_t i=0 ; i<cur_conf->tab.size() ; ++i)
|
||||
{
|
||||
if( param_id == cur_conf->tab[i].id )
|
||||
{
|
||||
exists = true;
|
||||
ticket_param.param = param_id;
|
||||
|
||||
if( ReadTicketValue(cur_conf->tab[i], ticket_param , value, file_map) )
|
||||
ticket.par_tab.push_back(ticket_param);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( !exists )
|
||||
log << log1 << "Ticket: skipped incorrect parameter: " << param_id << " (not defined in the config)" << logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TicketInfo::ReadTicketParams(Ticket & ticket, bool clear_ticket, std::vector<long> * file_map)
|
||||
{
|
||||
PostTab::iterator i;
|
||||
const wchar_t parstr[] = L"ticketparam"; // !! dodac do konfiga? i szablony tez niech bior<6F> z konfiga
|
||||
size_t parlen = sizeof(parstr) / sizeof(wchar_t) - 1;
|
||||
Ticket::TicketParam param;
|
||||
PostFileTab::iterator i2;
|
||||
|
||||
ticket.par_tab.clear();
|
||||
if( clear_ticket )
|
||||
ticket.Clear();
|
||||
|
||||
for(i=request->post_tab.begin() ; i!=request->post_tab.end() ; ++i)
|
||||
{
|
||||
if( IsSubString(parstr, i->first.c_str()) )
|
||||
{
|
||||
param.param = Toi(i->first.c_str() + parlen);
|
||||
param.value = Toi(i->second);
|
||||
if( IsSubString(config->ticket_form_prefix, i->first) )
|
||||
ReadTicketParam(ticket, Toi(i->first.c_str() + config->ticket_form_prefix.size()), i->second);
|
||||
}
|
||||
|
||||
if( CheckMinMaxValue(param) )
|
||||
ticket.par_tab.push_back(param);
|
||||
}
|
||||
for(i2=request->post_file_tab.begin() ; i2!=request->post_file_tab.end() ; ++i2)
|
||||
{
|
||||
if( IsSubString(config->ticket_form_prefix, i2->first) )
|
||||
ReadTicketParam(ticket, Toi(i2->first.c_str() + config->ticket_form_prefix.size()), i2->second, file_map);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
#include "ticketparser.h"
|
||||
#include "core/item.h"
|
||||
#include "core/system.h"
|
||||
#include "functions/functions.h"
|
||||
#include "db/db.h"
|
||||
#include "tdb.h"
|
||||
|
||||
|
||||
|
||||
namespace Ticket
|
||||
{
|
||||
|
||||
@@ -46,48 +46,42 @@ public:
|
||||
|
||||
void SetTDb(TDb * ptdb);
|
||||
void SetDb(Db * pdb);
|
||||
void SetConfig(Config * pconfig);
|
||||
void SetSystem(System * psystem);
|
||||
void SetRequest(Request * prequest);
|
||||
void SetFunctions(Functions * pfunctions);
|
||||
|
||||
void Clear();
|
||||
void ReadTicket(long dir_id);
|
||||
void SortTickets();
|
||||
|
||||
Item item;
|
||||
bool is_ticket;
|
||||
Ticket ticket;
|
||||
// current ticket for templates
|
||||
const Ticket * ticket;
|
||||
|
||||
// for displaying all tickets in a directory
|
||||
std::vector<Item> item_tab;
|
||||
std::vector<Ticket> ticket_tab;
|
||||
|
||||
std::vector<Item*> item_sort_tab;
|
||||
|
||||
|
||||
// <dir_id, TicketConfWrap>
|
||||
typedef std::map<long, TicketConfWrap> ConfTab;
|
||||
ConfTab conf_tab;
|
||||
|
||||
// used by templates
|
||||
// will not be null
|
||||
// current ticket config
|
||||
// will be set by FindCurrentConf()
|
||||
const TicketConfWrap * cur_conf_wrap;
|
||||
const TicketConf * cur_conf;
|
||||
const TicketConf * cur_conf;
|
||||
|
||||
// default: "progress"
|
||||
// can be set in config in option: ticket_form_progress_prefix
|
||||
std::wstring progress_prefix;
|
||||
|
||||
int mount_type_ticket;
|
||||
// ticket plugin id
|
||||
int plugin_id;
|
||||
|
||||
int mount_par_ticket;
|
||||
|
||||
int mount_type_ticket;
|
||||
int mount_par_ticket_conf;
|
||||
|
||||
int mount_par_ticket_type;
|
||||
int mount_par_ticket_type_default;
|
||||
int mount_par_ticket_status;
|
||||
int mount_par_ticket_status_default;
|
||||
int mount_par_ticket_priority;
|
||||
int mount_par_ticket_priority_default;
|
||||
int mount_par_ticket_category;
|
||||
int mount_par_ticket_category_default;
|
||||
int mount_par_ticket_expected;
|
||||
int mount_par_ticket_expected_default;
|
||||
|
||||
int mount_par_createticket_on;
|
||||
|
||||
// template index for notifications
|
||||
size_t template_index;
|
||||
@@ -95,32 +89,47 @@ public:
|
||||
|
||||
void ReadTicketConf(bool skip_existing_configs = false);
|
||||
void FindCurrentConf();
|
||||
bool CheckMinMaxValue(const TicketConf::TicketItem & ticket_item, Ticket::TicketParam & par);
|
||||
bool CheckMinMaxValue(Ticket::TicketParam & par);
|
||||
void ReadTicketParams();
|
||||
void CheckMinMaxValue(const TicketConf::TicketItem & conf_item, Ticket::TicketParam & par);
|
||||
void ReadTicketParams(Ticket & ticket, bool clear_ticket = true, std::vector<long> * file_map = 0);
|
||||
|
||||
private:
|
||||
TDb * tdb;
|
||||
Db * db;
|
||||
System * system;
|
||||
Request * request;
|
||||
|
||||
Db * db;
|
||||
TDb * tdb;
|
||||
Config * config;
|
||||
System * system;
|
||||
Request * request;
|
||||
Functions * functions;
|
||||
|
||||
// for reading parameters
|
||||
Ticket::TicketParam ticket_param;
|
||||
|
||||
// for adding a new image/file to a ticket
|
||||
Item file;
|
||||
|
||||
// for reading config file
|
||||
TicketParser ticket_parser;
|
||||
Item item_conf;
|
||||
std::wstring path_dir;
|
||||
std::wstring path_file;
|
||||
std::vector<Item*> config_dir_tab;
|
||||
Item config_file;
|
||||
|
||||
// for cur_conf_wrap and cur_conf
|
||||
// for Clearing
|
||||
// (we don't want to use empty pointers)
|
||||
const TicketConfWrap cur_conf_wrap_empty;
|
||||
const TicketConf cur_conf_empty;
|
||||
const TicketConf cur_conf_empty;
|
||||
const Ticket ticket_empty;
|
||||
|
||||
|
||||
static bool SortTicketsFun(const Ticket & t1, const Ticket & t2);
|
||||
bool GetConfContent(const std::wstring & path);
|
||||
bool ParseTicketConf(long mount_dir_id, const std::wstring & path);
|
||||
void ReadTicketConf(Mounts & mounts, bool skip_existing_configs);
|
||||
void MarkAllConfToDelete();
|
||||
void DeleteAllMarkedConf();
|
||||
|
||||
|
||||
bool ReadTicketValue(const TicketConf::TicketItem & conf_item, Ticket::TicketParam & par, const std::wstring & value);
|
||||
bool ReadTicketValue(const TicketConf::TicketItem & conf_item, Ticket::TicketParam & par, const PostFile & value, std::vector<long> * file_map);
|
||||
void ReadTicketParam(Ticket & ticket, int param_id, const std::wstring & value);
|
||||
void ReadTicketParam(Ticket & ticket, int param_id, const PostFile & value, std::vector<long> * file_map);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
#include "ticketparser.h"
|
||||
#include "core/log.h"
|
||||
#include "core/misc.h"
|
||||
|
||||
|
||||
|
||||
|
||||
bool TicketParser::IsWhite(int c)
|
||||
@@ -121,9 +124,21 @@ bool TicketParser::ReadItemType()
|
||||
if( type == L"integer" )
|
||||
item.type = TicketConf::TicketItem::TypeInteger;
|
||||
else
|
||||
if( type == L"progress" )
|
||||
item.type = TicketConf::TicketItem::TypeProgress;
|
||||
else
|
||||
if( type == L"select" )
|
||||
item.type = TicketConf::TicketItem::TypeSelect;
|
||||
else
|
||||
if( type == L"string" )
|
||||
item.type = TicketConf::TicketItem::TypeString;
|
||||
else
|
||||
if( type == L"images" )
|
||||
item.type = TicketConf::TicketItem::TypeImages;
|
||||
else
|
||||
if( type == L"files" )
|
||||
item.type = TicketConf::TicketItem::TypeFiles;
|
||||
else
|
||||
{
|
||||
error = WINIX_TICKET_ERR_UKNOWN_TYPE;
|
||||
return false;
|
||||
@@ -194,6 +209,30 @@ bool def;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::ReadItemString()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
bool TicketParser::ReadItemFiles()
|
||||
{
|
||||
ReadText(item.upload_dir);
|
||||
|
||||
if( item.upload_dir.empty() )
|
||||
{
|
||||
error = WINIX_TICKET_ERR_NO_UPLOAD_DIR;
|
||||
return false;
|
||||
}
|
||||
|
||||
ReadText(int_max);
|
||||
|
||||
if( !int_max.empty() )
|
||||
item.max_files = Toi(int_max);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool TicketParser::CheckEndLine()
|
||||
{
|
||||
SkipWhite();
|
||||
@@ -224,7 +263,18 @@ bool TicketParser::ReadItem()
|
||||
if( item.type == TicketConf::TicketItem::TypeInteger )
|
||||
ReadItemInteger();
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeProgress )
|
||||
ReadItemInteger();
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeSelect )
|
||||
ReadItemSelect();
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeString || item.type == TicketConf::TicketItem::TypeMultistring )
|
||||
ReadItemString();
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeImages || item.type == TicketConf::TicketItem::TypeFiles )
|
||||
if( !ReadItemFiles() )
|
||||
return false;
|
||||
|
||||
if( !CheckEndLine() )
|
||||
return false;
|
||||
@@ -244,6 +294,16 @@ void TicketParser::LogItemInteger(TicketConf::TicketItem & item)
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItemProgress(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: progress"
|
||||
<< ", item_name: " << item.name
|
||||
<< ", item_id: " << item.id
|
||||
<< ", min: " << item.integer_min
|
||||
<< ", max: " << item.integer_max
|
||||
<< logend;
|
||||
}
|
||||
|
||||
void TicketParser::LogItemSelect(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: select"
|
||||
@@ -268,13 +328,69 @@ void TicketParser::LogItemSelect(TicketConf::TicketItem & item)
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItemString(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: string"
|
||||
<< ", item_name: " << item.name
|
||||
<< ", item_id: " << item.id
|
||||
<< logend;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItemMultistring(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: multistring"
|
||||
<< ", item_name: " << item.name
|
||||
<< ", item_id: " << item.id
|
||||
<< logend;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItemImages(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: images"
|
||||
<< ", item_name: " << item.name
|
||||
<< ", item_id: " << item.id
|
||||
<< ", item_upload_dir: " << item.upload_dir
|
||||
<< logend;
|
||||
}
|
||||
|
||||
|
||||
void TicketParser::LogItemFiles(TicketConf::TicketItem & item)
|
||||
{
|
||||
log << log3 << "TicketParser: item_type: files"
|
||||
<< ", item_name: " << item.name
|
||||
<< ", item_id: " << item.id
|
||||
<< ", item_upload_dir: " << item.upload_dir
|
||||
<< logend;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void TicketParser::LogItem(TicketConf::TicketItem & item)
|
||||
{
|
||||
if( item.type == TicketConf::TicketItem::TypeInteger )
|
||||
LogItemInteger(item);
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeProgress )
|
||||
LogItemProgress(item);
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeSelect )
|
||||
LogItemSelect(item);
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeString )
|
||||
LogItemString(item);
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeMultistring )
|
||||
LogItemMultistring(item);
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeImages )
|
||||
LogItemImages(item);
|
||||
else
|
||||
if( item.type == TicketConf::TicketItem::TypeFiles )
|
||||
LogItemFiles(item);
|
||||
else
|
||||
log << log1 << "TicketParser: unknown item type" << logend;
|
||||
}
|
||||
|
||||
|
||||
@@ -293,7 +409,7 @@ int TicketParser::Parse(const wchar_t * str, TicketConf & conf)
|
||||
|
||||
if( error != WINIX_TICKET_ERR_OK )
|
||||
{
|
||||
log << log1 << "TicketParser: some errors occured during parsing the config (clearing the table)";
|
||||
log << log1 << "TicketParser: some errors occured during parsing the config (clearing the table)" << logend;
|
||||
conf.Clear();
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#define WINIX_TICKET_ERR_UKNOWN_TYPE 1
|
||||
#define WINIX_TICKET_ERR_NO_ITEM_NAME 2
|
||||
#define WINIX_TICKET_ERR_SYNTAX_ERROR 3
|
||||
#define WINIX_TICKET_ERR_NO_UPLOAD_DIR 4
|
||||
|
||||
|
||||
|
||||
@@ -45,10 +46,17 @@ private:
|
||||
bool ReadItemName();
|
||||
void ReadItemInteger();
|
||||
void ReadItemSelect();
|
||||
void ReadItemString();
|
||||
bool ReadItemFiles();
|
||||
bool ReadItem();
|
||||
|
||||
void LogItemInteger(TicketConf::TicketItem & item);
|
||||
void LogItemProgress(TicketConf::TicketItem & item);
|
||||
void LogItemSelect(TicketConf::TicketItem & item);
|
||||
void LogItemString(TicketConf::TicketItem & item);
|
||||
void LogItemMultistring(TicketConf::TicketItem & item);
|
||||
void LogItemImages(TicketConf::TicketItem & item);
|
||||
void LogItemFiles(TicketConf::TicketItem & item);
|
||||
void LogItem(TicketConf::TicketItem & item);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user