Package: rt.bulkmodify
Table of contentsRead carefully!IntroductionA usecaseHow to useAccessing the “Bulk modify contents” panelBasic searchResultsReplace textReplacing optionsAdvanced useAdvanced server side operationsAdding new server side special handlersExtending handled typesTODOCreditsAuthorsChangelog0.4.1 (2014-05-29)0.4 (2013-10-07)0.3 (2013-04-02)0.2 (2013-03-26)0.1.1 (2013-03-15)0.1 (2013-03-14)Read carefully!Even if this product is giving you an high level Plone user interface,it’s not designed for end usersor “normal” site administrators.
You must be aPython regular expressionexpert (probably a Grand Master).Also: when used this product canslow downyour running Plone site.Notebackupyour Plone site and be carefulIntroductionThis product will give to your Plone site managers a tool for performing text search usingregular expressionsquery and optionally performing text substitutions on the main rich text field of your site’s contents.A usecaseYou are working at the Ministry of Truth in the super-state of Oceania.
War history say that Oceania is allied with Eastasia and in war with Eurasia.You are in charge of keeping the Oceania web site updated and the Party choosed Plone as the unique CMS available.Then the Party apply the Doublethink, and history change: Oceania had never been allied with Eastasia, but
it’s allied with Eurasia (and in war with Eastasia).
You must quickly updated the Plone site.You need to quickly review all document where Eastasia and Eurasia are named and, if needed, switch the two names.
You can’t simply perform a bach substitution because you must read the context on which the term to be replaced is
used.For example: a document that talk about Eastasia as a friend must be changed, a document that describe the
geographical position of Eurasia can remain untouched.How to useThis product is designed for performing the same text type of replacement operation on many documents without
going to edit every ones.By default the product works with all know rich text fields of Plone contents, that are:text field from Page content typetext field from Event content typetext field from News Item content typetext field from Collection content type (old-style also)You can extending the set above providing 3rd party extensions (see below).Accessing the “Bulk modify contents” panelIn your “Site setup” section you will find a new “Bulk modify contents” panel.
All operations take places from this page.Basic searchThe upper section of the page is about searching contents.You must select which content types you want to inspect by checking the “Content types” section.
Although this selection display all content types, note that only a subset of them usable (for example: the Link
content types is not using any text field right now).This selection will trigger a catalog search of all types in the selection (so keep this selection at minimum).The most important field is the “Search regex”, where you must write a regular expression.
For every content type found, it’s text field will be loaded and text inside wil be parsed for searching matches
with the regex.You can change some regex search configuration option using the “Regex flags” set of checkboxes.Now you can hit the search button below.ResultsResults of the search are displayed in a table at the bottom of the page.The table will contain a preview of the found text and minimal information about the content.
Please note that a single document can be found multiple time in the table as the minimal entity is the text match,
not the document itself.Replace textThe simpler way of performing text replacement is get filling the “Default replacement” text area.The table of results will change, providing a graphical preview of what will be changed applying your
replacement expression.The user must now select all replacement that he really want to apply, the click the “Modify selected” button.
Only selected matches are changed.Replacing optionsWhen changing text you are (obviously) changing a Plone content, so you have some additional option available:Do not update anything (silent change)Useful if you want to fix some contents without updating other metadata from the content itself.
Only the text field (and the Plone full text index) will be updated.Site members will never notice this type of changes.Update modification timeUpdate also the last modification time of the document.Create a new version (if possible)Full modification. If the content type is versionable, a new version will be saved.Advanced useAdvanced server side operationsSometimes a simple text regex expression is not enough.
This product is supporting a way of handling really complex text substitution by calling some server side
components.By default, only one handler is available: “Convert internal links to resolveuid usage”, that can transform
Plone internal links to content to a form that use the “resolveuid” call.
This can be used in Plone sites where the TinyMCE option “Link using UIDs” were not enabled by mistake
(something like the feature given by Kupu editor).Adding new server side special handlersProving newIBulkModifyReplacementHandlerutility will automatically display new special replacement:<utility
     name="handler_name"
     component="your.product.utility.YourTextSpacialReplacement"
     provides="rt.bulkmodify.interfaces.IBulkModifyReplacementHandler"
  />Extending handled typesTo being able to change a text field of a type not handled, you must provide a proper adapter with a 3rd party
product:<adapter
      for="your.product.interfaces.IYourContentTypeInterface"
      provides="..interfaces.IBulkModifyContentChanger"
      factory="your.product.adapter.YourTextContentAdapter"
      />TODOAdding a way for using text substitution also as a running script for instanceWereallyneed JavaScript testsJavaScript is all but optimizedThe product is designed for performing multiple write commit on ZODB, but probably a
way of performing a single huge write operation can be usefulCreditsDeveloped with the support ofRegione Emilia Romagna;
Regione Emilia Romagna supports thePloneGov initiative.AuthorsThis product was developed by RedTurtle Technology team.Changelog0.4.1 (2014-05-29)Requires zope.tal >= 3.6.1 if on Python 2.6. This close#2.
[keul]Makeportal_cssandportal_javascripthappy: do not add
load condition for JavaScript and CSS. This prevent fragmentation on
loaded resources
[keul]0.4 (2013-10-07)Nicely display types check, plus a select all/none command
[keul]Show a counter for documents really checked (means: for documents where
theIBulkModifyContentChangeradapter has been found)
[keul]Show an HTML preview also when replacing text (this close #3)
[keul]Do not break if “text” can’t be read (for example: for ComputedField named “text”)
[keul]0.3 (2013-04-02)Calling a new search after a change were not working until
you re-start the instance
[keul]Fixed broken tests
[keul]Better UI after changes (display only one message per content, and keep
the content title)
[keul]Calling additional changes on the same content were not working
(or worst: it could perform a wrong substitution)
[keul]Fixed a bug in the label/checkbox association when you have multiple match on same element
[keul]Added a new checkbox type, for selecting all matches of the same document
[keul]0.2 (2013-03-26)Kept a link to content after server changes
[keul]Open links in new windows
[keul]When a document is updated multiple times, onlyonenew
version is created
[keul]When request for replacements are submitted show a spinner and disable
checkbox
[keul]Display a counter about running searches
[keul]JSHint cleanup and fix for Internet Explorer
[keul]Is now possible to pause, then continue, a search operation
[keul]0.1.1 (2013-03-15)When loading data from Archetypes field, use therawformat.
This prevent substitution from destroyingresolveuidusage.
[keul]When  performing searches, display immediately the “loading” info,
not after the first completed request
[keul]0.1 (2013-03-14)Initial release