diff --git a/core/log.cpp b/core/log.cpp index e2024b4..3bf4ad3 100755 --- a/core/log.cpp +++ b/core/log.cpp @@ -233,6 +233,28 @@ Log & Log::operator<<(double s) } +Log & Log::operator<<(const PT::Space * s) +{ + if( current_level <= log_level ) + { + buffer << s; + } + +return *this; +} + + +Log & Log::operator<<(const PT::Space & s) +{ + if( current_level <= log_level ) + { + buffer << s; + } + +return *this; +} + + Log & Log::operator<<(LogManipulators m) { diff --git a/core/log.h b/core/log.h index 3deb3de..dd1923e 100755 --- a/core/log.h +++ b/core/log.h @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2008-2011, Tomasz Sowa + * Copyright (c) 2008-2012, Tomasz Sowa * All rights reserved. * */ @@ -43,8 +43,11 @@ public: Log & operator<<(wchar_t s); Log & operator<<(size_t s); Log & operator<<(double s); + Log & operator<<(const PT::Space * space); + Log & operator<<(const PT::Space & space); Log & operator<<(LogManipulators m); + template void LogString(const StringType & value, size_t max_size); diff --git a/core/plugin.cpp b/core/plugin.cpp index 757a6f9..781d33a 100755 --- a/core/plugin.cpp +++ b/core/plugin.cpp @@ -382,7 +382,10 @@ size_t Plugin::Size() } - +// !! to nie jest dobre rozwiazanie +// obsluga jednego komunikatu moze wywolac inny komunikat +// i zmienne sie nadpisza +// potrzebujemy cos ala stos wywolan int Plugin::True() { return ret_true; diff --git a/db/db.cpp b/db/db.cpp index 21a2eed..5636b0e 100755 --- a/db/db.cpp +++ b/db/db.cpp @@ -245,7 +245,7 @@ Error Db::AddItemIntoItem(Item & item) query.Clear(); query << R("insert into core.item (user_id, modification_user_id, group_id, privileges, " "date_creation, date_modification, type, parent_id, content_id, " - "link_to, link_redirect, subject, guest_name, template, sort_index, url) values (") + "link_to, link_redirect, subject, guest_name, template, sort_index, meta, url) values (") << item.user_id << item.modification_user_id << item.group_id @@ -260,7 +260,8 @@ Error Db::AddItemIntoItem(Item & item) << item.subject << item.guest_name << item.html_template - << item.sort_index; + << item.sort_index + << item.meta; url_without_id = AddItemCreateUrlSubject(item); @@ -402,7 +403,7 @@ Error Db::EditItemInItem(Item & item, bool with_url) query.Clear(); query << R("update core.item set (user_id, modification_user_id, group_id, privileges, " "date_creation, date_modification, type, link_to, link_redirect, parent_id, subject, " - "guest_name, template, sort_index"); + "guest_name, template, sort_index, meta"); if( with_url ) query << R(", url"); @@ -421,7 +422,8 @@ Error Db::EditItemInItem(Item & item, bool with_url) << item.subject << item.guest_name << item.html_template - << item.sort_index; + << item.sort_index + << item.meta; if( with_url ) { diff --git a/html/fun_createticket.html b/html/fun_createticket.html index 79b8fa8..02981d7 100755 --- a/html/fun_createticket.html +++ b/html/fun_createticket.html @@ -30,7 +30,7 @@ - [if ticket_tab_is_select] + [if ticket_tab_type_is "select"] [end] - [if ticket_tab_is_multistring] + [if ticket_tab_type_is "multistring"] [end] - [if ticket_tab_is_images] + [if ticket_tab_type_is "images"] [for ticket_tab_files_tab] [ticket_tab_value] [end] @@ -59,7 +59,7 @@ [end] - [if ticket_tab_is_files] + [if ticket_tab_type_is "files"] [for ticket_tab_files_tab] [ticket_tab_value] [end] diff --git a/html/fun_showtickets.html b/html/fun_showtickets.html index 671330a..aaab581 100755 --- a/html/fun_showtickets.html +++ b/html/fun_showtickets.html @@ -15,7 +15,7 @@ {tickets_header_name} [for ticket_tab] - [if-any-no ticket_tab_is_images ticket_tab_is_files] + [if-any-no ticket_tab_type_is "images" ticket_tab_type_is "files"] [ticket_tab_param_name] [end] [end] @@ -31,8 +31,8 @@ [if-no tickets_tab_subject_empty][tickets_tab_subject][else]<[tickets_tab_url]>[end] [for tickets_tab_conf_tab] - [if-any-no tickets_tab_conf_tab_is_images tickets_tab_conf_tab_is_files] - [if tickets_tab_conf_tab_is_progress] + [if-any-no tickets_tab_conf_tab_type_is "images" tickets_tab_conf_tab_type_is "files"] + [if tickets_tab_conf_tab_type_is "progress"] progress [tickets_tab_conf_tab_value]% [else] [tickets_tab_conf_tab_value] diff --git a/html/fun_ticket.html b/html/fun_ticket.html index 52abd21..a6bb2c0 100755 --- a/html/fun_ticket.html +++ b/html/fun_ticket.html @@ -11,19 +11,19 @@ [filter fil_firstup][ticket_tab_param_name]:[end] - [if ticket_tab_is_images] + [if ticket_tab_type_is "images"] [for ticket_tab_files_tab] [ticket_tab_value] [end] [end] - [if ticket_tab_is_files] + [if ticket_tab_type_is "files"] [for ticket_tab_files_tab] [ticket_tab_value] [end] [end] - [if-any-no ticket_tab_is_images ticket_tab_is_files] + [if-any-no ticket_tab_type_is "images" ticket_tab_type_is "files"] [ticket_tab_value] [end] diff --git a/plugins/ticket/Makefile.dep b/plugins/ticket/Makefile.dep index 894cf03..70c5329 100755 --- a/plugins/ticket/Makefile.dep +++ b/plugins/ticket/Makefile.dep @@ -32,8 +32,7 @@ createticket.o: ../../core/crypt.h ../../core/run.h ../../core/users.h createticket.o: ../../core/groups.h ../../core/group.h ../../core/loadavg.h createticket.o: ../../core/image.h ../../core/basethread.h createticket.o: ../../core/threadmanager.h ../../core/synchro.h ticketinfo.h -createticket.o: ticketparser.h ticketconf.h ../../functions/functions.h -createticket.o: ../../functions/functionbase.h +createticket.o: ../../functions/functions.h ../../functions/functionbase.h createticket.o: ../../functions/functionparser.h ../../core/cur.h createticket.o: ../../functions/adduser.h ../../functions/cat.h createticket.o: ../../functions/chmod.h ../../functions/privchanger.h @@ -58,18 +57,17 @@ createticket.o: ../../core/plugindata.h ../../functions/rm.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/requesttypes.h -editticket.o: ../../core/error.h ticketinfo.h ticketparser.h ticketconf.h -editticket.o: ../../core/item.h ../../core/system.h ../../core/dirs.h -editticket.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h -editticket.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h -editticket.o: ../../core/user.h ../../core/group.h ../../core/dircontainer.h -editticket.o: ../../core/ugcontainer.h ../../core/log.h -editticket.o: ../../core/textstream.h ../../core/logmanipulators.h -editticket.o: ../../core/slog.h ../../core/cur.h ../../core/request.h -editticket.o: ../../core/error.h ../../core/config.h ../../core/htmlfilter.h -editticket.o: ../../templates/htmltextstream.h ../../core/session.h -editticket.o: ../../core/user.h ../../core/plugindata.h ../../core/rebus.h -editticket.o: ../../core/mount.h ../../templates/locale.h +editticket.o: ../../core/error.h ticketinfo.h ../../core/item.h +editticket.o: ../../core/system.h ../../core/dirs.h ../../core/dircontainer.h +editticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h +editticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h +editticket.o: ../../core/dircontainer.h ../../core/ugcontainer.h +editticket.o: ../../core/log.h ../../core/textstream.h +editticket.o: ../../core/logmanipulators.h ../../core/slog.h ../../core/cur.h +editticket.o: ../../core/request.h ../../core/error.h ../../core/config.h +editticket.o: ../../core/htmlfilter.h ../../templates/htmltextstream.h +editticket.o: ../../core/session.h ../../core/user.h ../../core/plugindata.h +editticket.o: ../../core/rebus.h ../../core/mount.h ../../templates/locale.h editticket.o: ../../notify/notify.h ../../notify/notifypool.h editticket.o: ../../templates/patterns.h ../../templates/locale.h editticket.o: ../../templates/localefilter.h ../../../ezc/src/ezc.h @@ -111,18 +109,17 @@ editticket.o: ../../functions/rm.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/requesttypes.h -funticket.o: ../../core/error.h ticketinfo.h ticketparser.h ticketconf.h -funticket.o: ../../core/item.h ../../core/system.h ../../core/dirs.h -funticket.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h -funticket.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h -funticket.o: ../../core/user.h ../../core/group.h ../../core/dircontainer.h -funticket.o: ../../core/ugcontainer.h ../../core/log.h -funticket.o: ../../core/textstream.h ../../core/logmanipulators.h -funticket.o: ../../core/slog.h ../../core/cur.h ../../core/request.h -funticket.o: ../../core/error.h ../../core/config.h ../../core/htmlfilter.h -funticket.o: ../../templates/htmltextstream.h ../../core/session.h -funticket.o: ../../core/user.h ../../core/plugindata.h ../../core/rebus.h -funticket.o: ../../core/mount.h ../../templates/locale.h +funticket.o: ../../core/error.h ticketinfo.h ../../core/item.h +funticket.o: ../../core/system.h ../../core/dirs.h ../../core/dircontainer.h +funticket.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h +funticket.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h +funticket.o: ../../core/dircontainer.h ../../core/ugcontainer.h +funticket.o: ../../core/log.h ../../core/textstream.h +funticket.o: ../../core/logmanipulators.h ../../core/slog.h ../../core/cur.h +funticket.o: ../../core/request.h ../../core/error.h ../../core/config.h +funticket.o: ../../core/htmlfilter.h ../../templates/htmltextstream.h +funticket.o: ../../core/session.h ../../core/user.h ../../core/plugindata.h +funticket.o: ../../core/rebus.h ../../core/mount.h ../../templates/locale.h funticket.o: ../../notify/notify.h ../../notify/notifypool.h funticket.o: ../../templates/patterns.h ../../templates/locale.h funticket.o: ../../templates/localefilter.h ../../../ezc/src/ezc.h @@ -168,33 +165,33 @@ funticket.o: ../../core/sessionmanager.h ../../plugins/thread/pluginmsg.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/requesttypes.h ../../core/error.h -init.o: funticket.h ticketinfo.h ticketparser.h ticketconf.h -init.o: ../../core/item.h ../../core/system.h ../../core/dirs.h -init.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h -init.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h ../../core/user.h -init.o: ../../core/group.h ../../core/dircontainer.h ../../core/ugcontainer.h -init.o: ../../core/log.h ../../core/textstream.h ../../core/logmanipulators.h -init.o: ../../core/slog.h ../../core/cur.h ../../core/request.h -init.o: ../../core/error.h ../../core/config.h ../../core/htmlfilter.h -init.o: ../../templates/htmltextstream.h ../../core/session.h -init.o: ../../core/user.h ../../core/plugindata.h ../../core/rebus.h -init.o: ../../core/mount.h ../../templates/locale.h ../../notify/notify.h -init.o: ../../notify/notifypool.h ../../templates/patterns.h -init.o: ../../templates/locale.h ../../templates/localefilter.h -init.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h -init.o: ../../../ezc/src/pattern.h ../../../ezc/src/functions.h -init.o: ../../../ezc/src/funinfo.h ../../../ezc/src/stringconv.h -init.o: ../../notify/notifythread.h ../../core/basethread.h -init.o: ../../core/synchro.h ../../notify/templatesnotify.h -init.o: ../../core/config.h ../../core/users.h ../../core/ugcontainer.h -init.o: ../../core/lastcontainer.h ../../templates/misc.h -init.o: ../../templates/htmltextstream.h ../../core/mounts.h -init.o: ../../core/mountparser.h ../../core/crypt.h ../../core/run.h -init.o: ../../core/users.h ../../core/groups.h ../../core/group.h -init.o: ../../core/loadavg.h ../../core/image.h ../../core/basethread.h -init.o: ../../core/threadmanager.h ../../functions/functions.h -init.o: ../../functions/functionbase.h ../../functions/functionparser.h -init.o: ../../core/cur.h ../../functions/adduser.h ../../functions/cat.h +init.o: funticket.h ticketinfo.h ../../core/item.h ../../core/system.h +init.o: ../../core/dirs.h ../../core/dircontainer.h ../../db/db.h +init.o: ../../db/dbbase.h ../../db/dbitemquery.h ../../db/dbitemcolumns.h +init.o: ../../core/user.h ../../core/group.h ../../core/dircontainer.h +init.o: ../../core/ugcontainer.h ../../core/log.h ../../core/textstream.h +init.o: ../../core/logmanipulators.h ../../core/slog.h ../../core/cur.h +init.o: ../../core/request.h ../../core/error.h ../../core/config.h +init.o: ../../core/htmlfilter.h ../../templates/htmltextstream.h +init.o: ../../core/session.h ../../core/user.h ../../core/plugindata.h +init.o: ../../core/rebus.h ../../core/mount.h ../../templates/locale.h +init.o: ../../notify/notify.h ../../notify/notifypool.h +init.o: ../../templates/patterns.h ../../templates/locale.h +init.o: ../../templates/localefilter.h ../../../ezc/src/ezc.h +init.o: ../../../ezc/src/generator.h ../../../ezc/src/pattern.h +init.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h +init.o: ../../../ezc/src/stringconv.h ../../notify/notifythread.h +init.o: ../../core/basethread.h ../../core/synchro.h +init.o: ../../notify/templatesnotify.h ../../core/config.h ../../core/users.h +init.o: ../../core/ugcontainer.h ../../core/lastcontainer.h +init.o: ../../templates/misc.h ../../templates/htmltextstream.h +init.o: ../../core/mounts.h ../../core/mountparser.h ../../core/crypt.h +init.o: ../../core/run.h ../../core/users.h ../../core/groups.h +init.o: ../../core/group.h ../../core/loadavg.h ../../core/image.h +init.o: ../../core/basethread.h ../../core/threadmanager.h +init.o: ../../functions/functions.h ../../functions/functionbase.h +init.o: ../../functions/functionparser.h ../../core/cur.h +init.o: ../../functions/adduser.h ../../functions/cat.h init.o: ../../functions/chmod.h ../../functions/privchanger.h init.o: ../../core/request.h ../../functions/chown.h init.o: ../../functions/ckeditor.h ../../functions/cp.h @@ -227,8 +224,7 @@ 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/requesttypes.h ../../core/error.h ticketinfo.h -showtickets.o: ticketparser.h ticketconf.h ../../core/item.h -showtickets.o: ../../core/system.h ../../core/dirs.h +showtickets.o: ../../core/item.h ../../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/dircontainer.h @@ -291,24 +287,24 @@ templates.o: ../../../ezc/src/ezc.h ../../../ezc/src/generator.h templates.o: ../../../ezc/src/pattern.h ../../core/item.h templates.o: ../../../ezc/src/functions.h ../../../ezc/src/funinfo.h templates.o: ../../../ezc/src/stringconv.h ticketinfo.h ticket.h -templates.o: ticketparser.h ticketconf.h ../../core/item.h -templates.o: ../../core/system.h ../../core/dirs.h ../../core/dircontainer.h -templates.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h -templates.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h -templates.o: ../../core/dircontainer.h ../../core/ugcontainer.h -templates.o: ../../core/log.h ../../core/textstream.h -templates.o: ../../core/logmanipulators.h ../../core/slog.h ../../core/cur.h -templates.o: ../../core/request.h ../../core/requesttypes.h -templates.o: ../../core/error.h ../../core/config.h ../../core/htmlfilter.h -templates.o: ../../templates/htmltextstream.h ../../core/textstream.h -templates.o: ../../core/misc.h ../../core/session.h ../../core/user.h -templates.o: ../../core/plugindata.h ../../core/rebus.h ../../core/mount.h -templates.o: ../../templates/locale.h ../../notify/notify.h -templates.o: ../../notify/notifypool.h ../../templates/patterns.h -templates.o: ../../templates/locale.h ../../templates/localefilter.h -templates.o: ../../notify/notifythread.h ../../core/basethread.h -templates.o: ../../core/synchro.h ../../notify/templatesnotify.h -templates.o: ../../core/config.h ../../core/users.h ../../core/ugcontainer.h +templates.o: ../../core/item.h ../../core/system.h ../../core/dirs.h +templates.o: ../../core/dircontainer.h ../../db/db.h ../../db/dbbase.h +templates.o: ../../db/dbitemquery.h ../../db/dbitemcolumns.h +templates.o: ../../core/user.h ../../core/group.h ../../core/dircontainer.h +templates.o: ../../core/ugcontainer.h ../../core/log.h +templates.o: ../../core/textstream.h ../../core/logmanipulators.h +templates.o: ../../core/slog.h ../../core/cur.h ../../core/request.h +templates.o: ../../core/requesttypes.h ../../core/error.h ../../core/config.h +templates.o: ../../core/htmlfilter.h ../../templates/htmltextstream.h +templates.o: ../../core/textstream.h ../../core/misc.h ../../core/session.h +templates.o: ../../core/user.h ../../core/plugindata.h ../../core/rebus.h +templates.o: ../../core/mount.h ../../templates/locale.h +templates.o: ../../notify/notify.h ../../notify/notifypool.h +templates.o: ../../templates/patterns.h ../../templates/locale.h +templates.o: ../../templates/localefilter.h ../../notify/notifythread.h +templates.o: ../../core/basethread.h ../../core/synchro.h +templates.o: ../../notify/templatesnotify.h ../../core/config.h +templates.o: ../../core/users.h ../../core/ugcontainer.h templates.o: ../../core/lastcontainer.h ../../templates/misc.h templates.o: ../../templates/htmltextstream.h ../../core/mounts.h templates.o: ../../core/mountparser.h ../../core/crypt.h ../../core/run.h @@ -345,12 +341,11 @@ templates.o: ../../templates/patterncacher.h ../../templates/indexpatterns.h templates.o: ../../templates/patterns.h ../../templates/changepatterns.h templates.o: ../../core/sessionmanager.h sessiondata.h templates.o: ../../core/plugindata.h ../../functions/rm.h -templates.o: ../../plugins/thread/pluginmsg.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 -ticketinfo.o: ../../core/item.h ../../core/dircontainer.h ../../db/db.h -ticketinfo.o: ../../db/dbbase.h ../../db/dbitemquery.h +templates.o: ../../plugins/thread/pluginmsg.h ../../templates/miscspace.h +templates.o: ../../templates/templates.h +ticketinfo.o: ticketinfo.h ticket.h ../../core/item.h ../../core/system.h +ticketinfo.o: ../../core/dirs.h ../../core/item.h ../../core/dircontainer.h +ticketinfo.o: ../../db/db.h ../../db/dbbase.h ../../db/dbitemquery.h ticketinfo.o: ../../db/dbitemcolumns.h ../../core/user.h ../../core/group.h ticketinfo.o: ../../core/dircontainer.h ../../core/ugcontainer.h ticketinfo.o: ../../core/log.h ../../core/textstream.h @@ -399,5 +394,3 @@ 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 ../../functions/rm.h -ticketparser.o: ticketparser.h ticketconf.h ../../core/log.h -ticketparser.o: ../../core/misc.h diff --git a/plugins/ticket/Makefile.o.dep b/plugins/ticket/Makefile.o.dep index 6a40f3d..f5b6089 100755 --- a/plugins/ticket/Makefile.o.dep +++ b/plugins/ticket/Makefile.o.dep @@ -1 +1 @@ -o = createticket.o editticket.o funticket.o init.o sessiondata.o showtickets.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 ticketinfo.o diff --git a/plugins/ticket/createticket.cpp b/plugins/ticket/createticket.cpp index 628abce..a0d69ff 100755 --- a/plugins/ticket/createticket.cpp +++ b/plugins/ticket/createticket.cpp @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2008-2010, Tomasz Sowa + * Copyright (c) 2008-2012, Tomasz Sowa * All rights reserved. * */ @@ -43,7 +43,7 @@ bool CreateTicket::HasAccess() if( cur->request->is_item || !system->HasWriteAccess(*cur->request->dir_tab.back()) ) return false; - if( !system->mounts.pmount || system->mounts.pmount->type != ticket_info->mount_type_ticket ) + if( cur->mount->type != ticket_info->mount_type_ticket ) return false; return true; @@ -148,9 +148,10 @@ void CreateTicket::MakePost() Ticket & ticket = PrepareTicket(); Item & item = cur->request->item; ticket_info->ticket = &ticket; + ticket_info->item = &item; std::vector & file_map = PrepareFileMap(); - ticket_info->ReadTicketParams(ticket, false, &file_map); + ticket_info->ReadTicketParams(ticket, false, file_map, item.meta); functions->ReadItem(item, Item::file); if( !cur->request->IsPostVar(L"fileuploadsubmit") ) @@ -166,6 +167,7 @@ void CreateTicket::MakeGet() Ticket & ticket = PrepareTicket(); ticket_info->ticket = &ticket; + ticket_info->item = &cur->request->item; } diff --git a/plugins/ticket/editticket.cpp b/plugins/ticket/editticket.cpp index c98be85..e5a0807 100755 --- a/plugins/ticket/editticket.cpp +++ b/plugins/ticket/editticket.cpp @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2008-2010, Tomasz Sowa + * Copyright (c) 2008-2012, Tomasz Sowa * All rights reserved. * */ @@ -47,7 +47,7 @@ bool EditTicket::HasAccess() if( !cur->request->is_item || !system->HasWriteAccess(cur->request->item) ) return false; - if( !system->mounts.pmount || system->mounts.pmount->type != ticket_info->mount_type_ticket ) + if( cur->mount->type != ticket_info->mount_type_ticket ) return false; return true; @@ -98,6 +98,8 @@ void EditTicket::Submit(Ticket & ticket, Item & item) { log << log1 << "EditTicket: problem with editing a ticket, error code: " << cur->request->status << logend; + + // !! add session log } } @@ -111,7 +113,7 @@ void EditTicket::RemoveTmpTicket() long file_id = cur->request->item.id; session_data->edit_ticket_map.erase(file_id); - session_data->new_file_map.erase(file_id); + session_data->edit_file_map.erase(file_id); } @@ -141,7 +143,7 @@ std::vector & EditTicket::PrepareFileMap() cur->session->plugin_data.Get(ticket_info->plugin_id) ); long file_id = cur->request->item.id; - std::vector & file_map = session_data->GetFileTab(file_id, session_data->new_file_map); + std::vector & file_map = session_data->GetFileTab(file_id, session_data->edit_file_map); return file_map; } @@ -149,6 +151,7 @@ return file_map; void EditTicket::MakePost() { + ticket_info->Clear(); ticket_info->FindCurrentConf(); Ticket & ticket = PrepareTicket(); @@ -156,8 +159,9 @@ void EditTicket::MakePost() old_url = item.url; std::vector & file_map = PrepareFileMap(); ticket_info->ticket = &ticket; + ticket_info->item = &item; - ticket_info->ReadTicketParams(ticket, false, &file_map); + ticket_info->ReadTicketParams(ticket, false, file_map, item.meta); functions->ReadItem(item, Item::file); if( !cur->request->IsPostVar(L"fileuploadsubmit") ) @@ -168,10 +172,12 @@ void EditTicket::MakePost() void EditTicket::MakeGet() { + ticket_info->Clear(); ticket_info->FindCurrentConf(); Ticket & ticket = PrepareTicket(); ticket_info->ticket = &ticket; + ticket_info->item = &cur->request->item; } diff --git a/plugins/ticket/funticket.cpp b/plugins/ticket/funticket.cpp index 84f2066..ffd7e90 100755 --- a/plugins/ticket/funticket.cpp +++ b/plugins/ticket/funticket.cpp @@ -47,6 +47,7 @@ void FunTicket::MakeGet() ticket_info->Clear(); ticket_info->FindCurrentConf(); ticket_info->ticket = &ticket; + ticket_info->item = &cur->request->item; tdb->GetTicket(cur->request->item.id, ticket); diff --git a/plugins/ticket/init.cpp b/plugins/ticket/init.cpp index 5e10f3c..ed02c25 100755 --- a/plugins/ticket/init.cpp +++ b/plugins/ticket/init.cpp @@ -88,6 +88,9 @@ void ProcessRequest(PluginInfo & info) void RemoveTicket(PluginInfo & info) { + // !! dodac nowy komunikat PREPERE_TO_REMOVE + // i tam korzystajac z meta informacji w item + // usunac odpowiednie pliki const Item * item = reinterpret_cast(info.p1); if( item ) diff --git a/plugins/ticket/sessiondata.cpp b/plugins/ticket/sessiondata.cpp index 54f8ad3..bc8b3f5 100755 --- a/plugins/ticket/sessiondata.cpp +++ b/plugins/ticket/sessiondata.cpp @@ -22,7 +22,7 @@ SessionData::SessionData() SessionData::~SessionData() { RemoveFileMap(create_file_map); - RemoveFileMap(new_file_map); + RemoveFileMap(edit_file_map); } diff --git a/plugins/ticket/sessiondata.h b/plugins/ticket/sessiondata.h index 86732db..f857149 100755 --- a/plugins/ticket/sessiondata.h +++ b/plugins/ticket/sessiondata.h @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2010, Tomasz Sowa + * Copyright (c) 2010-2012, Tomasz Sowa * All rights reserved. * */ @@ -48,7 +48,7 @@ struct SessionData : public PluginDataBase // temporary files for 'editticket' function // these files should be deleted if a user will not click on the submit button // !! zmienic nazwe na edit_file_map albo podobnie - FileMap new_file_map; + FileMap edit_file_map; // inserting and returning a new ticket or just returning the ticket if it exists @@ -56,7 +56,10 @@ struct SessionData : public PluginDataBase std::vector & GetFileTab(long id, FileMap & file_map); - // for deleting new_file_map files + // for deleting edit_file_map files + // !! IMPROVE ME: when the program exits there can be a situation that + // fun_rm was finished and then an object of this class exits and call fun_rm + // so we should guarantee that all sessions object are removed first Fun::Rm * fun_rm; void RemoveFileMap(FileMap & file_map); diff --git a/plugins/ticket/showtickets.cpp b/plugins/ticket/showtickets.cpp index 62cb685..a2fa23c 100755 --- a/plugins/ticket/showtickets.cpp +++ b/plugins/ticket/showtickets.cpp @@ -82,6 +82,7 @@ void ShowTickets::ReadFiles() iq.sel_guest_name = true; iq.sel_privileges = true; iq.sel_date = true; + iq.sel_meta = true; iq.WhereParentId(cur->request->dir_tab.back()->id); iq.WhereType(Item::file); iq.WhereFileType(WINIX_ITEM_FILETYPE_NONE); diff --git a/plugins/ticket/tdb.cpp b/plugins/ticket/tdb.cpp index e3553e5..ba3e936 100755 --- a/plugins/ticket/tdb.cpp +++ b/plugins/ticket/tdb.cpp @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2010, Tomasz Sowa + * Copyright (c) 2010-2012, Tomasz Sowa * All rights reserved. * */ @@ -43,6 +43,24 @@ return is; } +void TDb::SetTicketColumns(PGresult * r) +{ + cfileid = AssertColumn(r, "file_id"); + cparam = AssertColumn(r, "param"); + cintv = AssertColumn(r, "intv"); + cdecv = AssertColumn(r, "decv"); +} + + +void TDb::ReadTicketPar(PGresult * r, Ticket::TicketParam & par, int row) +{ + par.Clear(); + par.param = AssertValueInt(r, row, cparam); + par.intv = AssertValueLong(r, row, cintv); + AssertValueWide(r, row, cdecv, par.decv); // !! temporarily +} + + Error TDb::GetTicket(long file_id, Ticket & ticket) { PGresult * r = 0; @@ -53,33 +71,26 @@ Error TDb::GetTicket(long file_id, Ticket & ticket) { // they should be sorted by param (they are used in a binary search later) query.Clear(); - query << R("select file_id, param, int_value, str_value from plugins.ticket " + query << R("select file_id, param, intv, decv from plugins.ticket " "where ticket.file_id=") << file_id << R(" order by param asc;"); r = AssertQuery(query); AssertResult(r, PGRES_TUPLES_OK); + SetTicketColumns(r); int rows = Rows(r); - - if( rows == 0 ) - throw Error(WINIX_ERR_NO_TICKET); - - Ticket::TicketParam par; ticket.file_id = file_id; - int cparam = AssertColumn(r, "param"); - int cintvalue = AssertColumn(r, "int_value"); - int cstrvalue = AssertColumn(r, "str_value"); + if( rows == 0 ) + throw Error(WINIX_ERR_NO_TICKET); // !! do we need this kind or error? - // !! mozna dodac uzycie ticket.par_tab.reserve() + if( ticket.par_tab.capacity() < ticket.par_tab.size() + rows ) + ticket.par_tab.reserve(ticket.par_tab.size() + rows); for(int i=0 ; i & file_id_tab, std::vector & ticket_tab) +Error TDb::GetTickets(const std::vector & file_id_tab, std::vector & ticket_tab, bool clear_tab) { PGresult * r = 0; Error status = WINIX_ERR_OK; - ticket_tab.clear(); + + if( clear_tab ) + ticket_tab.clear(); if( file_id_tab.empty() ) return status; @@ -111,40 +124,30 @@ Error TDb::GetTickets(const std::vector & file_id_tab, std::vector // ticket_tab must be sorted by file_id (they are used in a binary search later) // and items in a ticket should be sorted by param (they are used in a binary search later too) query.Clear(); - 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, param;"); - - // !! moze dodac operator <<(std::vector(long)) do query? + query << R("select file_id, param, intv, decv from plugins.ticket " + "where ticket.file_id in ") << file_id_tab << R(" order by file_id, param;"); r = AssertQuery(query); AssertResult(r, PGRES_TUPLES_OK); + SetTicketColumns(r); int rows = Rows(r); - Ticket::TicketParam par; - - 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; + empty_ticket.Clear(); for(int i=0 ; i & file_id_tab, std::vector } ClearResult(r); - file_list.clear(); return status; } @@ -171,11 +173,11 @@ Error TDb::AddTicket(const Ticket & ticket) for(size_t i=0 ; i & file_id_tab, std::vector & ticket_tab); + Error GetTickets(const std::vector & file_id_tab, std::vector & ticket_tab, bool clear_tab = true); Error AddTicket(const Ticket & ticket); Error RemoveAddTicket(const Ticket & ticket); // first removing and then adding a ticket Error RemoveTicket(long file_id); @@ -36,7 +36,16 @@ public: private: DbTextStream query; - std::wstring file_list; + Ticket empty_ticket; + Ticket::TicketParam tic_par; + + int cfileid; + int cparam; + int cintv; + int cdecv; + + void SetTicketColumns(PGresult * r); + void ReadTicketPar(PGresult * r, Ticket::TicketParam & par, int row); }; diff --git a/plugins/ticket/templates.cpp b/plugins/ticket/templates.cpp index 53615e8..9795c3e 100755 --- a/plugins/ticket/templates.cpp +++ b/plugins/ticket/templates.cpp @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2008-2010, Tomasz Sowa + * Copyright (c) 2008-2012, Tomasz Sowa * All rights reserved. * */ @@ -18,7 +18,8 @@ #include "templates/templates.h" #include "sessiondata.h" #include "plugins/thread/pluginmsg.h" - +#include "templates/miscspace.h" +#include "confparser/space.h" namespace Ticket @@ -47,10 +48,31 @@ return percent; } +PT::Space & find_add_meta_for_param(PT::Space & meta, long param_id) +{ + for(size_t i=0 ; i 0 && ticket.par_tab[o2-1].param == param ) --o2; @@ -105,36 +129,38 @@ return false; -void ticket_print_value(Info & i, size_t conf_index, const Ticket::TicketParam & ticket_param) +void ticket_print_value(Info & i, PT::Space & space, const Ticket::TicketParam & ticket_param, PT::Space & meta) { - if( conf_index < ticket_info.cur_conf->tab.size() ) - { - const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index]; + std::wstring & type = space.Text(L"type"); - if( conf_item.type == TicketConf::TicketItem::TypeInteger || - conf_item.type == TicketConf::TicketItem::TypeProgress ) + if( type == L"integer" || type == L"progress" ) + { + i.out << ticket_param.intv; + } + else + if( type == L"select" ) + { + for(size_t a=0 ; atab +static size_t conf_tab_index; // index for: ticket_info.cur_conf->spaces static bool has_ticket; static bool has_value; @@ -249,6 +275,7 @@ void tickets_tab_subject(Info & i) } +// !! do czego to w ogole sluzy? void tickets_tab_has_value(Info & i) { if( has_ticket && ticket_index < ticket_info.ticket_tab.size() ) @@ -257,37 +284,43 @@ void tickets_tab_has_value(Info & i) long id = Tol(i.par); Ticket & ticket = ticket_info.ticket_tab[ticket_index]; - if( find_ticket_value(id, ticket, par_index) ) + // !! dodac takze sprawdzanie czy jest wartosc w ticket_info.ticket->meta + + if( find_ticket_param(id, ticket, par_index) ) i.res = true; } } +// !! czy to w ogole jest gdzies uzywane? void tickets_tab_value_int(Info & i) { if( has_ticket && ticket_index < ticket_info.ticket_tab.size() ) { size_t par_index; - long id = Tol(i.par); + long param = Tol(i.par); Ticket & ticket = ticket_info.ticket_tab[ticket_index]; - if( find_ticket_value(id, ticket, par_index) ) - i.out << ticket.par_tab[par_index].int_value; + if( find_ticket_param(param, ticket, par_index) ) + i.out << ticket.par_tab[par_index].intv; } } - -void tickets_tab_value_str(Info & i) +// !! czy to w ogole jest gdzies uzywane? +void tickets_tab_value_meta(Info & i) { - if( has_ticket && ticket_index < ticket_info.ticket_tab.size() ) + if( has_ticket && + item_sort_index < ticket_info.item_sort_tab.size() && + ticket_index < ticket_info.ticket_tab.size() ) { - size_t par_index; - long id = Tol(i.par); - Ticket & ticket = ticket_info.ticket_tab[ticket_index]; + long param = Tol(i.par); - if( find_ticket_value(id, ticket, par_index) ) - i.out << ticket.par_tab[par_index].str_value; + PT::Space & meta = ticket_info.item_sort_tab[item_sort_index]->meta.FindAddSpace(L"ticket"); + PT::Space & sp = find_add_meta_for_param(meta, param); + + // !! to nie zadziala bo pierwszy parametr w i.par to jest param_id + space(i, sp); } } @@ -302,14 +335,24 @@ void tickets_tab_conf_tab(Info & i) 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(); + if( i.iter == 0 ) + conf_tab_index = 0; + else + conf_tab_index += 1; + + PT::Space & space = *ticket_info.cur_conf; + + for( ; conf_tab_index < space.spaces.size() ; conf_tab_index++) + if( space.spaces[conf_tab_index]->name == L"param" ) + break; + + i.res = conf_tab_index < space.spaces.size(); if( i.res ) { - const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_tab_index]; + PT::Space & sp = *space.spaces[conf_tab_index]; const Ticket & ticket = ticket_info.ticket_tab[ticket_index]; - has_value = find_ticket_value(conf_item.id, ticket, par_index); + has_value = find_ticket_param(sp.Long(L"id"), ticket, par_index); } } } @@ -324,82 +367,30 @@ void tickets_tab_conf_tab_has_value(Info & i) void tickets_tab_conf_tab_value(Info & i) { if( has_value && - item_sort_index < ticket_info.item_sort_tab.size() && - ticket_index < ticket_info.ticket_tab.size() && + conf_tab_index < ticket_info.cur_conf->spaces.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() ) { - ticket_print_value(i, conf_tab_index, ticket_info.ticket_tab[ticket_index].par_tab[par_index]); + PT::Space & space = *ticket_info.cur_conf->spaces[conf_tab_index]; + + // !! to mozna jakos gdzies zapamietac + // aby nie wyszukiwac ciagle + PT::Space & meta_ticket = ticket_info.item_sort_tab[item_sort_index]->meta.FindAddSpace(L"ticket"); + PT::Space & meta = find_add_meta_for_param(meta_ticket, space.Long(L"id")); + + ticket_print_value(i, space, ticket_info.ticket_tab[ticket_index].par_tab[par_index], meta); } } -void tickets_tab_conf_tab_is_integer(Info & i) +void tickets_tab_conf_tab_type_is(Info & i) { - if( conf_tab_index < ticket_info.cur_conf->tab.size() ) + if( conf_tab_index < ticket_info.cur_conf->spaces.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( 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( 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( 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( 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( 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( 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; + PT::Space & space = *ticket_info.cur_conf->spaces[conf_tab_index]; + i.res = (space.Text(L"type") == i.par); } } @@ -410,7 +401,7 @@ void tickets_tab_conf_tab_progress_image_number(Info & i) 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; + int progress = ticket_info.ticket_tab[ticket_index].par_tab[par_index].intv; i.out << ticket_calc_progress_image_number(progress); } } @@ -425,8 +416,8 @@ void tickets_tab_conf_tab_progress_image_number(Info & i) namespace ns_ticket_tab { -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 conf_index; // index for: ticket_info.cur_conf->spaces +static size_t select_index; // index for: ticket_info.cur_conf->spaces[conf_index]->spaces static size_t par_index; // index for: ticket_info.ticket->par_tab static size_t files_number; static bool has_value; @@ -435,13 +426,23 @@ static bool has_value; void ticket_tab(Info & i) { - conf_index = i.iter; - i.res = conf_index < ticket_info.cur_conf->tab.size(); + if( i.iter == 0 ) + conf_index = 0; + else + conf_index += 1; + + PT::Space & space = *ticket_info.cur_conf; + + for( ; conf_index < space.spaces.size() ; conf_index++) + if( space.spaces[conf_index]->name == L"param" ) + break; + + i.res = conf_index < space.spaces.size(); if( i.res ) { - const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index]; - has_value = find_ticket_value(conf_item.id, *ticket_info.ticket, par_index); + PT::Space & sp = *space.spaces[conf_index]; + has_value = find_ticket_param(sp.Long(L"id"), *ticket_info.ticket, par_index); } } @@ -449,110 +450,98 @@ void ticket_tab(Info & i) void ticket_tab_param_id(Info & i) { - if( conf_index < ticket_info.cur_conf->tab.size() ) - i.out << ticket_info.cur_conf->tab[conf_index].id; + if( conf_index < ticket_info.cur_conf->spaces.size() ) + i.out << ticket_info.cur_conf->spaces[conf_index]->Long(L"id"); } void ticket_tab_param_name(Info & i) { - if( conf_index < ticket_info.cur_conf->tab.size() ) - i.out << ticket_info.cur_conf->tab[conf_index].name; + if( conf_index < ticket_info.cur_conf->spaces.size() ) + i.out << ticket_info.cur_conf->spaces[conf_index]->Text(L"name"); } void ticket_tab_value(Info & i) { - if( has_value && par_index < ticket_info.ticket->par_tab.size() ) - ticket_print_value(i, conf_index, ticket_info.ticket->par_tab[par_index]); + // !! has_value mowi tylko czy opcja byla w tabeli tickets + // nalezy dodac aby has_value mialo obsluge meta (albo sie pozbyc go w ogole...) + + if( has_value && par_index < ticket_info.ticket->par_tab.size() && + conf_index < ticket_info.cur_conf->spaces.size() ) + { + PT::Space & space = *ticket_info.cur_conf->spaces[conf_index]; + PT::Space & meta = find_add_meta_for_param(ticket_info.item->meta.FindAddSpace(L"ticket"), space.Long(L"id")); + + ticket_print_value(i, space, ticket_info.ticket->par_tab[par_index], meta); + } } void ticket_tab_value_int(Info & i) { if( has_value && par_index < ticket_info.ticket->par_tab.size() ) - i.out << ticket_info.ticket->par_tab[par_index].int_value; + i.out << ticket_info.ticket->par_tab[par_index].intv; } -void ticket_tab_value_str(Info & i) +void ticket_tab_value_meta(Info & i) { if( has_value && par_index < ticket_info.ticket->par_tab.size() ) - i.out << ticket_info.ticket->par_tab[par_index].str_value; + { + PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; + PT::Space & meta = find_add_meta_for_param(ticket_info.item->meta.FindAddSpace(L"ticket"), sp.Long(L"id")); + + space(i, meta); + } } -void ticket_tab_is_integer(Info & i) +void ticket_tab_type_is(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() ) - i.res = ticket_info.cur_conf->tab[conf_index].type == TicketConf::TicketItem::TypeSelect; -} - - -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::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; + if( conf_index < ticket_info.cur_conf->spaces.size() ) + { + PT::Space & space = *ticket_info.cur_conf->spaces[conf_index]; + i.res = (space.Text(L"type") == i.par); + } } void ticket_tab_select_tab(Info & i) { - if( conf_index < ticket_info.cur_conf->tab.size() ) + if( conf_index < ticket_info.cur_conf->spaces.size() ) { - select_index = i.iter; - i.res = select_index < ticket_info.cur_conf->tab[conf_index].select.size(); + if( i.iter == 0 ) + select_index = 0; + else + select_index += 1; + + PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; + + for( ; select_index < sp.spaces.size() ; ++select_index) + if( sp.spaces[select_index]->name == L"option" ) + break; + + i.res = (select_index < sp.spaces.size()); } } void ticket_tab_select_tab_is_selected(Info & i) { - if( has_value && par_index < ticket_info.ticket->par_tab.size() ) + if( conf_index < ticket_info.cur_conf->spaces.size() && + select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() ) { - 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() && - select_index < ticket_info.cur_conf->tab[conf_index].select.size() ) + PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; + long id = sp.spaces[select_index]->Long(L"id"); + + if( has_value && par_index < ticket_info.ticket->par_tab.size() ) { - i.res = select_index == ticket_info.cur_conf->tab[conf_index].select_default; + i.res = (id == ticket_info.ticket->par_tab[par_index].intv); + } + else + { + i.res = (id == sp.Long(L"default")); } } } @@ -560,20 +549,20 @@ void ticket_tab_select_tab_is_selected(Info & i) void ticket_tab_select_tab_name(Info & i) { - if( conf_index < ticket_info.cur_conf->tab.size() && - select_index < ticket_info.cur_conf->tab[conf_index].select.size() ) + if( conf_index < ticket_info.cur_conf->spaces.size() && + select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() ) { - i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].name; + i.out << ticket_info.cur_conf->spaces[conf_index]->spaces[select_index]->Text(L"value"); } } void ticket_tab_select_tab_id(Info & i) { - if( conf_index < ticket_info.cur_conf->tab.size() && - select_index < ticket_info.cur_conf->tab[conf_index].select.size() ) + if( conf_index < ticket_info.cur_conf->spaces.size() && + select_index < ticket_info.cur_conf->spaces[conf_index]->spaces.size() ) { - i.out << ticket_info.cur_conf->tab[conf_index].select[select_index].id; + i.out << ticket_info.cur_conf->spaces[conf_index]->spaces[select_index]->Text(L"id"); } } @@ -584,7 +573,7 @@ void ticket_tab_files_tab(Info & i) { files_number = i.iter; - if( has_value && conf_index < ticket_info.cur_conf->tab.size() ) + if( has_value && conf_index < ticket_info.cur_conf->spaces.size() ) { if( i.iter == 0 ) { @@ -595,11 +584,13 @@ void ticket_tab_files_tab(Info & i) else { // next iteration, we are looking for the next par_index - const TicketConf::TicketItem & conf_item = ticket_info.cur_conf->tab[conf_index]; + PT::Space & sp = *ticket_info.cur_conf->spaces[conf_index]; + + long param = sp.Long(L"id"); 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 ) + if( ticket_info.ticket->par_tab[par_index].param == param ) { i.res = true; return; @@ -646,19 +637,13 @@ using namespace ns_ticket_tab; // you should provide an id (param) as a first parameter fun->Insert("tickets_tab_has_value", tickets_tab_has_value); fun->Insert("tickets_tab_value_int", tickets_tab_value_int); - fun->Insert("tickets_tab_value_str", tickets_tab_value_str); + fun->Insert("tickets_tab_value_meta", tickets_tab_value_meta); fun->Insert("tickets_tab_conf_tab", tickets_tab_conf_tab); fun->Insert("tickets_tab_conf_tab_has_value", tickets_tab_conf_tab_has_value); fun->Insert("tickets_tab_conf_tab_value", tickets_tab_conf_tab_value); - 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_type_is", tickets_tab_conf_tab_type_is); fun->Insert("tickets_tab_conf_tab_progress_image_number", tickets_tab_conf_tab_progress_image_number); @@ -669,15 +654,8 @@ using namespace ns_ticket_tab; fun->Insert("ticket_tab_param_name", ticket_tab_param_name); fun->Insert("ticket_tab_value", ticket_tab_value); fun->Insert("ticket_tab_value_int", ticket_tab_value_int); - fun->Insert("ticket_tab_value_str", ticket_tab_value_str); - - 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_value_meta", ticket_tab_value_meta); + fun->Insert("ticket_tab_type_is", ticket_tab_type_is); fun->Insert("ticket_tab_select_tab", ticket_tab_select_tab); fun->Insert("ticket_tab_select_tab_is_selected", ticket_tab_select_tab_is_selected); diff --git a/plugins/ticket/ticket.h b/plugins/ticket/ticket.h index b36f8a5..570e271 100755 --- a/plugins/ticket/ticket.h +++ b/plugins/ticket/ticket.h @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2008-2010, Tomasz Sowa + * Copyright (c) 2008-2012, Tomasz Sowa * All rights reserved. * */ @@ -22,15 +22,15 @@ struct Ticket { struct TicketParam { - int param; - long int_value; // changed to long (from int) - std::wstring str_value; + long param; + long intv; + std::wstring decv; // !! temporarily as a string (in the future there'll be a Dec type from ttmath) void Clear() { - param = 0; - int_value = 0; - str_value.clear(); + param = 0; + intv = 0; + decv.clear(); } TicketParam() @@ -43,15 +43,16 @@ struct Ticket std::vector par_tab; // auxiliary object used during sorting - unsigned long sort_id; + //unsigned long sort_id; void Clear() { - file_id = -1; + file_id = -1; par_tab.clear(); - sort_id = 0; + //sort_id = 0; } + struct Sort { bool operator()(const TicketParam & par1, const TicketParam & par2) @@ -59,11 +60,14 @@ struct Ticket return par1.param < par2.param; } }; + + void SortParTab() { std::sort(par_tab.begin(), par_tab.end(), Sort()); } + Ticket() diff --git a/plugins/ticket/ticketconf.cpp b/plugins/ticket/ticketconf.cpp deleted file mode 100755 index 8c62a84..0000000 --- a/plugins/ticket/ticketconf.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * This file is a part of Winix - * and is not publicly distributed - * - * Copyright (c) 2010, Tomasz Sowa - * All rights reserved. - * - */ - -#include -#include "ticketconf.h" - - -TicketConf::TicketItem::TicketItem() -{ - Clear(); -} - - -void TicketConf::TicketItem::Clear() -{ - id = 0; - name.clear(); - type = TypeInteger; - integer_min = std::numeric_limits::min(); - integer_max = std::numeric_limits::max(); - max_files = 0; - upload_dir.clear(); - select.clear(); - select_default = 0; -} - -void TicketConf::Clear() -{ - tab.clear(); -} - - - diff --git a/plugins/ticket/ticketconf.h b/plugins/ticket/ticketconf.h deleted file mode 100755 index 2c1bf47..0000000 --- a/plugins/ticket/ticketconf.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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_ticketconf -#define headerfile_winix_plugins_ticket_ticketconf - -#include -#include - - - - -struct TicketConf -{ - struct TicketItem - { - struct Select - { - std::wstring name; - int id; - }; - - TicketItem(); - void Clear(); - - enum Type { TypeInteger, TypeProgress, TypeSelect, TypeString, TypeMultistring, TypeImages, TypeFiles }; - - int id; - - std::wstring name; - Type type; - - // used when type is TypeInteger or TypeProgress - int integer_min, integer_max; - - // used when type is TypeSelect - std::vector