updated to the new Ezc API

[ezc stream] has gone, now we have [ezc out] and [out]
the output streams have names now: it's a std::map, before we have a std::vector
and the streams are serialized to "out" space in json
Request::out_streams[] are split into Request::out_main_stream and Request::out_streams class



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1017 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2015-11-15 22:23:36 +00:00
parent 632b49ab90
commit c433b3fd41
27 changed files with 1123 additions and 889 deletions

View File

@@ -5,7 +5,7 @@
*/
/*
* Copyright (c) 2008-2014, Tomasz Sowa
* Copyright (c) 2008-2015, Tomasz Sowa
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,6 +48,7 @@
#include "space/space.h"
#include "space/spacetojson.h"
#include "textstream/textstream.h"
#include "outstreams.h"
namespace Winix
@@ -234,21 +235,21 @@ struct Request
// | |
// normal request ajax request
// | |
// sending out_streams[0] |
// sending out_main_stream |
// |
// |
// depending on return_info_only
// (if false) ------------------------------------------------------ (if true)
// | |
// generating JSON object from: generating JSON object only from info
// out_streams and info, e.g.: e.g.:
// { { info object serialized here }
// "stream_1": "some html content",
// "stream_2": "some other html content",
// "info": { info object serialized here }
// }
// note that out_streams[0] is not sent
// in JSON answers
// (if false) ------------------------------------------------------------- (if true)
// | |
// generating JSON object from: generating JSON object only from info
// out_streams and info, e.g.: e.g.:
// { { info object serialized here }
// "out": { out_streams serialized here e.g.:
// "stream_name_1": "some html content",
// "stream_name_2": "some other html content"
// },
// "info": { info object serialized here }
// }
//
//
bool send_bin_stream;
@@ -258,9 +259,9 @@ struct Request
// when returning the text answer we can either return the whole html page (normal requests)
// or a JSON object (for requests generated from AJAX)
// if return_json is false then we return the whole html page (which is in out_streams[0])
// if return_json is false then we return the whole html page (which is in out_main_stream)
// if return_json is true we are creating an JSON object from out_streams
// (zero stream is ignored) and from info space (see above picture)
// and from info space (see above picture)
// (or just only from info if return_info_only is true)
// default: false
// return_json is set to true by App at the beginning of a request
@@ -268,13 +269,14 @@ struct Request
// note: return_json is only valid if send_bin_stream is false
bool return_json;
// main text output streams where the html otput is generated from ezc templates
// the zero stream (out_streams[0]) is used as the main stream
// to which the whole html page (with doctype, head, body) is generated
// the rest streams can be only used in ajax requests (send in JSON format to the client)
// in ezc templates you can use [ezc stream ...] keyword
// to switch between streams e.g. [ezc stream "0" "2"]
std::vector<HtmlTextStream> out_streams;
// main text output stream where the html otput is generated from ezc templates
// here the whole html page (with doctype, head, body) is generated
HtmlTextStream out_main_stream;
// text output streams used in ajax requests (send in JSON format to the client)
// in ezc templates you can use [ezc out "stream_name"] keyword
// to switch between streams
Ezc::OutStreams<HtmlTextStream> out_streams;
// if true the JSON object is generated only from info (out_streams are not used)
// default: false
@@ -295,14 +297,14 @@ struct Request
// default: false
bool page_generated;
// whether or not the html filter should be used
// the size of the table is the same as out_streams
// default: all items true
std::vector<bool> use_html_filter;
// whether or not the main html stream should be filtered by our html filter
bool out_main_stream_use_html_filter;
// whether or not the ajax streams should be filtered by our html filter
// this filter is only aplied to streams in "out" space, "info" space is not touched
bool out_streams_use_html_filter;
// if this variable is true then winix always return 200 OK header
// when the status would be 404 (not found) or 403 (permission denied)
// default: false