Added function to support toggling of structure/data for all plugins
This commit is contained in:
186
js/export.js
186
js/export.js
@@ -10,111 +10,141 @@
|
|||||||
* according to the currently selected plugin from the dropdown list
|
* according to the currently selected plugin from the dropdown list
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#plugins").change(function() {
|
$("#plugins").change(function() {
|
||||||
$(".format_specific_options").each(function() {
|
$(".format_specific_options").each(function() {
|
||||||
$(this).hide();
|
$(this).hide();
|
||||||
});
|
});
|
||||||
var selected_plugin_name = $("#plugins option:selected").attr("value");
|
var selected_plugin_name = $("#plugins option:selected").attr("value");
|
||||||
$("#" + selected_plugin_name + "_options").show();
|
$("#" + selected_plugin_name + "_options").show();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles the hiding and showing of the SQL plugin's structure-specific and data-specific
|
* Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
|
||||||
* options (TODO: expand to include other plugins).
|
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("input[type='radio'][name$='structure_or_data']").change(function() {
|
$("input[type='radio'][name$='sql_structure_or_data']").change(function() {
|
||||||
var show = $("input[type='radio'][name$='structure_or_data']:checked").attr("value");
|
var show = $("input[type='radio'][name$='sql_structure_or_data']:checked").attr("value");
|
||||||
if(show == 'data') {
|
if(show == 'data') {
|
||||||
$('#data').slideDown('slow');
|
// disable the SQL comment options
|
||||||
$('#structure').slideUp('slow');
|
$("#checkbox_sql_dates").parent().fadeTo('fast', 0.4);
|
||||||
// disable the SQL comment options
|
$("#checkbox_sql_dates").attr('disabled', 'disabled');
|
||||||
$("#checkbox_sql_dates").parent().fadeTo('fast', 0.4);
|
$("#checkbox_sql_relation").parent().fadeTo('fast', 0.4);
|
||||||
$("#checkbox_sql_dates").attr('disabled', 'disabled');
|
$("#checkbox_sql_relation").attr('disabled', 'disabled');
|
||||||
$("#checkbox_sql_relation").parent().fadeTo('fast', 0.4);
|
$("#checkbox_sql_mime").parent().fadeTo('fast', 0.4);
|
||||||
$("#checkbox_sql_relation").attr('disabled', 'disabled');
|
$("#checkbox_sql_mime").attr('disabled', 'disabled');
|
||||||
$("#checkbox_sql_mime").parent().fadeTo('fast', 0.4);
|
} else {
|
||||||
$("#checkbox_sql_mime").attr('disabled', 'disabled');
|
// enable the SQL comment options
|
||||||
} else {
|
$("#checkbox_sql_dates").parent().fadeTo('fast', 1);
|
||||||
// enable the SQL comment options
|
$("#checkbox_sql_dates").removeAttr('disabled');
|
||||||
$("#checkbox_sql_dates").parent().fadeTo('fast', 1);
|
$("#checkbox_sql_relation").parent().fadeTo('fast', 1);
|
||||||
$("#checkbox_sql_dates").removeAttr('disabled');
|
$("#checkbox_sql_relation").removeAttr('disabled');
|
||||||
$("#checkbox_sql_relation").parent().fadeTo('fast', 1);
|
$("#checkbox_sql_mime").parent().fadeTo('fast', 1);
|
||||||
$("#checkbox_sql_relation").removeAttr('disabled');
|
$("#checkbox_sql_mime").removeAttr('disabled');
|
||||||
$("#checkbox_sql_mime").parent().fadeTo('fast', 1);
|
}
|
||||||
$("#checkbox_sql_mime").removeAttr('disabled');
|
});
|
||||||
if(show == 'structure') {
|
});
|
||||||
$('#structure').slideDown('slow');
|
|
||||||
$('#data').slideUp('slow');
|
|
||||||
} else {
|
/**
|
||||||
$('#structure').slideDown('slow');
|
* Toggles the hiding and showing of plugin structure-specific and data-specific
|
||||||
$('#data').slideDown('slow');
|
* options
|
||||||
}
|
*/
|
||||||
}
|
$(document).ready(function() {
|
||||||
});
|
function toggleStructureAndDataOpts(pluginName) {
|
||||||
|
var radioFormName = pluginName + "_structure_or_data";
|
||||||
|
var dataDiv = "#" + pluginName + "_data";
|
||||||
|
var structureDiv = "#" + pluginName + "_structure";
|
||||||
|
var show = $("input[type='radio'][name='" + radioFormName + "']:checked").attr("value");
|
||||||
|
if(show == 'data') {
|
||||||
|
$(dataDiv).slideDown('slow');
|
||||||
|
$(structureDiv).slideUp('slow');
|
||||||
|
} else {
|
||||||
|
$(structureDiv).slideDown('slow');
|
||||||
|
if(show == 'structure') {
|
||||||
|
$(dataDiv).slideUp('slow');
|
||||||
|
} else {
|
||||||
|
$(dataDiv).slideDown('slow');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$("input[type='radio'][name='latex_structure_or_data']").change(function() {
|
||||||
|
toggleStructureAndDataOpts("latex");
|
||||||
|
});
|
||||||
|
$("input[type='radio'][name='odt_structure_or_data']").change(function() {
|
||||||
|
toggleStructureAndDataOpts("odt");
|
||||||
|
});
|
||||||
|
$("input[type='radio'][name='texytext_structure_or_data']").change(function() {
|
||||||
|
toggleStructureAndDataOpts("texytext");
|
||||||
|
});
|
||||||
|
$("input[type='radio'][name='htmlword_structure_or_data']").change(function() {
|
||||||
|
toggleStructureAndDataOpts("htmlword");
|
||||||
|
});
|
||||||
|
$("input[type='radio'][name='sql_structure_or_data']").change(function() {
|
||||||
|
toggleStructureAndDataOpts("sql");
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles the disabling of the "save to file" options
|
* Toggles the disabling of the "save to file" options
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("input[type='radio'][name='output_format']").change(function() {
|
$("input[type='radio'][name='output_format']").change(function() {
|
||||||
if($("#radio_dump_asfile:checked").length == 0) {
|
if($("#radio_dump_asfile:checked").length == 0) {
|
||||||
$("#ul_save_asfile > li").fadeTo('fast', 0.4);
|
$("#ul_save_asfile > li").fadeTo('fast', 0.4);
|
||||||
$("#ul_save_asfile > li > input").attr('disabled', 'disabled');
|
$("#ul_save_asfile > li > input").attr('disabled', 'disabled');
|
||||||
$("#ul_save_asfile > li> select").attr('disabled', 'disabled');
|
$("#ul_save_asfile > li> select").attr('disabled', 'disabled');
|
||||||
} else {
|
} else {
|
||||||
$("#ul_save_asfile > li").fadeTo('fast', 1);
|
$("#ul_save_asfile > li").fadeTo('fast', 1);
|
||||||
$("#ul_save_asfile > li > input").removeAttr('disabled');
|
$("#ul_save_asfile > li > input").removeAttr('disabled');
|
||||||
$("#ul_save_asfile > li> select").removeAttr('disabled');
|
$("#ul_save_asfile > li> select").removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For SQL plugin, toggles the disabling of the "display comments" options
|
* For SQL plugin, toggles the disabling of the "display comments" options
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#checkbox_sql_include_comments").change(function() {
|
$("#checkbox_sql_include_comments").change(function() {
|
||||||
if($("#checkbox_sql_include_comments:checked").length == 0) {
|
if($("#checkbox_sql_include_comments:checked").length == 0) {
|
||||||
$("#ul_include_comments > li").fadeTo('fast', 0.4);
|
$("#ul_include_comments > li").fadeTo('fast', 0.4);
|
||||||
$("#ul_include_comments > li > input").attr('disabled', 'disabled');
|
$("#ul_include_comments > li > input").attr('disabled', 'disabled');
|
||||||
} else {
|
} else {
|
||||||
$("#ul_include_comments > li").fadeTo('fast', 1);
|
$("#ul_include_comments > li").fadeTo('fast', 1);
|
||||||
$("#ul_include_comments > li > input").removeAttr('disabled');
|
$("#ul_include_comments > li > input").removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For SQL plugin, if "CREATE TABLE options" is checked/uncheck, check/uncheck each of its sub-options
|
* For SQL plugin, if "CREATE TABLE options" is checked/uncheck, check/uncheck each of its sub-options
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#checkbox_sql_create_table_statements").change(function() {
|
$("#checkbox_sql_create_table_statements").change(function() {
|
||||||
if($("#checkbox_sql_create_table_statements:checked").length == 0) {
|
if($("#checkbox_sql_create_table_statements:checked").length == 0) {
|
||||||
$("#checkbox_sql_if_not_exists").removeAttr('checked');
|
$("#checkbox_sql_if_not_exists").removeAttr('checked');
|
||||||
$("#checkbox_sql_auto_increment").removeAttr('checked');
|
$("#checkbox_sql_auto_increment").removeAttr('checked');
|
||||||
} else {
|
} else {
|
||||||
$("#checkbox_sql_if_not_exists").attr('checked', 'checked');
|
$("#checkbox_sql_if_not_exists").attr('checked', 'checked');
|
||||||
$("#checkbox_sql_auto_increment").attr('checked', 'checked');
|
$("#checkbox_sql_auto_increment").attr('checked', 'checked');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disables the view output as text option if the output must be saved as a file
|
* Disables the view output as text option if the output must be saved as a file
|
||||||
*/
|
*/
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#plugins").change(function() {
|
$("#plugins").change(function() {
|
||||||
var active_plugin = $("#plugins option:selected").attr("value");
|
var active_plugin = $("#plugins option:selected").attr("value");
|
||||||
var force_file = $("#force_file_" + active_plugin).attr("value");
|
var force_file = $("#force_file_" + active_plugin).attr("value");
|
||||||
if(force_file == "true") {
|
if(force_file == "true") {
|
||||||
$("#radio_view_as_text").attr('disabled', 'disabled');
|
$("#radio_view_as_text").attr('disabled', 'disabled');
|
||||||
$("#radio_view_as_text").parent().fadeTo('fast', 0.4);
|
$("#radio_view_as_text").parent().fadeTo('fast', 0.4);
|
||||||
} else {
|
} else {
|
||||||
$("#radio_view_as_text").removeAttr('disabled');
|
$("#radio_view_as_text").removeAttr('disabled');
|
||||||
$("#radio_view_as_text").parent().fadeTo('fast', 1);
|
$("#radio_view_as_text").parent().fadeTo('fast', 1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user