bfncs

Page Path History Manager

Recommended Posts

If you are using the great PagePathHistory module in core, this one might be helpful:

Page Path History Manager

https://github.com/boundaryfunctions/PagePathHistoryManager

General

This modules allows you to easily manage past page URLs tracked with the PagePathHistory module.

It extends the settings tab on the page edit form in the backend and allows you to:

  • view past URLs of the current page and parent pages,
  • delete past URLs, and
  • create new fallback URLs.

How to use

Use the form in the settings tab on the page edit form of every page in admin to view and manipulate past URLs. See Screenshots to get a better idea of what you can do.

Installation

  1. Install the module PagePathHistory from within the Processwire admin. PagePathHistory is included in core but not installed by default.
  2. Grab the module from its Github repository.
  3. Install this module from within the Processwire admin or copy the file content to/site/modules/PagePathHistoryManager.
  4. In Admin, click Modules → Check for new modules to refresh module directory. Afterwards install the newly registered module PagePathHistoryManager.
  5. You can now manage past URLs from within the settings tab when editing any page.

Screenshots

post-869-0-58798400-1426800493_thumb.png

post-869-0-64524600-1426800494_thumb.png

post-869-0-64195800-1426800495_thumb.png

Notes

This module doesn't install or require PagePathHistory because I'm currently working with a fork of it that is language sensitive. I'll try to publish this one here as well, but I'm not done with final testing.

Links

You can grab this Module from Github:

I would be glad if some of you could give this module a quick test drive and comment with some feedback here.

  • Like 16

Share this post


Link to post
Share on other sites

Thanks for making this, great idea that comes in handy.

Just for code:

At a first glance at the code, why does it have to be a Process module that is autoload? 

Not sure but I think implement Module isn't necessary as Process class already has that?

Instead of this:

public function install()
    {
        parent::___install();

        /* Create manager page */
        if (!count($this->pages->find('name=' . __CLASS__))) {
            $p = new Page();
            $p->template = $this->templates->get('admin');
            $p->title = 'Page Path History Manager';
            $p->name = __CLASS__;
            $p->parent = $this->pages->get(3); // Create as children of /admin/pages
            $p->status = Page::statusHidden | Page::statusSystem; // Hide in menu and prevent deletion
            $p->process = $this;
            $p->save();
        }
    }

You can also do now

