From: <sk...@us...> - 2008-10-02 09:11:37
|
Revision: 1339 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1339&view=rev Author: sknappe Date: 2008-10-02 09:11:24 +0000 (Thu, 02 Oct 2008) Log Message: ----------- bugfixes Modified Paths: -------------- trunk/src/dbpedia-navigator/ajax_generate_URL.php trunk/src/dbpedia-navigator/ajax_get_article.php trunk/src/dbpedia-navigator/helper_functions.php trunk/src/dbpedia-navigator/js/ajax.js Modified: trunk/src/dbpedia-navigator/ajax_generate_URL.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-10-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/ajax_generate_URL.php 2008-10-02 09:11:24 UTC (rev 1339) @@ -1,7 +1,7 @@ <?php session_start(); - $positives=$_SESSION['positive']; - $negatives=$_SESSION['negative']; + if (isset($_SESSION['positive'])) $positives=$_SESSION['positive']; + if (isset($_SESSION['negative'])) $negatives=$_SESSION['negative']; $attr=array(); $pos=""; @@ -23,18 +23,21 @@ $i++; } if (strlen($neg)>0){ - $neg.='negatives=['.$neg.']'; + $neg='negatives=['.$neg.']'; $attr[]=$neg; } - $last_action=$_SESSION['lastAction']; - if (strpos($last_action,'searchConceptInstances')===0){ - $attr[]='concept='.substr($last_action,strpos($last_action, "/")+1); - $last_action='searchConceptInstances/Concept'; + if (isset($_SESSION['lastAction'])){ + $last_action=$_SESSION['lastAction']; + if (strpos($last_action,'searchConceptInstances')===0){ + $attr[]='concept='.substr($last_action,strpos($last_action, "/")+1); + $last_action='searchConceptInstances/Concept'; + } + if (count($attr)>0) $attributes='?'.implode('&',$attr); + else $attributes=''; + + $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; + + print '<a href="'.$url.'">'.$url.'</a><br/><br/>'; } - if (count($attr)>0) $attributes='?'.implode('&',$attr); - - $url='http://'.$_SERVER['HTTP_HOST'].'/dbpedia-navigator/'.$last_action.$attributes; - - print '<a href="'.$url.'">'.$url.'</a><br/><br/>'; ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/ajax_get_article.php =================================================================== --- trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/ajax_get_article.php 2008-10-02 09:11:24 UTC (rev 1339) @@ -158,7 +158,7 @@ $birthdate=$dates; $characteristics['Birthdate']=$triples[$dates]; } - else if ($triples[$dates][0]['type']=='uri'&&$birthuri==false){ + else if (isset($triples[$dates])&&$triples[$dates][0]['type']=='uri'&&$birthuri==false){ $birthuri=$dates; $characteristics['Birthdate']=$triples[$dates]; } @@ -178,7 +178,7 @@ $deathdate=$dates; $characteristics['Deathdate']=$triples[$dates]; } - else if ($triples[$dates][0]['type']=='uri'&&$deathuri==false){ + else if (isset($triples[$dates])&&$triples[$dates][0]['type']=='uri'&&$deathuri==false){ $deathuri=$dates; $characteristics['Deathdate']=$triples[$dates]; } @@ -349,6 +349,27 @@ $artTitle=$_SESSION['articles'][$fromCache]['subject']; $lat=$_SESSION['articles'][$fromCache]['lat']; $long=$_SESSION['articles'][$fromCache]['long']; + + //Add Positives to Session + if (!isset($_SESSION['positive'])){ + if ($redirect!=""){ + $array=array($redirect => $artTitle); + } + else $array=array($uri => $artTitle); + $_SESSION['positive']=$array; + } + else{ + $array=$_SESSION['positive']; + if ($redirect!="") $array[$redirect] = $artTitle; + else $array[$uri]=$artTitle; + if (count($array)>3){ + foreach ($array as $key=>$value){ + unset($array[$key]); + break; + } + } + $_SESSION['positive']=$array; + } } //Build lastArticles Modified: trunk/src/dbpedia-navigator/helper_functions.php =================================================================== --- trunk/src/dbpedia-navigator/helper_functions.php 2008-10-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/helper_functions.php 2008-10-02 09:11:24 UTC (rev 1339) @@ -40,8 +40,12 @@ else if ($count>($min+$distribution)) $style="font-size:medium;"; else $style="font-size:small;"; + $lab=urldecode(str_replace("_"," ",substr (strrchr ($tag, "/"), 1))); + if (strlen($label[$tag])>strlen($lab)-3||preg_match('/[0-9]/',$lab)===1){ + $lab=$label[$tag]; + } //$tag_with_entities=htmlentities("\"".$tag."\""); - $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value);">'.$label[$tag].'</a> '; + $ret.='<a style="'.$style.'" href="#" onclick="document.getElementById(\'hidden_class\').value=\''.$tag.'\';show_results(\''.$tag.'\',document.getElementById(\'hidden_number\').value);">'.$lab.'</a> '; } $ret.="</p><br/>"; return $ret; Modified: trunk/src/dbpedia-navigator/js/ajax.js =================================================================== --- trunk/src/dbpedia-navigator/js/ajax.js 2008-10-02 05:10:43 UTC (rev 1338) +++ trunk/src/dbpedia-navigator/js/ajax.js 2008-10-02 09:11:24 UTC (rev 1339) @@ -125,6 +125,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -152,6 +153,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -176,6 +178,7 @@ if (XhrObj.readyState == 4 && XhrObj.status == 200){ document.getElementById('Positives').innerHTML = XhrObj.responseText; } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -201,6 +204,7 @@ document.getElementById('Negatives').innerHTML = XhrObj.responseText; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -228,6 +232,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); @@ -255,6 +260,7 @@ document.getElementById('Negatives').innerHTML=response[1]; learnConcept(); } + generateURL(); } XhrObj.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |