46 #include <Wt/WTemplate.h> 50 #include "ViewDetail.h" 52 #ifndef ID_DETAIL_ITEM 53 #define ID_DETAIL_ITEM "Wtx.Web.BlogEntry.Item.DetailForm" 56 void Wtx::Web::BlogEntry::ViewDetail::init(
const Wt::Dbo::ptr<Wtx::Web::BlogEntry::Item> & item )
60 addNew<Wt::WText>(
"Oops, I was unable to find that article" );
69 auto tr = Wt::WString::tr( ID_DETAIL_ITEM );
70 if( tr.toUTF8().find(
"??") != std::string::npos )
76 " <strong><big>${title}</big></strong><br />" 78 " <small>Posted on ${date}</small><br />" 91 auto templt = addNew<Wt::WTemplate>( tr );
97 templt-> setCondition(
"if-posted", item-> datePosted.value() !=
"" );
98 templt-> bindNew<Wt::WText>(
"date", item-> datePosted.value() );
100 templt-> bindNew<Wt::WText>(
"title", item-> keyField().value() );
101 templt-> bindNew<Wt::WText>(
"body", item-> body.value(), Wt::TextFormat::UnsafeXHTML );
104 Wtx::Web::BlogEntry::ViewDetail::ViewDetail(
const Wt::Dbo::ptr<Wtx::Web::BlogEntry::Item> & item )
105 :
Wt::WContainerWidget()
111 Wtx::Web::BlogEntryViewDetail::BlogEntryViewDetail(
const std::string & url )
112 :
Wt::WContainerWidget()
114 auto key = url.substr( std::string(BLOG_ENTRY_URL).length() );
117 std::cout << __FILE__ <<
":" << __LINE__ <<
" " << url.size() <<
" " << url <<
":" << key << std::endl;
119 Wt::Dbo::Transaction t(*kbwSession);
121 kbwSession-> find<Wtx::Web::BlogEntry>()
122 .where(
"\"keyField\" = ?" ).bind( key )