? Language Change ? Pending

User tests: Successful: Unsuccessful:

avatar joomdonation
joomdonation
26 Feb 2021

Pull Request for Issue # .

Summary of Changes

This PR adds support for Save As Copy article from frontend of your site

Testing Instructions

  1. Apply Patch.
  2. Login to frontend of your site using an account which has permission to edit an existing article
  3. Edit the an existing article. Look at the Bottom of the page, if you are using an account which is having Create Article Permission, you will see a new button Save As Copy to allows you to create new article base on that existing article
  4. Press Save As Copy button, confirm that the article is successfully created.
avatar joomdonation joomdonation - open - 26 Feb 2021
avatar joomdonation joomdonation - change - 26 Feb 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 26 Feb 2021
Category Administration com_content Front End Language & Strings
avatar joomdonation joomdonation - change - 26 Feb 2021
Labels Added: ? ?
avatar chnnst
chnnst - comment - 26 Feb 2021

Is it possible to turn off this feature?

Testing Instructions
can you provide data for article base on that existing article?

avatar richard67
richard67 - comment - 26 Feb 2021

@chnnst The testing instructions are complete and clear enough for everybody who is familiar with Joomla.

avatar toivo toivo - test_item - 26 Feb 2021 - Tested unsuccessfully
avatar toivo
toivo - comment - 26 Feb 2021

I have tested this item 🔴 unsuccessfully on 3615d42

Received an error when accessing an unpublished article and then pressing either Save as Copy or Save: 0 Invalid field: Start Featured. The test was done in Beta8-dev updated to 26 February in Wampserver using PHP 8.0.2. However, the same error occurred after the patch was reverted.

The same Author user was able to save a new article without problems and the Publishing tab did not include any Featured option. When teh Author user edited this last article, the Featured option in Publishing showed 'No' and then pushing Save resulted the same error, 0 Invalid field: Start Featured

Will now install the lastest Beta8-dev from scratch for further testing.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar himanshu007-creator himanshu007-creator - test_item - 26 Feb 2021 - Tested successfully
avatar himanshu007-creator
himanshu007-creator - comment - 26 Feb 2021

I have tested this item ✅ successfully on debf2f2

before applying the patch, there was no option named "SAVE AS COPY". After applying the patch , the option showed up and worked as expected.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar chnnst
chnnst - comment - 26 Feb 2021

@richard67 joomdonation Is it possible to turn off this feature?

avatar joomdonation
joomdonation - comment - 26 Feb 2021

@chnnst Don't worry about it. This feature is not accepted yet. If it is accepted and you don't like this feature, you can easy turn it off by implementing a template override.

avatar chnnst
chnnst - comment - 26 Feb 2021

We don't want a template override, we want an option button to turn this feature off.
this feature should be postponed to 4.1 we need j.4 release now.

avatar joomdonation
joomdonation - comment - 26 Feb 2021

@chnnst You do not need it does not mean other users do not need it. This is up to maintainers to decide. You or me do not have the right to make decision.

avatar richard67
richard67 - comment - 26 Feb 2021

The easiest way to switch it off is to use an account for frontend editing who has the permission to edit existing articles but not to create new ones.

avatar chnnst
chnnst - comment - 26 Feb 2021

@richard67 that's awkward way to switch it off, better way is an option button to turn this feature off.

can you provide real life data for article base on that existing article? To understand why you need this feature to be implemented?

avatar joomdonation
joomdonation - comment - 26 Feb 2021

@chnnst Joomla! has Save As Copy option for long time from administrator area. This PR just makes that option available for frontend.

If it is not needed, then people would not open this discussion #28092 . If it is not needed, then Joomla won't need Save As Copy feature in administrator area

You want Joomla 4 to release NOW, so please stop wasting time of other people to answer your questions for nothing.

avatar toivo
toivo - comment - 26 Feb 2021

Not even the Save button is working from the front end for an Author user in an unpatched out-of-the-box full version of Beta8-dev just installed today. The error message is always "0 Invalid field: Start Featured", independent of the state of Featured, whether the Start Featured date was selected from the Calendar icon or not.

