Commit 95bb96eb authored by halcyon's avatar halcyon

各种bug修改

parent e81eefcf
...@@ -12,13 +12,13 @@ urlpatterns = patterns('', ...@@ -12,13 +12,13 @@ urlpatterns = patterns('',
url(r'^idc_add/$', add_idc), url(r'^idc_add/$', add_idc),
url(r'^idc_list/$', list_idc), url(r'^idc_list/$', list_idc),
url(r'^idc_detail/$', detail_idc), url(r'^idc_detail/$', detail_idc),
url(r'^idc_del/(\d+)/$', del_idc), url(r'^idc_del/(\w+)/$', del_idc),
url(r'^jgroup_add/$', add_group), url(r'^jgroup_add/$', add_group),
url(r'^group_edit/$', edit_group), url(r'^group_edit/$', edit_group),
url(r'^jgroup_list/$', list_group), url(r'^jgroup_list/$', list_group),
url(r'^group_detail/$', detail_group), url(r'^group_detail/$', detail_group),
url(r'^group_del_host/(\w+)/$', group_del_host), url(r'^group_del_host/(\w+)/$', group_del_host),
url(r'^group_del/(\d+)/$', group_del), url(r'^group_del/(\w+)/$', group_del),
url(r'^host_del/(\w+)/$', host_del), url(r'^host_del/(\w+)/$', host_del),
url(r'^host_edit/$', host_edit), url(r'^host_edit/$', host_edit),
url(r'^host_edit/batch/$', batch_host_edit), url(r'^host_edit/batch/$', batch_host_edit),
......
...@@ -251,7 +251,15 @@ def list_idc(request): ...@@ -251,7 +251,15 @@ def list_idc(request):
def del_idc(request, offset): def del_idc(request, offset):
IDC.objects.filter(id=offset).delete() if offset == 'multi':
len_list = request.POST.get("len_list")
for i in range(int(len_list)):
key = "id_list[" + str(i) + "]"
gid = request.POST.get(key)
IDC.objects.filter(id=gid).delete()
else:
gid = int(offset)
IDC.objects.filter(id=gid).delete()
return HttpResponseRedirect('/jasset/idc_list/') return HttpResponseRedirect('/jasset/idc_list/')
...@@ -354,8 +362,18 @@ def group_del_host(request, offset): ...@@ -354,8 +362,18 @@ def group_del_host(request, offset):
def group_del(request, offset): def group_del(request, offset):
BisGroup.objects.filter(id=offset).delete() if offset == 'multi':
return HttpResponseRedirect('/jasset/group_list/') len_list = request.POST.get("len_list")
for i in range(int(len_list)):
key = "id_list[" + str(i) + "]"
gid = request.POST.get(key)
BisGroup.objects.filter(id=gid).delete()
else:
gid = int(offset)
BisGroup.objects.filter(id=gid).delete()
return HttpResponseRedirect('/jasset/jgroup_list/')
def host_search(request): def host_search(request):
......
...@@ -38,7 +38,13 @@ ...@@ -38,7 +38,13 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="row">
<div class="col-sm-6">
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />
</div>
{% include 'paginator.html' %} {% include 'paginator.html' %}
</div>
</form> </form>
</div> </div>
</div> </div>
...@@ -46,4 +52,28 @@ ...@@ -46,4 +52,28 @@
</div> </div>
</div> </div>
<script>
function del(form) {
var checkboxes = document.getElementById(form);
var id_list = {};
var j = 0;
for (var i = 0; i < checkboxes.elements.length; i++) {
if (checkboxes.elements[i].type == "checkbox" && checkboxes.elements[i].checked == true && checkboxes.elements[i].value != "checkall") {
id_list[j] = checkboxes.elements[i].value;
j++;
}
}
if (confirm("确定删除")) {
$.ajax({
type: "POST",
url: "/jasset/group_del/multi/",
data: {"id_list": id_list, "len_list": j},
success: function (data) {
window.open("/jasset/jgroup_list/", "_self");
}
});
}
}
</script>
{% endblock %} {% endblock %}
...@@ -81,7 +81,13 @@ ...@@ -81,7 +81,13 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="row">
<div class="col-sm-6">
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />
</div>
{% include 'paginator.html' %} {% include 'paginator.html' %}
</div>
</form> </form>
</div> </div>
</div> </div>
......
...@@ -40,38 +40,7 @@ ...@@ -40,38 +40,7 @@
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" /> <input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" /> <input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />
</div> </div>
<div class="col-sm-6"> {% include 'paginator.html' %}
<div class="dataTables_paginate paging_simple_numbers" id="editable_paginate">
<ul class="pagination" style="margin-top: 0; float: right">
{% if contacts.has_previous %}
<li class="paginate_button previous" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="?id={{ group_id }}&page={{ contacts.previous_page_number }}">Previous</a>
</li>
{% else %}
<li class="paginate_button previous disabled" aria-controls="editable" tabindex="0" id="editable_previous">
<a href="#">Previous</a>
</li>
{% endif %}
{% for page in page_range %}
{% ifequal current_page page %}
<li class="paginate_button active" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% else %}
<li class="paginate_button" aria-controls="editable" tabindex="0"><a href="?keyword={{ keyword }}&page={{ page }}" title="第{{ page }}页">{{ page }}</a></li>
{% endifequal %}
{% endfor %}
{% if contacts.has_next %}
<li class="paginate_button next" aria-controls="editable" tabindex="0" id="editable_next">
<a href="?id={{ group_id }}&page={{ contacts.next_page_number }}">Next</a>
</li>
{% else %}
<li class="paginate_button next disabled" aria-controls="editable" tabindex="0" id="editable_next">
<a href="#">Next</a>
</li>
{% endif %}
</ul>
</div>
</div>
</div> </div>
<script> <script>
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
<a target="_blank" href="/jasset/idc_add" class="btn btn-sm btn-primary "> 添加IDC </a> <a target="_blank" href="/jasset/idc_add" class="btn btn-sm btn-primary "> 添加IDC </a>
</div> </div>
<form id="contents_form" name="contents_form">
<table class="table table-striped table-bordered table-hover " id="editable" > <table class="table table-striped table-bordered table-hover " id="editable" >
<thead> <thead>
<tr> <tr>
...@@ -36,11 +37,42 @@ ...@@ -36,11 +37,42 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="row">
<div class="col-sm-6">
<input type="button" id="del_button" class="btn btn-danger btn-sm" name="del_button" value="删除" onclick="del('contents_form')" />
<input type="button" id="alter_button" class="btn btn-warning btn-sm" name="alter_button" value="修改" onclick="alter('contents_form')" />
</div>
{% include 'paginator.html' %} {% include 'paginator.html' %}
</div> </div>
</form>
</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<script>
function del(form) {
var checkboxes = document.getElementById(form);
var id_list = {};
var j = 0;
for (var i = 0; i < checkboxes.elements.length; i++) {
if (checkboxes.elements[i].type == "checkbox" && checkboxes.elements[i].checked == true && checkboxes.elements[i].value != "checkall") {
id_list[j] = checkboxes.elements[i].value;
j++;
}
}
if (confirm("确定删除")) {
$.ajax({
type: "POST",
url: "/jasset/idc_del/multi/",
data: {"id_list": id_list, "len_list": j},
success: function (data) {
window.open("/jasset/idc_list/", "_self");
}
});
}
}
</script>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -96,12 +96,16 @@ ...@@ -96,12 +96,16 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="row">
<div class="col-sm-6">
</div>
{% include 'paginator.html' %} {% include 'paginator.html' %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
......
...@@ -96,12 +96,16 @@ ...@@ -96,12 +96,16 @@
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>
<div class="row">
<div class="col-sm-6">
</div>
{% include 'paginator.html' %} {% include 'paginator.html' %}
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment