# Textpattern CMS support forum

You are not logged in. Register | Login | Help

## #21 2018-03-18 00:11:48

jayrope
Plugin Author
From: Berlin
Registered: 2006-07-06
Posts: 647
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

###### Bloke wrote #310060:

This one I think. Not tried it on 4.7 yet. Probably needs some visual love.

p.

Goodness! Which possibilities did you not touch yet? Awesome.

a hole turned upside down is a dome, when there’s also gravity.

Offline

## #22 2018-03-18 05:34:03

Summer
Member
Registered: 2018-01-29
Posts: 51

### Re: glz_custom_fields v2 beta for Textpattern v4.7

Custom script path, always warning path error?

Custom scripts path does not exist, please create it.

The path is now:
E:\www\text\plugins/glz_custom_fields/

Offline

## #23 2018-03-18 08:22:54

jakob
From: Germany
Registered: 2005-01-20
Posts: 3,657
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

###### Summer wrote #310098:

Custom script path, always warning path error?

Custom scripts path does not exist, please create it.

The path is now:
E:\www\text\plugins/glz_custom_fields/

Hi Summer, try checking the following:

• Your path has a mix of backslashes and forward slashes in it so I’m guessing you’re on windows. Try using either all forward slashes (php should automatically deal with that on windows) or double-backslashes (as a single backslash is an escape character for the following character).
• If you’re not using any custom script custom fields, the error does not affect the rest of glz_custom_fields working.

TXP Builders – finely-crafted code, design and txp

Offline

## #24 2018-03-18 10:51:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 8,948
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

###### jayrope wrote #310096:

Goodness! Which possibilities did you not touch yet? Awesome.

:-) Thanks. I compiled the Kindle version of Understanding the silent communication of dogs entirely with smd_ebook from articles in Txp.

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

## #25 2018-04-03 22:03:01

jakob
From: Germany
Registered: 2005-01-20
Posts: 3,657
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

I’ve made some updates to this one too to accommodate your feedback. They’re in the dev branch for the moment pending your testing.

Changes

• Relaxed the table widths as per your suggestion and made the drag script try and fix the widths better when dragging.
• List options. Thanks for your suggestion Philippe but I opted instead to disable them entirely. They didn’t originally appear (see original screenshot), only in more recent dev updates. With the couple of columns we have here, it’s usefulness is limited and it can interfere with the drag-sorting.
• Fewer unnecessary privs (keeps rah_privs cleaner :-) Some of them were already behind identical system privs. I don’t think I broke anything here.
• File paths are no longer checked on every prefs page load. Although no-one else has reported pageload slowdowns, it is conceivable that it will affect more people. I’ve added a “check paths” button to do the test on-demand. Clicking “check paths” causes the check to be performed (the page load will then be slower, of course, while it does that) and reports success or fail. If the timepicker or datepicker won’t load on the write tab, the link in the error message takes you straight to “check paths”.

If these prove okay with you lot, I’ll merge them back into the main branch.

Updating

Grab the new installer and update glz_custom_fields.min.css too.

TXP Builders – finely-crafted code, design and txp

Offline

## #26 2018-04-03 23:49:45

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,821
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

I’ve added a “check paths” button to do the test on-demand.

Could that button be inserted after the headline; if feels weird to see it there.

<h2>Custom fields preferences</h2>
<p>insert button here</p>
<div class="txp-form-field">rest of stuff

Relaxed the table widths as per your suggestion and made the drag script try and fix the widths better when dragging.

Thank you for that.

Regarding the top part of the custom fields panel. Agree that the list options button isn’t strictly needed (when I tried to use, I could’t hide the sort column). But I’d still argue for matching the Core layout as I mentioned in the Github issue; e.g. a plugin could do “something” with (all) the list tables and add a button in the same location as the list-options button.

Offline

## #27 2018-04-04 09:47:12

jakob
From: Germany
Registered: 2005-01-20
Posts: 3,657
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

###### phiw13 wrote #310599:

Could that button be inserted after the headline; if feels weird to see it there.

Hmm, maybe. What could be done easily is to simply force it to be on a new line (or perhaps ranged right) with css.

The thing is the preferences table is mighty clever: it basically creates itself from a list of preferences assigned to a particular prefs group. The header is automatically created from the prefs group language string, the prefs labels from the language strings matching the pref, the subheadings likewise from prefs subgroup. The only bit you can adapt to each situation is the input method by creating a custom function for it.

