Enhancement in gmaps module

This commit is contained in:
Laurent Destailleur 2011-05-16 13:59:46 +00:00
parent 5f06e2dc16
commit 2e51ab945f

View File

@ -1141,7 +1141,7 @@ function dol_print_address($address,$htmlid='gmap',$mode,$id)
}); });
</script> </script>
'; */ '; */
print ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>'; print ' <a href="'.$url.'" target="_gmaps"><img id="'.$htmlid.'" border="0" src="'.DOL_URL_ROOT.'/theme/common/gmap.png"></a>';
} }
} }
} }
@ -1241,8 +1241,9 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie')
global $conf,$langs; global $conf,$langs;
if (empty($conf->use_javascript_ajax)) return; if (empty($conf->use_javascript_ajax)) return;
$jsgraphlib='flot'; $jsgraphlib='flot';
$datacolor=array("#d18b2c", "#dba255", "#919733"); $datacolor=array();
// Load colors of theme into $datacolor array
$color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php"; $color_file = DOL_DOCUMENT_ROOT."/theme/".$conf->theme."/graph-color.php";
if (is_readable($color_file)) if (is_readable($color_file))
{ {
@ -1261,23 +1262,11 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie')
// We use Flot js lib // We use Flot js lib
if ($jsgraphlib == 'flot') if ($jsgraphlib == 'flot')
{ {
print '<script type="text/javascript">
jQuery(function () {
// data
/*var data = [
{ label: "Series1<br>aa", data: 10},
{ label: "Series2", data: 30},
{ label: "Series3", data: 90}
];
var data = [
{ label: "Series1", data: [[1,10]]},
{ label: "Series2", data: [[1,30]]},
{ label: "Series3", data: [[1,90]]}
];*/
';
if ($type == 'pie') if ($type == 'pie')
{ {
print 'var data = ['."\n"; print '<script type="text/javascript">
jQuery(function () {
var data = ['."\n";
$i=0; $i=0;
foreach($data as $serie) foreach($data as $serie)
{ {
@ -1308,7 +1297,10 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie')
} }
} }
} }, } },
colors: ['; ';
if (sizeof($datacolor))
{
print 'colors: [';
$j=0; $j=0;
foreach($datacolor as $val) foreach($datacolor as $val)
{ {
@ -1316,8 +1308,9 @@ function dol_print_graph($htmlid,$width,$height,$data,$showlegend=0,$type='pie')
if ($j < sizeof($datacolor)) print ','; if ($j < sizeof($datacolor)) print ',';
$j++; $j++;
} }
print '], print '], ';
legend: {show: '.($showlegend?'true':'false').'} }
print 'legend: {show: '.($showlegend?'true':'false').'}
}); });
}); });
</script>'; </script>';