plugins/db/templates/admin/db_manager/main.stpl
<h3>{t(Execute SQL)}</h3>
<form action="{form_action}" method="post" enctype="multipart/form-data">
{t(Paste SQL here)}
<textarea name="sql" cols="50" rows="5" style="width:100%"></textarea>
<br />
{t(Or select file to process)} ({t(Plain text, ZIP, GZIP allowed)})<br />
<input type="file" name="sql_file" value="">
<input type="submit" name="go" value="{t(EXECUTE)}" class="btn">
</form>
<h3>{t(All Tables List)} ({total})</h3>
<div>
<a href="{ajax_status_link}" id="ajax_status_link" class="btn">{t(Refresh Tables Status)}</a>
<a href="{backup_link}" class="btn">{t(Backup)}</a>
<span id="ajax_loading" class="label label-info" style="display:none;"><i class="icon-spin fa-spin icon icon-refresh fa fa-refresh"></i> {t(Loading)}</span>
</div>
<table id="tables" class="table table-bordered table-striped table-hover">
<thead>
<th></th>
<th>{t(Name)}</th>
<th>{t(Engine)}</th>
<th>{t(Collation)}</th>
<th>{t(Num rows)}</th>
<th>{t(Data Size)}</th>
<th>{t(Action)}</th>
</thead>
<tbody>
{tables}
</tbody>
{if("tables" ne "")}
<tfoot>
<tr id="total_info">
<td> </td>
<td> </td>
<td> </td>
<td>{total_rows}</td>
<td>{total_size}</td>
<td> </td>
</tr>
</tfoot>
{/if}
</table>
<label for="my_check_all">
<input type="checkbox" name='check_all' onclick="check_all()" check_status="0" id="my_check_all">
<b>Select all</b>
</label>
{actions_select_box}
<span id="loading" class="label label-info" style="display:none"><i class="icon-spin fa-spin icon-refresh fa fa-refresh"></i> {t(Loading)}</span>
<span id="status_message"></span>
{jquery()}
$("a#ajax_status_link").click(function(){
$("#ajax_loading").show();
$.post($(this).attr("href"), function(data) {
data = eval("(" + data + ")");
$("tr[id^=dbt_]").each(function() {
var _short_name = $(this).attr("id").substr(4);
var cur_data = data[_short_name];
if (!cur_data) {
return ;
}
$("td:eq(2)", this).html(cur_data["engine"]);
$("td:eq(3)", this).html(cur_data["collation"]);
$("td:eq(4)", this).html(cur_data["rows"]);
$("td:eq(5)", this).html(cur_data["data_size"]);
});
$("tr#total_info td:eq(4) b").html(data["__total_rows"]);
$("tr#total_info td:eq(5) b").html(data["__total_size"]);
$("#ajax_loading").hide();
})
return false;
});
{/jquery}
{js()}
function check_all (){
var check_status = $("#my_check_all").attr("check_status");
if(check_status == 0){
$("#tables input").attr("checked", true);
$("#my_check_all").attr("check_status", "1");
}else{
$("#tables input").attr("checked", false);
$("#my_check_all").attr("check_status", "0");
}
}
function group_action (){
var action = $("#group_action_select_box option:selected").val();
if(action == 0){
return;
}
// get selected tables
var tables = "";
$(".group_action:checked").each(function(){
tables += $(this).val() + ",";
});
if(tables == ""){
alert("Please select tables!");
$("#group_action_select_box option:first").attr("selected", true);
return;
}
if(!confirm(action + '?')){
$("#group_action_select_box option:first").attr("selected", true);
return;
}
$("#loading").css("display", "");
$("#status_message").html(action);
$.post("./?object=db_manager&action="+action, {
tables: tables
}, function (data){
$("#loading").css("display", "none");
$("#status_message").html(data);
});
}
{/js}