mirror of https://github.com/kiwix/libkiwix.git
+ load the result template automaticaly from the skin directory
This commit is contained in:
parent
3f2f79d40f
commit
51b605906a
|
@ -23,7 +23,8 @@ namespace kiwix {
|
||||||
|
|
||||||
/* Constructor */
|
/* Constructor */
|
||||||
Searcher::Searcher() :
|
Searcher::Searcher() :
|
||||||
estimatedResultCount(0) {
|
estimatedResultCount(0),
|
||||||
|
resultTemplatePath("") {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search strings in the database */
|
/* Search strings in the database */
|
||||||
|
@ -78,9 +79,14 @@ namespace kiwix {
|
||||||
return retVal;
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool Searcher::setResultTemplatePath(const std::string path) {
|
||||||
|
this->resultTemplatePath = path;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const string Searcher::getHtml() {
|
const string Searcher::getHtml() {
|
||||||
|
|
||||||
const STLW::string & sSourceFile = "/var/www/kiwix/moulinkiwix/templates/results.tmpl";
|
const STLW::string & sSourceFile = this->resultTemplatePath;
|
||||||
VMOpcodeCollector oVMOpcodeCollector;
|
VMOpcodeCollector oVMOpcodeCollector;
|
||||||
StaticText oSyscalls;
|
StaticText oSyscalls;
|
||||||
StaticData oStaticData;
|
StaticData oStaticData;
|
||||||
|
|
|
@ -62,8 +62,9 @@ namespace kiwix {
|
||||||
void search(std::string &search, const unsigned int resultsCount, const bool verbose=false);
|
void search(std::string &search, const unsigned int resultsCount, const bool verbose=false);
|
||||||
bool getNextResult(string &url, string &title, unsigned int &score);
|
bool getNextResult(string &url, string &title, unsigned int &score);
|
||||||
const unsigned int getEstimatedResultCount();
|
const unsigned int getEstimatedResultCount();
|
||||||
void reset();
|
const bool setResultTemplatePath(const std::string path);
|
||||||
const string getHtml();
|
const string getHtml();
|
||||||
|
void reset();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void closeIndex() = 0;
|
virtual void closeIndex() = 0;
|
||||||
|
@ -71,6 +72,7 @@ namespace kiwix {
|
||||||
|
|
||||||
std::vector<Result> results;
|
std::vector<Result> results;
|
||||||
std::vector<Result>::iterator resultOffset;
|
std::vector<Result>::iterator resultOffset;
|
||||||
|
std::string resultTemplatePath;
|
||||||
unsigned int estimatedResultCount;
|
unsigned int estimatedResultCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,360 @@
|
||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml" xmlns:Web="http://schemas.live.com/Web/">
|
||||||
|
<head>
|
||||||
|
<meta content="text/html; charset=utf-8" http-equiv="content-type" />
|
||||||
|
<style type="text/css">
|
||||||
|
body{
|
||||||
|
color:#000;
|
||||||
|
background:#fff url(/fd/s/a/s.png) repeat-x 0 -76px;
|
||||||
|
font:small/normal Arial,Helvetica,Sans-Serif;
|
||||||
|
margin:0;
|
||||||
|
}
|
||||||
|
|
||||||
|
a{
|
||||||
|
color:#04c;
|
||||||
|
text-decoration:none
|
||||||
|
}
|
||||||
|
|
||||||
|
a:visited{
|
||||||
|
color:#639
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover,h3 a{
|
||||||
|
text-decoration:underline
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,h2,h3,h4,h5,h6{
|
||||||
|
font-size:small;
|
||||||
|
font-weight:200;
|
||||||
|
margin:0
|
||||||
|
}
|
||||||
|
|
||||||
|
h1{
|
||||||
|
font-size:93%
|
||||||
|
}
|
||||||
|
|
||||||
|
h2,h3{
|
||||||
|
font-size:125%
|
||||||
|
}
|
||||||
|
|
||||||
|
h1,h1 a,h1 a:visited,h2,h2 a,h2 a:visited{
|
||||||
|
color:#e66400
|
||||||
|
}
|
||||||
|
|
||||||
|
h2{
|
||||||
|
margin:0 0 .62em
|
||||||
|
}
|
||||||
|
|
||||||
|
img{
|
||||||
|
border:0
|
||||||
|
}
|
||||||
|
|
||||||
|
cite,.sb_cite{
|
||||||
|
color:#388222;
|
||||||
|
font-style:normal;
|
||||||
|
word-wrap:break-word
|
||||||
|
}
|
||||||
|
|
||||||
|
strong{
|
||||||
|
font-weight:700
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_count,.sb_meta{
|
||||||
|
color:#737373
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_meta a,.sb_meta a:visited{
|
||||||
|
color:#5077bb
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_alert{
|
||||||
|
color:#d90026
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_alert a{
|
||||||
|
font-style:italic
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_hdr,#sw_content,#sw_main,#sw_foot{
|
||||||
|
width:100%;
|
||||||
|
float:left
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_content{
|
||||||
|
position:static;
|
||||||
|
z-index:3;
|
||||||
|
min-height:344px
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_canvas{
|
||||||
|
padding:0 0 0 15px;
|
||||||
|
clear:both
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_main{
|
||||||
|
_display:inline;
|
||||||
|
margin:0 0 0 -15px;
|
||||||
|
padding:0 0 1.54em 15px
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_results,.sb_results ul,.sb_results li{
|
||||||
|
list-style-type:none;
|
||||||
|
margin:0;
|
||||||
|
padding:0
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_results p,.sb_results .sb_meta{
|
||||||
|
margin:0;
|
||||||
|
line-height:1.2em;
|
||||||
|
word-wrap:
|
||||||
|
break-word
|
||||||
|
}
|
||||||
|
|
||||||
|
.sp_pss li{
|
||||||
|
display:inline
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_pag{
|
||||||
|
padding:0;
|
||||||
|
margin:0;
|
||||||
|
width:100%;
|
||||||
|
float:left
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_pag ul,.sb_pag li{
|
||||||
|
list-style:none;
|
||||||
|
margin:0;
|
||||||
|
padding:0
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_pag li{
|
||||||
|
float:left
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_pag h4{
|
||||||
|
display:none
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_pag a,.sb_pag span{
|
||||||
|
display:block;
|
||||||
|
padding:.3em .7em;
|
||||||
|
margin:0 .38em 0 0;
|
||||||
|
text-align:center
|
||||||
|
}
|
||||||
|
|
||||||
|
a.sb_pagP,a.sb_pagN,span.sb_pagSp{
|
||||||
|
padding:.38em .5em
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_pag a:hover,a.sb_pagS{
|
||||||
|
text-decoration:none;
|
||||||
|
background:#ededed
|
||||||
|
}
|
||||||
|
|
||||||
|
a.sb_pagS{
|
||||||
|
color:#000
|
||||||
|
}
|
||||||
|
|
||||||
|
a.sb_pagP{
|
||||||
|
margin-right:.7em;
|
||||||
|
padding-left:0
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover.sb_pagP,a:hover.sb_pagN{
|
||||||
|
text-decoration:underline;
|
||||||
|
background-color:transparent
|
||||||
|
}
|
||||||
|
|
||||||
|
a.sb_pagP:visited,a.sb_pagN:visited{
|
||||||
|
color:#04c
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_hdr{
|
||||||
|
min-height:70px;
|
||||||
|
_height:70px;
|
||||||
|
padding:0 0 30px 0
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_im{
|
||||||
|
position:absolute;
|
||||||
|
z-index:-1;
|
||||||
|
height:100px;
|
||||||
|
width:620px;
|
||||||
|
top:0;
|
||||||
|
left:190px;
|
||||||
|
background:no-repeat;
|
||||||
|
opacity:0;
|
||||||
|
filter:alpha(opacity=0)
|
||||||
|
}
|
||||||
|
|
||||||
|
.sw_logo{
|
||||||
|
background:url(/fd/s/a/s.png) no-repeat 0 -33px;
|
||||||
|
_display:inline;
|
||||||
|
height:40px;
|
||||||
|
width:112px;
|
||||||
|
margin:-39px 52px 0 20px;
|
||||||
|
float:left
|
||||||
|
}
|
||||||
|
|
||||||
|
.sw_logoT{
|
||||||
|
color:#000;
|
||||||
|
font-size:170%;
|
||||||
|
line-height:normal;
|
||||||
|
position:absolute;
|
||||||
|
z-index:-1
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_hdr .sw_box{
|
||||||
|
padding:49px 0 0;
|
||||||
|
margin:0;
|
||||||
|
float:left;
|
||||||
|
position:relative;
|
||||||
|
z-index:1001;
|
||||||
|
width:100%;
|
||||||
|
line-height:1.38em
|
||||||
|
}
|
||||||
|
|
||||||
|
#sw_hdr .sw_bd{
|
||||||
|
margin-top:-2.43em
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_form_align{
|
||||||
|
margin:-50px 0 0 600px;
|
||||||
|
padding:0 0 0 .53em
|
||||||
|
}
|
||||||
|
|
||||||
|
.sw_box .sb_form_align{
|
||||||
|
text-align:right;
|
||||||
|
padding:0
|
||||||
|
}
|
||||||
|
|
||||||
|
.sw_t,.sw_t *,.sw_t a:visited{
|
||||||
|
color:#fff
|
||||||
|
}
|
||||||
|
|
||||||
|
.sw_t{
|
||||||
|
line-height:1.52em;
|
||||||
|
width:100%;
|
||||||
|
float:left
|
||||||
|
}
|
||||||
|
|
||||||
|
.sw_tc{
|
||||||
|
background:#525051 url(/fd/s/a/s.png) 0 -76px;
|
||||||
|
background:-webkit-gradient(linear,left top,left bottom,from(#768b9e),to(#9fabb9));
|
||||||
|
position:absolute;
|
||||||
|
left:0;
|
||||||
|
z-index:-2;
|
||||||
|
height:1.5em;
|
||||||
|
width:100%
|
||||||
|
}
|
||||||
|
|
||||||
|
.sw_t ul{float:left;margin:0;padding:0 0 0 20px}.sw_t li{padding:0 .85em 0 0;display:inline;zoom:1}ul.sw_tm{padding:0}ul.sw_tn{float:right;white-space:nowrap;padding:0 20px}.sw_tn li{padding:0 0 0 .85em}.sw_u{font-weight:bold;padding:0 .77em 0 0}.sw_tl{position:relative;display:inline;z-index:1003}.sw_tl a:hover,.sw_tl a:hover .sw_tla{text-decoration:none}.sw_tl a:hover span{text-decoration:underline}#sw_tll span{margin:0 0 0 .38em}.sw_tlia,.sw_tliw,.sw_tlif{width:17px;height:16px;display:-moz-inline-box;display:inline-block;vertical-align:text-top;background:url(/fd/s/a/mlk.png) no-repeat}.sw_tlia{width:35px}.sw_tliw{background-position:-18px 0}#sw_tlm,.sw_tlin,#sw_tfbb{display:none}.sw_tla{font-size:75%;margin-left:.38em}.sw_bd{position:relative;float:left;font-size:medium}.sw_b{float:left;border:1px #e5e5e5 solid;background:#fff;padding:.19em .19em 1.06em 0}.sw_b input{float:left;border:0;margin:0 0 -.88em;font-size:100%;padding:.19em .31em .25em .56em;height:1.25em;line-height:1.25em;width:23.45em;-webkit-appearance:none;outline:none}.sw_b .sw_qbtn{background:#e66400 url(/fd/s/a/s.png) 0 -1px;cursor:pointer;height:27px;width:27px;padding:27px 0 0;margin:0 0 -14px;overflow:hidden;font-size:0}#sw_as{left:-1px;position:relative;clear:both;display:none;font-size:small}#sw_bta{color:#737373;font-size:10px;position:absolute;left:135px;top:4px;width:45px}
|
||||||
|
|
||||||
|
#content{
|
||||||
|
margin:0 0 0 -15px;
|
||||||
|
padding:0 271px 0 0;
|
||||||
|
max-width:666px
|
||||||
|
}
|
||||||
|
|
||||||
|
#results_area{
|
||||||
|
float:left;
|
||||||
|
width:100%
|
||||||
|
}
|
||||||
|
|
||||||
|
#results_container{
|
||||||
|
padding:0 15px
|
||||||
|
}
|
||||||
|
|
||||||
|
#sidebar{
|
||||||
|
float:left;
|
||||||
|
margin:0 -271px 0 0;
|
||||||
|
padding:0 15px 0 26px;
|
||||||
|
width:230px;
|
||||||
|
word-wrap:break-word
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_vdl{
|
||||||
|
width:100%;
|
||||||
|
margin-top:.4em
|
||||||
|
}
|
||||||
|
|
||||||
|
#results:after,.sb_vdl:after{
|
||||||
|
clear:both;
|
||||||
|
content:'.';
|
||||||
|
display:block;
|
||||||
|
height:0;
|
||||||
|
visibility:hidden
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_vdl ul{
|
||||||
|
max-width:34%;
|
||||||
|
_width:34%;
|
||||||
|
margin:0 1.51em 0 3.11em;
|
||||||
|
_margin:0 2.55em 0 1.18em;
|
||||||
|
float:left
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_vdl li{
|
||||||
|
text-indent:-.77em;
|
||||||
|
_text-indent:0;
|
||||||
|
a:0
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_ph{
|
||||||
|
margin:0 0 .93em;
|
||||||
|
text-align:right;
|
||||||
|
color:#737373
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_ph h1{
|
||||||
|
float:left;
|
||||||
|
color:#737373;
|
||||||
|
text-transform:uppercase
|
||||||
|
}
|
||||||
|
|
||||||
|
.sc_bullet{
|
||||||
|
margin:0 0 0 .47em;
|
||||||
|
font-size:93%
|
||||||
|
}
|
||||||
|
|
||||||
|
.sb_ph a{
|
||||||
|
color:#737373;
|
||||||
|
text-decoration:underline
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="sb_ph">
|
||||||
|
<h1>Results <b>1-20</b> of <b><TMPL_var count></b> for <b><TMPL_var searchPattern></b></h1>
|
||||||
|
</div>
|
||||||
|
<div id="results">
|
||||||
|
<ul id="wg0" class="sb_results">
|
||||||
|
|
||||||
|
<TMPL_loop results>
|
||||||
|
<li class="sa_wr">
|
||||||
|
<div class="sa_cc">
|
||||||
|
<div class="sb_tlst">
|
||||||
|
<h3><a href="<TMPL_var url>"><TMPL_var title></a></h3>
|
||||||
|
</div>
|
||||||
|
<p>
|
||||||
|
<TMPL_var sample>
|
||||||
|
</p>
|
||||||
|
<div class="sb_meta"><cite><TMPL_var url></cite></div>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</TMPL_loop>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="sb_pag">
|
||||||
|
<h4>Pagination</h4>
|
||||||
|
<ul>
|
||||||
|
<li><a class="sb_pagS">1</a></li>
|
||||||
|
<li><a>2</a></li>
|
||||||
|
<li><a>3</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
Reference in New Issue