changed: the way how raw template is set

option for setting raw template from 'emacs' function has been removed
         now we have index_raw.html template and it can be set from 'template' function
removed: template index_fullscreen.html
changed: some work in miscspace (changed: space_list_tab, space_list_tab_value and space_list_tab_has_next)
fixed:   main index template could not be set through 'template' function





git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1039 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2016-04-04 16:02:36 +00:00
parent abd1500f07
commit 240bf4dc5d
21 changed files with 105 additions and 445 deletions

View File

@@ -601,8 +601,6 @@ void App::CreateJSONAnswer()
// !! IMPROVE ME change to a better name
void App::MakePage()
{
bool sent = false;
if( cur.request->page_generated || !cur.request->redirect_to.empty() || !cur.request->x_sendfile.empty() )
return;
@@ -610,27 +608,7 @@ bool sent = false;
cur.request->gen_skip_new_line,
cur.request->gen_use_special_chars);
if( cur.request->is_item && cur.request->item.file_type == WINIX_ITEM_FILETYPE_NONE &&
cur.request->item.content_type == Item::ct_raw && cur.request->status == WINIX_ERR_OK && cur.request->function )
{
if( cur.request->function == &functions.fun_cat )
{
TemplatesFunctions::item_print_content(cur.request->out_main_stream,
cur.request->item.content, cur.request->item.content_type);
sent = true;
}
else
if( cur.request->function == &functions.fun_run )
{
templates.GenerateRunRaw();
sent = true;
}
}
if( !sent )
{
templates.Generate();
}
templates.Generate();
}
@@ -1182,13 +1160,6 @@ void App::SendHeaders()
template<class RawType>
DbTextStream::RawText<RawType> R(const RawType & par)
{
return DbTextStream::RawText<RawType>(par);
}
void App::SendCookies()
{
PT::Space::TableSingle::iterator i;
@@ -1248,14 +1219,11 @@ void App::PrepareHeaders(bool compressing, int compress_encoding, Header header,
void App::FilterContent()
{
Request & req = *cur.request;
bool raw = req.is_item && req.item.content_type == Item::ct_raw &&
req.status == WINIX_ERR_OK && req.function &&
(req.function == &functions.fun_cat || req.function == &functions.fun_run);
bool filter_main_stream = false;
bool filter_json = false;
if( config.html_filter && !req.send_bin_stream && !raw )
if( config.html_filter && !req.send_bin_stream )
{
if( req.return_json )
{

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2015, Tomasz Sowa
* Copyright (c) 2008-2016, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -182,6 +182,7 @@ void Config::AssignValues(bool stdout_is_closed)
templates_fun_prefix = Text(L"templates_fun_prefix", L"fun_");
templates_fun_postfix = Text(L"templates_fun_postfix", L".html");
templates_index = Text(L"templates_index", L"index.html");
templates_index_raw = Text(L"templates_index_raw", L"index_raw.html");
template_only_root_use_template_fun = Bool(L"template_only_root_use_template_fun", false);
http_session_id_name = Text(L"http_session_id_name", L"session_id");

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2015, Tomasz Sowa
* Copyright (c) 2008-2016, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -175,6 +175,10 @@ public:
// default: index.html
std::wstring templates_index;
// html template used to send raw content
// default: index_raw.html
std::wstring templates_index_raw;
// if true then only root can use 'template' winix function
// default: false
bool template_only_root_use_template_fun;

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2016, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -82,7 +82,6 @@ struct Item
ct_formatted_text,
ct_html,
ct_bbcode,
ct_raw
};
ContentType content_type;
@@ -116,7 +115,6 @@ struct Item
int hash_type; // hash type WINIX_CRYPT_HASH_* (see crypt.h)
size_t file_size; // size of the file
std::wstring html_template;

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2016, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -753,11 +753,6 @@ bool System::CanUseBBCode(long user_id)
}
bool System::CanUseRaw(long user_id)
{
return IsSuperUser(user_id) || IsMemberOfGroup(user_id, L"allow_raw");
}
bool System::IsSuperUser(long user_id)
@@ -1395,15 +1390,15 @@ bool System::AddCommonFileToVar(const wchar_t * file_path, const wchar_t * url,
}
file_content_item.Clear();
file_content_item.parent_id = var->id;
file_content_item.user_id = var->user_id;
file_content_item.group_id = var->group_id;
file_content_item.privileges = 07555; // !! IMPROVE ME: may it should be added as a parameter to this function?
file_content_item.subject = url;
file_content_item.url = url;
file_content_item.type = Item::file;
file_content_item.content_type = Item::ct_raw;
file_content_item.content = file_content;
file_content_item.parent_id = var->id;
file_content_item.user_id = var->user_id;
file_content_item.group_id = var->group_id;
file_content_item.privileges = 07555; // !! IMPROVE ME: may it should be added as a parameter to this function?
file_content_item.subject = url;
file_content_item.url = url;
file_content_item.type = Item::file;
file_content_item.html_template = config->templates_index_raw;
file_content_item.content = file_content;
return AddFile(file_content_item, false) == WINIX_ERR_OK;
}

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2010-2014, Tomasz Sowa
* Copyright (c) 2010-2016, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -158,7 +158,6 @@ public:
bool CanUseHtml(long user_id);
bool CanUseBBCode(long user_id);
bool CanUseRaw(long user_id);
bool IsSuperUser(long user_id);
bool IsMemberOfGroup(long user_id, const wchar_t * group_name);