From aa58faf1453f98592debba6db5d3f28733ff149b Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 10 May 2018 17:21:39 +0000 Subject: [PATCH] some work on integrating ckeditor4 added ezc blocks: ckeditor_old_browsers_support, ckeditor, ckeditor_small defined in ckeditor.html git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1109 e52654a7-88a9-db11-a3e9-0013d4bc506e --- winixd/functions/emacs.cpp | 15 +- winixd/functions/emacs.h | 2 +- winixd/html/ckeditor.html | 165 ++++++++++++++++++++++ winixd/html/fun_ckeditor.html | 89 ++++-------- winixd/html/index_head_functions_add.html | 2 + winixd/templates/item.cpp | 12 +- winixd/templates/templates.cpp | 4 +- winixd/templates/templates.h | 4 +- 8 files changed, 226 insertions(+), 67 deletions(-) create mode 100644 winixd/html/ckeditor.html diff --git a/winixd/functions/emacs.cpp b/winixd/functions/emacs.cpp index 2494cb4..b920c78 100644 --- a/winixd/functions/emacs.cpp +++ b/winixd/functions/emacs.cpp @@ -105,9 +105,12 @@ return true; // !! zmienic nazwy // albo w ogole te metody nie sa potrzebne teraz (byly zmiany) -void Emacs::PostFunEmacsModifyMountPoint(bool adding) +void Emacs::DoRedirectIfNeeded(bool adding) { - system->RedirectTo(cur->request->item); + if( cur->request->ParamValue(L"reqtype") != L"json" ) + { + system->RedirectTo(cur->request->item); + } } @@ -166,13 +169,19 @@ void Emacs::MakePost() if( cur->request->status == WINIX_ERR_OK ) { - PostFunEmacsModifyMountPoint(adding); + DoRedirectIfNeeded(adding); functions->CheckSpecialFile(cur->request->item); } else { log << log1 << "Emacs: error: " << cur->request->status << logend; } + + + if( cur->request->ParamValue(L"reqtype") == L"json" ) + { + cur->request->info.Add(L"status", cur->request->status); + } } diff --git a/winixd/functions/emacs.h b/winixd/functions/emacs.h index 80d6d6e..794232a 100644 --- a/winixd/functions/emacs.h +++ b/winixd/functions/emacs.h @@ -57,7 +57,7 @@ private: bool HasAccess(const Item & item); // !! takie funkcje to nie powinny byc skladowe modelu? bool PostEmacsCheckAbuse(bool adding); - void PostFunEmacsModifyMountPoint(bool adding); + void DoRedirectIfNeeded(bool adding); int NotifyCodeEdit(); int NotifyCodeAdd(); diff --git a/winixd/html/ckeditor.html b/winixd/html/ckeditor.html new file mode 100644 index 0000000..b518f3c --- /dev/null +++ b/winixd/html/ckeditor.html @@ -0,0 +1,165 @@ +[block ckeditor_old_browsers_support] + +[end] + + + + + + + +[block ckeditor] + + + + + + + +[end] + + + + + + + +[block ckeditor_small] + + + + + + + +[end] diff --git a/winixd/html/fun_ckeditor.html b/winixd/html/fun_ckeditor.html index b463248..6c3cb8a 100644 --- a/winixd/html/fun_ckeditor.html +++ b/winixd/html/fun_ckeditor.html @@ -1,9 +1,6 @@
[if item_is]

{edit}

[else]

{add}

[end] - - -
[if mount_type_is "cms"]
@@ -37,21 +34,14 @@ [# template fun_ls.html uses the name: itemcontent to refer to this textarea item] -
[item_content_noescape]
+
[item_print_content]
- - - - [end] + + [if not user_logged]
@@ -64,57 +54,36 @@
[end] - + +
+ + +
+ progress bar +
+ +
+
+ +
+
+ +
[if winix_function_param_is "postredirect"] [end] -
- - - - + [include "ckeditor.html"] + [ckeditor_old_browsers_support] + [ckeditor "winix-editor-content"]
diff --git a/winixd/html/index_head_functions_add.html b/winixd/html/index_head_functions_add.html index ebc95bd..78b7b23 100644 --- a/winixd/html/index_head_functions_add.html +++ b/winixd/html/index_head_functions_add.html @@ -136,6 +136,8 @@ cm.save() [if winix_function_is "ckeditor"] + + [end] diff --git a/winixd/templates/item.cpp b/winixd/templates/item.cpp index 221905d..cda3c61 100644 --- a/winixd/templates/item.cpp +++ b/winixd/templates/item.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2016, Tomasz Sowa + * Copyright (c) 2008-2018, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -432,6 +432,11 @@ void item_meta(Info & i) } +void item_meta_noescape(Info & i) +{ + space_value(i, cur->request->last_item->meta, false); +} + void item_meta_tab(Info & i) @@ -859,6 +864,11 @@ void item_tab_meta(Info & i) space_value(i, cur->request->item_tab[item_index].meta); } +void item_tab_meta_noescape(Info & i) +{ + if( item_index < cur->request->item_tab.size() ) + space_value(i, cur->request->item_tab[item_index].meta, false); +} void item_tab_meta_tab(Info & i) { diff --git a/winixd/templates/templates.cpp b/winixd/templates/templates.cpp index bd857a7..a266510 100644 --- a/winixd/templates/templates.cpp +++ b/winixd/templates/templates.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2016, Tomasz Sowa + * Copyright (c) 2008-2018, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -459,6 +459,7 @@ void Templates::CreateFunctions() ezc_functions.Insert("item_sort", item_sort); ezc_functions.Insert("item_meta_str", item_meta_str); ezc_functions.Insert("item_meta", item_meta); + ezc_functions.Insert("item_meta_noescape", item_meta_noescape); ezc_functions.Insert("item_meta_tab", item_meta_tab); ezc_functions.Insert("item_meta_tab_value", item_meta_tab_value); ezc_functions.Insert("item_meta_tab_has_next", item_meta_tab_has_next); @@ -509,6 +510,7 @@ void Templates::CreateFunctions() ezc_functions.Insert("item_tab_has_next", item_tab_has_next); ezc_functions.Insert("item_tab_meta_str", item_tab_meta_str); ezc_functions.Insert("item_tab_meta", item_tab_meta); + ezc_functions.Insert("item_tab_meta_noescape", item_tab_meta_noescape); ezc_functions.Insert("item_tab_meta_tab", item_tab_meta_tab); ezc_functions.Insert("item_tab_meta_tab_value", item_tab_meta_tab_value); ezc_functions.Insert("item_tab_meta_tab_has_next", item_tab_meta_tab_has_next); diff --git a/winixd/templates/templates.h b/winixd/templates/templates.h index a7d96d5..2fd5636 100644 --- a/winixd/templates/templates.h +++ b/winixd/templates/templates.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2016, Tomasz Sowa + * Copyright (c) 2008-2018, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -352,6 +352,7 @@ namespace TemplatesFunctions void item_sort(Info & i); void item_meta_str(Info & i); void item_meta(Info & i); + void item_meta_noescape(Info & i); void item_meta_tab(Info & i); void item_meta_tab_value(Info & i); void item_meta_tab_has_next(Info & i); @@ -402,6 +403,7 @@ namespace TemplatesFunctions void item_tab_has_next(Info & i); void item_tab_meta_str(Info & i); void item_tab_meta(Info & i); + void item_tab_meta_noescape(Info & i); void item_tab_meta_tab(Info & i); void item_tab_meta_tab_value(Info & i); void item_tab_meta_tab_has_next(Info & i);