From 901663b1456309af7b32cf4e3c4d6b71725a243c Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sun, 8 Mar 2015 23:22:05 +0000 Subject: [PATCH] updated: to the new ezc api added: following ezc functions: ezc_and_not, ezc_any_not, ezc_or_not, ezc_one_not, is, is_not, is_empty, is_not_empty git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1005 e52654a7-88a9-db11-a3e9-0013d4bc506e --- html/dir_last_info.html | 2 +- html/fun_adduser.html | 4 +- html/fun_cat.html | 6 +- html/fun_ckeditor.html | 4 +- html/fun_cp.html | 8 +-- html/fun_createthread.html | 2 +- html/fun_createticket.html | 12 ++-- html/fun_emacs.html | 2 +- html/fun_gallery.html | 14 ++--- html/fun_imgcrop.html | 4 +- html/fun_last.html | 2 +- html/fun_locale.html | 4 +- html/fun_login.html | 6 +- html/fun_ls.html | 14 ++--- html/fun_mv.html | 8 +-- html/fun_nicedit.html | 4 +- html/fun_priv.html | 28 ++++----- html/fun_reply.html | 2 +- html/fun_rm.html | 4 +- html/fun_showtickets.html | 6 +- html/fun_sort.html | 2 +- html/fun_subject.html | 4 +- html/fun_template.html | 4 +- html/fun_thread.html | 2 +- html/fun_ticket.html | 2 +- html/fun_timezone.html | 4 +- html/fun_tinymce.html | 4 +- html/fun_upload.html | 2 +- html/fun_uptime.html | 2 +- html/fun_vim.html | 4 +- html/fun_who.html | 2 +- html/index.html | 2 +- html/index_fullscreen.html | 2 +- html/index_head_functions_add.html | 95 +++++++++++++++--------------- html/item_info.html | 2 +- html/item_options.html | 12 ++-- html/item_tab_info.html | 4 +- html/slog.html | 1 - html/thread_sort_tab_info.html | 2 +- templates/generic.cpp | 88 ++++++++++++++++++++++++++- templates/templates.cpp | 34 +++++++---- templates/templates.h | 8 +++ 42 files changed, 260 insertions(+), 158 deletions(-) diff --git a/html/dir_last_info.html b/html/dir_last_info.html index e8e80b7..967c84c 100644 --- a/html/dir_last_info.html +++ b/html/dir_last_info.html @@ -1,7 +1,7 @@

{added_by}: [dir_last_user], [dir_last_date_creation_nice] - [if-no dir_last_dates_equal] + [if not dir_last_dates_equal] , {last_modified} [if dir_last_users_different] diff --git a/html/fun_adduser.html b/html/fun_adduser.html index 88955f4..196c9de 100644 --- a/html/fun_adduser.html +++ b/html/fun_adduser.html @@ -1,6 +1,6 @@

-

[if-one user_logged]{adduser_header_add}[else]{adduser_header_register}[end]

+

[if user_logged]{adduser_header_add}[else]{adduser_header_register}[end]

@@ -33,7 +33,7 @@ [end] - +
diff --git a/html/fun_cat.html b/html/fun_cat.html index 2787bca..12c8265 100644 --- a/html/fun_cat.html +++ b/html/fun_cat.html @@ -1,9 +1,9 @@ [if mount_page_arg_is "subject"][if mount_page_arg_is "info"]

[else]

[end][item_subject]