I will raise a new item about this error.

Test environment:
Windows 10, Wampserver 3.2.4
Apache 2.4.46c, MySQL 8.0.23, PHP 8.0.2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar joomdonation
joomdonation - comment - 26 Feb 2021

Thanks @toivo . Please open a new issue for that. I will try to look at it later today (please give me a clear instructions to see the error)

avatar chnnst
chnnst - comment - 26 Feb 2021

@joomdonation your new feature which are not needed create new issues, please stop proposing them to j4 but better propose them to 4.1 or later .

We want Joomla 4 to release NOW, so please stop wasting time of other people, and better test release blockers.

avatar toivo
toivo - comment - 26 Feb 2021

@chnnst @joomdonation - The error "0 Invalid field: Start Featured" occurs in an out-of-the-box Beta8-dev in my Windows test environment with PHP 8.0.2, independent of any patches.

Here are the steps I followed:

Beta8-dev full version installed on Wampserver, PHP 8.0.2

Create an Author user.

Content - Categories and create a new category, 'My Category'.

Add a menu item to Main Menu, Create Article and select 'My Category' as the category.
Add a menu item to Main Menu, Category List, and select 'My Category' as the category.
Add a menu item to Main Menu, Category Blog, and select 'My Category' as the category.

Login as the Author user. Create an article from the front end.
The article shows as unpublished and assigned to My Category from the back end.
Publish the article.

Edit the article from the front end as the Author user.
The Featured field has the value No and Start Featured is blank.
Save the article.

Expected result: The article is saved

Result: 0 Invalid field: Start Featured

Go to the Category Blog and edit the article.
Change the option Feature to Yes and leave Start Featured blank.
Save - 0 Invalid field: Start Featured

Go to the Category Blog and edit the article.
Change the option Feature to Yes and select Today from the calendar link in the field Start Featured.
Clickin Save ends with "0 Invalid field: Start Featured"


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.
avatar joomdonation
joomdonation - comment - 26 Feb 2021

Thanks @toivo. I will try to re-procedure the issue myself and get it sorted.

avatar toivo
toivo - comment - 26 Feb 2021

The front end Author user already had the permissions 'Edit' and 'Edit State' to that particle article from Author to Publisher but was unable to save the article without the error. After the user group of this front end user was changed from Author to Publisher, this user was able to save the article without issues.

I will raise this as a new issue now.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar toivo
toivo - comment - 26 Feb 2021

It turns out that giving to the user group Author the permission to Edit State in an article or the category causes the error.

Changed the 'Edit State' permission to Inherited and therefore by calculation 'Not Allowed (Inherited)' in the article and granted the Edit State permission to Author in the category. When the Author tries to save the article from the front end, we get "0 Invalid field: Start Featured."

When the 'Edit State' permission is changed back to 'Inherited' and therefore by calculation 'Not Allowed (Inherited)', the Author user can save the article without any issues.

Perhaps this is not an issue. Should we say that an Author with the permission 'Edit State' should be a Publisher instead? Otherwise we will have an endless number of permutations of items, categories, user groups and permissions that some of our users think should work.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.
avatar joomdonation
joomdonation - comment - 26 Feb 2021

@toivo It is actually an issue with permission checking. I will find a way to solve it.

avatar ceford ceford - test_item - 26 Feb 2021 - Tested unsuccessfully
avatar ceford
ceford - comment - 26 Feb 2021

I have tested this item 🔴 unsuccessfully on debf2f2

I followed the instructions: logged in as Super User, edited Article in Front End and clicked Save as Copy - the new article was not created, any changes were saved in the existing article. I tried again, changed the Title and clicked Save as Copy - the existing article was saved with the new title. I tried in the back-end - the new article was created there. This was using a new clone created a couple of days ago.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar joomdonation
joomdonation - comment - 26 Feb 2021

@ceford You at least need to change Title of the article before press Save As Copy button to have article created, otherwise, you will see an error message

That same behavior is applied for Save As Copy button in the backend.

