Jump to content

Batch Child Editor


adrian

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
Link to comment
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
Link to comment
Share on other sites

  • 1 month later...

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.

Link to comment
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..

Link to comment
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.

Link to comment
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
Link to comment
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.

Link to comment
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
Link to comment
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?

Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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!

Link to comment
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
Link to comment
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

Link to comment
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
Link to comment
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
Link to comment
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
Link to comment
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?

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