This is an automated email from the ASF dual-hosted git repository.
jfthomps pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/vcl.git
The following commit(s) were added to refs/heads/develop by this push:
new 9f794414 VCL-1150 - save user group filters in cookie so they persist
across page loads
9f794414 is described below
commit 9f7944140e66351d24a893acd89aac99323eaf76
Author: Josh Thompson <[email protected]>
AuthorDate: Thu Mar 7 16:08:17 2024 -0500
VCL-1150 - save user group filters in cookie so they persist across page
loads
utils.php: modified getDojoHTML: added dojo.cookie to $dojoRequires for
Manage Groups page
groups.js:
-modified usergroupGridFilter: added code to set GROUPFILTER cookie based
on current filters
-modified buildUserFilterStores: added call to setFiltersFromCookie, which
sets the filters from GROUPFILTER cookie
-added setFiltersFromCookie
---
web/.ht-inc/utils.php | 1 +
web/js/groups.js | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 60 insertions(+)
diff --git a/web/.ht-inc/utils.php b/web/.ht-inc/utils.php
index 3032e5a6..6e71c297 100644
--- a/web/.ht-inc/utils.php
+++ b/web/.ht-inc/utils.php
@@ -13867,6 +13867,7 @@ function getDojoHTML($refresh) {
'dojox.grid.DataGrid',
'dijit.TitlePane',
'dijit.Dialog',
+ 'dojo.cookie',
'dijit.Tooltip');
break;
case 'viewResources':
diff --git a/web/js/groups.js b/web/js/groups.js
index 796914e4..4543a39d 100644
--- a/web/js/groups.js
+++ b/web/js/groups.js
@@ -192,6 +192,7 @@ function usergroupGridFilter() {
query.push('courseroll');
}
var type = query.join('|');
+ var cookietype = query.join('_');
if(query.length == 0)
type = 'foo';
@@ -201,6 +202,9 @@ function usergroupGridFilter() {
if(editid == -1)
editid = 'NULL';
+ var cookiedata = "type:" + cookietype + "|owner:" + owner + "|name:" +
name + "|affilid:" + affilid + "|editgroupid:" + editid;
+ dojo.cookie('GROUPFILTER', cookiedata, {expires: 15, path: '/', domain:
cookiedomain});
+
usergroupgrid.setQuery({type: new RegExp(type),
owner: owner,
name: new RegExp(name, 'i'),
@@ -270,10 +274,65 @@ function buildUserFilterStores() {
}
dijit.byId('editgroupfilter').setStore(editgroupstore,
'', {query: {id: '*'}});
delete usergroupstore.editgroups;
+
+ setFiltersFromCookie();
}
});
}
+function setFiltersFromCookie() {
+ var tmp = dojo.cookie('GROUPFILTER');
+ var data = tmp.split('|');
+ dijit.byId('shownormal').set('value', 0);
+ dijit.byId('showfederated').set('value', 0);
+ dijit.byId('showcourseroll').set('value', 0);
+ var regex = new RegExp('normal');
+ if(data[0].match(regex)) {
+ dijit.byId('shownormal').set('value', 1);
+ }
+ regex = new RegExp('federated');
+ if(data[0].match(regex)) {
+ dijit.byId('showfederated').set('value', 1);
+ }
+ regex = new RegExp('courseroll');
+ if(data[0].match(regex)) {
+ dijit.byId('showcourseroll').set('value', 1);
+ }
+ var owner = data[1].split(':');
+ regex = new RegExp('^[-A-Za-z0-9_@\.]*$');
+ if(owner[1] == '*') {
+ dijit.byId('ownerfilter').set('value', 'all');
+ }
+ else if(owner[1].match(regex)) {
+ dijit.byId('ownerfilter').set('value', owner[1]);
+ }
+ var name = data[2].split(':');
+ regex = new RegExp('^\.\*[-A-Za-z0-9_@\.]*\.\*$');
+ if(name[1].match(regex)) {
+ var name2 = name[1].slice(2, -2);
+ dijit.byId('namefilter').set('value', name2);
+ }
+ var affilid = data[3].split(':');
+ regex = new RegExp('^[0-9]*$');
+ if(affilid[1] == '*') {
+ dijit.byId('affiliationfilter').set('value', 0);
+ }
+ else if(affilid[1].match(regex)) {
+ dijit.byId('affiliationfilter').set('value', affilid[1]);
+ }
+ var editgroupid = data[4].split(':');
+ regex = new RegExp('^[0-9]*$');
+ if(editgroupid[1] == '*') {
+ dijit.byId('editgroupfilter').set('value', 0);
+ }
+ else if(editgroupid[1] == 'NULL') {
+ dijit.byId('editgroupfilter').set('value', -1);
+ }
+ else if(editgroupid[1].match(regex)) {
+ dijit.byId('editgroupfilter').set('value', editgroupid[1]);
+ }
+}
+
function fmtResourceGroupDeleteBtn(groupid, rowIndex) {
var rowdata = this.grid.getItem(rowIndex);
if(rowdata.deletable == 0)