Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#76 2011-11-20 10:52:40

masa
Member
From: North Wales, UK
Registered: 2005-11-25
Posts: 1,095

Re: adi_matrix – Multi-article update tabs

gomedia wrote:

I reckon a tooltip is definitely achievable, I’ll look into it.

Thanks Adi!

Offline

#77 2011-12-09 19:37:47

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: adi_matrix – Multi-article update tabs

I was getting an “Article update failed” message when trying to save some changes. I tracked it down to a single quote ' on custom field.
A possible solution to this issue:

On function adi_matrix_update_article, circa line 525:

	foreach($adi_matrix_cfs as $i => $cf_name) {
		$custom_x = "custom_{$i}";
		if (isset($data[$custom_x]))
-			$cfq[] = "custom_$i = '".$data[$custom_x]."'";
+			$cfq[] = "custom_$i = '".doSlash($data[$custom_x])."'";
	}

Hopefully, that should be enough.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#78 2011-12-09 21:26:40

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

Hi Julián – well spotted & well fixed. I’ll include it in the next release.

Offline

#79 2011-12-10 16:00:42

phuture303
Member
Registered: 2008-09-14
Posts: 127

Re: adi_matrix – Multi-article update tabs

Hey, I’d like to double the (a most polite) bump… glz 11+? question by mrdale a few months ago. This plugin would be perfect for me when supporting more than 10 custom fields :-) Any chances in the near future?

Have a nice weekend!
David

Offline

#80 2011-12-10 22:08:11

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

phuture303 wrote:

… Any chances in the near future? …

Yes, it probably is time to release the glz_cfs beta version properly. Leave it with me & I’ll do some final checks.

Offline

#81 2011-12-12 01:14:42

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

adi_matrix version 1.0 is now available for download:

  • enhancement: glz_custom_fields compatibility
  • enhancement: force numeric sort (for jpdupont)
  • enhancement: sort by Expires timestamp
  • enhancement: article catagories (for maniqui)
  • enhancement: option to switch on horizontal scroll (for mrdale)
  • fixed: MySQL 4.1 compatibility (thanks colak)
  • fixed: error if custom field contains single quote (thanks maniqui)
  • fixed: superfluous “Logged in user” wildcard option in matrix appearance
  • now uses lifecycle events

I’m hoping that adi_matrix & glz_custom_fields will play nicely together but let me know how you get on. Please note that I haven’t been able to implement the radio button reset function.

The horizontal scroll option is an attempt to cope with wide matrix tabs. It can be enabled on a per matrix basis. Thank you mrdale for the suggestion.

Thanks to everyone who’s been testing this new release for me. It’s very much appreciated. Don’t panic if you get some error messages on install (depending on which beta you’ve got installed) – they should appear only once and can be ignored.

maniqui & masa – I haven’t forgotten your other requests!

Offline

#82 2011-12-12 18:16:25

phuture303
Member
Registered: 2008-09-14
Posts: 127

Re: adi_matrix – Multi-article update tabs

Wow, incredible! Just tested the plugin on a local tryout-installation, everything seems to work fine for me. I’m deeply impressed and thank you so much!

David

Offline

#83 2011-12-14 21:17:21

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: adi_matrix – Multi-article update tabs

Hi Adi,
first of all let me say the more I use this plugin the more I love it,
I’ve just istalled the latest version (I never upgraded after v 0.1) and the improvements are amazing.
For the record I’ve been testing it with glz_custom and all seems to be working flawlessly. I love especially the fact that now checkboxes are rendered as checkboxes, multiselects as multiselects etc.

gomedia wrote:

maniqui & masa – I haven’t forgotten your other requests!

So multiple sections support is a possibility? That would be wonderful, thanks again for a great plugin!

Offline

#84 2011-12-17 23:12:18

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: adi_matrix – Multi-article update tabs

gomedia wrote:

enhancement: glz_custom_fields compatibility

As I wasn’t noticing any kind of compatibility after upgrading to adi_matrix v1.0, I took a look at the plugin’s code to see how the presence (or not) of glz_c_f was being tested.
I found:

$glz_cfs_installed = safe_row("version","txp_plugin","status = 1 AND name='glz_custom_fields'");

That explained why adi_matrix and glz_c_f weren’t playing nice in my TXP install: I’m running plugins from filesystem (plugin_cache_dir), so this kind of test always return false on my install.
Adi, could it be possible for you to add another test to check if glz_c_f is present?
I’m thinking of something like:

$glz_cfs_installed = safe_row("version","txp_plugin","status = 1 AND name='glz_custom_fields'") || function_exists("some_glz_c_f_function");

I’m proposing an OR test using function_exists, but may there be a more bullet-proof of testing the presence of a particular plugin (not relying on the DB and not relying on some particular function)?


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#85 2011-12-17 23:13:24

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: adi_matrix – Multi-article update tabs

In the meanwhile, I think I’ll temporarily hack my copy of adi_matrix and just put:

$glz_cfs_installed = 1;

:)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#86 2011-12-18 00:01:29

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: adi_matrix – Multi-article update tabs