As far as I can tell – though I may be mistaken – the only way to add a button at another position is to create a “blind” preference record and a function for the button, which seems a bit extreme for a single link. I kind of fudged it by putting the button in the language string – which is probably poor coding style – but works.

Stef did point me to an arguably better way of doing the check using an ajaxified button that performs the checks, picks up the results and then adds the success/error messages but for the moment I failed in my attempts to do it that way, plus I can’t work out how that can be called from another page (I think it’s useful if the link from the “datepicker -> go fix it” error on the write tab automatically performs the check paths routine). Currently, these things exceed my programming skills/knowledge level, but a PR would be very welcome if someone else can fix this for me.

Regarding the top part of the custom fields panel. Agree that the list options button isn’t strictly needed (when I tried to use, I couldn’t hide the sort column). But I’d still argue for matching the Core layout as I mentioned in the Github issue; e.g. a plugin could do “something” with (all) the list tables and add a button in the same location as the list-options button.

I’m still not sure. As far as I’ve been able to discern, the list options now get added automatically to any table with class="txp-list" and it’s options are determined by what column headers are generated by textpattern. I just suppressed it by assigning class="txp-list--no-options" (cudos to the devs for making it so easy).

With the drag-and-drop sort option activated, the position column is hidden and the sort column is added with jquery after the table has already been generated. Hence it can’t be hidden in the list options because no option was generated for it when the page layout was created. You can, however, activate the “position” column when using drag-sort which is just begging for confusion because it won’t automatically update when you drag and drop.

If you would rather not have the sort options, switch it off in the preferences altogether and you won’t see it at all. You’ll need to assign position manually as before, though.

One option might be to show the list options when drag-and-drop is set to off. Might that be a help?

Incidentally, drag-and-drop sort is also the reason why I haven’t included any paging options (you can’t drag-sort across pages). My thinking was that most sites will have a handful or two of custom fields and that most people would prefer to use drag-and-drop than manual entry. For long lists of custom fields, it’s not optimal. I could activate pagination when drag-and-drop is switched off. It does mean, though, that you will have to use the long-winded manual entering of position numbers. Switching drag-and-drop on or off happens in the preferences so can’t be changed on the fly.

TXP Builders – finely-crafted code, design and txp

Offline

## #28 2018-04-05 06:06:34

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,821
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

###### jakob wrote #310608:

Hmm, maybe. What could be done easily is to simply force it to be on a new line (or perhaps ranged right) with css.

The thing is the preferences table is mighty clever: it basically creates itself from a list of preferences assigned to a particular prefs group. The header is automatically created from the prefs group language string, the prefs labels from the language strings matching the pref, the subheadings likewise from prefs subgroup. The only bit you can adapt to each situation is the input method by creating a custom function for it. (…)

Dang. I was afraid that it was more than complicated :-(. Ok. I am not really comfortable with having that as part of the headline (accessibility, semantics…). But if any other solution is currently out of reach, how about the following: instead of a button, just make it a plain link, floated to the end of the line (on larger screens) – and remove all the other stuff you have for that block):

.check-path {
float: right;
font-size: .7em; /* the font-size then matches normal text with both Hive and Sandspace) */
font-weight: 400;
}
[dir=rtl] .check-path { float: left; }

One other thing I noticed while looking at the glz_custom_fields.js towards the end.

\$glz_select_instructions.html("<a href=\"http://"+window.location.host+window.location.pathname+"?event=prefs#prefs_group_glz_custom_f\">" + GLZ_CF.messages['configure'] + "</a>");

You are forcing the use of http. That is not nice, some people do use https, and what more, with strict Content Security Policies.

This ought to work fine:

<a href=\"//"+window.location.host+window.location.pathname+

Offline

## #29 2018-04-05 08:35:37

jakob
From: Germany
Registered: 2005-01-20
Posts: 3,657
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

Thanks for checking so diligently and thinking of edge cases that I’d not taken into account. I’ve incorporated your various suggestions, updated and expanded the help infos a little, and uploaded new css/js + zip files and recompiled plugins.

TXP Builders – finely-crafted code, design and txp

Offline

## #30 2018-04-05 12:00:28

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 1,821
Website

### Re: glz_custom_fields v2 beta for Textpattern v4.7

###### jakob wrote #310629:

Thanks for checking so diligently and thinking of edge cases that I’d not taken into account. I’ve incorporated your various suggestions, updated and expanded the help infos a little, and uploaded new css/js + zip files and recompiled plugins.

Works nicely and looks better!

(Some this little niggle I found while working on a French textpack – work in progress here)

Offline