From 6c2c12fe5e42f47086eed9e2a62d4003a86be984 Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sat, 3 Mar 2012 21:00:48 +0000 Subject: [PATCH] added: html/fun_pw.html default view for pw winix function git-svn-id: svn://ttmath.org/publicrep/winix/trunk@815 e52654a7-88a9-db11-a3e9-0013d4bc506e --- core/users.cpp | 2 -- html/fun_pw.html | 27 +++++++++++++++++++++++++++ locale/en | 11 +++++++++++ locale/pl | 11 +++++++++++ templates/templates.cpp | 4 ++++ templates/templates.h | 4 ++++ templates/user.cpp | 27 ++++++++++++++++++++++++++- 7 files changed, 83 insertions(+), 3 deletions(-) create mode 100755 html/fun_pw.html diff --git a/core/users.cpp b/core/users.cpp index f7d2aa0..0354f8f 100755 --- a/core/users.cpp +++ b/core/users.cpp @@ -122,8 +122,6 @@ Users::SizeType Users::Size() User & Users::operator[](Users::SizeType pos) { - // !! IMPROVE ME - // add checking the range and returning an empty User struct if out of range return table[pos]; } diff --git a/html/fun_pw.html b/html/fun_pw.html new file mode 100755 index 0000000..6c325cf --- /dev/null +++ b/html/fun_pw.html @@ -0,0 +1,27 @@ +

Pw

+ +[if user_tab] + + + + + + + + + + + [for user_tab] + + + + + + + + + [end] +
{pw_table_no}{pw_table_login}{pw_table_is_root}{pw_table_is_active}{pw_table_is_suspended}{pw_table_is_banned}
[user_tab_index][user_tab_name][if user_tab_is_super_user]{pw_table_yes}[end][if user_tab_is_active]{pw_table_yes}[end][if user_tab_is_suspended]{pw_table_yes}[end][if user_tab_is_blocked]{pw_table_yes}[end]
+[end] + + diff --git a/locale/en b/locale/en index 913707a..5fbe1cf 100755 --- a/locale/en +++ b/locale/en @@ -178,6 +178,17 @@ priv_for_all_dirs = For all directories to priv_change_all = Change subdirectories as well priv_change_current_dir = Change also the current directory +pw_header = Users +pw_table_no = No +pw_table_login = Login +pw_table_is_root = Is Root +pw_table_is_active = Is active +pw_table_is_suspended = Is suspended +pw_table_is_banned = Is banned +pw_table_yes = yes +pw_table_no = no + + reload_header = Reload reload_select = Choose an item to reload reload_templates = html templates diff --git a/locale/pl b/locale/pl index 2a5b6d6..c4db81a 100755 --- a/locale/pl +++ b/locale/pl @@ -199,6 +199,17 @@ priv_change_all = Zmień także w podkatalogach priv_change_current_dir = Zmień także sam katalog bieżący +pw_header = Użytkownicy +pw_table_no = L.p. +pw_table_login = Login +pw_table_is_root = Root +pw_table_is_active = Aktywny +pw_table_is_suspended = Wstrzymany +pw_table_is_banned = Zbanowany +pw_table_yes = tak +pw_table_no = nie + + reload_header = Przeładuj reload_select = Wybierz pozycję reload_templates = szablony html diff --git a/templates/templates.cpp b/templates/templates.cpp index e0accef..2fef901 100755 --- a/templates/templates.cpp +++ b/templates/templates.cpp @@ -503,9 +503,13 @@ void Templates::CreateFunctions() ezc_functions.Insert("user_can_use_bbcode", user_can_use_bbcode); ezc_functions.Insert("user_can_use_raw", user_can_use_raw); ezc_functions.Insert("user_tab", user_tab); + ezc_functions.Insert("user_tab_index", user_tab_index); ezc_functions.Insert("user_tab_id", user_tab_id); ezc_functions.Insert("user_tab_name", user_tab_name); ezc_functions.Insert("user_tab_is_super_user", user_tab_is_super_user); + ezc_functions.Insert("user_tab_is_active", user_tab_is_active); + ezc_functions.Insert("user_tab_is_suspended", user_tab_is_suspended); + ezc_functions.Insert("user_tab_is_blocked", user_tab_is_blocked); ezc_functions.Insert("user_tab_is_current", user_tab_is_current); diff --git a/templates/templates.h b/templates/templates.h index 8143546..3f223ce 100755 --- a/templates/templates.h +++ b/templates/templates.h @@ -421,9 +421,13 @@ namespace TemplatesFunctions void user_can_use_bbcode(Info & i); void user_can_use_raw(Info & i); void user_tab(Info & i); + void user_tab_index(Info & i); void user_tab_id(Info & i); void user_tab_name(Info & i); void user_tab_is_super_user(Info & i); + void user_tab_is_active(Info & i); + void user_tab_is_suspended(Info & i); + void user_tab_is_blocked(Info & i); void user_tab_is_current(Info & i); diff --git a/templates/user.cpp b/templates/user.cpp index 7c1fb16..668360e 100755 --- a/templates/user.cpp +++ b/templates/user.cpp @@ -2,7 +2,7 @@ * This file is a part of Winix * and is not publicly distributed * - * Copyright (c) 2008-2010, Tomasz Sowa + * Copyright (c) 2008-2012, Tomasz Sowa * All rights reserved. * */ @@ -117,6 +117,11 @@ void user_tab(Info & i) } +void user_tab_index(Info & i) +{ + i.out << (user_index+1); +} + void user_tab_id(Info & i) { if( user_index < system->users.Size() ) @@ -138,6 +143,26 @@ void user_tab_is_super_user(Info & i) } +void user_tab_is_active(Info & i) +{ + if( user_index < system->users.Size() ) + i.res = system->users[user_index].status == WINIX_ACCOUNT_READY; +} + +void user_tab_is_suspended(Info & i) +{ + if( user_index < system->users.Size() ) + i.res = system->users[user_index].status == WINIX_ACCOUNT_SUSPENDED; +} + +void user_tab_is_blocked(Info & i) +{ + if( user_index < system->users.Size() ) + i.res = system->users[user_index].status == WINIX_ACCOUNT_BLOCKED; +} + + + void user_tab_is_current(Info & i) { if( user_index < system->users.Size() && cur->session->puser )