Commit e988d35a authored by François Jacquet's avatar François Jacquet
Browse files

Update DHTML tip message to version 1.6

Move styling from warehouse.js & Warehouse.php to stylesheet.css
New tipmessage/main16.js file
Init tipmessage directly in main16.js file
Reduce file size: 1.9ko VS. 6.1ko for version 1.5
parent 630c66f2
......@@ -176,14 +176,13 @@ if(!defined('WAREHOUSE_PHP'))
<link rel="stylesheet" href="assets/themes/<?php echo Preferences('THEME'); ?>/stylesheet.css?v=<?php echo $RosarioVersion; ?>" />
<script src="assets/js/jquery.js"></script>
<script src="assets/js/jquery.form.js"></script>
<script src="assets/js/tipmessage/main15.js"></script>
<script src="assets/js/tipmessage/main16.js"></script>
<script src="assets/js/warehouse.js?v=<?php echo $RosarioVersion; ?>"></script>
<script src="assets/js/jscalendar/calendar+setup.js"></script>
<script src="assets/js/jscalendar/lang/calendar-<?php echo file_exists('assets/js/jscalendar/lang/calendar-'.mb_substr($locale, 0, 2).'.js') ? mb_substr($locale, 0, 2) : 'en'; ?>.js"></script>
<script>var scrollTop="<?php echo Preferences('SCROLL_TOP'); ?>";</script>
</HEAD>
<BODY>
<DIV id="tipMsg"></DIV>
<?php
if ($_ROSARIO['is_popup']) :
?>
......
/*
DHTML tip message version 1.6 copyright Essam Gamal 2003 Francois Jacquet 2015
Updated on: 2015.02.08
Usage:
<a href="#" onmouseover="stm([tiptitle,tipmsg])" onmouseout="htm()" onclick="return false;">Tip</a>
*/
var Style=[],Text=[],Count=0,move=0,isOK=1,e_d,tb,w=window,PX="px"
var d_r="document.body"
var ww=w.innerWidth
var wh=w.innerHeight
var sbw=0
function mig_hand(){
w.onresize=mig_re
document.onmousemove=mig_mo
}
function stm(t){
if(isOK){
if(document.onmousemove!=mig_mo||w.onresize!=mig_re) mig_hand()
var title=t[0]?"<THEAD><TR><TH>"+t[0]+"</TH></TR></THEAD>":"";
var txt="<TABLE class='widefat cellspacing-0'>"+title+"<TR><TD>"+t[1]+"</TD></TR></TABLE>";
mig_wlay(txt);
//offset
tb={xpos:10,ypos:10};
e_d=mig_ed()
Count=0
move=1
return false;
}}
function mig_mo(e){
if(move){
var X=0,Y=0,s_d=mig_scd(),w_d=mig_wd()
var mx=e.pageX
var my=e.pageY
X=mx+tb.xpos;Y=my+tb.ypos
if(w_d[0]+s_d[0]<e_d[0]+X+sbw)X=w_d[0]+s_d[0]-e_d[0]-sbw
if(w_d[1]+s_d[1]<e_d[1]+Y+sbw){Y=my-e_d[1]}
if(X<s_d[0])X=s_d[0]
with(mig_layCss()){left=X+PX;top=Y+PX}
mig_dis()
}}
function mig_dis(){Count++
if(Count==1) mig_layCss().visibility="visible"
}
function mig_layCss(){return mig_lay().style}
function mig_lay(){return document.getElementById(TipId)}
function mig_wlay(txt){mig_lay().innerHTML=txt}
function mig_hide(C){mig_wlay("");with(mig_layCss()){visibility="hidden";left=0;top=-800+PX}}
function mig_scd(){return [parseInt(w.pageXOffset),parseInt(w.pageYOffset)]}
function mig_re(){var w_d=mig_wd();}
function mig_wd(){return [parseInt(eval(d_r).clientWidth),parseInt(eval(d_r).clientHeight)]}
function mig_ed(){return [parseInt(mig_lay().offsetWidth)+3,parseInt(mig_lay().offsetHeight)+5]}
function htm(){if(isOK){move=0;mig_hide(1)}}
function mig_clay(){
if(!mig_lay())isOK=0
else mig_hand()}
//init
var TipId="tipMsg";
$(document).ready(function (){
$('<div id="'+TipId+'"></div>').appendTo('body');
mig_clay();
});
......@@ -37,10 +37,6 @@ for(;i<max;i++) {
document.createElement(tags[i]);
}
//tipmessage
var TipId="tipMsg";
var tipmessageStyle = ["#21759b","#ececec","","","Georgia,Times New Roman",,"#555","#f9f9f9","","","sans-serif",,,,2,"#ececec",2,,,,,"",,,0,23];
//touchScroll, enables overflow:auto on mobile
//https://gist.github.com/chrismbarr/4107472
function touchScroll(el){
......@@ -166,8 +162,6 @@ $(document).ajaxStop(function(){
//onload
window.onload = function(){
if (typeof(mig_clay) == "function")
mig_clay();
scroll();
var h3 = $('#body h3.title').text();
document.title = $('#body h2').text()+(h3 ? ' | '+h3 : '');
......
......@@ -583,7 +583,7 @@ div.st{
min-width: 300px
}
/*tipmessage (DO NOT EDIT)*/
#tipMsg{visibility:hidden;position:absolute;z-index:1000;top:-100px}
#tipMsg{visibility:hidden;position:absolute;z-index:1000;top:-100px;max-width:300px}
/*mobile*/
@media only screen and (max-width:640px){
......
......@@ -582,7 +582,7 @@ div.st{
min-width: 300px
}
/*tipmessage (DO NOT EDIT)*/
#tipMsg{visibility:hidden;position:absolute;z-index:1000;top:-100px}
#tipMsg{visibility:hidden;position:absolute;z-index:1000;top:-100px;max-width:300px}
/*wkhtmltopdf code*/
*{
......
......@@ -340,7 +340,7 @@ function makeContactInfo($student_id,$column)
$return .= 'var tipmsg'.$student_id.'='.json_encode($tipmessage).';</script>';
return $return.button('phone','','"#" onMouseOver="stm([tiptitle,tipmsg'.$student_id.'],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
return $return.button('phone','','"#" onMouseOver="stm([tiptitle,tipmsg'.$student_id.'])" onMouseOut="htm()" onclick="return false;"');
}
function removeDot00($value,$column)
......
......@@ -285,7 +285,7 @@ function _makeTipMessage($value,$title)
$return = '<script>var tiptitle'.$THIS_RET['STUDENT_ID'].'='.json_encode($THIS_RET['FULL_NAME']).'; var tipmsg'.$THIS_RET['STUDENT_ID'].'='.json_encode('<IMG SRC="'.$picture_path.'" width="150" />').';</script>';
return $return.'<DIV onMouseOver="stm([tiptitle'.$THIS_RET['STUDENT_ID'].',tipmsg'.$THIS_RET['STUDENT_ID'].'],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;">'.$value.'</DIV>';
return $return.'<DIV onMouseOver="stm([tiptitle'.$THIS_RET['STUDENT_ID'].',tipmsg'.$THIS_RET['STUDENT_ID'].'])" onMouseOut="htm()" onclick="return false;">'.$value.'</DIV>';
}
else
return $value;
......
......@@ -89,7 +89,7 @@ if(!$_REQUEST['period'])
$tipJS .= 'var tipmsg'.$i.$period['PERIOD_ID'].'='.json_encode($period['COURSE_TITLE']).';</script>';
$staff_RET[$i][$period['PERIOD_ID']] .= $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$i.$period['PERIOD_ID'].'],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"').' ';
$staff_RET[$i][$period['PERIOD_ID']] .= $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$i.$period['PERIOD_ID'].'])" onMouseOut="htm()" onclick="return false;"').' ';
}
else
$staff_RET[$i][$period['PERIOD_ID']] = ($period['COMPLETED']=='Y'?_('Yes'):_('No'))." ";
......@@ -125,7 +125,7 @@ else
$tipJS .= 'var tipmsg'.$staff_id.$id.'='.json_encode($period['COURSE_TITLE']).';</script>';
$RET[$staff_id][$id]['COMPLETED'] = $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$staff_id.$id.'],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"').' ';
$RET[$staff_id][$id]['COMPLETED'] = $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$staff_id.$id.'])" onMouseOut="htm()" onclick="return false;"').' ';
}
else
$RET[$staff_id][$id]['COMPLETED'] = ($period['COMPLETED']=='Y'?_('Yes'):_('No'))." ";
......
......@@ -53,7 +53,7 @@ if(!$_REQUEST['modfunc'] && UserStudentID())
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
}
else
echo TextInput($student['ACCOUNT_ID'],'food_service[ACCOUNT_ID]','Account ID','size=12 maxlength=10');
......@@ -68,7 +68,7 @@ if(!$_REQUEST['modfunc'] && UserStudentID())
$tipJS = '<script>var tiptitle2='.json_encode(_('Warning')).'; var tipmsg2='.json_encode($warning).';</script>';
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2])" onMouseOut="htm()" onclick="return false;"');
}
echo '</TD>';
......
......@@ -122,7 +122,7 @@ if(UserStudentID() && empty($_REQUEST['modfunc']))
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
}
else
echo TextInput($student['ACCOUNT_ID'],'food_service[ACCOUNT_ID]',_('Account ID'),'size=12 maxlength=10');
......@@ -137,7 +137,7 @@ if(UserStudentID() && empty($_REQUEST['modfunc']))
$tipJS = '<script>var tiptitle2='.json_encode(_('Warning')).'; var tipmsg2='.json_encode($warning).';</script>';
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
echo $tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2])" onMouseOut="htm()" onclick="return false;"');
}
echo '</TD>';
......
......@@ -43,7 +43,7 @@ if(!$_REQUEST['modfunc'] && UserStaffID())
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo '<BR />'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
echo '<BR />'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
}
echo '</TD>';
......
......@@ -130,7 +130,7 @@ if(UserStaffID() && empty($_REQUEST['modfunc']))
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo '<BR />'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
echo '<BR />'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"');
}
echo '</TD>';
......
......@@ -172,7 +172,7 @@ if(isset($_REQUEST['modfunc']) && $_REQUEST['modfunc']=='save')
$tipJS = '<script>var tiptitle='.json_encode(_('Report Card Comments')).'; var tipmsg='.json_encode($tipmessage).';</script>';
$tipmessage = $tipJS.button('comment', _('Comment Codes'), '"#" onmouseover="stm([tiptitle,tipmsg],tipmessageStyle); return false;" onmouseout="htm()" onclick="return false;"', 'bigger');
$tipmessage = $tipJS.button('comment', _('Comment Codes'), '"#" onmouseover="stm([tiptitle,tipmsg])" onmouseout="htm()" onclick="return false;"', 'bigger');
DrawHeader('',$tipmessage);
}
......
......@@ -717,7 +717,7 @@ if(!isset($_REQUEST['_ROSARIO_PDF']))
$tipJS = '<script>var tiptitle='.json_encode(_('Report Card Comments')).'; var tipmsg='.json_encode($tipmessage).';</script>';
$tipmessage = $tipJS.button('comment', _('Comment Codes'), '"#" onmouseover="stm([tiptitle,tipmsg],tipmessageStyle); return false;" onmouseout="htm()" onclick="return false;"', 'bigger');
$tipmessage = $tipJS.button('comment', _('Comment Codes'), '"#" onmouseover="stm([tiptitle,tipmsg])" onmouseout="htm()" onclick="return false;"', 'bigger');
}
//modif Francois: add label on checkbox
......
......@@ -333,7 +333,7 @@ function _makeTipTitle($value,$column)
$tipJS .= 'var tipmsg'.$THIS_RET['ASSIGNMENT_ID'].'='.json_encode($tipmsg).';</script>';
$tip_title = $tipJS.'<A HREF="#" onMouseOver="stm([tiptitle,tipmsg'.$THIS_RET['ASSIGNMENT_ID'].'],tipmessageStyle); return false;" onMouseOut="htm();" onclick="return false;">'.$value.'</A>';
$tip_title = $tipJS.'<A HREF="#" onMouseOver="stm([tiptitle,tipmsg'.$THIS_RET['ASSIGNMENT_ID'].'])" onMouseOut="htm();" onclick="return false;">'.$value.'</A>';
}
else
$tip_title = $value;
......
......@@ -81,7 +81,7 @@ if(!$_REQUEST['period'])
$tipJS .= 'var tipmsg'.$i.$period['PERIOD_ID'].'='.json_encode($period['COURSE_TITLE']).';</script>';
$staff_RET[$i][$period['PERIOD_ID']] .= $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$i.$period['PERIOD_ID'].'],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"').' ';
$staff_RET[$i][$period['PERIOD_ID']] .= $tipJS.button($period['COMPLETED']=='Y'?'check':'x','','"#" onMouseOver="stm([tiptitle,tipmsg'.$i.$period['PERIOD_ID'].'])" onMouseOut="htm()" onclick="return false;"').' ';
}
else
$staff_RET[$i][$period['PERIOD_ID']] = $period['COMPLETED']=='Y'?_('Yes').' ':_('No').' ';
......
......@@ -374,7 +374,7 @@ if(empty($_REQUEST['modfunc']))
$tipJS = '<script>var tiptitle1='.json_encode(_('Warning')).'; var tipmsg1='.json_encode($warning).';</script>';
echo '<TH>'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"').'</TH>';
echo '<TH>'.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle1,tipmsg1])" onMouseOut="htm()" onclick="return false;"').'</TH>';
}
else
echo '<TH>&nbsp;</TH>';
......@@ -533,7 +533,7 @@ if(empty($_REQUEST['modfunc']))
$tipJS = '<script>var tiptitle2='.json_encode(_('Warning')).'; var tipmsg2='.json_encode($warning).';</script>';
$images .= ' '.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2],tipmessageStyle); return false;" onMouseOut="htm()" onclick="return false;"');
$images .= ' '.$tipJS.button('warning','','"#" onMouseOver="stm([tiptitle2,tipmsg2])" onMouseOut="htm()" onclick="return false;"');
}
if($contact['CUSTODY']=='Y')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment