1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * Functions used in the export tab
8 * Toggles the hiding and showing of each plugin's options
9 * according to the currently selected plugin from the dropdown list
11 $(document).ready(function() {
12 $("#plugins").change(function() {
13 $(".format_specific_options").each(function() {
16 var selected_plugin_name = $("#plugins option:selected").attr("value");
17 $("#" + selected_plugin_name + "_options").show();
22 * Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
24 $(document).ready(function() {
25 $("input[type='radio'][name$='sql_structure_or_data']").change(function() {
26 var show = $("input[type='radio'][name$='sql_structure_or_data']:checked").attr("value");
28 // disable the SQL comment options
29 $("#checkbox_sql_dates").parent().fadeTo('fast', 0.4);
30 $("#checkbox_sql_dates").attr('disabled', 'disabled');
31 $("#checkbox_sql_relation").parent().fadeTo('fast', 0.4);
32 $("#checkbox_sql_relation").attr('disabled', 'disabled');
33 $("#checkbox_sql_mime").parent().fadeTo('fast', 0.4);
34 $("#checkbox_sql_mime").attr('disabled', 'disabled');
36 // enable the SQL comment options
37 $("#checkbox_sql_dates").parent().fadeTo('fast', 1);
38 $("#checkbox_sql_dates").removeAttr('disabled');
39 $("#checkbox_sql_relation").parent().fadeTo('fast', 1);
40 $("#checkbox_sql_relation").removeAttr('disabled');
41 $("#checkbox_sql_mime").parent().fadeTo('fast', 1);
42 $("#checkbox_sql_mime").removeAttr('disabled');
49 * Toggles the hiding and showing of plugin structure-specific and data-specific
53 function toggle_structure_data_opts(pluginName) {
54 var radioFormName = pluginName + "_structure_or_data";
55 var dataDiv = "#" + pluginName + "_data";
56 var structureDiv = "#" + pluginName + "_structure";
57 var show = $("input[type='radio'][name='" + radioFormName + "']:checked").attr("value");
59 $(dataDiv).slideDown('slow');
60 $(structureDiv).slideUp('slow');
62 $(structureDiv).slideDown('slow');
63 if(show == 'structure') {
64 $(dataDiv).slideUp('slow');
66 $(dataDiv).slideDown('slow');
71 $(document).ready(function() {
72 $("input[type='radio'][name='latex_structure_or_data']").change(function() {
73 toggle_structure_data_opts("latex");
75 $("input[type='radio'][name='odt_structure_or_data']").change(function() {
76 toggle_structure_data_opts("odt");
78 $("input[type='radio'][name='texytext_structure_or_data']").change(function() {
79 toggle_structure_data_opts("texytext");
81 $("input[type='radio'][name='htmlword_structure_or_data']").change(function() {
82 toggle_structure_data_opts("htmlword");
84 $("input[type='radio'][name='sql_structure_or_data']").change(function() {
85 toggle_structure_data_opts("sql");
90 * Toggles the disabling of the "save to file" options
92 function toggle_save_to_file() {
93 if($("#radio_dump_asfile:checked").length == 0) {
94 $("#ul_save_asfile > li").fadeTo('fast', 0.4);
95 $("#ul_save_asfile > li > input").attr('disabled', 'disabled');
96 $("#ul_save_asfile > li> select").attr('disabled', 'disabled');
98 $("#ul_save_asfile > li").fadeTo('fast', 1);
99 $("#ul_save_asfile > li > input").removeAttr('disabled');
100 $("#ul_save_asfile > li> select").removeAttr('disabled');
104 $(document).ready(function() {
105 toggle_save_to_file();
106 $("input[type='radio'][name='output_format']").change(function() {
107 toggle_save_to_file();
112 * For SQL plugin, toggles the disabling of the "display comments" options
114 function toggle_sql_include_comments() {
115 $("#checkbox_sql_include_comments").change(function() {
116 if($("#checkbox_sql_include_comments:checked").length == 0) {
117 $("#ul_include_comments > li").fadeTo('fast', 0.4);
118 $("#ul_include_comments > li > input").attr('disabled', 'disabled');
120 // If structure is not being exported, the comment options for structure should not be enabled
121 if($("#radio_sql_structure_or_data_data:checked").length == 1) {
122 $("#text_sql_header_comment").parent("li").fadeTo('fast', 1);
123 $("#text_sql_header_comment").removeAttr('disabled');
125 $("#ul_include_comments > li").fadeTo('fast', 1);
126 $("#ul_include_comments > li > input").removeAttr('disabled');
133 * For SQL plugin, if "CREATE TABLE options" is checked/unchecked, check/uncheck each of its sub-options
135 $(document).ready(function() {
136 $("#checkbox_sql_create_table_statements").change(function() {
137 if($("#checkbox_sql_create_table_statements:checked").length == 0) {
138 $("#checkbox_sql_if_not_exists").removeAttr('checked');
139 $("#checkbox_sql_auto_increment").removeAttr('checked');
141 $("#checkbox_sql_if_not_exists").attr('checked', 'checked');
142 $("#checkbox_sql_auto_increment").attr('checked', 'checked');
148 * Disables the view output as text option if the output must be saved as a file
150 $(document).ready(function() {
151 $("#plugins").change(function() {
152 var active_plugin = $("#plugins option:selected").attr("value");
153 var force_file = $("#force_file_" + active_plugin).attr("value");
154 if(force_file == "true") {
155 $("#radio_view_as_text").attr('disabled', 'disabled');
156 $("#radio_view_as_text").parent().fadeTo('fast', 0.4);
158 $("#radio_view_as_text").removeAttr('disabled');
159 $("#radio_view_as_text").parent().fadeTo('fast', 1);
165 * Toggles display of options when quick and custom export are selected
167 function toggle_quick_or_custom() {
168 if($("$(this):checked").attr("value") == "custom") {
169 $("#databases_and_tables").show();
172 $("#format_specific_opts").show();
173 $("#output_quick_export").hide();
174 var selected_plugin_name = $("#plugins option:selected").attr("value");
175 $("#" + selected_plugin_name + "_options").show();
177 $("#databases_and_tables").hide();
180 $("#format_specific_opts").hide();
181 $("#output_quick_export").show();
185 $(document).ready(function() {
186 $("input[type='radio'][name='quick_or_custom']").change(function() {
187 toggle_quick_or_custom();
192 * Sets up the interface for Javascript-enabled browsers since the default is for
193 * Javascript-disabled browsers
195 $(document).ready(function() {
196 if($("input[type='hidden'][name='export_method']").attr("value") != "custom-no-form") {
197 $("#quick_or_custom").show();
199 $("#scroll_to_options_msg").hide();
200 $(".format_specific_options").hide();
201 $(".format_specific_options").css({ "border": 0, "margin": 0, "padding": 0});
202 $(".format_specific_options h3").remove();
203 toggle_quick_or_custom();
204 toggle_structure_data_opts($("select[id='plugins']").attr("value"));
205 toggle_sql_include_comments();
209 * Disables the "Dump some row(s)" sub-options when it is not selected
211 $(document).ready(function() {
212 $("input[type='radio'][name='allrows']").change(function() {
213 if($("input[type='radio'][name='allrows']:checked").attr("value") == "1") {
214 $("label[for='limit_to']").fadeTo('fast', 0.4);
215 $("label[for='limit_from']").fadeTo('fast', 0.4);
216 $("input[type='text'][name='limit_to']").attr('disabled', 'disabled');
217 $("input[type='text'][name='limit_from']").attr('disabled', 'disabled');
219 $("label[for='limit_to']").fadeTo('fast', 1);
220 $("label[for='limit_from']").fadeTo('fast', 1);
221 $("input[type='text'][name='limit_to']").removeAttr('disabled');
222 $("input[type='text'][name='limit_from']").removeAttr('disabled');