Jump to content
adrian

Batch Child Editor

Recommended Posts

Pleased to say I found the solution to my problem - in the end it wasn't an issue with this module, it was some other code that I had on my site which was echoing to the output stream.  I have now removed that errant code and all is now fine.

 

  • Like 1

Share this post


Link to post
Share on other sites

Hi,

My page template contains fields of type pagefield (among other fields).
When adding or updating pages, I use blank values for these page fields.
The CSV looks something like this:

title,contentTextarea,filterA,filterB
First page title,"<p>Text</p>",,
Second page title,"<p>Text</p>",,

Now BCE/PW generates a new page as a child of the page that is defined as the parent of the pages that are selectable through the page field. Or simpler: adding/updating results in one new filter inside of both filter groups. The new pages have an empty title field.

What value do I have to enter for the page fields in the csv to not select a page (filter) and to not generate new pages (filters)?

  • Like 1

Share this post


Link to post
Share on other sites

I'm working on a setup with no title fields. It was quite easy to edit "Import Pages From CSV" module to accept import data without titles. However, the module messes up the data->field pairings when using Tab separated data (I will report it later).

I would like to try Batch Child Editor to import my data, but it is not as obvious how to tweak it so titles are not required. I mean how to deal with the page naming after commenting out the if(!in_array('title' block starting from line 249. Page names as IDs would be fine, but what is the most straightforward way to achieve it?

Thanks.

Edit: urgh.. apparently I was wrong with "Import Pages From CSV" messing up the field pairings. I don't understand why I cannot reproduce the problem anymore. The only thing I can think of is I was in somehow dyslexic mode when staring at the data.

Share this post


Link to post
Share on other sites

@Beluga - it sounds like you sorted out your problem with the Import Pages From CSV module, but if you decide to come back to BCE let me know and I'll see what I can do about adding support for no title pages.

Share this post


Link to post
Share on other sites

Thanks :) I am using BCE anyways, even though not for this particular corner case.

One thing that would be interesting to hear is performance on import of large amounts of CSV data compared with Ryan's module. I am getting massive execution times on a local environment, hours, for a set with 16 columns and 35k rows (I have not yet done a successful import). I looked at these types of answers: http://stackoverflow.com/a/3908669 and tuned my MySQL settings, but I guess PW's page creation strategy should match..

Share this post


Link to post
Share on other sites

@Beluga - are those massive execution times with BCE or Ryan's module? I am using a third party csv parser - I don't think its approach is very efficient, but php's built-in parser is crap when it comes to certain situations. There might be better options out there though. BCE doesn't make any SQL queries directly so not sure any of those mentioned tweaks would be any use. Also given that in PW each field has its own table I don't know how you could make use of LOAD DATA INFILE etc because you'd have to do a lot of data manipulation before inserting so that you were populating one table at a time with all required data - sounds like a real likelyhood of introducing data integrity problems. That said, if you find something that makes a dramatic difference, please let us know.

Share this post


Link to post
Share on other sites

It is in Ryan's module. I guess I could later share the file (+ exported PW fields) for testing as the data will be completely public anyways (and even is now in an older site).

Share this post


Link to post
Share on other sites

@adrian

On a multilanguage site, loading the Children tab (BCE) shows the titles for the default language if there are no title set for the current language which is fine. But if I save the page, even without any editing, these default titles are saved to the DB (for the non-default language). This happens only after navigating to the Children tab.

From a user/editor POV I regard this as a bug, do you think there's an easy fix? So do not overwrite empty titles with the titles from the default language.

Currently it's not an issue because all titles will be translated for all languages but it's a bit confusing imo.

  • Like 1

Share this post


Link to post
Share on other sites

Hey @tpr - good catch. I am looking into this now and actually thinking about revisiting the fairly recent change we discussed that shows the default language title when there is no title for the current user language. I am thinking about leaving the title field empty and maybe putting the default language in the tooltip of the warning icon that shows up. I also need to revisit how page names are handled - at the moment it's a mess if you change the title because it changes the name for all languages.

Anyway, let me know what you think about my idea for making the title blank if it's blank for the user's language - just want to make sure I am not making it worse for anyone.

Share this post


Link to post
Share on other sites

I guess blanks would be better if that would prevent unintended saves, thanks. Hiding them in a tooltip is perhaps not the best idea, it would be better to make them visible all the time (wouldn't require hovering with the mouse).

22 minutes ago, adrian said:

at the moment it's a mess if you change the title because it changes the name for all languages.

Actually I could add non-default language titles and other titles were remained intact. But I have the Page Rename Options plugin installed, maybe that's interfering.

  • Like 1

Share this post


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

I guess blanks would be better if that would prevent unintended saves, thanks. Hiding them in a tooltip is perhaps not the best idea, it would be better to make them visible all the time (wouldn't require hovering with the mouse).

Well it's easy enough to not have them save to other languages even if the default is populated, but I think populating them is a little confusing still. What about setting the html5 placeholder as the default language title. Do you think that would be a reasonable UX?

Share this post


Link to post
Share on other sites

Haha, that was my first idea when reading the intro of your post :) I would say yes, and that would allow seeing the default title when clearing the field (if you add the placeholder to all title fields, not only to empty's)

  • Like 1

Share this post


Link to post
Share on other sites

Hey @tpr - I have made an initial (although took much longer than I thought) start on support multi-language in Edit mode. Keep in mind that this is not designed to make it possible to edit all languages at once, but rather add proper support for editing the title and name for the user's current language.

Here you can see the same set of child pages in Portuguese and then the default English.

The keys things are:

  • When viewing a non-default language the Title and Name columns have the current language in parentheses.
  • Title is left blank for the current language if no language-specific version is available (uses "Placeholder" to show default language title).
  • Name is left blank for the current language if no language-specific version is available.
  • If you have the BCE "Overwrite Names" setting checked, the name for the current language will be created/updated to match the entered title.
  • If you edit the page in a modal and save, the title and name for the current language will populate the edit mode interface instantly when modal is closed.
  • Unrelated to multi-language, but there is now a new "edit in normal mode" icon - sometimes I prefer this to modal and think a link from here is nice.

I am going to attach the new version here for the moment - please let me know if everything works as expected for you.

 

Portuguese

58b0bf2952fc6_ScreenShot2017-02-24at3_17_33PM.thumb.png.57365f3bcbc9e0fcdf441823da4d099c.png

 

Default: English

58b0bba87beb1_ScreenShot2017-02-24at3_02_49PM.thumb.png.135dfb6d5cec356fb94dbf20c6396e78.png

 

BatchChildEditor.zip

  • Like 2

Share this post


Link to post
Share on other sites

Thanks - all seem to work fine here.

I feel the empty "name" column for non-default language is a bit misleading, perhaps adding the default name there in grey would be less confusing? Now it looks like there's no name provided (which can't be as it's required). Plus this way you don't know the page name.

The new edit mode for me is not very helpful because I can open the modal link in a new tab with middle-click. But of course it can be handy for others.

Btw, what about displaying the "Active" state of pages in multilanguage installs?

  • Like 1

Share this post


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

I feel the empty "name" column for non-default language is a bit misleading, perhaps adding the default name there in grey would be less confusing?

I agree, but I use grey to indicate a hidden page (and strikethrough for unpublished). I know they aren't essential because of the hidden and unpublished checkbox columns, but it's still a nice familiar visual indicator. Any thoughts?

6 hours ago, tpr said:

The new edit mode for me is not very helpful because I can open the modal link in a new tab with middle-

I don't know how given that the modal edit icon has no link, but rather a data-url attribute. Are you sure this works for you?

6 hours ago, tpr said:

Btw, what about displaying the "Active" state of pages in multilanguage installs?

Seems like a great idea - thanks!

Share this post


Link to post
Share on other sites

Middle-click to open link: sorry, it was the same page that opened, not the one in the list. What if it had a link too, would the modal stop functioning?

Empty "name" for non-default language names: perhaps using square brackets, or something similar, eg "*pagename"?

  • Like 1

Share this post


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

Middle-click to open link: sorry, it was the same page that opened, not the one in the list. What if it had a link too, would the modal stop functioning?

Adding a link as well makes it possible to middle click / right click and open in new tab, so I have removed the additional link

4 hours ago, tpr said:

Empty "name" for non-default language names: perhaps using square brackets, or something similar, eg "*pagename"?

I went with another warning icon which I think works fine.

10 hours ago, tpr said:

Btw, what about displaying the "Active" state of pages in multilanguage installs?

Available in the new version.

58b1d1b0c137c_ScreenShot2017-02-25at10_47_05AM.thumb.png.28494c142424017f6253662e6cce5ddb.png

The one remaining issue (that I know of) with the attached version is how to handle newly added pages (with Add New) when they are added by a user when a non-default language is selected. The problem is that the default title is not populated and the default name is automatically populated with a timestamp. The easy option would be to disable adding new pages from non-default languages, but I think I should probably populate the default name with the same name as the language used to add the page. As for the title, maybe showing nothing for the default title is ok?

What do you think - is adding new pages from the non-default language something that should be allowed?

This is what it looks like after adding the Test page when in Portuguese and then switching to default (English):

58b1d7e580914_ScreenShot2017-02-25at11_14_54AM.thumb.png.4e76739d9d3bc5cb0fa8aeb89fc53782.png

BatchChildEditor.zip

Share this post


Link to post
Share on other sites

What about the usefulness of having an "active" checkbox column for each available language?

Share this post


Link to post
Share on other sites

Thanks, much better :) Perhaps I would change the new exclamation icon to "fa-info-circle" because it's less strict. Sometimes the page name is intentionally the same in all languages so it's not necessarily an error (eg. /sport/). But the same holds true for the "title" field too.

I like the active checkboxes. Or do you mean displaying checkboxes for all languages? How? Perhaps displaying a list of languages + active state in a tooltip on hover? That would be a handy extra info so one could edit the page in question if needed.

As for the add new page for non-default language, it's a tough one, I would say leave it as it is and improve later :)

  • Like 1

Share this post


Link to post
Share on other sites

Thanks again @tpr for the feedback. I have changed the icon to the info-circle.

I have added a new tooltip which provides a summary of titles/names for all languages:

58b49a9abb979_ScreenShot2017-02-27at1_29_43PM.png.ca48416fd60447639b96e2ec528bbb99.png

 

For the Add New page problem - I decided to go with populating the default language with the values for the current user language so there is at least valid entries for these that can be edited later if needed.

Note that I also added a Language label at the top of the table (rather than being added to several columns in the table). 

I would also like to mention the awesome Language Switcher in your AOS module - I think that having that enabled along with the new changes to BCE actually makes for a pretty decent start to multi-language support because it makes it so easy to instantly switch languages.

I think this new version is ready for release, but will attach here for one more review by you (and anyone else who is interested).

Thanks,
Adrian

 

BatchChildEditor.zip

  • Like 2

Share this post


Link to post
Share on other sites

Great updates, thanks! My only concern is the styling (again :)) of the new tooltip. It's too big here and all uppercase, I guess some CSS is interfering. 

My only idea that could work is adding a +/- icons to the end of the rows (or start), and clicking on them would open a full-width row below the actual line containing all these details. Of course this would require a click to work (and another to close) but maybe it would worth it. But it's just an idea.

bce-tooltip.png

  • Like 1

Share this post


Link to post
Share on other sites
2 minutes ago, tpr said:

My only idea that could work is adding a +/- icons to the end of the rows (or start), and clicking on them would open a full-width row below the actual line containing all these details. Of course this would require a click to work (and another to close) but maybe it would worth it. But it's just an idea.

I did think about something like that, but thought I'd go for the simpler option first.

Surely I could just override text-transform to prevent the uppercase. Would you mind testing that in BatchChildEditor.css at around line 38? Or maybe I need to override the table#bceLanguages td rules?

Share this post


Link to post
Share on other sites

I'll check the text-transform thing tomorrow.

I got an error on loading the module settings, plus the language text on top is showing as a non-rendered markup (even if AOS uninstalled, if it's enabled it's not showing at all):

 

bce-language-markup.png

bce-error.png

  • Like 1

Share this post


Link to post
Share on other sites

Sorry, it looks like you downloaded as soon as I posted - I already fixed the "$this" issue is the version that is posted.

I'll look into the language text issue.

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 Gadgetto
      Status update links (inside this thread) for SnipWire development will be always posted here:
      2019-10-18
      2019-08-08
      2019-06-15
      2019-06-02
      2019-05-25
      If you are interested, you can test the current state of development:
      https://github.com/gadgetto/SnipWire
      Please note that the software is not yet intended for use in a production system (alpha version).
      If you like, you can also submit feature requests and suggestions for improvement. I also accept pull requests.
      ---- INITIAL POST FROM 2019-05-25 ----
      I wanted to let you know that I am currently working on a new ProcessWire module that fully integrates the Snipcart Shopping Cart System into ProcessWire. (this is a customer project, so I had to postpone the development of my other module GroupMailer).
      The new module SnipWire offers full integration of the Snipcart Shopping Cart System into ProcessWire.
      Here are some highlights:
      simple setup with (optional) pre-installed templates, product fields, sample products (quasi a complete shop system to get started immediately) store dashboard with all data from the snipcart system (no change to the snipcart dashboard itself required) Integrated REST API for controlling and querying snipcart data webhooks to trigger events from Snipcart (new order, new customer, etc.) multi currency support self-defined/configurable tax rates etc. Development is already well advanced and I plan to release the module in the next 2-3 months.
      I'm not sure yet if this will be a "Pro" module or if it will be made available for free.
      I would be grateful for suggestions and hints!
      (please have a look at the screenshots to get an idea what I'm talking about)
       




    • 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.
×
×
  • Create New...