Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2012-03-26 19:16:14

kr37
Member
From: Colorado
Registered: 2011-11-06
Posts: 28

How do I add new elements (such as a pop-up form) in the Write tab?

{Edited to add: This thread began in the bot_image_upload topic where it was a little too much OT, but it deserves its own place. – Uli}

I’m coming up with more of a GUI for picking the dates for smd_calendar, but I can’t figure out how to incorporate it into the write tab. It seems what I want is the way bot_image_upload integrates with the write tab. Can anyone give me some hints? Thank you!

Last edited by kr37 (2012-03-30 04:30:58)

Offline

#2 2012-03-26 22:31:27

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

Re: How do I add new elements (such as a pop-up form) in the Write tab?

kr37 wrote:

I’m coming up with more of a GUI for picking the dates for smd_calendar, but I can’t figure out how to incorporate it into the write tab.

Is this the wheel?


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

Offline

#3 2012-03-27 15:43:35

kr37
Member
From: Colorado
Registered: 2011-11-06
Posts: 28

Re: How do I add new elements (such as a pop-up form) in the Write tab?

uli wrote:

Is this the wheel?

Thank you, that helped. I do like and use msd_admin_datepicker. The datepicker itself isn’t the solution in this case (the GUI allows custom times/text/repetition for smd_calendar). But now I understand that to insert something into the write tab, I need some javascript like lines 65 to 125 of msd_admin_datepicker or starting at about 293 on bot_image_upload. I really don’t know javascript, but can copy people. Is there anything written about this? Thank you (and again sorry for using this forum).

Offline

#4 2012-03-27 16:36:22

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

Re: How do I add new elements (such as a pop-up form) in the Write tab?

Hi kr37,
I’m sorry but I didn’t understand well what you’d like to accomplish. Also I never used smd_calendar so I fear I can’t be of much help here.
My first thought was to direct you towards msd_admin_datepicker, like Uli did (BTW thanks Uli!) but it seems that’s not the right answer for you.
The only thing I can suggest now is to use my other plugin bot_write_tab_customize which will allow you – among other things – to insert javascript directly in the write tab. Of course I can’t give you a better advice now, given that I don’t know precisely what are you looking for. Maybe you want to be more precise?

Offline

#5 2012-03-27 16:50:24

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

Re: How do I add new elements (such as a pop-up form) in the Write tab?

kr37 wrote:

But now I understand that to insert something into the write tab, I need some javascript like [snip]

… or a helper plugin like jmd_admin_js. It’s based on the presence of another plugin, stm_javascript, whose link you’ll find in the initial post. I recommend a look at its short code (once installed) probably good for learning from/dismantling and realizing.

Edit: Ah, redbot was faster. And probably you’ve bot_wtc installed already, so that’s better than two new ones.

Last edited by uli (2012-03-27 16:52:51)


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

Offline

#6 2012-03-27 17:12:19

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: How do I add new elements (such as a pop-up form) in the Write tab?

Sounds like we just need a better understanding of what is needed, probably because none of us use smd_calendar, then we could help you solve it.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#7 2012-03-29 16:57:57

kr37
Member
From: Colorado
Registered: 2011-11-06
Posts: 28

Re: How do I add new elements (such as a pop-up form) in the Write tab?

Thank you uli, Matt, and redbot,
Those tips were what I needed. Using jmd_admin_js and stm_javascript and putting the following in a js called article inserts a button onto the write tab. Now I just need to learn how to write the js that will make it do what I want. Thanks so much!

function insertAfter(referenceNode, newNode) {
    referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}

var el = document.createElement("input");
el.type = "submit";
el.value = "Enter Calendar Info";
var div = document.getElementById("custom-5");
insertAfter(div, el);

Offline

#8 2012-03-29 17:06:59

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: How do I add new elements (such as a pop-up form) in the Write tab?

You can use jQuery, which is included with Textpattern, to simplify writting this type of javascript.

$("#custom-5").after("<input type='submit' value='Enter Calendar Info'/>");

My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#9 2012-04-07 06:31:31

kr37
Member
From: Colorado
Registered: 2011-11-06
Posts: 28

Re: How do I add new elements (such as a pop-up form) in the Write tab?

Thanks for the tip, Matt, that’s much more concise! Sorry I’ve really had my hands full for a few days.

Offline

#10 2012-04-16 13:22:06

kr37
Member
From: Colorado
Registered: 2011-11-06
Posts: 28

Re: How do I add new elements (such as a pop-up form) in the Write tab?

Hi, I’m still working on this same project, have now learned a bit of ajax. I need to know the article number of the article being edited on the write tab. Is there a way to get that while the write tab is first being generated, or do I need to use ajax with the URL-only title, and query the database to get the article id? Thanks for any suggestions!

Offline

#11 2012-04-16 13:30:43

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,809
Website GitHub

Re: How do I add new elements (such as a pop-up form) in the Write tab?

kr37 wrote:

Is there a way to get that while the write tab is first being generated

If you mean, “first visit, showing blank” then no the article is only assigned an ID after you hit Publish so you can’t find out which one it will likely become. But yes after save, the ID is available. Try this PHP line:

$id = (empty($GLOBALS['ID']) ? gps('ID') : $GLOBALS['ID']);

$id will then contain the ID of the article being edited which you can use anywhere you like. Take a look at smd_article_stats for hints.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#12 2012-04-17 20:00:19

kr37
Member
From: Colorado
Registered: 2011-11-06
Posts: 28

Re: How do I add new elements (such as a pop-up form) in the Write tab?

Thanks, Bloke! I think smd_article_stats will give me enough to go on.

I would prefer to use the php you’ve provided, because I’m getting an awful lot of plugins going. However, I don’t know in what way I could incorporate it into the write tab without deeply dissecting txp’s internals. Any tips there?

Anyway, thanks for the help!

Offline

Board footer

Powered by FluxBB