So in short, you need to change Title of the article (so that a unique Alias will be generated for the new article) to have the article created

avatar ceford
ceford - comment - 26 Feb 2021

@ceford You at least need to change Title of the article before press Save As Copy button to have article created, otherwise, you will see an error message

That same behavior is applied for Save As Copy button in the backend.

So in short, you need to change Title of the article (so that a unique Alias will be generated for the new article) to have the article created

In the backend test I did not change the Title - the system appended (2) to the existing title and created a new alias.

avatar joomdonation
joomdonation - comment - 26 Feb 2021

@ceford OK. I will check that backend behavior to see how it is handled and make adjustment here. Could you confirm that if you change Title of article before pressing Save As Copy, the new article is being created properly?

avatar ceford
ceford - comment - 26 Feb 2021

I am using Multi-lingual Test Data. I tried changing the article title with Save as Copy and it just save the existing article with the new title.

avatar joomdonation
joomdonation - comment - 26 Feb 2021

@toivo Could you please check to see if PR #32524 solves the issue you are having?

avatar ChristineWk
ChristineWk - comment - 26 Feb 2021

@joomdonation steps 1 - 3 = OK, but Step 4: "0 Invalid field: Start Featured."
Tested before: PR #32524 x was successful. Above PR I can't test, because I hv to revert previous PR :-)
What I'm doing wrong?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar joomdonation
joomdonation - comment - 26 Feb 2021

@ChristineWk Thanks for testing. We have a bug need to be fixed first before we can continue with this PR. So please wait until the PR #32524 is merged before testing it again

Many thanks !

avatar simbus82
simbus82 - comment - 26 Feb 2021

@richard67 that's awkward way to switch it off, better way is an option button to turn this feature off.

can you provide real life data for article base on that existing article? To understand why you need this feature to be implemented?

In my case around 200 websites where authors everytime have to redo the same article structure in frontend, because save&copy doesn't exist. Only solution is let they can access to the admin, and this is wrong, really wrong.

avatar infograf768
infograf768 - comment - 26 Feb 2021

Tested, after #32524 was merged.
I don't get a copy at all as is.

If I modify what looks like a typo in form edit
<button type="button" class="btn btn-primary" data-submit-task="article.save">
to
<button type="button" class="btn btn-primary" data-submit-task="article.save2copy">

Then I get an Errror Save failed with the following error: Another article from this category has the same alias (remember it may be a trashed item).

avatar joomla-cms-bot joomla-cms-bot - change - 27 Feb 2021
Category Administration com_content Front End Language & Strings Administration com_content Front End Language & Strings Libraries
avatar joomdonation
joomdonation - comment - 27 Feb 2021

OK. Thanks for the feedback and testing. In the last commit, I addressed the following things:

  • The typo as pointed out by @infograf768
  • After Save As Copy, we are now being redirected back to article edit page, same as the behavior in the backend Save As Copy
  • If you don't make change to title of article before pressing Save As Copy, the new article will still being saved with (2) added to the end.

The PR is now ready for testing. Please help test it again and give feedback. Thanks !

avatar toivo toivo - test_item - 27 Feb 2021 - Tested successfully
avatar toivo
toivo - comment - 27 Feb 2021

I have tested this item ✅ successfully on 07454ef

Tested successfully in Beta8-dev of 27 February on Wampserver using PHP 8.0.2.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar ceford ceford - test_item - 27 Feb 2021 - Tested successfully
avatar ceford
ceford - comment - 27 Feb 2021

I have tested this item ✅ successfully on 07454ef

It works, but...

I think the Cancel button should be a Close button - compare with the back end. I guess that is a separate issue.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar joomdonation
joomdonation - comment - 27 Feb 2021

@ceford Yes. It's un-related to this PR.

avatar infograf768
infograf768 - comment - 27 Feb 2021

Article is now created but I have a phpmailer error :

Screen Shot 2021-02-27 at 10 34 08

avatar joomdonation
joomdonation - comment - 27 Feb 2021

@infograf768 Do you see this same error while creating article from frontend before this PR?

