You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
information-system/application/views/bootstrap/static_url.php

98 lines
3.7 KiB
PHTML

<script language="javascript">
$(function() {
var idList = [];
var index = 0;
$("td[data-id]").each(function(index, element) {
idList[index] = $(element).data("id");
});
$("#startButton").click(function() {
batch_update_cache(idList[index]);
});
batch_get_backup(idList[index]);
function batch_update_cache(infoId) {
var $statusLabel = $("#status" + infoId);
$statusLabel.html("\u7a0d\u7b49...");
console.info("infoId: " + infoId + "; length: " + idList.length + "; index: " + index);
$.get("/info.php/welcome/change_static_url/" + infoId,
function(result) {
console.info(result);
$statusLabel.html(result.message);
index++;
if (index < idList.length) {
batch_update_cache(idList[index]);
}
});
}
function batch_get_backup(infoId) {
var $backupLabel = $("#backup" + infoId);
$backupLabel.html("\u7a0d\u7b49...");
$.get("/info.php/welcome/get_info_backup_id/" + infoId,
function(result) {
console.info(result);
if (result.status == 'success') {
$backupLabel.html(result.username + ', ' + result.datetime + ', ' + result.logId);
$backupLabel.attr('href', '/info.php/information/backup_content/' + result.logId);
} else {
$backupLabel.html('无');
}
index++;
if (index < idList.length) {
batch_get_backup(idList[index]);
}
});
}
});
function update_content(infoId) {
var $statusLabel = $("#status" + infoId);
$statusLabel.html("\u7a0d\u7b49...");
console.info("infoId: " + infoId);
$.get("/info.php/welcome/change_static_url/" + infoId,
function(result) {
console.info(result);
$statusLabel.html(result.message);
});
}
</script>
<div class="row-fluid">
<div class="span1">
</div>
<div class="span10">
<table class="table table-striped">
<thead>
<tr>
<th class="span1">#ID</th>
<th class="span9">URL</th>
<th class="span5">备份</th>
<th class="span2">操作</th>
<th class="span2"><button id="startButton">开始批量</button></th>
</tr>
</thead>
<tbody>
<?php
foreach ($all_information as $key => $info) {
if ($info->ic_status == 1 && !empty($info->ic_url)) {
?>
<tr>
<td data-id='<?php echo $info->is_id; ?>'><?php echo $info->is_id; ?></td>
<td class="cache_url"><?php echo $info->ic_url; ?></td>
<td><a target="_blank" id="backup<?php echo $info->is_id; ?>" href="javascript:;">查看</a></td>
<td>
<a href="javascript:update_content(<?php echo $info->is_id; ?>);">更换</a> |
<a target="_blank" href="/info.php/information/edit/<?php echo $info->is_id; ?>">看看</a>
</td>
<td id="status<?php echo $info->is_id; ?>"><i class="icon-refresh"></i></td>
</tr>
<?php }
} ?>
</tbody>
</table>
</div>
</div>