Juergen Posted April 20, 2017 Share Posted April 20, 2017 Thanks @adrian, now the "double list" problem is gone. Your fix works 1 Link to comment Share on other sites More sharing options...
Juergen Posted April 20, 2017 Share Posted April 20, 2017 Now I have tested it with the browser console. As you can see, there are no JS-errors: In line 165 of the BatchChildEditor.js the checkbox markup will be declared: bce_toggleControl = '<input type="checkbox" class="' + bce_columnControlClass + '" style="position: relative; top: 2px; margin-right: 4px;" />', But this markup will not be added next to tableheader cells. I havent been working with the browser console so far. Maybe I am doing something wrong or I am in the wrong part of the console, but I cannot find an error. 1 Link to comment Share on other sites More sharing options...
tpr Posted April 20, 2017 Share Posted April 20, 2017 Thanks - a script can fail even if there are no errors, eg. in this case probably the markup can't be added because the target element is not found in the DOM (maybe the selector used doesn't match anything). It's hard to tell anything else without seeing it. I would try using console.log(obj.length); where object is the target (jQuery) element. If it's 1 (shown in the console) then it's there, otherwise not. 1 Link to comment Share on other sites More sharing options...
Juergen Posted April 20, 2017 Share Posted April 20, 2017 OK I have tried the following: I have added the following script to the admin.php file <script type="text/javascript"> a = "test"; console.log(a.length); obj = bce_toggleControl; console.log(obj.length); </script> The variable a with the content "test" is only to check if the console.log works. I got the following output: As you can see the variable "a" has a length of 4 - this is correct. But the variable "bce_toggleControl" which is responsible for the checkbox doesnt return anything. I have also tried it with bce_fieldID depending on this snippet // add column controls (top, bottom and replace modes) $(document).on('loaded', '#' + bce_fieldID, function () { addBceColumnControls(); }); Same result 1 Link to comment Share on other sites More sharing options...
tpr Posted April 20, 2017 Share Posted April 20, 2017 Try adding console.log() directly into BatchChildEditor.js file instead. Link to comment Share on other sites More sharing options...
Juergen Posted April 20, 2017 Share Posted April 20, 2017 Of course Here is what I have added: a = "test"; console.log(a,length); console.log(bce_fieldID,length); // add column controls (top, bottom and replace modes) $(document).on('loaded', '#' + bce_fieldID, function () { addBceColumnControls(); }); And this is what I got: As you can see the variable "bce_fieldsetID" consist of 23 letters (= ProcessPageEditChildren) So this variable of the if statement is there!!! 1 Link to comment Share on other sites More sharing options...
Juergen Posted April 20, 2017 Share Posted April 20, 2017 What I have found out is the following. In the JS-file there is the part where the additional function will be created (approx. at line 218) function addBceColumnControls() { //this timeout is a bit of a hack that should be improved in the future setTimeout(function () { if (bce_isColumnControlsAdded) { return false; } if ($(bce_adminDataTableSelector).length === 0) { return false; } // do not add controls if there is no more than 1 row if ($(bce_adminDataTableSelector + ' tbody tr').length <= 1) { return false; } //$(bce_adminDataTableSelector + ' tbody').on('click', 'input[type="checkbox"], i.InputfieldChildTableRowDeleteLink', function () { $(bce_adminDataTableSelector + ' tbody').on('click', 'input[type="checkbox"]', function () { setColumnControlStates($(this)); }); // add new controls for (var i = 0; i < bce_allowedColumnControls.length; i++) { var currentControl = bce_allowedColumnControls[i]; // skip non-existing elements if (!$(currentControl).length) { continue; } // get index of first checkbox in the first row var index = $(bce_adminDataTableSelector + ' ' + currentControl + ':eq(0)').parent().index(); // do the add $(bce_adminDataTableSelector + ' th:eq(' + index + ')').prepend($(bce_toggleControl)); // set initial checkbox states setColumnControlStates($(bce_adminDataTableSelector + ' th:eq(' + index + ') input')); // add event addColumnControlEvent(bce_adminDataTableSelector, currentControl, index); } // disable thead break to multiline $(bce_adminDataTableSelector + ' thead').css('white-space', 'nowrap'); bce_isColumnControlsAdded = true; return true; }, 1000); } There are a lot of if-statements depending on the length of a variable. It is not possible to log the variables inside this function. Fe. if I want to check the variable length of the second if statement if ($(bce_adminDataTableSelector).length === 0) { return false; } with console.log(bce_adminDataTableSelector.length); or console.log($(bce_adminDataTableSelector).length); nothing will be returned, so maybe the if-statements doesnt work in this case. 1 Link to comment Share on other sites More sharing options...
tpr Posted April 20, 2017 Share Posted April 20, 2017 Yepp, the main goal would be to detect where it stops at your side Btw "variable length" in these cases are the number of items found in the DOM. So if it's 0 for "$(bce_adminDataTableSelector).length" it means the html tag is not found in the DOM. I guess you can't provide login details via PM, that would make things easier 1 Link to comment Share on other sites More sharing options...
Juergen Posted April 20, 2017 Share Posted April 20, 2017 If you write "bce_adminDataTableSelector.length instead of ($(bce_adminDataTableSelector).length) it will return 41 instead of 0 after clicking the tab. It seems that $ before causes a problem. Link to comment Share on other sites More sharing options...
tpr Posted April 20, 2017 Share Posted April 20, 2017 The search is over, thanks to @Juergen providing login to the site in question. I have modified the way the controls are added, now it happens when you hover on the admindatatable, this seems to be the most reliable way. See the modified file attached. BatchChildEditor.js 3 Link to comment Share on other sites More sharing options...
adrian Posted April 20, 2017 Author Share Posted April 20, 2017 Thank you both for getting to the bottom of this! @tpr - I did tweak your changes slightly to use "one" and "mouseover": $(document).one('mouseover', bce_adminDataTableSelector, function () { instead of "on" and "hover": $(document).on('hover', bce_adminDataTableSelector, function () { so that it's triggered only once. I know you had another check in there to see if the controls were already added, but I still think this an improvement. Do you see any issues with this change? 1 Link to comment Share on other sites More sharing options...
tpr Posted April 20, 2017 Share Posted April 20, 2017 Thanks, I also think yours is better. At the time I wrote the original Js I wasn't aware of .one(), I would use that too. 1 Link to comment Share on other sites More sharing options...
Pretobrazza Posted May 3, 2017 Share Posted May 3, 2017 Hi, I'm using PW 3.0.61 with PHP7 and yesterday I downloaded this module as I urgently need to import coordinates to link those pages to my map in the frontend. As I'm using Leaflet Map Marker in the admin, the subfields in the 'map' table in the database are: map.data map.lat map.lng map.zoom map.status e.g. Albatrosstraat, Knokke-Heist, BE 51.34085 3.242333 18 -100 As I have to import 1000's of pages, I have no option but to work by batch georefferring and csv imports. I tried everything to make the import of the subfields work but to no avail. Could it be that the module is not compatible with PW 3.0.61 or that Leaflet Map Marker has other settings, or am I missing something somewhere? I tried to pair CSV column number and Processwire field names as in: 1:title 2:map.data (tried map.address too) 3:map.lat 4.map:lng etc. Link to comment Share on other sites More sharing options...
CodeCoffeeCode Posted May 12, 2017 Share Posted May 12, 2017 I am trying to import several child pages using a cvs file. All normal field types are importing without a problem, but when importing 'ProFields Textareas' fields, these fields are not being populated with the specified data form the CSV file. My Textareas field type is named “chartNumbers”, which contains 3 ‘Textarea Definitions’: “fieldfrom”, “fieldto”, fieldsplit”. I have written the ‘CSV filed pairings’ in my page settings like this: 1:title 2:page_shorttitle 3:page_subtitle 4:page_summary 5:chartNumbers.fieldfrom 6:chartNumbers.fieldto 7:chartNumbers.fieldsplit I believe that the above field parings are correct based on what I read in this post . Having spent almost 5-hours trying to figure this out, my brain has decided to give up at 5:30am. Can anybody tell me what I’m doing incorrect (if that is the case), or help me figure out what is going wrong. My setup: PW v3.0.61 Master, ProFields Textareas v0.0.7, Batch Child Editor v1.6.6 Link to comment Share on other sites More sharing options...
CodeCoffeeCode Posted May 14, 2017 Share Posted May 14, 2017 On 12/05/2017 at 5:38 AM, CodeCoffeeCode said: My setup: PW v3.0.61 Master, ProFields Textareas v0.0.7, Batch Child Editor v1.6.6 Ive just updated to PW v3.0.62. As Pretobrazza mentioned on May 3rd in this post, I think there maybe a compatibility issue with this module when trying to import 'ProFields Textareas - Textarea Definitions' fields. Any help would be useful. It is impossible to import these fields using the 'Import pages from CSV' module, I've several hundred pages to import that require these fields populating. Link to comment Share on other sites More sharing options...
bernhard Posted May 14, 2017 Share Posted May 14, 2017 hi codecoffeecode, you can try to use something like my solution for your import if you are only doing the import once (and not need your users to be able to import anything). it's very easy to import all kinds of data like this. adrian will be offline for some weeks... hope that helps 1 Link to comment Share on other sites More sharing options...
adrian Posted July 4, 2017 Author Share Posted July 4, 2017 Hi @Pretobrazza and @CodeCoffeeCode - I am sorry for the very long delay in responding - I have just returned from an extended time away from my computer. It looks like the issues you were having with textareas fields and the map marker were actually due to PHP 7. The latest version should fix things - I tested with textareas which now work perfectly again - hopefully map marker fields will also work again now. I have also fixed some other issues with adding multiple new child in Edit mode and also taken care of this issue. Please let me know how things work for you now. 3 Link to comment Share on other sites More sharing options...
titanium Posted July 12, 2017 Share Posted July 12, 2017 Adrian, let me first say "thank you so much" for this great module - it's incredibly helpful. I think I have found a small bug. When one or more quotes are used in the title of the page, the "edit" section breaks, see attached screenshot. I have now seen this across different installations, so I think it hasn't to do with my setup. Batch Child Editor is latest version 1.6.7, ProcessWire is 3.0.65 1 Link to comment Share on other sites More sharing options...
adrian Posted July 18, 2017 Author Share Posted July 18, 2017 Hi @titanium - sorry for the delay - turns out this was a new problem with the multi-language title info that was added recently. Please test the latest version and let me know if you have any further problems. 2 Link to comment Share on other sites More sharing options...
Klenkes Posted July 19, 2017 Share Posted July 19, 2017 Just ran into a funny problem. Well... not really funny, but it took me way too long to figure it out. (Sometimes I wonder how get through the day...) I am developing the migration of 10+ similar sites from another CMS to PW. All the websites have lots of fields and data, and BCE is the only way to map the data to textareas subfileds. All tests worked great so far until now! Suddenly I was unable to input my fieldpairings. ProcessWire: ProcessPageEdit: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'data' at row 1 As I said it took me way too long to realize the "Data too long for column data" During my testing the database field 'data' got filled up with all the settings for all the parent pages, and since it is of type text, I guess 64kb is the limit. I had to uninstall and reinstall BCE to start over with an empty data field. I guess there is no real solution to this but I wanted to add it here in case somebody faces the same dilemma. 2 Link to comment Share on other sites More sharing options...
adrian Posted July 19, 2017 Author Share Posted July 19, 2017 (edited) @Klenkes - a simple solution to this would be for you to manually change the "data" field in the "modules" db table from "text" to "mediumtext". I'll see if I can get Ryan to do it in the core so it's always available. https://github.com/processwire/processwire-issues/issues/321 Edited July 19, 2017 by adrian Added link to new Github issue 2 Link to comment Share on other sites More sharing options...
Klenkes Posted July 20, 2017 Share Posted July 20, 2017 I thought about mediumtext but don't know what "unwanted" effect it may have on other PW functions. I went the even more simple way and import now to a single import page, and then move the imported pages with your great AdminActions to their destination parents. This way I don't have to configure all parent pages with my fieldpairings. BTW... thank you very much for AdminActions. Without Move and Search and Replace this project wouldn't be possible. 4 Link to comment Share on other sites More sharing options...
Klenkes Posted July 22, 2017 Share Posted July 22, 2017 Me again... I imported a few hundred pages to more than 30 parents and almost everthing is fine. Then I noticed that all custom ids and classes in my imported textareas were filtered out during save, even with deactivated ACF and HTML Purifier(in textareas settings) Pasting in the same HTML in source mode afterwards leaves the custum stuff alone. So it works. I don't even know wether it's a BCE issue or with Profields textareas? This problem seems familiar but I can't remember... 1 Link to comment Share on other sites More sharing options...
adrian Posted July 22, 2017 Author Share Posted July 22, 2017 7 hours ago, Klenkes said: Me again... I imported a few hundred pages to more than 30 parents and almost everthing is fine. Then I noticed that all custom ids and classes in my imported textareas were filtered out during save, even with deactivated ACF and HTML Purifier(in textareas settings) Pasting in the same HTML in source mode afterwards leaves the custum stuff alone. So it works. I don't even know wether it's a BCE issue or with Profields textareas? This problem seems familiar but I can't remember... I do use the $sanitizer->purify option with all content added via BCE, so that will be the source of the problem for sure. I can see two possible options here. 1) Add a BCE config setting to enable you to turn off the purifier sitewide and/or per parent page. 2) Check the purifier status for the field that the content is being added to and respect that. Any thoughts? PS if you want a quick fix, just edit this line:https://github.com/adrianbj/BatchChildEditor/blob/ba228d2f011d306345f02ec4aa19d090f2d89481/BatchChildEditor.module#L1448 Link to comment Share on other sites More sharing options...
Klenkes Posted July 22, 2017 Share Posted July 22, 2017 That explains a lot For the sites I migrate to PW option 1 would me my choice, because importing the content is the first priority and editing the content comes later. Nobody wants to sift through a few hundred pages to make it all like it was. In my case editors are skilled, trusted and would be fired if they do monkeybusiness with the HTML. ...but then again... option 2 would work as well since I already deactivated all the purifier options for the fields anyway. For now I will go with the dirty fix 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now