From: Jean-Marc Coic Date: Sat, 5 Feb 2005 11:37:39 +0000 (+0000) Subject: Some improvements in design of categories and keywords X-Git-Tag: xorg/old~314 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=83bec1710ffb355386ce13366fa5f58582c67496;p=platal.git Some improvements in design of categories and keywords git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-446 --- diff --git a/include/exalead/exalead.parser.inc.php b/include/exalead/exalead.parser.inc.php index ba68898..66e90cf 100644 --- a/include/exalead/exalead.parser.inc.php +++ b/include/exalead/exalead.parser.inc.php @@ -79,12 +79,39 @@ class Exalead{ function first_query($query, $offset = 0){ if(empty($this->base_cgi)) return false; + //$tmp = parse_url($this->base_cgi); + //$view_name = substr($tmp['path'], 5); + //$query_exa = $this->base_cgi."?_q=".urlencode($query)."&_f=xml2&A=-1&_vn=".$view_name; $query_exa = $this->base_cgi."?_q=".urlencode($query)."&_f=xml2"; if($offset > 0){ $query_exa .= "&_s=".$offset; } - + $xml_response = file_get_contents($query_exa); + /*$xml_response = ''; + $query_explode = parse_url($query_exa); + + $fp = fsockopen("murphy.m4x.org", 10000, $errno, $errstr, 30); + if (!$fp) { + echo "$errstr ($errno)
\n"; + } else { + $out = "GET {$query_explode['path']}?{$query_explode['query']} HTTP/1.1\r\n"; + $out .= "Host: murphy.m4x.org:10000\r\n"; + $out .= "Accept: text/xml\r\n"; + $out .= "Accept-Charset: utf-8\r\n"; + $out .= "Connection: Close\r\n\r\n"; + + fwrite($fp, $out); + $body = false; + while (!feof($fp)) { + $s = fgets($fp, 1024); + if ( $body ) + $xml_response .= $s; + if ( $s == "\r\n" ) + $body = true; + } + fclose($fp); + }*/ $this->parse($xml_response); } diff --git a/include/exalead/exalead.smarty.inc.php b/include/exalead/exalead.smarty.inc.php index 6eb70b9..85bc8ae 100644 --- a/include/exalead/exalead.smarty.inc.php +++ b/include/exalead/exalead.smarty.inc.php @@ -1,5 +1,8 @@ title; @@ -127,10 +130,58 @@ function _exa_navigation_droite($params, &$smarty){ return $res; } +//categorie = true if this line is for a category, false if this is for a keyword +function _display_3_columns($title, $count, $refine, $exclude, $categorie){ + global $exa_max_length; + if($categorie) $title_exclude = 'Ne pas afficher cette catégorie'; + else $title_exclude = 'Ne pas afficher ce mot-clé'; + $extract = ((strlen($title) > $exa_max_length + 3)?substr($title,0,$exa_max_length).'...':$title); + return " + + $extract$count + &_f=xml2\" + title=\"$title_exclude\">[-] + "; + +} + +//excluded = true if this line is an excluded result, = false if this line is a refined result +//categorie = true if this line is for a category, false if this is for a keyword +function _display_2_columns($title, $reset, $excluded, $categorie){ + global $exa_max_length; + if($excluded){ + if($categorie) $title_link = 'Afficher de nouveau cette catégorie'; + else $title_link = 'Afficher de nouveau ce mot-clé'; + $link = '[+]'; + $style = 'text-decoration: line-through;'; + } else{ + if($categorie) $title_link = 'Voir les autres catégories'; + else $title_link = 'Voir les autres mots-clés'; + $link = '[-]'; + $style = 'text-decoration: none; font-weight: bold;'; + } + $extract = ((strlen($title) > $exa_max_length + 3)?substr($title,0,$exa_max_length).'...':$title); + return " + + $extract + + $link + + "; +} + /** * This function is used to resume database content for given group (template argument 'groupe') */ function _display_resume_groupe($params, &$smarty){ + global $exa_max_length; if(!empty($params['exalead_data'])){ $exalead_data = &$GLOBALS[$params['exalead_data']]; } @@ -144,52 +195,68 @@ function _display_resume_groupe($params, &$smarty){ foreach($exalead_data->groups as $group){ if($group->title == $groupe){ $array = & $group->categories; - $result = "
$groupe