Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsModFollowUs.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 <dlfcn.h>
8 #include <stdio.h>
9 
10 #include <iostream>
11 
12 #include <boost/filesystem.hpp>
13 
14 #include <Wt/WLogger>
15 #include <Wt/WText>
16 
17 #include <gdcore/gdCore.h>
18 
19 #include <Logger/WsLogger.h>
20 #include <User/WsUser.h>
21 
22 #include <Main/WsApplication.h>
23 
25 
26 #include "WsModFollowUs.h"
27 
28 extern "C" {
29  void WsModFollowUsInit(void)
30  {
31  void* hndl = dlopen("libwt.so", RTLD_NOW | RTLD_GLOBAL);
32  if ( hndl == NULL ) {
33  fprintf(stderr, "cannot load libwt.so shared library! %s\n", dlerror());
34  return;
35  }
36  }
37 }
38 
39 // Class WsFollowUs
40 // ==================
41 WsFollowUs::WsFollowUs(WContainerWidget* parent)
42  : WContainerWidget(parent)
43 {
44  addStyleClass("WsFollowUs");
45 }
46 
48 {
49 }
50 
52 {
53  WContainerWidget::load();
55  std::string rootPath = pUser->getRootPath();
56  std::string rootUrl = rootPath;
57  boost::replace_all(rootUrl, wApp->docRoot(), "");
58  addWidget(new WText("Follow us"));
59  WsAnchor* pAnchorRss = new WsAnchor();
60  pAnchorRss->addStyleClass("WsRss");
61  pAnchorRss->setOption("debug", std::string("true"));
62  pAnchorRss->setOption("linkType", std::string("InternalPath"));
63  pAnchorRss->setOption("link", std::string(rootUrl + "/ws.res/Eurofer.rss"));
64  pAnchorRss->setOption("text", std::string("RSS"));
65  pAnchorRss->setOption("icon", std::string(rootUrl + "/ws.res/icones/RSS.png"));
66  pAnchorRss->setOption("iconText", std::string("Eurofer RSS"));
67  pAnchorRss->setOption("target", std::string("TargetNewWindow"));
68  addWidget(pAnchorRss);
69  WsAnchor* pAnchorTwitter = new WsAnchor();
70  pAnchorTwitter->addStyleClass("WsTwitter");
71  pAnchorTwitter->setOption("debug", std::string("true"));
72  pAnchorTwitter->setOption("linkType", std::string("Url"));
73  pAnchorTwitter->setOption("link", asString(option("account")));
74  pAnchorTwitter->setOption("text", asString(option("text")));
75  pAnchorTwitter->setOption("icon", std::string(rootUrl + "/ws.res/icones/twitter.png"));
76  pAnchorTwitter->setOption("iconText", asString(option("iconText")));
77  pAnchorTwitter->setOption("target", std::string("TargetNewWindow"));
78  addWidget(pAnchorTwitter);
79 }
80 
81 
82 // Class WsModFollowUs
83 // =====================
85  : WsModule()
86 {
87 }
88 
90 {
91 }
92 
93 WWidget* WsModFollowUs::createContentsMenuBar(WContainerWidget* parent) const
94 {
95  return 0;
96 }
97 
98 WWidget* WsModFollowUs::createContents(WContainerWidget* parent) const
99 {
100  WsFollowUs* pFU = new WsFollowUs(parent);
101  pFU->setOptions(options());
102  pFU->outOptions("WsModFollowUs::createContents()");
103  return pFU;
104 }
105 
106 WsEditorWidget* WsModFollowUs::createEditor(WContainerWidget* parent) const
107 {
108  return 0;
109 }
110 
111 WWidget* WsModFollowUs::createAdmin(WContainerWidget* parent) const
112 {
113  return 0;
114 }
115 
116 std::string WsModFollowUs::description() const
117 {
118  return "WsModFollowUs wittyShare module";
119 }
120 
WsUser * wsUser()
Wt::WWidget * createContents(Wt::WContainerWidget *parent=0) const
Create the contents.
static WsApplication * wsInstance()
Facility function to access the application object.
Definition: WsApplication.h:39
WsModFollowUs()
CTor.
Wt::WWidget * createContentsMenuBar(Wt::WContainerWidget *parent=0) const
Create the functionalities.
a wittyShare module
const std::vector< WsOption > & options() const
Get all options.
Definition: WsOption.cpp:70
Interface that provides differents methods for accessing the FsTree as well as other features...
Definition: WsUser.h:33
WsEditorWidget * createEditor(Wt::WContainerWidget *parent=0) const
Create the contents for an editor (create a view of options).
a wittyShare widget
void setOption(const std::string &attribute, boost::any value)
Set an options if previously set, update the value.
Definition: WsOption.cpp:47
void WsModFollowUsInit(void)
WsFollowUs(Wt::WContainerWidget *parent=0)
CTor.
const boost::any & option(const std::string &attribute) const
Get an options value.
Definition: WsOption.cpp:62
const std::string getRootPath()
return the root path of the filesystem tree, example : /var/www/demo_site
Definition: WsUser.cpp:55
void outOptions(const std::string message)
Output all options.
Definition: WsOption.cpp:75
void setOptions(const std::vector< WsOption > &vOptions)
Set all options.
Definition: WsOption.cpp:57
Wt::WWidget * createAdmin(Wt::WContainerWidget *parent=0) const
Create the contents for an administrator.
std::string description() const
Return the description of the module.
User class.