added: to plugin thread: message WINIX_PL_THREAD_CAN_MAKE_REDIRECT

(similar as for ticket)



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@888 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2012-09-14 07:14:54 +00:00
parent bd1f717b4c
commit da15323c2f
7 changed files with 85 additions and 4 deletions

View File

@ -384,3 +384,31 @@ threadinfo.o: ../../core/users.h ../../core/groups.h ../../core/group.h
threadinfo.o: ../../core/loadavg.h ../../core/image.h
threadinfo.o: ../../core/threadmanager.h ../../core/timezones.h
threadinfo.o: ../../core/timezone.h thread.h tdb.h ../../db/dbbase.h
threadinfo.o: ../../core/plugin.h pluginmsg.h ../../core/system.h
threadinfo.o: ../../core/sessionmanager.h ../../core/sessioncontainer.h
threadinfo.o: ../../functions/functions.h ../../functions/functionbase.h
threadinfo.o: ../../functions/functionparser.h ../../core/cur.h
threadinfo.o: ../../functions/adduser.h ../../functions/cat.h
threadinfo.o: ../../functions/chmod.h ../../functions/privchanger.h
threadinfo.o: ../../core/request.h ../../functions/chown.h
threadinfo.o: ../../functions/ckeditor.h ../../functions/cp.h
threadinfo.o: ../../functions/default.h ../../functions/download.h
threadinfo.o: ../../functions/emacs.h ../../functions/env.h
threadinfo.o: ../../functions/last.h ../../functions/login.h
threadinfo.o: ../../functions/logout.h ../../functions/ln.h
threadinfo.o: ../../functions/ls.h ../../functions/man.h
threadinfo.o: ../../functions/meta.h ../../functions/mkdir.h
threadinfo.o: ../../functions/mv.h ../../functions/nicedit.h
threadinfo.o: ../../functions/node.h ../../functions/passwd.h
threadinfo.o: ../../functions/priv.h ../../functions/pw.h
threadinfo.o: ../../functions/reload.h ../../functions/rm.h
threadinfo.o: ../../functions/rmuser.h ../../functions/sort.h
threadinfo.o: ../../functions/specialdefault.h ../../functions/stat.h
threadinfo.o: ../../functions/subject.h ../../functions/template.h
threadinfo.o: ../../functions/tinymce.h ../../functions/uname.h
threadinfo.o: ../../functions/upload.h ../../functions/uptime.h
threadinfo.o: ../../functions/who.h ../../functions/vim.h
threadinfo.o: ../../core/htmlfilter.h ../../templates/templates.h
threadinfo.o: ../../templates/patterncacher.h ../../templates/indexpatterns.h
threadinfo.o: ../../templates/patterns.h ../../templates/changepatterns.h
threadinfo.o: ../../templates/htmltextstream.h ../../core/sessionmanager.h

View File

@ -89,7 +89,7 @@ void CreateThread::MakePost()
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "CreateThread: added a new thread" << logend;
system->RedirectTo(cur->request->item);
thread_info->MakeRedirectIfPossible(cur->request->item);
SendNotify(cur->request->item);
}
else

View File

@ -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.
*
*/
@ -19,6 +19,10 @@
#define WINIX_PL_THREAD_PREPARE_THREAD 4003
#define WINIX_PL_THREAD_SEARCH_THREAD_DIR 4004
#define WINIX_PL_THREAD_CAN_MAKE_REDIRECT 4005
#endif

View File

@ -106,7 +106,7 @@ void Reply::MakePost()
if( cur->request->status == WINIX_ERR_OK )
{
log << log2 << "Reply: added an answer in a thread" << logend;
system->RedirectTo(cur->request->item);
thread_info->MakeRedirectIfPossible(cur->request->item);
SendNotify(cur->request->item);
}
else

View File

@ -2,12 +2,14 @@
* 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.
*
*/
#include "threadinfo.h"
#include "core/plugin.h"
#include "pluginmsg.h"
@ -43,6 +45,12 @@ void ThreadInfo::Clear()
Item * ThreadInfo::FindThreadDir()
{
Item * plugin_dir = 0;
plugin.Call(WINIX_PL_THREAD_SEARCH_THREAD_DIR, &plugin_dir);
if( plugin_dir )
return plugin_dir;
const std::wstring & dir_str = system->mounts.pmount->FirstArg(mount_par_thread_dir);
if( dir_str.empty() )
@ -132,6 +140,22 @@ void ThreadInfo::Repair()
}
void ThreadInfo::MakeRedirectIfPossible(const Item & item)
{
PluginRes res = plugin.Call(WINIX_PL_THREAD_CAN_MAKE_REDIRECT);
if( res.res_false > 0 )
{
log << log4 << "Thread: redirect prevented" << logend;
return;
}
system->RedirectTo(item);
}
} // namespace

View File

@ -69,6 +69,8 @@ public:
// repairing the database
void Repair();
void MakeRedirectIfPossible(const Item & item);
private:
Db * db;

View File

@ -422,6 +422,27 @@ void tickets_tab_subject(Info & i)
}
void tickets_tab_date_creation(Info & i)
{
tickets_tab_check_reqid();
if( tickets_value.is_item )
i.out << tickets_value.item->date_creation;
}
void tickets_tab_date_creation_nice(Info & i)
{
tickets_tab_check_reqid();
if( tickets_value.is_item )
print_date_nice(i, tickets_value.item->date_creation);
}
void tickets_tab_conf_tab(Info & i)
{
tickets_tab_check_reqid();
@ -796,6 +817,8 @@ using namespace ns_ticket_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_date_creation", tickets_tab_date_creation);
fun->Insert("tickets_tab_date_creation_nice", tickets_tab_date_creation_nice);
fun->Insert("tickets_tab_conf_tab", tickets_tab_conf_tab);
fun->Insert("tickets_tab_conf_tab_has_value", tickets_tab_conf_tab_has_value);