Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#46 2013-10-24 15:46:01

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

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

Perfectly chilled. Just took exception to the idea that TXP devs shouldn’t be bothered by something so trivial, when this is something that has been requested for a very long time by many people.

So sans sarcasm, I think that the current crop of devs are doing an awesome job of transforming TXP into something far better than it has been. Kudos.

(As politely as possible and as a genuine question…) Since you bring up “create new”… by your own logic… why is that there? It performs the same function all you have to do is click on “Write” nav in the same page?

Last edited by mrdale (2013-10-24 15:46:38)

Offline

#47 2013-10-24 16:14:43

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

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

It’s always been there I guess.

Offline

#48 2013-10-24 18:08:21

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,443
Website GitHub

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

philwareham wrote:

It’s always been there I guess.

We do have ‘Create New’ on Form/Page/Styles (which do the same thing as selecting the respective panel name from the menu) so maybe that’s the reason. Somewhat superfluous, but reasonable UX.

Anyway, when I did the Duplicate (a.k.a. Clone) feature for the Presentation elements, I actually planned that similar logic could be applied to the Write panel. My sketchy outline was:

  • Next to the Article Title, add a Duplicate link.
  • Any changes you have made to any fields prior to hitting Duplicate are copied to the new article.
  • If you hit that link without changing the Title, a new article is created with _copy appended to the Title (although Jukka’s facility of appending the ID maybe has more merit). This is reflected in the URL Title too.
  • If Status was previously set to Live or Sticky (a.k.a visible on the public side), set it to Draft, else leave it as you set it.
  • Leave Posted/Expiry date and timestamp exactly as they are set in the article (i.e. the same as the original article unless you’ve altered them prior to hitting Duplicate), unless you’ve selected the reset to now option. This preserves people’s hard-crafted work if they are using the timestamps for article order on a portfolio site or as an event system in a calendar or whatever.
  • Clear the last modified information.
  • Set a new blog_uid.

To me, those are the most sensible defaults because it makes the fewest assumptions on workflow, besides that duplicating an article doesn’t automatically publish it.

Anyone think any differently? Have I missed any obvious use cases or unforeseen problems with the above?

Last edited by Bloke (2013-10-24 18:19:20)


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

Hire Txp Builders – finely-crafted code, design and Txp

Offline

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

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,565
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: 12,443
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.

Hire 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: 12,443
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.

Hire 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,316

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,723
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,316

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,675
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,675
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: 12,443
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.

Hire Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB