From 1aeeaa2c3b260a6ae278a63d771016d1b88df9a1 Mon Sep 17 00:00:00 2001 From: Skylsmoi Date: Wed, 7 Jun 2017 11:48:21 +0200 Subject: [PATCH] rewrite welcome page --- src/server/kiwix-serve.cpp | 48 +++++++++++++++++++++++++----------- static/server/home.html.tmpl | 3 ++- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index c618cba..2c1fd20 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -879,26 +879,46 @@ int main(int argc, char **argv) { } /* Compute the Welcome HTML */ - string welcomeBooksHtml; + string welcomeBooksCss = "" +""; + + string welcomeBooksHtml = "" +"
"; for (itr = booksIds.begin(); itr != booksIds.end(); ++itr) { libraryManager.getBookById(*itr, currentBook); if (!currentBook.path.empty() && readers.find(currentBook.getHumanReadableIdFromPath()) != readers.end()) { - welcomeBooksHtml += "

" + currentBook.title + "

\n \ - \n \ - \n \ - \n \ -
" + currentBook.description + - "
" + - "\n \ - \n \ - \n \ -
Size: " + kiwix::beautifyFileSize(atoi(currentBook.size.c_str())) + " (" + kiwix::beautifyInteger(atoi(currentBook.articleCount.c_str())) + " articles, " + kiwix::beautifyInteger(atoi(currentBook.mediaCount.c_str())) + " medias)\n \ - Date: " + currentBook.date + "
Author: " + currentBook.creator + "Language: " + currentBook.language + "
Publisher: " + (currentBook.publisher.empty() ? "unknown" : currentBook.publisher ) + "
\n \ -
\n\n"; + welcomeBooksHtml += "" +"" + "
" + "
" + "
" + currentBook.title + "
" + "
" + currentBook.description + "
" + "
" + "" + kiwix::beautifyInteger(atoi(currentBook.articleCount.c_str())) + " articles, " + kiwix::beautifyInteger(atoi(currentBook.mediaCount.c_str())) + " medias" + "
" + "
" + "
" +"
"; } } - welcomeHTML = replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksHtml, "__BOOKS__"); + welcomeBooksHtml += "" +"
"; + + welcomeHTML = replaceRegex(replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksCss, "__BOOKS_STYLE__"), welcomeBooksHtml, "__BOOKS__"); + #ifndef _WIN32 /* Fork if necessary */ diff --git a/static/server/home.html.tmpl b/static/server/home.html.tmpl index 14437c2..0a7d2b8 100644 --- a/static/server/home.html.tmpl +++ b/static/server/home.html.tmpl @@ -7,6 +7,7 @@ + __BOOKS_STYLE__