diff --git a/.gitignore b/.gitignore index 8c6bc44..d011c30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ .cproject .project .settings/ +*.o +*.so +winixd/winix diff --git a/winixd/core/config.cpp b/winixd/core/config.cpp index 06e4f81..9558d74 100644 --- a/winixd/core/config.cpp +++ b/winixd/core/config.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2018, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -186,6 +186,7 @@ void Config::AssignValues(bool stdout_is_closed) templates_fun_prefix = Text(L"templates_fun_prefix", L"fun_"); templates_fun_postfix = Text(L"templates_fun_postfix", L".html"); templates_index = Text(L"templates_index", L"index.html"); + templates_index_generic = Text(L"templates_index_generic", L"index_generic.html"); templates_index_raw = Text(L"templates_index_raw", L"index_raw.html"); template_only_root_use_template_fun = Bool(L"template_only_root_use_template_fun", false); diff --git a/winixd/core/config.h b/winixd/core/config.h index 8322c26..97a17f6 100644 --- a/winixd/core/config.h +++ b/winixd/core/config.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2018, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -181,6 +181,10 @@ public: // default: index.html std::wstring templates_index; + // html template used to send generic content - without site-css styles and markup (only uikit) + // default: index_generic.html + std::wstring templates_index_generic; + // html template used to send raw content // default: index_raw.html std::wstring templates_index_raw; diff --git a/winixd/core/request.cpp b/winixd/core/request.cpp index d5e4884..f6cf15f 100644 --- a/winixd/core/request.cpp +++ b/winixd/core/request.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2015, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -153,6 +153,8 @@ void Request::Clear() ip = 0; ip_str.clear(); use_200_status_for_not_found_and_permission_denied = false; + + html_template.clear(); } diff --git a/winixd/core/request.h b/winixd/core/request.h index 86f21a0..d46bcb8 100644 --- a/winixd/core/request.h +++ b/winixd/core/request.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2018, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -339,6 +339,8 @@ struct Request bool gen_use_special_chars; + // index template name + std::wstring html_template; /* diff --git a/winixd/functions/cat.cpp b/winixd/functions/cat.cpp index 3b021fe..3fd37be 100644 --- a/winixd/functions/cat.cpp +++ b/winixd/functions/cat.cpp @@ -51,6 +51,9 @@ Cat::Cat() void Cat::MakeGet() { + // IMPROVE ME this probably should be set for all winix functions + cur->request->html_template = cur->request->last_item->html_template; + if( !cur->request->is_item ) { log << log1 << "Content: cat function requires an item" << logend; diff --git a/winixd/functions/ls.cpp b/winixd/functions/ls.cpp index 500525b..d50b5eb 100644 --- a/winixd/functions/ls.cpp +++ b/winixd/functions/ls.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2008-2018, Tomasz Sowa + * Copyright (c) 2008-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -52,6 +52,13 @@ Ls::Ls() void Ls::MakeGet() { + // !! IMPROVE ME + // this should be moved to ckeditor function (similarly the html content from fun_ls.html) + if( cur->request->IsParam(L"ckeditor_browse") ) + { + cur->request->html_template = config->templates_index_generic; + } + if( !cur->request->is_item ) { DbItemQuery iq; diff --git a/winixd/functions/meta.cpp b/winixd/functions/meta.cpp index d1c2af5..2ca7be4 100644 --- a/winixd/functions/meta.cpp +++ b/winixd/functions/meta.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2011-2018, Tomasz Sowa + * Copyright (c) 2011-2021, Tomasz Sowa * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -127,6 +127,8 @@ return false; void Meta::ChangeAdminMeta() { + // IMPROVE ME we need to show an error msg if the user is not an admin + if( cur->session->puser && cur->session->puser->super_user ) { const std::wstring & meta_str = cur->request->PostVar(L"itemmeta"); diff --git a/winixd/functions/mv.cpp b/winixd/functions/mv.cpp index 960129b..1ab030b 100644 --- a/winixd/functions/mv.cpp +++ b/winixd/functions/mv.cpp @@ -584,12 +584,16 @@ bool Mv::MoveFileOrSymlink2(Item & src_file, const std::wstring & dst_path, bool if( !ParseDir(dst_path, check_access) ) return false; - if( src_file.parent_id == out_dir_tab.back()->id ) + if( out_has_file && src_file.parent_id == out_dir_tab.back()->id && src_file.url == out_item.url ) { - // actually out_filename is here empty - // because ParseDir() have been read it to out_item - if( out_filename.empty() || src_file.url == out_filename ) - return true; // the same file -- there is nothing to do + return true; // the same file -- there is nothing to do + } + + if( out_has_file ) + { + log << log3 << "Mv: such file already exists (skipping)" << logend; + slog << logerror << T("mv_file_exists") << logend; + return false; } return MoveFileOrSymlink(src_file, out_dir_tab, out_filename); diff --git a/winixd/functions/run.cpp b/winixd/functions/run.cpp index 280ad49..baf682b 100644 --- a/winixd/functions/run.cpp +++ b/winixd/functions/run.cpp @@ -60,6 +60,9 @@ void Run::MakePost() void Run::MakeGet() { + // IMPROVE ME this probably should be set for all winix functions + cur->request->html_template = cur->request->last_item->html_template; + if( !cur->request->is_item ) { log << log1 << "Content: Run function requires an item" << logend; diff --git a/winixd/functions/template.cpp b/winixd/functions/template.cpp index 2f8f4df..ac30372 100644 --- a/winixd/functions/template.cpp +++ b/winixd/functions/template.cpp @@ -97,12 +97,17 @@ void Template::CreateTemplateFileName(const std::wstring & index_str) } else if( index == 1 ) + { + html_template = config->templates_index_generic; + } + else + if( index == 2 ) { html_template = config->templates_index_raw; } else { - index -= 2; + index -= 3; Mount::ParamRow & par = system->mounts.pmount->param[system->mounts.MountParHtmlTemplate()]; if( !par.defined || (size_t)index >= par.arg.size() ) diff --git a/winixd/html/dir_last_info.html b/winixd/html/dir_last_info.html index 967c84c..ec1619f 100644 --- a/winixd/html/dir_last_info.html +++ b/winixd/html/dir_last_info.html @@ -1,4 +1,4 @@ -

