| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,111 @@ |
| 1 |
+/** |
|
| 2 |
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 3 |
+ * |
|
| 4 |
+ * @author Double Bastion LLC |
|
| 5 |
+ * |
|
| 6 |
+ * @license GNU AGPL version 3 or any later version |
|
| 7 |
+ * |
|
| 8 |
+ * This program is free software; you can redistribute it and/or |
|
| 9 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 10 |
+ * License as published by the Free Software Foundation; either |
|
| 11 |
+ * version 3 of the License, or any later version. |
|
| 12 |
+ * |
|
| 13 |
+ * This program is distributed in the hope that it will be useful, |
|
| 14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 17 |
+ * |
|
| 18 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 19 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 20 |
+ * |
|
| 21 |
+ */ |
|
| 22 |
+ |
|
| 23 |
+$(document).ready(function() {
|
|
| 24 |
+ |
|
| 25 |
+ // Send the CSRF token as an HTTP header |
|
| 26 |
+ XMLHttpRequest.prototype.open = (function(open) {
|
|
| 27 |
+ return function(method,url,async) {
|
|
| 28 |
+ open.apply(this,arguments); |
|
| 29 |
+ this.setRequestHeader('requesttoken', OC.requestToken);
|
|
| 30 |
+ }; |
|
| 31 |
+ })(XMLHttpRequest.prototype.open); |
|
| 32 |
+ |
|
| 33 |
+ $("#save_fax_settings").on("click", function(event) {
|
|
| 34 |
+ |
|
| 35 |
+ event.preventDefault(); |
|
| 36 |
+ OC.msg.startAction("#paxfax_save_msg", t("pax_fax", "Saved"));
|
|
| 37 |
+ |
|
| 38 |
+ var baseUrl = OC.generateUrl("/apps/pax_fax/user/updatesettings");
|
|
| 39 |
+ var getnotify = 0; |
|
| 40 |
+ |
|
| 41 |
+ if ($("#get_notification").is(':checked')) {
|
|
| 42 |
+ getnotify = 1; |
|
| 43 |
+ } |
|
| 44 |
+ |
|
| 45 |
+ var emailaddressinit = $("#notification_email").val();
|
|
| 46 |
+ |
|
| 47 |
+ function validate_email($email) {
|
|
| 48 |
+ var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
| 49 |
+ return email_reg.test($email); |
|
| 50 |
+ } |
|
| 51 |
+ |
|
| 52 |
+ if (validate_email(emailaddressinit)) {
|
|
| 53 |
+ var notifyemail = emailaddressinit; |
|
| 54 |
+ } else {
|
|
| 55 |
+ var notifyemail = ''; |
|
| 56 |
+ } |
|
| 57 |
+ |
|
| 58 |
+ var datatosave = {
|
|
| 59 |
+ apiKey: $("#api_key").val(),
|
|
| 60 |
+ apiSecret: $("#api_secret").val(),
|
|
| 61 |
+ webhookToken: $("#webhook_token").val(),
|
|
| 62 |
+ receiveUrl: $("#receive_url").val(),
|
|
| 63 |
+ sinchProjectId: $("#sinch_project_id").val(),
|
|
| 64 |
+ sinchKeyId: $("#sinch_key_id").val(),
|
|
| 65 |
+ sinchKeySecret: $("#sinch_key_secret").val(),
|
|
| 66 |
+ sinchServiceId: $("#sinch_service_id").val(),
|
|
| 67 |
+ sinchCallbackUrl: $("#sinch_callback_url").val(),
|
|
| 68 |
+ getNotification: getnotify, |
|
| 69 |
+ notificationEmail: notifyemail |
|
| 70 |
+ }; |
|
| 71 |
+ |
|
| 72 |
+ $.ajax({
|
|
| 73 |
+ method: 'PUT', |
|
| 74 |
+ url: baseUrl, |
|
| 75 |
+ contentType: 'application/json', |
|
| 76 |
+ data: JSON.stringify(datatosave), |
|
| 77 |
+ error: function(resp){
|
|
| 78 |
+ alert('Error ! Please check your settings !');
|
|
| 79 |
+ } |
|
| 80 |
+ }); |
|
| 81 |
+ |
|
| 82 |
+ }); |
|
| 83 |
+ |
|
| 84 |
+ var baseUrlget = OC.generateUrl("/apps/pax_fax/user/getsettings");
|
|
| 85 |
+ |
|
| 86 |
+ $.ajax({
|
|
| 87 |
+ method: 'GET', |
|
| 88 |
+ url: baseUrlget, |
|
| 89 |
+ contentType: 'application/json', |
|
| 90 |
+ success: function(settingsfromdb) {
|
|
| 91 |
+ $("#api_key").val(settingsfromdb.api_key);
|
|
| 92 |
+ $("#api_secret").val(settingsfromdb.api_secret);
|
|
| 93 |
+ $("#webhook_token").val(settingsfromdb.webhook_token);
|
|
| 94 |
+ $("#receive_url").val(settingsfromdb.receive_url);
|
|
| 95 |
+ $("#sinch_project_id").val(settingsfromdb.sinch_project_id);
|
|
| 96 |
+ $("#sinch_key_id").val(settingsfromdb.sinch_key_id);
|
|
| 97 |
+ $("#sinch_key_secret").val(settingsfromdb.sinch_key_secret);
|
|
| 98 |
+ $("#sinch_service_id").val(settingsfromdb.sinch_service_id);
|
|
| 99 |
+ $("#sinch_callback_url").val(settingsfromdb.sinch_callback_url);
|
|
| 100 |
+ $("#notification_email").val(settingsfromdb.notification_email);
|
|
| 101 |
+ |
|
| 102 |
+ if (settingsfromdb.get_notification == 1) {
|
|
| 103 |
+ $("#get_notification").attr('checked', true);
|
|
| 104 |
+ } else {
|
|
| 105 |
+ $("#get_notification").attr('checked', false);
|
|
| 106 |
+ } |
|
| 107 |
+ } |
|
| 108 |
+ }); |
|
| 109 |
+ |
|
| 110 |
+}); |
|
| 111 |
+ |
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,103 +0,0 @@ |
| 1 |
-/** |
|
| 2 |
- * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 3 |
- * |
|
| 4 |
- * @author Double Bastion LLC |
|
| 5 |
- * |
|
| 6 |
- * @license GNU AGPL version 3 or any later version |
|
| 7 |
- * |
|
| 8 |
- * This program is free software; you can redistribute it and/or |
|
| 9 |
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 10 |
- * License as published by the Free Software Foundation; either |
|
| 11 |
- * version 3 of the License, or any later version. |
|
| 12 |
- * |
|
| 13 |
- * This program is distributed in the hope that it will be useful, |
|
| 14 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 17 |
- * |
|
| 18 |
- * You should have received a copy of the GNU Affero General Public |
|
| 19 |
- * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 20 |
- * |
|
| 21 |
- */ |
|
| 22 |
- |
|
| 23 |
-$(document).ready(function() {
|
|
| 24 |
- |
|
| 25 |
- $("#save_fax_settings").on("click", function(event) {
|
|
| 26 |
- |
|
| 27 |
- event.preventDefault(); |
|
| 28 |
- OC.msg.startAction("#paxfax_save_msg", t("pax_fax", "Saved"));
|
|
| 29 |
- |
|
| 30 |
- var baseUrl = OC.generateUrl("/apps/pax_fax/user/updatesettings");
|
|
| 31 |
- var getnotify = 0; |
|
| 32 |
- |
|
| 33 |
- if ($("#get_notification").is(':checked')) {
|
|
| 34 |
- getnotify = 1; |
|
| 35 |
- } |
|
| 36 |
- |
|
| 37 |
- var emailaddressinit = $("#notification_email").val();
|
|
| 38 |
- |
|
| 39 |
- function validate_email($email) {
|
|
| 40 |
- var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
| 41 |
- return email_reg.test($email); |
|
| 42 |
- } |
|
| 43 |
- |
|
| 44 |
- if (validate_email(emailaddressinit)) {
|
|
| 45 |
- var notifyemail = emailaddressinit; |
|
| 46 |
- } else {
|
|
| 47 |
- var notifyemail = ''; |
|
| 48 |
- } |
|
| 49 |
- |
|
| 50 |
- var datatosave = {
|
|
| 51 |
- apiKey: $("#api_key").val(),
|
|
| 52 |
- apiSecret: $("#api_secret").val(),
|
|
| 53 |
- webhookToken: $("#webhook_token").val(),
|
|
| 54 |
- receiveUrl: $("#receive_url").val(),
|
|
| 55 |
- sinchProjectId: $("#sinch_project_id").val(),
|
|
| 56 |
- sinchKeyId: $("#sinch_key_id").val(),
|
|
| 57 |
- sinchKeySecret: $("#sinch_key_secret").val(),
|
|
| 58 |
- sinchServiceId: $("#sinch_service_id").val(),
|
|
| 59 |
- sinchCallbackUrl: $("#sinch_callback_url").val(),
|
|
| 60 |
- getNotification: getnotify, |
|
| 61 |
- notificationEmail: notifyemail |
|
| 62 |
- }; |
|
| 63 |
- |
|
| 64 |
- $.ajax({
|
|
| 65 |
- method: 'PUT', |
|
| 66 |
- url: baseUrl, |
|
| 67 |
- contentType: 'application/json', |
|
| 68 |
- data: JSON.stringify(datatosave), |
|
| 69 |
- error: function(resp){
|
|
| 70 |
- alert('Error ! Please check your settings !');
|
|
| 71 |
- } |
|
| 72 |
- }); |
|
| 73 |
- |
|
| 74 |
- }); |
|
| 75 |
- |
|
| 76 |
- var baseUrlget = OC.generateUrl("/apps/pax_fax/user/getsettings");
|
|
| 77 |
- |
|
| 78 |
- $.ajax({
|
|
| 79 |
- method: 'GET', |
|
| 80 |
- url: baseUrlget, |
|
| 81 |
- contentType: 'application/json', |
|
| 82 |
- success: function(settingsfromdb) {
|
|
| 83 |
- $("#api_key").val(settingsfromdb.api_key);
|
|
| 84 |
- $("#api_secret").val(settingsfromdb.api_secret);
|
|
| 85 |
- $("#webhook_token").val(settingsfromdb.webhook_token);
|
|
| 86 |
- $("#receive_url").val(settingsfromdb.receive_url);
|
|
| 87 |
- $("#sinch_project_id").val(settingsfromdb.sinch_project_id);
|
|
| 88 |
- $("#sinch_key_id").val(settingsfromdb.sinch_key_id);
|
|
| 89 |
- $("#sinch_key_secret").val(settingsfromdb.sinch_key_secret);
|
|
| 90 |
- $("#sinch_service_id").val(settingsfromdb.sinch_service_id);
|
|
| 91 |
- $("#sinch_callback_url").val(settingsfromdb.sinch_callback_url);
|
|
| 92 |
- $("#notification_email").val(settingsfromdb.notification_email);
|
|
| 93 |
- |
|
| 94 |
- if (settingsfromdb.get_notification == 1) {
|
|
| 95 |
- $("#get_notification").attr('checked', true);
|
|
| 96 |
- } else {
|
|
| 97 |
- $("#get_notification").attr('checked', false);
|
|
| 98 |
- } |
|
| 99 |
- } |
|
| 100 |
- }); |
|
| 101 |
- |
|
| 102 |
-}); |
|
| 103 |
- |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,103 @@ |
| 1 |
+/** |
|
| 2 |
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 3 |
+ * |
|
| 4 |
+ * @author Double Bastion LLC |
|
| 5 |
+ * |
|
| 6 |
+ * @license GNU AGPL version 3 or any later version |
|
| 7 |
+ * |
|
| 8 |
+ * This program is free software; you can redistribute it and/or |
|
| 9 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 10 |
+ * License as published by the Free Software Foundation; either |
|
| 11 |
+ * version 3 of the License, or any later version. |
|
| 12 |
+ * |
|
| 13 |
+ * This program is distributed in the hope that it will be useful, |
|
| 14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 17 |
+ * |
|
| 18 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 19 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 20 |
+ * |
|
| 21 |
+ */ |
|
| 22 |
+ |
|
| 23 |
+$(document).ready(function() {
|
|
| 24 |
+ |
|
| 25 |
+ $("#save_fax_settings").on("click", function(event) {
|
|
| 26 |
+ |
|
| 27 |
+ event.preventDefault(); |
|
| 28 |
+ OC.msg.startAction("#paxfax_save_msg", t("pax_fax", "Saved"));
|
|
| 29 |
+ |
|
| 30 |
+ var baseUrl = OC.generateUrl("/apps/pax_fax/user/updatesettings");
|
|
| 31 |
+ var getnotify = 0; |
|
| 32 |
+ |
|
| 33 |
+ if ($("#get_notification").is(':checked')) {
|
|
| 34 |
+ getnotify = 1; |
|
| 35 |
+ } |
|
| 36 |
+ |
|
| 37 |
+ var emailaddressinit = $("#notification_email").val();
|
|
| 38 |
+ |
|
| 39 |
+ function validate_email($email) {
|
|
| 40 |
+ var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
| 41 |
+ return email_reg.test($email); |
|
| 42 |
+ } |
|
| 43 |
+ |
|
| 44 |
+ if (validate_email(emailaddressinit)) {
|
|
| 45 |
+ var notifyemail = emailaddressinit; |
|
| 46 |
+ } else {
|
|
| 47 |
+ var notifyemail = ''; |
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 50 |
+ var datatosave = {
|
|
| 51 |
+ apiKey: $("#api_key").val(),
|
|
| 52 |
+ apiSecret: $("#api_secret").val(),
|
|
| 53 |
+ webhookToken: $("#webhook_token").val(),
|
|
| 54 |
+ receiveUrl: $("#receive_url").val(),
|
|
| 55 |
+ sinchProjectId: $("#sinch_project_id").val(),
|
|
| 56 |
+ sinchKeyId: $("#sinch_key_id").val(),
|
|
| 57 |
+ sinchKeySecret: $("#sinch_key_secret").val(),
|
|
| 58 |
+ sinchServiceId: $("#sinch_service_id").val(),
|
|
| 59 |
+ sinchCallbackUrl: $("#sinch_callback_url").val(),
|
|
| 60 |
+ getNotification: getnotify, |
|
| 61 |
+ notificationEmail: notifyemail |
|
| 62 |
+ }; |
|
| 63 |
+ |
|
| 64 |
+ $.ajax({
|
|
| 65 |
+ method: 'PUT', |
|
| 66 |
+ url: baseUrl, |
|
| 67 |
+ contentType: 'application/json', |
|
| 68 |
+ data: JSON.stringify(datatosave), |
|
| 69 |
+ error: function(resp){
|
|
| 70 |
+ alert('Error ! Please check your settings !');
|
|
| 71 |
+ } |
|
| 72 |
+ }); |
|
| 73 |
+ |
|
| 74 |
+ }); |
|
| 75 |
+ |
|
| 76 |
+ var baseUrlget = OC.generateUrl("/apps/pax_fax/user/getsettings");
|
|
| 77 |
+ |
|
| 78 |
+ $.ajax({
|
|
| 79 |
+ method: 'GET', |
|
| 80 |
+ url: baseUrlget, |
|
| 81 |
+ contentType: 'application/json', |
|
| 82 |
+ success: function(settingsfromdb) {
|
|
| 83 |
+ $("#api_key").val(settingsfromdb.api_key);
|
|
| 84 |
+ $("#api_secret").val(settingsfromdb.api_secret);
|
|
| 85 |
+ $("#webhook_token").val(settingsfromdb.webhook_token);
|
|
| 86 |
+ $("#receive_url").val(settingsfromdb.receive_url);
|
|
| 87 |
+ $("#sinch_project_id").val(settingsfromdb.sinch_project_id);
|
|
| 88 |
+ $("#sinch_key_id").val(settingsfromdb.sinch_key_id);
|
|
| 89 |
+ $("#sinch_key_secret").val(settingsfromdb.sinch_key_secret);
|
|
| 90 |
+ $("#sinch_service_id").val(settingsfromdb.sinch_service_id);
|
|
| 91 |
+ $("#sinch_callback_url").val(settingsfromdb.sinch_callback_url);
|
|
| 92 |
+ $("#notification_email").val(settingsfromdb.notification_email);
|
|
| 93 |
+ |
|
| 94 |
+ if (settingsfromdb.get_notification == 1) {
|
|
| 95 |
+ $("#get_notification").attr('checked', true);
|
|
| 96 |
+ } else {
|
|
| 97 |
+ $("#get_notification").attr('checked', false);
|
|
| 98 |
+ } |
|
| 99 |
+ } |
|
| 100 |
+ }); |
|
| 101 |
+ |
|
| 102 |
+}); |
|
| 103 |
+ |
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,93 +0,0 @@ |
| 1 |
-/** |
|
| 2 |
- * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 3 |
- * |
|
| 4 |
- * @author Double Bastion LLC |
|
| 5 |
- * |
|
| 6 |
- * @license GNU AGPL version 3 or any later version |
|
| 7 |
- * |
|
| 8 |
- * This program is free software; you can redistribute it and/or |
|
| 9 |
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 10 |
- * License as published by the Free Software Foundation; either |
|
| 11 |
- * version 3 of the License, or any later version. |
|
| 12 |
- * |
|
| 13 |
- * This program is distributed in the hope that it will be useful, |
|
| 14 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 17 |
- * |
|
| 18 |
- * You should have received a copy of the GNU Affero General Public |
|
| 19 |
- * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 20 |
- * |
|
| 21 |
- */ |
|
| 22 |
- |
|
| 23 |
-$(document).ready(function() {
|
|
| 24 |
- |
|
| 25 |
- $("#save_fax_settings").on("click", function(event) {
|
|
| 26 |
- |
|
| 27 |
- event.preventDefault(); |
|
| 28 |
- OC.msg.startAction("#paxfax_save_msg", t("pax_fax", "Saved"));
|
|
| 29 |
- |
|
| 30 |
- var baseUrl = OC.generateUrl("/apps/pax_fax/user/updatesettings");
|
|
| 31 |
- var getnotify = 0; |
|
| 32 |
- |
|
| 33 |
- if ($("#get_notification").is(':checked')) {
|
|
| 34 |
- getnotify = 1; |
|
| 35 |
- } |
|
| 36 |
- |
|
| 37 |
- var emailaddressinit = $("#notification_email").val();
|
|
| 38 |
- |
|
| 39 |
- function validate_email($email) {
|
|
| 40 |
- var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
| 41 |
- return email_reg.test($email); |
|
| 42 |
- } |
|
| 43 |
- |
|
| 44 |
- if (validate_email(emailaddressinit)) {
|
|
| 45 |
- var notifyemail = emailaddressinit; |
|
| 46 |
- } else {
|
|
| 47 |
- var notifyemail = ''; |
|
| 48 |
- } |
|
| 49 |
- |
|
| 50 |
- var datatosave = {
|
|
| 51 |
- apiKey: $("#api_key").val(),
|
|
| 52 |
- apiSecret: $("#api_secret").val(),
|
|
| 53 |
- webhookToken: $("#webhook_token").val(),
|
|
| 54 |
- receiveUrl: $("#receive_url").val(),
|
|
| 55 |
- getNotification: getnotify, |
|
| 56 |
- notificationEmail: notifyemail |
|
| 57 |
- }; |
|
| 58 |
- |
|
| 59 |
- $.ajax({
|
|
| 60 |
- method: 'PUT', |
|
| 61 |
- url: baseUrl, |
|
| 62 |
- contentType: 'application/json', |
|
| 63 |
- data: JSON.stringify(datatosave), |
|
| 64 |
- error: function(resp){
|
|
| 65 |
- alert('Error ! Please check your settings !');
|
|
| 66 |
- } |
|
| 67 |
- }); |
|
| 68 |
- |
|
| 69 |
- }); |
|
| 70 |
- |
|
| 71 |
- var baseUrlget = OC.generateUrl("/apps/pax_fax/user/getsettings");
|
|
| 72 |
- |
|
| 73 |
- $.ajax({
|
|
| 74 |
- method: 'GET', |
|
| 75 |
- url: baseUrlget, |
|
| 76 |
- contentType: 'application/json', |
|
| 77 |
- success: function(settingsfromdb) {
|
|
| 78 |
- $("#api_key").val(settingsfromdb.api_key);
|
|
| 79 |
- $("#api_secret").val(settingsfromdb.api_secret);
|
|
| 80 |
- $("#webhook_token").val(settingsfromdb.webhook_token);
|
|
| 81 |
- $("#receive_url").val(settingsfromdb.receive_url);
|
|
| 82 |
- $("#notification_email").val(settingsfromdb.notification_email);
|
|
| 83 |
- |
|
| 84 |
- if (settingsfromdb.get_notification == 1) {
|
|
| 85 |
- $("#get_notification").attr('checked', true);
|
|
| 86 |
- } else {
|
|
| 87 |
- $("#get_notification").attr('checked', false);
|
|
| 88 |
- } |
|
| 89 |
- } |
|
| 90 |
- }); |
|
| 91 |
- |
|
| 92 |
-}); |
|
| 93 |
- |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,93 @@ |
| 1 |
+/** |
|
| 2 |
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 3 |
+ * |
|
| 4 |
+ * @author Double Bastion LLC |
|
| 5 |
+ * |
|
| 6 |
+ * @license GNU AGPL version 3 or any later version |
|
| 7 |
+ * |
|
| 8 |
+ * This program is free software; you can redistribute it and/or |
|
| 9 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 10 |
+ * License as published by the Free Software Foundation; either |
|
| 11 |
+ * version 3 of the License, or any later version. |
|
| 12 |
+ * |
|
| 13 |
+ * This program is distributed in the hope that it will be useful, |
|
| 14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 17 |
+ * |
|
| 18 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 19 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 20 |
+ * |
|
| 21 |
+ */ |
|
| 22 |
+ |
|
| 23 |
+$(document).ready(function() {
|
|
| 24 |
+ |
|
| 25 |
+ $("#save_fax_settings").on("click", function(event) {
|
|
| 26 |
+ |
|
| 27 |
+ event.preventDefault(); |
|
| 28 |
+ OC.msg.startAction("#paxfax_save_msg", t("pax_fax", "Saved"));
|
|
| 29 |
+ |
|
| 30 |
+ var baseUrl = OC.generateUrl("/apps/pax_fax/user/updatesettings");
|
|
| 31 |
+ var getnotify = 0; |
|
| 32 |
+ |
|
| 33 |
+ if ($("#get_notification").is(':checked')) {
|
|
| 34 |
+ getnotify = 1; |
|
| 35 |
+ } |
|
| 36 |
+ |
|
| 37 |
+ var emailaddressinit = $("#notification_email").val();
|
|
| 38 |
+ |
|
| 39 |
+ function validate_email($email) {
|
|
| 40 |
+ var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
| 41 |
+ return email_reg.test($email); |
|
| 42 |
+ } |
|
| 43 |
+ |
|
| 44 |
+ if (validate_email(emailaddressinit)) {
|
|
| 45 |
+ var notifyemail = emailaddressinit; |
|
| 46 |
+ } else {
|
|
| 47 |
+ var notifyemail = ''; |
|
| 48 |
+ } |
|
| 49 |
+ |
|
| 50 |
+ var datatosave = {
|
|
| 51 |
+ apiKey: $("#api_key").val(),
|
|
| 52 |
+ apiSecret: $("#api_secret").val(),
|
|
| 53 |
+ webhookToken: $("#webhook_token").val(),
|
|
| 54 |
+ receiveUrl: $("#receive_url").val(),
|
|
| 55 |
+ getNotification: getnotify, |
|
| 56 |
+ notificationEmail: notifyemail |
|
| 57 |
+ }; |
|
| 58 |
+ |
|
| 59 |
+ $.ajax({
|
|
| 60 |
+ method: 'PUT', |
|
| 61 |
+ url: baseUrl, |
|
| 62 |
+ contentType: 'application/json', |
|
| 63 |
+ data: JSON.stringify(datatosave), |
|
| 64 |
+ error: function(resp){
|
|
| 65 |
+ alert('Error ! Please check your settings !');
|
|
| 66 |
+ } |
|
| 67 |
+ }); |
|
| 68 |
+ |
|
| 69 |
+ }); |
|
| 70 |
+ |
|
| 71 |
+ var baseUrlget = OC.generateUrl("/apps/pax_fax/user/getsettings");
|
|
| 72 |
+ |
|
| 73 |
+ $.ajax({
|
|
| 74 |
+ method: 'GET', |
|
| 75 |
+ url: baseUrlget, |
|
| 76 |
+ contentType: 'application/json', |
|
| 77 |
+ success: function(settingsfromdb) {
|
|
| 78 |
+ $("#api_key").val(settingsfromdb.api_key);
|
|
| 79 |
+ $("#api_secret").val(settingsfromdb.api_secret);
|
|
| 80 |
+ $("#webhook_token").val(settingsfromdb.webhook_token);
|
|
| 81 |
+ $("#receive_url").val(settingsfromdb.receive_url);
|
|
| 82 |
+ $("#notification_email").val(settingsfromdb.notification_email);
|
|
| 83 |
+ |
|
| 84 |
+ if (settingsfromdb.get_notification == 1) {
|
|
| 85 |
+ $("#get_notification").attr('checked', true);
|
|
| 86 |
+ } else {
|
|
| 87 |
+ $("#get_notification").attr('checked', false);
|
|
| 88 |
+ } |
|
| 89 |
+ } |
|
| 90 |
+ }); |
|
| 91 |
+ |
|
| 92 |
+}); |
|
| 93 |
+ |
| 1 | 1 |
deleted file mode 100644 |
| ... | ... |
@@ -1,96 +0,0 @@ |
| 1 |
-/** |
|
| 2 |
- * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 3 |
- * |
|
| 4 |
- * @author Double Bastion LLC |
|
| 5 |
- * |
|
| 6 |
- * @license GNU AGPL version 3 or any later version |
|
| 7 |
- * |
|
| 8 |
- * This program is free software; you can redistribute it and/or |
|
| 9 |
- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 10 |
- * License as published by the Free Software Foundation; either |
|
| 11 |
- * version 3 of the License, or any later version. |
|
| 12 |
- * |
|
| 13 |
- * This program is distributed in the hope that it will be useful, |
|
| 14 |
- * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
- * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 17 |
- * |
|
| 18 |
- * You should have received a copy of the GNU Affero General Public |
|
| 19 |
- * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 20 |
- * |
|
| 21 |
- */ |
|
| 22 |
- |
|
| 23 |
-$(document).ready(function() {
|
|
| 24 |
- |
|
| 25 |
- $("#save_fax_settings").on("click", function(event) {
|
|
| 26 |
- |
|
| 27 |
- event.preventDefault(); |
|
| 28 |
- OC.msg.startAction("#paxfax_save_msg", t("pax_fax", "Saved"));
|
|
| 29 |
- |
|
| 30 |
- var baseUrl = OC.generateUrl("/apps/pax_fax/user/updatesettings");
|
|
| 31 |
- var userid = "<?php p($userId); ?>"; |
|
| 32 |
- var getnotify = 0; |
|
| 33 |
- |
|
| 34 |
- if ($("#get_notification").is(':checked')) {
|
|
| 35 |
- getnotify = 1; |
|
| 36 |
- } |
|
| 37 |
- |
|
| 38 |
- var emailaddressinit = $("#notification_email").val();
|
|
| 39 |
- |
|
| 40 |
- function validate_email($email) {
|
|
| 41 |
- var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
| 42 |
- return email_reg.test($email); |
|
| 43 |
- } |
|
| 44 |
- |
|
| 45 |
- if (validate_email(emailaddressinit)) {
|
|
| 46 |
- var notifyemail = emailaddressinit; |
|
| 47 |
- } else {
|
|
| 48 |
- var notifyemail = ''; |
|
| 49 |
- } |
|
| 50 |
- |
|
| 51 |
- var datatosave = {
|
|
| 52 |
- userId: userid, |
|
| 53 |
- apiKey: $("#api_key").val(),
|
|
| 54 |
- apiSecret: $("#api_secret").val(),
|
|
| 55 |
- webhookToken: $("#webhook_token").val(),
|
|
| 56 |
- receiveUrl: $("#receive_url").val(),
|
|
| 57 |
- getNotification: getnotify, |
|
| 58 |
- notificationEmail: notifyemail |
|
| 59 |
- }; |
|
| 60 |
- |
|
| 61 |
- $.ajax({
|
|
| 62 |
- method: 'PUT', |
|
| 63 |
- url: baseUrl + '/' + userid, |
|
| 64 |
- contentType: 'application/json', |
|
| 65 |
- data: JSON.stringify(datatosave), |
|
| 66 |
- error: function(resp){
|
|
| 67 |
- alert('Error ! Please check your settings !');
|
|
| 68 |
- } |
|
| 69 |
- }); |
|
| 70 |
- |
|
| 71 |
- }); |
|
| 72 |
- |
|
| 73 |
- var baseUrlget = OC.generateUrl("/apps/pax_fax/user/getsettings");
|
|
| 74 |
- var userid = "<?php p($userId); ?>"; |
|
| 75 |
- |
|
| 76 |
- $.ajax({
|
|
| 77 |
- method: 'GET', |
|
| 78 |
- url: baseUrlget + '/' + userid, |
|
| 79 |
- contentType: 'application/json', |
|
| 80 |
- success: function(settingsfromdb) {
|
|
| 81 |
- $("#api_key").val(settingsfromdb.api_key);
|
|
| 82 |
- $("#api_secret").val(settingsfromdb.api_secret);
|
|
| 83 |
- $("#webhook_token").val(settingsfromdb.webhook_token);
|
|
| 84 |
- $("#receive_url").val(settingsfromdb.receive_url);
|
|
| 85 |
- $("#notification_email").val(settingsfromdb.notification_email);
|
|
| 86 |
- |
|
| 87 |
- if (settingsfromdb.get_notification == 1) {
|
|
| 88 |
- $("#get_notification").attr('checked', true);
|
|
| 89 |
- } else {
|
|
| 90 |
- $("#get_notification").attr('checked', false);
|
|
| 91 |
- } |
|
| 92 |
- } |
|
| 93 |
- }); |
|
| 94 |
- |
|
| 95 |
-}); |
|
| 96 |
- |
| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,96 @@ |
| 1 |
+/** |
|
| 2 |
+ * @copyright 2021 Double Bastion LLC <www.doublebastion.com> |
|
| 3 |
+ * |
|
| 4 |
+ * @author Double Bastion LLC |
|
| 5 |
+ * |
|
| 6 |
+ * @license GNU AGPL version 3 or any later version |
|
| 7 |
+ * |
|
| 8 |
+ * This program is free software; you can redistribute it and/or |
|
| 9 |
+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE |
|
| 10 |
+ * License as published by the Free Software Foundation; either |
|
| 11 |
+ * version 3 of the License, or any later version. |
|
| 12 |
+ * |
|
| 13 |
+ * This program is distributed in the hope that it will be useful, |
|
| 14 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 |
+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details. |
|
| 17 |
+ * |
|
| 18 |
+ * You should have received a copy of the GNU Affero General Public |
|
| 19 |
+ * License along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
| 20 |
+ * |
|
| 21 |
+ */ |
|
| 22 |
+ |
|
| 23 |
+$(document).ready(function() {
|
|
| 24 |
+ |
|
| 25 |
+ $("#save_fax_settings").on("click", function(event) {
|
|
| 26 |
+ |
|
| 27 |
+ event.preventDefault(); |
|
| 28 |
+ OC.msg.startAction("#paxfax_save_msg", t("pax_fax", "Saved"));
|
|
| 29 |
+ |
|
| 30 |
+ var baseUrl = OC.generateUrl("/apps/pax_fax/user/updatesettings");
|
|
| 31 |
+ var userid = "<?php p($userId); ?>"; |
|
| 32 |
+ var getnotify = 0; |
|
| 33 |
+ |
|
| 34 |
+ if ($("#get_notification").is(':checked')) {
|
|
| 35 |
+ getnotify = 1; |
|
| 36 |
+ } |
|
| 37 |
+ |
|
| 38 |
+ var emailaddressinit = $("#notification_email").val();
|
|
| 39 |
+ |
|
| 40 |
+ function validate_email($email) {
|
|
| 41 |
+ var email_reg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
|
|
| 42 |
+ return email_reg.test($email); |
|
| 43 |
+ } |
|
| 44 |
+ |
|
| 45 |
+ if (validate_email(emailaddressinit)) {
|
|
| 46 |
+ var notifyemail = emailaddressinit; |
|
| 47 |
+ } else {
|
|
| 48 |
+ var notifyemail = ''; |
|
| 49 |
+ } |
|
| 50 |
+ |
|
| 51 |
+ var datatosave = {
|
|
| 52 |
+ userId: userid, |
|
| 53 |
+ apiKey: $("#api_key").val(),
|
|
| 54 |
+ apiSecret: $("#api_secret").val(),
|
|
| 55 |
+ webhookToken: $("#webhook_token").val(),
|
|
| 56 |
+ receiveUrl: $("#receive_url").val(),
|
|
| 57 |
+ getNotification: getnotify, |
|
| 58 |
+ notificationEmail: notifyemail |
|
| 59 |
+ }; |
|
| 60 |
+ |
|
| 61 |
+ $.ajax({
|
|
| 62 |
+ method: 'PUT', |
|
| 63 |
+ url: baseUrl + '/' + userid, |
|
| 64 |
+ contentType: 'application/json', |
|
| 65 |
+ data: JSON.stringify(datatosave), |
|
| 66 |
+ error: function(resp){
|
|
| 67 |
+ alert('Error ! Please check your settings !');
|
|
| 68 |
+ } |
|
| 69 |
+ }); |
|
| 70 |
+ |
|
| 71 |
+ }); |
|
| 72 |
+ |
|
| 73 |
+ var baseUrlget = OC.generateUrl("/apps/pax_fax/user/getsettings");
|
|
| 74 |
+ var userid = "<?php p($userId); ?>"; |
|
| 75 |
+ |
|
| 76 |
+ $.ajax({
|
|
| 77 |
+ method: 'GET', |
|
| 78 |
+ url: baseUrlget + '/' + userid, |
|
| 79 |
+ contentType: 'application/json', |
|
| 80 |
+ success: function(settingsfromdb) {
|
|
| 81 |
+ $("#api_key").val(settingsfromdb.api_key);
|
|
| 82 |
+ $("#api_secret").val(settingsfromdb.api_secret);
|
|
| 83 |
+ $("#webhook_token").val(settingsfromdb.webhook_token);
|
|
| 84 |
+ $("#receive_url").val(settingsfromdb.receive_url);
|
|
| 85 |
+ $("#notification_email").val(settingsfromdb.notification_email);
|
|
| 86 |
+ |
|
| 87 |
+ if (settingsfromdb.get_notification == 1) {
|
|
| 88 |
+ $("#get_notification").attr('checked', true);
|
|
| 89 |
+ } else {
|
|
| 90 |
+ $("#get_notification").attr('checked', false);
|
|
| 91 |
+ } |
|
| 92 |
+ } |
|
| 93 |
+ }); |
|
| 94 |
+ |
|
| 95 |
+}); |
|
| 96 |
+ |