<?php include _include(ADMIN_PATH.'view/htm/header.inc.htm');?>

<div class="row">
	<div class="col-lg-12">
		<div class="btn-group mb-3" role="group">
			<?php echo admin_tab_active($menu['setting']['tab'], 'extend');?>
		</div>
		<div class="card">
			<div class="card-body"> 
				<form action="<?php echo url('setting-extend');?>" method="post" id="form">
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('sitekeywords');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['site_keywords'];?>
						</div>
					</div>
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('runlevel_reason');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['runlevel_reason'];?> 
						</div>
					</div>
					
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('user_create_io');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['user_create_io'];?>
						</div>
					</div>
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('url_rewrite_on');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['url_rewrite_on'];?>
							<p class="d-inline "><a class="badge badge-secondary font-weight-normal" href="//bbs.xiuno.com/thread-2.htm" target="_blank"><i class="icon-exclamation-circle"></i>  <?php echo lang('url_rewrite_on_tip');?></a></p>
						</div>
					</div>					
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('cdn_on');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['cdn_on'];?>
						</div>
					</div>
					
					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('admin_bind_ip');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['admin_bind_ip'];?>
						</div>
					</div>

					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('pagesize');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['pagesize'];?>
						</div>
					</div>

					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('postlist_pagesize');?>：</label>
						<div class="col-sm-10">
							<?php echo $input['postlist_pagesize'];?>
						</div>
					</div>

					<div class="form-group row">
						<label class="col-sm-2 form-control-label"><?php echo lang('attach_maxsize');?>：</label>
						<div class="col col-sm-6 col-md-5 col-lg-3">
						    <div class="input-group">
								<?php echo $input['attach_maxsize'];?>
								<div class="input-group-append"><span class="input-group-text">Bytes</span></div>
							</div>
						</div>
						<div class="col-auto font-weight-normal">
							<button type="button" class="btn btn-secondary btn-sm" data-toggle="modal" data-target="#exampleModalLong"><?php echo lang('query');?></button>
							<!-- Modal -->
							<div class="modal fade" id="exampleModalLong" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
								<div class="modal-dialog modal-sm" role="document">
									<div class="modal-content">
									    <div class="modal-header">
									        <h5 class="modal-title" id="exampleModalLongTitle">Mb to Bytes</h5>
									        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
									            <span aria-hidden="true">&times;</span>
									        </button>
									    </div>
									    <div class="modal-body ">
									        <ul class="list-unstyled">
										        <li>1Mb = 1048576 Bytes</li>
											    <li>2Mb = 2097152 Bytes</li>
											    <li>3Mb = 3145728 Bytes</li>
											    <li>4Mb = 4194304 Bytes</li>
											    <li>5Mb = 5242880 Bytes</li>
											    <li>6Mb = 6291456 Bytes</li>
											    <li>7Mb = 7340032 Bytes</li>
											    <li>8Mb = 8388608 Bytes</li>
											    <li>9Mb = 9437184 Bytes</li>
											    <li>10Mb = 10485760 Bytes</li>
											    <li>15Mb = 15728640 Bytes</li>
											    <li>maxsize = 20480000 Bytes</li>
									        </ul>
									    </div>
									</div>
								</div>
							</div>
							<!-- END Modal -->
						</div>
					</div>

					<div class="form-group row">
						<label for="inputPassword3" class="col-sm-2 form-control-label"></label>
						<div class="col-sm-10">
							<button type="submit" class="btn btn-primary btn-block" id="submit" data-loading-text="<?php echo lang('submiting');?>..."><?php echo lang('confirm');?></button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

	
<?php include _include(ADMIN_PATH.'view/htm/footer.inc.htm');?>

<script>
var jform = $('#form');
var jsubmit = $('#submit');
jform.on('submit', function() {
	jform.reset();
	jsubmit.button('loading');
	var postdata = jform.serialize();
	$.xpost(jform.attr('action'), postdata, function(code, message) {
		if(code == 0) {
			$.alert(message);
			jsubmit.text(message).delay(1000).button('reset');
		} else if(code < 0) {
			$.alert(message);
			jsubmit.button('reset');
		} else {
			jform.find('[name="'+code+'"]').alert(message).focus();
			jsubmit.button('reset');
		}
	});
	return false;
});

$('#nav li.nav-item-setting').addClass('active');
//$('input[name="url_rewrite_on"][value="1"]').click(function(){ 虽然测试有效，但这种高科技的写法还是先不用了
$('input[name="url_rewrite_on"]:eq(0)').click(function(){
	return confirm('请在完成服务器端伪静态配置后开启\nBefore setting up，Please complete URL Rewrite setting for your server');
});
</script>

