Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#49 2013-10-24 19:15:14

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

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

#50 2013-10-24 19:54:03

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

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

#51 2013-10-25 10:42:13

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

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

#52 2013-10-25 11:01:51

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

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

#54 2014-02-11 15:36:31

gaekwad
Server grease monkey
From: People's Republic of Cornwall
Registered: 2005-11-19
Posts: 4,263
GitHub

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

#56 2014-02-12 14:31:58

etc
Developer
Registered: 2010-11-11
Posts: 5,195
Website GitHub

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

#57 2014-02-12 19:16:09

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

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

#58 2014-02-12 20:16:01

etc
Developer
Registered: 2010-11-11
Posts: 5,195
Website GitHub

Re: [request] Save As, Save New button for 4.5+

maverick wrote #278890:

I can only imagine the generous donation that Matt & Co. must have provided to give such fancy ideas! :P

Every cent of it has been transferred to txp team! Defacing websites is amazingly easy, but it’s all over now.

Offline

#59 2014-02-15 17:59:30

maverick
Member
From: Southeastern Michigan, USA
Registered: 2005-01-14
Posts: 976
Website

Re: [request] Save As, Save New button for 4.5+

:)

Offline

#60 2014-02-18 07:31:30

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

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

Board footer

Powered by FluxBB