mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Pretty Server Version Choice
This commit is contained in:
parent
6a29f1063b
commit
261c8665c8
@ -62,6 +62,7 @@ class ServerHandler(BaseHandler):
|
|||||||
if page == "step1":
|
if page == "step1":
|
||||||
|
|
||||||
page_data['server_types'] = server_jar_obj.get_serverjar_data_sorted()
|
page_data['server_types'] = server_jar_obj.get_serverjar_data_sorted()
|
||||||
|
page_data['js_server_types'] = json.dumps(server_jar_obj.get_serverjar_data_sorted())
|
||||||
template = "server/wizard.html"
|
template = "server/wizard.html"
|
||||||
|
|
||||||
self.render(
|
self.render(
|
||||||
|
@ -19,16 +19,21 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-12">
|
<div class="col-sm-12">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<h4 class="card-title" style="margin-bottom:20px;">{{ translate('serverWizard', 'serverType') }}</h4>
|
<label for="server_type">{{ translate('serverWizard', 'serverType') }}</label>
|
||||||
|
<select class="form-control form-control-lg select-css" id="server_type" name="server_type" onchange="serverTypeChange(this)">
|
||||||
<select class="form-control form-control-lg select-css" id="server" name="server">
|
|
||||||
{% for s in data['server_types'] %}
|
{% for s in data['server_types'] %}
|
||||||
{% for v in data['server_types'][s] %}
|
<option value="{{ s }}">{{ s.capitalize() }}</option>
|
||||||
<option value="{{ s }}|{{ v }}">{{ s.capitalize() }} - {{ v }}</option>
|
|
||||||
{% end %}
|
|
||||||
{% end %}
|
{% end %}
|
||||||
</select>
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-12">
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="server_version">{{ translate('serverWizard', 'serverVersion') }}</label>
|
||||||
|
<select class="form-control form-control-lg select-css" id="server" name="server">
|
||||||
|
<option value="0">Select a Version</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -266,4 +271,57 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
//<![CDATA[
|
||||||
|
// array of possible countries in the same order as they appear in the country selection list
|
||||||
|
|
||||||
|
function decodeHtmlCharCodes(str) {
|
||||||
|
return str.replace(""", "\"");
|
||||||
|
}
|
||||||
|
|
||||||
|
function convertHtmlJsonToJavacriptArray(str) {
|
||||||
|
var result = []
|
||||||
|
str = decodeHtmlCharCodes(str)
|
||||||
|
for(var i in str)
|
||||||
|
result.push([i, str [i]]);
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
var text = '{% raw data["js_server_types"] %}';
|
||||||
|
var serverTypesLists = JSON.parse(text);
|
||||||
|
//convertHtmlJsonToJavacriptArray('{{ data["js_server_types"] }}')
|
||||||
|
/* CountryChange() is called from the onchange event of a select element.
|
||||||
|
* param selectObj - the select object which fired the on change event.
|
||||||
|
*/
|
||||||
|
function serverTypeChange(selectObj) {
|
||||||
|
// get the index of the selected option
|
||||||
|
var idx = selectObj.selectedIndex;
|
||||||
|
// get the value of the selected option
|
||||||
|
var which = selectObj.options[idx].value;
|
||||||
|
// use the selected option value to retrieve the list of items from the serverTypesLists array
|
||||||
|
cList = serverTypesLists[which];
|
||||||
|
// get the country select element via its known id
|
||||||
|
var cSelect = document.getElementById("server");
|
||||||
|
// remove the current options from the country select
|
||||||
|
var len=cSelect.options.length;
|
||||||
|
while (cSelect.options.length > 0) {
|
||||||
|
cSelect.remove(0);
|
||||||
|
}
|
||||||
|
var newOption;
|
||||||
|
// create new options
|
||||||
|
for (var i=0; i<cList.length; i++) {
|
||||||
|
newOption = document.createElement("option");
|
||||||
|
newOption.value = which+"|"+cList[i]; // assumes option string and value are the same
|
||||||
|
newOption.text=cList[i];
|
||||||
|
// add the new option
|
||||||
|
try {
|
||||||
|
cSelect.add(newOption); // this will fail in DOM browsers but is needed for IE
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
cSelect.appendChild(newOption);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
{% end %}
|
{% end %}
|
@ -38,6 +38,7 @@
|
|||||||
"serverName": "Server Name",
|
"serverName": "Server Name",
|
||||||
"serverPath": "Server Path",
|
"serverPath": "Server Path",
|
||||||
"serverType": "Server Type",
|
"serverType": "Server Type",
|
||||||
|
"serverVersion": "Server Version",
|
||||||
"absoluteServerPath": "Absolute path to your server",
|
"absoluteServerPath": "Absolute path to your server",
|
||||||
"serverJar": "Server Jarfile",
|
"serverJar": "Server Jarfile",
|
||||||
"minMem": "Minimum Memory",
|
"minMem": "Minimum Memory",
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
"serverName": "Palvelimen nimi",
|
"serverName": "Palvelimen nimi",
|
||||||
"serverPath": "Palvelimen polku",
|
"serverPath": "Palvelimen polku",
|
||||||
"serverType": "Palvelimen tyypi",
|
"serverType": "Palvelimen tyypi",
|
||||||
|
"serverVersion": "Palvelimen versio",
|
||||||
"absoluteServerPath": "Absoluuttinen polku palvelimeesi",
|
"absoluteServerPath": "Absoluuttinen polku palvelimeesi",
|
||||||
"serverJar": "Palvelimen Jar -tiedosto",
|
"serverJar": "Palvelimen Jar -tiedosto",
|
||||||
"minMem": "Minimi Muisti",
|
"minMem": "Minimi Muisti",
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
"serverName": "Non du Serveur",
|
"serverName": "Non du Serveur",
|
||||||
"serverPath": "Chemin du Serveur",
|
"serverPath": "Chemin du Serveur",
|
||||||
"serverType": "Type du Serveur",
|
"serverType": "Type du Serveur",
|
||||||
|
"serverVersion": "Version du Serveur",
|
||||||
"absoluteServerPath": "Chemin absolu de Votre Serveur",
|
"absoluteServerPath": "Chemin absolu de Votre Serveur",
|
||||||
"serverJar": "Fichier Jar du Serveur",
|
"serverJar": "Fichier Jar du Serveur",
|
||||||
"minMem": "Mémoire Minimum",
|
"minMem": "Mémoire Minimum",
|
||||||
|
Loading…
Reference in New Issue
Block a user