Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsModRSS.cpp
Go to the documentation of this file.
1 /*
2  *
3  * Filename: WsModRSS.cpp
4  *
5  * Description: Zip Wittyshare plugin
6  *
7  * Created: 03/04/2013 06:14:15
8  *
9  * Author: Guy Deleeuw, Guy.Geleeuw@gmail.com
10  *
11  */
12 
13 #include <boost/filesystem.hpp>
14 
15 #include <iostream>
16 #include <dlfcn.h>
17 #include <stdlib.h>
18 #include <stdio.h>
19 #include <fcntl.h>
20 #include <unistd.h>
21 
22 #include <Wt/WDateTime>
23 #include <Wt/WTheme>
24 
25 #include <gdcore/gdCore.h>
26 
27 #include <gdwtcore/gdWTextDelegate.h>
28 
30 #include <User/WsUser.h>
32 
33 #include <WsModule/WsModule.h>
34 
35 #include "WsModRSS.h"
36 #include "WsRSS.h"
37 
38 using namespace Wt;
39 
40 extern "C" {
41  void WsModRSSInit(void)
42  {
43  void* hndl = dlopen("libwt.so", RTLD_NOW | RTLD_GLOBAL);
44  if ( hndl == NULL ) {
45  fprintf(stderr, "cannot load wt.so shared library! %s\n", dlerror());
46  return;
47  }
48  }
49 }
50 
52  : WsModule()
53 {
54  wApp->messageResourceBundle().use(wApp->docRoot() + wApp->resourcesUrl() + "WsModRSS/Transl/WsModRSS");
55 }
56 
58 {
59 }
60 
61 WWidget* WsModRSS::createContentsMenuBar(WContainerWidget* parent) const
62 {
63  WsModRSS* self = const_cast<WsModRSS*>(this);
64  self->buildMenuBar(parent);
65  return 0;
66 }
67 
68 WWidget* WsModRSS::createContents(WContainerWidget* parent) const
69 {
70  return 0;
71 }
72 
73 WsEditorWidget* WsModRSS::createEditor(WContainerWidget* parent) const
74 {
75  return 0;
76 }
77 
78 WWidget* WsModRSS::createAdmin(WContainerWidget* parent) const
79 {
80  return 0;
81 }
82 
83 std::string WsModRSS::description() const
84 {
85  return "WsModRSS wittyShare module";
86 }
87 
88 void WsModRSS::buildMenuBar(WContainerWidget* parent)
89 {
90  if ( !contentButtonsBar() ) return;
91  WsUser* pUser = WsApp->wsUser();
92  if ( pUser->isAdministrator() || pUser->isEditor() ) {
93  WsRSS* m_pRSS = new WsRSS(parent);
94  m_pRSS->setOptions(options());
95  gdToolbarItem* pTbItem = contentButtonsBar()->addToolbarItem(wApp->theme()->resourcesUrl() + "wittyshare/Icons/rss.png", "", "Build the RSS file");
96  pTbItem->clicked().connect(SLOT(m_pRSS, WsRSS::buildRSS));
97  }
98 }
99 
Global properties.
void WsModRSSInit(void)
Definition: WsModRSS.cpp:41
std::string description() const
Return the description of the module.
Definition: WsModRSS.cpp:83
Wt::WWidget * createContents(Wt::WContainerWidget *parent=0) const
Create the contents.
Definition: WsModRSS.cpp:68
void buildMenuBar(Wt::WContainerWidget *parent=0)
Definition: WsModRSS.cpp:88
void buildRSS()
Definition: WsRSS.cpp:55
const std::vector< WsOption > & options() const
Get all options.
Definition: WsOption.cpp:70
WsContentButtonsBar * contentButtonsBar()
WittyShare provide a container to add some buttons like export page in pdf, ..., This function allow ...
Definition: WsModule.cpp:42
Interface that provides differents methods for accessing the FsTree as well as other features...
Definition: WsUser.h:33
Wt::WWidget * createContentsMenuBar(Wt::WContainerWidget *parent=0) const
Create the functionalities.
Definition: WsModRSS.cpp:61
~WsModRSS()
Definition: WsModRSS.cpp:57
Definition: WsRSS.h:21
bool isEditor()
Definition: WsUser.cpp:179
WsModRSS()
Definition: WsModRSS.cpp:51
#define WsApp
Define a shortcut to the application instance.
Definition: WsApplication.h:62
void setOptions(const std::vector< WsOption > &vOptions)
Set all options.
Definition: WsOption.cpp:57
bool isAdministrator()
Definition: WsUser.cpp:184
WsEditorWidget * createEditor(Wt::WContainerWidget *parent=0) const
Create the contents for an editor (create a view of options).
Definition: WsModRSS.cpp:73
Wt::WWidget * createAdmin(Wt::WContainerWidget *parent=0) const
Create the contents for an administrator.
Definition: WsModRSS.cpp:78
Abstract Node class.
User class.