인스톨러 구현 중
This commit is contained in:
+8
-8
@@ -43,7 +43,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="turnterm" class="col-sm-3 col-form-label">턴 시간(분)</label>
|
<label for="turnterm" class="col-sm-3 col-form-label">턴 시간(분)</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
<div id="turnterm" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
<label class="btn btn-secondary">
|
<label class="btn btn-secondary">
|
||||||
<input type="radio" name="turnterm" value="120">120
|
<input type="radio" name="turnterm" value="120">120
|
||||||
</label>
|
</label>
|
||||||
@@ -76,7 +76,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="sync" class="col-sm-3 col-form-label">시간 동기화</label>
|
<label for="sync" class="col-sm-3 col-form-label">시간 동기화</label>
|
||||||
<div class="col-sm-9" style="display: inline-flex;">
|
<div class="col-sm-9" style="display: inline-flex;">
|
||||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
<div id="sync" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
<label class="btn btn-secondary active">
|
<label class="btn btn-secondary active">
|
||||||
<input type="radio" name="sync" value="1" checked>Y
|
<input type="radio" name="sync" value="1" checked>Y
|
||||||
</label>
|
</label>
|
||||||
@@ -94,7 +94,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="confirm_password" class="col-sm-3 col-form-label">시나리오 선택</label>
|
<label for="confirm_password" class="col-sm-3 col-form-label">시나리오 선택</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<select class="form-control" size="1" id="scenario_sel">
|
<select class="form-control" name="scenario" size="1" id="scenario_sel">
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -103,7 +103,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="fiction" class="col-sm-3 col-form-label">NPC 상성</label>
|
<label for="fiction" class="col-sm-3 col-form-label">NPC 상성</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
<div id="fiction" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
<label class="btn btn-secondary active">
|
<label class="btn btn-secondary active">
|
||||||
<input type="radio" name="fiction" value="0" checked>연의
|
<input type="radio" name="fiction" value="0" checked>연의
|
||||||
</label>
|
</label>
|
||||||
@@ -117,7 +117,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="extend" class="col-sm-3 col-form-label">확장 NPC</label>
|
<label for="extend" class="col-sm-3 col-form-label">확장 NPC</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
<div id="extend" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
<label class="btn btn-secondary active">
|
<label class="btn btn-secondary active">
|
||||||
<input type="radio" name="extend" value="1" checked>포함
|
<input type="radio" name="extend" value="1" checked>포함
|
||||||
</label>
|
</label>
|
||||||
@@ -131,7 +131,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="npcmode" class="col-sm-3 col-form-label">NPC 빙의</label>
|
<label for="npcmode" class="col-sm-3 col-form-label">NPC 빙의</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
<div id="npcmode" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
<label class="btn btn-secondary">
|
<label class="btn btn-secondary">
|
||||||
<input type="radio" name="npcmode" value="1">가능
|
<input type="radio" name="npcmode" value="1">가능
|
||||||
</label>
|
</label>
|
||||||
@@ -145,7 +145,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label for="show_img_level" class="col-sm-3 col-form-label">이미지 표기</label>
|
<label for="show_img_level" class="col-sm-3 col-form-label">이미지 표기</label>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<div class="btn-group btn-group-toggle" data-toggle="buttons">
|
<div id="show_img_level" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||||
<label class="btn btn-secondary">
|
<label class="btn btn-secondary">
|
||||||
<input type="radio" name="show_img_level" value="0">안함
|
<input type="radio" name="show_img_level" value="0">안함
|
||||||
</label>
|
</label>
|
||||||
@@ -165,7 +165,7 @@ if(Session::getUserGrade(true) < 5){
|
|||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col-sm-3"></div>
|
<div class="col-sm-3"></div>
|
||||||
<div class="col-sm-9">
|
<div class="col-sm-9">
|
||||||
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">리셋 개시</button>
|
<input type="submit" class="btn btn-primary btn-lg btn-block login-button" value="리셋 개시">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
<?php
|
||||||
|
namespace sammo;
|
||||||
|
|
||||||
|
include "lib.php";
|
||||||
|
include "func.php";
|
||||||
|
|
||||||
|
$session = Session::Instance()->setReadOnly();
|
||||||
|
if($session->userGrade < 5){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'관리자 아님'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$turnterm = Util::toInt(Util::array_get($_POST['turnterm']));
|
||||||
|
$sync = Util::toInt(Util::array_get($_POST['sync']));
|
||||||
|
$scenario = Util::toInt(Util::array_get($_POST['scenario']));
|
||||||
|
$fiction = Util::toInt(Util::array_get($_POST['fiction']));
|
||||||
|
$extend = Util::toInt(Util::array_get($_POST['extend']));
|
||||||
|
$npcmode = Util::toInt(Util::array_get($_POST['npcmode']));
|
||||||
|
$show_img_level = Util::toInt(Util::array_get($_POST['show_img_level']));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if($turnterm===null || $sync===null || $scenario===null || $fiction===null || $extend===null || $npcmode===null || $show_img_level===null){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'입력 값이 올바르지 않습니다'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(120 % $turnterm != 0){
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'turnterm은 120의 약수여야 합니다.'
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
$mysqli_obj = DB::db()->get();
|
||||||
|
|
||||||
|
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){
|
||||||
|
do{
|
||||||
|
if(!$mysqli_obj->store_result()){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while($mysqli_obj->next_result());
|
||||||
|
}
|
||||||
|
|
||||||
|
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/schema.sql'))){
|
||||||
|
do{
|
||||||
|
if(!$mysqli_obj->store_result()){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while($mysqli_obj->next_result());
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO:script
|
||||||
|
$env = [
|
||||||
|
|
||||||
|
];
|
||||||
|
|
||||||
|
Json::die([
|
||||||
|
'result'=>false,
|
||||||
|
'reason'=>'NYI'
|
||||||
|
]);
|
||||||
+70
-1
@@ -102,8 +102,77 @@ function scenarioPreview(){
|
|||||||
));
|
));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formSetup(){
|
||||||
|
$('#game_form').validate({
|
||||||
|
rules:{
|
||||||
|
turnterm:"required",
|
||||||
|
sync:"required",
|
||||||
|
scenario:"required",
|
||||||
|
fiction:"required",
|
||||||
|
extend:"required",
|
||||||
|
npcmode:"required",
|
||||||
|
show_img_level:"required",
|
||||||
|
},
|
||||||
|
errorElement: "div",
|
||||||
|
errorPlacement: function ( error, element ) {
|
||||||
|
// Add the `help-block` class to the error element
|
||||||
|
error.addClass( "invalid-feedback" );
|
||||||
|
|
||||||
|
if ( element.prop( "type" ) === "checkbox" ) {
|
||||||
|
error.insertAfter( element.parent( "label" ) );
|
||||||
|
} else {
|
||||||
|
error.insertAfter( element );
|
||||||
|
}
|
||||||
|
},
|
||||||
|
highlight: function ( element, errorClass, validClass ) {
|
||||||
|
$( element ).addClass( "is-invalid" ).removeClass( "is-valid" );
|
||||||
|
},
|
||||||
|
unhighlight: function (element, errorClass, validClass) {
|
||||||
|
$( element ).addClass( "is-valid" ).removeClass( "is-invalid" );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#game_form').submit(function(e){
|
||||||
|
e.preventDefault();
|
||||||
|
if(!$("#game_form").valid()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
cache:false,
|
||||||
|
type:'post',
|
||||||
|
url:'j_install.php',
|
||||||
|
dataType:'json',
|
||||||
|
data:{
|
||||||
|
turnterm:$('#turnterm input:radio:checked').val(),
|
||||||
|
sync:$('#sync input:radio:checked').val(),
|
||||||
|
scenario:$('#scenario_sel').val(),
|
||||||
|
fiction:$('#fiction input:radio:checked').val(),
|
||||||
|
extend:$('#extend input:radio:checked').val(),
|
||||||
|
npcmode:$('#npcmode input:radio:checked').val(),
|
||||||
|
show_img_level:$('#show_img_level input:radio:checked').val()
|
||||||
|
}
|
||||||
|
}).then(function(result){
|
||||||
|
var deferred = $.Deferred();
|
||||||
|
|
||||||
|
if(!result.result){
|
||||||
|
alert(result.reason);
|
||||||
|
deferred.reject('fail');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
alert('DB.php가 생성되었습니다.');
|
||||||
|
deferred.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return deferred.promise();
|
||||||
|
}).then(function(){
|
||||||
|
location.href = 'install.php';
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
$(function(){
|
$(function(){
|
||||||
loadScenarios();
|
loadScenarios();
|
||||||
$('#scenario_sel').change(scenarioPreview);
|
$('#scenario_sel').change(scenarioPreview);
|
||||||
//loadScenarioPreview(8);
|
formSetup();
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user