From: <da...@us...> - 2007-01-29 16:49:14
|
Update of /cvsroot/tikiwiki/tiki In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv6196 Modified Files: tiki-gmap_locator.php tiki-view_tracker_item.php Log Message: - add a new tracker field type : Google map locator Index: tiki-gmap_locator.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/tiki-gmap_locator.php,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tiki-gmap_locator.php 22 May 2006 17:09:07 -0000 1.2 +++ tiki-gmap_locator.php 29 Jan 2007 16:48:11 -0000 1.3 @@ -1,5 +1,6 @@ <?php include 'tiki-setup.php'; +include_once ('lib/trackers/trackerlib.php'); if ($feature_gmap != 'y') { $smarty->assign('msg', tra('This feature is disabled').": feature_gmap"); @@ -53,6 +54,40 @@ $smarty->assign('backurl','tiki-user_preferences.php'); $smarty->assign('backlink',tra('Back to preferences')); } + if ($_REQUEST['for'] == 'item') { + if (isset($_REQUEST['point']) and is_array($_REQUEST['point'])) { + echo "OK"; + if(isset($_REQUEST['itemId']) && isset($_REQUEST['fieldId'])){ + echo "OK"; + $p = $_REQUEST['point']; + if ( ($p['x'] > -90 and $p['x'] < 90) && + ($p['y'] > -90 and $p['y'] < 90) && + ($p['z'] > 0 and $p['z'] < 20) ){ + + $G_query="UPDATE `tiki_tracker_item_fields` SET `value`=? WHERE `itemId`=? AND `fieldId`=?"; + $trklib->query($G_query,array($p['x'].','.$p['y'].','.$p['z'], (int)$_REQUEST['itemId'], (int)$_REQUEST['fieldId'])); + } + } + } + $smarty->assign('input','y'); + $xyz = $trklib->get_item_value($_REQUEST['trackerId'],$_REQUEST['itemId'],$_REQUEST['fieldId']); + $first_comma=strpos($xyz,','); + $second_comma=strpos($xyz,',',$first_comma+1); + echo "$xyz $first_comma $second_comma"; + if(!$second_comma){ + $second_comma=strlen($xyz); + $xyz.=",11"; + } + $pointx = substr($xyz,0,$first_comma); + $pointy = substr($xyz,$first_comma+1,$second_comma-$first_comma-1); + $pointz = substr($xyz,$second_comma+1); + $smarty->assign('pointx',$pointx); + $smarty->assign('pointy',$pointy); + $smarty->assign('pointz',$pointz); + $smarty->assign('extraquery','?for=item&itemId='.$_REQUEST['itemId'].'&trackerId='.$_REQUEST['trackerId'].'&fieldId='.$_REQUEST['fieldId']); + $smarty->assign('backurl','tiki-view_tracker_item.php?itemId='.$_REQUEST['itemId'].'&trackerId='.$_REQUEST['trackerId']); + $smarty->assign('backlink',tra('Back to item')); + } } if (isset($_REQUEST['recenter']) and $pointx and $pointy) { $smarty->assign('gmap_defaultx',$pointx); Index: tiki-view_tracker_item.php =================================================================== RCS file: /cvsroot/tikiwiki/tiki/tiki-view_tracker_item.php,v retrieving revision 1.108 retrieving revision 1.109 diff -u -d -r1.108 -r1.109 --- tiki-view_tracker_item.php 23 Jan 2007 16:53:09 -0000 1.108 +++ tiki-view_tracker_item.php 29 Jan 2007 16:48:11 -0000 1.109 @@ -722,6 +722,17 @@ $ins_fields["data"][$i]["defvalue"] = $user; } $ins_fields["data"][$i]["value"] = $info["$fid"]; + } elseif ($fields["data"][$i]["type"] == 'G') { + $ins_fields["data"][$i]["value"] = $info["$fid"]; + $first_comma=strpos($info["$fid"],','); + $second_comma=strpos($info["$fid"],',',$first_comma+1); + if(!$second_comma){ + $second_comma=strlen($info["$fid"]); + $ins_fields["data"][$i]["value"].=",11"; + } + $ins_fields["data"][$i]["x"] = substr($ins_fields["data"][$i]["value"],0,$first_comma); + $ins_fields["data"][$i]["y"] = substr($ins_fields["data"][$i]["value"],$first_comma+1,$second_comma-$first_comma-1); + $ins_fields["data"][$i]["z"] = substr($ins_fields["data"][$i]["value"],$second_comma+1); } elseif ($fields["data"][$i]["type"] == 'U') { $ins_fields["data"][$i]["value"]=$info["$fid"]; $temp=$userlib->get_user_info($user); |