-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: page move function #58
Comments
Because there is no responds until now I'd like to know whether this request is accepted or not. This function is one of the few reasons I can't use blogtng for the wiki of my company. |
On short term i don't expect improvements on this area. |
I had a look at this when I implemented the pagemove plugin. The new pagemove plugin provides an event that other plugins can use in order to move their data. I wrote some code for a new action component in <?php
/**
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Michael Hamann <[email protected]>
*/
// must be run within Dokuwiki
if (!defined('DOKU_INC')) die();
class action_plugin_blogtng_pagemove extends DokuWiki_Action_Plugin{
private $entry = null;
private $tags = array();
function register(&$controller) {
$controller->register_hook('PAGEMOVE_PAGE_RENAME', 'BEFORE', $this, 'get_data', array());
$controller->register_hook('PAGEMOVE_PAGE_RENAME', 'AFTER', $this, 'update_data', array());
}
function get_data($event, $params) {
global $ID;
$old_pid = md5($ID);
/** @var helper_plugin_blogtng_entry $entryhelper */
$entryhelper =& plugin_load('helper', 'blogtng_entry');
if ($entryhelper->load_by_pid($old_pid) === helper_plugin_blogtng_entry::RET_OK) {
$this->entry = $entryhelper->entry;
$taghelper = $entryhelper->getTagHelper();
$this->tags = $taghelper->tags;
$entryhelper->delete();
}
}
function update_data(&$event, $params) {
if (!is_null($this->entry)) {
$new_id = $event->data['opts']['new_id'];
$new_pid = md5($new_id);
/** @var helper_plugin_blogtng_entry $entryhelper */
$entryhelper =& plugin_load('helper', 'blogtng_entry');
$entryhelper->load_by_pid($new_pid);
$entryhelper->entry['page'] = $new_id;
$entryhelper->set($this->entry);
$entryhelper->save();
$taghelper = $entryhelper->getTagHelper();
$taghelper->set($this->tags);
$taghelper->save();
}
}
} |
Hi,
I really like blogtng.
There is just one thing I'm missing.
It would be nice if blogtng would provide a function for other plugins which allows moving of pages.
So e.g. dw-editx could also move pages stored in blogtng database without losing the comments and tags of it.
The text was updated successfully, but these errors were encountered: