diff --git a/winixd/core/app.cpp b/winixd/core/app.cpp index 45146ce..ef30631 100644 --- a/winixd/core/app.cpp +++ b/winixd/core/app.cpp @@ -724,6 +724,25 @@ void App::SaveSessionsIfNeeded() +const std::wstring * App::CreateFrameAnswer() +{ + Request & req = *cur.request; + auto i = req.out_streams.streams_map.begin(); + const std::wstring * frame = cur.request->ParamValuep(L"frame"); + + for( ; i != req.out_streams.streams_map.end() ; ++i) + { + if( (frame && i->first == *frame) || (!frame && i->first == L"content") ) + { + return &i->second->Str(); + break; + } + } + + return nullptr; +} + + void App::CreateJSONAnswer() { Request & req = *cur.request; @@ -1764,11 +1783,12 @@ return header; void App::SendTextAnswer() { -const std::wstring * source; +const std::wstring * source = nullptr; bool compressing = false; int compress_encoding = 0; size_t output_size = 0; + Header header = GetHTTPStatusCode(); if( CanSendContent() ) @@ -1781,6 +1801,17 @@ size_t output_size = 0; source = &json_out_stream.Str(); // json_out_stream was prepared by CreateJSONAnswer() } else + if( cur.request->headers_in.has_key(L"HX-Request") || cur.request->headers_in.has_key(L"hx_request") ) // fastcgi will change the header to hx_request + { + source = CreateFrameAnswer(); + + if( !source ) + { + empty_response.clear(); + source = &empty_response; + } + } + else { source = &cur.request->out_main_stream.Str(); } diff --git a/winixd/core/app.h b/winixd/core/app.h index 6d1172a..3bef5c8 100644 --- a/winixd/core/app.h +++ b/winixd/core/app.h @@ -164,6 +164,7 @@ private: std::wstring http_header_name; std::wstring http_header_value; std::string http_header_8bit; + std::wstring empty_response; morm::ModelConnector model_connector; // main thread model connector, each thread has its own connector morm::JSONConnector json_connector; @@ -206,6 +207,7 @@ private: void SaveSessionsIfNeeded(); // !! IMPROVE ME wywalic do menagera sesji?? void LogAccess(); void SendData(const BinaryPage & page, FCGX_Stream * out); + const std::wstring * CreateFrameAnswer(); void CreateJSONAnswer(); void ReadRequest(); diff --git a/winixd/html/ckeditor.html b/winixd/html/ckeditor.html index da0c890..b4a2ea4 100644 --- a/winixd/html/ckeditor.html +++ b/winixd/html/ckeditor.html @@ -3,13 +3,17 @@ [# blocks are not connected with languages yet, so don't use \{ but {] - - -if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) -{ - CKEDITOR.tools.enableHtml5Elements( document ); +function winix_ckeditor_old_browser_support() { + if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) + { + CKEDITOR.tools.enableHtml5Elements( document ); + } } +[if not winix_is_htmx_request] + winix_ckeditor_old_browser_support(); +[end] + [end] @@ -22,6 +26,7 @@ if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 ) [block ckeditor] diff --git a/winixd/html/index_bottom_adder.html b/winixd/html/index_bottom_adder.html index 139597f..72a6e76 100644 --- a/winixd/html/index_bottom_adder.html +++ b/winixd/html/index_bottom_adder.html @@ -1,2 +1,180 @@ +[if winix_has_htmx] +