avatar infograf768
infograf768 - comment - 27 Feb 2021

@joomdonation
Nope. And we do not have the issue in backend with or without PR.

avatar joomdonation
joomdonation - comment - 27 Feb 2021

@infograf768 We do not get issue in the backend because when article is created from backend, no email needs to be sent like in the frontend. So somehow, it is related to the code which process sending email when new article is created. I think it is not related to this PR but I will try to find out (don't know where the code for sending email is located yet)

avatar infograf768
infograf768 - comment - 27 Feb 2021

/libraries/vendor/phpmailer/phpmailer/src/PHPMailer.php

public function preSend()

           $this->setMessageType();
            // Refuse to send an empty message unless we are specifically allowing it
            if (!$this->AllowEmpty && empty($this->Body)) {
                throw new Exception($this->lang('empty_message'), self::STOP_CRITICAL);
            }
avatar joomdonation
joomdonation - comment - 27 Feb 2021

@infograf768 We need to find out where in the frontend article creation process email is sent.

avatar infograf768
infograf768 - comment - 27 Feb 2021

Without your PR, I see the same error when creating a new article (and not editing one)

avatar joomdonation
joomdonation - comment - 27 Feb 2021

@infograf768 So it is un-related to this PR. Could you open a new issue for that, I can look at it later. Basically, you might get error when new article is created from frontend. As I mentioned, there is email sent somewhere and email body is empty somehow (maybe related to our new mail template component ?) ?

We can look at it later.

avatar infograf768
infograf768 - comment - 27 Feb 2021

Code is in content plugin public function onContentAfterSave($context, $article, $isNew): void

$model_message = $this->app->bootComponent('com_messages')->getMVCFactory()
					->createModel('Message', 'Administrator');
				$model_message->save($message);

Could you open a new issue for that, I can look at it later.

yep

avatar infograf768
infograf768 - comment - 27 Feb 2021

See #32537

avatar joomdonation
joomdonation - comment - 27 Feb 2021

@infograf768 Thanks. Do we need more test for this PR?

avatar infograf768 infograf768 - change - 27 Feb 2021
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 27 Feb 2021

rtc


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32520.

avatar joomdonation
joomdonation - comment - 27 Feb 2021

Thanks @infograf768 . To maintainers, there is a change in FormController class which is included in this PR. So before merging this PR, please review and make sure that change does not contain any backward incompatibility issue. I opened a discussion for that #32534

avatar rdeutz
rdeutz - comment - 10 Mar 2021

I am moving this to 4.1, we are in beta and this is a new feature. Thank you all who have been working on this and bringing it to the state it is now. But if we want to get 4.0 out of the door we need to make a cut.

Side note: this decision has be discussed in the production department and the maintainers team. It's not just mine even if I support the decision.

avatar rdeutz rdeutz - change - 10 Mar 2021
Title
[4.0] Allow save as copy article in the frontend
[4.1] Allow save as copy article in the frontend
avatar rdeutz rdeutz - edited - 10 Mar 2021
avatar HLeithner
HLeithner - comment - 8 Apr 2021

@bembelimen can you have a look at it and merge it if ok?

avatar joomdonation joomdonation - change - 26 Aug 2021
Labels Added: ? Language Change ?
Removed: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2021
Category Administration com_content Front End Language & Strings Libraries Unit Tests Repository Administration com_admin SQL
avatar joomdonation joomdonation - change - 26 Aug 2021
Labels Added: ?
Removed: Language Change
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2021
Category Administration Unit Tests Repository com_admin SQL Administration com_content Front End Language & Strings Libraries Modules
avatar joomdonation joomdonation - change - 26 Aug 2021
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2021-08-26 03:38:33
Closed_By joomdonation
Labels Added: Language Change
Removed: ?
avatar joomdonation
joomdonation - comment - 26 Aug 2021

Sorry. I merged 4.0-dev into this branch and messed up the PR. Will close this one for now and redo it later.

avatar joomdonation joomdonation - close - 26 Aug 2021

Add a Comment

Login with GitHub to post a comment