Wiclear

You are here :

English Confirmation of history delete code

Sunday, 9. July 2006 14:14:23, by David Jobet

 

David(09/07/06) : done

In history.php

Modify handler array

//New event handlers
$contentBoxHandle"history_del"          = "deleteHistory";
$contentBoxHandle"history_del_all"      = "deleteAllHistory";
//added _confirmed to the array key
$userActionHandle"history_del_confirmed"          = "onDeleteHistory";
$userActionHandle"history_del_all_confirmed"      = "onDeleteAllHistory";

Add the following two functions

/**
* brief Confirm delete history 
*
* return html blob
*/
function deleteHistory(){
   //sdw - added to get user to confirm delete
   global $wiki;
   global $node;
   global $user;
   
   $id = varGet("id");
   $html = '<h1>Confirm delete history </h1>';
   $html .= '<p>This will permentally delete this version of the page from the wiki, you will not be able to undo this action.</p>';
   $html .= "<p>Please confirm you wish to delete this version of '{$node->title}'</p>";
   $html .= "<p><a href="?title={$node->title}&amp;id={$id}&amp;mode=history&amp;lang={$node-&gt;lang-&gt;code}&quot;&gt;No (take me back)&lt;/a&gt;&lt;/p&gt;&quot;;
   return $html; 
}

and

/**
* brief Confirm delete all history
*
* return html blob
*/
function deleteAllHistory(){
   //sdw - added to get user to confirm delete
   global $wiki;
   global $node;
   global $user;
   
   $id = varGet("id");
   $html = '<h1>Confirm delete all history </h1>';
   $html .= '<p>This will permentally delete all previous versions of the page from the wiki, you will not be able to undo this action.</p>';
   $html .= "<p>Please confirm you wish to delete all previous versions of '{$node->title}'</p>";
   $html .= "<p><a href="?title={$node->title}&amp;id={$id}&amp;mode=history&amp;lang={$node-&gt;lang-&gt;code}&quot;&gt;No (take me back)&lt;/a&gt;&lt;/p&gt;&quot;;
   return $html; 
}

No trackbacks yet

To make a trackback, use ping url http://wiclear.free.fr/tools/trackback/trackback.php?id=167

If your client support ping url auto discovery, you can also try it using directly this page's url

No comments yet