[end] [if mount_page_arg_is "info"][include "item_info.html"][end] -[if-one item_filetype_is_image] +[if one item_filetype_is_image] - [item_subject] + [item_subject] [# we use pre.nowinixbreak to tell the html_filter not to put a blank space into those urles] @@ -18,7 +18,7 @@ [else] - [if-no item_filetype_is_none] + [if not item_filetype_is_none] {download}: [item_subject]
diff --git a/html/fun_ckeditor.html b/html/fun_ckeditor.html
index 2eb4c3a..d2d8789 100644
--- a/html/fun_ckeditor.html
+++ b/html/fun_ckeditor.html
@@ -17,7 +17,7 @@
 		
[end] - [if-any mount_type_is "thread" thread_mount_arg_is "subject"] + [if any [mount_type_is "thread"] [thread_mount_arg_is "subject"]]
@@ -47,7 +47,7 @@ [end] - [if-no user_logged] + [if not user_logged]
diff --git a/html/fun_cp.html b/html/fun_cp.html index db22ba8..fb2dc8d 100644 --- a/html/fun_cp.html +++ b/html/fun_cp.html @@ -3,22 +3,22 @@

{cp_header}

-
+
{cp_form_legend}

- [if-one item_is]{cp_page} "[item_url]":[else]{cp_dir} "[dir_without_slash]"[end] + [if item_is]{cp_page} "[item_url]":[else]{cp_dir} "[dir_without_slash]"[end]

{suggested_url}

- +

- [if-no item_is] + [if not item_is] diff --git a/html/fun_createthread.html b/html/fun_createthread.html index 5a7d05b..3c2c59f 100644 --- a/html/fun_createthread.html +++ b/html/fun_createthread.html @@ -18,7 +18,7 @@ [include "fun_emacs_post.html"] - [if-no user_logged] + [if not user_logged]

{nick}:

diff --git a/html/fun_createticket.html b/html/fun_createticket.html index 6f97cfd..9620b78 100644 --- a/html/fun_createticket.html +++ b/html/fun_createticket.html @@ -36,7 +36,7 @@ [end] - [if-one ticket_tab_type_is "integer" ticket_tab_type_is "progress" ticket_tab_type_is "string"] + [if one [ticket_tab_type_is "integer"] [ticket_tab_type_is "progress"] [ticket_tab_type_is "string"]] [end] @@ -76,7 +76,7 @@ [end] - [if-any-no ticket_tab_type_is "images" ticket_tab_type_is "files" ticket_is_creating_new ticket_tab_has_value] + [if any_not [ticket_tab_type_is "images"] [ticket_tab_type_is "files"] ticket_is_creating_new ticket_tab_has_value] {ticket_value_not_set} [end] @@ -101,15 +101,15 @@
-[if-no user_logged] +[if not user_logged]
diff --git a/html/fun_emacs.html b/html/fun_emacs.html index 3e38cb1..1308ef3 100644 --- a/html/fun_emacs.html +++ b/html/fun_emacs.html @@ -18,7 +18,7 @@ [include "fun_emacs_post.html"] - [if-no user_logged] + [if not user_logged]
diff --git a/html/fun_gallery.html b/html/fun_gallery.html index 463a4d4..642c856 100644 --- a/html/fun_gallery.html +++ b/html/fun_gallery.html @@ -4,7 +4,7 @@ [if mount_page_arg_is "info"][include "dir_last_info.html"][end] -[if-one gallery_has_not_mount_type gallery_mount_type_arg_is "lightbox"] +[if one gallery_has_not_mount_type [gallery_mount_type_arg_is "lightbox"]] [if gallery_tab]
    @@ -36,7 +36,7 @@ [end] [end] - [if-no winix_function_param_is "image"] + [if not [winix_function_param_is "image"]] [else] [# !! IMPROVE ME add this javascript code to the rest of galleria types] @@ -61,7 +61,7 @@ [if gallery_mount_theme_arg_is "transparent"] - [if-no winix_function_param_is "image"] + [if not [winix_function_param_is "image"]] [else] @@ -71,7 +71,7 @@ [if gallery_mount_theme_arg_is "transparentinfo"] - [if-no winix_function_param_is "image"] + [if not [winix_function_param_is "image"]] [else] @@ -79,7 +79,7 @@ [else] - [if-no winix_function_param_is "image"] + [if not [winix_function_param_is "image"]] [else] @@ -94,7 +94,7 @@ [if gallery_mount_type_arg_is "galleriathumb"] - [if-no winix_function_param_is "image"] + [if not [winix_function_param_is "image"]] [if gallery_tab]
      [for gallery_tab] @@ -128,7 +128,7 @@ [if gallery_mount_type_arg_is "galleriathumb1.2.9"] - [if-no winix_function_param_is "image"] + [if not [winix_function_param_is "image"]] [if gallery_tab]
        [for gallery_tab] diff --git a/html/fun_imgcrop.html b/html/fun_imgcrop.html index 0aa6a25..a16a475 100644 --- a/html/fun_imgcrop.html +++ b/html/fun_imgcrop.html @@ -15,7 +15,7 @@ [end] [end] - [if-any item_is item_filetype_is_image] + [if any item_is item_filetype_is_image] [end] - [if-one gallery_mount_type_arg_is "galleria" gallery_mount_type_arg_is "galleriathumb"] + [if one [gallery_mount_type_arg_is "galleria"] [gallery_mount_type_arg_is "galleriathumb"]] [end] - [if-one gallery_mount_type_arg_is "galleria1.2.9" gallery_mount_type_arg_is "galleriathumb1.2.9"] + [if one [gallery_mount_type_arg_is "galleria1.2.9"] [gallery_mount_type_arg_is "galleriathumb1.2.9"]] [end] @@ -219,7 +219,7 @@ [if winix_function_is "sort"] - [if-no item_is] + [if not item_is] @@ -234,9 +234,10 @@ [end] - +[if false] +[# temporarily blocked] [if winix_has_plugin "stats"] [include "stats_info.html"] [end] - +[end] diff --git a/html/item_info.html b/html/item_info.html index e9e702a..af12f74 100644 --- a/html/item_info.html +++ b/html/item_info.html @@ -1,5 +1,5 @@

        - {added_by}: [item_user], [item_date_creation_nice][if-no item_dates_equal], + {added_by}: [item_user], [item_date_creation_nice][if not item_dates_equal], {last_modified}[if item_users_different] {by}: [item_modification_user],[else]:[end] [item_date_modification_nice][end]

        diff --git a/html/item_options.html b/html/item_options.html index 049bd87..bce4d34 100644 --- a/html/item_options.html +++ b/html/item_options.html @@ -1,8 +1,8 @@ -[if-no winix_function_param_is "fullscreen"] -[if-one dir_can_write item_can_write] +[if not [winix_function_param_is "fullscreen"]] +[if dir_can_write item_can_write]
        - [if-any dir_can_write] + [if dir_can_write]

        {add_page}

        [end] - [if-any item_is item_can_write] + [if item_is item_can_write]

        {edit_page}

        [end] diff --git a/html/item_tab_info.html b/html/item_tab_info.html index e4e1047..171a7f2 100644 --- a/html/item_tab_info.html +++ b/html/item_tab_info.html @@ -1,7 +1,7 @@

        - {added_by}: [item_tab_user], [item_tab_date_creation_nice][if-no item_tab_dates_equal], - {last_modified}[if-one item_tab_users_different] {by}: [item_tab_modification_user],[else]:[end] + {added_by}: [item_tab_user], [item_tab_date_creation_nice][if not item_tab_dates_equal], + {last_modified}[if item_tab_users_different] {by}: [item_tab_modification_user],[else]:[end] [item_tab_date_modification_nice] [end] diff --git a/html/slog.html b/html/slog.html index e03fd2f..b9e5de8 100644 --- a/html/slog.html +++ b/html/slog.html @@ -1,4 +1,3 @@ - [if slog_tab] diff --git a/html/thread_sort_tab_info.html b/html/thread_sort_tab_info.html index 2ed34ea..fb13f76 100644 --- a/html/thread_sort_tab_info.html +++ b/html/thread_sort_tab_info.html @@ -1,6 +1,6 @@

        - {added_by}: [thread_sort_tab_user], [thread_sort_tab_date_creation_nice][if-no thread_sort_tab_dates_equal], + {added_by}: [thread_sort_tab_user], [thread_sort_tab_date_creation_nice][if not thread_sort_tab_dates_equal], {last_modified}[if thread_sort_tab_users_different] {by}: [thread_sort_tab_modification_user],[else]:[end] [thread_sort_tab_date_modification_nice] [end] diff --git a/templates/generic.cpp b/templates/generic.cpp index c86dd54..b774e1a 100644 --- a/templates/generic.cpp +++ b/templates/generic.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014, Tomasz Sowa + * Copyright (c) 2014-2015, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -102,6 +102,53 @@ void ezc_one(Info & i) } +void ezc_and_not(Info & i) +{ + if( !i.params.empty() ) + { + i.res = true; + + for(size_t a=0 ; a < i.params.size() ; ++a) + { + if( i.params[a].res ) + { + i.res = false; + break; + } + } + } +} + + +void ezc_any_not(Info & i) +{ + ezc_and_not(i); +} + + + +void ezc_or_not(Info & i) +{ + i.res = false; + + for(size_t a=0 ; a < i.params.size() ; ++a) + { + if( !i.params[a].res ) + { + i.res = true; + break; + } + } +} + + +void ezc_one_not(Info & i) +{ + ezc_or_not(i); +} + + + void ezc_not(Info & i) { if( !i.params.empty() ) @@ -110,6 +157,7 @@ void ezc_not(Info & i) + /* * compare strings */ @@ -132,6 +180,44 @@ void cmp(Info & i) +void is(Info & i) +{ + cmp(i); +} + + + +void is_not(Info & i) +{ + cmp(i); + i.res = !i.res; +} + + + +void is_empty(Info & i) +{ + i.res = true; + + for(size_t a=0 ; a < i.params.size() ; ++a) + { + if( !i.params[a].str.empty() ) + { + i.res = false; + break; + } + } +} + + + +void is_not_empty(Info & i) +{ + is_empty(i); + i.res = !i.res; +} + + // IMPROVE ME !! may we need such a filter too? diff --git a/templates/templates.cpp b/templates/templates.cpp index eabc294..ea3fa94 100644 --- a/templates/templates.cpp +++ b/templates/templates.cpp @@ -329,19 +329,27 @@ void Templates::CreateFunctions() /* generic functions */ - ezc_functions.Insert("false", ezc_false); - ezc_functions.Insert("true", ezc_true); - ezc_functions.Insert("and", ezc_and); - ezc_functions.Insert("any", ezc_any); - ezc_functions.Insert("or", ezc_or); - ezc_functions.Insert("one", ezc_one); - ezc_functions.Insert("not", ezc_not); - ezc_functions.Insert("cmp", cmp); - ezc_functions.Insert("trim", trim); - ezc_functions.Insert("to_lower", to_lower); - ezc_functions.Insert("to_upper", to_upper); - ezc_functions.Insert("index", index); - ezc_functions.Insert("str", str); + ezc_functions.Insert("false", ezc_false); + ezc_functions.Insert("true", ezc_true); + ezc_functions.Insert("and", ezc_and); + ezc_functions.Insert("any", ezc_any); + ezc_functions.Insert("or", ezc_or); + ezc_functions.Insert("one", ezc_one); + ezc_functions.Insert("and_not", ezc_and_not); + ezc_functions.Insert("any_not", ezc_any_not); + ezc_functions.Insert("or_not", ezc_or_not); + ezc_functions.Insert("one_not", ezc_one_not); + ezc_functions.Insert("not", ezc_not); + ezc_functions.Insert("cmp", cmp); + ezc_functions.Insert("is", is); + ezc_functions.Insert("is_not", is_not); + ezc_functions.Insert("is_empty", is_empty); + ezc_functions.Insert("is_not_empty", is_not_empty); + ezc_functions.Insert("trim", trim); + ezc_functions.Insert("to_lower", to_lower); + ezc_functions.Insert("to_upper", to_upper); + ezc_functions.Insert("index", index); + ezc_functions.Insert("str", str); /* diff --git a/templates/templates.h b/templates/templates.h index 065fdb1..0533c6f 100644 --- a/templates/templates.h +++ b/templates/templates.h @@ -248,8 +248,16 @@ namespace TemplatesFunctions void ezc_any(Info & i); void ezc_or(Info & i); void ezc_one(Info & i); + void ezc_and_not(Info & i); + void ezc_any_not(Info & i); + void ezc_or_not(Info & i); + void ezc_one_not(Info & i); void ezc_not(Info & i); void cmp(Info & i); + void is(Info & i); + void is_not(Info & i); + void is_empty(Info & i); + void is_not_empty(Info & i); void trim(Info & i); void to_lower(Info & i); void to_upper(Info & i);