From 84a3e2f6bcb4da4ab156e39d79f0f8a36c2a0e90 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Sat, 18 Apr 2015 14:32:27 +0200 Subject: added placeholders for directories added user app and content (empty for now) added storage and sqlite script --- .gitignore | 1 + CMakeLists.txt | 1 + config.js | 3 ++- media/basic-profile.css | 1 - sql/sqlite3.sql | 7 +++++++ src/content.hpp | 1 + src/strusCms.cpp | 5 ++++- src/strusCms.hpp | 3 +++ src/user.cpp | 21 +++++++++++++++++++++ src/user.hpp | 16 +++++++++------- src/user_content.hpp | 13 +++++++++++++ storage/db/.gitkeep | 0 storage/strus/.gitkeep | 0 templates/main.tmpl | 16 ++++++++-------- 14 files changed, 70 insertions(+), 18 deletions(-) create mode 100644 .gitignore create mode 100644 sql/sqlite3.sql create mode 100644 src/user.cpp create mode 100644 src/user_content.hpp create mode 100644 storage/db/.gitkeep create mode 100644 storage/strus/.gitkeep diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e166442 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.gitkeep diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ee6c80..659dfed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,7 @@ set(SRC src/strusCms.cpp src/master.cpp src/intro.cpp + src/user.cpp ) add_custom_command( diff --git a/config.js b/config.js index ee20fc7..412111b 100644 --- a/config.js +++ b/config.js @@ -1,7 +1,8 @@ { "strusCms" : { "script" : "/strusCms", - "media" : "/media" + "media" : "/media", + "db_connection" : "sqlite3:db=./storage/db/strusCms.db;@pool_size=16", }, "service" : { diff --git a/media/basic-profile.css b/media/basic-profile.css index b9813c9..961c63c 100644 --- a/media/basic-profile.css +++ b/media/basic-profile.css @@ -29,4 +29,3 @@ h1,h2,h3 {font-weight:700; line-height:1.4em;} .credits {display:block; clear:left; font-size:0.9em; color:#aaa; margin:20px 0;} .credits a {color:#888;} .clear {clear:both;} - diff --git a/sql/sqlite3.sql b/sql/sqlite3.sql new file mode 100644 index 0000000..e524ce6 --- /dev/null +++ b/sql/sqlite3.sql @@ -0,0 +1,7 @@ +drop table if exists users; + +create table users( + id integer primary key autoincrement not null, + username varchar(32) unique not null, + password varchar(32) not null +); diff --git a/src/content.hpp b/src/content.hpp index 13cc61d..ad8753d 100644 --- a/src/content.hpp +++ b/src/content.hpp @@ -3,5 +3,6 @@ #include "master_content.hpp" #include "intro_content.hpp" +#include "user_content.hpp" #endif diff --git a/src/strusCms.cpp b/src/strusCms.cpp index 64cc235..db715f4 100644 --- a/src/strusCms.cpp +++ b/src/strusCms.cpp @@ -8,12 +8,15 @@ namespace apps { strusCms::strusCms( cppcms::service &srv ) : cppcms::application( srv ), - intro( *this ) + conn( settings( ).get( "strusCms.db_connection" ) ), + intro( *this ), + user( *this ) { locale_name = "en"; script = settings( ).get( "strusCms.script" ); add( intro ); + add( user ); mapper( ).root( "/strusCms" ); } diff --git a/src/strusCms.hpp b/src/strusCms.hpp index db7f0d9..539833e 100644 --- a/src/strusCms.hpp +++ b/src/strusCms.hpp @@ -4,6 +4,7 @@ #include #include "intro.hpp" +#include "user.hpp" namespace apps { @@ -15,8 +16,10 @@ class strusCms : public cppcms::application { private: std::string script; std::string locale_name; + std::string conn; apps::intro intro; + apps::user user; }; } diff --git a/src/user.cpp b/src/user.cpp new file mode 100644 index 0000000..746e123 --- /dev/null +++ b/src/user.cpp @@ -0,0 +1,21 @@ +#include "content.hpp" +#include "user.hpp" +#include "strusCms.hpp" + +#include +#include + +namespace apps { + +user::user( strusCms &cms ) + : master( cms ) +{ + cms.dispatcher( ).assign( "/login", &user::login, this ); + cms.mapper( ).assign( "/login" ); +} + +void user::login( ) +{ +} + +} diff --git a/src/user.hpp b/src/user.hpp index 99a0894..041585e 100644 --- a/src/user.hpp +++ b/src/user.hpp @@ -1,14 +1,16 @@ -#ifndef USER_CONTENT_HPP -#define USER_CONTENT_HPP +#ifndef USER_HPP +#define USER_HPP -#include +#include "master.hpp" -#include +namespace apps { -namespace content { +class user : public master { + public: + user( strusCms &cms ); -struct user : public cppcms::base_content { - std::string title; + private: + void login( ); }; } diff --git a/src/user_content.hpp b/src/user_content.hpp new file mode 100644 index 0000000..cac0755 --- /dev/null +++ b/src/user_content.hpp @@ -0,0 +1,13 @@ +#ifndef USER_CONTENT_HPP +#define USER_CONTENT_HPP + +#include "master.hpp" + +namespace content { + +struct user : public master { +}; + +} + +#endif diff --git a/storage/db/.gitkeep b/storage/db/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/storage/strus/.gitkeep b/storage/strus/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/templates/main.tmpl b/templates/main.tmpl index 0d949d7..48b6984 100644 --- a/templates/main.tmpl +++ b/templates/main.tmpl @@ -14,15 +14,7 @@
-

<% include title( ) %>

-
- <% include page_content( ) %> -

© 2015 Patrick Frey
- Template design by Andreas Viklund / Best hosted at www.svenskadomaner.se

- -
- +
+

<% include title( ) %>

+ <% include page_content( ) %> + +

© 2015 Patrick Frey
+ Template design by Andreas Viklund / Best hosted at www.svenskadomaner.se

+
+ <% end template %> -- cgit v1.2.3-54-g00ecf