From f1b8ac2fda166687f2ae1f16f7423bd9a627dbbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Bernigaud?= <come.bernigaud@laposte.net> Date: Tue, 7 Jan 2014 11:02:18 +0100 Subject: [PATCH] Fixes: #2928 Cleaned up message dialog, improved display, added LDAP_ERROR category --- html/include/fusiondirectory.js | 21 ++++++------ html/themes/default/style.css | 12 +++++++ ihtml/themes/default/msg_dialog.tpl | 50 +++++++++++++---------------- include/class_msg_dialog.inc | 4 +-- 4 files changed, 47 insertions(+), 40 deletions(-) diff --git a/html/include/fusiondirectory.js b/html/include/fusiondirectory.js index 4b4f35477..858670876 100644 --- a/html/include/fusiondirectory.js +++ b/html/include/fusiondirectory.js @@ -471,8 +471,8 @@ function start_move_div_by_cursor(e) y = dialog.style.top; x = x.replace(/[^0-9]/g,""); y = y.replace(/[^0-9]/g,""); - if(!y) y = 1; - if(!x) x = 1; + if(!y) y = 200; + if(!x) x = 200; } /* Get mouse position within msg_dialog @@ -527,12 +527,12 @@ function move_div_by_cursor(e) */ if(window.event){ event = window.event; - mouse_pos_x =event.clientX; - mouse_pos_y =event.clientY; + 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; + mouse_pos_x = event.screenX; + mouse_pos_y = event.screenY; }else{ return; } @@ -548,11 +548,12 @@ function move_div_by_cursor(e) /* 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 + 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"; + /* Assign new values */ + dialog.style.left = (cur_div_x ) + "px"; + dialog.style.top = (cur_div_y ) + "px"; + dialog.style.margin = "0"; } } } diff --git a/html/themes/default/style.css b/html/themes/default/style.css index 271615b90..b133365b1 100644 --- a/html/themes/default/style.css +++ b/html/themes/default/style.css @@ -573,21 +573,33 @@ background:#fbe3e4; color:#8a1f11; border-color:#fbc2c4; } +.error h1,.error h2,.error h3,.error h4,.error h5,.error h6 { +color:#8a3700; +} .notice { background:#fff6bf; color:#514721; border-color:#ffd324; } +.notice h1,.notice h2,.notice h3,.notice h4,.notice h5,.notice h6 { +color:#412701; +} .success { background:#e6efc2; color:#264409; border-color:#c6d880; } +.success h1,.success h2,.success h3,.success h4,.success h5,.success h6 { +color:#378a00; +} .info { background:#d5edf8; color:#205791; border-color:#92cae4; } +.info h1,.info h2,.info h3,.info h4,.info h5,.info h6 { +color:#00378a; +} /* Header */ diff --git a/ihtml/themes/default/msg_dialog.tpl b/ihtml/themes/default/msg_dialog.tpl index 1cefb9b01..fe0344b85 100644 --- a/ihtml/themes/default/msg_dialog.tpl +++ b/ihtml/themes/default/msg_dialog.tpl @@ -17,24 +17,26 @@ </div> {/if} - {if $i_Type == $smarty.const.INFO_DIALOG || $i_Type == $smarty.const.CONFIRM_DIALOG || $i_Type == $smarty.const.OK_CANCEL_DIALOG} + {if $i_Type == $smarty.const.INFO_DIALOG || $i_Type == $smarty.const.CONFIRM_DIALOG} <div id="e_layer{$i_ID}" class="info msgdialog"> + {elseif $i_Type == $smarty.const.WARNING_DIALOG} + <div id="e_layer{$i_ID}" class="notice msgdialog"> {else} <div id="e_layer{$i_ID}" class="error msgdialog"> {/if} - <div id="e_layerTitle{$i_ID}" class="msgtitle"> - <h2> - {if $i_Type == $smarty.const.ERROR_DIALOG} - <img src="images/error.png" class="center" alt="{t}Error{/t}"/> - {elseif $i_Type == $smarty.const.WARNING_DIALOG} - <img src="images/warning.png" class="center" alt="{t}Warning{/t}"/> - {elseif $i_Type == $smarty.const.INFO_DIALOG || $i_Type == $smarty.const.CONFIRM_DIALOG || $i_Type == $smarty.const.OK_CANCEL_DIALOG} - <img src="images/info.png" class="center" alt="{t}Information{/t}"/> - {/if} - {$s_Title} - </h2> - </div> + <div id="e_layerTitle{$i_ID}" class="msgtitle"> + <h2> + {if $i_Type == $smarty.const.ERROR_DIALOG} + <img src="images/error.png" class="center" alt="{t}Error{/t}"/> + {elseif $i_Type == $smarty.const.WARNING_DIALOG} + <img src="images/warning.png" class="center" alt="{t}Warning{/t}"/> + {elseif $i_Type == $smarty.const.INFO_DIALOG || $i_Type == $smarty.const.CONFIRM_DIALOG} + <img src="images/info.png" class="center" alt="{t}Information{/t}"/> + {/if} + {$s_Title} + </h2> + </div> <table style="z-index:250;width:100%;"> <tr> @@ -43,25 +45,17 @@ <br/> </td> {if $s_Trace != "" && $i_TraceCnt != 0} - <td style="width:20px; vertical-align:top; cursor:pointer;"> - <div onClick="$('trace_{$i_ID}').toggle();"><u>Trace</u></div> - </td> + <td style="width:20px; vertical-align:top; cursor:pointer;"> + <div onClick="$('trace_{$i_ID}').toggle();"><u>Trace</u></div> + </td> {/if} </tr> </table> <div class="plugbottom"> - {if $i_Type == $smarty.const.ERROR_DIALOG || $i_Type == $smarty.const.WARNING_DIALOG || $i_Type == $smarty.const.INFO_DIALOG} - <input type="button" id="MSG_OK{$i_ID}" type="button" name="MSG_OK{$i_ID}" - onClick="next_msg_dialog();" value="{t}Ok{/t}"/> - {elseif $i_Type == $smarty.const.CONFIRM_DIALOG} - <input type="button" id="MSG_OK{$i_ID}" type="submit" name="MSG_OK{$i_ID}" - onClick="next_msg_dialog();" value="{t}Ok{/t}"/> - <input type="button" type="button" name="MSG_CANCEL{$i_ID}" - onClick="next_msg_dialog();" value="{t}Cancel{/t}"/> - {elseif $i_Type == $smarty.const.OK_CANCEL_DIALOG} - <input type="button" id="MSG_OK{$i_ID}" type="submit" name="MSG_OK{$i_ID}" - onClick="next_msg_dialog();" value="{t}Ok{/t}"/> - <input type="button" type="submit" name="MSG_CANCEL{$i_ID}" + <input type="button" id="MSG_OK{$i_ID}" name="MSG_OK{$i_ID}" + onClick="next_msg_dialog();" value="{t}Ok{/t}"/> + {if $i_Type == $smarty.const.CONFIRM_DIALOG} + <input type="button" name="MSG_CANCEL{$i_ID}" onClick="next_msg_dialog();" value="{t}Cancel{/t}"/> {/if} </div> diff --git a/include/class_msg_dialog.inc b/include/class_msg_dialog.inc index f01cd0cd7..92ed301ad 100644 --- a/include/class_msg_dialog.inc +++ b/include/class_msg_dialog.inc @@ -26,8 +26,8 @@ define("INFO_DIALOG", 10001); define("WARNING_DIALOG", 10002); define("ERROR_DIALOG", 10003); +define("LDAP_ERROR", 10003); // LDAP_ERROR is the same as ERROR_DIALOG define("CONFIRM_DIALOG", 10004); -define("OK_CANCEL_DIALOG", 10005); define("FATAL_ERROR_DIALOG", 10006); /*! @@ -60,7 +60,7 @@ class msg_dialog return; } - if (!in_array($i_type, array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG,OK_CANCEL_DIALOG))) { + if (!in_array($i_type, array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG))) { trigger_error("Invalid msg_dialog type."); $i_type = INFO_DIALOG; } -- GitLab