<?php require_once '../thinkedit.init.php'; require_once ROOT . '/class/clipboard.class.php'; echo '<pre>'; $root = $thinkedit->newNode(); $root->loadRootNode(); $tmp = $thinkedit->newRecord('page'); $tmp->setTitle('testing_clipboard'); $tmp->save(); $tmp_node = $root->add($tmp); $tmp2 = $thinkedit->newRecord('page'); $tmp2->setTitle('testing_clipboard 2, in root later'); $tmp2->save(); $tmp_node2 = $tmp_node->add($tmp2); // now we try to mode tmp_node2 into root $clipboard = new clipboard(); $clipboard->clear(); $clipboard->cut($tmp_node2); $clipboard->paste($root); echo $clipboard->debug(); print_r($_SESSION); /* $tmp_node->delete(); $tmp_node2->delete(); */
Thinkedit clipboard It will keep in a session the node id that is in the clipboard and will paste it when requested (add a new emplacement, or change parent) Input : - source_node (for cut and copy) - target_node (for paste) - action (cut,copy,paste) - node_id Output : Simple translated messages in clear text, to be shown inside an iframe (status bar) */ die('deprecated'); include_once 'common.inc.php'; include_once '../class/clipboard.class.php'; //check_user check_user(); $clipboard = new clipboard(); //echo $clipboard->debug(); $session = $thinkedit->newSession(); if ($url->get('action') == 'cut') { if ($url->get('source_node')) { /* $session->set('clipboard_source_node', $url->get('source_node')); $session->set('clipboard_action', 'cut'); */ $source_node = $thinkedit->newNode(); $source_node->setId($url->get('source_node')); if ($clipboard->cut($source_node)) { $out['info'] = translate('node_cut_ok'); } else { $out['info'] = translate('node_cut_failed'); }
$url->set('error', 'node_not_moved'); $url->redirect(); } } if ($url->get('action') == 'movebottom') { if ($current_node->moveBottom()) { $url->set('info', 'node_moved_successfully'); $url->redirect(); } else { $url->set('error', 'node_not_moved'); $url->redirect(); } } /********************* Clipboard action **********************/ include_once '../class/clipboard.class.php'; $clipboard = new clipboard(); if ($url->get('action') == 'cut') { if ($clipboard->cut($current_node)) { $out['info'] = translate('node_cut_ok'); } else { $out['info'] = translate('node_cut_failed'); } } if ($url->get('action') == 'copy') { if ($clipboard->copy($current_node)) { $out['info'] = translate('node_copy_ok'); } else { $out['info'] = translate('node_copy_failed'); } } if ($url->get('action') == 'paste') {
<?php include_once '../thinkedit.init.php'; include_once '../class/clipboard.class.php'; $clipboard = new clipboard(); echo $clipboard->debug();