Improved hoverhelp system
This commit is contained in:
parent
978be4dc47
commit
1a20c3bf6b
3 changed files with 26 additions and 11 deletions
|
|
@ -259,8 +259,8 @@ sub displayFormWithWrapper {
|
|||
my ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext) = $self->prepareWrapper;
|
||||
my $hoverCode = $self->getHoverCode($hoverHelp, $self->get('id') . '_wrapper');
|
||||
return '<tr'.$rowClass.'>
|
||||
<td'.$labelClass.' valign="top" style="width: 25%;">'.$self->get("label").'</td>
|
||||
<td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->displayForm().$subtext.$hoverCode."</td>
|
||||
<td'.$labelClass.' valign="top" style="width: 25%;">'.$self->get("label") . $hoverCode . '</td>
|
||||
<td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->displayForm().$subtext."</td>
|
||||
</tr>\n";
|
||||
} else {
|
||||
return $self->toHtmlAsHidden;
|
||||
|
|
@ -627,8 +627,8 @@ sub toHtmlWithWrapper {
|
|||
my ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext) = $self->prepareWrapper;
|
||||
my $hoverCode = $self->getHoverCode($hoverHelp, $self->get('id') . '_description');
|
||||
return '<tr'.$rowClass.' id="'.$self->get("id").'_row">
|
||||
<td'.$labelClass.' id="' . $self->get('id') . '_description" valign="top" style="width: 180px;"><label for="'.$self->get("id").'">'.$self->get("label").'</label></td>
|
||||
<td valign="top"'.$fieldClass.'>'.$rawField . $subtext . $hoverCode . "</td>
|
||||
<td'.$labelClass.' id="' . $self->get('id') . '_description" valign="top" style="width: 180px;"><label for="'.$self->get("id").'">'.$self->get("label").'</label>' . $hoverCode . '</td>
|
||||
<td valign="top"'.$fieldClass.'>'.$rawField . $subtext . "</td>
|
||||
</tr>\n";
|
||||
} else {
|
||||
return $self->toHtmlAsHidden;
|
||||
|
|
@ -657,18 +657,17 @@ sub getHoverCode {
|
|||
my $url = $self->session->url;
|
||||
my $hoverHelp = shift;
|
||||
my $attachId = shift;
|
||||
$hoverHelp =~ s/\r/ /g;
|
||||
$hoverHelp =~ s/\n/ /g;
|
||||
$hoverHelp =~ s/'/\\'/g;
|
||||
$hoverHelp =~ s/^\s+//;
|
||||
return ''
|
||||
unless $hoverHelp;
|
||||
my $hover = '<script type="text/javascript">var tooltip = new YAHOO.widget.Tooltip("' . $attachId . '_tooltip", { context: "' . $attachId . '", text: \'' . $hoverHelp . '\', autodismissdelay: 100000, width: "300px"});</script>';
|
||||
my $hover = '<div class="wg-hoverhelp">' . $hoverHelp . '</div>';
|
||||
$style->setLink($url->extras('/yui/build/container/assets/container.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setLink($url->extras('/hoverhelp.css'),{ type=>'text/css', rel=>"stylesheet" });
|
||||
$style->setScript($url->extras('/yui/build/yahoo/yahoo-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/dom/dom-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/event/event-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/yui/build/container/container-min.js'),{ type=>'text/javascript' });
|
||||
$style->setScript($url->extras('/hoverhelp.js'),{ type=>'text/javascript' });
|
||||
return $hover;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
.yui-tt {
|
||||
visibility:hidden;
|
||||
position:absolute;
|
||||
.wg-hoverhelp {
|
||||
visibility: collapse;
|
||||
display: none;
|
||||
background-color: #e6ecff;
|
||||
border: 1px solid #003399;
|
||||
color: #000066;
|
||||
|
|
@ -11,3 +11,7 @@
|
|||
z-index: 1000;
|
||||
}
|
||||
|
||||
.wg-hoverhelp.yui-tt {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
|
|
|||
12
www/extras/hoverhelp.js
Normal file
12
www/extras/hoverhelp.js
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
YAHOO.util.Event.onDOMReady(function () {
|
||||
var tips = YAHOO.util.Dom.getElementsByClassName('wg-hoverhelp');
|
||||
var i;
|
||||
for (i = 0; i < tips.length; i++) {
|
||||
var myTip = new YAHOO.widget.Tooltip(tips[i], {
|
||||
autodismissdelay: 1000000,
|
||||
width: '300px',
|
||||
context: tips[i].parentNode
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue