24 void* hndl = dlopen(
"libwt.so", RTLD_NOW | RTLD_GLOBAL);
26 fprintf(stderr,
"cannot load libwt.so shared library! %s\n", dlerror());
35 : WContainerWidget(parent)
43 WContainerWidget::load();
45 std::string galleriaPath = WApplication::instance()->internalPath();
46 boost::algorithm::replace_last(galleriaPath,
"galleria",
"ws.res/galleria");
48 std::string fullGalleriaPath = user->
getRootPath() + galleriaPath;
49 boost::filesystem::directory_iterator end_itr;
50 for (boost::filesystem::directory_iterator itr_dir(fullGalleriaPath +
"/thumbnails"); itr_dir != end_itr; ++itr_dir) {
51 if ( itr_dir->path().extension() ==
".jpeg"
52 || itr_dir->path().extension() ==
".jpg"
53 || itr_dir->path().extension() ==
".png"
55 string img = itr_dir->path().string();
56 boost::replace_first(img,
WsApp->docRoot(),
"");
57 boost::algorithm::replace_all(img,
"&",
"&");
58 string imgThumb = img;
59 boost::replace_last(imgThumb,
"thumbnails",
"images");
60 std::string text =
"<a href=\""
64 +
"\" data-title=\"My title\" data-description=\"My description\"/></a>";
65 std::cout << text << std::endl;
66 addWidget(
new WText(text, Wt::PlainText));
69 std::string javaScript =
"Galleria.loadTheme('";
70 javaScript += wApp->resourcesUrl();
71 javaScript +=
"galleria/themes/classic/galleria.classic.min.js'); \n";
72 javaScript +=
"Galleria.run('#galleria');";
73 WApplication::instance()->doJavaScript(javaScript);
89 WApplication::instance()->require(
"http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js");
90 WApplication::instance()->require(WApplication::instance()->resourcesUrl() +
"galleria/galleria-1.2.9.min.js",
"galleria");
121 return "WsModGalleria wittyShare module";
static WsApplication * wsInstance()
Facility function to access the application object.
WsEditorWidget * createEditor(Wt::WContainerWidget *parent=0) const
Create the contents for an editor (create a view of options).
void WsModGalleriaInit(void)
const std::vector< WsOption > & options() const
Get all options.
Interface that provides differents methods for accessing the FsTree as well as other features...
Wt::WWidget * createContents(Wt::WContainerWidget *parent=0) const
Create the contents.
const std::string getRootPath()
return the root path of the filesystem tree, example : /var/www/demo_site
WsGalleria(Wt::WContainerWidget *parent=0)
#define WsApp
Define a shortcut to the application instance.
Wt::WWidget * createAdmin(Wt::WContainerWidget *parent=0) const
Create the contents for an administrator.
void setOptions(const std::vector< WsOption > &vOptions)
Set all options.
std::string description() const
Return the description of the module.
Wt::WWidget * createContentsMenuBar(Wt::WContainerWidget *parent=0) const
Create the functionalities.