+

{added_by}: [dir_last_user], [dir_last_date_creation_nice] [if not dir_last_dates_equal] diff --git a/winixd/html/fun_account.html b/winixd/html/fun_account.html index aaaa681..fffd056 100644 --- a/winixd/html/fun_account.html +++ b/winixd/html/fun_account.html @@ -1,20 +1,56 @@

-

Account

+

{account_header}

[if user_logged] -

You are logged as: [user_name]
- [if user_super_user] - You are the root - [end] - [# !! IMPROVE ME add info about groups, may other parameters like time zone, language?] -

+ + + + + + + + + + [if user_super_user] + + + + + + [end] + + [if false] + [# improve me] + + + + + + [end] + + + + + + + + + + + + + +
{account_logged_as}[user_name]
{account_admin}{account_admin_yes}
{account_groups}html, www, foo
{account_timezone}[user_time_zone_name] + {change} +
{account_language}[user_locale_name] + {change} +
+ + [else] -

You are not logged in.

+

{account_not_logged}

[end] - - -
diff --git a/winixd/html/fun_adduser.html b/winixd/html/fun_adduser.html index 196c9de..c6e81f3 100644 --- a/winixd/html/fun_adduser.html +++ b/winixd/html/fun_adduser.html @@ -2,39 +2,62 @@

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

-
-
- {adduser_form_legend} - -

{adduser_login}:

- - -

{adduser_password}:

- + -

{adduser_confirm_password}:

- +
+ - [if winix_account_need_email_verification] -

{adduser_need_email}
{adduser_need_email2}:

- [else] -

{adduser_email}:

- [end] - +
+ +
+
+ +
+ + +
+ +
+
+ +
+ + +
+ +
+
+ +
+ [if winix_account_need_email_verification] + + [else] + + [end] + +
+ +
+
[if user_super_user] -

- -

+
+
+ +
+
[end] [if winix_function_param_is "postredirect"] [end] - - -
+
+
+ +
+
+
diff --git a/winixd/html/fun_ckeditor.html b/winixd/html/fun_ckeditor.html index 650f7bb..1b81443 100644 --- a/winixd/html/fun_ckeditor.html +++ b/winixd/html/fun_ckeditor.html @@ -1,75 +1,80 @@
[if item_is]

{edit}

[else]

{add}

[end] - - [if mount_type_is "cms"] -
- - -
-
- - +
+ + [if one [mount_type_is "cms"] [any [mount_type_is "thread"] [thread_mount_arg_is "subject"]]] +
+ +
+
+
+ +
+ +
+ +
+
[end] - [if any [mount_type_is "thread"] [thread_mount_arg_is "subject"]] -
- - -
- -
- - -
- [end] -
- [if mount_type_is "cms"][end] - [if mount_type_is "thread"][end] - [if mount_type_is "ticket"][end] +
+ [if mount_type_is "cms"][end] + [if mount_type_is "thread"][end] + [if mount_type_is "ticket"][end] [# template fun_ls.html uses the name: itemcontent to refer to this textarea item] - -
[item_print_content]
- +
+
[item_print_content]
+
- - +
+ +
[if not user_logged] -
- - +
+ +
+ +
-
-