From: <sk...@us...> - 2008-02-07 11:43:24
|
Revision: 511 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=511&view=rev Author: sknappe Date: 2008-02-07 03:43:21 -0800 (Thu, 07 Feb 2008) Log Message: ----------- fixed a bug for redirects Modified Paths: -------------- trunk/src/dbpedia-navigator/ajaxfunctions.php Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-07 10:40:10 UTC (rev 510) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-02-07 11:43:21 UTC (rev 511) @@ -125,7 +125,10 @@ //BUILD ARTICLE TITLE $artTitle=$triples['http://www.w3.org/2000/01/rdf-schema#label'][0]; + + //Restart the Session session_start(); + //store article in session, to navigate between last 5 articles quickly $contentArray=array('content' => $content,'subject' => $artTitle); if (!isset($_SESSION['nextArticle'])){ @@ -139,12 +142,16 @@ //Add Positives to Session if (!isset($_SESSION['positive'])){ - $array=array("http://dbpedia.org/resource/".str_replace(" ","_",$subject) => "http://dbpedia.org/resource/".str_replace(" ","_",$subject)); + if (isset($triples['http://dbpedia.org/property/redirect'])){ + $array=array($triples['http://dbpedia.org/property/redirect'][0] => $triples['http://dbpedia.org/property/redirect'][0]); + } + else $array=array("http://dbpedia.org/resource/".str_replace(" ","_",$subject) => "http://dbpedia.org/resource/".str_replace(" ","_",$subject)); $_SESSION['positive']=$array; } else{ $array=$_SESSION['positive']; - $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); + if (isset($triples['http://dbpedia.org/property/redirect'])) $array[$triples['http://dbpedia.org/property/redirect'][0]] = $triples['http://dbpedia.org/property/redirect'][0]; + else $array["http://dbpedia.org/resource/".str_replace(" ","_",$subject)]="http://dbpedia.org/resource/".str_replace(" ","_",$subject); $_SESSION['positive']=$array; } @@ -254,11 +261,11 @@ //add Positives and Negatives to Interests $posInterests=""; if (isset($_SESSION['positive'])) foreach($_SESSION['positive'] as $pos){ - $posInterests=$posInterests.substr (strrchr ($pos, "/"), 1)." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"images/remove.png\" alt=\"Minus\"/></a><br/>"; + $posInterests.=urldecode(substr (strrchr ($pos, "/"), 1))." <a href=\"\" onclick=\"xajax_toNegative('".$pos."');return false;\"><img src=\"images/minus.jpg\" alt=\"Minus\"/></a> <a href=\"\" onclick=\"xajax_removePosInterest('".$pos."');return false;\"><img src=\"images/remove.png\" alt=\"Minus\"/></a><br/>"; } $negInterests=""; if (isset($_SESSION['negative'])) foreach($_SESSION['negative'] as $neg){ - $negInterests=$negInterests.substr (strrchr ($neg, "/"), 1)." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"images/remove.png\" alt=\"Minus\"/></a><br/>"; + $negInterests.=urldecode(substr (strrchr ($neg, "/"), 1))." <a href=\"\" onclick=\"xajax_toPositive('".$neg."');return false;\"><img src=\"images/plus.jpg\" alt=\"Plus\"/></a> <a href=\"\" onclick=\"xajax_removeNegInterest('".$neg."');return false;\"><img src=\"images/remove.png\" alt=\"Minus\"/></a><br/>"; } $objResponse=new xajaxResponse(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |