Go to content

bot_write_tab_customize

One thing that always buggled me is the rigidity of the textpattern “write” tab.
Once I had to do a site containing – between all other sections – a blog and a movies catalogue.
Well, I knew I could manage all items for the catalogue section (i.e. “author”, “actors”, “plot”, “year” and so on) using a lot of custom fields (with the help of glz_custom_field of course) but the problem was these fields were totally out-of-place when writing a blog post. And I still ended with an incredibly long left column in the “catalog” section. And furthermore I didn’t need a body textarea here…

All this problems could be partially solved with the help of some clever plugins such as sed_section_fields and ied_hide_in_admin but there was still somemething missing.
To make it short I wrote this plugin which allows to rearrange and style items in the write tab, hide them on a per section basis and remove sections from the “write” tab sections dropdown. Used alone or togheter with the above mentioned plugins can really ease txp admin customization.

Note that the rearrange capability is mainly intended to be an intermediate step in the “write” tab customization process. It takes care of page elements that cannot be moved or targeted with simple css. You are so encouraged to fine-tune your customization by modifying the “textpattern.css” file.

Features

A simple example

Suppose you want a giant coloured round-cornered section drop-down as the first item at the top left corner.
Quite easy: first set the rule “section dropdown before textilehelp”, then add one (or more) custom class to the item, let’s say “big rounded” (note multiple classes can be set). Now write some rules in your textpattern.css like:

