Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 2084 → Rev 2085

/trunk/papyrus/applettes/google/google.html
New file
0,0 → 1,12
<script>
(function() {
var cx = '001929411250905967187:sldmewo1uyo';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
/trunk/papyrus/applettes/google/google.php
New file
0,0 → 1,39
<?php
/**
* @author Raphaël Droz <raphael@tela-botania.org>
* @copyright 2013 Tela-Botanica
* @license http://www.cecill.info/licences/Licence_CeCILL_V2-fr.txt Licence CECILL
* @license GPL v3 <http://www.gnu.org/licenses/gpl.txt>
*
* Intégration du moteur de recherche Google
* Exemple de templates relatifs pour lesquels envisager un remplacement de PAPYRUS_MOTEUR_RECHERCHE:
* - sites/botanique/fr/squelettes/botanique.html: PAPYRUS_GOOGLE (en-tête)
* - sites/botanique/fr/squelettes/botanique.html: PAPYRUS_GOOGLE:results (corps de page)
*
**/
 
$GLOBALS['_GEN_commun']['info_applette_nom_fonction'] = 'afficherMoteurRechercheGoogle';
$GLOBALS['_GEN_commun']['info_applette_balise'] = '(?:<!-- '.$GLOBALS['_GEN_commun']['balise_prefixe'].'GOOGLE(?::(\w+))? -->|\{\{GoogleInput(?::(\w+))?\}\})';
 
function afficherMoteurRechercheGoogle($tab_applette_arguments, $_GEN_commun) {
// boite de résultats
// TODO: comment stopper le chargement de #zone_contenu_corps//PAPYRUS_CONTENU_CORPS ?
// réponse: cf: papyrus/applications/afficheur/afficheur.php :: afficherContenuCorps()
// TODO: link href dans <body> est non-standard
if($tab_applette_arguments[1] == 'results') {
return <<<EOF
<link href="/papyrus/applettes/google/google.css" rel="stylesheet" type="text/css" />
<gcse:searchresults-only queryParameterName="r"></gcse:searchresults-only>
EOF;
}
$url = $_SERVER['REDIRECT_URL'];
/*$d = array();
parse_str($_SERVER['QUERY_STRING'], $d);
var_dump(urldecode(http_build_query($d)));die;*/
$script = file_get_contents(dirname(__FILE__) . '/google.html');
return <<<EOF
$script
<!-- <gcse:search></gcse:search> -->
<gcse:searchbox-only resultsUrl="http://papy$url" queryParameterName="r"></gcse:searchbox-only>
EOF;
}
/trunk/papyrus/applettes/google/google.css
New file
0,0 → 1,35
.cse .gsc-control-cse, .gsc-control-cse {
padding: 0;
}
 
.gsc-search-box-tools .gsc-search-box .gsc-input {
padding: 0 /*!important*/;
}
 
gsc-search-box {
margin: 0;
}
 
table.gsc-search-box td {
padding: 0;
}
 
table.gsc-search-box {
margin: 0;
}
div.gsc-input-box {
height: auto;
}
.gsc-input-box table {
margin: 0;
}
input.gsc-search-button-v2 {
/*padding: 0 !important;*/
height: 8px /*!important*/;
width: 8px /*!important*/;
min-width: 8px /*!important*/;
}
 
li#recherche {
margin-top: -5px;
}