Bug 40933

Bug3 52340
pre-wrap


git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@300 6955db30-a419-402b-8a0d-67ecbb4d7f56
master
vfilippov 2009-08-26 11:42:50 +00:00
parent dcb05ff81d
commit ee16127658
4 changed files with 39 additions and 21 deletions

View File

@ -1,12 +1,14 @@
[% USE Bugzilla %] [% USE Bugzilla %]
[% cgi = Bugzilla.cgi %] [% cgi = Bugzilla.cgi %]
<html id="cmt"> <html id="cmt" style="overflow: hidden">
<script type="text/javascript"> <script type="text/javascript">
function resizeIframe() { function resizeIframe()
{
parent.document.getElementById('commentpreview').style.height = document.getElementById('cmt').scrollHeight + "px"; parent.document.getElementById('commentpreview').style.height = document.getElementById('cmt').scrollHeight + "px";
parent.document.getElementById('commentpreview').style.width = document.getElementById('cmt').scrollWidth + "px";
} }
</script> </script>
<body onLoad="resizeIframe()" onResize="resizeIframe()" style="margin: 0; padding: 0"> <body onLoad="resizeIframe()" onResize="resizeIframe()" style="margin: 0; padding: 0; overflow: hidden">
<div class="bz_comment" style="border-style: dotted; border-width: 2px; border-color: #969696; background-color: #e8e8e8; padding: 5px"> <div class="bz_comment" style="border-style: dotted; border-width: 2px; border-color: #969696; background-color: #e8e8e8; padding: 5px">
<p><pre>[%- cgi.param("comment") FILTER wrap_comment FILTER quoteUrls FILTER links_targetblank -%]</pre></p> <p><pre>[%- cgi.param("comment") FILTER wrap_comment FILTER quoteUrls FILTER links_targetblank -%]</pre></p>
</div> </div>

View File

@ -197,6 +197,10 @@ TUI_hide_default('expert_fields');
[% select_fields.${field.name} = field %] [% select_fields.${field.name} = field %]
[% END %] [% END %]
<form name="commentpreviewform" style="display:none" target="commentpreview" method="POST" action="page.cgi?id=previewcomment.html">
<input id="previewcommentvalue" type="hidden" name="comment" value="" />
</form>
<form name="Create" id="Create" method="post" action="post_bug.cgi" <form name="Create" id="Create" method="post" action="post_bug.cgi"
enctype="multipart/form-data" onsubmit="return Create_onsubmit()"> enctype="multipart/form-data" onsubmit="return Create_onsubmit()">
<input type="hidden" name="product" value="[% product.name FILTER html %]"> <input type="hidden" name="product" value="[% product.name FILTER html %]">
@ -527,24 +531,28 @@ TUI_hide_default('expert_fields');
<br> <br>
<p style="text-align: left; margin-bottom: 0" id="showpreviewbtn"><a href="javascript:void showcommentpreview()">Preview</a></p> <p style="text-align: left; margin-bottom: 0" id="showpreviewbtn"><a href="javascript:void showcommentpreview()">Preview</a></p>
<div id="wrapcommentpreview" style="display: none"> <div id="wrapcommentpreview" style="display: none">
<iframe name="commentpreview" id="commentpreview" style="height: auto; border-width: 0; width: 100%"> <iframe name="commentpreview" id="commentpreview" style="height: auto; border-width: 0; width: 100%; overflow: hidden">
</iframe> </iframe>
<script> <script>
/*<!--*/ /*<!--*/
function hidepreview() { function isIE() { return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent); }
document.getElementById('wrapcommentpreview').style.display='none'; function findPos(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curtop]; } }
document.getElementById('showpreviewbtn').style.display=''; function scrollDocTo(obj) { window.scroll(0,findPos(obj)); }
} function scrTo(id) { scrollDocTo(document.getElementById(id)); }
function isIE() function showcommentpreview()
{ {
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}
function showcommentpreview() {
document.getElementById('wrapcommentpreview').style.width=(document.Create.comment.offsetWidth-10)+'px'; document.getElementById('wrapcommentpreview').style.width=(document.Create.comment.offsetWidth-10)+'px';
document.getElementById('wrapcommentpreview').style.display=(isIE()?'inline-block':'table-cell'); document.getElementById('wrapcommentpreview').style.display=(isIE()?'inline-block':'table-cell');
window.frames['commentpreview'].location.replace('page.cgi?id=previewcomment.html&comment='+encodeURI(document.Create.comment.value).replace('#','%23')); document.commentpreviewform.comment.value = document.Create.comment.value;
document.commentpreviewform.submit();
scrTo('commentpreview');
document.getElementById('showpreviewbtn').style.display='none'; document.getElementById('showpreviewbtn').style.display='none';
} }
function hidepreview()
{
document.getElementById('wrapcommentpreview').style.display='none';
document.getElementById('showpreviewbtn').style.display='';
}
//--> //-->
</script> </script>
<p style="text-align: right; margin-bottom: 0"><a href="javascript:void showcommentpreview()">Update preview</a> &nbsp; <a href="javascript:void hidepreview()">Hide preview</a></p> <p style="text-align: right; margin-bottom: 0"><a href="javascript:void showcommentpreview()">Update preview</a> &nbsp; <a href="javascript:void hidepreview()">Hide preview</a></p>

