Code Monkey home page Code Monkey logo

Comments (4)

thorst avatar thorst commented on September 24, 2024

I thought i would take a stab at this, and I've gotten pretty close.

I started out by downloading the following plugin to see how they were doing it:
https://www.dokuwiki.org/plugin:dw2pdf

Then I grabbed an icon and overlayed it on theirs
Used an icon from http://icons8.com/icons/#!/1878/rename

Then made the following changes to your plugin:

Add style.css to root:

/**
 * mode move_rename pagetool icon
 */
#dokuwiki__pagetools ul li a.move_rename {
    background-position: right 0;
}
#dokuwiki__pagetools ul li a.move_rename:before {
    content: url(pagetools-moverename-sprite.png);
    margin-top: 0;
}
#dokuwiki__pagetools:hover ul li a.move_rename,
#dokuwiki__pagetools ul li a.move_rename:focus,
#dokuwiki__pagetools ul li a.move_rename:active {
    background-image: url(pagetools-moverename-sprite.png);
}
#dokuwiki__pagetools ul li a.move_rename:hover,
#dokuwiki__pagetools ul li a.move_rename:active,
#dokuwiki__pagetools ul li a.move_rename:focus {
    background-position: right -45px;
}

Add to the bottom of lang/en/lang.php:

// Page Tools
$lang['move_button'] = 'Move/Rename';

Add to action.php around line 25 in register function:

        $controller->register_hook('TEMPLATE_PAGETOOLS_DISPLAY', 'BEFORE', $this, 'addbutton', array());
        $controller->register_hook('ACTION_ACT_PREPROCESS', 'BEFORE', $this, 'handle_moverenamebutton', array());

Add to action.php somewhere in the file:

/**
     * Handle when user clicks on move rename button
     *
     * @param Doku_Event $event
     * @param array      $param
     * @return bool
     */
    public function handle_moverenamebutton(&$event, $param) {
        global $ACT;
        global $REV;
        global $ID;
        global $INPUT, $conf;

        // our event?
        if($ACT != 'move_rename') return false;

        // check user's rights
        if(auth_quickaclcheck($ID) < AUTH_READ) return false;

        //$list[0] = $ID;
        //$title = p_get_first_heading($ID);

    }

   /**
     * Add 'move rename'-button to pagetools
     *
     * @param Doku_Event $event
     * @param mixed      $param not defined
     */
    public function addbutton(&$event, $param) {
        global $ID, $REV;

        //if($this->getConf('showexportbutton') && $event->data['view'] == 'main') {
            $params = array('do' => 'move_rename');
            if($REV) $params['rev'] = $REV;

            // insert button at position before last (up to top)
            $event->data['items'] = array_slice($event->data['items'], 0, -1, true) +
                                    array('move_rename' =>
                                          '<li>'
                                          . '<a href=' . wl($ID, $params) . '  class="action move_rename" rel="nofollow" title="' . $this->getLang('move_button') . '">'
                                          . '<span>' . $this->getLang('move_button') . '</span>'
                                          . '</a>'
                                          . '</li>'
                                    ) +
                                    array_slice($event->data['items'], -1, 1, true);
        //}
    }

My issue is that when you click the link you get the following message Command unknown: move_rename. I tried linking directly to the page doku.php?id=proxy_request_service&do=admin&page=move, but that doesn't pick up what page they were on, so I think that's risky.

Do you know how I can register that move_rename action, or how to link directly to the page and have it fill in the proper page?

I would be happy to do a pr once I get this working.

from dokuwiki-plugin-move.

thorst avatar thorst commented on September 24, 2024

Well, I changed the url to doku.php?id='.$ID.'&do=admin&page=move and that seems to work

from dokuwiki-plugin-move.

michitux avatar michitux commented on September 24, 2024

The new version of the move plugin which has been released today supports this directly at least for the dokuwiki template.

from dokuwiki-plugin-move.

michitux avatar michitux commented on September 24, 2024

This is now a configuration option in the move plugin.

from dokuwiki-plugin-move.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.