Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#313 2013-03-25 09:46:46

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

Re: bot_write_tab_customize: rearrange and style items in the write tab

Dale + Ross,
sorry I can’t help you at least for the next week. I’m overwhelmed with work and I can barely follow this forum.
Hope I’ll find some free time soon ok?

Last edited by redbot (2013-03-25 09:47:18)

Offline

#314 2013-05-01 21:20:35

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: bot_write_tab_customize: rearrange and style items in the write tab

Bumpidy Bump… itching to get this functional again. with hive and 4.6ish

Offline

#315 2013-05-10 04:14:22

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: bot_write_tab_customize: rearrange and style items in the write tab

OK, there are really two issues with this plugin…

  1. When loaded the write tab will throw an alert that says “Sorry, the form could not be submitted” (although it actually does save the article.
  2. The rules written out by the plugin replace instances of quote characters (") with it’s entity (") and subsequently fail to work. Stef described it here »

I’ve solved #1 (see Source here) and am living with #2 by simply editing rules directly in phpMyAdmin.

It would be nice to have te admin to to this very useful plugin working again. Anyone?

Offline

#316 2013-05-14 15:54:20

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

Re: bot_write_tab_customize: rearrange and style items in the write tab

Hi Dale,
unfortunately you choose the wrong time to ask for help, sorry
anyway i found some time to download (yes I don’t use svn) the latest development version and have a look.

What I found:

When loaded the write tab will throw an alert that says “Sorry, the form could not be submitted” (although it actually does save the article.

I didn’t experience this issue. Maybe it’s caused by another plugin or the txp codebase has changed meanwhile?
Anyway your mods can’t do no harm, actually they are more elegant and I already planned to introduce them in the next version.

The rules written out by the plugin replace instances of quote characters (”) with it’s entity (") and subsequently fail to work. Stef described it here »

Yes this is really annoying. I see the issue and I still can’t understand what is causing this.
Anyway – as Stef noted – this is happening only if you use the advanced preferences and not if you use the standard mode.
I understand this is more time-consuming but can be a good compromise for now

As for the other issues outlined by Stef

On the configuration screen, when I try to add (say) a custom field to be excluded from some sections I see this error

the issue actually exists and it’s simply due to changes in the “write” page markup.
To solve this just do a quick search and replace
from this:

#section.list

to this:

#section

Finally I discovered another bug which is present also in the current supported version which doesn’ let you uncheck the last section in the “hide in sections dropdown” config.

to fix this replace:

	// updates static sections prefs
        if ($static_sections) {
        	$static_sections_string = implode('|', $static_sections);
		safe_update('txp_prefs', 'val= "'.$static_sections_string.'", html="text_input" ', 'name = "bot_wtc_static_sections"' );
        }

with:

    	if (is_array($static_sections)) {
    		$static_sections_string = implode('|', $static_sections);
    	}
    	else {
    		$static_sections_string ='';
    	}
	safe_update('txp_prefs', 'val= "'.doslash($static_sections_string).'", html="text_input" ', 'name = "bot_wtc_static_sections"' );

That’s all for now.

For anyone following this thread please notice that all this issues are not present in the current textpattern version but only in the development unstable version

Offline

#317 2013-05-14 18:52:57

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: bot_write_tab_customize: rearrange and style items in the write tab

cool… I did wonder though, why do we look for names with this kind of rule

$("p:has(*[name='custom_2'])")

wouldn’t the simpler to use the id of the cf field?

$('p').has('#custom-2')

…which has the added advantage of not needing to check the input type and present a different scenario for “custom_2[]” and would probably avoid the quote entity encoding.

In that case instances like this

$selector = '$("p:has(*[name=\'custom_'.$cf_number.'\'])")';

could be simplified to

$selector = '$(\'p\').has(\'#custom-'.$cf_number.'\')';

What do you think?

Last edited by mrdale (2013-05-14 18:54:40)

Offline

#318 2013-05-14 21:02:49

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

Re: bot_write_tab_customize: rearrange and style items in the write tab

mrdale wrote:

cool… I did wonder though, why do we look for names with this kind of rule…

…because ids for custom fields were introduced just recently and I wanted to maintain backward compatibility until possible. Furthermore this had to do with other changes made by glz_custom_fields which I can’t remember well now.
Anyway yes, the time has come for a jquery refresh which hopefully will be addressed in the next release.

Offline

#319 2013-05-14 21:58:48

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: bot_write_tab_customize: rearrange and style items in the write tab

gotcha… I see

Offline

#320 2013-11-25 03:58:08

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: bot_write_tab_customize: rearrange and style items in the write tab

mrdale dijo:

That works… I’m still having an issue with one multi select but I think I know what the issue is… The multi select that won’t be hidden is dynamically generated by a glz custom script…

I have the same issue with a “glz_custom_field_script” custom field.
Have you been able to fix it?
Regards

Offline

#321 2013-11-26 13:02:28

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: bot_write_tab_customize: rearrange and style items in the write tab

Hi everyone
I have an issue with a custom field created with glz_custom_field. This field is based on a custom script (such as the my_images.php script that glz_custom_field brings as example). With this new custom field, I no have any control using “bot_write_tab_customize” to hide or arrange to other position. It would seem this issue is due to just “glz_custom_field_script” fields.
Anybody does have the same problem?
Does it have solution?
I look forward your comments
Best regards

Offline

#322 2013-11-27 17:14:20

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: bot_write_tab_customize: rearrange and style items in the write tab

You can do a lot of rearranging of the write tab using jquery/javascript. This includes selective show/hide custom fields generated by scripts but can also be to add subheads to groups, etc…

here’s what I do.

<script type="text/javascript">
$(document).ready(function() {
	//rearrange a custom field generated by a script
	$("p:has(*[name='custom_24[]'])").insertBefore($("p:has(*[name='custom_20'])"));
	//hide a custom field generated by a script
	$("select#section").change(function(){
		var value = $("select#section option:selected").val();
		if (value!="my_section"){$("p:has(*[name='custom_24[]'])").hide();}
		else{$("p:has(*[name='custom_24[]'])").show();}
	});

	//replace underscores with spaces in custom field names
	$('#custom_field p label').each(function(){$(this).text($(this).text().replace('_',' ') )});

    //add some subheads for groups of custom fields
	$("p:has(*[name='custom_10'])").before('<h2 class="cf-my-section">Subhead 1</h2>');
	$("p:has(*[name='custom_13'])").before('<h2 class="cf-my-section">Subhead 2');
	$("p:has(*[name='custom_20'])").before('<h2 class="cf-my-section">Subhead 3</h2>');

	//hide those subheads when you're not in the section they pertain to
	$("select#section").change(function(){
		var value = $("select#section option:selected").val();
		if (value!="my_section"){$('h2.cf-my-section').hide();}
		else{$('h2.cf-my-section').show();}
	});
});
</script>

Last edited by mrdale (2013-11-27 17:18:53)

Offline

#323 2013-11-27 18:48:06

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: bot_write_tab_customize: rearrange and style items in the write tab

Thanks Dale for replying
I’d need a little help to solve my issue.
I have the “custom-7” field who calls the script and I’d want to place it after the “custom-4”. Also I’d want to show it just in section “avisos”.
With my tries, this custom-field always appears hide :(
Could you help me with the code how it sould be?
I’d really appreciate it
Regards

Last edited by gfdesign (2013-11-27 18:52:15)

Offline

#324 2013-12-02 13:00:52

gfdesign
Member
From: Argentina
Registered: 2009-04-20
Posts: 401

Re: bot_write_tab_customize: rearrange and style items in the write tab

Finally, I got it.
My code stayed so, and it works for me:

<script type="text/javascript">
$(document).ready(function() {
	//rearrange a custom field 
	$("p:has(*[for='custom-7'])").insertAfter($("p:has(*[for='custom-4'])"));

	//hide a custom field generated by a script in "avisos" section
	$("select#section").change(function(){
		var value = $("select#section option:selected").val();
		if (value!="avisos"){$("p:has(*[for='custom-7'])").hide();}
	});
});
</script>

Many thanks
Regards

Last edited by gfdesign (2013-12-02 15:27:19)

Offline

Board footer

Powered by FluxBB