View File

@ -40,10 +40,6 @@
<script type="text/javascript"> <script type="text/javascript">
<!-- <!--
function isIE()
{
return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
}
/* Outputs a link to call replyToComment(); used to reduce HTML output */ /* Outputs a link to call replyToComment(); used to reduce HTML output */
function addReplyLink(id, real_id) { function addReplyLink(id, real_id) {
@ -165,6 +161,10 @@
//--> //-->
</script> </script>
<form name="commentpreviewform" style="display:none" target="commentpreview" method="POST" action="page.cgi?id=previewcomment.html">
<input id="previewcommentvalue" type="hidden" name="comment" value="" />
</form>
<form name="changeform" method="post" action="process_bug.cgi" onsubmit="return changeform_onsubmit()"> <form name="changeform" method="post" action="process_bug.cgi" onsubmit="return changeform_onsubmit()">
<input type="hidden" name="delta_ts" value="[% bug.delta_ts %]"> <input type="hidden" name="delta_ts" value="[% bug.delta_ts %]">
@ -299,14 +299,22 @@
</table> </table>
</td></tr> </td></tr>
<tr><td id="wrapcommentpreview" style="display: none"> <tr><td id="wrapcommentpreview" style="display: none">
<iframe name="commentpreview" id="commentpreview" style="height: auto; border-width: 0; width: 100%"> <iframe name="commentpreview" id="commentpreview" style="height: auto; border-width: 0; width: 100%; overflow: hidden">
</iframe> </iframe>
<script> <script>
/*<!--*/ /*<!--*/
function hidepreview() { document.getElementById('wrapcommentpreview').style.display='none' } function isIE() { return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent); }
function findPos(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curtop]; } } function findPos(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curtop]; } }
function scrollDocTo(obj) { window.scroll(0,findPos(obj)); } function scrollDocTo(obj) { window.scroll(0,findPos(obj)); }
function scrTo(id) { scrollDocTo(document.getElementById(id)); } function scrTo(id) { scrollDocTo(document.getElementById(id)); }
function hidepreview() { document.getElementById('wrapcommentpreview').style.display='none'; }
function showcommentpreview()
{
document.getElementById('wrapcommentpreview').style.display=(isIE()?'inline-block':'table-cell');
document.commentpreviewform.comment.value = document.changeform.comment.value;
document.commentpreviewform.submit();
scrTo('commentpreview');
}
//--> //-->
</script> </script>
<p style="text-align: right"><a href="javascript:void hidepreview()">Hide preview</a></p> <p style="text-align: right"><a href="javascript:void hidepreview()">Hide preview</a></p>
@ -1212,7 +1220,7 @@
[% IF user.id %] [% IF user.id %]
[% IF NOT nobr %] [% IF NOT nobr %]
<div class="knob-buttons" style="text-align:right"> <div class="knob-buttons" style="text-align:right">
<input type="button" value="Preview" onclick="document.getElementById('wrapcommentpreview').style.display=(isIE()?'inline-block':'table-cell');window.frames['commentpreview'].location.replace('page.cgi?id=previewcomment.html&comment='+encodeURI(document.changeform.comment.value).replace('#','%23'));scrTo('commentpreview')"> <input type="button" value="Preview" onclick="showcommentpreview()">
<input type="submit" value="Commit" id="commit[% id FILTER css_class_quote %]"> <input type="submit" value="Commit" id="commit[% id FILTER css_class_quote %]">
[% IF bug.user.canmove %] [% IF bug.user.canmove %]
<input type="submit" name="action" id="action[% id FILTER css_class_quote %]" value="[% Param("move-button-text") %]"> <input type="submit" name="action" id="action[% id FILTER css_class_quote %]" value="[% Param("move-button-text") %]">

View File

@ -152,7 +152,7 @@ body { font-size: 10pt; }
[% ELSE %] [% ELSE %]
[% wrapped_comment = comment.body FILTER wrap_comment %] [% wrapped_comment = comment.body FILTER wrap_comment %]
[% END %] [% END %]
<pre class="bz_comment_text" style="border-width: 0 0 1px 0; border-style: solid; border-color: #808080"> <pre style="border-width: 0 0 1px 0; border-style: solid; border-color: #808080; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap;">
[%- wrapped_comment FILTER quoteUrls(bugid) FILTER absolute_uris -%] [%- wrapped_comment FILTER quoteUrls(bugid) FILTER absolute_uris -%]
</pre> </pre>
[% END %] [% END %]