{combine_script id='LocalStorageCache' load='footer' path='admin/themes/default/js/LocalStorageCache.js'} {combine_script id='jquery.selectize' load='footer' path='themes/default/js/plugins/selectize.min.js'} {combine_css id='jquery.selectize' path="themes/default/js/plugins/selectize.default.css"} {footer_script} (function(){ {* *} var groupsCache = new LocalStorageCache('groupsAdminList', 5*60, function(callback) { jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.groups.getList&per_page=99999', function(data) { callback(data.result.groups); }); }); jQuery('[data-selectize=groups]').selectize({ valueField: 'id', labelField: 'name', searchField: ['name'], plugins: ['remove_button'] }); groupsCache.get(function(groups) { jQuery('[data-selectize=groups]').each(function() { this.selectize.load(function(callback) { callback(groups); }); jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, id) { this.selectize.addItem(id); }, this)); }); }); {* *} var usersCache = new LocalStorageCache('usersAdminList', 5*60, function(callback) { var page = 0, users = []; (function load(page){ jQuery.getJSON('{$ROOT_URL}ws.php?format=json&method=pwg.users.getList&display=username&per_page=99999&page='+ page, function(data) { users = users.concat(data.result.users); if (data.result.paging.count == data.result.paging.per_page) { load(++page); } else { callback(users); } }); }(page)); }); jQuery('[data-selectize=users]').selectize({ valueField: 'id', labelField: 'username', searchField: ['username'], plugins: ['remove_button'] }); usersCache.get(function(users) { jQuery('[data-selectize=users]').each(function() { this.selectize.load(function(callback) { callback(users); }); jQuery.each(jQuery(this).data('value'), jQuery.proxy(function(i, id) { this.selectize.addItem(id); }, this)); }); }); }()); {/footer_script}