From 1a485fd6abef7a969edbd43cd028e7d351bfdd8a Mon Sep 17 00:00:00 2001
From: Pascal Dreissen <pascal@dreissen.nl>
Date: Tue, 05 Jul 2016 11:09:43 -0400
Subject: [PATCH] Merge branch 'missing_fonts' into 'stable-3.1'
---
interface/web/themes/default/assets/javascripts/ispconfig.js | 101 +++++++++++++++++---------------------------------
1 files changed, 35 insertions(+), 66 deletions(-)
diff --git a/interface/web/themes/default/assets/javascripts/ispconfig.js b/interface/web/themes/default/assets/javascripts/ispconfig.js
index 66e04e8..d791b19 100644
--- a/interface/web/themes/default/assets/javascripts/ispconfig.js
+++ b/interface/web/themes/default/assets/javascripts/ispconfig.js
@@ -23,11 +23,7 @@
},
reportError: function(request) {
- /* Error reporting is disabled by default as some browsers like safari
- sometimes throw errors when a ajax request is delayed even if the
- ajax request worked. */
-
- /*alert(request);*/
+
},
registerHook: function(name, callback) {
@@ -138,58 +134,11 @@
'fontAwesome': true,
'autoclose': true
});
+ $('[data-toggle="tooltip"]').tooltip({
+ });
ISPConfig.callHook('onAfterContentLoad', {'url': url, 'data': data });
},
-
- /* THIS ONE SHOULD BE REMOVED AFTER CREATING THE STATIC LOGIN PAGE!!! */
- /*submitLoginForm: function(formname) {
- //* Validate form. TODO: username and password with strip();
- var frm = document.getElementById(formname);
- var userNameObj = frm.username;
- if(userNameObj.value == ''){
- userNameObj.focus();
- return;
- }
- var passwordObj = frm.passwort;
- if(passwordObj.value == ''){
- passwordObj.focus();
- return;
- }
-
- $('#dummy_username').val(userNameObj.value);
- $('#dummy_passwort').val(passwordObj.value);
- $('#dummy_login_form').submit();
-
- var submitFormObj = $.ajax({
- type: "POST",
- url: "content.php",
- data: $('#'+formname).serialize(),
- dataType: "html",
- beforeSend: function() {
- ISPConfig.showLoadIndicator();
- },
- success: function(data, textStatus, jqXHR) {
- if(jqXHR.responseText.indexOf('HEADER_REDIRECT:') > -1) {
- var parts = jqXHR.responseText.split(':');
- ISPConfig.loadContent(parts[1]);
- } else if (jqXHR.responseText.indexOf('LOGIN_REDIRECT:') > -1) {
- // Go to the login page
- document.location.href = 'index.php';
- } else {
- $('#pageContent').html(jqXHR.responseText);
- ISPConfig.onAfterContentLoad('content.php', $('#'+formname).serialize());
- ISPConfig.pageFormChanged = false;
- }
- ISPConfig.loadMenus();
- ISPConfig.hideLoadIndicator();
- },
- error: function() {
- ISPConfig.hideLoadIndicator();
- ISPConfig.reportError('Ajax Request was not successful.110');
- }
- });
- },*/
submitForm: function(formname, target, confirmation) {
var successMessage = arguments[3];
@@ -320,11 +269,6 @@
var newUrl= jqXHR.responseText.substr(jqXHR.responseText.indexOf('URL_REDIRECT:') + "URL_REDIRECT:".length);
document.location.href = newUrl;
} else {
- //document.getElementById('pageContent').innerHTML = jqXHR.responseText;
- //var reponse = $(jqXHR.responseText);
- //var reponseScript = reponse.filter("script");
- //$.each(reponseScript, function(idx, val) { eval(val.text); } );
-
$('#pageContent').html(jqXHR.responseText);
ISPConfig.onAfterContentLoad(pagename, (params ? params : null));
ISPConfig.pageFormChanged = false;
@@ -364,9 +308,11 @@
},
loadInitContent: function() {
+ var startpage = $('#pageContent').attr('data-startpage');
+ if(!startpage) startpage = 'dashboard/dashboard.php';
var pageContentObject = $.ajax({
type: "GET",
- url: "dashboard/dashboard.php",
+ url: startpage,
data: "",
dataType: "html",
beforeSend: function() {
@@ -442,7 +388,10 @@
},
changeTab: function(tab, target, force) {
- if(ISPConfig.requestsRunning > 0) return false;
+ if(ISPConfig.requestsRunning > 0) {
+ console.log('tab change interrupted, request still running.');
+ return false;
+ }
document.pageForm.next_tab.value = tab;
@@ -616,9 +565,17 @@
}
});
+var $page = $('html, body');
+
$(document).on('click', 'a[data-load-content],button[data-load-content]', function(e) {
e.preventDefault();
- $('html, body').animate({scrollTop: 0}, 1000);
+ if(ISPConfig.requestsRunning > 0) {
+ console.log('preventing click because there is still a request running.');
+ return;
+ }
+
+ $page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+ $page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
var content_to_load = $(this).attr('data-load-content');
if(!content_to_load) return this;
@@ -628,7 +585,13 @@
$(document).on('click', 'a[data-capp],button[data-capp]', function(e) {
e.preventDefault();
- $('html, body').animate({scrollTop: 0}, 1000);
+ if(ISPConfig.requestsRunning > 0) {
+ console.log('preventing click because there is still a request running.');
+ return;
+ }
+
+ $page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+ $page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
var content_to_load = $(this).attr('data-capp');
if(!content_to_load) return this;
@@ -638,7 +601,13 @@
$(document).on('click', 'a[data-submit-form],button[data-submit-form]', function(e) {
e.preventDefault();
- $('html, body').animate({scrollTop: 0}, 1000);
+ if(ISPConfig.requestsRunning > 0) {
+ console.log('preventing click because there is still a request running.');
+ return;
+ }
+
+ $page.on('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); });
+ $page.animate({scrollTop: 0}, 1000, function() { $page.off('scroll mousedown wheel DOMMouseScroll mousewheel keyup touchmove', function() { $page.stop(); }); });
var $el = $(this);
var act = $el.attr('data-form-action');
@@ -655,9 +624,9 @@
$("#pageForm .table #Filter").trigger('click');
}
//Use $ submit with keypress Enter in forms
- if (event.which == '13' && $(".pnl_formsarea button.positive").length > 0 && event.target.localName != 'textarea' && $(event.target).is(':input')) {
+ if (event.which == '13' && $(".tab-content button.formbutton-success").length > 0 && event.target.localName != 'textarea' && $(event.target).is(':input')) {
event.preventDefault();
- $(".pnl_formsarea button.positive:first").not("[disabled='disabled']").trigger('click');
+ $(".tab-content button.formbutton-success").not("[disabled='disabled']").trigger('click');
}
});
--
Gitblit v1.9.1