Bug 65772 - Rework comment preview, add comment preview to attachment forms
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@814 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
e0a5527882
commit
de7e566ce6
|
@ -144,4 +144,4 @@ table.attachment_info td {
|
||||||
padding-top: 1em;
|
padding-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#comment { width: 50em; font-size: medium; font-family: monospace; }
|
#comment_textarea { width: 50em; font-size: medium; font-family: monospace; }
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
<div id="wrapcommentpreview" style="display: none">
|
||||||
|
<div id="commentpreviewhtml"></div>
|
||||||
|
<iframe name="commentpreviewframe" id="commentpreviewframe" style="display: none"></iframe>
|
||||||
|
<script>
|
||||||
|
/*<!--*/
|
||||||
|
if (!window.findPos)
|
||||||
|
{
|
||||||
|
window.findPos = function(obj) { var curtop = 0; if (obj.offsetParent) { do { curtop += obj.offsetTop; } while (obj = obj.offsetParent); return [curtop]; } }
|
||||||
|
window.scrollDocTo = function(obj) { window.scroll(0,findPos(obj)); }
|
||||||
|
window.scrTo = function(id) { scrollDocTo(document.getElementById(id)); }
|
||||||
|
window.hidepreview = function() { document.getElementById('wrapcommentpreview').style.display='none'; }
|
||||||
|
window.showcommentpreview = function() {
|
||||||
|
document.getElementById('wrapcommentpreview').style.display = '';
|
||||||
|
document.commentpreviewform.comment.value = document.getElementById('comment_textarea').value;
|
||||||
|
document.commentpreviewform.submit();
|
||||||
|
scrTo('wrapcommentpreview');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//-->
|
||||||
|
</script>
|
||||||
|
<p style="text-align: right; margin-top: 0"><a href="javascript:void(0)" onclick="hidepreview()">Hide preview</a></p>
|
||||||
|
</div>
|
|
@ -0,0 +1,3 @@
|
||||||
|
<form name="commentpreviewform" style="display:none" target="commentpreviewframe" method="POST" action="page.cgi?id=previewcomment.html">
|
||||||
|
<input id="previewcommentvalue" type="hidden" name="comment" value="" />
|
||||||
|
</form>
|
|
@ -10,16 +10,12 @@
|
||||||
.bz_st_CLOSED { text-decoration: line-through; border: 1px solid #2f6fab; background-color: #f9f9f9; line-height: 1.1em; }
|
.bz_st_CLOSED { text-decoration: line-through; border: 1px solid #2f6fab; background-color: #f9f9f9; line-height: 1.1em; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<script type="text/javascript">
|
<body style="margin: 0; padding: 0; overflow: hidden">
|
||||||
function resizeIframe()
|
<div class="bz_comment" style="border-style: dotted; border-width: 2px; border-color: #969696; background-color: #e8e8e8; padding: 5px">
|
||||||
{
|
<pre style="white-space: pre-wrap">[%- cgi.param("comment") | wrap_comment | quoteUrls | links_targetblank -%]</pre>
|
||||||
parent.document.getElementById('commentpreview').style.height = (document.getElementById('cmt').scrollHeight+4) + "px";
|
|
||||||
parent.document.getElementById('commentpreview').style.width = document.getElementById('cmthtm').scrollWidth + "px";
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<body onLoad="resizeIframe()" onResize="resizeIframe()" style="margin: 0; padding: 0; overflow: hidden">
|
|
||||||
<div id="cmt" class="bz_comment" style="border-style: dotted; border-width: 2px; border-color: #969696; background-color: #e8e8e8; padding: 5px">
|
|
||||||
<p><pre style="white-space: pre-wrap">[%- cgi.param("comment") FILTER wrap_comment FILTER quoteUrls FILTER links_targetblank -%]</pre></p>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
<script type="text/javascript">
|
||||||
|
parent.document.getElementById('commentpreviewhtml').innerHTML = document.body.innerHTML;
|
||||||
|
</script>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -38,6 +38,8 @@
|
||||||
doc_section = "attachments.html"
|
doc_section = "attachments.html"
|
||||||
%]
|
%]
|
||||||
|
|
||||||
|
[% PROCESS "bug/comment-preview-form.html.tmpl" %]
|
||||||
|
|
||||||
<form name="entryform" method="post" action="attachment.cgi"
|
<form name="entryform" method="post" action="attachment.cgi"
|
||||||
enctype="multipart/form-data"
|
enctype="multipart/form-data"
|
||||||
onsubmit="return validateAttachmentForm(this)">
|
onsubmit="return validateAttachmentForm(this)">
|
||||||
|
@ -103,15 +105,17 @@
|
||||||
<td>
|
<td>
|
||||||
<em>(optional) Add a comment about this attachment to the [% terms.bug %].</em>
|
<em>(optional) Add a comment about this attachment to the [% terms.bug %].</em>
|
||||||
<input type="checkbox" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label>
|
<input type="checkbox" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label>
|
||||||
<br>
|
<br />
|
||||||
[% INCLUDE global/textarea.html.tmpl
|
[% INCLUDE global/textarea.html.tmpl
|
||||||
name = 'comment'
|
name = 'comment'
|
||||||
id = 'comment'
|
id = 'comment_textarea'
|
||||||
minrows = 6
|
minrows = 6
|
||||||
maxrows = 15
|
maxrows = 15
|
||||||
cols = constants.COMMENT_COLS
|
cols = constants.COMMENT_COLS
|
||||||
wrap = 'soft'
|
wrap = 'soft'
|
||||||
|
style = 'width: 100%'
|
||||||
%]
|
%]
|
||||||
|
[% PROCESS "bug/comment-preview-div.html.tmpl" %]
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
[% IF user.is_insider %]
|
[% IF user.is_insider %]
|
||||||
|
@ -130,7 +134,7 @@
|
||||||
[% END %]
|
[% END %]
|
||||||
<tr>
|
<tr>
|
||||||
<th> </th>
|
<th> </th>
|
||||||
<td><input type="submit" id="create" value="Submit"></td>
|
<td><input type="submit" id="create" value="Submit"> <input type="button" value="Preview comment" onclick="showcommentpreview()" tabindex="-1" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,8 @@
|
||||||
[% can_edit = attachment.validate_can_edit %]
|
[% can_edit = attachment.validate_can_edit %]
|
||||||
[% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
|
[% editable_or_hide = can_edit ? "" : " bz_hidden_option" %]
|
||||||
|
|
||||||
|
[% PROCESS "bug/comment-preview-form.html.tmpl" %]
|
||||||
|
|
||||||
<form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
|
<form method="post" action="attachment.cgi" onsubmit="normalizeComments();">
|
||||||
<input type="hidden" name="id" value="[% attachment.id %]">
|
<input type="hidden" name="id" value="[% attachment.id %]">
|
||||||
<input type="hidden" name="action" value="update">
|
<input type="hidden" name="action" value="update">
|
||||||
|
@ -170,7 +172,7 @@
|
||||||
<label for="comment">Comment (on the [% terms.bug %]):</label>
|
<label for="comment">Comment (on the [% terms.bug %]):</label>
|
||||||
<input type="checkbox" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label></small><br />
|
<input type="checkbox" name="commentsilent" value="1" /> <label for="commentsilent">Silent</label></small><br />
|
||||||
[% INCLUDE global/textarea.html.tmpl
|
[% INCLUDE global/textarea.html.tmpl
|
||||||
id = 'comment'
|
id = 'comment_textarea'
|
||||||
name = 'comment'
|
name = 'comment'
|
||||||
minrows = 5
|
minrows = 5
|
||||||
cols = 25
|
cols = 25
|
||||||
|
@ -179,7 +181,11 @@
|
||||||
%]
|
%]
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<input type="submit" value="Submit" id="update"><br><br>
|
<input type="submit" value="Submit" id="update" />
|
||||||
|
<input type="button" value="Preview" onclick="showcommentpreview()" tabindex="-1" /><br><br>
|
||||||
|
|
||||||
|
[% PROCESS "bug/comment-preview-div.html.tmpl" %]
|
||||||
|
|
||||||
[% END %]
|
[% END %]
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
|
|
|
@ -124,6 +124,8 @@
|
||||||
<table class="bz_comment_table" cellpadding="0" cellspacing="0"><tr>
|
<table class="bz_comment_table" cellpadding="0" cellspacing="0"><tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
|
[% PROCESS "bug/comment-preview-div.html.tmpl" %]
|
||||||
|
|
||||||
[% FOREACH comment = comments %]
|
[% FOREACH comment = comments %]
|
||||||
[% IF count >= start_at;
|
[% IF count >= start_at;
|
||||||
PROCESS a_comment;
|
PROCESS a_comment;
|
||||||
|
|
|
@ -194,9 +194,7 @@
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form name="commentpreviewform" style="display:none" target="commentpreview" method="POST" action="page.cgi?id=previewcomment.html">
|
[% PROCESS "bug/comment-preview-form.html.tmpl" %]
|
||||||
<input id="previewcommentvalue" type="hidden" name="comment" value="" />
|
|
||||||
</form>
|
|
||||||
|
|
||||||
[%# CustIS Bug 57315 - Force Fucking Firefox to reset form on Reload %]
|
[%# CustIS Bug 57315 - Force Fucking Firefox to reset form on Reload %]
|
||||||
[% USE date %]
|
[% USE date %]
|
||||||
|
@ -1149,27 +1147,6 @@ document.changeform = document.[% cfname %];
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</td></tr></table>
|
</td></tr></table>
|
||||||
<div id="wrapcommentpreview" style="display: none">
|
|
||||||
<iframe name="commentpreview" id="commentpreview" style="height: auto; border-width: 0; width: 100%; overflow: hidden">
|
|
||||||
</iframe>
|
|
||||||
<script>
|
|
||||||
/*<!--*/
|
|
||||||
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 scrTo(id) { scrollDocTo(document.getElementById(id)); }
|
|
||||||
function hidepreview() { document.getElementById('wrapcommentpreview').style.display='none'; }
|
|
||||||
function showcommentpreview()
|
|
||||||
{
|
|
||||||
document.getElementById('wrapcommentpreview').style.width=document.getElementById('comments').scrollWidth+'px';
|
|
||||||
document.getElementById('wrapcommentpreview').style.display='inline-block';
|
|
||||||
document.commentpreviewform.comment.value = document.changeform.comment.value;
|
|
||||||
document.commentpreviewform.submit();
|
|
||||||
scrTo('commentpreview');
|
|
||||||
}
|
|
||||||
//-->
|
|
||||||
</script>
|
|
||||||
<p style="text-align: right"><a href="javascript:void hidepreview()">Hide preview</a></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
[%# For logged-out users %]
|
[%# For logged-out users %]
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
|
|
Loading…
Reference in New Issue