Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#316 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

#317 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

#318 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

#319 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

#320 2015-04-25 23:42:05

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

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

For me, this is one of the most useful plugins. In addition that it allows to rearrange all type of form fields in the editable article interface, it also allows to insert little JS or jQuery snippets to change parts of the UI.

An example, which I achieved today a desired solution:

<script>
	$(function() {
		$("textarea#custom-12").attr("placeholder", "Short notice for the input");
		$("textarea#custom-13").attr("placeholder", "Other short notice for the input");
	});
</script>

Maybe that’s nothing new, but I wasn’t aware of this helpful function.

Offline

#321 2015-06-14 23:36:22

lazlo
Member
Registered: 2004-02-24
Posts: 110

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

Here is a bug that has been happening to me with bot_write_tab_customize .7.2. Updating to a new instance of TXP 4.5.7 I came across a bug. The plugin was working perfectly as I organized my 63 custom fields into shape and then for no apparent reason after using the “Advanced/Multiple selection” screen a few time the update button stopped working on either screen (advanced/norma). Hitting update would just kick me out to the write page without saving preferences.

Updated to using mrdale’s mod .7.3 and while it made the UI match hive better the kickout to write tab still continued. If I went back to bot_write_tab_customize tab through the menu, the preferences were not saved BUT if I hit the back button the green flag came up and said “preferences saved” and I thought they were but unfortunately the were just saved in the cache. Reloading the page made the what appeared to be saved preferences disappear.

This happens on Firefox, Safari and Chrome. Is there a log where I can see what is happening after the update button is pushed?

Offline

#322 2015-06-15 14:57:57

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

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

Hi Lazlo,
this seems to be the bug already discussed here.
Is it the case?

Offline

#323 2015-06-15 15:28:12

uli
Moderator
From: Cologne
Registered: 2006-08-15
Posts: 4,316

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

redbot wrote #291555:

this seems to be the bug already discussed here.

lazlo, don’t miss maniqui’s solution some posts deeper there:

maniqui wrote #243861:

Fixed!
[…]
It seems that if you have Suhosing module (some security-related module for PHP which I didn’t know it was installed), you have to edit the corresponding config file (on my system, it was located in /etc/php5/conf.d/suhosin.ini) to raise the corresponding values.
I’ve set them to:

php_value suhosin.request.max_vars 2048
php_value suhosin.post.max_vars 2048

And then, all was good: I was able to post large bot_wtc forms :)


In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links

Offline

#324 2015-12-07 21:04:57

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,192
Website GitHub

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

For people already working with the v4.6 dev version with the new two column admin layout, here’s a tentative first fix for bot_write_tab_customize:

These are the new search and replace bits within the plugin matching phil’s much cleaner admin layout.

$bot_arr_selectors = array(

    'writetab_main_content' => '$("#main_content")',

      'writetab_view_modes' => '$("#view_modes")',
      'title' => '$(".title")',
      'body' => '$(".body")',
      'excerpt' => '$(".excerpt")',

    'writetab_sidebar' => '$("#supporting_content")',

      'save' => '$(".txp-save")',

      'actions' => '$(".txp-actions")',

        'create_new' => '$(".txp-new")',
        'duplicate' => '$(".txp-clone")',      
        'view' => '$(".txp-article-view")', 

      'page_article_nav_hed' => '$(".nav-tertiary")',

      'sort_display' => '$("#txp-write-sort-group")',

        'status' => '$(".status")',
        'section' => '$(".section")',
        'category1' => '$(".category-1")',
        'category2' => '$(".category-2")',

      'date_settings' => '$("#txp-dates-group")',

        'publish' => '$(".posted")',
        'publish_time' => '$(".posted.time")',
        'reset_time' => '$(".posted-now")',
        'expired' => '$(".expires")',
        'expire_time' => '$(".expires.time")',

      'meta' => '$("#txp-meta-group")',

        'url_title' => '$(".url-title")',
        'description' => '$(".description")',
        'keywords' => '$(".keywords")',

      'comment_settings' => '$("#txp-comments-group")',

        'use_comments' => '$(".comments-annotate")',
        'comment_invitation' => '$(".comment-invite")',

      'article_image_group' => '$("#txp-image-group")',

        'article_image' => '$(".article-image")',

      'custom' => '$("#txp-custom-field-group")',

      'advanced_options' => '$("#txp-advanced-group")',

        'article_markup' => '$(".markup-body")',
        'excerpt_markup' => '$(".markup-excerpt")',
        'override_default_form' => '$(".override-form")',

      'textile_help' => '$("#txp-textfilter-group")',

      'recent_articles' => '$("#txp-recent-group")'

);

