Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [request] Save As, Save New button for 4.5+
Ok Stef, a simple link in line with how it works on 4.6 pages, styles etc. works for me. It’s a consistent UI pattern then. Feel like patching it in?
Offline
Re: [request] Save As, Save New button for 4.5+
philwareham wrote:
Ok Stef, a simple link in line with how it works on 4.6 pages, styles etc. works for me. It’s a consistent UI pattern then. Feel like patching it in?
Sure. I’ll wait a wee while just in case I’ve missed anything obvious. Someone’s bound to spot an error in my thinking.
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
Re: [request] Save As, Save New button for 4.5+
Bloke wrote:
If you hit that link without changing the Title, a new article is created with _copy appended to the Title
That creates collisions. Just merely adding copy to name, title or URL can not work. You can neither count the items; that then creates a race condition. Unless you want to lock the table during cloning of course.
You may actually want to lock the table — you will have to anyways. You know, the relational meta storage (custom fields, partials); those will require locking, or unique index at least. If you aren’t locking (or at least creating unique indexes of article_id + custom_id), two words: race condition which leads to eventual table corruption.
although Jukka’s facility of appending the ID maybe has more merit
No, it doesn’t, but it avoids collisions. Its the only unique, collision preventing value I can use. Other option is locking the table (both read and write), and make sure the new title/url is free. I didn’t do that because it locks reads too, locking the whole site.
Last edited by Gocom (2013-10-25 10:47:55)
Offline
Re: [request] Save As, Save New button for 4.5+
Gocom
Good point: multi-users. Table locking it is, I guess. That goes for the Pages/Forms/Styles too so I’ll have to revisit the duplicate feature there and fix them.
I despair relational databases sometimes…
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
#53 2014-02-11 15:00:40
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: [request] Save As, Save New button for 4.5+
yab saves the world. (Again.)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: [request] Save As, Save New button for 4.5+
uli wrote #278817:
yab saves the world. (Again.)
At least that gives etc_query
some brief respite from being a superhero plugin, eh?
Offline
#55 2014-02-12 14:19:01
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: [request] Save As, Save New button for 4.5+
LOL :)
Pulitzering for the Textpattern swag store.
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: [request] Save As, Save New button for 4.5+
etc_query
is so underemployed these days that it gives it some fancy ideas… Sorry for OT, but Pete’z got the power now! ;)
Offline
Re: [request] Save As, Save New button for 4.5+
etc wrote #278882:
fancy ideas … but Pete’z got the power now! ;)
I can only imagine the generous donation that Matt & Co. must have provided to give such fancy ideas! :P
{404ing link repaired. – Uli}
Last edited by uli (2014-02-12 19:26:39)
Offline
Offline
Re: [request] Save As, Save New button for 4.5+
:)
Offline
Re: [request] Save As, Save New button for 4.5+
In case anyone watching this thread missed it, r5736 adds the ‘duplicate’ (a.k.a. clone, a.k.a. save as) feature to the Write panel. It tries to take the path of least resistance and will just take anything that is in the current form fields, directing them to a brand new article. It appends the new article’s ID to the Title (and also the url-title) so you can distinguish it from the original, and if the original was already published then the clone becomes a Draft, otherwise the status remains as you set it.
This does introduce one extra pre-publication step (renaming the article from both the Title and url-title meta fields) but I couldn’t think of a neater way round it, given that a duplicate URL is undesirable and any “check if the name isn’t already taken” gymnastics could end in a race condition between two users who happen to clone an article to the same name at the same time.
If anyone has any further improvements on this workflow, please holler.
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