dynamic config
This commit is contained in:
parent
9b11d59407
commit
d3bf129a2a
|
@ -203,6 +203,34 @@ class ConfigController extends Controller {
|
|||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
Yii::$app->response->format = "json";
|
||||
$cfgData = $post['config'];
|
||||
$config_json = [];
|
||||
foreach ($cfgData as $key => $value) {
|
||||
if (is_numeric($value['data'])) {
|
||||
$value['data'] = floatval($value['data']);
|
||||
}
|
||||
|
||||
$pr = explode("|", $value['parent']);
|
||||
if (count($pr) == 1) {
|
||||
if ($pr[0] === "")
|
||||
$config_json[$value['key']] = $value['data'];
|
||||
else
|
||||
$config_json[$pr[0]][$value['key']] = $value['data'];
|
||||
}
|
||||
if (count($pr) == 2) {
|
||||
$config_json[$pr[0]][$pr[1]][$value['key']] = $value['data'];
|
||||
}
|
||||
if (count($pr) == 3) {
|
||||
$config_json[$pr[0]][$pr[1]][$pr[2]][$value['key']] = $value['data'];
|
||||
}
|
||||
if (count($pr) == 4) {
|
||||
$config_json[$pr[0]][$pr[1]][$pr[2]][$pr[3]][$value['key']] = $value['data'];
|
||||
}
|
||||
if (count($pr) == 5) {
|
||||
$config_json[$pr[0]][$pr[1]][$pr[2]][$pr[3]][$pr[4]][$value['key']] = $value['data'];
|
||||
}
|
||||
}
|
||||
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
|
@ -224,7 +252,7 @@ class ConfigController extends Controller {
|
|||
'content' => json_encode([
|
||||
'path' => $engineConfig['data']['engines'][0]['path'],
|
||||
'config' => $engineConfig,
|
||||
'configEngine' => $post['config']
|
||||
'configEngine' => $config_json
|
||||
])
|
||||
]
|
||||
]));
|
||||
|
@ -261,8 +289,8 @@ class ConfigController extends Controller {
|
|||
if ($checkConfig['status'])
|
||||
$config_json = json_decode($checkConfig['data'], true);
|
||||
|
||||
return $this->render('cau-hinh-nhan-dien', [
|
||||
"config_json" => $config_json
|
||||
return $this->render('config', [
|
||||
"config_json" => \app\widgets\ConfigTree::widget(['configLists' => $config_json, 'isRoot' => true, 'parent_id' => 'node', 'parent_key' => ''])
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,732 +0,0 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="app\assets\ConfigAsset"}
|
||||
{ConfigAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.input-group-addon{
|
||||
width: 100px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.input-group{
|
||||
width: 100%;
|
||||
}
|
||||
#fontSizeWrapper { font-size: 16px; }
|
||||
|
||||
#fontSize {
|
||||
width: 100px;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* ————————————————————–
|
||||
Tree core styles
|
||||
*/
|
||||
.tree { margin: 1em; list-style: none;}
|
||||
|
||||
.tree input {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.tree input ~ ul { display: none; }
|
||||
|
||||
.tree input:checked ~ ul { display: block; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree rows
|
||||
*/
|
||||
.tree li {
|
||||
line-height: 1.2;
|
||||
position: relative;
|
||||
padding: 0 0 1em 1em;
|
||||
}
|
||||
|
||||
.tree ul li { padding: 1em 0 0 1em; }
|
||||
|
||||
.tree > li:last-child { padding-bottom: 0; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree labels
|
||||
*/
|
||||
.tree_label {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
label.tree_label { cursor: pointer; }
|
||||
|
||||
label.tree_label:hover { color: #666; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree expanded icon
|
||||
*/
|
||||
label.tree_label:before {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
float: left;
|
||||
margin: 0 1em 0 -2em;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
border-radius: 1em;
|
||||
content: '+';
|
||||
text-align: center;
|
||||
line-height: .9em;
|
||||
}
|
||||
|
||||
:checked ~ label.tree_label:before { content: '–'; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree branches
|
||||
*/
|
||||
.tree ul{
|
||||
list-style: none;
|
||||
}
|
||||
.tree li:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: -.5em;
|
||||
display: block;
|
||||
width: 0;
|
||||
border-left: 1px solid #777;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.tree_label:after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -1.5em;
|
||||
display: block;
|
||||
height: 0.5em;
|
||||
width: 1em;
|
||||
border-bottom: 1px solid #777;
|
||||
border-left: 1px solid #777;
|
||||
border-radius: 0 0 0 .3em;
|
||||
content: '';
|
||||
}
|
||||
|
||||
label.tree_label:after { border-bottom: 0; }
|
||||
|
||||
:checked ~ label.tree_label:after {
|
||||
border-radius: 0 .3em 0 0;
|
||||
border-top: 1px solid #777;
|
||||
border-right: 1px solid #777;
|
||||
border-bottom: 0;
|
||||
border-left: 0;
|
||||
bottom: 0;
|
||||
top: 0.5em;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.tree li:last-child:before {
|
||||
height: 1em;
|
||||
bottom: auto;
|
||||
}
|
||||
|
||||
.tree > li:last-child:before { display: none; }
|
||||
|
||||
.tree_custom {
|
||||
display: block;
|
||||
background: #eee;
|
||||
padding: 1em;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
.editform{
|
||||
display: inline-block;min-width: 200px;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mt-element-step">
|
||||
<div class="row step-thin">
|
||||
<div class="col-md-6 bg-grey mt-step-col active">
|
||||
<div class="mt-step-number bg-white font-grey">1</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config'])}';">
|
||||
Cấu hình máy chủ
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Server config</div>
|
||||
</div>
|
||||
<div class="col-md-6 bg-grey mt-step-col active">
|
||||
<div class="mt-step-number bg-white font-grey">2</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
|
||||
Cấu hình nhận diện
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Engine config</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{$username=Yii::$app->user->identity->username}
|
||||
<ul class="tree">
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c1" />
|
||||
<label class="tree_label" for="c1">camera</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c11" />
|
||||
<label class="tree_label" for="c11">auto_check</label>:
|
||||
<div contenteditable="" id="text-c11" class="editform">{$config_json.camera.auto_check}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c12" />
|
||||
<label class="tree_label" for="c12">num_cam</label>:
|
||||
<div contenteditable="" id="text-c12" class="editform">{$config_json.camera.num_cam}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c13" />
|
||||
<label class="tree_label" for="c13">rgb</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c131" />
|
||||
<label class="tree_label" for="c131">url</label>:
|
||||
<div contenteditable="" id="text-c131" class="editform">{$config_json.camera.rgb.url}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c132" />
|
||||
<label class="tree_label" for="c132">type</label>:
|
||||
<div contenteditable="" id="text-c132" class="editform">{$config_json.camera.rgb.type}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c133" />
|
||||
<label class="tree_label" for="c133">rotate</label>:
|
||||
<div contenteditable="" id="text-c133" class="editform">{$config_json.camera.rgb.rotate}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c134" />
|
||||
<label class="tree_label" for="c134">config</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1341" />
|
||||
<label class="tree_label" for="c1341">enable</label>:
|
||||
<div contenteditable="" id="text-c1341" class="editform">{$config_json.camera.rgb.config.enable}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1342" />
|
||||
<label class="tree_label" for="c1342">brightness</label>:
|
||||
<div contenteditable="" id="text-c1342" class="editform">{$config_json.camera.rgb.config.brightness}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1343" />
|
||||
<label class="tree_label" for="c1343">gain</label>:
|
||||
<div contenteditable="" id="text-c1343" class="editform">{$config_json.camera.rgb.config.gain}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1344" />
|
||||
<label class="tree_label" for="c1344">saturation</label>:
|
||||
<div contenteditable="" id="text-c1344" class="editform">{$config_json.camera.rgb.config.saturation}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1345" />
|
||||
<label class="tree_label" for="c1345">sharpness</label>:
|
||||
<div contenteditable="" id="text-c1345" class="editform">{$config_json.camera.rgb.config.sharpness}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c14" />
|
||||
<label class="tree_label" for="c14">ir</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c141" />
|
||||
<label class="tree_label" for="c141">url</label>:
|
||||
<div contenteditable="" id="text-c141" class="editform">{$config_json.camera.ir.url}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c142" />
|
||||
<label class="tree_label" for="c142">type</label>:
|
||||
<div contenteditable="" id="text-c142" class="editform">{$config_json.camera.ir.type}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c143" />
|
||||
<label class="tree_label" for="c143">rotate</label>:
|
||||
<div contenteditable="" id="text-c143" class="editform">{$config_json.camera.ir.rotate}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c144" />
|
||||
<label class="tree_label" for="c144">translate_x</label>:
|
||||
<div contenteditable="" id="text-c144" class="editform">{$config_json.camera.ir.translate_x}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c145" />
|
||||
<label class="tree_label" for="c145">translate_y</label>:
|
||||
<div contenteditable="" id="text-c145" class="editform">{$config_json.camera.ir.translate_y}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c146" />
|
||||
<label class="tree_label" for="c146">ir_scale</label>:
|
||||
<div contenteditable="" id="text-c146" class="editform">{$config_json.camera.ir.ir_scale}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c147" />
|
||||
<label class="tree_label" for="c147">config</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1471" />
|
||||
<label class="tree_label" for="c1471">enable</label>:
|
||||
<div contenteditable="" id="text-c1471" class="editform">{$config_json.camera.ir.config.enable}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c15" />
|
||||
<label class="tree_label" for="c15">max_queue_size</label>:
|
||||
<div contenteditable="" id="text-c15" class="editform">{$config_json.camera.max_queue_size}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c16" />
|
||||
<label class="tree_label" for="c16">count_frame_to_skip</label>:
|
||||
<div contenteditable="" id="text-c16" class="editform">{$config_json.camera.count_frame_to_skip}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c17" />
|
||||
<label class="tree_label" for="c17">fps</label>:
|
||||
<div contenteditable="" id="text-c17" class="editform">{$config_json.camera.fps}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c18" />
|
||||
<label class="tree_label" for="c18">merge_queue_pause</label>:
|
||||
<div contenteditable="" id="text-c18" class="editform">{$config_json.camera.merge_queue_pause}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c19" />
|
||||
<label class="tree_label" for="c19">raw_resolution</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c191" />
|
||||
<label class="tree_label" for="c191">width</label>:
|
||||
<div contenteditable="" id="text-c191" class="editform">{$config_json.camera.raw_resolution.width}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c192" />
|
||||
<label class="tree_label" for="c192">height</label>:
|
||||
<div contenteditable="" id="text-c192" class="editform">{$config_json.camera.raw_resolution.height}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c110" />
|
||||
<label class="tree_label" for="c110">video_resize</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1101" />
|
||||
<label class="tree_label" for="c1101">width</label>:
|
||||
<div contenteditable="" id="text-c1101" class="editform">{$config_json.camera.video_resize.width}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1102" />
|
||||
<label class="tree_label" for="c1102">height</label>:
|
||||
<div contenteditable="" id="text-c1102" class="editform">{$config_json.camera.video_resize.height}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c111" />
|
||||
<label class="tree_label" for="c111">crop_frame</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1111" />
|
||||
<label class="tree_label" for="c1111">x</label>:
|
||||
<div contenteditable="" id="text-c1111" class="editform">{$config_json.camera.crop_frame.x}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1112" />
|
||||
<label class="tree_label" for="c1112">y</label>:
|
||||
<div contenteditable="" id="text-c1112" class="editform">{$config_json.camera.crop_frame.y}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1113" />
|
||||
<label class="tree_label" for="c1113">width</label>:
|
||||
<div contenteditable="" id="text-c1113" class="editform">{$config_json.camera.crop_frame.width}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c1114" />
|
||||
<label class="tree_label" for="c1114">height</label>:
|
||||
<div contenteditable="" id="text-c1114" class="editform">{$config_json.camera.crop_frame.height}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c2" />
|
||||
<label class="tree_label" for="c2">face_verify</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c21" />
|
||||
<label class="tree_label" for="c21">show_fake_label</label>:
|
||||
<div contenteditable="" id="text-c21" class="editform">{$config_json.face_verify.show_fake_label}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c22" />
|
||||
<label class="tree_label" for="c22">debug</label>:
|
||||
<div contenteditable="" id="text-c22" class="editform">{$config_json.face_verify.debug}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c23" />
|
||||
<label class="tree_label" for="c23">max_fake_time</label>:
|
||||
<div contenteditable="" id="text-c23" class="editform">{$config_json.face_verify.max_fake_time}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c24" />
|
||||
<label class="tree_label" for="c24">min_real_time</label>:
|
||||
<div contenteditable="" id="text-c24" class="editform">{$config_json.face_verify.min_real_time}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c25" />
|
||||
<label class="tree_label" for="c25">saturation</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c251" />
|
||||
<label class="tree_label" for="c251">enable</label>:
|
||||
<div contenteditable="" id="text-c251" class="editform">{$config_json.face_verify.saturation.enable}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c252" />
|
||||
<label class="tree_label" for="c252">min_std_thresh</label>:
|
||||
<div contenteditable="" id="text-c252" class="editform">{$config_json.face_verify.saturation.min_std_thresh}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c253" />
|
||||
<label class="tree_label" for="c253">min_mean_thresh</label>:
|
||||
<div contenteditable="" id="text-c253" class="editform">{$config_json.face_verify.saturation.min_mean_thresh}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c26" />
|
||||
<label class="tree_label" for="c26">mtcnn</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c261" />
|
||||
<label class="tree_label" for="c261">enable</label>:
|
||||
<div contenteditable="" id="text-c261" class="editform">{$config_json.face_verify.mtcnn.enable}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c262" />
|
||||
<label class="tree_label" for="c262">size</label>:
|
||||
<div contenteditable="" id="text-c262" class="editform">{$config_json.face_verify.mtcnn.size}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c263" />
|
||||
<label class="tree_label" for="c263">num_thread</label>:
|
||||
<div contenteditable="" id="text-c263" class="editform">{$config_json.face_verify.mtcnn.num_thread}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c27" />
|
||||
<label class="tree_label" for="c27">ir_face_verify</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c271" />
|
||||
<label class="tree_label" for="c271">enable</label>:
|
||||
<div contenteditable="" id="text-c271" class="editform">{$config_json.face_verify.ir_face_verify.enable}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c272" />
|
||||
<label class="tree_label" for="c272">ir_scale</label>:
|
||||
<div contenteditable="" id="text-c272" class="editform">{$config_json.face_verify.ir_face_verify.ir_scale}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c273" />
|
||||
<label class="tree_label" for="c273">ir_neighbor</label>:
|
||||
<div contenteditable="" id="text-c273" class="editform">{$config_json.face_verify.ir_face_verify.ir_neighbor}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c_10" />
|
||||
<label class="tree_label" for="c_10">ultraface</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_101" />
|
||||
<label class="tree_label" for="c_101">enable</label>:
|
||||
<div contenteditable="" id="text-c_101" class="editform">{$config_json.ultraface.enable|default:1}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_102" />
|
||||
<label class="tree_label" for="c_102">translate_x</label>:
|
||||
<div contenteditable="" id="text-c_102" class="editform">{$config_json.ultraface.translate_x|default:0}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_103" />
|
||||
<label class="tree_label" for="c_103">translate_y</label>:
|
||||
<div contenteditable="" id="text-c_103" class="editform">{$config_json.ultraface.translate_y|default:0}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_104" />
|
||||
<label class="tree_label" for="c_104">width</label>:
|
||||
<div contenteditable="" id="text-c_104" class="editform">{$config_json.ultraface.width|default:160}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_105" />
|
||||
<label class="tree_label" for="c_105">height</label>:
|
||||
<div contenteditable="" id="text-c_105" class="editform">{$config_json.ultraface.height|default:120}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_106" />
|
||||
<label class="tree_label" for="c_106">threshold</label>:
|
||||
<div contenteditable="" id="text-c_106" class="editform">{$config_json.ultraface.threshold|default:0.7}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_107" />
|
||||
<label class="tree_label" for="c_107">min_size</label>:
|
||||
<div contenteditable="" id="text-c_107" class="editform">{$config_json.ultraface.min_size|default:60}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_108" />
|
||||
<label class="tree_label" for="c_108">thread_use</label>:
|
||||
<div contenteditable="" id="text-c_108" class="editform">{$config_json.ultraface.thread_use|default:2}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c_109" />
|
||||
<label class="tree_label" for="c_109">max_ratio</label>:
|
||||
<div contenteditable="" id="text-c_109" class="editform">{$config_json.ultraface.max_ratio|default:1.5}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c3" />
|
||||
<label class="tree_label" for="c3">haarcascade</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c31" />
|
||||
<label class="tree_label" for="c31">enable</label>:
|
||||
<div contenteditable="" id="text-c31" class="editform">{$config_json.haarcascade.enable}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c32" />
|
||||
<label class="tree_label" for="c32">show_time_detect</label>:
|
||||
<div contenteditable="" id="text-c32" class="editform">{$config_json.haarcascade.show_time_detect}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c33" />
|
||||
<label class="tree_label" for="c33">min_size</label>:
|
||||
<div contenteditable="" id="text-c33" class="editform">{$config_json.haarcascade.min_size}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c34" />
|
||||
<label class="tree_label" for="c34">max_size</label>:
|
||||
<div contenteditable="" id="text-c34" class="editform">{$config_json.haarcascade.max_size}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c35" />
|
||||
<label class="tree_label" for="c35">scale</label>:
|
||||
<div contenteditable="" id="text-c35" class="editform">{$config_json.haarcascade.scale}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c36" />
|
||||
<label class="tree_label" for="c36">neighbor</label>:
|
||||
<div contenteditable="" id="text-c36" class="editform">{$config_json.haarcascade.neighbor}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c4" />
|
||||
<label class="tree_label" for="c4">engine</label>
|
||||
<ul>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c41" />
|
||||
<label class="tree_label" for="c41">max_fps</label>:
|
||||
<div contenteditable="" id="text-c41" class="editform">{$config_json.engine.max_fps}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c42" />
|
||||
<label class="tree_label" for="c42">cam_id</label>:
|
||||
<div contenteditable="" id="text-c42" class="editform">{$config_json.engine.cam_id}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c43" />
|
||||
<label class="tree_label" for="c43">server_authen</label>:
|
||||
<div contenteditable="" id="text-c43" class="editform">{$config_json.engine.server_authen}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c5" />
|
||||
<label class="tree_label" for="c5">recognition</label>
|
||||
<ul>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c51" />
|
||||
<label class="tree_label" for="c51">enable</label>:
|
||||
<div contenteditable="" id="text-c51" class="editform">{$config_json.recognition.enable}</div>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c52" />
|
||||
<label class="tree_label" for="c52">accuracy</label>:
|
||||
<div contenteditable="" id="text-c52" class="editform">{$config_json.recognition.accuracy}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c53" />
|
||||
<label class="tree_label" for="c53">server_recog</label>:
|
||||
<div contenteditable="" id="text-c53" class="editform">{$config_json.recognition.server_recog}</div>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c54" />
|
||||
<label class="tree_label" for="c54">request_timeout</label>:
|
||||
<div contenteditable="" id="text-c54" class="editform">{$config_json.recognition.request_timeout}</div>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c55" />
|
||||
<label class="tree_label" for="c55">num_face_recog</label>:
|
||||
<div contenteditable="" id="text-c55" class="editform">{$config_json.recognition.num_face_recog}</div>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c56" />
|
||||
<label class="tree_label" for="c56">first_time_recog</label>:
|
||||
<div contenteditable="" id="text-c56" class="editform">{$config_json.recognition.first_time_recog}</div>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c57" />
|
||||
<label class="tree_label" for="c57">next_time_recog</label>:
|
||||
<div contenteditable="" id="text-c57" class="editform">{$config_json.recognition.next_time_recog}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c6" />
|
||||
<label class="tree_label" for="c6">screen</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c61" />
|
||||
<label class="tree_label" for="c61">show_video</label>:
|
||||
<div contenteditable="" id="text-c61" class="editform">{$config_json.screen.show_video}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c62" />
|
||||
<label class="tree_label" for="c62">full_screen</label>:
|
||||
<div contenteditable="" id="text-c62" class="editform">{$config_json.screen.full_screen}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c63" />
|
||||
<label class="tree_label" for="c63">width</label>:
|
||||
<div contenteditable="" id="text-c63" class="editform">{$config_json.screen.width}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c64" />
|
||||
<label class="tree_label" for="c64">height</label>:
|
||||
<div contenteditable="" id="text-c64" class="editform">{$config_json.screen.height}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c65" />
|
||||
<label class="tree_label" for="c65">banner</label>:
|
||||
<div contenteditable="" id="text-c65" class="editform">{$config_json.screen.banner}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c66" />
|
||||
<label class="tree_label" for="c66">bb_color_rgb</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c661" />
|
||||
<label class="tree_label" for="c661">detect</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c6611" />
|
||||
<label class="tree_label" for="c6611">R</label>:
|
||||
<div contenteditable="" id="text-c6611" class="editform">{$config_json.screen.bb_color_rgb.detect.0|default:0}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c6612" />
|
||||
<label class="tree_label" for="c6612">G</label>:
|
||||
<div contenteditable="" id="text-c6612" class="editform">{$config_json.screen.bb_color_rgb.detect.1|default:250}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c6613" />
|
||||
<label class="tree_label" for="c6613">B</label>:
|
||||
<div contenteditable="" id="text-c6613" class="editform">{$config_json.screen.bb_color_rgb.detect.2|default:150}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c662" />
|
||||
<label class="tree_label" for="c662">recog</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c6621" />
|
||||
<label class="tree_label" for="c6621">R</label>:
|
||||
<div contenteditable="" id="text-c6621" class="editform">{$config_json.screen.bb_color_rgb.detect.0|default:255}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c6622" />
|
||||
<label class="tree_label" for="c6622">G</label>:
|
||||
<div contenteditable="" id="text-c6622" class="editform">{$config_json.screen.bb_color_rgb.detect.1|default:0}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c6623" />
|
||||
<label class="tree_label" for="c6623">B</label>:
|
||||
<div contenteditable="" id="text-c6623" class="editform">{$config_json.screen.bb_color_rgb.detect.2|default:0}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c7" />
|
||||
<label class="tree_label" for="c7">id_city</label>
|
||||
<div contenteditable="" id="text-c7" class="editform">{$config_json.id_city}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c8" />
|
||||
<label class="tree_label" for="c8">open_door</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c81" />
|
||||
<label class="tree_label" for="c81">enable</label>:
|
||||
<div contenteditable="" id="text-c81" class="editform">{$config_json.open_door.enable}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c82" />
|
||||
<label class="tree_label" for="c82">port_name</label>:
|
||||
<div contenteditable="" id="text-c82" class="editform">{$config_json.open_door.port_name}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li {if $username!='admin'}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="c9" />
|
||||
<label class="tree_label" for="c9">log</label>
|
||||
<ul>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c91" />
|
||||
<label class="tree_label" for="c91">path</label>:
|
||||
<div contenteditable="" id="text-c91" class="editform">{$config_json.log.path}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c92" />
|
||||
<label class="tree_label" for="c92">limit</label>:
|
||||
<div contenteditable="" id="text-c92" class="editform">{$config_json.log.limit}</div>
|
||||
</li>
|
||||
<li>
|
||||
<input type="checkbox" checked="checked" id="c93" />
|
||||
<label class="tree_label" for="c93">clear_line</label>:
|
||||
<div contenteditable="" id="text-c93" class="editform">{$config_json.log.clear_line}</div>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="saveStep2(this);" data-href="{Url::to(['/config/cau-hinh-nhan-dien'])}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu lại
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
178
views/config/config.tpl
Normal file
178
views/config/config.tpl
Normal file
|
@ -0,0 +1,178 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="app\assets\ConfigAsset"}
|
||||
{ConfigAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.input-group-addon{
|
||||
width: 100px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.input-group{
|
||||
width: 100%;
|
||||
}
|
||||
#fontSizeWrapper { font-size: 16px; }
|
||||
|
||||
#fontSize {
|
||||
width: 100px;
|
||||
font-size: 1em;
|
||||
}
|
||||
|
||||
/* ————————————————————–
|
||||
Tree core styles
|
||||
*/
|
||||
.tree { margin: 1em; list-style: none;}
|
||||
|
||||
.tree input {
|
||||
position: absolute;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
.tree input ~ ul { display: none; }
|
||||
|
||||
.tree input:checked ~ ul { display: block; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree rows
|
||||
*/
|
||||
.tree li {
|
||||
line-height: 1.2;
|
||||
position: relative;
|
||||
padding: 0 0 1em 1em;
|
||||
}
|
||||
|
||||
.tree ul li { padding: 1em 0 0 1em; }
|
||||
|
||||
.tree > li:last-child { padding-bottom: 0; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree labels
|
||||
*/
|
||||
.tree_label {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
label.tree_label { cursor: pointer; }
|
||||
|
||||
label.tree_label:hover { color: #666; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree expanded icon
|
||||
*/
|
||||
label.tree_label:before {
|
||||
background: #000;
|
||||
color: #fff;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
float: left;
|
||||
margin: 0 1em 0 -2em;
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
border-radius: 1em;
|
||||
content: '+';
|
||||
text-align: center;
|
||||
line-height: .9em;
|
||||
}
|
||||
|
||||
:checked ~ label.tree_label:before { content: '–'; }
|
||||
|
||||
/* ————————————————————–
|
||||
Tree branches
|
||||
*/
|
||||
.tree ul{
|
||||
list-style: none;
|
||||
}
|
||||
.tree li:before {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: -.5em;
|
||||
display: block;
|
||||
width: 0;
|
||||
border-left: 1px solid #777;
|
||||
content: "";
|
||||
}
|
||||
|
||||
.tree_label:after {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: -1.5em;
|
||||
display: block;
|
||||
height: 0.5em;
|
||||
width: 1em;
|
||||
border-bottom: 1px solid #777;
|
||||
border-left: 1px solid #777;
|
||||
border-radius: 0 0 0 .3em;
|
||||
content: '';
|
||||
}
|
||||
|
||||
label.tree_label:after { border-bottom: 0; }
|
||||
|
||||
:checked ~ label.tree_label:after {
|
||||
border-radius: 0 .3em 0 0;
|
||||
border-top: 1px solid #777;
|
||||
border-right: 1px solid #777;
|
||||
border-bottom: 0;
|
||||
border-left: 0;
|
||||
bottom: 0;
|
||||
top: 0.5em;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.tree li:last-child:before {
|
||||
height: 1em;
|
||||
bottom: auto;
|
||||
}
|
||||
|
||||
.tree > li:last-child:before { display: none; }
|
||||
|
||||
.tree_custom {
|
||||
display: block;
|
||||
background: #eee;
|
||||
padding: 1em;
|
||||
border-radius: 0.3em;
|
||||
}
|
||||
.editform{
|
||||
display: inline-block;min-width: 200px;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mt-element-step">
|
||||
<div class="row step-thin">
|
||||
<div class="col-md-6 bg-grey mt-step-col active">
|
||||
<div class="mt-step-number bg-white font-grey">1</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config'])}';">
|
||||
Cấu hình máy chủ
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Server config</div>
|
||||
</div>
|
||||
<div class="col-md-6 bg-grey mt-step-col active">
|
||||
<div class="mt-step-number bg-white font-grey">2</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
|
||||
Cấu hình nhận diện
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Engine config</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{$config_json}
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="saveStep2(this);" data-href="{Url::to(['/config/cau-hinh-nhan-dien'])}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu lại
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
131
web/js/config.js
131
web/js/config.js
|
@ -57,134 +57,21 @@ function saveStep1(e) {
|
|||
});
|
||||
}
|
||||
function saveStep2(e) {
|
||||
var config_json = {
|
||||
"camera": {
|
||||
"auto_check": parseInt($("#text-c11").html()),
|
||||
"num_cam": parseInt($("#text-c12").html()),
|
||||
"rgb": {
|
||||
"url": $("#text-c131").html(),
|
||||
"type": $("#text-c132").html(),
|
||||
"rotate": parseInt($("#text-c133").html()),
|
||||
"config": {
|
||||
"enable": parseInt($("#text-c1341").html()),
|
||||
"brightness": parseInt($("#text-c1342").html()),
|
||||
"gain": parseInt($("#text-c1343").html()),
|
||||
"saturation": parseInt($("#text-c1344").html()),
|
||||
"sharpness": parseInt($("#text-c1345").html())
|
||||
var cfgLists = $(".editform");
|
||||
var cfg = [];
|
||||
for (var i = 0; i < cfgLists.length; i++) {
|
||||
cfg.push({
|
||||
parent: $(cfgLists[i]).data("parent"),
|
||||
key: $(cfgLists[i]).data("key"),
|
||||
data: $(cfgLists[i]).html()
|
||||
});
|
||||
}
|
||||
},
|
||||
"ir": {
|
||||
"url": $("#text-c141").html(),
|
||||
"type": $("#text-c142").html(),
|
||||
"rotate": parseInt($("#text-c143").html()),
|
||||
"translate_x": parseInt($("#text-c144").html()),
|
||||
"translate_y": parseInt($("#text-c145").html()),
|
||||
"ir_scale": parseFloat($("#text-c146").html()),
|
||||
"config": {
|
||||
"enable": parseInt($("#text-c1471").html())
|
||||
}
|
||||
},
|
||||
"max_queue_size": parseInt($("#text-c15").html()),
|
||||
"count_frame_to_skip": parseInt($("#text-c16").html()),
|
||||
"fps": parseInt($("#text-c17").html()),
|
||||
"merge_queue_pause": parseInt($("#text-c18").html()),
|
||||
"raw_resolution": {
|
||||
"width": parseInt($("#text-c191").html()),
|
||||
"height": parseInt($("#text-c192").html())
|
||||
},
|
||||
"video_resize": {
|
||||
"width": parseInt($("#text-c1101").html()),
|
||||
"height": parseInt($("#text-c1102").html())
|
||||
},
|
||||
"crop_frame": {
|
||||
"x": parseInt($("#text-c1111").html()),
|
||||
"y": parseInt($("#text-c1112").html()),
|
||||
"width": parseInt($("#text-c1113").html()),
|
||||
"height": parseInt($("#text-c1114").html())
|
||||
}
|
||||
},
|
||||
"face_verify": {
|
||||
"show_fake_label": parseInt($("#text-c21").html()),
|
||||
"debug": parseInt($("#text-c22").html()),
|
||||
"max_fake_time": parseInt($("#text-c23").html()),
|
||||
"min_real_time": parseInt($("#text-c24").html()),
|
||||
"saturation": {
|
||||
"enable": parseInt($("#text-c251").html()),
|
||||
"min_std_thresh": parseInt($("#text-c252").html()),
|
||||
"min_mean_thresh": parseInt($("#text-c253").html())
|
||||
},
|
||||
"mtcnn": {
|
||||
"enable": parseInt($("#text-c261").html()),
|
||||
"size": parseInt($("#text-c262").html()),
|
||||
"num_thread": parseInt($("#text-c263").html())
|
||||
},
|
||||
"ir_face_verify": {
|
||||
"enable": parseInt($("#text-c271").html()),
|
||||
"ir_scale": parseFloat($("#text-c272").html()),
|
||||
"ir_neighbor": parseInt($("#text-c273").html())
|
||||
}
|
||||
},
|
||||
"ultraface": {
|
||||
"enable": parseInt($("#text-c_101").html()),
|
||||
"translate_x": parseInt($("#text-c_102").html()),
|
||||
"translate_y": parseInt($("#text-c_103").html()),
|
||||
"width": parseInt($("#text-c_104").html()),
|
||||
"height": parseInt($("#text-c_105").html()),
|
||||
"threshold": parseFloat($("#text-c_106").html()),
|
||||
"min_size": parseInt($("#text-c_107").html()),
|
||||
"thread_use": parseInt($("#text-c_108").html()),
|
||||
"max_ratio": parseFloat($("#text-c_109").html())
|
||||
},
|
||||
"haarcascade": {
|
||||
"enable": parseInt($("#text-c31").html()),
|
||||
"show_time_detect": parseInt($("#text-c32").html()),
|
||||
"min_size": parseInt($("#text-c33").html()),
|
||||
"max_size": parseInt($("#text-c34").html()),
|
||||
"scale": parseFloat($("#text-c35").html()),
|
||||
"neighbor": parseInt($("#text-c36").html())
|
||||
},
|
||||
"engine": {
|
||||
"max_fps": parseInt($("#text-c41").html()),
|
||||
"cam_id": parseInt($("#text-c42").html()),
|
||||
"server_authen": $("#text-c43").html()
|
||||
},
|
||||
"recognition": {
|
||||
"enable": parseInt($("#text-c51").html()),
|
||||
"accuracy": parseFloat($("#text-c52").html()),
|
||||
"server_recog": $("#text-c53").html(),
|
||||
"request_timeout": parseInt($("#text-c54").html()),
|
||||
"num_face_recog": parseInt($("#text-c55").html()),
|
||||
"first_time_recog": parseInt($("#text-c56").html()),
|
||||
"next_time_recog": parseInt($("#text-c57").html())
|
||||
},
|
||||
"screen": {
|
||||
"show_video": parseInt($("#text-c61").html()),
|
||||
"full_screen": parseInt($("#text-c62").html()),
|
||||
"width": parseInt($("#text-c63").html()),
|
||||
"height": parseInt($("#text-c64").html()),
|
||||
"banner": $("#text-c65").html(),
|
||||
"bb_color_rgb": {
|
||||
"detect": [parseInt($("#text-c6611").html()), parseInt($("#text-c6612").html()), parseInt($("#text-c6613").html())],
|
||||
"recog": [parseInt($("#text-c6621").html()), parseInt($("#text-c6622").html()), parseInt($("#text-c6623").html())]
|
||||
}
|
||||
},
|
||||
"id_city": parseInt($("#text-c7").html()),
|
||||
"open_door": {
|
||||
"enable": parseInt($("#text-c81").html()),
|
||||
"port_name": $("#text-c82").html()
|
||||
},
|
||||
"log": {
|
||||
"path": $("#text-c91").html(),
|
||||
"limit": parseInt($("#text-c92").html()),
|
||||
"clear_line": parseInt($("#text-c93").html())
|
||||
}
|
||||
};
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
config: JSON.stringify(config_json)
|
||||
config: cfg
|
||||
},
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
|
|
33
widgets/ConfigTree.php
Normal file
33
widgets/ConfigTree.php
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace app\widgets;
|
||||
|
||||
use yii\base\Widget;
|
||||
|
||||
class ConfigTree extends Widget {
|
||||
|
||||
public $configLists;
|
||||
public $isRoot;
|
||||
public $parent_id;
|
||||
public $parent_key;
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
}
|
||||
|
||||
public function run() {
|
||||
|
||||
$public_root = ['engine', 'recognition', 'open_door'];
|
||||
$public_cfg = ['engine|cam_id', 'engine|server_authen', 'recognition|server_recog', 'open_door|enable', 'open_door|port_name'];
|
||||
|
||||
return $this->render("config-tree", [
|
||||
"configLists" => $this->configLists,
|
||||
"isRoot" => $this->isRoot,
|
||||
"parent_id" => $this->parent_id,
|
||||
"parent_key" => $this->parent_key,
|
||||
"public_root" => $public_root,
|
||||
"public_cfg" => $public_cfg
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
34
widgets/views/config-tree.tpl
Normal file
34
widgets/views/config-tree.tpl
Normal file
|
@ -0,0 +1,34 @@
|
|||
{$username=Yii::$app->user->identity->username}
|
||||
<ul {if $isRoot}class="tree"{/if}>
|
||||
{$c=0}
|
||||
{foreach from=$configLists item=cf key=k}
|
||||
{$c=$c+1}
|
||||
{$hidden=false}
|
||||
{if $username!='admin'}
|
||||
{if $isRoot}
|
||||
{if !in_array($k,$public_root)}
|
||||
{$hidden=true}
|
||||
{/if}
|
||||
{else}
|
||||
{$tree=$parent_key|cat:"|"|cat:$k}
|
||||
{if !in_array($tree,$public_cfg)}
|
||||
{$hidden=true}
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
<li {if $hidden}class='hidden'{/if}>
|
||||
<input type="checkbox" checked="checked" id="{$parent_id}_{$c}" />
|
||||
<label class="tree_label" for="{$parent_id}_{$c}">{$k}</label>
|
||||
{if is_array($cf)}
|
||||
{if $parent_key===""}
|
||||
{$parentKey=$k}
|
||||
{else}
|
||||
{$parentKey=$parent_key|cat:"|"|cat:$k}
|
||||
{/if}
|
||||
{\app\widgets\ConfigTree::widget(['configLists' => $cf,'isRoot'=>false,'parent_id'=>$parent_id|cat:"_"|cat:$c,'parent_key'=>$parentKey])}
|
||||
{else}
|
||||
<b>:</b> <div contenteditable="" id="text_{$parent_id}_{$c}" data-parent="{$parent_key}" data-key="{$k}" class="editform">{$cf}</div>
|
||||
{/if}
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
Loading…
Reference in New Issue
Block a user