From d9f5fbaf040c1a5dd1a9d541adbb81d59c036fce Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Wed, 30 Jun 2010 19:56:32 +0000 Subject: [PATCH] added: "edit" button on threads git-svn-id: svn://ttmath.org/publicrep/winix/trunk@616 e52654a7-88a9-db11-a3e9-0013d4bc506e --- content/emacs.cpp | 5 +++-- html/fun_thread.html | 1 + static/layout1/winix.css | 7 +++++++ templates/item.cpp | 20 ++++++++++++++++++++ templates/templates.cpp | 3 ++- templates/templates.h | 2 ++ 6 files changed, 35 insertions(+), 3 deletions(-) diff --git a/content/emacs.cpp b/content/emacs.cpp index 6e63231..3c687a6 100755 --- a/content/emacs.cpp +++ b/content/emacs.cpp @@ -129,15 +129,16 @@ void Content::PostFunEmacs() bool adding = !request.is_item; bool edit_with_url = ReadItem(request.item, Item::file); + if( adding ) + SetUser(request.item); // set user before checking the rebus + if( !PostEmacsCheckAbuse(adding) ) return; - if( adding ) { request.is_item = true; request.item.privileges = 0644; // !! tymczasowo, bedzie uzyte umask - SetUser(request.item); PostFunEmacsAdd(request.item); } else diff --git a/html/fun_thread.html b/html/fun_thread.html index 2e414cf..eb6b677 100755 --- a/html/fun_thread.html +++ b/html/fun_thread.html @@ -32,6 +32,7 @@ [for item_tab]
+ [if-one item_tab_can_use_emacs]\[{edit}\][end] [is mount_thread_is "subject"][item_tab_subject][end] [is mount_thread_is "info"][item_tab_info][end] [item_tab_print_content] diff --git a/static/layout1/winix.css b/static/layout1/winix.css index 5736a4e..e93ec15 100755 --- a/static/layout1/winix.css +++ b/static/layout1/winix.css @@ -590,6 +590,13 @@ border-radius: 8px; } +div.threadbox a.threadedit { +margin: 0.5em 0 0 0; +float: right; +font-size: 0.8em; +} + + table.forum { border: 1px solid #D1D1E1; } diff --git a/templates/item.cpp b/templates/item.cpp index d27ffac..4c45057 100755 --- a/templates/item.cpp +++ b/templates/item.cpp @@ -440,6 +440,17 @@ void item_tab_can_read(Info & i) } } + +void item_tab_can_write(Info & i) +{ + if( item_index < request.item_table.size() ) + { + if( request.HasWriteAccess(request.item_table[item_index]) ) + i.res = true; + } +} + + void item_tab_info(Info & i) { if( static_cast(locale.GetLang()) >= patterns.size() ) @@ -574,6 +585,15 @@ void item_tab_run(Info & i) } +void item_tab_can_use_emacs(Info & i) +{ + if( item_index < request.item_table.size() ) + { + i.res = request.CanUseEmacs(request.item_table[item_index], true); + } +} + + diff --git a/templates/templates.cpp b/templates/templates.cpp index a4e37f6..74d3f30 100755 --- a/templates/templates.cpp +++ b/templates/templates.cpp @@ -240,6 +240,7 @@ void Templates::CreateFunctions() functions.Insert("item_tab_link", item_tab_link); functions.Insert("item_tab_link_auth", item_tab_link_auth); functions.Insert("item_tab_can_read", item_tab_can_read); + functions.Insert("item_tab_can_write", item_tab_can_write); functions.Insert("item_tab_info", item_tab_info); functions.Insert("item_tab_user", item_tab_user); functions.Insert("item_tab_modification_user", item_tab_modification_user); @@ -251,7 +252,7 @@ void Templates::CreateFunctions() functions.Insert("item_tab_date_modification_nice", item_tab_date_modification_nice); functions.Insert("item_tab_dates_equal", item_tab_dates_equal); functions.Insert("item_tab_run", item_tab_run); - + functions.Insert("item_tab_can_use_emacs", item_tab_can_use_emacs); /* dir diff --git a/templates/templates.h b/templates/templates.h index b0681f0..b7a5e66 100755 --- a/templates/templates.h +++ b/templates/templates.h @@ -151,6 +151,7 @@ namespace TemplatesFunctions void item_tab_link(Info & i); void item_tab_link_auth(Info & i); void item_tab_can_read(Info & i); + void item_tab_can_write(Info & i); void item_tab_info(Info & i); void item_tab_user(Info & i); void item_tab_modification_user(Info & i); @@ -162,6 +163,7 @@ namespace TemplatesFunctions void item_tab_date_modification_nice(Info & i); void item_tab_dates_equal(Info & i); void item_tab_run(Info & i); + void item_tab_can_use_emacs(Info & i); /*