big{background:#c00 url(images/my_background.gif); color:#fff; font-size:14px; font-weight:bold;}

and finally, if you want to use a jquery plugin for the rounded corners, write something like this in the js box:

<script type="text/javascript" src= "../js/your_jquery_rounded_corners_plugin.js"></script> <script language="javascript" type="text/javascript"> $(document).ready(function() { $("rounded").your_jquery_rounded_corners_plugin(); }); </script>

…and you are done.
The same principle applies if you want to apply other js behavieur (i.e. collapsible menu): first set a class for the elements you want to target and then write the appropriate Jquery (or plain js) code.

Another example

Textpattern 4.3 brought a lot of cool enhancements to the "write" tab but also a few drawbacks.

On the 'enhancement' side almost every item has now an id or a class. This means a snappier jquery execution and, above all, the possibility to hide these elements with simple css. For these reason I highly reccommend - if you want to hide an item in each section - to set a rule directly in your textpattern css file.
For example:

.override-form {display:none;}

Is a lot more efficient than hiding the item in each section using this plugin.

Unluckily there are some little drawbacks in the way the page is designed (IMHO). I'm referring to the several collapsible groups which crowd the 'write' tab.
The issue here is while you can easily hide a group label (well, actually it isn't an html label but an h3) with css, this may lead to trouble if the group is already collapsed. In this case a user will not be able to expand it anymore being there nothing to be clicked.
Of course this is nothing dramatic and can be fixed inserting a tiny jquery rule in the js box. Something like:

<script type="text/javascript">
$(document).ready(function() {
$(".toggle").show();
});
</script>

will keep everything expanded so you can safely hide any label with css (in your textpattern.css file).
Naturally you can also choose to apply this rule only to certain groups (separated by commas) like:

<script type="text/javascript">
$(document).ready(function() {
$("#image.toggle, #custom_field.toggle").show();
});
</script>

Notes

Instructions

Once inatalled and activated visit: “extensions” > “bot_wtc”. Choose an item, choose “before” or “after” and choose another item.

  1. Hi Redbot.
    As always, congratulations for your hard work. I am an admirer of your works/plugins.
    I bother you because this time I am having an issue that I don’t know why or how to solve it.
    Let me tell you, I created a glz_custom_field using an script but I can’t control it using your “bot_write_tab_customize” plugin. I’ve tried in two different site and I get the same result. Even with the script sample brings “glz_custom_fields” plugin (my_images.php)
    If you want to know, I’m using:

    - TXP 4.5.2

    - bot_write_tab_customize 0.7.2

    - glz_custom_fields 1.4.0-beta

    I look forward for your comments
    Thanks in advance

    Fernando | 25 November 2013 #

  2. I’d be happy to donate for you to fix this plugin for 4.6ish svn builds. I’m getting an error on the write page and I rely on this plugin.

    Dale Chapman | 21 March 2013 #

  3. @ferragnoli
    Really? I didn’t notice. Could you describe which changes are you seeing?
    BTW maybe you should post these questions in the textpattern forum so other users can benefit from it.

    redbot | 2 November 2012 #

  4. would you have any idea of the reason why this plugin changes the style of the whole write tab under Txp 4.5..?

    feragnoli | 1 November 2012 #

  5. Hi Ferragnoli,
    I suppose there are still some old entries in the bot_wtc table from a previous ancient install. Uninstalling the bot_wtc table (by pressing the ‘uninstall’ button located at the bottom of the plugins preferences page) should fix the issue.

    redbot | 1 November 2012 #

  6. hello, I’ve just installed version 0.7.2 on Txp 4.5.2 and when opening the Write tab customize Tab I get a bunch of:

    internal_error “Undefined index: $(“p:has(*[name=custom_2])”)”.

    js errors, any ideas why..?
    thank you

    feragnoli | 1 November 2012 #

  7. Hi Dave,
    sorry I didn’t answer before but I missed the notification for your mail.
    Anyway this error message should show only once when you install the plugin for the first time. For the record that’s because the plugin is trying to modify some fields in the bot_wtc table from type “varchar” to type ‘text’ for older installations. The issue is I forgot to check if you were performing a first install or an upgrade.
    Anyway – again – this message should not interfere at all with the plugin once you refresh or move to another page.

    Please let me know if you can confirm this or if the error persists.

    redbot | 22 March 2012 #

  8. Hi Mave, maybe this will fix your issue? I'm sorry but haven’t still had the time to include it in a new version…

    redbot | 20 March 2012 #

  9. Hi, just want to say I love your plugin and it’s been a huge help. I’ve been having one issue with it, though. I’m using glz_custom_fields, and I recently added a custom multi-select field. bot_wtc is not hiding it in the sections it should be, and I was just wondering if you had any ideas why that might be. Thanks!

    Mave | 20 March 2012 #

  10. Hi,

    I’m using TXP 4.4.1 and installing this plugin on a fresh installation. Only one other plugin is installed and active – glz_custom_fields 1.3.0. When I attempt to activate bot_write_tab_customize, I get the following error:

    alter table bot_wtc CHANGE sections sections TEXT

    Warning: Table ‘664932_que_sera_S3R4.bot_wtc’ doesn’t exist alter table bot_wtc CHANGE sections sections TEXT in /mnt/Target01/326401/664932/www.redsquarevt.com/web/content/textpattern/lib/txplib_db.php on line 89

    Any advice would be very much appreciated.

    Thanks for your great plugins!

    Dave Bias | 3 March 2012 #

  11. Hi Roger,
    sorry again for not having answered in so long, this is really a busy period for me.
    Now regarding your question, if I understand correctly your request can be also reformulated this way:

    Can be the item rearrangement tied to the “override form” dropdown instead of the “sections” one?

    The answer is yes, but I don’t see any real advantage in doing so. At least for the way I usually organize sites. That said I understand you may find your approach more productive.

    If you have some php knowledge you can tweak the plugin to do what you want. If you agree with the method I mentioned before you must replace each reference to the sections dropdown to the “override form” dropdown. This should be not too difficult once you understand how the code works.

    If I had more free thime I could be more helpful but sadly this is not the case :( anyway thank you for your suggestion: any improvement idea it’s always appreciated, even when I don’t agree.

    redbot | 9 July 2011 #

  12. My bad! When I re-read my comment, it made little sense to me either! What I was attempting to say is that the plugin would be more flexible if it wasn’t tied to the write tab’s section drop-down. I think if it created it’s own user defined select list in the write tab area, it would free up sections for taxonomy purposes.

    The example I gave goes like this –

    > I use your ‘amended’ plugin (and glz Custom Fields) to rearrange the write tab to accommodate an easy video upload interface.

    > In the plugin options panel, rather than associating / saving this configuration to a TXP section, I create a name / title for it. i.e Video

    > When I go to the write tab, I see in one of the columns a new select list that lets me choose ‘video’. When I select it, the write page rearranges according to how I set it up.

    > Now I can evoke the newly arranged write panel regardless of what section I want to place the article in.

    If this was possible, TXP would truly be one huge leap closer to Custom Content Types. It would also be handy if the ‘amended’ plugin created a new <txp:tag> called, lets be frivolous, <txp:content-type name=“video”> that could call all articles created under that write tab configuration.

    I hope this makes more sense! I also think you could / should fund this sort of development in-line with the GLZ CF method!

    Either way, I just realised I forgot to thank you for the Plugin as it stands. It’s still pretty damn awesome! Cheers!

    roger | 25 May 2011 #

  13. Roger and John,
    first of all sorry for the late reply, I missed Roger’s comment completely.
    That said I’m not sure I understood what both of you are asking for. This plugin is intimately related to the txp “write” tab so using it on another tab would mean writing a completely different plugin from scratch.
    Would you mind explaining better what you are trying to accomplish?

    redbot | 25 May 2011 #

  14. Agree with Roger. Freeing this module from the article’s section, would make it much more flexible.

    john | 23 May 2011 #

  15. Would it be possible to amend your plugin to use, say, a custom field radio select list to determine how to display the write page as oppose to the articles section?

    Many of my sites have different types of content i.e blog posts, videos, reviews etc, and my urls look like this: mysite.com/music/video/article-name or mysite.com/music/blog/article-name. I mite also want to display all videos via mysite.com/videos.

    I’ve avoided txp until now because it can’t natively do this. Your plugin lets me get most of the way there, but I can’t figure out how to achieve the url structure I want whilst using your plugin….

    Any ideas?

    Roger | 11 May 2011 #

  16. Thanx Kreeltje, I’m glad you found it useful.

    redbot | 27 February 2011 #

  17. This Rocks!!

    Thank You!

    Kreeltje | 23 February 2011 #