EDIT: code updated slightly

The indentation is not necessary, just an indication of which bits go where. As before it references each group and most of the items within the groups. If you want to group items within a group of your own, you’ll need to do some custom jQuerying.

And here’s a tentative version that builds on mrdale’s version already made to bot_write_tab_customize – Thanks Dale – which regularised some of the styling to match the rest of txp and added some other saving fixes.

EDIT: code deleted – see later post

Note: this is not backwards compatible with pre v4.6-new-admin-layout versions and may break with future changes to the edit pane. Mr Dale’s version works for earlier versions.

Also note that Phil does offer ways of hiding certain aspects of the write tab with css from the outset by adding lines to config.php. That is more efficient if you want to hide things generally and not just on a per-section basis using bot_wtc.

Redbot, it would be brilliant if you could meld this back into your own version at some point when things are ready. Thanks for all the hard work you put into this invaluable plugin over the years.


TXP Builders – finely-crafted code, design and txp

Offline

#325 2015-12-15 18:40:45

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

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

Hey! I’m using this plugin (v0.7.2) on a site that runs Textpattern v4.5.7 with the Hive admin theme. It still works, despite some hiccups in the past!

I need to add a custom field along with some bot_wtc rules for how it’s displayed, but I’m afraid to edit anything in bot_wtc’s admin panel. Sometimes, when I visit the panel, it spawns a bunch of error popups, and even without those errors, many of the “Item” fields for existing fields are blank. It also appears that the entire set of items is duplicated, doubling the list of display rules.

For those who have it working in 4.5.7 with Hive, what version of the plugin are you using? Do you have any recommendations?

Thank you!

Offline

#326 2015-12-15 18:55:08

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

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

Update—I upgraded my local installation to Mr Dale’s v0.7.3. It looks more beautiful, but the same “problems” remain:

  • It spawns a bunch of popup error messages like this: Internal error "Undefined index: $("p:has(*[name='custom_8'])")". —unless I click “Prevent this page from spawning additional popups” in my browser.
  • The entire list of custom fields I have display rules for is duplicated.
  • And many of the field titles are blank in the “Item” field.

Last edited by johnstephens (2015-12-15 18:55:22)

Offline

#327 2015-12-15 20:30:58

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,192
Website GitHub

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

Any luck with this one that’s working for me on txp v457 (not the 4.6 one from my previous post)?

I vaguely remember having a problem with an older updated site where the bot_wtc_update function had not run properly and the entries in the bot_wtc table were still “old style”. I edited them manually in the database to match the “new style” and the errors disappeared. You can look at the function in the plugin to see how it should be or compare your table with a working bot_wtc installation.


TXP Builders – finely-crafted code, design and txp

Offline

#328 2015-12-15 21:15:57

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

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

Thank you, Jakob! The plugin version doesn’t seem to matter, but you gave me a vital clue anyway. The jQuery selector designated by the Item’s “option” element seems to be out of sync on some fields. I’ll fix those and see if that helps.

Offline

#329 2015-12-15 23:21:44

johnstephens
Plugin Author
From: Woodbridge, VA
Registered: 2008-06-01
Posts: 1,000
Website

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

That seemed to work. I think the fields got doubled when I imported public server data into my dev database.

Thanks again, Jakob!

Last edited by johnstephens (2015-12-15 23:22:06)

Offline

#330 2015-12-16 16:22:59

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

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

Hi all,
I’m sorry for all this issues, I hope in the next few weeks I’ll find the time to update the plugin.
BTW thank you for all your help and suggestions :)

Offline

Board footer

Powered by FluxBB