Textpattern Forum

You are not logged in. Register | Login | Help

#41 2010-05-28 18:57:58

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,980
Website

Re: adi_variables - Manage TXP variables

Hi gomedia,

not sure if this question belongs to this thread or to wet_quicklink’s thread, but I’ll begin here. :)

I’m trying to add the magic of wet_quicklink to the adi_variable’s “Write -> Variables” tab.
wet_quicklink’s magic is “just” a bunch of JS/CSS added to the page.

By now, I’ve just added this line:

register_callback('wet_quicklink', 'adi_variables_admin');

on wet_quicklink plugin code.

It “works”: it adds the necessary JS/CSS to “Variables” tab, but that’s being added before <html> element. In other words, it adds invalid, not working, markup.

Not sure where to start to track this down.
I appreciate your help. Thanks.

edit: I forgot to add: this is on TXP 4.0.7.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Online

#42 2010-05-28 22:19:16

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: adi_variables - Manage TXP variables

According to the documentation you link to Julián, wet_quicklink only works for 4.2.0+.


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#43 2010-05-28 22:35:10

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,980
Website

Re: adi_variables - Manage TXP variables

Stu, I’m using and old version of wet_quicklink that was already installed in this website, and so far, it works fine on the Write tab. In fact, I’ve also fixed this old version a little, as it wasn’t working in Chrome.

BTW, now that I recall, you have been modifying adi_variables, right? And you also made your way thru TXP backend code (I really suck on the back-end side of this thing).
Do you have any tip or trick to share in this case?

Thanks, Stu.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Online

#44 2010-05-29 08:47:56

thebombsite
Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: adi_variables - Manage TXP variables

Not really I’m afraid Julián. My PHP knowledge is such that I can read the code and understand what it is doing to the point where I can probably modify existing stuff to do what I want but adding or creating new stuff is mostly beyond me. Having said I’m going to have to learn PHP because I’m looking at a completely new plugin to do the same kind of thing but installing the variables as “preferences” so that I have things like “selects” and “radio buttons” available to me but don’t hold your breath. It will take a while. ;)

Why are you trying to combine them?

Last edited by thebombsite (2010-05-29 08:48:50)


Stuart – The BombsiteProText ThemesTextgarden

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#45 2011-03-25 03:11:10

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 898
Website

Re: adi_variables - Manage TXP variables

Version 0.3 now available, which properly handles single and double quotes in variable values.

The format of the adi_variables form (where the vars & values are stored) has changed again, so I would recommend doing a backup before upgrading the plugin – you can use the Backup option in the adi_variables Admin tab to do this but take the “belt & braces” approach and do a manual copy as well. The adi_variables form will be changed to the new format when you do an adi_variable update for the first time.

Upgrading from both 0.1 & 0.2 to version 0.3 is supported.

Offline

#46 2011-03-27 00:15:18

woof
Member
Registered: 2004-08-01
Posts: 127

Re: adi_variables - Manage TXP variables

Hi Adi
Thanks for this update. With the previous version I’ve successfully edited the adi_variables form to reorganise/group the variables in the admin view but now if I make any edits directly in the form, the admin view breaks. If you need more info please let me know.

Offline

#47 2011-03-27 00:26:22

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 898
Website

Re: adi_variables - Manage TXP variables

woof wrote:

With the previous version I’ve successfully edited the adi_variables form to reorganise/group the variables in the admin view but now if I make any edits directly in the form, the admin view breaks.

Hi John, the adi_variables form is still just a form – albeit in a different format (using <txp:variable> tags as containers instead) – so editing shouldn’t cause any issues.

Ordering of entries in the admin tab is something I should look at …

If you need more info please let me know.

Could you send me the broken adi_variables form? I’m happy for you to email it if you wish.

Offline

#48 2011-03-27 22:21:23

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 898
Website

Re: adi_variables - Manage TXP variables

Version 0.3.1 available, which fixes the “manually edited adi_variables form” scenario. Thanks to woof for testing the fix.

Offline

#49 2011-07-22 07:31:41

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 813
Website

Re: adi_variables - Manage TXP variables

I’m loving this – Thanks gomedia :)

I know it was mentioned on the first page – but adi_variables would be godly if it was possible to cross it with glz_custom_fields (especially for creating themes with options)

Possibilities would be endless

(if this board had icons, I’d use the hide behind the sofa one)

Offline

#50 2011-10-06 17:56:18

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,980
Website

Re: adi_variables - Manage TXP variables

Hi Adi et all.

Here is a mod to v0.3.1 that makes adi_variables to update the “lastmod” preference when a variable is added/modified/deleted.
This mod makes adi_variables play nice with aks_cache, in the sense that, with this mod, the “Reset cache if site was updated” will be triggered (when visiting a page in front end) if you added/modified/deleted a variable.

           if ($step == 'update') {
		$new_name = trim(ps('new_var'));
		// validate new variable name
		if (strpos($new_name,' '))
			$message = 'spaces not allowed in variable name';
		if (strpos($new_name,'"') || strpos($new_name,"'"))
			$message = 'quotes not allowed in variable name';
		if (ps('ps_name')) // then other variables exist (i.e. this is not the first)
			if (array_key_exists($new_name,ps('ps_name')))
				$message = "$new_name already exists";
		// add new variable to form
		if ($message == '') {
			$new_form = adi_variables_form_update(ps('ps_name'),ps('ps_public'),$new_name,ps('new_value'),ps('new_public'));
			$ok = adi_variables_update(join("\n",$new_form));
			$ok ?
				$message = "updated" :
				$message = "update failed";
		}
                // MOD: update value for "lastmod" preference when a variable is successfully added/updated.
		if ($ok) {
			update_lastmod();
		}
                // END_MOD
	}
	if ($step == 'delete') {
		if (has_privs($admin_privs)) { // double check privileges because this operation uses GET VARS
			$new_form = adi_variables_form_delete($this_variable);
			$ok = adi_variables_update(join("\n",$new_form));
			$ok ?
				$message = "$this_variable deleted" :
				$message = "delete failed";
		}
		else
			$message = "insufficient privileges";
                // MOD: update value for "lastmod" preference when a variable is successfully deleted.
		if ($ok) {
			update_lastmod();
		}
                // END_MOD

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Online

Board footer

Powered by FluxBB