Jump to content
adrian

Batch Child Editor

Recommended Posts

After test importing hundreds of pages in the last days I think BCE is a real time saver! Good job Adrian!

I still struggle with one feature though... since I have a lot of ProField Textareas to import to I have to use field pairings which works great, even with images, but the only location to configure field pairings are the parent pages.

This means I have to add each and every parent page to "Configurable Pages" in BCE settings. I can work with that but wouldn't make it more sense to make it template related? Since the template defines the fields to use then field pairings would be unique to a template?

I think I read something about this before in this thread but cannot find it anymore...

Share this post


Link to post
Share on other sites
On 16.11.2016 at 1:02 AM, adrian said:

Ok, the new version supports adding files and images. It works in both standard and field pairings modes. I haven't added support for descriptions/tags yet - will wait to see if anyone has the need.

It should work for local server paths to files/images, as well as remote urls.

Please test and let me know if you have any problems. 

While importing one image per field works fine I seem to be unable to import multiple images to an image field. The image field has no special setting and importing just one image works. 

I have tried with different separators(#, ##, \r, |) but to no avail. Strange, because this week I imported multiple values to an option field with no problems.

Did I miss something?

BCE 1.4.9 on PW 2.8.35 3.0.39

Edited by Klenkes
PW version change

Share this post


Link to post
Share on other sites

just asking... could it be that it is not yet supported to import multiple images(separated with a delimiter) to an image field?

I went through the module code(not that I understand a lot of it but getting better) and couldn't find any reference to importing multiple images.

Share this post


Link to post
Share on other sites

Hi @mel47 and @Klenkes - sorry for the delay in dealing with your issues. I have implemented some fixes, but things are not well tested yet, so I am just going to attach the updated version to this post.

On 12/7/2016 at 7:26 PM, mel47 said:

Again me... I have a problem I couldn't understand. I created my CSV file with " " in each column :

"Article in Metabolic Brain Disease-Bosoi-2009";;"Accepted article";"Publication";2008-12-29 18:12:48;;"<p>Latest paper was published in Metab Brain Disease</p>";"<p>Latest paper was published online December 23<sup>rd</sup>.</p>";;;"Bosoi et al.-2009-MetabBrainDis"

The last field is Page. Everything imports fine (no error), but last field is imported as

Bosoi et al.-2009-MetabBrainDis"

Why it keeps this extra " ?

Thanks

Melanie

@mel47 - can you please test the attached version and let me know if it fixes it. I inadvertently deleted my line ending fix in a recent commit. It has been reinstated so hopefully that will take care of this for you.

 

On 12/8/2016 at 1:01 AM, Klenkes said:

After test importing hundreds of pages in the last days I think BCE is a real time saver! Good job Adrian!

I still struggle with one feature though... since I have a lot of ProField Textareas to import to I have to use field pairings which works great, even with images, but the only location to configure field pairings are the parent pages.

This means I have to add each and every parent page to "Configurable Pages" in BCE settings. I can work with that but wouldn't make it more sense to make it template related? Since the template defines the fields to use then field pairings would be unique to a template?

I think I read something about this before in this thread but cannot find it anymore...

@Klenkes - I am not against this idea because I can understand the problems you are having. Unfortunately I think that would be a huge change to the module. I'll definitely think about it, but I can't promise a timely resolution for this I'm afraid - hope you understand!

 

On 12/19/2016 at 2:51 AM, Klenkes said:

just asking... could it be that it is not yet supported to import multiple images(separated with a delimiter) to an image field?

I went through the module code(not that I understand a lot of it but getting better) and couldn't find any reference to importing multiple images.

Yeah you were right - I never implemented the multiple values separator logic for files/images. The attached version should take care of this. I have tested with field pairings, but not without at the moment. Please let me know how it goes for you.

 

 

Edited by adrian
Removed attached version because it's now on Github
  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, adrian said:

 

@mel47 - can you please test the attached version and let me know if it fixes it. I inadvertently deleted my line ending fix in a recent commit. It has been reinstated so hopefully that will take care of this for you.
BatchChildEditor.zip

Perfect! Works as expecting when CSV is pasted.

Thanks again!

  • Like 1

Share this post


Link to post
Share on other sites
On 21.12.2016 at 2:43 AM, adrian said:

Yeah you were right - I never implemented the multiple values separator logic for files/images. The attached version should take care of this. I have tested with field pairings, but not without at the moment. Please let me know how it goes for you.

Ahhh...  new module name: ImportingMadeEasy! Absolutely great!
I tested with field pairing and it works without any flaws.

And no rush with the  "Configurable Pages" issue, or even if it is no doable. The way BCE now works is absolutely great and I can plan to migrate a few websites to PW.

Many thanks and have a great christmas holiday.

  • Like 2

Share this post


Link to post
Share on other sites

Hey all

This module works great. But, I do have one problem. I need to export most of the data on the website to a csv, but the site is in multiple languages available. And I need all the available languages in the same csv. Is there any option to fix this in the module or are there plans for this module to add an export option for multiple languages?

-Edit-

The website I currently use is build like this:

  • Products
    • Category
      • Product
      • Product
      • Etc...
    • Category
    • Etc.

Is it possible to export a csv file containing all the categories together with the products? Something like pages and sub-pages...

 

Thanks in advance,

 

Harmen

Share this post


Link to post
Share on other sites
6 hours ago, Harmen said:

And I need all the available languages in the same csv.

Hi @Harmen - how do you envision all the languages being formatted in the CSV - using a "|" or some other separator, or do you have some other approach in mind?

 

6 hours ago, Harmen said:

Is it possible to export a csv file containing all the categories together with the products? Something like pages and sub-pages...

Currently BCE only supports direct children of a page. I am not sure how to come up with a standardized approach for handling sub-pages/grandchildren in CSV format. Perhaps if you could explain (or provide an example) of how you'd like the CSV to look I could implement it, or you could provide a PR :)

  • Like 3

Share this post


Link to post
Share on other sites

Some of my thoughts but I really don't know if it's feasible or too much error-prone.

For sub-levels:

Having a new field (in the CSV): sub-levels. I discovered this approach in the Menu Builder module. However, since this field doesn't exist in template, it could be confusing if we forget to add it when add or replace data.

For multi-language:

According to me, it shouldn't use | since they are already use for many images/pages. Furthermore, I used CSV in Excel to fill quickly in column format, so I need different CSV fields. I guess the best option is having for example: body_en;body_fr. But I'm not sure how to order the CSV since there is maybe non-multi-language fieldtypes in the template. And/or, since not applicable to CSV import-export, to add data, it could be a multilanguage area (it used when you edit a ML option's fieldtypes).


But I have no idea how those things works, so I let you decide how good they are...

  • Like 1

Share this post


Link to post
Share on other sites

Hey @adrian

Thanks for your reply. I've asked my contractor how the csv file must be classified. He gave me an example which you can see in the attachment.

There is one product in the attachment, but the same needs to happen for all products and categories. Languages are seperated per column. Each product in a row, Same for categories. I hope this helps you, I will also think for a solution in the code of the module altough I don't have that much experience with exports to csv formats.

Note: With my 18 yrs I expect you're way better than me, but I will give it a try to think about it ;)

 

-Edit-

I wrote a module to get the categories and products (and more stuff) from the prestashop database and import the data in Processwire. What would be easier, write another piece of code in my module/or new module to get the data out of the database and directly import it to a csv file, or just make a csv file from the data in the Processwire fields?

 

Sorry for so many questions, still a bit newbie here I guess :D

example.xlsx

Edited by Harmen
Additional information
  • Like 1

Share this post


Link to post
Share on other sites

@adrian

Found a way to get the grandchildren into the csv file. You can find my code in the attachment. But I don't get all the data from the fields like image links and more. Maybe I've missed something? I guess it doens't get all the data, because the labels are different for the categories and products

-Still searching for multiple language-

 

ProcessChildrenCsvExport.module

Share this post


Link to post
Share on other sites

Hi Harmen,

Sorry it's taken me a while to respond to your post. I took a quick look at the code you added and I think all that logic needs to end up in a function that we can call for children and then again for grandchildren, rather than duplicating.

I am honestly wondering if this is a good fit for BCE because I am not sure that everyone will want the same formatting for grandchildren, although honestly I don't know how it looks yet, but grandchildren can have different templates/fields which would surely make a mess in a CSV?

I wonder if you'd be better off with something like a custom implementation using PHPExcel (https://github.com/PHPOffice/PHPExcel).

I do however agree with adding options for multilanguage support for exports. I don't expect this should be too difficult if we take the approach of a separate column for each language version of each field. 

Cheers,
Adrian

  • Like 1

Share this post


Link to post
Share on other sites

Hi Adrian,

No worries, it's ok. Good idea, functions are always good to use, less code easier to call.

I understand not everyone wants the same. Maybe an inputfield with radio buttons at the module info to check if they want to export the grandchildren too can fix it. You're right. It would be a mess, even my grandchildren pages don't have the same name as the fields of the child pages while the fields have the same type.

I will take a look at PHPExcel next week.

If you need any help during the development of multiple languages - message me ;) I will also search for a solution.

Regards,

Harmen

  • Like 1

Share this post


Link to post
Share on other sites

I am using this on one of my sites to export csv via the api and it all works fine except I am getting some spurious code at the start of each csv file - i.e:

<script>
var config = {"urls":{"root":"\/pw\/"

</script>

Can anyone help with where this might be coming from, I've done a search everywhere I can think of and can't find it.

Many thanks

Share this post


Link to post
Share on other sites

@Hantsweb - can you narrow it down to a certain branch of the page tree or does it happen everywhere on your site?

What version of PW? What version of this module?

What other modules do you have installed?

Share this post


Link to post
Share on other sites

On a multilanguage install if pages doesn't have the title filled for the user's language, BCE shows the title on the default language. This is good, but can be misleading because one can think that the title is filled but actually it's empty.

I could imagine a solution to notify the user about it, eg. like this:

bce-default-title.png

Perhaps there's a better solution, this was the first that came to me.

Share this post


Link to post
Share on other sites

@Hantsweb - any chance you have the SessionHandlerDB module installed?

@tpr - I wonder if in reality this should come under an overhaul for BCE to add multi-language support in general - maybe the edit interface needs tabs to make it possible to edit titles in all languages? Trouble is that I am really going to start running out of time for major module changes here. Anyone up for putting together a PR?

 

Share this post


Link to post
Share on other sites

I think a comprehensive multi-language support would be a really complex task. This tweak would require only adding an extra tag if the title is not in the current language.

Share this post


Link to post
Share on other sites

I think what @tpr says is right, I guess it could be super complex. 

I am also still a newbie in Processwire and don't know that much about programming as tpr, adrian etc etc

I am always available if anyone needs some help. In a few weeks my internship is over and school starts again for me, hoping to have time left then for PW...

  • Like 1

Share this post


Link to post
Share on other sites

@tpr  - it's implemented, although a little differently because I didn't want "default" taking up so much space in the input. I went with a warning icon and outside of the input so I could add a title tag to it.

I am checking if the "FieldtypePageTitleLanguage" module is installed before checking if there is a title in the user's language. Maybe one of the ML gurus can tell me if there is a better approach:

$this->modules->isInstalled("FieldtypePageTitleLanguage") && !$cp->title->getLanguageValue($this->user->language)

Let me know if this suits your needs.

Screen Shot 2017-01-10 at 4.34.49 PM.png

  • Like 2

Share this post


Link to post
Share on other sites

Thanks, working fine here. As for the snippet I think it's OK too. I usually check for multilanguage with something like this though I'm not sure it's a better approach.

if ($this->languages && $this->pages->find('template=language, check_access=0')->count() > 0)

 

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, tpr said:

Thanks, working fine here. As for the snippet I think it's OK too. I usually check for multilanguage with something like this though I'm not sure it's a better approach.


if ($this->languages && $this->pages->find('template=language, check_access=0')->count() > 0)

 

Thanks - I ended up changing a little anyway. I went with:

$titleMultiLanguage = $this->modules->isInstalled("FieldtypePageTitleLanguage") && $this->fields->get('title')->type == 'FieldtypePageTitleLanguage';

because I figured in this case we need to be sure that the "title" field type is actually set to "FieldtypePageTitleLanguage" or we'll get a non object error when I try to use getLanguageValue() on it. Sound ok?

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...