1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * Functions used in the export tab
9 * Toggles the hiding and showing of each plugin's options
10 * according to the currently selected plugin from the dropdown list
12 $(document).ready(function() {
13 $("#plugins").change(function() {
14 $(".format_specific_options").each(function() {
17 var selected_plugin_name = $("#plugins option:selected").attr("value");
18 $("#" + selected_plugin_name + "_options").show();
23 * Toggles the enabling and disabling of the SQL plugin's comment options that apply only when exporting structure
25 $(document).ready(function() {
26 $("input[type='radio'][name$='sql_structure_or_data']").change(function() {
27 var show = $("input[type='radio'][name$='sql_structure_or_data']:checked").attr("value");
29 // disable the SQL comment options
30 $("#checkbox_sql_dates").parent().fadeTo('fast', 0.4);
31 $("#checkbox_sql_dates").attr('disabled', 'disabled');
32 $("#checkbox_sql_relation").parent().fadeTo('fast', 0.4);
33 $("#checkbox_sql_relation").attr('disabled', 'disabled');
34 $("#checkbox_sql_mime").parent().fadeTo('fast', 0.4);
35 $("#checkbox_sql_mime").attr('disabled', 'disabled');
37 // enable the SQL comment options
38 $("#checkbox_sql_dates").parent().fadeTo('fast', 1);
39 $("#checkbox_sql_dates").removeAttr('disabled');
40 $("#checkbox_sql_relation").parent().fadeTo('fast', 1);
41 $("#checkbox_sql_relation").removeAttr('disabled');
42 $("#checkbox_sql_mime").parent().fadeTo('fast', 1);
43 $("#checkbox_sql_mime").removeAttr('disabled');
50 * Toggles the hiding and showing of plugin structure-specific and data-specific
54 function toggle_structure_data_opts(pluginName) {
55 var radioFormName = pluginName + "_structure_or_data";
56 var dataDiv = "#" + pluginName + "_data";
57 var structureDiv = "#" + pluginName + "_structure";
58 var show = $("input[type='radio'][name='" + radioFormName + "']:checked").attr("value");
60 $(dataDiv).slideDown('slow');
61 $(structureDiv).slideUp('slow');
63 $(structureDiv).slideDown('slow');
64 if(show == 'structure') {
65 $(dataDiv).slideUp('slow');
67 $(dataDiv).slideDown('slow');
72 $(document).ready(function() {
73 $("input[type='radio'][name='latex_structure_or_data']").change(function() {
74 toggle_structure_data_opts("latex");
76 $("input[type='radio'][name='odt_structure_or_data']").change(function() {
77 toggle_structure_data_opts("odt");
79 $("input[type='radio'][name='texytext_structure_or_data']").change(function() {
80 toggle_structure_data_opts("texytext");
82 $("input[type='radio'][name='htmlword_structure_or_data']").change(function() {
83 toggle_structure_data_opts("htmlword");
85 $("input[type='radio'][name='sql_structure_or_data']").change(function() {
86 toggle_structure_data_opts("sql");
91 * Toggles the disabling of the "save to file" options
93 $(document).ready(function() {
94 $("input[type='radio'][name='output_format']").change(function() {
95 if($("#radio_dump_asfile:checked").length == 0) {
96 $("#ul_save_asfile > li").fadeTo('fast', 0.4);
97 $("#ul_save_asfile > li > input").attr('disabled', 'disabled');
98 $("#ul_save_asfile > li> select").attr('disabled', 'disabled');
100 $("#ul_save_asfile > li").fadeTo('fast', 1);
101 $("#ul_save_asfile > li > input").removeAttr('disabled');
102 $("#ul_save_asfile > li> select").removeAttr('disabled');
108 * For SQL plugin, toggles the disabling of the "display comments" options
110 function toggle_sql_include_comments() {
111 $("#checkbox_sql_include_comments").change(function() {
112 if($("#checkbox_sql_include_comments:checked").length == 0) {
113 $("#ul_include_comments > li").fadeTo('fast', 0.4);
114 $("#ul_include_comments > li > input").attr('disabled', 'disabled');
116 // If structure is not being exported, the comment options for structure should not be enabled
117 if($("#radio_sql_structure_or_data_data:checked").length == 1) {
118 $("#text_sql_header_comment").parent("li").fadeTo('fast', 1);
119 $("#text_sql_header_comment").removeAttr('disabled');
121 $("#ul_include_comments > li").fadeTo('fast', 1);
122 $("#ul_include_comments > li > input").removeAttr('disabled');
129 * For SQL plugin, if "CREATE TABLE options" is checked/unchecked, check/uncheck each of its sub-options
131 $(document).ready(function() {
132 $("#checkbox_sql_create_table_statements").change(function() {
133 if($("#checkbox_sql_create_table_statements:checked").length == 0) {
134 $("#checkbox_sql_if_not_exists").removeAttr('checked');
135 $("#checkbox_sql_auto_increment").removeAttr('checked');
137 $("#checkbox_sql_if_not_exists").attr('checked', 'checked');
138 $("#checkbox_sql_auto_increment").attr('checked', 'checked');
144 * Disables the view output as text option if the output must be saved as a file
146 $(document).ready(function() {
147 $("#plugins").change(function() {
148 var active_plugin = $("#plugins option:selected").attr("value");
149 var force_file = $("#force_file_" + active_plugin).attr("value");
150 if(force_file == "true") {
151 $("#radio_view_as_text").attr('disabled', 'disabled');
152 $("#radio_view_as_text").parent().fadeTo('fast', 0.4);
154 $("#radio_view_as_text").removeAttr('disabled');
155 $("#radio_view_as_text").parent().fadeTo('fast', 1);
161 * Toggles display of options when quick and custom export are selected
163 function toggle_quick_or_custom() {
164 if($("$(this):checked").attr("value") == "custom") {
165 $("#databases_and_tables").show();
168 $("#format_specific_opts").show();
169 $("#output_quick_export").hide();
170 var selected_plugin_name = $("#plugins option:selected").attr("value");
171 $("#" + selected_plugin_name + "_options").show();
173 $("#databases_and_tables").hide();
176 $("#format_specific_opts").hide();
177 $("#output_quick_export").show();
181 $(document).ready(function() {
182 $("input[type='radio'][name='quick_or_custom']").change(function() {
183 toggle_quick_or_custom();
188 * Sets up the interface for Javascript-enabled browsers since the default is for
189 * Javascript-disabled browsers
191 $(document).ready(function() {
192 if($("input[type='hidden'][name='export_method']").attr("value") != "custom-no-form") {
193 $("#quick_or_custom").show();
195 $("#scroll_to_options_msg").hide();
196 $(".format_specific_options").hide();
197 $(".format_specific_options").css({ "border": 0, "margin": 0, "padding": 0});
198 $(".format_specific_options h3").remove();
199 toggle_quick_or_custom();
200 toggle_structure_data_opts($("select[id='plugins']").attr("value"));
201 toggle_sql_include_comments();
205 * Disables the "Dump some row(s)" sub-options when it is not selected
207 $(document).ready(function() {
208 $("input[type='radio'][name='allrows']").change(function() {
209 if($("input[type='radio'][name='allrows']:checked").attr("value") == "1") {
210 $("label[for='limit_to']").fadeTo('fast', 0.4);
211 $("label[for='limit_from']").fadeTo('fast', 0.4);
212 $("input[type='text'][name='limit_to']").attr('disabled', 'disabled');
213 $("input[type='text'][name='limit_from']").attr('disabled', 'disabled');
215 $("label[for='limit_to']").fadeTo('fast', 1);
216 $("label[for='limit_from']").fadeTo('fast', 1);
217 $("input[type='text'][name='limit_to']").removeAttr('disabled');
218 $("input[type='text'][name='limit_from']").removeAttr('disabled');