+ params = pagination.generate_uri(request.GET, ('page',))
+
+ if "save_filter" in request.POST:
+ filter_name = request.POST.get('filter_name', _('filter'))
+ params = pagination.generate_uri(request.GET, ('page',))
+ current_filters = settings.NODE_MAN_FILTERS.value
+ current_filters.append((filter_name, params))
+ settings.NODE_MAN_FILTERS.set_value(current_filters)
+
+ elif r"execute" in request.POST:
+ selected_nodes = request.POST.getlist('_selected_node')
+
+ if selected_nodes and request.POST.get('action', None):
+ action = str(request.POST['action'])
+ selected_nodes = Node.objects.filter(id__in=selected_nodes)
+
+ message = _("No action performed")
+
+ if action == 'delete_selected':
+ for node in selected_nodes:
+ if node.node_type in ('question', 'answer', 'comment') and (not node.nis.deleted):
+ DeleteAction(user=request.user, node=node, ip=request.META['REMOTE_ADDR']).save()
+
+ message = _("All selected nodes marked as deleted")
+
+ if action == 'undelete_selected':
+ for node in selected_nodes:
+ if node.node_type in ('question', 'answer', 'comment') and (node.nis.deleted):
+ node.nstate.deleted.cancel(ip=request.META['REMOTE_ADDR'])
+
+ message = _("All selected nodes undeleted")
+
+ if action == "close_selected":
+ for node in selected_nodes:
+ if node.node_type == "question" and (not node.nis.closed):
+ CloseAction(node=node.leaf, user=request.user, extra=_("bulk close"), ip=request.META['REMOTE_ADDR']).save()
+
+ message = _("Selected questions were closed")
+
+ if action == "hard_delete_selected":
+ ids = [n.id for n in selected_nodes]