updated to the new pikotools api: [ezc out] and [out] changed to [ezc frame] or just [frame]

- when returning json streams changed "out" field to "frames"
- renamed config parameter: allow_ezc_out_in_executable_items -> allow_ezc_frames_in_executable_items
- added basic support for ajax requests in thread plugin
This commit is contained in:
Tomasz Sowa 2021-05-28 18:36:19 +02:00
parent ba331dea4a
commit e6fae4598c
8 changed files with 24 additions and 15 deletions

View File

@ -750,7 +750,7 @@ void App::CreateJSONAnswer()
if( !req.return_info_only )
{
json_out_stream << L"{\n\"out\": {\n";
json_out_stream << L"{\n\"frames\": {\n";
auto i = req.out_streams.streams_map.begin();
bool is_first = true;

View File

@ -309,7 +309,7 @@ void Config::AssignValues(bool stdout_is_closed)
incorrect_login_cannot_login_delay = Size(L"incorrect_login_cannot_login_delay", 1800);
pid_file = Text(L"pid_file", L"");
allow_ezc_out_in_executable_items = Bool(L"allow_ezc_out_in_executable_items", false);
allow_ezc_frames_in_executable_items = Bool(L"allow_ezc_frames_in_executable_items", false);
check_proxy_ip_header = Bool(L"check_proxy_ip_header", false);
proxy_ip_header = Text(L"proxy_ip_header", L"X_Real_IP");

View File

@ -638,7 +638,7 @@ public:
// how many output streams do we have in Request class
// those streams used in ajax responses
// you can use no more [ezc out] statements than this limit
// you can use no more [ezc frames] statements than this limit
// default: 128
size_t ezc_out_streams_size;
@ -758,10 +758,10 @@ public:
// pid file is saved after winix has dropped privileges
std::wstring pid_file;
// allow to use [ezc out] statement in executable items (used in 'run' winix function)
// allow to use [ezc frame] statements in executable items (used in 'run' winix function)
// default false
// warning: if you enable this options a user can override a different output stream when using ajax
bool allow_ezc_out_in_executable_items;
bool allow_ezc_frames_in_executable_items;
// check whether there is a 'log_proxy_ip_header' header

View File

@ -3,7 +3,7 @@
<h1>{create_thread_header}</h1>
<form class="uk-form-stacked" method="post" action="[doc_base_url][dir]createthread">
<form class="uk-form-stacked" method="post" action="[doc_base_url][dir]createthread" [if winix_has_htmx]hx-post="[doc_base_url][dir]createthread" hx-push-url="true"[end]>
<div class="uk-margin">
<label class="uk-form-label" for="winix_title_id">{title}</label>

View File

@ -3,7 +3,7 @@
<h1>{thread_header_reply}</h1>
<form class="uk-form-stacked" method="post" action="[doc_base_url][dir][item_url]/reply">
<form class="uk-form-stacked" method="post" action="[doc_base_url][dir][item_url]/reply" [if winix_has_htmx]hx-post="[doc_base_url][dir][item_url]/reply"[end]>
[if thread_mount_arg_is "subject"]
<div class="uk-margin">

View File

@ -1,4 +1,4 @@
<div class="winix">
<div class="winix winix-threads-list">
[if mount_page_arg_is "subject"]<h1[if mount_page_arg_is "info"] class="withinfo"[end]>[dir_last_subject]</h1>[end]
[if mount_page_arg_is "info"][include "dir_last_info.html"][end]
@ -6,7 +6,7 @@
[if thread_can_create]
<div class="uk-margin">
<a class="uk-button uk-button-primary" href="[doc_base_url][dir]createthread" rel="nofollow">{thread_create_new}</a>
<a class="uk-button uk-button-primary" href="[doc_base_url][dir]createthread" rel="nofollow" [if winix_has_htmx]hx-get="[doc_base_url][dir]createthread" hx-swap="outerHTML" hx-target="this"[end]>{thread_create_new}</a>
</div>
[end]
@ -16,7 +16,7 @@
<tr><th>{thread_tab_title}</th><th>{thread_tab_author}</th><th>{thread_tab_replies}</th><th>{thread_tab_last_post}</th></tr>
[for thread_sort_tab]
<tr>
<td><a href="[doc_base_url][dir][thread_sort_tab_url]">[thread_sort_tab_subject]</a></td> [# dodac sprawdzanie subject empty]
<td><a class="winix-thread-link" href="[doc_base_url][dir][thread_sort_tab_url]" [if winix_has_htmx]hx-get="[doc_base_url][dir][thread_sort_tab_url]" hx-push-url="true"[end]>[thread_sort_tab_subject]</a></td> [# dodac sprawdzanie subject empty]
<td>[thread_sort_tab_user]</td><td class="smallfont">[thread_sort_tab_replies]</td>
<td>[thread_sort_tab_last_item_date_modification_nice] ([thread_sort_tab_last_item_user])</td>
</tr>
@ -27,4 +27,11 @@
</div>
[if false]
[if any winix_has_htmx winix_is_htmx_request winix_has_uikit]
<script>
[# fixme: not working in this way]
UIkit.scroll(".winix-thread-link").scrollTo(".winix-threads-list");
</script>
[end]
[end]

View File

@ -17,7 +17,7 @@
[if thread_mount_arg_is "sort_desc"]
[if thread_can_reply]
<div class="uk-margin">
<a class="uk-button uk-button-primary" href="[doc_base_url][dir][item_url]/reply" rel="nofollow">{thread_reply_in_this_thread}</a>
<a class="uk-button uk-button-primary" href="[doc_base_url][dir][item_url]/reply" rel="nofollow" [if winix_has_htmx]hx-get="[doc_base_url][dir][item_url]/reply" hx-swap="outerHTML" hx-target="this"[end]>{thread_reply_in_this_thread}</a>
</div>
[end]
[end]
@ -47,10 +47,12 @@
[if not [thread_mount_arg_is "sort_desc"]]
[if thread_can_reply]
<div class="uk-margin">
<a class="uk-button uk-button-primary" href="[doc_base_url][dir][item_url]/reply" rel="nofollow">{thread_reply_in_this_thread}</a>
<a class="uk-button uk-button-primary" href="[doc_base_url][dir][item_url]/reply" rel="nofollow" [if winix_has_htmx]hx-get="[doc_base_url][dir][item_url]/reply" hx-swap="outerHTML" hx-target="this"[end]>{thread_reply_in_this_thread}</a>
</div>
[end]
[end]
</div>

View File

@ -335,7 +335,7 @@ void item_run(Info & i)
InitGenerator(ezc_generator);
ezc_generator.SetPattern(*p);
if( config->allow_ezc_out_in_executable_items )
if( config->allow_ezc_frames_in_executable_items )
ezc_generator.Generate(item_run_content, cur->request->out_streams);
else
ezc_generator.Generate(item_run_content);
@ -742,7 +742,7 @@ void item_tab_run(Info & i)
InitGenerator(ezc_generator);
ezc_generator.SetPattern(*p);
if( config->allow_ezc_out_in_executable_items )
if( config->allow_ezc_frames_in_executable_items )
ezc_generator.Generate(item_run_content, cur->request->out_streams);
else
ezc_generator.Generate(item_run_content);