diff options
Diffstat (limited to 'ishtar_common/static/js/ishtar.js')
-rw-r--r-- | ishtar_common/static/js/ishtar.js | 65 |
1 files changed, 57 insertions, 8 deletions
diff --git a/ishtar_common/static/js/ishtar.js b/ishtar_common/static/js/ishtar.js index 9021dc4f5..6017aed64 100644 --- a/ishtar_common/static/js/ishtar.js +++ b/ishtar_common/static/js/ishtar.js @@ -37,11 +37,62 @@ function get_next_table_id(){} function get_previous_table_id(){} var shortcut_url = ''; +var advanced_menu = false; var activate_all_search_url = '/activate-all-search/'; var activate_own_search_url = '/activate-own-search/'; +var activate_advanced_url = '/activate-advanced-menu/'; +var activate_simple_url = '/activate-simple-menu/'; +function init_shortcut_menu(html){ + $("#progress").hide(); + $("#context_menu").html(html); + $(".chosen-select").chosen(); + if (advanced_menu) { + init_advanced_shortcut_fields(); + } else { + init_shortcut_fields(); + } + $("#short-menu-advanced").click(function(){ + $.get(url_path + activate_advanced_url, + load_shortcut_menu + ); + }); + $("#short-menu-simple").click(function(){ + $.get(url_path + activate_simple_url, + load_shortcut_menu + ); + }); +} + function init_shortcut_fields(){ + $("#current_file").change(function(){ + $.post('/' + url_path + 'update-current-item/', + {item:'file', value:$("#current_file").val()}, + load_shortcut_menu + ); + }); + $("#current_operation").change(function(){ + $.post('/' + url_path + 'update-current-item/', + {item:'operation', value:$("#current_operation").val()}, + load_shortcut_menu + ); + }); + $("#current_contextrecord").change(function(){ + $.post('/' + url_path + 'update-current-item/', + {item:'contextrecord', value:$("#current_contextrecord").val()}, + load_shortcut_menu + ); + }); + $("#current_find").change(function(){ + $.post('/' + url_path + 'update-current-item/', + {item:'find', value:$("#current_find").val()}, + load_shortcut_menu + ); + }); +} + +function init_advanced_shortcut_fields(){ $('#id_file-shortcut').change(function(){ $("#id_select_file-shortcut").attr( 'title', $('#id_select_file-shortcut').val()); @@ -76,13 +127,6 @@ function init_shortcut_fields(){ }); } -function init_shortcut_menu(html){ - $("#progress").hide(); - $("#context_menu").html(html); - $(".chosen-select").chosen(); - init_shortcut_fields(); -} - function display_info(msg){ $('#message .information .content').html(msg); $('#message').fadeIn('slow'); @@ -206,7 +250,12 @@ function load_window(url, speed, on_success){ } function load_current_window(url, model_name){ - var id = $("#id_" + model_name + "-shortcut").val(); + var id; + if (advanced_menu){ + id = $("#id_" + model_name + "-shortcut").val(); + } else { + id = $("#current_" + model_name).val(); + } if (!id) return; url = url.split('/'); url[url.length - 1] = id; |