FoxTextReplace-Talk

Summary: Talk page for FoxTextReplace.
Maintainer: HansB
Users: (View? / Edit)

This space is for User-contributed commentary and notes. Please include your name and a date along with your comment.

Comments

Incompatibility

From: R. D. Jones, May 8, 2012:
This is a very useful tool but it is incompatible with Cookbook.RequireSummary. If each edit is required to have a summary added (as the RequireSummary recipe requires), then FoxTextReplace will not replace anything. The workaround is to comment out RequireSummary in the config.php and then run your FoxTextReplace, and then reinstall RequireSummary. But this is clunky to have to change the config every time I want to do a bulk TextReplace, and besides, each edit using TextReplace is not identified with an edit summary (and I'd like to know that a bulk replace had been made when looking at the page history).

Is there an easy way to set the change summary in FoxTextReplace so that if a summary is required, a summary is provided?

HansB: I think you just need to add a hidden field named csum to the Fox form, with some value of what you want the /summary to say, like

(:input hidden csum "Text Replace":)

Modification

wow, this is extremely useful. here's my own version of the recipe - it contains a form for practicing deriving your wildcard target names; an 'Add Text' form where you can toggle between adding text to the top or bottom of pages, and a 'Replace Text' form where you can toggle between all occurrences, first occurrence, and regex. i'm including this on my SiteAdmin.ReplaceText. overtones99 December 23, 2009, at 06:17 AM

(:fox listpages foxaction=display:)
(:foxtemplate ">>lframe padding=10px bgcolor=#ddffdd<<\n'''Pages to be affected:''' \n->{$$(plist {$$pat} sep="\n->")}\n>><<[[<<]]":)
>>lframe width=55pct padding=10px<<
'''List Pages'''
Practice your plist expressions here first. You can specify several target pages (with a space between each), and use wiki wildcards (* and ?). 

''Example:'' '''Test.*''' to replace a string on all pages in ''Test'' group.

GroupPattern: (:input default request=1 :)(:input text pat:) (:input submit post 'List Pages':)

(:foxdisplay listpages:)
(:foxend listpages:)
>><<
[[<<]]

>>lframe width=55pct bgcolor=#ffeeee padding=10px<<
'''Add Text to Pages'''
(:fox addtext target='{$$(plist {$$pat})}' foxtemplate="{$$new}":)
|| 
|| Add text to the:||(:input default put top:)(:input radio put top:) top  (:input radio put bottom:) bottom ||
|| Add text string:||(:input text new size=40:) ||
|| To Target Pages:||(:input text pat size=40:) ||
|| ||(:input submit post 'Add Text Now':) ||
(:foxend addtext:)
>><<
[[<<]]

>>lframe width=55pct bgcolor=#ffeeee padding=10px<<
'''Replace Text'''
(:fox frm foxaction=replace target='{$$(plist {$$pat})}' foxtemplate="{$$new}" mark='{$$mk}':)
|| 
|| Replace:||(:input default put all:)(:input radio put all:) all instances  (:input radio put string:) first instance   (:input radio put regex:) regex ||
|| Replace text string:||(:input text mk size=40:) ||
|| With this string:||(:input text new size=40:) ||
|| On Target Pages:||(:input text pat size=40:) ||
|| ||(:input submit post 'Replace Now':) ||
>><<
[[<<]]

>>lframe<<
'''Results:'''
(:foxmessage:)
>><<
(:foxend frm:)
[[<<]]

Talk page for the FoxTextReplace recipe (users?).