-
-
- logout: function()
- {
- window.onbeforeunload = function() { }; // false does not work for IE..
- Pman.Login.authUserId = -1;
- Roo.Ajax.request({
- url: baseURL + '/Login.html',
- params: {
- logout: 1
- },
- method: 'GET',
- failure : function() {
- Roo.MessageBox.alert("Error", "Error logging out. - continuing anyway.", function() {
- document.location = baseURL + '?ts=' + Math.random();
- });
-
- },
- success : function() {
- Pman.Login.authUserId = -1;
- Pman.Login.checkFails =0;
- // remove the
- document.location = baseURL + '?ts=' + Math.random();
- }
-
-
- });
- },
- switchLang : function (lang) {
- if (!lang.length) {
- return;
- }
- if (typeof(_T.en) == 'undefined') {
- _T.en = {};
- Roo.apply(_T.en, _T);
- }
-
- if (typeof(_T[lang]) == 'undefined') {
- Roo.MessageBox.alert("Sorry", "Language not available yet (" + lang +')');
- return;
- }
-
-
- Roo.apply(_T, _T[lang]);
- // just need to set the text values for everything...
- if (this.form) {
-
-
- function formLabel(name, val) {
-
- var lbl = Pman.Login.form.findField( name ).el.dom.parentNode.parentNode;
- if (lbl.getElementsByTagName('label').length) {
- lbl = lbl.getElementsByTagName('label')[0];
- } else {
- lbl = lbl.parentNode.getElementsByTagName('label')[0];
- }
-
- lbl.innerHTML = val;
- }
-
- formLabel('password', "Password"+':');
- formLabel('username', "Email Address"+':');
- formLabel('lang', "Language"+':');
- this.dialog.setTitle("Login");
- this.dialog.buttons[0].setText("Forgot Password");
- this.dialog.buttons[1].setText("Login");
- }
-
-
- },
-
- inGroup : function(g)
- {
- return this.authUser && this.authUser.groups &&
- this.authUser.groups.indexOf(g) > -1;
- },
- isOwner : function()
- {
- return this.authUser && this.authUser.company_id_comptype &&
- this.authUser.company_id_comptype == 'OWNER';
- },
-
- /**
- * Depreciated = use Pman.I18n
- */
-
- i18nList: function (type, codes)
- {
-
- return Pman.I18n.listToNames(type, codes);
- },
- i18n: function(type, code)
- {
- return Pman.I18n.toName(type, code);
-
- }
-
-
-});
-
-