From 98695a00b53ae0020abaae497dff957653cd3d3e Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Fri, 6 Feb 2015 09:26:33 +0000 Subject: [PATCH] added more code to support review comment editing --- codepot/src/codepot/views/code_revision.php | 56 +++++++++++++++++++-- 1 file changed, 51 insertions(+), 5 deletions(-) diff --git a/codepot/src/codepot/views/code_revision.php b/codepot/src/codepot/views/code_revision.php index 3e722c5c..a56c1187 100644 --- a/codepot/src/codepot/views/code_revision.php +++ b/codepot/src/codepot/views/code_revision.php @@ -52,7 +52,7 @@ $(function() { $(function() { - $("#code_revision_new_comment_div").dialog ( + $("#code_revision_new_review_comment_div").dialog ( { title: 'lang->line('Comment')?>', width: 'auto', @@ -75,7 +75,7 @@ $(function() { $("#code_revision_new_review_comment_button").button().click ( function () { - $("#code_revision_new_comment_div").dialog('open'); + $("#code_revision_new_review_comment_div").dialog('open'); return false; } ); @@ -88,10 +88,37 @@ $(function() { $rc = $reviews[$i]; if ($login['id'] == $rc->updatedby) { + $edit_title = $this->lang->line('Comment') . ' ' . ($i + 1); + $label_ok = $this->lang->line('OK'); + $label_cancel = $this->lang->line('Cancel'); print (" + + $('#code_revision_edit_review_comment_div_{$i}').dialog ( + { + title: '{$edit_title}', + width: 'auto', + height: 'auto', + resizable: false, + autoOpen: false, + modal: true, + buttons: { + '{$label_ok}': function () { + // dynamically add a comment number to edit + var hidden_comment_no = $('').attr('type', 'hidden').attr('name', 'edit_review_comment_no').val('{$i}'); + $('#code_revision_edit_review_comment_form_{$i}').append(hidden_comment_no).submit (); + $(this).dialog('close'); + }, + '{$label_cancel}': function () { + $(this).dialog('close'); + } + }, + close: function() { } + } + ); + $('#code_revision_edit_review_comment_button_{$i}').button().click ( function () { - alert ('not implemented {$i}'); + $('#code_revision_edit_review_comment_div_{$i}').dialog('open'); return false; } ) @@ -353,7 +380,6 @@ $history = $file['history']; print "
\n"; print "\n"; @@ -395,7 +421,7 @@ $history = $file['history']; -
+
id}${revreqroot}", 'id="code_revision_new_review_comment_form"'); @@ -408,6 +434,26 @@ $history = $file['history']; 'id' => 'code_revision_edit_review_comment') ); print form_close(); + + for ($i = $review_count; $i > 0; ) + { + $i--; + + $rc = $reviews[$i]; + + if ($login['id'] == $rc->updatedby) + { + print "
\n"; + print form_open("code/revision/{$project->id}${revreqroot}", "id='code_revision_edit_review_comment_form_{$i}'"); + print form_textarea ( + array ('name' => "edit_review_comment_{$i}", + 'value' => $rc->comment, 'rows'=> 10, 'cols' => 70, + 'id' => "code_revision_edit_review_comment_{$i}") + ); + print form_close(); + print "
\n"; + } + } ?>