maniqui wrote:

Adi, could it be possible for you to add another test to check if glz_c_f is present?
I’m proposing an OR test using function_exists, but may there be a more bullet-proof of testing the presence of a particular plugin (not relying on the DB and not relying on some particular function)?

I’m thinking of something like:

$glz_cfs_installed = safe_row("version","txp_plugin","status = 1 AND name='glz_custom_fields'") || function_exists("some_glz_c_f_function");

Mmmmm, I’ve tested this but it won’t work unless I make TXP load first the glz_custom_field plugin, for example, by renaming glz_custom_fields.php to something like aaa_custom_fields.php, so it gets loaded before adi_matrix.php.
It works, so certainly, that could be a solution, but if I could avoid it, I’ll be happier :)

Another similar solution could be to test for the presence of a particular glz_custom_fields preference, although the existing ones (in txp_prefs table) have some pretty generic names, and again, doesn’t seem a flawless solution.

So… Adi, to avoid hacking your plugin, this is another solution I can think of: could you consider adding an option (a checkbox to be manually checked) to mark the glz_custom_fields plugin as installed?
In other words, a way to “manually” tell adi_matrix:
“Yes, believe me, glz_custom_fields is installed, don’t worry if you can’t find it at the txp_plugin table. So, adi_matrix, do your extra glz_c_f magic.”


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#87 2011-12-18 00:18:06

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: adi_matrix – Multi-article update tabs

maniqui wrote:

I’m proposing an OR test using function_exists, but may there be a more bullet-proof of testing the presence of a particular plugin (not relying on the DB and not relying on some particular function)?

As you say, relaying on the database row is a bad practice. To check whether particular plugin is installed (and to make sure the code is usable when needed), one can simply use Textpattern’s require_plugin(string $name). I.e.

$glz_cfs_installed = require_plugin('glz_custom_fields');

The function will return (bool) false when required plugin is missing, and triggers a (debugging) notice too. The function will make sure that either;

  • Required plugin exists in the database, and is active. If the plugin is active (or force is set true) and it hasn’t been loaded, it will load the plugin. This is to make sure that the plugin code is actually initialized and available when needed. If force is set true, plugin’s status won’t matter and the plugin is loaded despite it being disabled.
  • Required plugin is in the plugin cache directory. The function will check that file named as $name.php (i.e. glz_custom_fields.php) exists in the directory. If it does, it includes the plugin’s code (file) if it wasn’t already included.

Edit. that $force parameter is from load_plugin().

Last edited by Gocom (2011-12-18 08:09:21)

Offline

#88 2011-12-18 00:31:26

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: adi_matrix – Multi-article update tabs

Gocom, thanks once again for sharing your deep understanding of TXP.

I can confirm that:

$glz_cfs_installed = require_plugin('glz_custom_fields');

works as expected.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#89 2011-12-18 06:46:52

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,373

Re: adi_matrix – Multi-article update tabs

Gocom wrote:

To check whether particular plugin is installed (and to make sure the code is usable when needed), one can simply use Textpattern’s require_plugin(string $name, bool $force = FALSE)

adi_matrix doesn’t require glz_custom_fields to be installed. It only needs to detect if it is installed & then modify it’s behaviour accordingly. And I don’t want error messages if it’s not installed.

If the plugin is active (or force is set true) and it hasn’t been loaded, it (i.e. require_plugin) will load the plugin.

adi_matrix is definitely not going to load any other plugin if the user hasn’t done it themselves already.

As you say, relying on the database row is a bad practice.

Are there scenarios where a plugin exists in the txp_plugin database table, with a status set to “1”, and it’s not actually loaded & active?

Textpattern’s require_plugin(string $name, bool $force = FALSE)

I couldn’t find a $force option to this function in TXP 4.4.1 – is it in an upcoming release?

maniquiWRT the scenario where glz_custom_fields is loaded from the plugin cache – I’m happy to look into other ways of detecting it.

Offline

#90 2011-12-18 08:04:27

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: adi_matrix – Multi-article update tabs

gomedia wrote:

I couldn’t find a $force option to this function in TXP 4.4.1 – is it in an upcoming release?

Nope, sorry my mistake. It’s not parameter of the function at all. It’s from load_plugin() which is what require_plugin() uses. Both are the same thing (aliases) expect that require_plugin additionally returns notices.

adi_matrix doesn’t require glz_custom_fields to be installed. It only needs to detect if it is installed & then modify it’s behaviour accordingly. And I don’t want error messages if it’s not installed.

If you don’t want notices, you can use load_plugin().

$glz_cfs_installed = load_plugin('glz_custom_fields');

Same thing as with require_plugin(); returns true if the plugin exists and is active.

adi_matrix is definitely not going to load any other plugin if the user hasn’t done it themselves already.

require_plugin(), and load_plugin(), will load nothing, or affect loading, if executed on a callback event. After the initial plugin loading is done by Textpattern, you can safely use both load_plugin() and require_plugin() without them doing anything else than checking.

Last edited by Gocom (2011-12-18 08:22:37)

Offline

Board footer

Powered by FluxBB