Add new Server functionality, some cleanups, spelling & desing

This commit is contained in:
Ulf Gebhardt 2015-09-16 02:09:14 +02:00
parent e3d168e7b8
commit 5a394c0588
11 changed files with 48 additions and 13 deletions

View File

@ -1,2 +1,8 @@
<?php
class api_mojotrollz extends \SYSTEM\API\api_system {}
class api_mojotrollz extends \SYSTEM\API\api_system {
public static function call_mojo_action_newserver($address){
return \SQL\MOJOTROLLZ_SERVER_INSERT::QI(array($address,$address)) ?
\SYSTEM\LOG\JsonResult::ok() :
\SYSTEM\LOG\JsonResult::fail();
}
}

View File

@ -1,2 +1,3 @@
<?php
SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
SYSTEM\autoload::registerFolder(dirname(__FILE__),'');
SYSTEM\autoload::registerFolder(dirname(__FILE__).'/qq','SQL');

View File

@ -0,0 +1,8 @@
<?php
namespace SQL;
class MOJOTROLLZ_SERVER_INSERT extends \SYSTEM\DB\QP {
public static function get_class(){return \get_class();}
public static function mysql(){return
'INSERT INTO mojotrollz_server (`name`,`url`) VALUES(?,?);';
}
}

View File

@ -10,4 +10,19 @@ function init_start(){
$(this).removeClass('active');});
$(this).parent().addClass('active');
});
$("#newserver_form input").not("[type=submit]").jqBootstrapValidation({
preventSubmit: true,
submitError: function($form, event, errors) {},
submitSuccess: function($form, event){
$.getJSON('./api.php?call=mojo&action=newserver&address='+encodeURIComponent($('#input_server_address').val()), function (data) {
if(data.status){
$('.help-block').html("Registered new Server successfully. Wait for its approval!");
} else {
$('.help-block').html("An Error occurred. Could not register new Server.");
}
});
event.preventDefault();
}
});
}

View File

@ -13,7 +13,7 @@
<div style="padding-top:20px; padding-left: 75px; font-size: 16px;">
<img style="float:right; margin-right:20px;" data-pyroimage="true" src="./api.php?call=files&cat=content&id=wow_normal.png" alt="Windows" height="48" width="48">
<div><a href="${magnet_clssic}">WoW 1.12.1</a></div>
<div style="font-size: 10px;">Open this file with <a href="http://www.qbittorrent.org/download.php" target="blank">qBittorrent</a></div>
<div style="font-size: 10px;">Download this file with <a href="http://www.qbittorrent.org/download.php" target="blank">qBittorrent</a></div>
</div>
</a>
</div>
@ -22,7 +22,7 @@
<div style="padding-top:20px; padding-left: 75px; font-size: 16px;">
<img style="float:right; margin-right:20px;" data-pyroimage="true" src="./api.php?call=files&cat=content&id=wow_bc_normal.png" alt="Windows" height="48" width="48">
<div><a href="${magnet_bc}">WoW 2.4.3</a></div>
<div style="font-size: 10px;">Open this file with <a href="http://www.qbittorrent.org/download.php" target="blank">qBittorrent</a></div>
<div style="font-size: 10px;">Download this file with <a href="http://www.qbittorrent.org/download.php" target="blank">qBittorrent</a></div>
</div>
</a>
</div>
@ -31,7 +31,7 @@
<div style="padding-top:20px; padding-left: 75px; font-size: 16px;">
<img style="float:right; margin-right:20px;" data-pyroimage="true" src="./api.php?call=files&cat=content&id=wow_wotlk_normal.png" alt="Windows" height="48" width="48">
<div><a href="${magnet_wotlk}">WoW 3.3.5a</a></div>
<div style="font-size: 10px;">Open this file with <a href="http://www.qbittorrent.org/download.php" target="blank">qBittorrent</a></div>
<div style="font-size: 10px;">Download this file with <a href="http://www.qbittorrent.org/download.php" target="blank">qBittorrent</a></div>
</div>
</a>
</div>

View File

@ -8,9 +8,9 @@
</div>
<div class="col-md-4">
<a href="#!login">LOGIN</a><br><br>
<a href="#!login(register)">REGISTER</a><br><br>
<!--<a href="#!login(register)">REGISTER</a><br><br>
<a href="#!guild">GUILD PAGES</a><br><br>
<a href="#!gshirt">GUILD SHIRTS</a><br><br>
<a href="#!gshirt">GUILD SHIRTS</a><br><br>-->
</div>
<div class="col-md-4">
<a href="#!impressum">IMPRESSUM</a><br><br>

View File

@ -11,13 +11,13 @@
</tr>
${server_list}
</table>
<form class="textbox trojan" style="padding:10px" id="contact_form">
<form class="textbox trojan" style="padding:10px" id="newserver_form">
<div class="help-block"></div>
<div class="control-group">
<div class="controls" style="float: left; width: 450px;">
<input class="form-control text_width"
type="text"
id="input_contact_name"
id="input_server_address"
placeholder="Address of the new Server "
required data-validation-required-message="Please tell us the Server's Address ;-).">
</div>&nbsp;

View File

@ -1,8 +1,8 @@
<tr>
<td><a href="${url}" target="blank">${name}</a></td>
<td>
<img style="" data-pyroimage="true" src="./api.php?call=files&cat=content&id=${version}" alt="Windows" height="48" width="48">
<img style="" data-pyroimage="true" src="./api.php?call=files&cat=content&id=${version}" alt="WoW" height="48" width="48">
</td>
<td>Score</td>
<td>Vote</td>
<td>${score}</td>
<td>${vote}</td>
</tr>

View File

@ -4,6 +4,7 @@ class DATA_MOJOTROLLZ extends \SYSTEM\DB\QI {
public static function get_class(){return \get_class();}
public static function files_mysql(){
return array( \SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_page.sql'),
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/meta_mojotrollz_server.sql'));
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/system_api.sql'),
\SYSTEM\SERVERPATH(new \PSQL(),'/mysql/schema_mojotrollz_server.sql'));
}
}

View File

@ -4,7 +4,10 @@ CREATE TABLE `mojotrollz_server` (
`url` CHAR(50) NOT NULL,
`version` INT(11) NULL DEFAULT NULL,
`visible` INT(11) NULL DEFAULT NULL,
`score` INT(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2
;

View File

@ -0,0 +1 @@
INSERT INTO `system_api` (`ID`, `group`, `type`, `parentID`, `parentValue`, `name`, `verify`) VALUES (200, 0, 2, 11, 'newserver', 'address', 'STRING');