adrian

Batch Child Editor

Recommended Posts

This module facilitates quick batch creation (titles only or CSV import for other fields), editing, sorting, deletion, and CSV export of all children under a given page. You can even provide an alternate parent page which allows for editing of an external page tree.
 
http://modules.processwire.com/modules/batch-child-editor/
https://github.com/adrianbj/BatchChildEditor
 
The interface can be added to the Children Tab, or in a new dedicated tab, or placed inline with other fields in the Content tab.
 
Various modes allow you to:

  • Lister - Embeds a customized Lister interface. Installation of ListerPro will allow inline ajax editing of displayed fields.
     
  • Edit - This allows you to rename existing child pages and add new child pages. It is non-destructive and so could be used on child pages that have their own children or other content fields (not just title). It includes the ability to quickly sort and delete pages and change page templates. Also allows full editing of each page via a modal dialog by clicking on the page name link.

    This is my preferred default setup - see how it replaces the default Children/Subpages with an easily addable/editable/sortable/renamable/deletable list. Note that the edit links open each child page in a modal for quick editing of all fields.

    post-985-0-98642800-1432782769_thumb.png
     
  • Add - adds newly entered page titles as child pages to the list of existing siblings. You could create a list of pages in Word or whatever and just paste them in here and viola!

    This screenshot shows the editor in its own tab (name is configurable) and shows some of the CSV creation options. Update and Replace modes look fairly similar but show existing page titles.

    post-985-0-16922200-1430761056_thumb.png
     
  • Update - Updates the titles (and any other fields if you enter CSV data) for the existing pages and adds any additionally entered pages.
     
  • Replace - Works similarly to Add, but replaces all the existing children. There are checks that prevent this method working if there are any child pages with their own children or other content fields that are not empty. This check can be disabled in the module config settings, but please be very careful with this.
     
  • Export to CSV - Generates a CSV file containing the fields for all child pages. Fields to be exported can to fixed or customizable by the user. Also includes an API export method.

    post-985-0-87901800-1432667874_thumb.png

Populating fields on new pages
 
In Add, Update, and Replace modes you can enter CSV formatted rows to populate all text/numeric fields, making for an extremely quick way of creating new pages and populating their content fields.
 
 
Predefined Field Pairings
 
Like the field connections setup from Ryan's CSV Importer, but defined ahead of time so the dev controls what columns from the CSV pair with which PW fields. This is especially powerful in Update mode giving editors the ability to periodically import a CSV file to update only certain fields on a entire set of child pages. These pairings also allow for importing fieldtypes with subfields - verified to work for Profields Textareas and MapMarker fields, but I think should work for most others as well - let me know if you find any that don't work.
 
 
Access permission
 
This module requires a new permission: "batch-child-editor". This permission is created automatically on install and is added to the superuser role, but it is up to the developer to add the permission to other roles as required.
 
Config Settings
 
This module is HIGHLY configurable down to setting up custom descriptions and notes for your editors. You define one config globally for the site and then optionally you can define completely custom configurations for each page tree parent on your site. There are too many settings to bother showing here - you really just need to look through all the options and play around with them!

  • Like 19

Share this post


Link to post
Share on other sites
Just released an improved version. Two main changes:

  1. You can now limit which types of editing the users have access to. You might want to disable the Create/Overwrite mode in some cases. Note that superusers have both modes regardless of this setting.
  2. You can now add new pages using the edit mode.
Docs and images in the first post have been updated

  • Like 3

Share this post


Link to post
Share on other sites

Life saver Adrian! I was just thinking that it would be nice to have feature two days ago for the project I am working on at the moment. I haven't tested it but from the looks of it very promising. Cheers

Share this post


Link to post
Share on other sites

Glad to hear it sounds useful - please let me know how it goes for you and if you have any suggestions for improvements. I haven't had much real world feedback yet, so I would appreciate hearing your experience.

Share this post


Link to post
Share on other sites

Adrian,

Thanks for this!

Just finished testing...two things:

Not sure if possible: Would it be possible, somehow to display names of child pages alongside their titles? This is helpful when 'overwrite names' is not checked; new pages are created with similar titles but different names. However, all the user sees are similar titles. Not a big issue since names are visible on hover of the titles of children pages above (i.e. the PW list of children/subpages).

I have been getting this error: You cannot bulk edit these child pages, because at least one page has a field which is not empty. Try the edit option, or delete existing child pages first.  in Create/Overwrite mode. Does this mean child pages fields have to be empty before they can be overwritten?

