Commit a1109273 by q2apro.com Committed by Scott

Close with Notice or as Duplicate in one field

parent 5430e6d9
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
'close_original_note' => 'You can also enter the question number from the URL, e.g. 123.', 'close_original_note' => 'You can also enter the question number from the URL, e.g. 123.',
'close_original_title' => 'URL of the original question:', 'close_original_title' => 'URL of the original question:',
'close_q_popup' => 'Close this question to any new answers', 'close_q_popup' => 'Close this question to any new answers',
'close_reason_title' => 'Reason for closing this question:', 'close_reason_title' => 'Reason for closing this question or insert the URL of the duplicate question:',
'closed_as_duplicate' => 'closed as a duplicate of:', 'closed_as_duplicate' => 'closed as a duplicate of:',
'closed_with_note' => 'closed with the note:', 'closed_with_note' => 'closed with the note:',
'comment_a_popup' => 'Add a comment on this answer', 'comment_a_popup' => 'Add a comment on this answer',
......
...@@ -528,19 +528,10 @@ ...@@ -528,19 +528,10 @@
'title' => qa_lang_html('question/close_form_title'), 'title' => qa_lang_html('question/close_form_title'),
'fields' => array( 'fields' => array(
'duplicate' => array(
'type' => 'checkbox',
'tags' => 'name="q_close_duplicate" id="q_close_duplicate" onchange="document.getElementById(\'q_close_details\').focus();"',
'label' => qa_lang_html('question/close_duplicate'),
'value' => @$in['duplicate'],
),
'details' => array( 'details' => array(
'tags' => 'name="q_close_details" id="q_close_details"', 'tags' => 'name="q_close_details" id="q_close_details"',
'label' => 'label' =>
'<span id="close_label_duplicate">'.qa_lang_html('question/close_original_title').' </span>'. '<span id="close_label_other">'.qa_lang_html('question/close_reason_title').':</span>',
'<span id="close_label_other">'.qa_lang_html('question/close_reason_title').'</span>',
'note' => '<span id="close_note_duplicate" style="display:none;">'.qa_lang_html('question/close_original_note').'</span>',
'value' => @$in['details'], 'value' => @$in['details'],
'error' => qa_html(@$errors['details']), 'error' => qa_html(@$errors['details']),
), ),
...@@ -564,12 +555,6 @@ ...@@ -564,12 +555,6 @@
), ),
); );
qa_set_display_rules($qa_content, array(
'close_label_duplicate' => 'q_close_duplicate',
'close_label_other' => '!q_close_duplicate',
'close_note_duplicate' => 'q_close_duplicate',
));
$qa_content['focusid']='q_close_details'; $qa_content['focusid']='q_close_details';
return $form; return $form;
...@@ -582,18 +567,19 @@ ...@@ -582,18 +567,19 @@
*/ */
{ {
$in=array( $in=array(
'duplicate' => qa_post_text('q_close_duplicate'), 'details' => trim(qa_post_text('q_close_details')),
'details' => qa_post_text('q_close_details'),
); );
$userid=qa_get_logged_in_userid(); $userid=qa_get_logged_in_userid();
$handle=qa_get_logged_in_handle(); $handle=qa_get_logged_in_handle();
$cookieid=qa_cookie_get(); $cookieid=qa_cookie_get();
if (!qa_check_form_security_code('close-'.$question['postid'], qa_post_text('code'))) $isduplicateurl = filter_var($in['details'], FILTER_VALIDATE_URL);
$errors['details']=qa_lang_html('misc/form_security_again');
elseif ($in['duplicate']) { if (!qa_check_form_security_code('close-'.$question['postid'], qa_post_text('code'))) {
$errors['details']=qa_lang_html('misc/form_security_again');
}
elseif ($isduplicateurl) {
// be liberal in what we accept, but there are two potential unlikely pitfalls here: // be liberal in what we accept, but there are two potential unlikely pitfalls here:
// a) URLs could have a fixed numerical path, e.g. http://qa.mysite.com/1/478/... // a) URLs could have a fixed numerical path, e.g. http://qa.mysite.com/1/478/...
// b) There could be a question title which is just a number, e.g. http://qa.mysite.com/478/12345/... // b) There could be a question title which is just a number, e.g. http://qa.mysite.com/478/12345/...
......
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