PluginProbe
WP Data Access – App Builder for Tables, Forms, Dashboards, Charts & Maps / 5.5.87
WP Data Access – App Builder for Tables, Forms, Dashboards, Charts & Maps v5.5.87
5.5.87 5.5.85 5.5.84 5.5.83 5.5.82 5.5.81 5.5.80 5.5.79 5.5.77 5.5.76 5.5.75 5.5.73 5.5.72 5.5.22 5.5.23 5.5.29 5.5.3 5.5.31 5.5.32 5.5.34 5.5.35 5.5.36 5.5.37 5.5.4 5.5.40 All 162 releases
← All changes | assets/js/wpda_admin.js +105 -41 5.5.3 → 5.5.87 View file →
@@ -28,48 +28,8 @@
28 28 jQuery("#rownum_" + rownum + " td div").addClass("row-actions");
29 29 }
30 30 }
31 31
32 -function wpda_list_table_favourite( schema_name, table_name ) {
33 - if (jQuery('#span_favourites_'+ table_name).hasClass('dashicons-star-empty')) {
34 - action = 'wpda_add_favourite';
35 - } else {
36 - action = 'wpda_rem_favourite';
37 - }
38 - url = location.pathname + '?action=' + action;
39 - jQuery.ajax({
40 - method: 'POST',
41 - url: url,
42 - data: {
43 - wpdaschema_name: schema_name,
44 - table_name: table_name
45 - }
46 - }).done(
47 - function (msg) {
48 - if (msg === '1') {
49 - if (jQuery('#span_favourites_' + table_name).hasClass('dashicons-star-empty')) {
50 - jQuery('#span_favourites_' + table_name)
51 - .removeClass('dashicons-star-empty')
52 - .addClass('dashicons-star-filled')
53 - .prop('title', 'Remove from favourites');
54 - } else {
55 - jQuery('#span_favourites_' + table_name)
56 - .removeClass('dashicons-star-filled')
57 - .addClass('dashicons-star-empty')
58 - .prop('title', 'Add to favourites');
59 - }
60 - if (jQuery('#wpda_main_favourites_list').val()!=='') {
61 - jQuery("#wpda_main_form :input[name='action']").val('-1');
62 - jQuery("#wpda_main_form :input[name='action2']").val('-1');
63 - jQuery('#wpda_main_form').submit();
64 - }
65 - } else {
66 - alert('Adding to favourites failed!');
67 - }
68 - }
69 - );
70 -}
71 -
72 32 function wpda_main_export_start() {
73 33 jQuery("#wpda_main_export_form").submit();
74 34 jQuery("#wpda_row_export_anchor").empty();
75 35
@@ -502,8 +462,11 @@
502 462 jQuery("#" + rownum + "-tab-" + tab).show();
503 463 }
504 464
505 465 function backup_respository_tables(
466 + app_table_name,
467 + app_container_table_name,
468 + app_apps_table_name,
506 469 table_settings_table_name,
507 470 media_table_name,
508 471 design_table_name,
509 472 data_projects_project_name,
@@ -513,8 +476,11 @@
513 476 menus_table_name,
514 477 csv_import_table_name,
515 478 logging_table_name
516 479 ) {
480 + jQuery('#app_table_name').val(app_table_name);
481 + jQuery('#app_container_table_name').val(app_container_table_name);
482 + jQuery('#app_apps_table_name').val(app_apps_table_name);
517 483 jQuery('#table_settings_table_name').val(table_settings_table_name);
518 484 jQuery('#media_table_name').val(media_table_name);
519 485 jQuery('#design_table_name').val(design_table_name);
520 486 jQuery('#data_projects_project_name').val(data_projects_project_name);
@@ -532,8 +498,11 @@
532 498 if (!confirm("Restore repository tables? This action cannot be undone!\n\nIt might be wise to backup your actual repository tables first...")) {
533 499 return;
534 500 }
535 501
502 + jQuery('#restore_app_table_name').val(jQuery("input[name='restore_app_table_name']:checked").val());
503 + jQuery('#restore_app_container_table_name').val(jQuery("input[name='restore_app_container_table_name']:checked").val());
504 + jQuery('#restore_app_apps_table_name').val(jQuery("input[name='restore_app_apps_table_name']:checked").val());
536 505 jQuery('#restore_table_settings_table_name').val(jQuery("input[name='restore_table_settings_table_name']:checked").val());
537 506 jQuery('#restore_media_table_name').val(jQuery("input[name='restore_media_table_name']:checked").val());
538 507 jQuery('#restore_design_table_name').val(jQuery("input[name='restore_design_table_name']:checked").val());
539 508 jQuery('#restore_data_projects_project_name').val(jQuery("input[name='restore_data_projects_project_name']:checked").val());
@@ -622,9 +591,13 @@
622 591 wpnonce: wpnonce,
623 592 }
624 593 }).done(
625 594 function(data) {
626 - msg = JSON.parse(data);
595 + if (typeof data === "string") {
596 + msg = JSON.parse(data);
597 + } else {
598 + msg = data;
599 + }
627 600 if (msg.status==="OK") {
628 601 jQuery.notify('Database function wpda_get_wp_user_id() created', 'success');
629 602 } else {
630 603 console.log(msg);
@@ -901,4 +874,95 @@
901 874 selection.add(attachment ? [attachment] : []);
902 875 }
903 876 );
904 877 }
878 +
879 +const setLegacyTools = () => {
880 + jQuery("#wpda-legacy-tool-settings-panel").toggle();
881 +}
882 +
883 +const setLegacyToolStatus = (element) => {
884 + if (jQuery(element).find("i.fas.fa-toggle-off").length === 1) {
885 + // Turn on
886 + jQuery(element).html('<i class="fas fa-toggle-on" style="font-size: 28px;"></i>');
887 + } else {
888 + // Turn off
889 + jQuery(element).html('<i class="fas fa-toggle-off" style="font-size: 28px;"></i>');
890 + }
891 +}
892 +
893 +const updateLegacyTools = () => {
894 + const toolStatus = {}
895 +
896 + jQuery.each(
897 + jQuery("#wpda-legacy-tool-settings-panel table td.status"),
898 + function(key, value) {
899 + const tool = jQuery(value).data("tool");
900 + const status = jQuery(value).find("i.fas.fa-toggle-off").length === 0
901 + toolStatus[tool] = status;
902 + }
903 + );
904 +
905 + jQuery("#wpda-legacy-tool-settings-legacy-tool-data").val(JSON.stringify(toolStatus));
906 + jQuery("#wpda-legacy-tool-settings-form-data").submit();
907 +}
908 +
909 +const submitMailCallbackOk = (response, debug) => {
910 + if (response.code!==undefined && response.message!==undefined) {
911 + switch(response.code) {
912 + case "ok":
913 + jQuery("#debugInfoContainer").parent().parent().hide()
914 + jQuery.notify(response.message, "success");
915 + break;
916 + case "error":
917 + jQuery.notify(response.message, "error");
918 + break;
919 + default:
920 + jQuery.notify("Application error! Please contact the plugin development team.", "error");
921 + }
922 +
923 + if (debug === true) {
924 + jQuery("#debugInfoContainer").html(response.debug)
925 + jQuery("#debugInfoContainer").parent().parent().show()
926 + }
927 + } else {
928 + submitSettingsCallbackError(response);
929 + }
930 +
931 + jQuery('#mailSpinner').hide();
932 +}
933 +
934 +const submitMailCallbackError = (response) => {
935 + if (response.code!==undefined && response.message!==undefined) {
936 + switch(response.code) {
937 + case "error":
938 + jQuery.notify(response.message, "error");
939 + break;
940 + default:
941 + jQuery.notify("Application error! Please contact the plugin development team.", "error");
942 + }
943 + } else {
944 + jQuery.notify("Application error! Please contact the plugin development team.", "error");
945 + }
946 +
947 + jQuery('#mailSpinner').hide();
948 +}
949 +
950 +const sendMail = (to, subject, message, debug) => {
951 + if (to.trim() === "" || subject.trim() === "" || message.trim() === "") {
952 + jQuery.notify("Invalid function call! Missing arguments.", "error");
953 + jQuery('#mailSpinner').hide();
954 + } else {
955 + wpda_rest_api(
956 + "action/mail",
957 + {
958 + to: to,
959 + subject: subject,
960 + message: message,
961 + },
962 + function(response) {
963 + submitMailCallbackOk(response, debug)
964 + },
965 + submitSettingsCallbackError
966 + );
967 + }
968 +}