Skip to content

Commit

Permalink
*** empty log message ***
Browse files Browse the repository at this point in the history
  • Loading branch information
manolis committed Nov 12, 2007
1 parent 022eeb9 commit 8460e41
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 24 deletions.
19 changes: 13 additions & 6 deletions FN_waypoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function getCountriesList($year=0,$month=0,$clubID=0,$pilotID=0) {
return array($countriesCodes,$countriesNames,$countriesFlightsNum);
}

function getWaypoints($tm=0,$onlyTakeoffs=0) {
function getWaypoints($tm=0,$onlyTakeoffs=0,$utf=0) {
global $db,$waypointsTable;
set_time_limit(200);
if ($onlyTakeoffs)
Expand All @@ -157,15 +157,22 @@ function getWaypoints($tm=0,$onlyTakeoffs=0) {

$waypoints=array();
$i=0;
// while ($row = $db->sql_fetchrow($res)) {
//$rows=$db->sql_fetchrowset($res);
// while ($row = $db->sql_fetchrow($res)) {
// $rows=$db->sql_fetchrowset($res);

while ($row = mysql_fetch_assoc($res)) {
//foreach($rows as $row) {
//foreach($rows as $row) {
$waypoints[$i]=new gpsPoint();
$waypoints[$i]->waypointID=$row["ID"];
$waypoints[$i]->name=urlencode($row["name"]);
$waypoints[$i]->intName=$row["intName"];

if ($utf ) {
$waypoints[$i]->name=urlencode(mb_convert_encoding($row["name"] ,'iso-8859-7', "UTF-8"));
$waypoints[$i]->intName=urlencode(mb_convert_encoding($row["intName"] ,'iso-8859-1', "UTF-8"));

} else {
$waypoints[$i]->name=urlencode($row["name"]);
$waypoints[$i]->intName=urlencode($row["intName"]);
}
$waypoints[$i]->lat=$row["lat"];
$waypoints[$i]->lon=$row["lon"];
$waypoints[$i]->type=$row["type"];
Expand Down
21 changes: 19 additions & 2 deletions GUI_EXT_server_action.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,21 @@

// set to 1 for debug
if ($DBGlvl) $server->DEBUG=1;
?><head>

<style type="text/css">
body { background-color: #EDF3F1;}

body , p, table, td {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-style: normal;
text-align:justify;
margin:0;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>
<?

if ($action==1) { // server info
list($server_version,$server_releaseDate, $server_opMode,
Expand All @@ -46,9 +60,12 @@
} else if ($action==2) {
$takeoffsList=$server->getTakeoffs(0); // takeoffs from time 0
echo "<HR>Takeoff list<hr>";
//print_r($takeoffsList);
foreach($takeoffsList as $takeoff){
$takeoff=(object) $takeoff;
echo "#".urldecode($takeoff->intName)."<BR>";
echo "#".urldecode($takeoff->intName).
"#".urldecode($takeoff->name).
"#<BR>";
}

} else if ($action==3) { //flights
Expand All @@ -66,7 +83,7 @@
echo $server->url_op;
echo "<BR>$action<br>";

list($nearestWaypoint,$minTakeoffDistance)=$server->findTakeoff(40,22);
list($nearestWaypoint,$minTakeoffDistance)=$server->findTakeoff(49.4619,-8.67848);
echo "wpt: ".$nearestWaypoint->intName. "~ $minTakeoffDistance<BR>";
}

Expand Down
90 changes: 78 additions & 12 deletions GUI_servers_manage.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,44 @@
<script language="javascript">
function serverAction(id,action,DBGlvl) {
//document.getElementById('takeoffBoxTitle').innerHTML = "Register Takeoff";
document.getElementById('addTakeoffFrame').src='<?=$moduleRelPath?>/GUI_EXT_server_action.php?id='+id+'&action='+action+'&DBGlvl='+DBGlvl;
// document.getElementById('addTakeoffFrame').src='<?=$moduleRelPath?>/GUI_EXT_server_action.php?id='+id+'&action='+action+'&DBGlvl='+DBGlvl;

document.getElementById('display_in_'+id).src='<?=$moduleRelPath?>/GUI_EXT_server_action.php?id='+id+'&action='+action+'&DBGlvl='+DBGlvl;
//MWJ_changeSize('addTakeoffFrame',410,320);
//MWJ_changeSize( 'takeoffAddID', 410,350 );
// toggleVisible('takeoffAddID','takeoffAddPos',14,0,410,320);
MWJ_changeDisplay("display_"+id,"block");

}

function collapseAll() {
for(i=0;i <100 ; i++) {
MWJ_changeDisplay("action_"+i,"none");
}
}

function expandAll() {
for(i=0;i < 100 ; i++) {
MWJ_changeDisplay("action_"+i,"block");
}
}
</script>
<style type="text/css">

.actionsTable {
display:none;
border:1px solid #cccccc;
padding:2px;
background-color:#EEEAD2;
}

.actionsTable ul {
margin-left:10px;
padding:5px;
}

</style>
<? if (0) { ?>
<div id="takeoffAddID" class="dropBox takeoffOptionsDropDown" style="visibility:block;">
<table width="100%" >
<tr><td class="infoBoxHeader" >
Expand All @@ -37,12 +68,12 @@ function serverAction(id,action,DBGlvl) {
<div id='addTakeoffDiv'>
<iframe id="addTakeoffFrame" width="100%" height="250" frameborder=0 style='border-width:0px'></iframe></div>
</div>

<? } ?>

<?
$legend="Manage external Servers";
echo "<div class='tableTitle'>
<div class='titleDiv'>$legend</div>
<div class='titleDiv'>$legend <a href='javascript:collapseAll()'>Collapse All</a> <a href='javascript:expandAll()'>Expand All</a> </div>
</div>" ;

$i=0;
Expand All @@ -62,16 +93,51 @@ function serverAction(id,action,DBGlvl) {

$url="<a href='http://".$server->url."' target='_blank'>".substr($server->url_base,0,50)."</a>";

echo "<TR><td><a href='javascript:serverAction(".$server->ID.",1,$DBGlvl);'>Info</a> ::
<b><a href='javascript:serverAction(".$server->ID.",5,$DBGlvl);'>Sync (pull data)</a></b> ::
<a href='javascript:serverAction(".$server->ID.",2,$DBGlvl);'>Takeoffs</a>
:: <a href='javascript:serverAction(".$server->ID.",3,$DBGlvl);'>Flights</a> :: <a href='javascript:serverAction(".$server->ID.",4,$DBGlvl);'>Update OP files</a>
:: <a href='javascript:serverAction(".$server->ID.",99,$DBGlvl);'>Test</a></td>".
"<td>".$server->ID."</td><td>".$url."</td><td>".$server->leonardo_version."</td><td>".
$server->is_active."</td><td>".$wpt."</td><td>".$server->isLeo."</td><td>".$type."</td><td></td></tr>";
// echo "<td >";
// echo "";
// echo "</td></tr>";

$id=$server->ID;
echo "<TR><td class='$actionRow' width='90' valign=top>
<div align='left' ><a href='javascript:toggleVisibility(\"action_$id\")'>Actions <img src='$moduleRelPath/img/icon_arrow_down.gif' border=0></a></div>
</td>".
"<td valign=top>".$server->ID."</td>
<td valign=top>".$url."</td>
<td valign=top>".$server->leonardo_version."</td>
<td valign=top> ".$server->is_active."</td>
<td valign=top>".$wpt."</td>
<td valign=top>".$server->isLeo."</td>
<td valign=top>".$type."</td>
<td valign=top></td>
</tr>";

echo "<TR height=0><td colspan='9' height=0>
<div class='actionsTable' id='action_$id' width=100%>
<table width=100%>
<tr>
<td><a href='javascript:serverAction(".$server->ID.",1,$DBGlvl);'>Info</a></td>
<td><b><a href='javascript:serverAction(".$server->ID.",5,$DBGlvl);'>Sync (pull data)</a></b></td>
<td><a href='javascript:serverAction(".$server->ID.",2,$DBGlvl);'>Takeoffs</a></td>
<td><a href='javascript:serverAction(".$server->ID.",3,$DBGlvl);'>Flights</a></td>
<td><a href='javascript:serverAction(".$server->ID.",4,$DBGlvl);'>Update OP files</a></td>
<td><a href='javascript:serverAction(".$server->ID.",99,$DBGlvl);'>Test</a>
<td><a href='javascript:toggleVisibility(\"display_$id\")'>Results On/Off</a></td>
</tr>
<TR >
<td colspan='7' bgcolor='#ffffff' >
<div style='display:none' id='display_$id' bgcolor='#ff0000'>
<iframe id='display_in_$id' width='100%' height='250' frameborder=0 style='border-width:0px'></iframe>
</div>
</td>
</tr>
</table>
</div>
</td></tr>";


// var $url_op;
$i++;
// var $url_op;
$i++;
}
echo "</table>";

Expand Down
3 changes: 2 additions & 1 deletion OP_takeoff.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ function takeoffs_getTakeoffs($arg) {

if ( ! securityCheck($sitePass) ) return new IXR_Error(4000, 'Access Denied');

$waypoints=getWaypoints($tm,$onlyTakeoffs);
$waypoints=getWaypoints($tm,$onlyTakeoffs,0);
return array(count($waypoints),$waypoints);
// return array(1,array($waypoints[0]));
}


Expand Down
16 changes: 13 additions & 3 deletions lib/xml_rpc/IXR_Library.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ function parse() {
if (trim($this->message) == '') {
return false;
}

// $this->message = mb_convert_encoding($this->message ,'iso-8859-7', "UTF-8");


$this->_parser = xml_parser_create();
// Set XML parser to take the case of tags in to account
xml_parser_set_option($this->_parser, XML_OPTION_CASE_FOLDING, false);
Expand All @@ -150,9 +154,11 @@ function parse() {
xml_set_element_handler($this->_parser, 'tag_open', 'tag_close');
xml_set_character_data_handler($this->_parser, 'cdata');
if (!xml_parse($this->_parser, $this->message)) {
/* die(sprintf('XML error: %s at line %d',
if (1) {
die(sprintf('XML error: %s at line %d',
xml_error_string(xml_get_error_code($this->_parser)),
xml_get_current_line_number($this->_parser))); */
xml_get_current_line_number($this->_parser)));
}
return false;
}
xml_parser_free($this->_parser);
Expand Down Expand Up @@ -328,6 +334,7 @@ function serve($data = false) {
EOD;
// Send it
// $xml = mb_convert_encoding($xml ,'iso-8859-7', "UTF-8");
$this->output($xml);
}
function call($methodname, $args) {
Expand Down Expand Up @@ -368,7 +375,7 @@ function error($error, $message = false) {
$this->output($error->getXml());
}
function output($xml) {
$xml = '<?xml version="1.0"?>'."\n".$xml;
$xml = '<?xml version="1.0" encoding="utf-8"?>'."\n".$xml;
$length = strlen($xml);
header('Connection: close');
header('Content-Length: '.$length);
Expand Down Expand Up @@ -542,6 +549,9 @@ function query() {
if ($this->debug) {
echo '<pre>'.htmlspecialchars($contents)."\n</pre>\n\n";
}

// $contents = mb_convert_encoding($contents ,'iso-8859-7', "UTF-8");

// Now parse what we've got back
$this->message = new IXR_Message($contents);
if (!$this->message->parse()) {
Expand Down

0 comments on commit 8460e41

Please sign in to comment.