Einstellungen angefangen
This commit is contained in:
@@ -730,7 +730,7 @@ class ListHelper {
|
||||
|
||||
class SettingsSite extends AbstractSite {
|
||||
constructor(siteManager) {
|
||||
super(siteManager, 'core/html/settings.html', "settings");
|
||||
super(siteManager, SettingsSite.template, "settings");
|
||||
for (let k in SettingsSite.settingsFragments) {
|
||||
this.addSettingsFragment(k, new SettingsSite.settingsFragments[k](this));
|
||||
}
|
||||
@@ -799,20 +799,32 @@ class SettingsSite extends AbstractSite {
|
||||
static setAddSettingsSite(addLink) {
|
||||
SettingsSite.shouldAddSettingsSite = addLink;
|
||||
}
|
||||
|
||||
static setTemplate(template) {
|
||||
SettingsSite.template = template;
|
||||
}
|
||||
}
|
||||
|
||||
SettingsSite.template = 'core/html/settings.html';
|
||||
SettingsSite.settingsFragments = {};
|
||||
SettingsSite.shouldAddSettingsSite = true;
|
||||
SettingsSite.settingsAction = null;
|
||||
SettingsSite.shouldAddSettingsAction = true;
|
||||
|
||||
InitPromise.addPromise(function (app) {
|
||||
if (SettingsSite.shouldAddSettingsSite) {
|
||||
app.addDeepLink("settings", SettingsSite);
|
||||
|
||||
let settingsAction = new MenuAction("settings", function () {
|
||||
app.startSite(SettingsSite);
|
||||
}, MenuAction.SHOW_FOR_LARGE, 10000);
|
||||
settingsAction.setIcon("img/settings.png");
|
||||
app.addDefaultAction(settingsAction);
|
||||
if (Helper.isNull(SettingsSite.settingsAction)) {
|
||||
let settingsAction = new MenuAction("settings", function () {
|
||||
app.startSite(SettingsSite);
|
||||
}, MenuAction.SHOW_FOR_LARGE, 10000);
|
||||
settingsAction.setIcon("img/settings.png");
|
||||
SettingsSite.settingsAction = settingsAction;
|
||||
}
|
||||
if (SettingsSite.shouldAddSettingsAction) {
|
||||
app.addDefaultAction(SettingsSite.settingsAction);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -3515,6 +3515,21 @@ class MyDb {
|
||||
});
|
||||
}
|
||||
|
||||
removeAll(objectStore){
|
||||
return new Promise((resolve) => {
|
||||
this.openStore(objectStore, "readwrite", (store) => {
|
||||
let req = store.clear();
|
||||
req.onerror = (e) => {
|
||||
throw {
|
||||
"type":"indexed-db-index-error",
|
||||
"event": e
|
||||
}
|
||||
};
|
||||
req.onsuccess = resolve;
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
upgrade(db) {
|
||||
};
|
||||
}
|
||||
@@ -3560,9 +3575,7 @@ class Prioritised {
|
||||
this.callbackCalledPromiseResolver();
|
||||
}
|
||||
|
||||
|
||||
if (prio == this.highestPrio) {
|
||||
console.log("endPromise resolved!");
|
||||
this.endPromiseResolver();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -441,34 +441,51 @@ InitPromise.addPromise(function(app){
|
||||
app.addDeepLink("forgotPassword", ForgotPasswordSite);
|
||||
});
|
||||
|
||||
class LoginSite extends UserSite{
|
||||
class LoginSite extends UserSite {
|
||||
constructor(siteManager) {
|
||||
super(siteManager, 'userManagement/html/login.html', "login", "offline");
|
||||
}
|
||||
|
||||
onFirstStart() {
|
||||
let self = this;
|
||||
(new LoginForm(document.getElementById("login-form"), "u/login", "post")).onSubmit(function(res){
|
||||
(new LoginForm(document.getElementById("login-form"), "u/login", "post")).onSubmit(function (res) {
|
||||
UserManager.setData(res);
|
||||
self.startStartsite();
|
||||
FlashMessenger.addMessage(FlashMessenger.MESSAGE_TYPE_SUCCESS, Translator.translate("login-success"));
|
||||
self.finish();
|
||||
});
|
||||
|
||||
this.findBy("#forgot-password-link").addEventListener("click", function(){
|
||||
this.findBy("#forgot-password-link").addEventListener("click", function () {
|
||||
self.startSite(ForgotPasswordSite);
|
||||
self.finish();
|
||||
});
|
||||
}
|
||||
}
|
||||
InitPromise.addPromise(function(app){
|
||||
|
||||
LoginSite.loginAction = null;
|
||||
LoginSite.logoutAction = null;
|
||||
LoginSite.addLoginAction = true;
|
||||
LoginSite.addLogoutAction = true;
|
||||
|
||||
InitPromise.addPromise(function (app) {
|
||||
app.addDeepLink("login", LoginSite);
|
||||
app.addDefaultAction(new UserAction('login', function(){
|
||||
app.startSite(LoginSite);
|
||||
}, Menu.SHOW_NEVER, 1100, "offline"));
|
||||
app.addDefaultAction(new UserAction('logout', function(){
|
||||
UserManager.logOut();
|
||||
}, Menu.SHOW_NEVER, 1100, "online"));
|
||||
|
||||
if (Helper.isNull(LoginSite.loginAction)) {
|
||||
LoginSite.loginAction = new UserAction('login', function () {
|
||||
app.startSite(LoginSite);
|
||||
}, Menu.SHOW_NEVER, 1100, "offline");
|
||||
}
|
||||
if (Helper.isNull(LoginSite.logoutAction)) {
|
||||
LoginSite.logoutAction = new UserAction('logout', function () {
|
||||
UserManager.logOut();
|
||||
}, Menu.SHOW_NEVER, 1100, "online");
|
||||
}
|
||||
if (LoginSite.addLoginAction){
|
||||
app.addDefaultAction(LoginSite.loginAction);
|
||||
}
|
||||
if (LoginSite.addLogoutAction){
|
||||
app.addDefaultAction(LoginSite.logoutAction);
|
||||
}
|
||||
});
|
||||
|
||||
class RegistrationSite extends UserSite {
|
||||
@@ -477,17 +494,26 @@ class RegistrationSite extends UserSite {
|
||||
}
|
||||
|
||||
onFirstStart() {
|
||||
(new RegistrationForm(document.getElementById("registration-form"), "u/registration", "post")).onSubmit(function(res){
|
||||
(new RegistrationForm(document.getElementById("registration-form"), "u/registration", "post")).onSubmit(function (res) {
|
||||
FlashMessenger.addMessage(FlashMessenger.MESSAGE_TYPE_SUCCESS, Translator.translate("registration-success"));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
RegistrationSite.action = null;
|
||||
RegistrationSite.addAction = true;
|
||||
|
||||
InitPromise.addPromise(function (app) {
|
||||
app.addDeepLink("registration", RegistrationSite);
|
||||
app.addDefaultAction(new UserAction('registration', function(){
|
||||
app.startSite(RegistrationSite);
|
||||
}, null, 1100, "offline"));
|
||||
|
||||
if (Helper.isNull(RegistrationSite.action)) {
|
||||
RegistrationSite.action = new UserAction('registration', function () {
|
||||
app.startSite(RegistrationSite);
|
||||
}, null, 1100, "offline");
|
||||
}
|
||||
if (RegistrationSite.addAction) {
|
||||
app.addDefaultAction(RegistrationSite.action);
|
||||
}
|
||||
});
|
||||
|
||||
class SetNewPasswordSite extends UserSite {
|
||||
|
||||
Reference in New Issue
Block a user