summaryrefslogtreecommitdiff
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
parent2b5cb826fae8325661abd54eb6521cade1c80dba (diff)
downloadaCms-dc080f8fe2697569923ed326f8080cb0baedc46b.tar.gz
aCms-dc080f8fe2697569923ed326f8080cb0baedc46b.tar.bz2
some rearrangement
-rw-r--r--CMakeLists.txt2
-rw-r--r--config.js2
-rw-r--r--media/basic-profile.css32
-rw-r--r--media/images/strus_big.jpgbin0 -> 36406 bytes
-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
-rw-r--r--templates/intro.tmpl8
-rw-r--r--templates/main.tmpl26
16 files changed, 165 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 375bbba..3ee6c80 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,8 @@ set(TEMPLATES
set(SRC
src/main.cpp
src/strusCms.cpp
+ src/master.cpp
+ src/intro.cpp
)
add_custom_command(
diff --git a/config.js b/config.js
index 6673811..ee20fc7 100644
--- a/config.js
+++ b/config.js
@@ -1,5 +1,7 @@
{
"strusCms" : {
+ "script" : "/strusCms",
+ "media" : "/media"
},
"service" : {
diff --git a/media/basic-profile.css b/media/basic-profile.css
new file mode 100644
index 0000000..b9813c9
--- /dev/null
+++ b/media/basic-profile.css
@@ -0,0 +1,32 @@
+/*
+Original design: Basic Profile (v2.0 - Sep 11, 2012) - A free xhtml/css website template by Andreas Viklund.
+For more information, see http://andreasviklund.com/templates/basic-profile/
+*/
+
+*{margin:0; padding:0;}
+body {background:#fff url(background.jpg) top center no-repeat; color:#303030; font:84% Arial,Helvetica,sans-serif; line-height:1.6em;}
+a {color:#0B0B61; text-decoration:none;}
+a:hover {text-decoration:underline;}
+p,ul,ol,dl {margin:0 0 30px 0;}
+h1 {color:#888; font-size:3.2em; line-height:1.1em; letter-spacing:-3px; margin:20px 0 0 0;}
+h1 a {color:#0B0B61; text-transform:none;}
+h2 {font-size:2.2em; color:#333; margin:0 0 20px; letter-spacing:-1px; border-bottom:2px solid #eee;}
+h3 {font-size:1.8em; margin:10px 0 15px 0; letter-spacing:-1px; border-bottom:2px solid #eee;}
+h1,h2,h3 {font-weight:700; line-height:1.4em;}
+#wrap {color:#303030; margin:40px auto; padding:0; width:980px;}
+#content {text-align:left; width:600px; padding-right:40px;}
+#content ul {list-style:none; margin:0; padding:10px 0 0 0; border-top:1px solid #eee;}
+#content li {list-style:none; font-size:1.2em; margin:0 0 0; padding:0 0 0 0; color:#888; }
+#sidebar {float:right; width:280px; padding-left:40px; border-left:2px solid #ccc; }
+#sidebar ul {list-style:none; margin:0; padding:10px 0 0 0; border-top:1px solid #eee;}
+#sidebar li {list-style:none; font-size:1.2em; margin:0 0 10px; padding:0 0 10px 0; color:#888; border-bottom:1px solid #eee;}
+#sidebar li a {font-size:1.2em;}
+#sidebar h2 {font-size: 1.4em;}
+.slogan {color:#888; font-size:1.4em; font-weight:700; margin:0 0 20px 0; letter-spacing:-1px;}
+.readmore {text-align:right; margin:0 20px 30px 0;}
+.timestamp {display:block; font-weight:700; color:#888; text-align:right; width:150px; padding:20px 20px 20px 0; float:left; margin:0 20px 20px 0; border-right:2px solid #eee;}
+.timestamp a {font-weight:normal;}
+.credits {display:block; clear:left; font-size:0.9em; color:#aaa; margin:20px 0;}
+.credits a {color:#888;}
+.clear {clear:both;}
+
diff --git a/media/images/strus_big.jpg b/media/images/strus_big.jpg
new file mode 100644
index 0000000..70c0776
--- /dev/null
+++ b/media/images/strus_big.jpg
Binary files differ
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
diff --git a/templates/intro.tmpl b/templates/intro.tmpl
index b99ea06..eb7fa49 100644
--- a/templates/intro.tmpl
+++ b/templates/intro.tmpl
@@ -1,13 +1,15 @@
-<% c++ #include "content.hpp" %>
+<% c++ #include "intro_content.hpp" %>
<% skin view %>
-<% view intro uses content::master extends master %>
+<% view intro uses content::intro extends master %>
<% template title() %>
<% include master::title() %> :: Intro
<% end %>
<% template page_content() %>
- Welcome to <b>StrusCms</b>.
+ <div>
+ Welcome to <b>StrusCms</b>.
+ </div>
<% end template %>
<% end view %>
diff --git a/templates/main.tmpl b/templates/main.tmpl
index 8e4592f..0d949d7 100644
--- a/templates/main.tmpl
+++ b/templates/main.tmpl
@@ -9,12 +9,30 @@
<html>
<head>
<title><% include title( ) %></title>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
+ <link rel="stylesheet" type="text/css" href="/media/basic-profile.css" title="Basic Profile" media="all" />
</head>
<body>
- <h1><% include title( ) %></h1>
- <div id="content">
- <% include page_content( ) %>
- </div>
+ <div id="wrap">
+ <h2><% include title( ) %></h2>
+ <div id="content">
+ <% include page_content( ) %>
+
+ <p class="credits">&copy; 2015 Patrick Frey<br />
+ Template design by <a href="http://andreasviklund.com/">Andreas Viklund</a> / Best hosted at <a href="https://www.svenskadomaner.se/?ref=mall&amp;ling=en" title="Svenska Domäner AB">www.svenskadomaner.se</a></p>
+
+ </div>
+
+ <div id="sidebar">
+ <img src="/media/images/strus_big.jpg" width="280" height="280" alt="Strus logo" /></a>
+ <h1><a href="index.htm">Strus CMS</a></h1>
+ <p class="slogan">A simple demo CMS showing the power of the following software:</p>
+ <ul>
+ <li><a href="http://project-strus.net">Strus</a><br/>a collection of C++ libraries for building a full-text search engine</li>
+ <li><a href="http://cppcms.com/wikipp/en/page/main">CppCMS</a><br/>a C++ web programming framework</li>
+ </ul>
+ </div>
+
</body>
</html>
<% end template %>