Commit f1e0e94e by Scott Vivian

Coding style (comment button processing)

parent c37638d3
...@@ -204,40 +204,35 @@ ...@@ -204,40 +204,35 @@
// Process hide, show, delete, flag, unflag, edit or save button for comments // Process hide, show, delete, flag, unflag, edit or save button for comments
foreach ($commentsfollows as $commentid => $comment) foreach ($commentsfollows as $commentid => $comment) {
if ($comment['basetype']=='C') { if ($comment['basetype'] == 'C') {
$commentparent=@$answers[$comment['parentid']]; $cparentid = $comment['parentid'];
if (!isset($commentparent)) $commentparent = isset($answers[$cparentid]) ? $answers[$cparentid] : $question;
$commentparent=$question; $prefix = 'c'.$commentid.'_';
$commentparenttype=$commentparent['basetype'];
$prefix='c'.$commentid.'_';
if (qa_page_q_single_click_c($comment, $question, $commentparent, $pageerror)) if (qa_page_q_single_click_c($comment, $question, $commentparent, $pageerror))
qa_page_q_refresh($pagestart, 'showcomments-'.$comment['parentid'], $commentparenttype, $comment['parentid']); qa_page_q_refresh($pagestart, 'showcomments-'.$cparentid, $commentparent['basetype'], $cparentid);
if ($comment['editbutton']) { if ($comment['editbutton']) {
if (qa_clicked($prefix.'doedit')) { if (qa_clicked($prefix.'doedit')) {
if (qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) // extra check here ensures error message is visible if (qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) // extra check here ensures error message is visible
qa_page_q_refresh($pagestart, 'edit-'.$commentid, 'C', $commentid); qa_page_q_refresh($pagestart, 'edit-'.$commentid, 'C', $commentid);
}
} elseif (qa_clicked($prefix.'dosave') && qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) { elseif (qa_clicked($prefix.'dosave') && qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) {
if (qa_page_q_edit_c_submit($comment, $question, $commentparent, $ceditin[$commentid], $cediterrors[$commentid])) if (qa_page_q_edit_c_submit($comment, $question, $commentparent, $ceditin[$commentid], $cediterrors[$commentid]))
qa_page_q_refresh($pagestart, null, 'C', $commentid); qa_page_q_refresh($pagestart, null, 'C', $commentid);
else { else {
$formtype='c_edit'; $formtype = 'c_edit';
$formpostid=$commentid; // keep editing if an error $formpostid = $commentid; // keep editing if an error
} }
}
} elseif (($pagestate==('edit-'.$commentid)) && qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) { elseif (($pagestate == ('edit-'.$commentid)) && qa_page_q_permit_edit($comment, 'permit_edit_c', $pageerror)) {
$formtype='c_edit'; $formtype = 'c_edit';
$formpostid=$commentid; $formpostid = $commentid;
} }
} }
} }
}
// Functions used above - also see functions in qa-page-question-submit.php (which are shared with Ajax) // Functions used above - also see functions in qa-page-question-submit.php (which are shared with Ajax)
......
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