Commit eced9a46 authored by Ryan Herbert's avatar Ryan Herbert

my account: pass group_ids by json from group list

parent b9e1a5bb
......@@ -291,6 +291,34 @@ Database.prototype = {
});
},
callUrlJson : function(url, args) {
var self=this;
$.ajax({
type: "POST",
crossDomain: true,
url: url,
data: {'data': JSON.stringify(args)},
timeout: DB_TIMEOUT_CALL,
xhrFields: {withCredentials: true},
success: function (result) {
self.display_result(result, url, args)
self.connected = true;
},
error: function (request, status, error) {
self.connected = false;
if (status === "timeout") {
console.log({"type": "flash", "default" : "database_timeout", "priority": 2});
} else {
self.check_cert()
}
self.warn("callUrlJson: " + status + " - " + url.replace(self.db_address, '') + "?" + self.argsToStr(args))
}
});
},
callLinkable: function (linkable) {
var href = linkable.attr('href');
var type = linkable.data('linkable-type');
......@@ -1231,17 +1259,17 @@ Database.prototype = {
callGroupStats: function() {
var group_ids = [];
$('[name^="group_ids"]:checked').each(function() {
group_ids.push("group_ids=" + $(this).val());
group_ids.push($(this).val());
});
this.call('my_account/index?' + group_ids.join("&"));
this.callUrlJson(DB_ADDRESS + 'my_account/index', {'group_ids': group_ids});
},
callJobStats: function() {
var group_ids = [];
$('[name^="group_ids"]:checked').each(function() {
group_ids.push("group_ids=" + $(this).val());
group_ids.push($(this).val());
});
this.call('my_account/jobs?' + group_ids.join("&"));
this.callUrlJson(DB_ADDRESS + 'my_account/index', {'group_ids': group_ids});
},
stopGroupPropagate: function(e) {
......
......@@ -100,14 +100,13 @@ def get_most_used_tags(group_list):
)
def index():
import json
start = time.time()
since = datetime.today() - timedelta(days=30)
if auth.is_admin() and 'group_ids' in request.vars and request.vars['group_ids'] is not None:
group_list = request.vars['group_ids']
if isinstance(group_list, types.StringTypes):
group_list = [group_list]
if auth.is_admin() and 'data' in request.vars:
group_list = json.loads(request.vars['data'])['group_ids']
else:
group_list = [int(g.id) for g in auth.get_user_groups() + auth.get_user_group_parents()]
......
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