summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2015-04-18 11:53:48 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2015-04-18 11:53:48 +0200
commitdc080f8fe2697569923ed326f8080cb0baedc46b (patch)
tree84ccd679d3c9de649583bb51c830d069e6419432 /src
parent2b5cb826fae8325661abd54eb6521cade1c80dba (diff)
downloadaCms-dc080f8fe2697569923ed326f8080cb0baedc46b.tar.gz
aCms-dc080f8fe2697569923ed326f8080cb0baedc46b.tar.bz2
some rearrangement
Diffstat (limited to 'src')
-rw-r--r--src/content.hpp1
-rw-r--r--src/intro.cpp0
-rw-r--r--src/intro.hpp13
-rw-r--r--src/intro_content.hpp13
-rw-r--r--src/main.cpp2
-rw-r--r--src/master.cpp14
-rw-r--r--src/master.hpp20
-rw-r--r--src/strusCms.cpp16
-rw-r--r--src/strusCms.hpp9
-rw-r--r--src/user.hpp16
10 files changed, 102 insertions, 2 deletions
diff --git a/src/content.hpp b/src/content.hpp
index e476702..13cc61d 100644
--- a/src/content.hpp
+++ b/src/content.hpp
@@ -2,5 +2,6 @@
#define CONTENT_HPP
#include "master_content.hpp"
+#include "intro_content.hpp"
#endif
diff --git a/src/intro.cpp b/src/intro.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/src/intro.cpp
diff --git a/src/intro.hpp b/src/intro.hpp
new file mode 100644
index 0000000..8a9f2a0
--- /dev/null
+++ b/src/intro.hpp
@@ -0,0 +1,13 @@
+#ifndef iNTRO_CONTENT_HPP
+#define INTRO_CONTENT_HPP
+
+#include "master.hpp"
+
+namespace apps {
+
+class intro : public master {
+};
+
+}
+
+#endif
diff --git a/src/intro_content.hpp b/src/intro_content.hpp
new file mode 100644
index 0000000..ab508ec
--- /dev/null
+++ b/src/intro_content.hpp
@@ -0,0 +1,13 @@
+#ifndef INTRO_CONTENT_HPP
+#define INTRO_CONTENT_HPP
+
+#include "master.hpp"
+
+namespace content {
+
+struct intro : public master {
+};
+
+}
+
+#endif
diff --git a/src/main.cpp b/src/main.cpp
index 9005e20..a1a2e71 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -34,7 +34,7 @@ int main( int argc, char *argv[] )
try {
BOOSTER_INFO( "strusCms" ) << "Restarting application..";
- srv.applications_pool( ).mount( cppcms::applications_factory<strusCms>( ) );
+ srv.applications_pool( ).mount( cppcms::applications_factory<apps::strusCms>( ) );
srv.run( );
diff --git a/src/master.cpp b/src/master.cpp
new file mode 100644
index 0000000..3243bf6
--- /dev/null
+++ b/src/master.cpp
@@ -0,0 +1,14 @@
+#include "master.hpp"
+#include "strusCms.hpp"
+
+#include <cppcms/service.h>
+
+namespace apps {
+
+master::master( strusCms &cms )
+ : m_cms( cms ),
+ application( cms.service( ) )
+{
+}
+
+}
diff --git a/src/master.hpp b/src/master.hpp
new file mode 100644
index 0000000..75f4eb1
--- /dev/null
+++ b/src/master.hpp
@@ -0,0 +1,20 @@
+#ifndef MASTER_HPP
+#define MASTER_HPP
+
+#include <cppcms/application.h>
+
+namespace apps {
+
+class strusCms;
+
+class master : public cppcms::application {
+ protected:
+ strusCms &m_cms;
+
+ public:
+ master( strusCms &cms );
+};
+
+}
+
+#endif
diff --git a/src/strusCms.cpp b/src/strusCms.cpp
index 9c59adf..9190cc3 100644
--- a/src/strusCms.cpp
+++ b/src/strusCms.cpp
@@ -4,18 +4,32 @@
#include <cppcms/url_dispatcher.h>
#include <cppcms/url_mapper.h>
#include <cppcms/http_response.h>
+#include <cppcms/json.h>
+
+namespace apps {
strusCms::strusCms( cppcms::service &srv ) : cppcms::application( srv )
{
+ locale_name = "en";
+ script = settings( ).get<std::string>( "strusCms.script" );
+
dispatcher( ).assign( "", &strusCms::intro, this );
mapper( ).assign( "" );
mapper( ).root( "/strusCms" );
}
+std::string strusCms::root( std::string l )
+{
+ if( l.empty( ) ) l = locale_name;
+ return script + "/" + l;
+}
+
void strusCms::intro( )
{
- content::master c;
+ content::intro c;
c.title = "strusCms";
render( "intro", c );
}
+
+}
diff --git a/src/strusCms.hpp b/src/strusCms.hpp
index 6c152d0..5d4af13 100644
--- a/src/strusCms.hpp
+++ b/src/strusCms.hpp
@@ -3,12 +3,21 @@
#include <cppcms/application.h>
+namespace apps {
+
class strusCms : public cppcms::application {
public:
strusCms( cppcms::service &srv );
+ std::string root( std::string locale_name = "" );
private:
void intro( );
+
+ private:
+ std::string script;
+ std::string locale_name;
};
+}
+
#endif
diff --git a/src/user.hpp b/src/user.hpp
new file mode 100644
index 0000000..99a0894
--- /dev/null
+++ b/src/user.hpp
@@ -0,0 +1,16 @@
+#ifndef USER_CONTENT_HPP
+#define USER_CONTENT_HPP
+
+#include <cppcms/view.h>
+
+#include <string>
+
+namespace content {
+
+struct user : public cppcms::base_content {
+ std::string title;
+};
+
+}
+
+#endif