diff --git a/web/js/events.js b/web/js/events.js
new file mode 100644
index 00000000..ccbf89ab
--- /dev/null
+++ b/web/js/events.js
@@ -0,0 +1,124 @@
+// Init kinda namespace object
+var VE = { // Vesta Events object
+ core: {}, // core functions
+ callbacks: { // events callback functions
+ click: {},
+ mouseover: {},
+ mouseout: {},
+ keypress: {}
+ },
+ helpers: {}, // simple handy methods
+ tmp: {}
+};
+
+/*
+ * Main method that invokes further event processing
+ * @param root is root HTML DOM element that. Pass HTML DOM Element or css selector
+ * @param event_type (eg: click, mouseover etc..)
+ */
+VE.core.register = function(root, event_type) {
+ var root = !root ? 'body' : root; // if elm is not passed just bind events to body DOM Element
+ var event_type = !event_type ? 'click' : event_type; // set event type to "click" by default
+ $(root).bind(event_type, function(evt) {
+ var elm = $(evt.target);
+ VE.core.dispatch(evt, elm, event_type); // dispatch captured event
+ });
+}
+
+/*
+ * Dispatch event that was previously registered
+ * @param evt related event object
+ * @param elm that was catched
+ * @param event_type (eg: click, mouseover etc..)
+ */
+VE.core.dispatch = function(evt, elm, event_type) {
+ if ('undefined' == typeof VE.callbacks[event_type]) {
+ return VE.helpers.warn('There is no corresponding object that should contain event callbacks for "'+event_type+'" event type');
+ }
+ // get class of element
+ var classes = $(elm).attr('class');
+ // if no classes are attached, then just stop any further processings
+ if (!classes) {
+ return; // no classes assigned
+ }
+ // split the classes and check if it related to function
+ $(classes.split(/\s/)).each(function(i, key) {
+ VE.callbacks[event_type][key] && VE.callbacks[event_type][key](evt, elm);
+ });
+}
+
+//
+// CALLBACKS
+//
+
+
+
+/*
+ * Suspend action
+ */
+VE.callbacks.click.do_suspend = function(evt, elm) {
+ var ref = elm.hasClass('data-controls') ? elm : elm.parents('.data-controls');
+ var url = $('input[name="suspend_url"]', ref).val();
+ var dialog_elm = ref.find('.confirmation-text-suspention');
+ VE.helpers.createConfirmationDialog(dialog_elm, 'Confirm SUSPEND', url);
+}
+
+/*
+ * Unsuspend action
+ */
+VE.callbacks.click.do_unsuspend = function(evt, elm) {
+ var ref = elm.hasClass('data-controls') ? elm : elm.parents('.data-controls');
+ var url = $('input[name="unsuspend_url"]', ref).val();
+ var dialog_elm = ref.find('.confirmation-text-suspention');
+ VE.helpers.createConfirmationDialog(dialog_elm, 'Confirm UNSUSPEND', url);
+}
+
+/*
+ * Delete action
+ */
+VE.callbacks.click.do_delete = function(evt, elm) {
+ var ref = elm.hasClass('data-controls') ? elm : elm.parents('.data-controls');
+ var url = $('input[name="delete_url"]', ref).val();
+ var dialog_elm = ref.find('.confirmation-text-delete');
+ VE.helpers.createConfirmationDialog(dialog_elm, 'Confirm DELETE', url);
+}
+
+
+/*
+ * Create dialog box on the fly
+ * @param elm Element which contains the dialog contents
+ * @param dialog_title
+ * @param confirmed_location_url URL that will be redirected to if user hit "OK"
+ * @param custom_config Custom configuration parameters passed to dialog initialization (optional)
+ */
+VE.helpers.createConfirmationDialog = function(elm, dialog_title, confirmed_location_url, custom_config) {
+ var custom_config = !custom_config ? {} : custom_config;
+ var config = {
+ modal: true,
+ autoOpen: true,
+ width: 360,
+ title: dialog_title,
+ close: function() {
+ $(this).dialog("destroy");
+ },
+ buttons: {
+ "Ok": function(event, ui) {
+ location.href = confirmed_location_url;
+ },
+ "Cancel": function() {
+ $(this).dialog("close");
+ $(this).dialog("destroy");
+ }
+ }
+ }
+ config = $.extend(config, custom_config);
+ var reference_copied = $(elm).clone();
+ $(reference_copied).dialog(config);
+}
+
+/*
+ * Simple debug output
+ */
+VE.helpers.warn = function(msg) {
+ alert('WARNING: ' + msg);
+}
diff --git a/web/templates/admin/list_backup.html b/web/templates/admin/list_backup.html
index 97492074..f7c50ed5 100644
--- a/web/templates/admin/list_backup.html
+++ b/web/templates/admin/list_backup.html
@@ -44,46 +44,6 @@
if (!empty($data[$key]['DB'])) $db = 'yes ยจ';
?>
-
-
@@ -96,19 +56,14 @@
|
- download |
-
-
- "> restore
- " title="Confirmation">
- Are you sure you want to restore backup?
-
- |
-
-
- delete
-
- Are you sure you want to delete backup?
+ download |
+ "> restore |
+
+
+ delete
+ " />
+
+ Are you sure you want to delete backup ?
|
|
diff --git a/web/templates/admin/list_cron.html b/web/templates/admin/list_cron.html
index 82fa93a1..a7379960 100644
--- a/web/templates/admin/list_cron.html
+++ b/web/templates/admin/list_cron.html
@@ -44,44 +44,6 @@
?>
-
|
@@ -93,18 +55,20 @@
|
- edit |
-
-
- ">
- " title="Confirmation">
- Are you sure you want to cron job?
+ edit |
+
+
+
+
+
+ Are you sure you want to cron job?/p>
|
-
-
- delete
-
+
+
+ delete
+
+
Are you sure you want to delete cron job?
|
diff --git a/web/templates/admin/list_db.html b/web/templates/admin/list_db.html
index b20e573b..52f141e3 100644
--- a/web/templates/admin/list_db.html
+++ b/web/templates/admin/list_db.html
@@ -48,44 +48,6 @@
if ($data[$key]['TYPE'] == 'pgsql') $db_admin_link = "http://".$http_host."/phpPgAdmin/";
?>
-
|
@@ -97,19 +59,21 @@
|
- open |
- edit |
-
-
- ">
- " title="Confirmation">
+ open |
+ edit |
+
+
+
+ " />
+
Are you sure you want to database?
|
-
-
- delete
-
+
+
+ delete
+ " />
+
Are you sure you want to delete database?
|
diff --git a/web/templates/admin/list_dns.html b/web/templates/admin/list_dns.html
index 1307d03e..f9db4e85 100644
--- a/web/templates/admin/list_dns.html
+++ b/web/templates/admin/list_dns.html
@@ -42,45 +42,6 @@
}
?>
-
-
@@ -93,20 +54,22 @@
|
- list records |
- add record |
- edit |
-
-
- ">
- " title="Confirmation">
- Are you sure you want to domain?
+ list records |
+ add record |
+ edit |
+
+
+
+
+
+ Are you sure you want to domain?
|
-
-
- delete
-
+
+
+ delete
+
+
Are you sure you want to delete domain?
|
diff --git a/web/templates/admin/list_dns_rec.html b/web/templates/admin/list_dns_rec.html
index a4b54ed7..95848038 100644
--- a/web/templates/admin/list_dns_rec.html
+++ b/web/templates/admin/list_dns_rec.html
@@ -43,45 +43,6 @@
}
?>
-
-
@@ -94,18 +55,20 @@
|
- edit |
-
-
- ">
- " title="Confirmation">
+ edit |
+
+
+
+
+
Are you sure you want to record?
|
-
-
- "> delete
- " title="Confirmation">
+
+
+ delete
+
+
Are you sure you want to delete record?
|
diff --git a/web/templates/admin/list_ip.html b/web/templates/admin/list_ip.html
index cac5aaad..8cdb05a5 100644
--- a/web/templates/admin/list_ip.html
+++ b/web/templates/admin/list_ip.html
@@ -35,28 +35,6 @@
++$i;
?>
-
-
@@ -69,11 +47,12 @@
|
- edit |
-
-
- delete
-
+ edit |
+
+
+ delete
+ " />
+
Are you sure you want to delete ip?
|
diff --git a/web/templates/admin/list_mail.html b/web/templates/admin/list_mail.html
index 64214095..23b13fbf 100644
--- a/web/templates/admin/list_mail.html
+++ b/web/templates/admin/list_mail.html
@@ -46,45 +46,6 @@
}
?>
-
-
@@ -97,21 +58,23 @@
|
- list accounts |
- add account |
- " target="_blank"> open webmail |
- edit |
-
-
- ">
- " title="Confirmation">
+ list accounts |
+ add account |
+ " target="_blank"> open webmail |
+ edit |
+
+
+
+
+
Are you sure you want to domain?
|
-
-
- delete
-
+
+
+ delete
+
+
Are you sure you want to delete domain?
|
diff --git a/web/templates/admin/list_mail_acc.html b/web/templates/admin/list_mail_acc.html
index f1caacda..188bc869 100644
--- a/web/templates/admin/list_mail_acc.html
+++ b/web/templates/admin/list_mail_acc.html
@@ -43,46 +43,6 @@
}
?>
-
-
@@ -95,18 +55,20 @@
|
- edit |
-
-
- ">
- " title="Confirmation">
- Are you sure you want to account?
+ edit |
+
+
+
+
+
+ Are you sure you want to account?
|
-
-
- "> delete
- " title="Confirmation">
+
+
+ delete
+
+
Are you sure you want to delete account?
|
diff --git a/web/templates/admin/list_packages.html b/web/templates/admin/list_packages.html
index 8cad84c7..417bb0aa 100644
--- a/web/templates/admin/list_packages.html
+++ b/web/templates/admin/list_packages.html
@@ -36,27 +36,6 @@
?>
-
|
@@ -68,12 +47,13 @@
|
- edit |
-
-
- delete
-
- Are you sure you want to delete package?
+ edit |
+
+
+ delete
+ " />
+
+ Are you sure you want to delete package?
|
|
diff --git a/web/templates/admin/list_rrd.html b/web/templates/admin/list_rrd.html
index 8a40462a..f12d93aa 100644
--- a/web/templates/admin/list_rrd.html
+++ b/web/templates/admin/list_rrd.html
@@ -44,7 +44,7 @@
diff --git a/web/templates/admin/list_user.html b/web/templates/admin/list_user.html
index 611eac0d..f3921edd 100644
--- a/web/templates/admin/list_user.html
+++ b/web/templates/admin/list_user.html
@@ -56,45 +56,6 @@
}
?>
-
-
@@ -107,10 +68,10 @@
|
-
+ |
logout";
+ echo " logout";
if (!empty($_SESSION['look_alert'])) {
?>
|
@@ -114,22 +76,25 @@
| |
';
- echo " open webstats ";
+ echo ' ';
+ echo "";
+ echo ' open webstats | ';
}
?>
- "> edit |
-
-
- ">
- " title="Confirmation">
+ "> edit |
+
+
+
+
+
Are you sure you want to domain?
|
-
-
- delete
-
+
+
+ delete
+
+
Are you sure you want to delete domain?
|
diff --git a/web/templates/footer.html b/web/templates/footer.html
index caf828f8..f1935d37 100644
--- a/web/templates/footer.html
+++ b/web/templates/footer.html
@@ -10,6 +10,13 @@
|
|
+
+
+
| | | | | | | | | | | | | | | | | | | | | | |