Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2018-08-22 18:05:35

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

Hello Jakob,
see :

here, in the multiple select tool, the section dropdown show the sections hidden in the bot_wtc window.

Is it possible to hide the same sections as in the write screen, and display here the titles and not the names ? And sort the titles !

Thanks !

Offline

#14 2018-08-22 19:56:23

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,187
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

jpdupont wrote #313580:

Here, in the multiple select tool, the section dropdown show the sections hidden in the bot_wtc window. Is it possible to hide the same sections as in the write screen, and display here the titles and not the names ? And sort the titles !

That’s in the article list pane, right? I don’t think so, I’m afraid. The multi_edit form doesn’t have a pluggable_ui hook so there’s not an in-built mechanism for modifying it with a plugin. Also bot_wtc only loads in the Write pane so the user javascript wouldn’t act on the list pane.

As far as I can tell, the section dropdown is constructed here using this function which requires key => value array pairs (see notes above the function) to construct the dropdown with labels. Currently that’s populated by $all_sections which is a single list array of just the section names.

Two possible options:

One way I can think of to achieve everything you want – though the devs may have a better suggestion – is to make a minor amendment (patch) to the code of /include/txp_list.php. As $all_sections is needed later to match against the chosen values, I wouldn’t change that. Instead, something like this:

  • Retrieve the section titles into a second array, e.g. $all_section_titles, using the same sort order as $all_sections, then array_combine the two into a new name => Label array (or start over and create a fresh array out of the ‘name’ and ‘title’ of txp_section).
  • Look up the hidden sections in the table txp_prefs called bot_wtc_static_sections and unset those sections from the array.
  • Sort the array by the title.
  • Replace the inputSelect line using your own new array.

The remainder should still function, all you’ve changed is the construction of the dropdown.

Another option would be to remove the sections you wish to hide using jquery/javascript. Add a file called custom.js to /admin-themes/{hive or your-theme}/assets/js/ (see the admin-theme readme) and remove the options you don’t want to have from the dropdown that way. If you make a lookup table of section names and section titles, you could potentially also modify the dropdown labels with jquery and then sort all the options. It’s not very dynamic but if your site doesn’t change much, perhaps that’s an option. You might be able to use the same code to modify the dropdown in adi_matrix, too.


TXP Builders – finely-crafted code, design and txp

Online

#15 2018-08-22 20:54:41

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

Thanks Jakob for this long analysis …
Previously, the dropdown of the sections in the write page was based on the names and not on the titles, and today, this list is sorted on the titles. Can not we use this code? Gocom had created rah_sections_titles to work around the old display …
Hiding sections as in bot_wtc is not as important as posting titles rather than names, for our clients.

Offline

#16 2018-08-22 21:22:40

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,187
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

On the write tab, there is a pluggable_ui hook for replacing the entire section dropdown. I think that’s what Gocom used (also for his status radio buttons plugin). But you’re talking about the article list page, or am I mistaken?

It’s possible that some of the code for the section dropdown on the write tab could be relevant for the multi-edit chooser, but the ui element for the multi_edit chooser is more complex as it covers lots of situations in one combo box.

The “analysis” was to give you some pointers if you want to attempt it yourself :-)


TXP Builders – finely-crafted code, design and txp

Online

#17 2018-08-23 06:03:04

jpdupont
Member
From: Virton (BE)
Registered: 2004-10-01
Posts: 752
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

Thank you Jakob,
I will see what I can do myself in this particular case :-)

However, I want to reveal this inconsistency, when we compare the two drop down here: the categories listed and sorted by title, and the sections listed by name, and not sorted … What disturb the user.

Offline

#18 2018-08-23 07:44:22

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,187
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

jpdupont wrote #313586:

However, I want to reveal this inconsistency, when we compare the two drop down here: the categories listed and sorted by title, and the sections listed by name, and not sorted … What disturb the user.

You’re right, it should really be the section titles in alphabetical order. The same goes for the authors too. As far as I can tell, categories and statuses (stati?) are already okay.

I’ve added an issue to GitHub for that.

Then you’d only need to do the removing items from the list with js.


TXP Builders – finely-crafted code, design and txp

Online

#19 2020-09-23 11:53:21

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,467

Re: bot_wtc v8 for Textpattern v4.7 (beta)

Maybe this is the better place (yesterday):

I use identical Textpattern installations at different providers, version 4.8.3 and PHP 7.4.10. At one of the providers there are problems saving the articles. After several attempts to solve the problem I found out that it has to do with the latest version of the bot_write_tab_customize plug-in. The console shows the following, only if the plug-in is activated.

What has this to do with the provider, why it works for some providers and not for one?

Warnings:

