Commit 673e1d53 authored by Romain Loth's avatar Romain Loth

tidy up php before changes

factorize access to local static files and fix imagestar function, stash unused archeology of script variants for future decision to clean or integrate
parent 0fe18527
<?php
header('Content-Type: application/json');
include("DirectoryScanner.php");
$projectFolderPat = dirname(dirname(getcwd())) . "/";
$instance = new scanTree($projectFolderPat);
$instance->getDirectoryTree("data");
//pr(var_dump($instance->folders));
$output = array();
$output["folders"] = $instance->folders;
$output["gexf_idfolder"] = $instance->gexf_folder;
echo json_encode($output);
// ** Debug Functions: **
function br() {
echo "----------<br>";
}
function pr($msg) {
echo $msg . "<br>";
}
?>
<?php
echo 'toto';
?>
\ No newline at end of file
...@@ -11,9 +11,6 @@ $table = ""; ...@@ -11,9 +11,6 @@ $table = "";
$column = ""; $column = "";
$id=""; $id="";
// $twjs=end( explode("/",getcwd()) )."/"; // LOCALDB folder.
$twjs="LOCALDB/"; // LOCALDB folder.
// echo("count(elems): ".count($elems)."<br/>"); // echo("count(elems): ".count($elems)."<br/>");
// echo("elems[0]: ".$elems[0]."<br/>"); // echo("elems[0]: ".$elems[0]."<br/>");
// echo("is_array($elems): ".is_array($elems)."<br/>"); // echo("is_array($elems): ".is_array($elems)."<br/>");
...@@ -34,7 +31,6 @@ if($ndtype=="semantic"){ ...@@ -34,7 +31,6 @@ if($ndtype=="semantic"){
$factor=10; $factor=10;
} }
$restriction=''; $restriction='';
$factor=10;
$sql=""; $sql="";
////////// //////////
...@@ -113,11 +109,10 @@ foreach ($wos_ids as $id => $score) { ...@@ -113,11 +109,10 @@ foreach ($wos_ids as $id => $score) {
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data'; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=15px src="twlibs/img/google.png"></a>'; $external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=15px src="'.$our_libs_root.'/img/google.png"></a>';
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=$external_link.imagestar($score,$factor,$twjs).' '; $output.=$external_link.imagestar($score,$factor,$our_libs_root).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details.php?gexf='.urlencode($gexf).'&index='.$table.'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.$row['data']." </a> "; $output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?gexf='.urlencode($gexf).'&index='.$table.'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.$row['data']." </a> ";
// echo '<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details.php?gexf='.urlencode($gexf).'&index='.$table.'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.$row['data']." </a> ";
} }
// get the authors /!\ hardcoded CortextDB table /!\ // get the authors /!\ hardcoded CortextDB table /!\
...@@ -196,7 +191,7 @@ $output .= "</ul>"; ##### ...@@ -196,7 +191,7 @@ $output .= "</ul>"; #####
// // $sql2='SELECT ISIpubdate.id,ISIC1_1.data from ISIpubdate,ISIC1_1 where ISIC1_1.data="'.$row['data'].'" AND ISIpubdate.id=ISIC1_1.id AND ISIpubdate.data="2013" limit 1'; // // $sql2='SELECT ISIpubdate.id,ISIC1_1.data from ISIpubdate,ISIC1_1 where ISIC1_1.data="'.$row['data'].'" AND ISIpubdate.id=ISIC1_1.id AND ISIpubdate.data="2013" limit 1';
// // //echo $sql2; // // //echo $sql2;
// // foreach ($corporadb->query($sql2) as $row2){ // // foreach ($corporadb->query($sql2) as $row2){
// // $nov_string.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($graphdb).'&gexf='.urlencode($gexf).'&query='.urlencode('["'.$res[$i].'"]').'&type='.urlencode($_GET["type"]).'&id='.$row2['id'].' \')">'.$res[$i]."</a>, "; // // $nov_string.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($graphdb).'&gexf='.urlencode($gexf).'&query='.urlencode('["'.$res[$i].'"]').'&type='.urlencode($_GET["type"]).'&id='.$row2['id'].' \')">'.$res[$i]."</a>, ";
// // } // // }
// // } // // }
// // } // // }
...@@ -215,7 +210,7 @@ $output .= "</ul>"; ##### ...@@ -215,7 +210,7 @@ $output .= "</ul>"; #####
// // $sql2='SELECT ISIpubdate.id,ISIC1_1.data from ISIpubdate,ISIC1_1 where ISIC1_1.data="'.$row['data'].'" AND ISIpubdate.id=ISIC1_1.id AND ISIpubdate.data="2013" limit 1'; // // $sql2='SELECT ISIpubdate.id,ISIC1_1.data from ISIpubdate,ISIC1_1 where ISIC1_1.data="'.$row['data'].'" AND ISIpubdate.id=ISIC1_1.id AND ISIpubdate.data="2013" limit 1';
// // //echo $sql2; // // //echo $sql2;
// // foreach ($corporadb->query($sql2) as $row2){ // // foreach ($corporadb->query($sql2) as $row2){
// // $res_string.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($graphdb).'&gexf='.urlencode($gexf).'&query='.urlencode('["'.$res[$i].'"]').'&type='.urlencode($_GET["type"]).'&id='.$row2['id'].' \')">'.$res[$i]."</a>, "; // // $res_string.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($graphdb).'&gexf='.urlencode($gexf).'&query='.urlencode('["'.$res[$i].'"]').'&type='.urlencode($_GET["type"]).'&id='.$row2['id'].' \')">'.$res[$i]."</a>, ";
// // } // // }
// // } // // }
// // } // // }
...@@ -285,22 +280,6 @@ $output .= "</ul>"; ##### ...@@ -285,22 +280,6 @@ $output .= "</ul>"; #####
} }
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
if($max_item_displayed>$total_count) $max_item_displayed=$total_count; if($max_item_displayed>$total_count) $max_item_displayed=$total_count;
// echo $news.'<br/><h4><font color="#0000FF"> Full text of top '.$max_item_displayed.'/'.$related.' related publications:</font></h4>'.$output; // echo $news.'<br/><h4><font color="#0000FF"> Full text of top '.$max_item_displayed.'/'.$related.' related publications:</font></h4>'.$output;
echo '<br/><h4><font color="#0000FF"> Full text of top '.$max_item_displayed.'/'.$total_count.' related publications:</font></h4>'.$output; echo '<br/><h4><font color="#0000FF"> Full text of top '.$max_item_displayed.'/'.$total_count.' related publications:</font></h4>'.$output;
......
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf]; $db = $gexf_db[$gexf];
......
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf]; $db = $gexf_db[$gexf];
...@@ -6,7 +7,6 @@ $base = new PDO("sqlite:../" .$db); ...@@ -6,7 +7,6 @@ $base = new PDO("sqlite:../" .$db);
$output = "<ul>"; // string sent to the javascript for display $output = "<ul>"; // string sent to the javascript for display
#http://localhost/branch_ademe/php/test.php?type=social&query=[%22marwah,%20m%22]
$type = $_GET["type"]; $type = $_GET["type"];
...@@ -23,7 +23,6 @@ foreach ($base->query($sql) as $row) { ...@@ -23,7 +23,6 @@ foreach ($base->query($sql) as $row) {
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs=end( explode("/",getcwd()) )."/"; // LOCALDB folder.
if($type=="social"){ if($type=="social"){
$table = "ISIAUTHOR"; $table = "ISIAUTHOR";
...@@ -89,19 +88,12 @@ foreach ($wos_ids as $id => $score) { ...@@ -89,19 +88,12 @@ foreach ($wos_ids as $id => $score) {
if ($to_display){ if ($to_display){
$count+=1; $count+=1;
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' '; $output.=imagestar($score,$factor,$our_libs_root).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data"; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data";
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="'.$our_php_root.'/default_doc_details.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="'.$our_libs_root.'/img/gs.png"></a>';
//this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="twlibs/img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
// get the authors // get the authors
...@@ -110,8 +102,6 @@ foreach ($wos_ids as $id => $score) { ...@@ -110,8 +102,6 @@ foreach ($wos_ids as $id => $score) {
$output.=strtoupper($row['data']).', '; $output.=strtoupper($row['data']).', ';
} }
//<a href="JavaScript:newPopup('http://www.quackit.com/html/html_help.cfm');">Open a popup window</a>'
$output.=$external_link."</li><br>"; $output.=$external_link."</li><br>";
} }
...@@ -126,21 +116,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou ...@@ -126,21 +116,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
<?php <?php
// default path to ProjectExplorer root
// (where data directory and db.json file reside) // GLOBAL PARAMS
$mainpath=dirname(getcwd())."/../"; // -------------
$ntypes = 2; // 1 - relative urls
$our_php_root="twbackends/phpAPI"; // our php scripts relative URL
$our_libs_root="twbackends/phpAPI"; // for our few icons and jquery-ui
// POSS could be merged with our_php_root
// 2 - paths
$mainpath=dirname(dirname(getcwd()))."/"; // default fs path to ProjectExplorer root
// (where data dir and db.json file reside)
$project_menu_path = "db.json"; $project_menu_path = "db.json";
// 3 - others
$ntypes = 2; // max node types
// number of docs to display setting
$max_item_displayed = 7;
// for csv parsing
$csvsep = "\t";
$csvquote = '"';
// for csv caching (optional)
$memserver = 'localhost';
$memport = 11211;
// CONFIGURATION PARAMS
// --------------------
// reading db.json associations // reading db.json associations
// source graph file <=> (db, dbtype, cols) as relatedDocs php API // source graph file <=> (db, dbtype, cols) as relatedDocs php API
$project_menu_fh = fopen($mainpath.$project_menu_path, "r"); $project_menu_fh = fopen($mainpath.$project_menu_path, "r");
...@@ -69,6 +94,7 @@ foreach ($project_menu as $project_dir => $dir_items){ ...@@ -69,6 +94,7 @@ foreach ($project_menu as $project_dir => $dir_items){
$gexf= str_replace('"','',$_GET["gexf"]); $gexf= str_replace('"','',$_GET["gexf"]);
$ndtype = $_GET["type"]; $ndtype = $_GET["type"];
$ntid = null; $ntid = null;
$my_conf = null;
// legacy types => generic types // legacy types => generic types
if ($ndtype == 'semantic') { $ntid = 0; } if ($ndtype == 'semantic') { $ntid = 0; }
...@@ -84,27 +110,12 @@ else { ...@@ -84,27 +110,12 @@ else {
$graphdb = $my_conf['dir'].'/'.$my_conf['reldbfile']; $graphdb = $my_conf['dir'].'/'.$my_conf['reldbfile'];
} }
echodump("reldb", $graphdb); // echodump("params: reldb", $graphdb);
// echodump("params: node type id", $ntid);
// for csv parsing
$csvsep = "\t";
$csvquote = '"';
// for csv caching (optional)
$memserver = 'localhost';
$memport = 11211;
// number of docs to display setting
$max_item_displayed = 7;
// echodump("graphdb", $graphdb); // echodump("graphdb", $graphdb);
function echodump($title, $anyObj) {
echo "<br>".$title.": ";
echo (preg_replace_callback("/\n(\s*)/", function($capt){
return('<br>'.str_repeat('&nbsp;', strlen($capt[0])));
}, json_encode($anyObj, JSON_PRETTY_PRINT)));
echo "<br>";
}
?> ?>
<?php
function echodump($title, $anyObj) {
echo "<br>".$title.": ";
echo (preg_replace_callback("/\n(\s*)/", function($capt){
return('<br>'.str_repeat('&nbsp;', strlen($capt[0])));
}, json_encode($anyObj, JSON_PRETTY_PRINT)));
echo "<br>";
}
function errmsg($message, $context, $more = "") {
echo "<p class='micromessage'>The relatedDocs DB conf for $context is $message
(please read A-Introduction/servermenu_config.md).<br>$more</p>";
}
function imagestar($score,$factor,$static_libs) {
// produit le html des images de score
$star_image = '';
if ($score > 1) {
$star_image = '';
$yellow_star = '<img src="'.$static_libs.'/img/star.gif" border="0" >';
$grey_star = '<img src="'.$static_libs.'/img/stargrey.gif" border="0">';
$max = 5 * $score / $factor;
for ($s = 0; $s < 5 ; $s++) {
if ($s < $max) {
$star_image.=$yellow_star;
}
else {
$star_image.= $grey_star;
}
}
}
return $star_image;
}
?>
#### Unused functionalities
- `tfidf.php`: compute a tfidf value per term (as pointwise metric for ranking, not similarities) table in Cortext-like databases
- `listFiles.php` + `DirectoryScanner.php`: alternative strategy to navigate between source files (old tina before db.json)
- `favorites.php` : query a favorites table in Cortext-like databases
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
$db= $_GET["db"];//I receive the specific database as string! $db= $_GET["db"];//I receive the specific database as string!
$terms_of_query=json_decode($_GET["query"]); $terms_of_query=json_decode($_GET["query"]);
include('parameters_details.php'); include('parameters_details.php');
include('tools.php');
$base = new PDO("sqlite:" .$mainpath.$db); $base = new PDO("sqlite:" .$mainpath.$db);
$query=$_GET["query"]; $query=$_GET["query"];
$gexf=$_GET["gexf"]; $gexf=$_GET["gexf"];
...@@ -47,10 +48,10 @@ foreach ($wos_ids as $id => $score) { ...@@ -47,10 +48,10 @@ foreach ($wos_ids as $id => $score) {
$output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command: //this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one: //the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>'; $external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>'; //$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
...@@ -108,20 +109,4 @@ $output= '<h3>'.$num_favorite.' favorite items </h3>'.$tag_could.'<br/>'.$output ...@@ -108,20 +109,4 @@ $output= '<h3>'.$num_favorite.' favorite items </h3>'.$tag_could.'<br/>'.$output
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
### phpAPI old use-case specific variants
They are quasi-identical to info_div.php and full_doc_list.php, kept for future decision to remove or add as conditional behavior.
Apparent use-cases:
- `info_div2.php`: tweetoscope
- `full_doc_list2.php`: pasteur
- `default_doc_details2.php`: pasteur
- `full_doc_list_tidf.php`: ???
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf]; $db = $gexf_db[$gexf];
......
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db = $gexf_db[$gexf]; $db = $gexf_db[$gexf];
...@@ -23,7 +24,6 @@ foreach ($base->query($sql) as $row) { ...@@ -23,7 +24,6 @@ foreach ($base->query($sql) as $row) {
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs="pasteurapi/"; // submod path of TinaWebJS
if($type=="social"){ if($type=="social"){
$table = "ISIAUTHOR"; $table = "ISIAUTHOR";
...@@ -90,19 +90,18 @@ foreach ($wos_ids as $id => $score) { ...@@ -90,19 +90,18 @@ foreach ($wos_ids as $id => $score) {
if ($to_display){ if ($to_display){
$count+=1; $count+=1;
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' '; $output.=imagestar($score,$factor,$our_libs_root).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data"; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id." group by data";
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details2.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="'.$our_php_root.'/default_doc_details2.php?gexf='.urlencode($gexf).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command: //this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one: //the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="twlibs/img/gs.png"></a>'; $external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="'.$our_libs_root.'/img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
// get the authors // get the authors
...@@ -127,21 +126,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou ...@@ -127,21 +126,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
<?php <?php
include('tools.php');
include('parameters_details.php'); include('parameters_details.php');
$db= $_GET["db"];//I receive the specific database as string! $db= $_GET["db"];//I receive the specific database as string!
...@@ -49,7 +50,6 @@ if($project_folder=='nci'){ ...@@ -49,7 +50,6 @@ if($project_folder=='nci'){
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs="tinawebJS/"; // submod path of TinaWebJS
if($type=="social"){ if($type=="social"){
$table = "ISIAUTHOR"; $table = "ISIAUTHOR";
...@@ -136,18 +136,18 @@ foreach ($wos_ids as $id => $score) { ...@@ -136,18 +136,18 @@ foreach ($wos_ids as $id => $score) {
if ($to_display){ if ($to_display){
$count+=1; $count+=1;
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=imagestar($score,$factor,$twjs).' '; $output.=imagestar($score,$factor,$our_libs_root).' ';
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id;
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.='<a href="default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> "; $output.='<a href="'.$our_php_root.'/default_doc_details.php?db='.urlencode($db).'&type='.urlencode($_GET["type"]).'&query='.urlencode($query).'&id='.$id.'">'.$row['data']." </a> ";
//this should be the command: //this should be the command:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?db='.urlencode($datadb).'&id='.$id.' \')">'.$row['data']." </a> ";
//the old one: //the old one:
//$output.='<a href="JavaScript:newPopup(\''.$twjs.'php/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> "; //$output.='<a href="JavaScript:newPopup(\''.$our_php_root.'/default_doc_details.php?id='.$id.' \')">'.$row['data']." </a> ";
$external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="twlibs/img/gs.png"></a>'; $external_link="<a href=http://scholar.google.com/scholar?q=".urlencode('"'.$row['data'].'"')." target=blank>".' <img width=20px src="'.$our_libs_root.'/img/gs.png"></a>';
//$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>'; //$output.='<a href="JavaScript:newPopup(''php/doc_details.php?id='.$id.''')"> Link</a>';
} }
...@@ -183,21 +183,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou ...@@ -183,21 +183,4 @@ $output= '<h3>'.$count.' items related to: '.implode(' OR ', $elems).'</h3>'.$ou
echo $output; echo $output;
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
...@@ -13,7 +13,6 @@ $elems = json_decode($query); ...@@ -13,7 +13,6 @@ $elems = json_decode($query);
$table = ""; $table = "";
$column = ""; $column = "";
$id=""; $id="";
$twjs="API_CNRS/"; // submod path of TinaWebJS
if($type=="semantic"){ if($type=="semantic"){
...@@ -99,18 +98,18 @@ foreach ($wos_ids as $id => $score) { ...@@ -99,18 +98,18 @@ foreach ($wos_ids as $id => $score) {
$sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data'; $sql = 'SELECT data FROM ISITITLE WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.utf8_decode($row['data']).'"')." target=blank>".' <img width=15px src="twlibs/img/google.png"></a>'; $external_link="<a href=http://google.com/webhp?#q=".urlencode('"'.utf8_decode($row['data']).'"')." target=blank>".' <img width=15px src="'.$our_libs_root.'/img/google.png"></a>';
$output.="<li title='".$score."'>"; $output.="<li title='".$score."'>";
$output.=$external_link.imagestar($score,$factor,$twjs).' '; $output.=$external_link.imagestar($score,$factor,$our_libs_root).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> "; $output.='<a href="JavaScript:newPopup(\''.$our_php_root.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
// $output.='<a>'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> "; // $output.='<a>'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
} }
$sql = 'SELECT data FROM ISIDOI WHERE id='.$id.' group by data'; $sql = 'SELECT data FROM ISIDOI WHERE id='.$id.' group by data';
foreach ($base->query($sql) as $row) { foreach ($base->query($sql) as $row) {
$output.=$external_link.imagestar($score,$factor,$twjs).' '; $output.=$external_link.imagestar($score,$factor,$our_libs_root).' ';
$output.='<a href="JavaScript:newPopup(\''.$twjs.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> "; $output.='<a href="JavaScript:newPopup(\''.$our_php_root.'default_doc_details2.php?gexf='.urlencode($gexf).'&query='.urlencode($query).'&type='.urlencode($_GET["type"]).'&id='.$id.' \')">'.htmlentities($row['data'], ENT_QUOTES, "UTF-8")." </a> ";
} // get the authors } // get the authors
$sql2 = 'SELECT data FROM ISIAUTHOR WHERE id='.$id. ' group by data'; $sql2 = 'SELECT data FROM ISIAUTHOR WHERE id='.$id. ' group by data';
...@@ -170,19 +169,4 @@ function getDB ($directory) { ...@@ -170,19 +169,4 @@ function getDB ($directory) {
return $result; return $result;
} }
function imagestar($score,$factor,$twjs) {
// produit le html des images de score
$star_image = '';
if ($score > .5) {
$star_image = '';
for ($s = 0; $s < min(5,$score/$factor); $s++) {
$star_image.='<img src="twlibs/img/star.gif" border="0" >';
}
} else {
$star_image.='<img src="twlibs/img/stargrey.gif" border="0">';
}
return $star_image;
}
?> ?>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment