Jump to content
adrian

Batch Child Editor

Recommended Posts

Thanks Adrian, great module!

I'm trying to use it to export users page into csv, but the module doesn't show in "Users" parent page.

Is there a way to make it work?

Glad you like it!

Are you talking about from Access > Users, or Home > Admin > Access > Users ?

The former uses Lister, so I assume you are talking about the latter. If you have ListerPro you can use the export to CSV action from the former. If you don't, then go into the BCE module code and comment out this line:

// don't even consider system templates
if($this->editedPage->template->flags & Template::flagSystem) return;

On the master branch it is line#159 and on dev it is 166.

Let me know if that works for you.

I wouldn't recommend leaving this commented though - I haven't though through it too much, but the Replace mode could cause some major damage pretty quickly :)

Do you need this to be available regularly, or is it a one off need? If you need it regularly I could add any exception for the user page - let me know and we'll work something out.

Share this post


Link to post
Share on other sites

I have bunch of Pages that have

I'm

in their title. BCE doesn't show them correctly, only the "I' is visible under the "TITLE" column. I can add titles correctly and they gets saved (fortunately). I guess it's a bug.

post-3156-0-88262100-1446551581_thumb.pn

Update:

On second save (when title field shows "I" only) the wrong value gets saved.

Share this post


Link to post
Share on other sites

Thanks @adrian

yes i was talking about Home > Admin > Access > Users

Unfortunately i've commented that line, and i can see the Batch Child Editor block in Children Tab, but when i click on export csv nothing happen

And yes i need this to be available regularly to export users.

Thanks for helping.

Share this post


Link to post
Share on other sites

I have bunch of Pages that have

I'm

in their title. BCE doesn't show them correctly, only the "I' is visible under the "TITLE" column. I can add titles correctly and they gets saved (fortunately). I guess it's a bug.

attachicon.gifbce-i-am-bug.png

Update:

On second save (when title field shows "I" only) the wrong value gets saved.

Thanks for reporting @tpr - I have fixed this on the master branch. I have some uncommitted changes to the dev branch at the moment, so the fix won't be on that branch just yet.

  • Like 1

Share this post


Link to post
Share on other sites

Thanks! Just tried and it works fine.

BCE and Migrator saved my *ss today when I needed to migrate 100+ pages, so thanks for these :)

  • Like 1

Share this post


Link to post
Share on other sites

@tpr - glad it works and that Migrator helped to save your *ss too :)
 
 

Thanks @adrian
 
yes i was talking about Home > Admin > Access > Users
 
Unfortunately i've commented that line, and i can see the Batch Child Editor block in Children Tab, but when i click on export csv nothing happen
 
And yes i need this to be available regularly to export users.
 
Thanks for helping.

 
Firstly, I do have a working solution for you, but first a little background :)
 
It is weird that nothing is getting exported - it is definitely exporting a valid CSV file for me. The only problem I am seeing is that I can't control the fields that are exported - it is defaulting to: Set Password, Email Address, Roles
 
The problem is that if you allow the Home > Admin > Access > Users to be separately configurable you should be able to specify the required fields, but the settings don't save, because that page is locked for editing by PW so we are out of luck with that.
 
BUT, here is my working solution, which I think is cleaner than making users navigate to that deep page anyway:

  • Grab the latest master version (there is one critical change to make this work).
  • Create a new page somewhere in the main page tree (not inside the Admin tree) - maybe called "User CSV Export".
  • Make this new page separately configurable in the BCE "Where editing tools are available and separately configurable" settings section.
  • Go to the Settings tab of this new page and configure it to enable Export mode.
  • In the Content / Deletion / Protection section, set the Parent Page to: Home > Admin > Access > Users
  • In the CSV Export Settings, set up the fields to export. You will likely want Name, Email Address, and any custom fields you may have set up.
  • Save settings and then go to where you have BCE displayed (maybe an Inline Fieldset would be a good idea in this case) and click Export.

Works great here, so please test and let me know.

  • Like 2

Share this post


Link to post
Share on other sites

Thanks @adrian .

I'm trying the solution you described. I don't know if I'm doing something wrong but the "Fields to export" select is not showing the user template fields.

I made some screenshot of the setting tab and of the "field to export" select.

The editor is giving me some problem attaching them so here are the links to the screenshots

https://www.dropbox.com/s/16oqik2ann07y40/settings_tab.png?dl=0

https://www.dropbox.com/s/c0h2gvgty27k3uw/Schermata%202015-11-04%20alle%2009.57.46.png?dl=0

Share this post


Link to post
Share on other sites

Ah - sorry - at the moment you will need to check the "User override CSV settings" and then choose the fields to export when going to actually export - does that make sense.

post-985-0-52802100-1446629232_thumb.png

I'll see what I can do about getting the correct fields to also appear in the config settings based on the selected alternate parent page.

Share this post


Link to post
Share on other sites

It seems I have no luck here. I check "Users override CSV settings", then save, but when the page load again "Users override CSV settings" is still unchecked

Share this post


Link to post
Share on other sites

Ok, I just committed a new version (master branch again) that will grab the fields from the selected alternate page (you need to save the page after selecting an alternate parent page to refresh the field list), so you should now be able to set those in  the config settings and not rely on doing it at export. Does this work for you like this?

post-985-0-87894700-1446630925_thumb.png

As for why your override checkbox is not saving, I am completely baffled - do you have debug mode on? Any errors? It looks like all the other settings on that page are saving - correct?

Share this post


Link to post
Share on other sites

Not sure what's about that, but I tried this module and now I get on every page save I see message "Session: Change: status". Took me a while to realize it's BatchChildEditor.

  • Like 1

Share this post


Link to post
Share on other sites

Not sure what's about that, but I tried this module and now I get on every page save I see message "Session: Change: status". Took me a while to realize it's BatchChildEditor.

Thanks for spotting Soma - it seems to come from this code:

            // temporarily put the parent in an unpublished status so that we can check it from
            // the proper context: when page-publish permission exists, a page not not editable
            // if a user doesn't have page-publish permission to it, even though it may still
            // be editable if it was unpublished.
            $parent->addStatus(Page::statusUnpublished);
            $parentEditable = $parent->editable();
            $parent->removeStatus(Page::statusUnpublished);

This is part of a method called getAllowedTemplatesAdd that determines whether the user is allowed to add a template to this parent. It is a modified version of this method: https://github.com/ryancramerdesign/ProcessWire/blob/cffb682836517065d7dd7acf187545a4a80f1769/wire/modules/Process/ProcessPageAdd/ProcessPageAdd.module#L191

I am not sure how to avoid this check. Do you think it is a major concern? I guess it's not ideal that there is a recorded change to a page when saved, even though there are effectively no changes.

Any thoughts?

  • Like 1

Share this post


Link to post
Share on other sites

Why is this needed to change Status and back I don't get it? I don't think it's nice if it's tracked. What if I track changes to my pages? So maybe a trackChange(false) is needed?

Share this post


Link to post
Share on other sites

Just tried a 

$parent->setTrackChanges(false);
$parent->addStatus(Page::statusUnpublished);
$parentEditable = $parent->editable();
$parent->removeStatus(Page::statusUnpublished);
$parent->setTrackChanges(true);
and it wouldn't track it. I think it's something we want to hide from the track change system. What if I'm listening to page changes in my module? :)
 
Edit1: I noticed recently that there's really a lot of such changes going on in PW. Only opening a page editor does change the created_users_id for example. Huh? 
 
Edit2: well I guess it's because I'm tracking every change to page object, so I guess there's maybe some way around it (using page type, template etc, and fields). But still I think such back and forth changing to archive something, those should be hidden from track changing. What you think?
  • Like 1

Share this post


Link to post
Share on other sites

I think that setting TrackChanges to false seems like a great idea - I will happily implement that in BCE - do you want to suggest it to Ryan for the core version of that method?

I noticed recently that there's really a lot of such changes going on in PW. Only opening a page editor does change the created_user_id for example. Huh? 

Just to clarify - this is PW core changes you are talking about and not something caused by BCE - correct?

Share this post


Link to post
Share on other sites

I would suggest it to Ryan see what he thinks.

Sorry, no this is core and not BCE.

  • Like 1

Share this post


Link to post
Share on other sites

I would suggest it to Ryan see what he thinks.

Sorry, no this is core and not BCE.

Great - just committed a new version of BCE (master branch) with those changes - thanks for figuring this out!

  • Like 1

Share this post


Link to post
Share on other sites

Ehrm I'm not sure it's really correct code. :) Just trying to get my head around it. $page->setTrackChanges(false) isn't correct but it may have an effect to clear out changes? Sorry for the confusion.


Lol I'm so stupid, looking at the wrong method in Wire.php, no it's ok I guess. :) Sorry again.

Share this post


Link to post
Share on other sites