Thanks again for the module! Great to see that it respects the template family settings ^-^

Share this post


Link to post
Share on other sites

Hi kongondo,

Thanks for testing. I should be able to do something for you along the lines of displaying the page names - I'll take a look.

The error you are getting is an intentional protection when using the Create/Overwrite mode. Because this mode deletes all children and recreates them I check to make sure there are no other fields (other than title and name) that have content and also that there are no grandchildren that might be deleted. I guess I could add an additional config setting to allow this check to be turned off.

Alternatively, the Edit mode will work fine because it won't affect other fields or grandchildren.

I am thinking the config option would probably work well, but I am still worried that if this module is accidentally enabled on a template or page with lots of content fields, it could be very destructive without this check. Maybe it's just a case of the developer needing to be very aware of where they make it available.

Do you have any thoughts on the best approach here?

Share this post


Link to post
Share on other sites

Thanks for prompt response Adrian. Haven't thought much about best approach but for now I would err on the side of caution.

Alternative 1: Don't delete anything with other non-empty fields (other than name and title). However, the explanation you have on your post above should be included somewhere in the Warning. Maybe better....

Alternative 2: An extension of Alternative 1 (some Warning notice) + to skip only the problematic child pages, i.e. the operations should continue for child pages with empty fields but skipped over for those with content. Then, capture the titles of the problematic ones and display a separate single error message alongside the success message: "could not bulk/edit a, b, c, d, e, f, g, x, z, because...blah, blah" (up to a point, otherwise string can be very long!). This way, the user is not too disappointed. The current all or nothing can be frustrating if you've spent a while setting things up [but did not check for non-empty fields first]  :lol:. Unless I am missing something and Alternative 2 is the current behaviour?

Cheers

Edited by kongondo

Share this post


Link to post
Share on other sites

Cannot create child pages with cyrillic titles. Probably names are not generated through transliteration.

  • Like 1

Share this post


Link to post
Share on other sites

Ivan,

I am really not very experienced with non-latin characters, but I just changed page name sanitizer to include: "Sanitizer::translate" which I am hoping will do what you need. Otherwise I will need to revisit things and use the code from the core that dynamically generates the page names on the fly from the titles.

I have also added a few new features to this module:

  1. There is a new "Add" option so it is possible to bulk add new children regardless of the content and grandchildren of the other sibling pages.
  2. Also there is a new config setting for allowing you to override the content protection check when using the overwrite mode - obviously use with extreme caution.

Hope all those changes are useful.

First post updated with new options and screenshots.

Edited by adrian
  • Like 2

Share this post


Link to post
Share on other sites

Nope. Still doesn't work. Latin titles are ok. Cyrillic titles don't work. Pages just do not get created at all. If i put a list with some latin and some cyrillic titles, only pages with latin titles get created.

And a little inconsistensy, as I think. If you do not choose any of the edit modes in module preferencies, you get the module output in page setup with a blank dropdown. Maybe get some defaults or turn off the output if nothing is selected in edit modes options. But that is for when it's time to polish.

Share this post


Link to post
Share on other sites

Ok, I just committed another update and I just tested myself with some cyrillic characters and I think everything should be working fine now.

I also fixed the blank dropdown issue. Now if there are no edit modes set in the config, the editor is not available at all from the Children tab.

Please let me know how it goes for you.

  • Like 1

Share this post


Link to post
Share on other sites

Finally got to test it. It seems to work fine. It even adds a number to the end of the name, if a page with the same name already exists. Something that my regular PW 2.4 does not do. That makes me wonder if this module uses some standard PW method or a custom one. I quess there will be a number of similar cases with non-latin characters, so want to make this clear (but not smart enough for now to compare the code myself ).

Share this post


Link to post
Share on other sites

Glad it works for you now!

It even adds a number to the end of the name, if a page with the same name already exists. Something that my regular PW 2.4 does not do.

PW should be adding a number to the end of the name to avoid conflicts. When you say this doesn't work for you, is it with all names, or only with names with cyrillic characters in them?

That makes me wonder if this module uses some standard PW method or a custom one. 

BatchChildEditor uses a custom naming method if the Overwrite Names option is checked in the module config, but if adding or overwriting, it uses the built-in method. What happens if you use the Add option and create to child pages with the same title - does the number get appended to the second child's page name?

Share this post


Link to post
Share on other sites

Hi everyone,

