X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=html%2Finclude%2Ffocus.js;h=29003ea5b62fb2800c0497bcf01686d0b415bbe5;hb=bf781db3d9f73f8bd555ce039f659ca7ee3adf54;hp=edc7cda7faeee68a6c093812f09de228a14194d9;hpb=63cd11d95083ba0fcec3d41d9218500cec8cc3e6;p=gosa.git diff --git a/html/include/focus.js b/html/include/focus.js index edc7cda7f..29003ea5b 100644 --- a/html/include/focus.js +++ b/html/include/focus.js @@ -330,6 +330,12 @@ function adjust_height(e) { suggested= inner_height-230; } } + + /* Reduce height if a list footer is set */ + if(document.getElementById("t_scrollfoot")){ + suggested = suggested -20; + } + document.getElementById("d_scrollbody").style.height=suggested+"px"; } return true; @@ -340,17 +346,25 @@ function absTop(e) { } // Automatic resize (width) of divlists -function adjust_width(e) { - if (!e) e=window.event; +function adjust_width(e) +{ + + /* Get event ... it seems to be unused here ...*/ + if (!e) { + e=window.event; + } // Known to not work with IE if(document.defaultView && document.getElementById("t_scrolltable")) { - // Resize the div - var div_width=parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('width')); + + // Get current width of divlist + var div_width = parseInt(document.defaultView.getComputedStyle(document.getElementById("t_scrolltable"),"").getPropertyValue('width')); + + // Get window width var width= parseInt(window.innerWidth); - // Resize the body cells - var diff= width-div_width-470; + // Resize the body cells, 470 represents the info box and the navigation part + var diff= width - div_width - 470; // window has been upscaled if(div_width+diff>=600) { @@ -376,7 +390,7 @@ function adjust_width(e) { var width= parseInt(window.innerWidth); // Resize the body cells - var diff= width-div_width-470; + var diff= width-div_width-200; // window has been upscaled if(div_width+diff>=600) { @@ -434,4 +448,186 @@ function focus_field() } +/* This function pops up messages from message queue + All messages are hidden in html output (style='display:none;'). + This function makes single messages visible till there are no more dialogs queued. + + hidden inputs: + current_msg_dialogs - Currently visible dialog + closed_msg_dialogs - IDs of already closed dialogs + pending_msg_dialogs - Queued dialog IDs. +*/ +function next_msg_dialog() +{ + var s_pending = ""; + var a_pending = new Array(); + var i_id = 0; + var i = 0; + var tmp = ""; + var ele = null; + var ele2 = null; + var cur_id = ""; + + if(document.getElementById('current_msg_dialogs')){ + cur_id = document.getElementById('current_msg_dialogs').value; + if(cur_id != ""){ + ele = document.getElementById('e_layer' + cur_id); + ele.onmousemove = ""; + hide('e_layer' + cur_id); + document.getElementById('closed_msg_dialogs').value += "," + cur_id; + document.getElementById('current_msg_dialogs').value= ""; + } + } + + if(document.getElementById('pending_msg_dialogs')){ + s_pending = document.getElementById('pending_msg_dialogs').value; + a_pending = s_pending.split(","); + if(a_pending.length){ + i_id = a_pending.pop(); + for (i = 0 ; i < a_pending.length; ++i){ + tmp = tmp + a_pending[i] + ','; + } + tmp = tmp.replace(/,$/g,""); + if(i_id != ""){ + ele = document.getElementById('e_layer' + i_id); + ele.style.display= 'block' ; + document.getElementById('pending_msg_dialogs').value= tmp; + document.getElementById('current_msg_dialogs').value= i_id; + ele2 = document.getElementById('e_layer2') ; + ele.onmousedown = start_move_div_by_cursor; + ele2.onmouseup = stop_move_div_by_cursor; + ele2.onmousemove = move_div_by_cursor; + }else{ + ele2 = document.getElementById('e_layer2') ; + ele2.style.display ="none"; + } + } + } +} + + +/* Drag & drop for message dialogs */ +var enable_move_div_by_cursor = false; // Indicates wheter the div movement is enabled or not +var mouse_x_on_div = 0; // +var mouse_y_on_div = 0; +var div_offset_x = 0; +var div_offset_y = 0; + +/* Activates msg_dialog drag & drop + * This function is called when clicking on a displayed msg_dialog + */ +function start_move_div_by_cursor(e) +{ + var x = 0; + var y = 0; + var cur_id = 0; + var dialog = null; + var event = null; + + /* Get current msg_dialog position + */ + cur_id = document.getElementById('current_msg_dialogs').value; + if(cur_id != ""){ + dialog = document.getElementById('e_layer' + cur_id); + x = dialog.style.left; + y = dialog.style.top; + x = x.replace(/[^0-9]/g,""); + y = y.replace(/[^0-9]/g,""); + if(!y) y = 1; + if(!x) x = 1; + } + + /* Get mouse position within msg_dialog + */ + if(window.event){ + event = window.event; + if(event.offsetX){ + div_offset_x = event.clientX -x; + div_offset_y = event.clientY -y; + enable_move_div_by_cursor = true; + } + }else if(e){ + event = e; + if(event.layerX){ + div_offset_x = event.screenX -x; + div_offset_y = event.screenY -y; + enable_move_div_by_cursor = true; + } + } +} + + +/* Deactivate msg_dialog movement +*/ +function stop_move_div_by_cursor() +{ + mouse_x_on_div = 0; + mouse_y_on_div = 0; + div_offset_x = 0; + div_offset_y = 0; + enable_move_div_by_cursor = false; +} + + +/* Move msg_dialog with cursor */ +function move_div_by_cursor(e) +{ + var event = false; + var mouse_pos_x = 0; + var mouse_pos_y = 0; + var cur_div_x = 0; + var cur_div_y = 0; + var cur_id = 0; + var dialog = null; + + + if(undefined !== enable_move_div_by_cursor && enable_move_div_by_cursor == true){ + + if(document.getElementById('current_msg_dialogs')){ + + /* Get mouse position on screen + */ + if(window.event){ + event = window.event; + mouse_pos_x =event.clientX; + mouse_pos_y =event.clientY; + }else if (e){ + event = e; + mouse_pos_x =event.screenX; + mouse_pos_y =event.screenY; + }else{ + return; + } + + /* Get id of current msg_dialog */ + cur_id = document.getElementById('current_msg_dialogs').value; + if(cur_id != ""){ + dialog = document.getElementById('e_layer' + cur_id); + + /* Calculate new position */ + cur_div_x = mouse_pos_x - div_offset_x; + cur_div_y = mouse_pos_y - div_offset_y; + + /* Ensure that dialog can't be moved out of screen */ + if(cur_div_x < 0 ) cur_div_x = 0 + if(cur_div_y < 0 ) cur_div_y = 0 + + /* Assign new values */ + dialog.style.left = (cur_div_x ) + "px"; + dialog.style.top = (cur_div_y ) + "px"; + } + } + } +} + +function send_menu_action(str) +{ + if(str != "" && str != "#"){ + if(document.getElementById('menu_action')){ + document.getElementById('menu_action').value=str; + document.mainform.submit(); + } + } +} + // vim:ts=2:syntax