Lol I'm so stupid, looking at the wrong method in Wire.php, no it's ok I guess. :) Sorry again.

No problem - it looks like that approach of setting to false, doing something, and then setting to true is used in several places in the PW core. Interestingly, the cheatsheet mentions setting to false, but doesn't show true as an option - maybe just meant to be assumed - weird it doesn't show:

$a->setTrackChanges(true|false)

That would be consistent with others.

Share this post


Link to post
Share on other sites

I was about to change it on cheatsheet. But now it's because it's only a set and default is ON. Hence there's two entries in cheatsheet and not (true|false).


So a 

$parent->setTrackChanges(false);

...

$parent->setTrackChanges();

would be sufficient.

  • Like 1

Share this post


Link to post
Share on other sites

Just wanted to let you guys know that I have committed some changes over the last couple of days that brings complete live updating of child page details (name, template, hidden status, unpublished status, and removal of a row if deleted) in the edit mode table after making edits to a specific page in a modal popup.

It might not seem like much, but it makes this mode much more functional and intuitive.

Please let me know if you notice any problems.

  • Like 4

Share this post


Link to post
Share on other sites

Are admin pages disabled by default? I have a few pages under the Admin branch (form submissions) and BCE doesn't seem to be present there. Is there a way to allow it there?

(using devns 3.0.5)

Share this post


Link to post
Share on other sites

Are admin pages disabled by default? I have a few pages under the Admin branch (form submissions) and BCE doesn't seem to be present there. Is there a way to allow it there?

(using devns 3.0.5)

Yes they are disabled by default, but I just added a new option under Content / Deletion / Protection to enable BCE editing of the Admin page branch.

Obviously this has the potential to completely break a PW install so use carefully at your own risk :)

Share this post


Link to post
Share on other sites

Hi Adrian!

When I mark children page for delete and then Save the page, I get errors (see attachment). The page itself (http://localhost/processwire/page/edit/?id=1) returns " The process returned no content." Could it be my fault (playing around...)? No problem with editing and adding pages.

Thanks for the report and sorry about that - looks like I introduced a bug in my commits from yesterday. Should be fixed now in the latest version. Please let me know if you still have any problems.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      I am happy to present my new fieldtype FieldtypeImageFromPage. It is made up of 2 modules:
      Fieldtype Image Reference From Another Page is a Fieldtype that stores a reference to a single image from another page. The image can be selected with the associated Inputfield.
      Inputfield Select Image From Page is an Inputfield to select a single image from images on a predefined page and it's children.
      And there also is a helper module that takes care of cleanup tasks.
      This module evolved out of a discussion about my other Module FieldtypeImagePicker.  It caters for use cases where a set of images is being reused multiple times across a site. With this fieldtype these images can be administered through a chosen page. All images uploaded to that page will be available in the inputfield.
      When to use ?
      Let editors choose an image from a set of images that is being used site-wide. Ideal for images that are being re-used across the site.
      Suited for images that are used on multiple pages throughout the site (e.g. icons).
      Other than the native ProcessWire images field, the images here are not stored per page. Only references to images on another page are stored. This has several advantages:
      one central place to organize images when images change, you only have to update them in one place. All references will be updated, too. (Provided the name of the image that has changed stays the same) Features
      Images can be manipulated like native ProcessWire images (resizing, cropping etc.) Image names are fully searchable through the API Accidental image deletion is prevented. When you want to delete an image from one of the pages that hold your site-wide images, the module searches all pages that use that image. If any page contains a reference to the image you are trying to delete, deletion will be prevented. You will get an error message to help you edit those pages and remove references there before you can finally delete the image. How to install and setup
      Download and install this module like any other modules in ProcessWire Create a page in the page tree that will hold your images. This page's template must have an images field Upload some images to the page you created in step 2 Create a new field. As type choose 'Image Reference From Another Page'. Save the field. In 'Details' Tab of the field choose the page you created in step 2 Click Save button Choose the images field name for the field that holds your images (on page template from step 2) Click Save button again Choose whether you want to include child pages of page from step 2 to supply images Add the field to any template You are now ready to use the field View of the inputfield on the page edit screen:

      View of the field settings

      The module can be installed from this github repo. Some more info in the README there, too.
      In my tests it was fairly stable. After receiving your valued feedback, I will eventually add it to the modules directory.
      My ideas for further improvement:
      - add ajax loading of thumbnails
      Happy to hear your feedback!
       
    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
×
×
  • Create New...