138 lines
No EOL
5.6 KiB
PHP
138 lines
No EOL
5.6 KiB
PHP
<?php
|
|
/**
|
|
* This file is part of XNova:Legacies
|
|
*
|
|
* @license http://www.gnu.org/licenses/gpl-3.0.txt
|
|
* @see http://www.xnova-ng.org/
|
|
*
|
|
* Copyright (c) 2009-Present, XNova Support Team <http://www.xnova-ng.org>
|
|
* All rights reserved.
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* --> NOTICE <--
|
|
* This file is part of the core development branch, changing its contents will
|
|
* make you unable to use the automatic updates manager. Please refer to the
|
|
* documentation for further information about customizing XNova.
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* @deprecated
|
|
* @param unknown_type $CurrentPlanet
|
|
*/
|
|
function InsertGalaxyScripts ( $CurrentPlanet ) {
|
|
global $lang;
|
|
trigger_error(sprintf('%s is deprecated', __FUNCTION__), E_USER_DEPRECATED);
|
|
$Script = "<div style=\"top: 10px;\" id=\"content\">";
|
|
$Script .= "<script language=\"JavaScript\">\n";
|
|
$Script .= "function galaxy_submit(value) {\n";
|
|
$Script .= " document.getElementById('auto').name = value;\n";
|
|
$Script .= " document.getElementById('galaxy_form').submit();\n";
|
|
$Script .= "}\n\n";
|
|
|
|
$Script .= "function fenster(target_url,win_name) {\n";
|
|
$Script .= " var new_win = window.open(target_url,win_name,'resizable=yes,scrollbars=yes,menubar=no,toolbar=no,width=640,height=480,top=0,left=0');\n";
|
|
$Script .= " new_win.focus();\n";
|
|
$Script .= "}\n";
|
|
$Script .= "</script>\n";
|
|
|
|
$Script .= "<script language=\"JavaScript\" src=\"scripts/tw-sack.js\"></script>\n";
|
|
|
|
$Script .= "<script type=\"text/javascript\">\n\n";
|
|
$Script .= "var ajax = new sack();\n";
|
|
$Script .= "var strInfo = \"\";\n";
|
|
|
|
$Script .= "function whenResponse () {\n";
|
|
$Script .= " retVals = this.response.split(\"|\");\n";
|
|
$Script .= " Message = retVals[0];\n";
|
|
$Script .= " Infos = retVals[1];\n";
|
|
$Script .= " retVals = Infos.split(\" \");\n";
|
|
$Script .= " UsedSlots = retVals[0];\n";
|
|
$Script .= " SpyProbes = retVals[1];\n";
|
|
$Script .= " Recyclers = retVals[2];\n";
|
|
$Script .= " Missiles = retVals[3];\n";
|
|
$Script .= " retVals = Message.split(\";\");\n";
|
|
$Script .= " CmdCode = retVals[0];\n";
|
|
$Script .= " strInfo = retVals[1];\n";
|
|
$Script .= " addToTable(\"done\", \"success\");\n";
|
|
$Script .= " changeSlots( UsedSlots );\n";
|
|
$Script .= " setShips(\"probes\", SpyProbes );\n";
|
|
$Script .= " setShips(\"recyclers\", Recyclers );\n";
|
|
$Script .= " setShips(\"missiles\", Missiles );\n";
|
|
$Script .= "}\n\n";
|
|
|
|
$Script .= "function doit (order, galaxy, system, planet, planettype, shipcount) {\n";
|
|
$Script .= " ajax.requestFile = \"flotenajax.php?action=send\";\n";
|
|
$Script .= " ajax.runResponse = whenResponse;\n";
|
|
$Script .= " ajax.execute = true;\n\n";
|
|
$Script .= " ajax.setVar(\"thisgalaxy\", ". $CurrentPlanet["galaxy"] .");\n";
|
|
$Script .= " ajax.setVar(\"thissystem\", ". $CurrentPlanet["system"] .");\n";
|
|
$Script .= " ajax.setVar(\"thisplanet\", ". $CurrentPlanet["planet"] .");\n";
|
|
$Script .= " ajax.setVar(\"thisplanettype\", ". $CurrentPlanet["planet_type"] .");\n";
|
|
$Script .= " ajax.setVar(\"mission\", order);\n";
|
|
$Script .= " ajax.setVar(\"galaxy\", galaxy);\n";
|
|
$Script .= " ajax.setVar(\"system\", system);\n";
|
|
$Script .= " ajax.setVar(\"planet\", planet);\n";
|
|
$Script .= " ajax.setVar(\"planettype\", planettype);\n";
|
|
$Script .= " if (order == 6)\n";
|
|
$Script .= " ajax.setVar(\"ship210\", shipcount);\n";
|
|
$Script .= " if (order == 7) {\n";
|
|
$Script .= " ajax.setVar(\"ship208\", 1);\n\n";
|
|
$Script .= " ajax.setVar(\"ship203\", 2);\n\n";
|
|
$Script .= " }\n";
|
|
$Script .= " if (order == 8)\n";
|
|
$Script .= " ajax.setVar(\"ship209\", shipcount);\n\n";
|
|
$Script .= " ajax.runAJAX();\n";
|
|
$Script .= "}\n\n";
|
|
|
|
$Script .= "function addToTable(strDataResult, strClass) {\n";
|
|
$Script .= " var e = document.getElementById('fleetstatusrow');\n";
|
|
$Script .= " var e2 = document.getElementById('fleetstatustable');\n";
|
|
$Script .= " e.style.display = '';\n";
|
|
$Script .= " if(e2.rows.length > 2) {\n";
|
|
$Script .= " e2.deleteRow(2);\n";
|
|
$Script .= " }\n";
|
|
$Script .= " var row = e2.insertRow(0);\n";
|
|
$Script .= " var td1 = document.createElement(\"td\");\n";
|
|
$Script .= " var td1text = document.createTextNode(strInfo);\n";
|
|
$Script .= " td1.appendChild(td1text);\n";
|
|
$Script .= " var td2 = document.createElement(\"td\");\n";
|
|
$Script .= " var span = document.createElement(\"span\");\n";
|
|
$Script .= " var spantext = document.createTextNode(strDataResult);\n";
|
|
$Script .= " var spanclass = document.createAttribute(\"class\");\n";
|
|
$Script .= " spanclass.nodeValue = strClass;\n";
|
|
$Script .= " span.setAttributeNode(spanclass);\n";
|
|
$Script .= " span.appendChild(spantext);\n";
|
|
$Script .= " td2.appendChild(span);\n";
|
|
$Script .= " row.appendChild(td1);\n";
|
|
$Script .= " row.appendChild(td2);\n";
|
|
$Script .= "}\n\n";
|
|
|
|
$Script .= "function changeSlots(slotsInUse) {\n";
|
|
$Script .= " var e = document.getElementById('slots');\n";
|
|
$Script .= " e.innerHTML = slotsInUse;\n";
|
|
$Script .= "}\n\n";
|
|
|
|
$Script .= "function setShips(ship, count) {\n";
|
|
$Script .= " var e = document.getElementById(ship);\n";
|
|
$Script .= " e.innerHTML = count;\n";
|
|
$Script .= "}\n";
|
|
|
|
$Script .= "</script>\n";
|
|
|
|
return $Script;
|
|
}
|
|
|
|
?>
|