From 51b605906ae4993e1a37e2512f5705ade0b0d88c Mon Sep 17 00:00:00 2001 From: kelson42 Date: Sat, 19 Mar 2011 10:48:23 +0000 Subject: [PATCH] + load the result template automaticaly from the skin directory --- src/common/kiwix/searcher.cpp | 10 +- src/common/kiwix/searcher.h | 4 +- static/results.tmpl | 360 ++++++++++++++++++++++++++++++++++ 3 files changed, 371 insertions(+), 3 deletions(-) create mode 100644 static/results.tmpl diff --git a/src/common/kiwix/searcher.cpp b/src/common/kiwix/searcher.cpp index 1867217bf..eb45a74c0 100644 --- a/src/common/kiwix/searcher.cpp +++ b/src/common/kiwix/searcher.cpp @@ -23,7 +23,8 @@ namespace kiwix { /* Constructor */ Searcher::Searcher() : - estimatedResultCount(0) { + estimatedResultCount(0), + resultTemplatePath("") { } /* Search strings in the database */ @@ -78,9 +79,14 @@ namespace kiwix { return retVal; } + const bool Searcher::setResultTemplatePath(const std::string path) { + this->resultTemplatePath = path; + return true; + } + const string Searcher::getHtml() { - const STLW::string & sSourceFile = "/var/www/kiwix/moulinkiwix/templates/results.tmpl"; + const STLW::string & sSourceFile = this->resultTemplatePath; VMOpcodeCollector oVMOpcodeCollector; StaticText oSyscalls; StaticData oStaticData; diff --git a/src/common/kiwix/searcher.h b/src/common/kiwix/searcher.h index 20ae77c32..684d9294d 100644 --- a/src/common/kiwix/searcher.h +++ b/src/common/kiwix/searcher.h @@ -62,8 +62,9 @@ namespace kiwix { void search(std::string &search, const unsigned int resultsCount, const bool verbose=false); bool getNextResult(string &url, string &title, unsigned int &score); const unsigned int getEstimatedResultCount(); - void reset(); + const bool setResultTemplatePath(const std::string path); const string getHtml(); + void reset(); protected: virtual void closeIndex() = 0; @@ -71,6 +72,7 @@ namespace kiwix { std::vector results; std::vector::iterator resultOffset; + std::string resultTemplatePath; unsigned int estimatedResultCount; }; diff --git a/static/results.tmpl b/static/results.tmpl new file mode 100644 index 000000000..6ee6becc9 --- /dev/null +++ b/static/results.tmpl @@ -0,0 +1,360 @@ + + + + + + + + +
+

Results 1-20 of for

+
+
+
    + + +
  • +
    +
    +

    +
    +

    + +

    +
    +
    +
  • +
    + +
+
+ +
+

Pagination

+
    +
  • 1
  • +
  • 2
  • +
  • 3
  • +
+
+ +