jQuery.Deferred exception: allForms is not defined ReferenceError: allForms is not defined
    at HTMLSelectElement.<anonymous> (https://domain.ch/textpattern/textpattern.js:2082:23)
    at HTMLElement.dispatch (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:43090)
    at HTMLElement.v.handle (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:41074)
    at Object.trigger (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:71513)
    at HTMLSelectElement.<anonymous> (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:72108)
    at Function.each (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:2976)
    at S.fn.init.each (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:1454)
    at S.fn.init.trigger (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:72084)
    at S.fn.init.S.fn.<computed> [as change] (https://domain.ch/textpattern/vendors/jquery/jquery/jquery.js:2:88549)
    at HTMLDocument.<anonymous> (https://domain.ch/textpattern/index.php?event=article&step=edit&ID=35&_txp_token=5ac45a1ad7f790b347f79e5cfb288f6a:442:12) undefined

Errors:

Uncaught ReferenceError: allForms is not defined
    at HTMLSelectElement.<anonymous> (textpattern.js:2082)
    at HTMLElement.dispatch (jquery.js:2)
    at HTMLElement.v.handle (jquery.js:2)
    at Object.trigger (jquery.js:2)
    at HTMLSelectElement.<anonymous> (jquery.js:2)
    at Function.each (jquery.js:2)
    at S.fn.init.each (jquery.js:2)
    at S.fn.init.trigger (jquery.js:2)
    at S.fn.init.S.fn.<computed> [as change] (jquery.js:2)
    at HTMLDocument.<anonymous> (index.php?event=article&step=edit&ID=35&_txp_token=5ac45a1ad7f790b347f79e5cfb288f6a:442)

Offline

#20 2020-09-23 12:15:28

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,187
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

Hmm. Not sure there a) why it’s doing that and b) why it’s different on your two installations. It’s a javascript notice you’re seeing in the console so shouldn’t depend on the php version.

bot_wtc doesn’t have that variable in its javascript but textpattern.js does. I’m guessing it has to do with an interaction between bot_wtc and this part of textpattern.js, as the other instances of allForms are all on the article list page. The plugin and textpattern.js both listen for changes to the section dropdown.

I don’t have a solution for you at the moment. Does the plugin continue to work despite the the message in the console?


TXP Builders – finely-crafted code, design and txp

Online

#21 2020-09-23 12:48:02

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,467

Re: bot_wtc v8 for Textpattern v4.7 (beta)

Yes, the plug-in works well otherwise.

With other providers (in Switzerland) I had problems with ModSecurity roles after the Textpattern and PHP 7.4 upgrade because of my Ecuadorian IP. The provider with this plug-in problem deactivated them temporarily, but it didn’t help.

I think like you, that it has to do with the interaction between Plug-In PHP and jQuery in Textpattern. But, what interferes with this interaction?

When saving, the process goes on endlessly (circling). If I wait long enough and reload the page I notice that the content has been saved. Only the interaction with the button does not work properly.

Offline

#22 2020-09-23 13:14:46

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,187
Website

Re: bot_wtc v8 for Textpattern v4.7 (beta)

GugUser wrote #326048:

Yes, the plug-in works well otherwise.

Good :-)

I think like you, that it has to do with the interaction between Plug-In PHP and jQuery in Textpattern. But, what interferes with this interaction?

It’s actually jQuery in bot_wtc, it’s only injected into the head of the page via PHP. bot_wtc listens to see if the section is changed and then switches the custom field display accordingly. Textpattern seems to do something with skin (e.g. themes) but I’m not sure. When the section drop-down is changed, both scripts respond and something’s happening there. I don’t know enough about what textpattern is doing there but I suspect it’s bot_wtc that needs adjusting to play nicely with txp.

Maybe a dev can chime in here.

When saving, the process goes on endlessly (circling). If I wait long enough and reload the page I notice that the content has been saved. Only the interaction with the button does not work properly.

That sounds like it’s interfering with completion of the ajax-save and does need resolving, then.


TXP Builders – finely-crafted code, design and txp

Online

#23 2020-09-23 13:34:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 10,565
Website GitHub

Re: bot_wtc v8 for Textpattern v4.7 (beta)

jakob wrote #326049:

bot_wtc listens to see if the section is changed and then switches the custom field display accordingly.

Textpattern 4.8.2+ (or thereabouts) listens to the section dropdown and uses that to seed the override form based on the theme in use. I suspect bot_wtc is either stomping on this callback or is being stomped on by core’s callback. Perhaps one of them is not propagating, e.g. doing a .stopPropagation() or .preventDefault() or exiting or returning false which stops (or interferes with) the next one firing properly?

The console output should help narrow it down.

Last edited by Bloke (2020-09-23 13:35:18)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#24 2020-09-24 17:11:23

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,467

Re: bot_wtc v8 for Textpattern v4.7 (beta)

GugUser wrote #326045:

Maybe this is the better place (yesterday):

I use identical Textpattern installations at different providers, version 4.8.3 and PHP 7.4.10. At one of the providers there are problems saving the articles. After several attempts to solve the problem I found out that it has to do with the latest version of the bot_write_tab_customize plug-in. The console shows the following, only if the plug-in is activated.

What has this to do with the provider, why it works for some providers and not for one?

Warnings:

jQuery.Deferred exception: allForms is not defined ReferenceError: allForms is not defined...

Errors:

Uncaught ReferenceError: allForms is not defined...

It seems that there is no solution to the problem described. The provider’s customer service cannot help either.

Offline

Board footer

Powered by FluxBB