Jump to content
adrian

Batch Child Editor

Recommended Posts

Upon a re-import of data (generated originally from BCE's export as csv feature), BCE appears to be treating the related field as type TINYTEXT (limiting to 255 characters), even though the field is defined as type MEDIUMTEXT  (collation: utf8_general_ci).

I've tested this a number of times.   Full paragraphs (i.e. greater than 1000 characters) that I copy into the field's textbox (using page edit) and then save, end up being cut off to 255 characters over and over upon a re-import of data.   Checked CSV and it contains the full paragraph.

Any idea as to why the predefined type is changing upon CSV import?

Share this post


Link to post
Share on other sites

Can this module be used to export pages, add translations for content, and import them?

We have this huge website (over 7000 pages). We've used TextLanguage and TextAreaLanguage fields for all textual fields, and all image and file fields have their own description input boxes for different languages too.

Now we'd need to export all pages and send them to our translator so they can translate all site contents with their specialized programs, and a way to import the translations back to our site alongside the content in original language. Is this possible with BCE?

I've tried to export site contents, but can't figure out a way to include image/file descriptions, or any textual field's contents in other language(s).

This module has already been a huge help when initially building this site in question. We created most of the pages with Ryan's Import Pages from CSV module, and were able to modify them in batches with BCE quite a few times during further development. Massive time savings!

Share this post


Link to post
Share on other sites

Hi!

I'm on 'PW' 3.0.21 with 'BCE' 1.3.0.

As for me 'BCE' in 'Export mode' doesn't shows 'AsmSelect' field to adjust children fields to be exported, as shown in your topic.

So according to the module description I must have

Screen Shot 2015-05-26 at 12.17.17 PM.png

but only get

post-4381-0-75231900-1465646226_thumb.jp

I've also tried to install 'Select Options' fieldtype core module, that enables 'AsmSelect ' fields to be used in templates, but nothing had changed.

Despite of mentioned above, an API exporting still works well.

Share this post


Link to post
Share on other sites

@tkaranka - multi-language is not currently possible, but we do have some functionality for multiple value fields which could be extended to support multilanguage - the catch is that I am not a ML user myself so I am not terribly familiar with it, although I would love to see BCE support it at some point. Either way I am glad it's been a big timesaver for you.

@feniks502 - 

Quote
As for me 'BCE' in 'Export mode' doesn't shows 'AsmSelect' field to adjust children fields to be exported, as shown in your topic.

This option is only available if you define separately configurable pages:

Screen Shot 2016-06-11 at 8.13.49 AM.png

and then you check this on the Settings tab of the page(s) selected above:

Screen Shot 2016-06-11 at 8.15.03 AM.png

But this is only necessary if you them to be able to select the fields to export. You can also define them yourself on the Settings tab of the page, here:

Screen Shot 2016-06-11 at 8.16.06 AM.png

Please let me know if it makes sense now!

Share this post


Link to post
Share on other sites

When creating a bunch of children via CSV the pages aren't active in the alternative languages. Just caught me. 

  • Like 1

Share this post


Link to post
Share on other sites
12 minutes ago, Soma said:

When creating a bunch of children via CSV the pages aren't active in the alternative languages. Just caught me. 

Thanks for the report soma - I really have played with ML much at all - can you give me a quick rundown of what BCE needs to do to make this work as needed?

Share this post


Link to post
Share on other sites

You mean you haven't? Shame on you really!

Well you check for $languages more than 1 and then cycle each and set "status[langid]" to 1. 

  • Like 1

Share this post


Link to post
Share on other sites
Just now, Soma said:

You mean you haven't? Shame on you really!

Well you check for $languages more than 1 and then cycle each and set "status[langid]" to 1. 

True - see I can't even get my only language correct :)

I have played a little with it, but never had a need to actually use it so just wanted clarification from you to save me a little time.

  • Like 3

Share this post


Link to post
Share on other sites

Hi @adrian,

I'm currently trying this module to import my news from my old website to PW (3.0.28). I have 2 questions:

  1. Do I'm suppose to be able to import html? All <h>, <p>, etc are lost when I import. Either by copy-paste the text or using a CSV file. I tried different ways to escape but didn't get it. I also deactivate HTML purifier and some other stuff in input tab of my body field.
  2. I have some glitchs with CSV export in images or files field. I created a mockup page (values were just the title of the field). You will see that in images/files, the content of body is copied. However, if images/files are filled, they export correctly.

Thanks!!

Mel

PS I didn't try yet multilanguages, I hope it works!! ;-)

news.csv

Share this post


Link to post
Share on other sites

Thanks adrian for this excellent module! I used it a lot in my projects.

Recently I upgraded my php version to 7 and found that the Add method and Update method for csv import(both by using textarea and files) failed. Only the title can be saved successfully but not other fields when I am using the Add method. However, I cannot confirm if it is the issue raised from the php upgrade. Just wonder anyone can use this module with php7?

I tried upgrade PW and reinstall the module but no luck. Thanks for reading.

Share this post


Link to post
Share on other sites

Let me reply the above issue by myself.

I have tried using this module with freshly installed php7 and php5.64 xampp. The result is that the Add and Update function using csv is not working in php7 but php5.64. However I am not smart enough to figure out why is this happening. I hope this information is useful to somebody. 

Share this post


Link to post
Share on other sites

Hi @Karl_T and @mel47 - I am very sorry for the lack of response here. I have been low on time lately and spending most of it on TracyDebugger.

@mel47  - I'll look into the html tags being lost on import - any chance you could PM me the file you are trying to import?

@Karl_T - I know what the issues will be - just need to set myself up with a PHP7 testing environment and track them all down.

I'll see what I can do about getting both of these taken care of this week.

Thanks for your patience.

  • Like 3

Share this post


Link to post
Share on other sites

@Karl_T - I think your PHP7 issues should be fixed with the latest version. Please let me know if you find anything else amiss.

@mel47 - any chance of that test file that you are trying to import?

  • Like 2

Share this post


Link to post
Share on other sites
On 7/25/2016 at 8:02 AM, Soma said:

When creating a bunch of children via CSV the pages aren't active in the alternative languages. Just caught me. 

Sorry for the crazy delay on this @Soma but I think it should now all work as expected.

Would there be any reason to make this a config option? Would anyone not want new pages to be automatically activated? Could it be a module-wide setting, or would it need to be part of the interface where the new pages are added?

Share this post


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

would it need to be part of the interface where the new pages are added?

I think that it is the best option

  • Like 1

Share this post


Link to post
Share on other sites
Just now, Zeka said:

I think that it is the best option

So to clarify, there are time when you wouldn't want newly added pages automatically activated in all other languages? (Sorry not a ML user so not sure how most people work). Do you think it should be checked or unchecked by default?

@mel47 - I took a look at the html tag issue - was a very easy fix (just committed) - sorry I hadn't come across this before. I was sanitizing as "text" - now I am using the "purify" sanitizer - hopefully that will work for everyone in all scenarios, but if anyone notices a problem, please let me know.

 

  • Like 1

Share this post


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

So to clarify, there are time when you wouldn't want newly added pages automatically activated in all other languages? (Sorry not a ML user so not sure how most people work). Do you think it should be checked or unchecked by default?

Yes, you are right. Very often only few pages have translation to all languages. ( Ukraine is not english speaking country and almost all blogs have only about 10% of posts translated to other languages ). 
It should be checked by default, IMHO.

  • Like 1

Share this post


Link to post
Share on other sites

An option when creating would be nice option. It's not always content pages bit also pages as categories etc. Maybe even some field in csv could be used to do it on a per entry basis. I would go for something like this. In the case of such a feature the more option to do such things the better.

  • Like 1

Share this post


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

Yes, you are right. Very often only few pages have translation to all languages. ( Ukraine is not english speaking country and almost all blogs have only about 10% of posts translated to other languages ). 
It should be checked by default, IMHO.

 

Ok, I have added the checkbox:

Screen Shot 2016-09-06 at 12.02.23 PM.png

4 minutes ago, Soma said:

Maybe even some field in csv could be used to do it on a per entry basis.

Not sure how best to implement this cleanly. If it was a simple matter of checking if there was an additional field at the end of the row that was 1 or 0, that would be ok I guess, but with the CSV field pairing functionality and it's checks, I think it is going to start to get a bit messy, but if you think it would be really worthwhile, let me know and maybe I'll revisit it.

  • Like 2

Share this post


Link to post
Share on other sites

Of course you're right. I think it would be possible but maybe little messy. I'm not into this module much (used it once), but maybe on the child editor some feature for setting the active languages via checkboxes would be a better way?

Share this post


Link to post
Share on other sites
1 minute ago, Soma said:

but maybe on the child editor some feature for setting the active languages via checkboxes would be a better way?

Sounds useful, but I'll wait and see if there is demand. I don't honestly know how many people are using this module anyway, let alone with ML setups.

Share this post


Link to post
Share on other sites

The latest version now uses a proper csv parser, not php's str_getcsv so now it supports line breaks within csv "fields". This should deal with the problem that @elabx reported earlier this year - sorry it's been so long coming.

I'd love to hear how this new parser works out for everyone's CSV importing needs. If it seems good, then I will also start using it in my Table CSV Import/Export module: http://modules.processwire.com/modules/table-csv-import-export/

Thanks for any feedback.

Does anyone else have anything outstanding that needs fixing?

  • Like 3

Share this post


Link to post
Share on other sites

Hi Adrian, thank you so much for the work you put into this module! It's really making life a lot easier.

I've read through this thread and seen that you considered setting the CSV field pairings per template rather than per page. Could you re-consider this option, or point me into the right direction of what I need to tweak to use the module this way? Alternatively it'd already be really helpful if it weren't necessary to add each configurable page separately, but to allow all children, grandchildren etc. of a page to be configurable too.

Since that probably helps understanding my issue, here's a little background: I work with a nested page structure in which the parent (A) has a number of children (B) which I'd like to import. Each of these children (B) will have between, on average, one and ten child elements (C), each of which again has at least one child. The current module settings would require me to add each of the children (B) and grandchildren (C) separately to the list of configurable pages in the module settings. Which also means my colleagues - who're not superusers - cannot import anything but the children on the first level (A) on their own, as they have no access to the module configuration and the settings tab, and B and C are only created with the imports.

(The easiest solution of course would be to import the pages without field pairings. However, that failed on my local testing environment every way I tried it. Even if the fields were all present in the CSV, and in the same order as in the template settings, the title field never imported correctly.)

Share this post


Link to post
Share on other sites

Hi @Naz - glad you like the module and welcome to the forums.

I can totally understand the issue you are having with the way I have the configuration set up. Ideally having it by template would also be useful - unfortunately I don't think it will be a simple change so I am wondering if we can figure out why you are needing the field pairing to be set up if you have matching numbers of fields in the CSV file.

Are you using the latest version of BCE? Could you perhaps send me a test CSV file to work from?

Share this post


Link to post
Share on other sites

@adrian sorry for the delay. I finally was able to test it, and it rocks! html tags are now imported correctly. I still have difficulties with export : when some fields (images or files) are empty, the content of body field is replicated.

Concerning multilanguage, could you give an hint of how to use it? Do I can import in 2 languages at the same time? Anyway, I discovered a workaround couple weeks ago. If I changed default language, I could import in this language. So I will do 2 imports, which is not so bad, considering I planned to used it only once to migrate my website content.

Thanks

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 eelkenet
      Hi! I've created a small Inputfield module called InputfieldFloatRange which allows you to use an HTML5 <input type="range" ../> slider as an InputField. I needed something like this for a project where the client needs to be able to tweak this value more based on 'a feeling' than just entering a boring old number. Maybe more people can use this so I'm hereby releasing it into the wild.  
       
      What is it?
      The missing range slider Inputfield for Processwire. 
      What does it do?
      This module extends InputfieldFloat and allows you to use HTML5 range sliders for number fields in your templates.
      It includes a visible and editable value field, to override/tweak the value if required.  
      Features
      Min/max values Precision (number of decimals) Steps (Read more) Manual override of the selected value (will still adhere to the rules above) Usage
      Clone / zip repo Install FieldtypeFloatRange, this automatically installs the Inputfield Create new field of type `Float (range)` or convert an existing `Float`, `Integer` or `Text` field. To render the field's value simply echo `$page->field` Demo
      A field with Min=0, Max=1, Step=0.2, Precision=2

      Field with settings Min=0, Max=200, Step=0.25, Precision=2

       
      Todo
      Make the display-field's size configurable (will use the Input Size field setting)  Hopefully become redundant If it's usable for others I'll add it to the Modules list  
      Changelog
      v002
      - Fix issue where setting the step value to an empty value created problem with validation
      - Make the display-field optional 
      v001
      - Initial release
       
      Thanks!
       
       
    • By Robin S
      Another little admin helper module...
      Template Field Widths
      Adds a "Field widths" field to Edit Template that allows you to quickly set the widths of inputfields in the template.

      Why?
      When setting up a new template or trying out different field layouts I find it a bit slow and tedious to have to open each field individually in a modal just to set the width. This module speeds up the process.
      Installation
      Install the Template Field Widths module.
      Config options
      You can set the default presentation of the "Field widths" field to collapsed or open. Field widths entered into the Template Field Widths inputfield are only applied if the Edit Template form is submitted with the Template Field Widths inputfield in an opened state. "Collapsed" is the recommended setting if you think you might also use core inputs for setting field widths in a template context. You can choose Name or Label as the primary identifier shown for the field. The unchosen alternative will become the title attribute shown on hover. You can choose to show the original field width next to the template context field width.  
      https://github.com/Toutouwai/TemplateFieldWidths
      https://modules.processwire.com/modules/template-field-widths/
    • By adrian
      Tracy Debugger for ProcessWire
      The ultimate “swiss army knife” debugging and development tool for the ProcessWire CMF/CMS

       
      Integrates and extends Nette's Tracy debugging tool and adds 35+ custom tools designed for effective ProcessWire debugging and lightning fast development
      The most comprehensive set of instructions and examples is available at: https://adrianbj.github.io/TracyDebugger
      Modules Directory: http://modules.processwire.com/modules/tracy-debugger/
      Github: https://github.com/adrianbj/TracyDebugger
      A big thanks to @tpr for introducing me to Tracy and for the idea for this module and for significant feedback, testing, and feature suggestions.
    • By adrian
      This module allows you to automatically rename file (including image) uploads according to a configurable format
      This module lets you define as many rules as you need to determine how uploaded files will be named and you can have different rules for different pages, templates, fields, and file extensions, or one rule for all uploads. Renaming works for files uploaded via the admin interface and also via the API, including images added from remote URLs.   Github: https://github.com/adrianbj/CustomUploadNames
      Modules Directory: http://modules.processwire.com/modules/process-custom-upload-names/
      Renaming Rules
      The module config allows you to set an unlimited number of Rename Rules. You can define rules to specific fields, templates, pages, and file extensions. If a rule option is left blank, the rule with be applied to all fields/templates/pages/extensions. Leave Filename Format blank to prevent renaming for a specific field/template/page combo, overriding a more general rule. Rules are processed in order, so put more specific rules before more general ones. You can drag to change the order of rules as needed. The following variables can be used in the filename format: $page, $template, $field, and $file. For some of these (eg. $field->description), if they haven't been filled out and saved prior to uploading the image, renaming won't occur on upload, but will happen on page save (could be an issue if image has already been inserted into RTE/HTML field before page save). Some examples: $page->title mysite-{$template->name}-images $field->label $file->description {$page->name}-{$file->filesize}-kb prefix-[Y-m-d_H-i-s]-suffix (anything inside square brackets is is considered to be a PHP date format for the current date/time) randstring[n] (where n is the number of characters you want in the string) ### (custom number mask, eg. 001 if more than one image with same name on a page. This is an enhanced version of the automatic addition of numbers if required) If 'Rename on Save' is checked files will be renamed again each time a page is saved (admin or front-end via API). WARNING: this setting will break any direct links to the old filename, which is particularly relevant for images inserted into RTE/HTML fields. The Filename Format can be defined using plain text and PW $page variable, for example: mysite-{$page->path} You can preserve the uploaded filename for certain rules. This will allow you to set a general renaming rule for your entire site, but then add a rule for a specific page/template/field that does not rename the uploaded file. Just simply build the rule, but leave the Filename Format field empty. You can specify an optional character limit (to nearest whole word) for the length of the filename - useful if you are using $page->path, $path->name etc and have very long page names - eg. news articles, publication titles etc. NOTE - if you are using ProcessWire's webp features, be sure to use the useSrcExt because if you have jpg and png files on the same page and your rename rules result in the same name, you need to maintain the src extension so they are kept as separate files.
      $config->webpOptions = array(     'useSrcExt' => false, // Use source file extension in webp filename? (file.jpg.webp rather than file.webp) ); Acknowledgments
      The module config settings make use of code from Pete's EmailToPage module and the renaming function is based on this code from Ryan: http://processwire.com/talk/topic/3299-ability-to-define-convention-for-image-and-file-upload-names/?p=32623 (also see this post for his thoughts on file renaming and why it is the lazy way out - worth a read before deciding to use this module). 
       
       
      NOTE:
      This should not be needed on most sites, but I work with lots of sites that host PDFs and photos/vectors that are available for download and I have always renamed the files on upload because clients will often upload files with horrible meaningless filenames like:
      Final ReportV6 web version for John Feb 23.PDF

×
×
  • Create New...