Added some major new functionality to the edit mode today (see revised screenshot for 3. in the first post). Edit mode now includes quick addition, sorting, and deleting of pages as well as full editing via a modal popup editor, similar to the new PageTable interface, making use of MarkupAdminDataTable.

If you are using this, definitely worth updating, and if you're not using it, maybe it is now worth taking a look :)

Enable this on your home template and you have a powerful editing alternative with the added ability to automatically overwrite page names based on changed page titles, which I think is very handy during the development phase of a new site.

Please let me know if you find any bugs with this new version.

  • Like 3

Share this post


Link to post
Share on other sites

I just committed a small but significant change in behavior - now if you don't select any templates or pages in the config settings, the Batch Child Editor tools will be available for all pages in your site. 

I have found I want access to this a lot (mostly the rename, sort, and delete functionality of the EDIT mode) and it was annoying to have to go and enable it for the template or page before I could use it, so now it can easily be available to all pages on your site. Hope everyone else finds this more convenient also.

  • Like 5

Share this post


Link to post
Share on other sites

Another significant update which should be a huge timesaver.

You can now populate all the text/numeric fields on newly created child pages (Add & Overwrite modes) from CSV formatted rows.

This allows easy creation and population of all page content, for example you could populate an entire page tree of country details by pasting in CSV formatted content like:

"Bolivia, Plurinational State of",BO,"BOLIVIA, PLURINATIONAL STATE OF",BOL,68

"Bonaire, Saint Eustatius and Saba",BQ,"BONAIRE, SAINT EUSTATIUS AND SABA",BES,535

etc

etc

Hope you guys will find this as useful as I am :)

As always, let me know if you have any problems or suggestions for improvements!

  • Like 5

Share this post


Link to post
Share on other sites

Major feature enhancements currently available on dev branch  - https://github.com/adrianbj/BatchChildEditor/tree/dev

The new config settings rely on the new "OR" options for inputfield dependencies, so this new version requires the dev branch of PW.

Please test carefully and let me know if you have any problems or suggestions!
 
Thanks to ideas, testing and feedback from @mr-fan this module now supports the following new features which mostly focus on enhanced, customized CSV importing for page creation:

  • Custom configurations on a page by page basis (on the Settings tab) - you can set up a default config in the module settings, but override these for any parent page.
     
  • Ability to set up custom titles, descriptions, and notes so the interface can be tailored to the exact needs of your editors with page/template specific examples.
     
  • Option to have editing tools in a new tab, rather than in the Children Tab. Alternatively, you can now replace the current Children/Subpages list in the Children tab.
     
  • CSV upload and link to external URL, in addition to the existing textarea manual / paste entry.
     
  • Ability to predefine "field pairings". This means that editors can upload/link to CSV files that may contain more fields than you want to import, or there are fields in your template that are not included in the CSV. Think of it as a predefined version of the "Connect the Fields" functionality in Ryan's "Import Pages from CSV Files" module. This makes complex imports foolproof for non-tech site editors.

I think in most cases this could now replace the need for custom scripts for editor friendly, regular CSV importing.
 
Despite the added options, it should be just as simple to setup as before if you don't need any of the extra features.
 
Here are some screenshots to give you an idea.
 
Shows a very simple, restricted CSV upload setup with custom title, description, and notes fields. Note that it is in a custom labeled new tab, rather than under the Children tab.
 
post-985-0-05553000-1429545165_thumb.png
 
All the new parent page specific config settings. Note in particular the "Field Pairings" section where you define CSV column numbers to match PW field names.
 
post-985-0-63565900-1429545174_thumb.png
 
 
The only thing I am having some issues with is persistence of some error messages - if you have setup some options that conflict or otherwise cause a specific error to be sent, you may need to save the settings a couple of extra times to make the message go away - not sure if this is a PW bug or what at the moment, but it shouldn't affect functionality.

  • Like 6

Share this post


Link to post
Share on other sites

Another new option added to the dev branch!

The old "Overwrite" edit mode is now called "Replace" and there is a new Overwrite mode that updates the content of fields of existing pages.

An example use case would be to allow editors to periodically upload a CSV file to update certain fields in all child pages while leaving other fields intact. To make this happen you would utilize the Field Pairings option so their import would only edit the specified fields.

  • Like 4

Share this post


Link to post
Share on other sites

An example use case would be to allow editors to periodically upload CSV files to update certain fields in all child pages while leaving other fields intact. To make this happen you would utilize the Field Pairings option so their import would only edit the specified fields.

