FoxPTVConvert

Summary: Display and convert hidden PTVs on multiple pages
Version: 2015-09-28
Prerequisites: Fox PowerTools
Status: new
Maintainer: HansB
License: GPL2
Users: (view? / edit)

Description

An admin tool using Fox forms to display and convert hidden PTVs on multiple pages

Installation

Download foxptvconvert.phpΔ, copy to cookbook folder and include in config.php with

include("cookbook/foxptvconvert.php");

Make sure fox.php and powertools.php are also installed.
De-install after conversion jobs are done, to prevent misuse!

Configuration

Copy example form below to a secure wiki page (you can find this form also in the script's comments)

(:table width=100%:)
(:cell:)
!!!Display hidden PTVs
(:fox test foxaction=display foxtemplate="{$$(hiddenptvs (plist {$$group}.{$$name}))}":)
(:input default source=1:)
Pages (:input text name *:)
Group (:input text group Main:)

->(:input submit post 'Display hidden PTVs':)
(:foxend test:)
(:cell:)
!!!Convert hidden PTVs
(:fox convert foxaction=display foxtemplate="{$$(hiddenptvs {$$plist})}":) 
(:input hidden plist "{$$(plist {$$group}.{$$name})}":) 
(:input hidden foxfilter ptvconvert:)
(:input default source=1:)
Pages (:input text name *:)
Group (:input text group Main:)
replace (:input text old size=8:) with (:input text new size=8:)
(:input submit post "Convert hidden PTVs":) Test run (:input checkbox testrun:)
(:foxend convert:)
(:tableend:)
(:foxmessages:)(:foxdisplay:)

Usage

Use the convert form with admin rights. It is a powerful script with little safeguards built-in, use at your own risk, make a backup of wiki pages first.

The Display form lets you see the name and values of hidden PTVs in multiple pages, by supplying page name and group in the input fields, wildcard characters like * and? are allowed.

The Convert form lets you do a string search/replace in PTV values over multiple pages. It's main aim is to facilitate an easy change of the separating comma in csv lists in PTVs to a space character, so such array PTV values can be better used with PmWiki's input default directive in forms. But the form allows general changes in PTVs from one string to a replacement string.

It does not facilitate emptying of multiple PTVs, or setting them to just one specific value.

Any page updating performed by this script uses PmWiki's internal UpdatePage() function, and all page attributes and page histories are preserved. A RecentChanges Summary is not written though.

Notes

The Display form uses a custom markup expression 'hiddenptvs', which could be used without form, but is best used with PowerTools 'plist' expression for multiple page use. The Convert form uses these two markup expressions as well as Fox and a custom Fox Filter function.

Change log / Release notes

  • 2015-09-28: initial release.

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

See also

Contributors

Comments

See discussion at FoxPTVConvert-Talk?

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.