summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1aa0fea)
raw | patch | inline | side by side (parent: 1aa0fea)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 26 Sep 2007 12:58:48 +0000 (12:58 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 26 Sep 2007 12:58:48 +0000 (12:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7411 594d385d-05f5-0310-b6e9-bd551577e9d8
html/include/focus.js | patch | blob | history | |
ihtml/themes/default/msg_dialog.tpl | patch | blob | history | |
include/class_msg_dialog.inc | patch | blob | history |
diff --git a/html/include/focus.js b/html/include/focus.js
index a5452beb620353c7c3fcda4f464b65c993c3e2fb..75d22c4f90421943a253c6a1b91b9829e9994d43 100644 (file)
--- a/html/include/focus.js
+++ b/html/include/focus.js
}
-
+/* 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 = "";
-
- if(document.getElementById('current_msg_dialogs')){
- var cur_id = document.getElementById('current_msg_dialogs').value;
- if(cur_id != ""){
- var ele = document.getElementById('e_layer2' + cur_id);
- ele.onmousemove = "";
- hide('e_layer2' + cur_id);
- document.getElementById('closed_msg_dialogs').value += "," + cur_id;
- document.getElementById('current_msg_dialogs').value= "";
+ 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 != ""){
- var ele = document.getElementById('e_layer2' + i_id);
- ele.style.display= 'block' ;
- document.getElementById('pending_msg_dialogs').value= tmp;
- document.getElementById('current_msg_dialogs').value= i_id;
- ele.onmousedown = start_move_div_by_cursor;
- ele.onmouseup = stop_move_div_by_cursor;
- ele.onmousemove = move_div_by_cursor;
+ 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";
+ }
}
}
- }
}
-var enable_move_div_by_cursor = false;
-function start_move_div_by_cursor()
+
+/* 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)
{
- enable_move_div_by_cursor = true;
+ 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()
{
- enable_move_div_by_cursor = false;
+ 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(enable_move_div_by_cursor){
if(document.getElementById('current_msg_dialogs')){
- var cur_id = document.getElementById('current_msg_dialogs').value;
+
+ /* 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 != ""){
- var ele = document.getElementById('e_layer2' + cur_id);
- ele.style.position = "absolute";
- ele.style.top = (e.screenY - 100) + "px";
- ele.style.left = (e.screenX -50)+ "px";
+ 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";
}
}
}
index 586a7b594429752422a07208f670df6818cd05a2..654453dcec6301fb3a5afa660c69ad68c3e7714e 100644 (file)
+{if $frame}
{if $IE}
- <iframe id='e_layer3{$i_ID}'
+ <iframe id='e_layer3'
style="
position:absolute;
width:100%;
filter:chroma(color=#FFFFFF);
z-index:0; ">
</iframe>
- <div id='e_layer2{$i_ID}'
+ <div id='e_layer2'
+ style='display:none;position:absolute; width:400%;'
+<!--
style="
position: absolute;
left: 0px;
z-index:0;
width:100%;
height:100%;
- filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='images/opacity_black.png'); ">
+ filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='images/opacity_black.png'); "
+-->
+
{else}
- <div id='e_layer2{$i_ID}'
- style='display:none;'
- onClick="move_div_by_cursor('e_layer2{$i_ID}');"
- >
-<!-- style="
+ <div id='e_layer2'
+ style="
position: absolute;
left: 0px;
top: 0px;
bottom:0px;
z-index:0;
background-image: url(images/opacity_black.png);">
--->
-{/if}
+{/if}
+{else}
<div id='e_layer{$i_ID}'
- style='left:20%;
- right:20%;
- top:30%;
+ style='
+ width:60%;
+ left:200px;
+ top:200px;
background-color:white;
padding:5px;
border:5px solid red;
z-index:150;
+ display:none;
position:absolute;'>
<table style='width:100%' summary='' border=0>
<tr>
</tr>
</table>
</div>
-</div>
+{/if}
index 90b4b07f26e45b11bca9cf45a8af08a9ee734905..d166ad328fa91ac3f7f18db8568af49f7ac9757d 100644 (file)
$smarty->assign("s_Message",$this->s_Message);
$smarty->assign("s_Title",$this->s_Title);
$smarty->assign("i_ID",$this->i_ID);
+ $smarty->assign("frame",false);
$smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']));
return($smarty->fetch(get_template_path('msg_dialog.tpl')));
}
if(isset($_SESSION['msg_dialogs']) && is_array($_SESSION['msg_dialogs'])){
+ /* Get frame one */
+ $smarty = get_smarty();
+ $smarty->assign("frame", true);
+ $smarty->assign("IE",preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT']));
+ $return = $smarty->fetch(get_template_path('msg_dialog.tpl'));
+
foreach($_SESSION['msg_dialogs'] as $key => $dialog){
if(preg_match("/".$dialog->get_ID()."/",$seen)){
}
unset($_SESSION['msg_dialogs'][$key]);
}
+ $dialog_ids = preg_replace("/,$/","",$dialog_ids);
+
+ $return .= "</div>";
+ $return .="<input type='hidden' style='width:400px;' name='pending_msg_dialogs' id='pending_msg_dialogs' value='".$dialog_ids."'>";
+ $return .="<input type='hidden' style='width:400px;' name='closed_msg_dialogs' id='closed_msg_dialogs' value=''>";
+ $return .="<input type='hidden' style='width:400px;' name='current_msg_dialogs' id='current_msg_dialogs' value=''>";
+ $return .="<input type='hidden' style='width:700px;' name='js_debug' id='js_debug'>";
}
- $dialog_ids = preg_replace("/,$/","",$dialog_ids);
-
- $return .="<input type='hidden' style='width:400px;' name='pending_msg_dialogs' id='pending_msg_dialogs' value='".$dialog_ids."'>";
- $return .="<input type='hidden' style='width:400px;' name='closed_msg_dialogs' id='closed_msg_dialogs' value=''>";
- $return .="<input type='hidden' style='width:400px;' name='current_msg_dialogs' id='current_msg_dialogs' value=''>";
return($return);
}
}