added: some methods in Dystem::Dirs (takes wchar_t * as an argument, now only std::wstring were)
changed: in plugin ticket: added message: WINIX_PL_TICKET_CAN_MAKE_REDIRECT it is sent at the end of POST request (editticket, createticket) if we can make a redirect (useful with AJAX) git-svn-id: svn://ttmath.org/publicrep/winix/trunk@887 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
72013046fc
commit
bd1f717b4c
|
@ -351,7 +351,7 @@ return &(*etc);
|
|||
}
|
||||
|
||||
|
||||
Item * Dirs::GetDir(const std::wstring & name, long parent)
|
||||
Item * Dirs::GetDir(const wchar_t * name, long parent)
|
||||
{
|
||||
DirContainer::ParentIterator i = dir_tab.FindFirstChild(parent);
|
||||
|
||||
|
@ -363,10 +363,16 @@ return 0;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Item * Dirs::GetDir(const std::wstring & path)
|
||||
Item * Dirs::GetDir(const std::wstring & name, long parent)
|
||||
{
|
||||
if( path.empty() )
|
||||
return GetDir(name.c_str(), parent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Item * Dirs::GetDir(const wchar_t * path)
|
||||
{
|
||||
if( *path == 0 )
|
||||
return 0;
|
||||
|
||||
DirContainer::Iterator root = dir_tab.GetRoot();
|
||||
|
@ -376,7 +382,7 @@ Item * Dirs::GetDir(const std::wstring & path)
|
|||
return 0;
|
||||
|
||||
Item * pitem = &(*root);
|
||||
const wchar_t * s = path.c_str();
|
||||
const wchar_t * s = path;
|
||||
|
||||
while( ExtractName(s, get_dir_temp) )
|
||||
{
|
||||
|
@ -390,6 +396,13 @@ return pitem;
|
|||
}
|
||||
|
||||
|
||||
|
||||
Item * Dirs::GetDir(const std::wstring & path)
|
||||
{
|
||||
return GetDir(path.c_str());
|
||||
}
|
||||
|
||||
|
||||
Item * Dirs::GetDir(long id)
|
||||
{
|
||||
DirContainer::Iterator i = dir_tab.FindId(id);
|
||||
|
|
|
@ -67,7 +67,10 @@ public:
|
|||
Item * GetRootDir();
|
||||
Item * GetEtcDir();
|
||||
Item * GetVarDir();
|
||||
|
||||
Item * GetDir(const wchar_t * name, long parent);
|
||||
Item * GetDir(const std::wstring & name, long parent);
|
||||
Item * GetDir(const wchar_t * path);
|
||||
Item * GetDir(const std::wstring & path);
|
||||
Item * GetDir(long id);
|
||||
Item * AddDir(const Item & item);
|
||||
|
|
|
@ -483,5 +483,10 @@ 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 ../../functions/rm.h
|
||||
ticketinfo.o: ../../core/log.h ../../core/misc.h ../../core/plugin.h
|
||||
ticketinfo.o: pluginmsg.h ../../core/system.h ../../core/sessionmanager.h
|
||||
ticketinfo.o: ../../core/sessioncontainer.h ../../templates/templates.h
|
||||
ticketinfo.o: ../../templates/patterncacher.h ../../templates/indexpatterns.h
|
||||
ticketinfo.o: ../../templates/patterns.h ../../templates/changepatterns.h
|
||||
ticketinfo.o: ../../templates/htmltextstream.h ../../core/sessionmanager.h
|
||||
ticketinfo.o: sessiondata.h ../../core/plugindata.h ../../functions/rm.h
|
||||
|
|
|
@ -93,7 +93,7 @@ void CreateTicket::Submit(Ticket & ticket, Item & item)
|
|||
{
|
||||
log << log2 << "CreateTicket: added a new ticket" << logend;
|
||||
RemoveTmpTicket();
|
||||
system->RedirectTo(item);
|
||||
ticket_info->MakeRedirectIfPossible(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -159,7 +159,10 @@ void CreateTicket::MakePost()
|
|||
ticket_info->CopyTicketSpace(meta, item);
|
||||
|
||||
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
|
||||
{
|
||||
Submit(ticket, item);
|
||||
ticket_info->ticket = 0; // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -92,7 +92,7 @@ void EditTicket::Submit(Ticket & ticket, Item & item)
|
|||
{
|
||||
log << log2 << "EditTicket: ticket modified" << logend;
|
||||
RemoveTmpTicket();
|
||||
system->RedirectTo(item);
|
||||
ticket_info->MakeRedirectIfPossible(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -180,7 +180,10 @@ void EditTicket::MakePost()
|
|||
ticket_info->CopyTicketSpace(meta, item);
|
||||
|
||||
if( !cur->request->IsPostVar(L"fileuploadsubmit") )
|
||||
{
|
||||
Submit(ticket, item);
|
||||
ticket_info->ticket = 0; // ticket was deleted by Submit() method -- RemoveTmpTicket() was used
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#define WINIX_PL_TICKET_SORT_POINTERS 4100
|
||||
|
||||
|
||||
//
|
||||
#define WINIX_PL_TICKET_CAN_MAKE_REDIRECT 4110
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -531,7 +531,9 @@ void ticket_tab(Info & i)
|
|||
value.is_param = true;
|
||||
value.config_par = space.spaces[conf_index];
|
||||
value.param_id = value.config_par->Long(L"id");
|
||||
find_ticket_value(value, ticket_info.ticket->par_tab, ticket_info.item->meta);
|
||||
|
||||
if( ticket_info.ticket && ticket_info.item )
|
||||
find_ticket_value(value, ticket_info.ticket->par_tab, ticket_info.item->meta);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "core/error.h"
|
||||
#include "core/log.h"
|
||||
#include "core/misc.h"
|
||||
#include "core/plugin.h"
|
||||
#include "pluginmsg.h"
|
||||
#include "sessiondata.h"
|
||||
|
||||
namespace Ticket
|
||||
|
@ -510,4 +512,20 @@ void TicketInfo::CopyTicketSpace(PT::Space & ticket_space, Item & item)
|
|||
}
|
||||
|
||||
|
||||
|
||||
void TicketInfo::MakeRedirectIfPossible(const Item & item)
|
||||
{
|
||||
PluginRes res = plugin.Call(WINIX_PL_TICKET_CAN_MAKE_REDIRECT);
|
||||
|
||||
if( res.res_false > 0 )
|
||||
{
|
||||
log << log4 << "Ticket: redirect prevented" << logend;
|
||||
return;
|
||||
}
|
||||
|
||||
system->RedirectTo(item);
|
||||
}
|
||||
|
||||
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -102,6 +102,8 @@ public:
|
|||
void RemoveTicket(long file_id);
|
||||
void CopyTicketSpace(PT::Space & ticket_space, Item & item);
|
||||
|
||||
void MakeRedirectIfPossible(const Item & item);
|
||||
|
||||
private:
|
||||
|
||||
Db * db;
|
||||
|
|
Loading…
Reference in New Issue