zhxcookie Report post Posted April 18, 2008 (edited) Hi, I am using the Gantt.swf in FusionWidget V3 Eva version, and I am creating a Gantt chart with 8 tasks. I need to add the link against the task, which means, when you click the task, it should run a javascript which needs to pass three php variables. Before I put the link on, the chart works fine. But, when I put the link, I got the error. when I put this in code: link='javascript:launchdailyreport('report.php','".$daily_report[$i]["date"]."','".$daily_report[$i]["code"]."','".$daily_report[$i]["en"]."')' I can see the xml in the page source when I render the page in IE <task label='Start:22:00 Finish:06:16 Duration:8 hours 16 minutes' start='07/01/2008 22:00:00' end='07/02/2008 06:16:00' processId='13-Apr-2008' link='javascript:launchreport('report.php','13-Apr-2008','XXX','YYY')' /> and on the page, it shows "Invalid XML data" and when I change all the single quote (') to %26apos; it is like link='javascript:launchdailyreport(%26apos; report.php %26apos; , %26apos; ".$daily_report[$i]["date"]." %26apos; , %26apos; ".$daily_report[$i]["code"]."%26apos; , %26apos; ".$daily_report[$i]["en"]." %26apos; )' I can see the the xml in the page source when I render the page in IE <task label='Start:22:00 Finish:06:16 Duration:8 hours 16minutes' start='07/01/2008 22:00:00' end='07/02/2008 06:16:00' processId='13-Apr-2008' link='javascript:launchreport('' /> and of course it is "Invalid XML data" error. I dont know how to fix it. Hope you could understand my situation. Thanks in advance. Edited April 18, 2008 by Guest Share this post Link to post Share on other sites
FusionCharts Support Report post Posted April 19, 2008 Hi, Could you please send us the php code (or the code block) where you are generating this link? It seems that somewhere the XML is getting broken. Share this post Link to post Share on other sites
zhxcookie Report post Posted April 20, 2008 I am using the FusionCharts_Gen.php which is in the free version FusionChartsFreeCodePHPClassIncludes to generate the xml, I modified a bit to fit the version 3, like change the swf file name without "FCF_", changed the to , and changed the "name" to "label". In order to get the %26apos; I changed the Parameter Delimiter to be ";;" instead of the default ";". but seems it cannot work with the %26apos; Thanks Share this post Link to post Share on other sites
FusionCharts Support Report post Posted April 21, 2008 Hi, Could you please try seeting some other delimeter? like "$$" etc. and try again. Could you please send us the code that you are witing using PHP Class to generate this XML? Share this post Link to post Share on other sites
zhxcookie Report post Posted April 21, 2008 Thanks for the reply, I tried the different Parameter Delimiter, and get this result: <task label='Start:22:00 Finish:06:30' start='07/01/2008 22:00:00' end='07/02/2008 06:30:00' processId='07-Apr-2008' link='javascript:launchdailyreport('report.php','07-Apr-2008',' XXX','YYY')' /> here are the code for adding task for Gantt Chart # Setting Tasks Parameter into TaskParam variables function setGanttTasksParams($strParam){ $listArray=explode($this->del,$strParam); # Fetching all value and converting into xml attribute foreach ($listArray as $valueArray) { $paramValue=explode("=",$valueArray); if($this->validateParam($paramValue)==true){ $this->GT_Tasks_Param .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; } } } # Function addGanttTasks adding Tasks function addGanttTask($label="",$catParam=""){ $strCatXML=""; $strParam=""; # cheking catParam not blank if($catParam!=""){ $listArray=explode($this->del,$catParam); foreach ($listArray as $valueArray) { $paramValue=explode("=",$valueArray); if($this->validateParam($paramValue)==true){ # creating parameter set if(trim(strtolower($paramValue[0]))=="link"){ $strParam .= $paramValue[0] . "='" . urldecode($paramValue[1]) . "' "; }else{ $strParam .= $paramValue[0] . "='" . $this->encodeSpecialChars($paramValue[1]) . "' "; } } } } # adding label and parameter set to category $strCatXML ="<task label='" . $label . "' " . $strParam . " />"; # storing into GT_Tasks array $this->GT_Tasks[$this->GT_Tasks_Counter]=$strCatXML; # Increase Counter $this->GT_Tasks_Counter++; } and the code to get the task xml # Function getProcessesXML for getting Processes part XML function getTasksXML(){ $partXML=""; # adding processes parameter $partXML="<tasks " . $this->GT_Tasks_Param . " >"; foreach($this->GT_Tasks as $part_type => $part_name){ if($part_name!=""){ # adding elements $partXML .= $part_name; } } # Closing <tasks> $partXML .="</tasks>"; return $partXML; } Thanks. Share this post Link to post Share on other sites
FusionCharts Support Report post Posted April 23, 2008 hi, I suppose you must be using addGanttTask($label="",$catParam="") function and in the param you are passing the link. e.g. FC->setParamDelimiter(":"); FC->setParamFC->addGanttTask("abc","link=jsfnName(%26apos;a1%26apos;,%26apos;a2%26apos;)"); Could you please try once : FC->setParamFC->addGanttTask("abc","link=jsfnName('a1','a2')"); (since addGanttTask() itself encodes the & to %26) Share this post Link to post Share on other sites
zhxcookie Report post Posted April 23, 2008 Thanks for your reply, but it still does not work. link='javascript:launchdailyreport('report.php','07-Apr-2008','XXX','YYY' );' Share this post Link to post Share on other sites
zhxcookie Report post Posted April 24, 2008 (edited) Hi, thanks for the reply, I did a very simple thing and it is working now. You are right, it transfers %26apos; to ', so I manually update the ' back to %26apos before it render the chart and it is working. Maybe this sound stupid :crying: But anyway, thanks for your help Edited April 24, 2008 by Guest Share this post Link to post Share on other sites