Merge branch 'feature/mobile-apps-on-reactjs' into feature/mobile-apps-on-reactjs-new-test

This commit is contained in:
JuliaSvinareva 2020-11-23 17:07:24 +03:00
commit 0d525a900f

View file

@ -117,7 +117,8 @@ var utils = new(function() {
Signature : 9,
Pivot : 10,
Cell : 11,
Slicer : 12
Slicer : 12,
Form : 13
},
importTextType = {
DRM: 0,
@ -727,6 +728,7 @@ Common.Utils.fillUserInfo = function(info, lang, defname) {
var _user = info || {};
!_user.id && (_user.id = ('uid-' + Date.now()));
_user.fullname = !_user.name ? defname : _user.name;
_user.group && (_user.fullname = (_user.group).toString() + Common.Utils.UserInfoParser.getSeparator() + _user.fullname);
return _user;
};
@ -777,6 +779,8 @@ Common.Utils.loadConfig = function(url, callback) {
else return 'error';
}).then(function(json){
callback(json);
}).catch(function(e) {
callback('error');
});
};
@ -975,3 +979,35 @@ Common.Utils.ModalWindow = new(function() {
}
}
})();
Common.Utils.UserInfoParser = new(function() {
var parse = false;
var separator = String.fromCharCode(160);
return {
setParser: function(value) {
parse = !!value;
},
getSeparator: function() {
return separator;
},
getParsedName: function(username) {
if (parse && username) {
return username.substring(username.indexOf(separator)+1);
} else
return username;
},
getParsedGroups: function(username) {
if (parse && username) {
var idx = username.indexOf(separator),
groups = (idx>-1) ? username.substring(0, idx).split(',') : [];
for (var i=0; i<groups.length; i++)
groups[i] = groups[i].trim();
return groups;
} else
return undefined;
}
}
})();