So I do have to give this a test after all. My current client is working with a master excel list, which is imported to pw and I've used Ryan's importer by now. But the ability to predefine the column to field connection is really nice and easy reimporting to update even more. Would it be possible to have different CSV "schemas"? Maybe later even in a per template notion.

Share this post


Link to post
Share on other sites

So I do have to give this a test after all. My current client is working with a master excel list, which is imported to pw and I've used Ryan's importer by now. But the ability to predefine the column to field connection is really nice and easy reimporting to update even more. Would it be possible to have different CSV "schemas"? Maybe later even in a per template notion.

Current behavior is that you can set general setting for different templates and set own settings on a per page basis.

This module is getting the absolute best solution to handle import CSV data to pages. Even it could be easy prepared to be used by clients without to much headache about posible damage...

I wanna thank you adrian - this evolution of the module is a really big one!

  • Like 1

Share this post


Link to post
Share on other sites

So I do have to give this a test after all. My current client is working with a master excel list, which is imported to pw and I've used Ryan's importer by now. But the ability to predefine the column to field connection is really nice and easy reimporting to update even more. Would it be possible to have different CSV "schemas"? Maybe later even in a per template notion.

@mr-fan has already mentioned this, but to clarify, the Field Pairings option is something that is configured on a page by page basis. You set these for the parent page and then all the children that are created from the import follow the defined rules. So I think this allows for the different CSV schemas you are talking about. I thought about doing it per template, but I actually thought that per page was more flexible and natural because afterall this modules is all about creating and the editing child pages of the current parent. I guess this might be a problem if your parent page's template allows for more than one child template. I don't think I have ever allowed this on any of my PW sites, but I am sure some of you do. This module allows the editor to choose the template for new child pages (if the template family settings allow multiple templates or there are no restrictions at all), so if the demand is there, I should be able to implement something along these lines, but please test the current setup first to see if it already suits your needs.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the clarification. It just looked like a global configuration from the screenshots. Will install the module later today.

  • Like 1

Share this post


Link to post
Share on other sites

For those interested, I just committed another small update that includes a couple of fixes from @LostKobrakai as well as support for not needing to define the "title" field in the field pairings if you only have edit and overwrite mode enabled. This should make it much more flexible when running CSV data imports to update existing pages.