public static function getModuleInfo() {
    return array(
        'title' => '',
        'page' => array(            // optionally install/uninstall a page for this process automatically
            'name' => 'page-name',  // name of page to create
            'parent' => 'setup',    // parent name (under admin) or omit or blank to assume admin root
            'title' => 'Title',     // title of page, or omit to use the title already specified above
            )
        ),
...
  • Like 3

Share this post


Link to post
Share on other sites

Seems to work great here. Awesome tool! Thanks.

Share this post


Link to post
Share on other sites

Hey Soma,

that was quick, thanks a lot for giving it a try!

At a first glance at the code, why does it have to be a Process module that is autoload? 

That's actually a very good question, the answer is probably that I got somewhat stuck in a rut while working on the module. It would probably be better to split this into two modules: PagePathHistoryManager to hook into the settings form and ProcessPagePathHistoryManager to provide the URLs for the process.

Not sure but I think implement Module isn't necessary as Process class already has that?

Absolutely right, didn't know that until now, thanks for pointing it out!

Instead of this: [...]

You can also do now: [...]

The next thing that I missed because I didn't follow closely. Processwire development is as always rapid and brings really great improvements.

Edit: I've been looking for this, but didn't find the place where this new behavior is documented. Could you please point me to the correct ressource? If I get it right, it is not possible to set the status of the newly created page this way, is this correct?

It's too late for today, but I'm going to add all this in the module tomorrow. Thanks a lot for the review!

Edited by boundaryfunctions

Share this post


Link to post
Share on other sites

Thanks again for your review, Soma. I just uploaded a new release that should solve the problems you mentioned.

The module has now been split into two distinct modules, one autoloaded and the other for the process. That also means that if you already had the first version of the module installed, you will have to either uninstall it before the update and reinstall it afterwards or have to manually install the newly added submodule ProcessPagePathHistoryManager.

Edited by boundaryfunctions

Share this post


Link to post
Share on other sites

My example is right from Process.php comments. Not sure about status.

Share this post


Link to post
Share on other sites

Nice module, thank you. Interesting to see the old links.

If you have a lot of links to remove, it can be a lot of click-click to get rid of them one by one individually. What about checkboxes and only one button?

Share this post


Link to post
Share on other sites

Thanks a lot for your comments.

My example is right from Process.php comments. Not sure about status.

Looking at the code of Process::___installPage() showed that there currently is no possibility to set the page status using the descriptive way to set up a page. Thanks anyway, knowing about this will come in handy soon enough, really saves some repetitious copy-paste work.

If you have a lot of links to remove, it can be a lot of click-click to get rid of them one by one individually. What about checkboxes and only one button?

I already though about this myself but shirked from the duty of implementing it for the first release. But you're absolutely right, sooner or later this will be needed, so thanks for pointing it out. I've already added an issue for this feature and will implement it during the next days.

There's one other thing that has been corrected in the current development version of the module and this is proper handling of URLs with non name-format characters (all characters but -_.a-zA-Z0-9/~), i.e. to redirect content from a legacy website. Due to the way Processwire currently handles these URLs, you will have to edit youR .htaccess file to enable this functionality. I added a short description of what has to be done to the module's README and issued a pull request on core to make the need for manual modifications obsolete in the future – let's see how this turns out.

  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By kixe
      Email Verification
      This module provides functions to validate email adresses and hosts. The module generates a textfile for blacklisted mailhosts (trashmail), which will be always up to date.
      Download
      https://modules.processwire.com/modules/email-verification/
      API
      // get module $mailcheck = $modules->get('EmailVerification'); // return bool/ string - automatted update of blacklist file $mailcheck->blacklisted(email|domain) // return bool - validate a top level domain, checks against IANA list $mailcheck->validTLD(tld) // return array of punycoded TLDs - cyclic updated, data pulled from IANA $mailcheck->getTLDs(cycle=2592000) // return bool - checks syntax converts to punycode $mailcheck->validDomainName(domain); // return bool - checks punycode encoded syntax $mailcheck->validHostName(host); // return bool - checks syntax and accessibility $mailcheck->validHost(email|domain) // add a single value to blacklist $mailcheck->addToBlacklist(email|domain) USAGE
      $mailcheck = $modules->get('EmailCheck'); $email = 'susi@trashmail.com'; if($mailcheck->blacklisted($email)) echo 'Email Provider not allowed'; if(!$mailcheck->validHost($email)) echo 'Mailhost not available'; Example blacklist file:  blacklist.txt
       
    • By teppo
      Code Blocks Textformatter is a tiny Textformatter module I cooked up to add support for code blocks to text/textarea/RTE fields on some of the sites I work with. Unlike a full-blown Markdown Textformatter – which is something that we already have in the core – this module simply adds support for fenced and inline code blocks.
      The syntax is based on the GitHub code block documentation, so please refer to that for additional instructions. The README at GitHub also includes some basic examples. As with any Textformatter, in order to enable this one, install it and enable it via field settings. Note that there's no syntax highlighting built in (at least for the time being), so use a tool of your choice for that – personally I prefer Prism.js.
      Since this module doesn't use a Markdown tool behind the scenes, but rather some home baked regular expressions, there's always the possibility that I've missed something – but please let me know if you use this module and run into any issues. On the other hand this module should be relatively fast and unobtrusive, as there are no unnecessary bits of code to run 
      GitHub repository: https://github.com/teppokoivula/TextformatterCodeBlocks Modules directory: http://modules.processwire.com/modules/textformatter-code-blocks/
    • By theo
      Here is my first processwire module (beta).
      https://github.com/theo222/ImagePickerField
      A lot of "first times". First time Github, Markdown and of course PW Modules.
      So be gentle please.
      I hope it works.

    • By horst
      Image Animated GIF  v 2.0.2
       
      Module for PW 2.5 stable or newer, but is obsolete for PW Versions greater then 3.0.89 (... read more ...)
       
      This module helps with resizing and cropping of animated GIFs when using the GD-Library.
      The GD-Library does not support this.


      This module is completely based upon the fantastic work of

         László Zsidi (http://www.gifs.hu/, builts the initial classes)
         xurei (https://github.com/xurei/GIFDecoder_optimized, enhanced the classes)


      I have ported it to a PW module and it works with core imagefields, together with Pia and with CropImagefields that uses the new naming scheme since PW 2.5.
       
      ------------------------------------------------------------------------------------------------------------------------------------------
      read more in this post about the rewrite from version 1.0.0 to version 2.0.0
      ------------------------------------------------------------------------------------------------------------------------------------------
      You can find it in the modules directory: https://modules.processwire.com/modules/image-animated-gif/
      and on Github: https://github.com/horst-n/ImageAnimatedGif
      ------
      A preview can be found here