mirror of
https://github.com/zyx0814/dzzoffice.git
synced 2025-04-04 22:33:37 +08:00
356 lines
10 KiB
HTML
356 lines
10 KiB
HTML
<!--{template lyear:header_simple_start}-->
|
|
<link href="{MOD_PATH}/images/market1.css?{VERHASH}" rel="stylesheet" media="all">
|
|
<style>
|
|
.app_upgradelist{
|
|
margin: auto;
|
|
position: relative;
|
|
}
|
|
.app_upgradelist .upgrade_progess{
|
|
position: absolute;
|
|
bottom:0;
|
|
left: 0;
|
|
width:0%;
|
|
height: 10%;
|
|
}
|
|
.app_upgradelist .appicon {
|
|
padding: var(--radius);
|
|
float: left;
|
|
padding-right: 5px;
|
|
}
|
|
.app_upgradelist .appicon img {
|
|
max-width: 45px;
|
|
max-height: 45px;
|
|
margin: 0;
|
|
}
|
|
.app-info{
|
|
display:inline-block;
|
|
}
|
|
.app-info .select-info{
|
|
display:none;
|
|
}
|
|
</style>
|
|
<!--{template lyear:header_simple_end}-->
|
|
<main class="bs-main-container">
|
|
<div class="container-fluid">
|
|
<div class="card">
|
|
<!--{if $list}-->
|
|
<header class="card-header">
|
|
<div class="float-start">
|
|
<input class="form-check-input" type="checkbox" name="chkall" id="chkall">
|
|
<a href="{MOD_URL}" class="dcolor">{lang total}<span class="num">$count</span>{lang ge}{lang app}</a>
|
|
<div class="app-info">
|
|
<div class="app-info select-info">
|
|
{lang selected}<span class="num">0</span>{lang ge}{lang app}
|
|
<a class="btn btn-round btn-primary " id="update_selected" title="{lang update_onekey}" href="javascript:;" onclick="upgrade_all();"><i class="glyphicon glyphicon-upload"></i> {lang update_onekey}</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="float-end">
|
|
<button class="btn btn-round btn-primary" id="update_check" title="{lang app_upgrade_check_need_update}" onclick="upgrade_check(this);" data-loading-text="{lang app_upgrade_check_need_update}">{lang app_upgrade_check_need_update2}</button>
|
|
</div>
|
|
</header>
|
|
<div class="card-body">
|
|
<form id="appform" name="appform" class="form-horizontal" action="{MOD_URL}" method="post">
|
|
<input type="hidden" name="appsubmit" value="true" />
|
|
<input type="hidden" name="formhash" value="{FORMHASH}" />
|
|
<div class="table-responsive">
|
|
<table class="table table-hover align-middle">
|
|
<thead>
|
|
<tr>
|
|
<th>#</th>
|
|
<th>{lang application_name}</th>
|
|
<th>{lang installed}</th>
|
|
<th>{lang newest}</th>
|
|
<th>更新内容</th>
|
|
<th>{lang operation}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<!--{loop $list $value}-->
|
|
<tr id="app_div_{$value[appid]}" class="app_upgradelist">
|
|
<th scope="row">
|
|
<input type="checkbox" name="del[]" class="form-check-input" value="$value[appid]" data-mid="$value[mid]">
|
|
<label></label>
|
|
<div id="progess_{$value[appid]}">
|
|
<span id="upgrade_progess_{$value[appid]}" class="progress-bar progress-bar-striped progress-bar-animated upgrade_progess"></span>
|
|
</div>
|
|
</th>
|
|
<td>
|
|
{eval $appadminurl=replace_canshu($value['appadminurl']?$value['appadminurl']:$value['appurl'])}
|
|
<a href="$appadminurl" target="_blank" class="appicon"><img src="$value[appico]" style="margin:0" /></a><a class="dcolor" href="$appadminurl" target="_blank">$value[appname]</a>
|
|
<div class="appdesc form-text" title="$value['appdesc']">
|
|
{eval echo $value['upgrade_version']['desc_short']?$value['upgrade_version']['desc_short']:lang('none');}
|
|
</div>
|
|
</td>
|
|
<td>$value[version]</td>
|
|
<td>$value[upgrade_version][version]</td>
|
|
<td>$value[upgrade_version][desc]</td>
|
|
<td>
|
|
<a class="btn btn-round btn-primary btn-sm" id="upgrade_info_{$value[appid]}" href="javascript:;" onclick="start_check_upgrade('$value[appid]',1);" title="{lang update_onekey}">{lang update_onekey}</a>
|
|
</td>
|
|
</tr>
|
|
<!--{/loop}-->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!--{if $multi}-->
|
|
$multi
|
|
<!--{/if}-->
|
|
</form>
|
|
</div>
|
|
<!--{else}-->
|
|
<div class="card-body">
|
|
<div class="text-center">
|
|
<img src="static/image/common/no_list.png" /><br>
|
|
<span class="lead">还没有可以升级的应用…</span><br>
|
|
<button class="btn btn-outline-primary btn-round" id="update_check" title="{lang app_upgrade_check_need_update}" onclick="upgrade_check(this);" data-loading-text="{lang app_upgrade_check_need_update}">{lang app_upgrade_check_need_update2}</button>
|
|
</div>
|
|
</div>
|
|
<!--{/if}-->
|
|
</div>
|
|
</div>
|
|
</main>
|
|
<script type="text/javascript">
|
|
var upgrade=false;
|
|
var appids=[];
|
|
var mids=[];
|
|
var nowupgradeappid=0;
|
|
jQuery('input[name="del[]"]').on('change',function(){
|
|
//console.log('change==='+this.value);
|
|
checkSelected();
|
|
});
|
|
jQuery('#chkall').on('change',function(){
|
|
if(jQuery(this).prop('checked')){
|
|
jQuery('input[name="del[]"]').prop('checked',true);
|
|
}else{
|
|
jQuery('input[name="del[]"]').prop('checked',false);
|
|
}
|
|
checkSelected();
|
|
});
|
|
|
|
function checkSelected(){
|
|
var i=0;
|
|
appids=[];
|
|
mids=[];
|
|
jQuery('input[name="del[]"]').each(function(){
|
|
//console.log(this);
|
|
if(jQuery(this).prop('checked')){
|
|
appids.push(this.value);
|
|
mids.push(jQuery(this).data("mid"));
|
|
}
|
|
i++;
|
|
});
|
|
var num=appids.length;
|
|
//console.log([i,num]);
|
|
if(num>0){
|
|
jQuery('.select-info').show().find('.num').text(num);
|
|
if(i>0 && i==num){//全部选中时
|
|
jQuery('#chkall').prop('checked',true);
|
|
}else{
|
|
jQuery('#chkall').prop('checked',false);
|
|
}
|
|
}else{
|
|
jQuery('.select-info').hide().find('.num').text('0');
|
|
}
|
|
}
|
|
function upgrade_check(obj){//强制检测更新,不受一天一次的限制,一般用于刚上传或修改了应用的配置信息,通过这个按钮可以强制刷新出需要更新的应用
|
|
var loader = $('body').lyearloading({
|
|
opacity: 0.2,
|
|
spinnerSize: 'lg',
|
|
spinnerText: '正在检测新版本中',
|
|
textColorClass: 'text-info',
|
|
spinnerColorClass: 'text-info'
|
|
});
|
|
jQuery(obj).button('loading');
|
|
jQuery.post('{MOD_URL}&op=check_upgrade',function(json){
|
|
var oldsum=parseInt(jQuery('#update_app_num').text());
|
|
if(json.sum!=oldsum){
|
|
window.location.reload();
|
|
}else{
|
|
loader.destroy();
|
|
showmessage('没有检测到新的更新','info',1000,1);
|
|
}
|
|
jQuery(obj).button('reset');
|
|
},'json')
|
|
.fail(function (jqXHR, textStatus, errorThrown) {
|
|
loader.destroy();
|
|
// 这里处理请求失败的情况
|
|
showmessage('请求失败: ' + textStatus, 'error', 3000, 1);
|
|
});
|
|
}
|
|
function upgrade_all(){
|
|
var num=appids.length;
|
|
if( upgrade ){
|
|
alert("正在升级,请稍等...");
|
|
return false;
|
|
}
|
|
if(num>0){
|
|
start_check_upgrade( 0 ,2);
|
|
}
|
|
}
|
|
|
|
function start_check_upgrade(appid,s){
|
|
var url="";
|
|
var appid = parseInt(appid);
|
|
var url_s='{MOD_URL}&op=upgrade_app_ajax&operation=check_upgrade&appid=';
|
|
if( upgrade ){
|
|
//alert("正在升级,请稍等...");
|
|
return false;
|
|
}
|
|
upgrade=true;
|
|
if( s==2 ){
|
|
if(nowupgradeappid==0 && appids.length>0 ){
|
|
url=url_s+appids[0];
|
|
nowupgradeappid=appids[0];
|
|
appids.shift();
|
|
}else{
|
|
url=url_s+nowupgradeappid;
|
|
}
|
|
}else{
|
|
if( appid==0 || isNaN(appid) ){
|
|
appid=nowupgradeappid;
|
|
}
|
|
url=url_s+appid;
|
|
nowupgradeappid=appid;
|
|
}
|
|
|
|
jQuery.ajax({
|
|
type:'GET',
|
|
async: false,
|
|
url:url,
|
|
data:{},
|
|
success:function(json){
|
|
if(json.status==0){
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
nowupgradeappid=0;
|
|
upgrade=false;
|
|
if( appids.length>0 && s==2){
|
|
nowupgradeappid=0;
|
|
url=url_s+appids[0];
|
|
start_check_upgrade(url,s);
|
|
}
|
|
}else{
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
jQuery('#upgrade_progess_'+nowupgradeappid).animate({width:json.percent+"%"},json.second,function(){
|
|
if(json.mid>0){
|
|
startupgrade(json.url,s);
|
|
}else{
|
|
upgradeover(json.url,s);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
// 添加错误处理
|
|
error: function(xhr, status, error) {
|
|
showmessage('Request failed:' + status +' ' +error, 'error', 3000, 1);
|
|
}
|
|
});
|
|
}
|
|
|
|
function startupgrade(url,s){
|
|
jQuery.ajax({
|
|
type:'GET',
|
|
async: false,
|
|
url:url,
|
|
data:{},
|
|
success:function(json){
|
|
if(json.status==0){
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
upgrade=false;
|
|
}else{
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
jQuery('#upgrade_progess_'+nowupgradeappid).animate({width:json.percent+"%"},json.second,function(){
|
|
startgetcrossorpatchfile(json.url,s);
|
|
});
|
|
}
|
|
},
|
|
// 添加错误处理
|
|
error: function(xhr, status, error) {
|
|
showmessage('Request failed:' + status +' ' +error, 'error', 3000, 1);
|
|
}
|
|
});
|
|
}
|
|
|
|
function startgetcrossorpatchfile(url,s){
|
|
jQuery.ajax({
|
|
type:'GET',
|
|
async: false,
|
|
url:url,
|
|
data:{},
|
|
success:function(json){
|
|
if(json.status==0){
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
upgrade=false;
|
|
}else{
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
jQuery('#upgrade_progess_'+nowupgradeappid).animate({width:json.percent+"%"},json.second,function(){
|
|
if(json.step==2){
|
|
startgetcrossorpatchfile(json.url,s);
|
|
}else{
|
|
startupgradefile(json.url,s);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
// 添加错误处理
|
|
error: function(xhr, status, error) {
|
|
showmessage('Request failed:' + status +' ' +error, 'error', 3000, 1);
|
|
}
|
|
});
|
|
}
|
|
|
|
function startupgradefile(url,s){
|
|
jQuery.ajax({
|
|
type:'GET',
|
|
async: false,
|
|
url:url,
|
|
data:{},
|
|
success:function(json){
|
|
if(json.status==0){
|
|
upgrade=false;
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
}else{
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
jQuery('#upgrade_progess_'+nowupgradeappid).animate({width:json.percent+"%"},json.second,function(){
|
|
if(json.step!=5){
|
|
startupgradefile(json.url,s);
|
|
}else{
|
|
upgradeover(json.url,s);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
// 添加错误处理
|
|
error: function(xhr, status, error) {
|
|
showmessage('Request failed:' + status +' ' +error, 'error', 3000, 1);
|
|
}
|
|
});
|
|
}
|
|
|
|
function upgradeover(url,s){
|
|
jQuery.ajax({
|
|
type:'GET',
|
|
async: false,
|
|
url:url,
|
|
data:{},
|
|
success:function(json){
|
|
if(json.status==0){
|
|
upgrade=false;
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
}else{
|
|
jQuery('#upgrade_info_'+nowupgradeappid).html(json.msg);
|
|
jQuery('#upgrade_progess_'+nowupgradeappid).animate({width:"100%"},300,function(){
|
|
jQuery('#upgrade_progess_'+nowupgradeappid).css("width","0%");
|
|
upgrade=false;
|
|
start_check_upgrade(json.url,s);
|
|
});
|
|
}
|
|
},
|
|
// 添加错误处理
|
|
error: function(xhr, status, error) {
|
|
showmessage('Request failed:' + status +' ' +error, 'error', 3000, 1);
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
<!--{template lyear:footer_simple}--> |