EDIT: Also just changed "Overwrite" edit mode to be called "Update" to better describe what it does and also to avoid confusion with the "Overwrite Names" option.

  • Like 4

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 Macrura
      Field Descriptions Extended
      This module enables you to extend field descriptions by dividing short descriptions with a longer text that is revealed in a toggle.
      Modules Directory: http://modules.processwire.com/modules/field-descriptions-extended/
      Github: https://github.com/outflux3/FieldDescriptionsExtended
      Extending your field descriptions using the standard field's description field.
      Once this module is installed, it will automatically search your description field for the presence of 5 dashes (-----).
      Any content above the 5 dashes will be visible and the content below the dashes will be hidden. A 'More...' link will appear at the end of the short description which when clicked will reveal the rest of the description.
      Using Simple Markdown Editor with the description field
      If you have Simple Markdown Editor (InputfieldSimpleMDE) installed, you can enable the field description to have that editor.
      *When using Simple MDE, you can use the button (Insert Horizontal Line) instead of typing 5 dashes. More about SimpleMDE.
      Extending your field descriptions using content from a ProcessWire Page for the field description.
      You may use the content from a ProcessWire page as a field description. This would allow you to easily insert images, links, and use hanna codes.
      To use page content for your field descriptions, please follow these instructions:
      Install Select Fields module (FieldtypeFields) http://modules.processwire.com/modules/fieldtype-fields/ Create a new field using this field type, e.g. field_select. Add the field to any template you will be using for your field descriptions. Setup your help pages (for example under a settings branch) where you will store the field description content,using the template containing the Field Select. Add content to a page and select the field where that content should show. To show a short text before the link to the longer content, separate them with 5 dashes Be sure to update your settings on this page, first enable page content descriptions,then specify the name of the Select Fields field, template to search, and content field. If you create a field description using this method, please note that the description field must be blank for contexts where you want the page content to appear.
      You can freely use template context for field descriptions, but the Page Content method is not context sensitive and will display under all contexts where the description is blank.
      ----
      original post:
      This is a new module, hope to release soon, which allows extended field descriptions, in currently 2 ways.
      The main feature of the module is that you can have a short description and then a 'more...' link which drops down a longer block of text.
      This is achieved by separating the intro/visible text and the rest with 5 dashes.

      Example setup:

      the 2nd way is if you are using AdminThemeUiKit, you can show extended field instructions in a panel. The content of the panel is edited on a regular PW page. This use case would probably not be that common, but if you had a field that required some extended instructions for how to use, this could be useful; Also, since this allows you to target information and instructions down at the field level, it could reduce the amount of documentation needed on a global level, since it is a lot more context targeted.

    • By Robin S
      Breadcrumb Dropdowns
      Adds dropdown menus of page edit links to the breadcrumbs in Page Edit.

      Installation
      Install the Breadcrumb Dropdowns module. The module requires ProcessWire >= v3.0.83 and AdminThemeUikit.
      There is a checkbox option in the module config that determines if the breadcrumb dropdowns will include pages that the user does not have permission to edit.
      Features/details
      The module adds an additional breadcrumb item at the end for the currently edited page. That's because I think it's more intuitive for the dropdown under each breadcrumb item to show the item's sibling pages rather than the item's child pages. In the dropdown menus the current page and the current page's parents are highlighted in a crimson colour to make it easier to quickly locate them in case you want to edit the next or previous sibling page. If the option to include uneditable pages is selected then those pages are indicated by a reduced text opacity and the "not-allowed" cursor is shown on hover. There is a limit of 25 sibling pages per dropdown for performance reasons and to avoid the dropdown becoming unwieldy. Incompatibilities
      This module replaces the AdminThemeUikit::renderBreadcrumbs method so will potentially be incompatible with other modules that hook the same method.
       
      https://modules.processwire.com/modules/breadcrumb-dropdowns/
      https://github.com/Toutouwai/BreadcrumbDropdowns
    • By joshuag
      Hey guys, 
      Thought I would share a quick preview of Designme. A module we (Eduardo @elabx and I) are building for visually laying out your templates/edit screens. 🙂
      This is a really quick, zero polish screen grab. FYI. 
      Video #2 - UPDATE
      This new video shows the following features in Designme:
      Re-arranging fields via Drag & Drop Re-sizing fields via Dragging. Adjusting field settings - with live refresh. Working on "hidden" fields while Designme is active. Creating New fields. Deleting fields. Creating/Deleting Tabs. Dragging fields between tabs. Creating fieldsets. Tagging/Un-tagging fields. Fields without headers expand when hovered (like checkboxes). Live filtering of fields in the sidebar. Ability to adjust (all) Template settings without leaving Designme. Template File Tree Editing Template files source code with ACE Editor. Editing Multiple files with ACE Editor. (New Tabs) Saving files. Techie stuff Fields load their own js/css dependancies. *ready to use on creation (*most fields)  Everything happens via Ajax to ProcessPageEdit (via module + hooks). Designme has a JS api that you can use.  All actions trigger events.  We would love any detailed feedback on what you see so far. If you are interested in testing Designme. Let me know below. 🙂
       
       
      Video #1. 
       
    • By dreerr
      TemplateEnginePug (formally TemplateEngineJade)
       
      This module adds Pug templates to the TemplateEngineFactory. It uses https://github.com/pug-php/pug to render templates.
      doctype html html(lang='en') head meta(http-equiv='content-type', content='text/html; charset=utf-8') title= $page->title link(rel='stylesheet', type='text/css', href=$config->urls->templates . 'styles/main.css') body include header.pug h1= $page->title if $page->editable() p: a(href=$page->editURL) Edit Project on GitHub: github.com/dreerr/TemplateEnginePug
      Project in modules directory: modules.processwire.com/modules/template-engine-pug/
       
      For common problems/features/questions about the Factory, use the TemplateEngineFactory thread.
       
    • By tpr
      ProcessNetteTester
      Run Nette Tester tests within ProcessWire admin.
      (continued from here)

      Features
      AJAX interface for running Nette Tester tests, in bulk or manually display counter, error message and execution time in a table run all tests at once or launch single tests show formatted test error messages and report PHP syntax errors stop on first failed test (optional) hide passed tests (optional) display failed/total instead passed/total (optional) re-run failed tests only (optional) auto scroll (optional) include or exclude tests based on query parameters start/stop all tests with the spacebar reset one test or all tests (ctrl+click) https://modules.processwire.com/modules/process-nette-tester/
      https://github.com/rolandtoth/ProcessNetteTester