123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- /** Autogenerated by otemplate v. 0.2.0 */
- #include <libintl.h>
- #include <string.h>
- #include <onion/onion.h>
- #include <onion/dict.h>
- typedef struct dict_res_t{
- onion_dict *dict;
- onion_response *res;
- }dict_res;
- void fortunes_html_blocks_init(onion_dict *context);
- void fortunes_html(onion_dict *context, onion_response *res);
- void base_html(onion_dict *context, onion_response *res);
- void fortunes_html__block_content(onion_dict *context, onion_response *res);
- static void otemplate_f_0000(dict_res *dr, const char *key, const void *value, int flags);
- static void otemplate_f_0001(onion_dict *context, onion_response *res);
- onion_connection_status fortunes_html_handler_page(onion_dict *context, onion_request *req, onion_response *res){
- fortunes_html(context, res);
- return OCS_PROCESSED;
- }
- onion_handler *fortunes_html_handler(onion_dict *context){
- return onion_handler_new((onion_handler_handler)fortunes_html_handler_page, context, (onion_handler_private_data_free)onion_dict_free);
- }
- onion_connection_status fortunes_html_template(onion_dict *context, onion_request *req, onion_response *res){
- if (context) onion_dict_add(context, "LANG", onion_request_get_language_code(req), OD_FREE_VALUE);
- fortunes_html(context, res);
- if (context) onion_dict_free(context);
- return OCS_PROCESSED;
- }
- #line 1 "fortunes.html"
- #line 1
- void fortunes_html_blocks_init(onion_dict *context){
- #line 1
- if (!onion_dict_get(context, "__block_content__"))
- onion_dict_add(context, "__block_content__", fortunes_html__block_content, 0);
- #line 1
- }
- #line 1
- void fortunes_html(onion_dict *context, onion_response *res){
- #line 1
- #line 1
- int has_context=(context!=NULL);
- #line 1
- if (!has_context)
- #line 1
- context=onion_dict_new();
- #line 1
-
- #line 1
- fortunes_html_blocks_init(context);
- #line 1
- base_html(context, res);
- #line 17
- if (!has_context)
- #line 17
- onion_dict_free(context);
- #line 1
- }
- #line 1
- void fortunes_html__block_content(onion_dict *context, onion_response *res){
- #line 1
- onion_response_write(res, "\n"
- "<table>\n"
- "<tr>\n"
- "<th>id</th>\n"
- "<th>message</th>\n"
- "</tr>\n"
- "", 49);
- #line 8
- {
- #line 8
- onion_dict *loopdict=onion_dict_get_dict(context, "fortunes");
- #line 8
- onion_dict *tmpcontext=onion_dict_hard_dup(context);
- #line 8
- if (loopdict){
- #line 8
- dict_res dr={ .dict = tmpcontext, .res=res };
- #line 8
- onion_dict_preorder(loopdict,
- #line 13
- otemplate_f_0000, &dr);
- #line 13
- }
- #line 13
- onion_dict_free(tmpcontext);
- #line 13
- }
- onion_response_write(res, "\n"
- "</table>\n"
- "", 10);
- #line 1
- }
- #line 1
- static void otemplate_f_0000(dict_res *dr, const char *key, const void *value, int flags){
- #line 1
- #line 8
- onion_dict_add(dr->dict, "f", value, OD_DUP_VALUE|OD_REPLACE|(flags&OD_TYPE_MASK));
- #line 13
- otemplate_f_0001(dr->dict, dr->res);
- #line 1
- }
- #line 1
- static void otemplate_f_0001(onion_dict *context, onion_response *res){
- #line 1
- onion_response_write(res, "\n"
- "<tr>\n"
- "<td>", 10);
- #line 10
- {
- #line 10
- const char *tmp;
- #line 10
- tmp=onion_dict_rget(context
- #line 10
- , "f"
- #line 10
- , "id"
- #line 10
- , NULL);
- #line 10
- if (tmp)
- #line 10
- onion_response_write_html_safe(res, tmp);
- #line 10
- }
- onion_response_write(res, "</td>\n"
- "<td>", 10);
- #line 11
- {
- #line 11
- const char *tmp;
- #line 11
- tmp=onion_dict_rget(context
- #line 11
- , "f"
- #line 11
- , "message"
- #line 11
- , NULL);
- #line 11
- if (tmp)
- #line 11
- onion_response_write_html_safe(res, tmp);
- #line 11
- }
- onion_response_write(res, "</td>\n"
- "</tr>\n"
- "", 12);
- #line 1
- }
|