# HG changeset patch # User Dan # Date 1182960542 14400 # Node ID dd2edcdc6c03b143fa9743fa55088e39fec37728 # Parent dd659f6ba8915dd48c3a33b4ab78634ba7ffa81c Deleting pages now requires a reason diff -r dd659f6ba891 -r dd2edcdc6c03 ajax.php --- a/ajax.php Wed Jun 27 00:59:42 2007 -0400 +++ b/ajax.php Wed Jun 27 12:09:02 2007 -0400 @@ -73,7 +73,10 @@ echo PageUtils::flushlogs($paths->cpage['urlname_nons'], $paths->namespace); break; case "deletepage": - echo PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace); + $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; + if ( empty($reason) ) + die('Please enter a reason for deleting this page.'); + echo PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); break; case "delvote": echo PageUtils::delvote($paths->cpage['urlname_nons'], $paths->namespace); diff -r dd659f6ba891 -r dd2edcdc6c03 includes/clientside/static/ajax.js --- a/includes/clientside/static/ajax.js Wed Jun 27 00:59:42 2007 -0400 +++ b/includes/clientside/static/ajax.js Wed Jun 27 12:09:02 2007 -0400 @@ -226,12 +226,18 @@ } function ajaxDeletePage() { + var reason = prompt('Please enter you reason for deleting this page.'); + if ( !reason || reason == '' ) + { + return false; + } c = confirm('You are about to DESTROY this page. Do you REALLY want to do this?'); - if(!c) return; - c = confirm('You\'re ABSOLUTELY sure???'); - if(!c) return; + if(!c) + { + return; + } setAjaxLoading(); - ajaxGet(stdAjaxPrefix+'&_mode=deletepage', function() { + ajaxPost(stdAjaxPrefix+'&_mode=deletepage', 'reason=' + escape(reason), function() { if(ajax.readyState == 4) { unsetAjaxLoading(); alert(ajax.responseText); diff -r dd659f6ba891 -r dd2edcdc6c03 includes/pageprocess.php --- a/includes/pageprocess.php Wed Jun 27 00:59:42 2007 -0400 +++ b/includes/pageprocess.php Wed Jun 27 12:09:02 2007 -0400 @@ -752,6 +752,12 @@ echo '
This page also appears to have some log entries in the database - it seems that it was deleted on ' . $r['date_string'] . '. You can probably roll back the deletion.
'; + echo 'This page was deleted on ' . $r['date_string'] . '. The stated reason was:
' . $r['edit_summary'] . '
You can probably roll back the deletion.
'; } $db->free_result(); } diff -r dd659f6ba891 -r dd2edcdc6c03 includes/pageutils.php --- a/includes/pageutils.php Wed Jun 27 00:59:42 2007 -0400 +++ b/includes/pageutils.php Wed Jun 27 12:09:02 2007 -0400 @@ -613,7 +613,7 @@ elseif($r['action']=='semiprot') echo 'Semi-protected pageDeleting pages requires admin rights.
'); if(isset($_POST['_adiossucker'])) { - $template->header(); - $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace); - echo ''.$result.' Return to the page.
'; - $template->footer(); - break; + $reason = ( isset($_POST['reason']) ) ? $_POST['reason'] : false; + if ( empty($reason) ) + $error = 'Please enter a reason for deleting this page.'; + else + { + $template->header(); + $result = PageUtils::deletepage($paths->cpage['urlname_nons'], $paths->namespace, $reason); + echo ''.$result.' Return to the page.
'; + $template->footer(); + break; + } } $template->header(); ?> @@ -324,6 +330,8 @@While the deletion of the page itself is completely reversible, it is impossible to recover any comments or category information on this page. If this is a file page, the file along with all older revisions of it will be permanently deleted. Also, any custom information that this page is tagged with, such as a custom name, protection status, or additional settings such as whether to allow comments, will be permanently lost.
Are you absolutely sure that you want to continue?
You will not be asked again.
Reason for deleting: