Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsBottomBanner.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-Today Guy Deleeuw
3  *
4  * See the LICENSE file for terms of use.
5 */
6 
7 #include <Wt/WTheme>
8 
9 #include <gdcore/gdCore.h>
10 
11 #include "WsApplication.h"
12 #include "WsBottomBanner.h"
13 
14 using namespace Wt;
15 
16 WsBottomBanner::WsBottomBanner(const std::string& rText = std::string(), WContainerWidget* parent)
17  : WContainerWidget(parent), m_pWText(0), m_bDebug(false)
18 {
19  //if ( WsLayoutProperties::instance()->get("global", "by_object_stylesheet", "false") == "true" )
20  if ( WString::tr("byObjectStyleSheet").narrow() == "true" )
21  wApp->useStyleSheet(wApp->theme()->resourcesUrl() + "wittyshare/Css/WsBottomBanner.css");
22  addStyleClass("WsBottomBanner");
23  m_pWText = new WText("", this);
24  setText(rText);
25 }
26 
28 { }
29 
30 const std::string& WsBottomBanner::text() const
31 {
32  return m_pString;
33 }
34 
35 void WsBottomBanner::setText(const std::string& rText)
36 {
37  m_pString = rText;
38  WsUser* pUser = WsApp->wsUser();
39  std::string m_sDocumentRoot = pUser->getRootPath(); // /var/www/demo_site
40  std::string sFile = m_sDocumentRoot + rText;
41  std::string fileContent;
42  if ( m_bDebug )
43  if ( !gdcore_file_content2string(sFile.c_str(), fileContent) ) {
44  wApp->log("error") << " WsBottomBanner::setText : cannot open : " << sFile;
45  return;
46  }
47  m_pWText->setText(fileContent);
48 }
49 
std::string m_pString
Wt::WText * m_pWText
Interface that provides differents methods for accessing the FsTree as well as other features...
Definition: WsUser.h:33
const std::string getRootPath()
return the root path of the filesystem tree, example : /var/www/demo_site
Definition: WsUser.cpp:55
#define WsApp
Define a shortcut to the application instance.
Definition: WsApplication.h:62
WsBottomBanner(const std::string &rText, Wt::WContainerWidget *parent=0)
void setText(const std::string &rText)
const std::string & text() const