changed: when there is reqtype:json parameter and there is not set request.ajax_serializer
then we are using a generic json serializer changed: we are sending the application/json header when returning an json string added: to config: log_server_answer (default false) when true we put the whole string (server's answer) to the log file added: to Request: use_200_status_for_not_found_and_permission_denied if this is true then if the server http code would be 403 or 404 then we return 200 OK (useful when using ajax) changed: System::RedirectTo() methods take as the last parameter: use_reqtype if this is true (default) then reqtype:type parameter is automatically added to the redirecting path git-svn-id: svn://ttmath.org/publicrep/winix/trunk@918 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
@@ -150,7 +150,7 @@ bool ssl = false;
|
||||
/*
|
||||
postfix will not be UrlEncoded
|
||||
*/
|
||||
void System::RedirectTo(const Item & item, const wchar_t * postfix)
|
||||
void System::RedirectTo(const Item & item, const wchar_t * postfix, bool use_reqtype)
|
||||
{
|
||||
PutUrlProto(config->use_ssl, cur->request->redirect_to);
|
||||
|
||||
@@ -176,6 +176,12 @@ void System::RedirectTo(const Item & item, const wchar_t * postfix)
|
||||
|
||||
if( postfix )
|
||||
cur->request->redirect_to += postfix;
|
||||
|
||||
if( use_reqtype && cur->request->IsParam(L"reqtype") )
|
||||
{
|
||||
cur->request->redirect_to += L"/-/reqtype:";
|
||||
cur->request->redirect_to += cur->request->ParamValue(L"reqtype");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +189,7 @@ void System::RedirectTo(const Item & item, const wchar_t * postfix)
|
||||
/*
|
||||
postfix will not be UrlEncoded
|
||||
*/
|
||||
void System::RedirectTo(long item_id, const wchar_t * postfix)
|
||||
void System::RedirectTo(long item_id, const wchar_t * postfix, bool use_reqtype)
|
||||
{
|
||||
PutUrlProto(config->use_ssl, cur->request->redirect_to);
|
||||
|
||||
@@ -224,6 +230,12 @@ void System::RedirectTo(long item_id, const wchar_t * postfix)
|
||||
|
||||
if( postfix )
|
||||
cur->request->redirect_to += postfix;
|
||||
|
||||
if( use_reqtype && cur->request->IsParam(L"reqtype") )
|
||||
{
|
||||
cur->request->redirect_to += L"/-/reqtype:";
|
||||
cur->request->redirect_to += cur->request->ParamValue(L"reqtype");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -231,7 +243,7 @@ void System::RedirectTo(long item_id, const wchar_t * postfix)
|
||||
/*
|
||||
url will not be UrlEncoded
|
||||
*/
|
||||
void System::RedirectTo(const wchar_t * url)
|
||||
void System::RedirectTo(const wchar_t * url, bool use_reqtype)
|
||||
{
|
||||
PutUrlProto(config->use_ssl, cur->request->redirect_to);
|
||||
|
||||
@@ -262,15 +274,21 @@ void System::RedirectTo(const wchar_t * url)
|
||||
cur->request->redirect_to += url;
|
||||
}
|
||||
}
|
||||
|
||||
if( use_reqtype && cur->request->IsParam(L"reqtype") )
|
||||
{
|
||||
cur->request->redirect_to += L"/-/reqtype:";
|
||||
cur->request->redirect_to += cur->request->ParamValue(L"reqtype");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
url will not be UrlEncoded
|
||||
*/
|
||||
void System::RedirectTo(const std::wstring & url)
|
||||
void System::RedirectTo(const std::wstring & url, bool use_reqtype)
|
||||
{
|
||||
RedirectTo(url.c_str());
|
||||
RedirectTo(url.c_str(), use_reqtype);
|
||||
}
|
||||
|
||||
|
||||
@@ -324,38 +342,52 @@ void System::RedirectWithFunctionAndParamsTo(const std::wstring & url)
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastDir(const wchar_t * postfix)
|
||||
void System::RedirectToLastDir(const wchar_t * postfix, bool use_reqtype)
|
||||
{
|
||||
if( !cur->request->dir_tab.empty() )
|
||||
RedirectTo( *cur->request->dir_tab.back(), postfix );
|
||||
RedirectTo( *cur->request->dir_tab.back(), postfix, use_reqtype);
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastItem(const wchar_t * postfix)
|
||||
void System::RedirectToLastItem(const wchar_t * postfix, bool use_reqtype)
|
||||
{
|
||||
if( cur->request->last_item )
|
||||
RedirectTo( *cur->request->last_item, postfix );
|
||||
RedirectTo( *cur->request->last_item, postfix, use_reqtype );
|
||||
}
|
||||
|
||||
|
||||
void System::RedirectToLastFunction(const wchar_t * postfix)
|
||||
void System::RedirectToLastFunction(const wchar_t * postfix, bool use_reqtype)
|
||||
{
|
||||
RedirectToLastDir();
|
||||
RedirectToLastDir(0, false);
|
||||
TrimLast(cur->request->redirect_to, '/');
|
||||
|
||||
if( cur->request->is_item )
|
||||
{
|
||||
cur->request->redirect_to += cur->request->item.url;
|
||||
cur->request->redirect_to += '/';
|
||||
cur->request->redirect_to += cur->request->item.url;
|
||||
}
|
||||
|
||||
if( cur->request->function )
|
||||
{
|
||||
cur->request->redirect_to += '/';
|
||||
cur->request->redirect_to += cur->request->function->fun.url;
|
||||
}
|
||||
|
||||
if( postfix )
|
||||
{
|
||||
cur->request->redirect_to += '/';
|
||||
cur->request->redirect_to += postfix;
|
||||
}
|
||||
|
||||
if( use_reqtype && cur->request->IsParam(L"reqtype") )
|
||||
{
|
||||
if( !cur->request->function && !postfix )
|
||||
cur->request->redirect_to += L"/-";
|
||||
|
||||
cur->request->redirect_to += L"/reqtype:";
|
||||
cur->request->redirect_to += cur->request->ParamValue(L"reqtype");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user