? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
21 Mar 2017

Pull Request for Issue #14562
and
#14816

Summary of Changes

Implementing an alert to remind the user to save the Target when using the Close button.

Change "Default" to "Undefined" when the Target is not saved when using Copy Reference to Target (I.e. displaying 'Undefined" in the same way as when one deletes a content language and some items were tagged to that language.)

After patch, you should get:

screen shot 2017-03-21 at 16 32 02

@Fedik @alikon @brianteeman

avatar infograf768 infograf768 - open - 21 Mar 2017
avatar infograf768 infograf768 - change - 21 Mar 2017
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 21 Mar 2017
Category Administration com_associations Language & Strings Layout JavaScript
avatar brianteeman
brianteeman - comment - 21 Mar 2017

This doesn't really resolve the problem. Yes it displays a message if you press the close button but if you were to close the browser or the session was to time out you still have the problem. The UI said it was saved but it hasn't been saved in the target language even though the language had been selected

avatar brianteeman
brianteeman - comment - 21 Mar 2017

And now you have a content item with a language of undefined which is just as useless as one of default.

avatar infograf768
infograf768 - comment - 21 Mar 2017

This PR is a possible solution until someone finds a way to save2copy AND port the Target language to the item created.
We must not describe the issue as heavier than it is really. It certainly is not a release blocker:
If closing without save, one just has created an item which is useless and not associated, and existing associations are not touched.

Obviously, if one has a better solution, I will be happy to close this.

avatar brianteeman brianteeman - test_item - 21 Mar 2017 - Tested unsuccessfully
avatar brianteeman
brianteeman - comment - 21 Mar 2017

I have tested this item 🔴 unsuccessfully on 247cef7

Applied the pr
Selected copy reference to target and then it got stuck in a loop of repeatedly trying to copy the article and never completing


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

avatar infograf768
infograf768 - comment - 21 Mar 2017

No loop here. It works fine although it is slow on my machine.

avatar infograf768
infograf768 - comment - 21 Mar 2017

Maybe you did not patch as should?

avatar infograf768
infograf768 - comment - 21 Mar 2017

assoccopyreference

avatar brianteeman
brianteeman - comment - 21 Mar 2017

Tested in two browser with debug on and off (to load the uncompressed js)

I click on the unassociated language icon for an item
the item opens unbelievably slowly and then just keeps refreshing

avatar brianteeman
brianteeman - comment - 21 Mar 2017

strange - just reverted the patch and still have the loop - must be something else. will do a clean install and recheck

avatar dgt41
dgt41 - comment - 21 Mar 2017

@infograf768 what is the real problem here?
The form shouldn't submit if the language is not selected in the right pane?
Let's fix the root problem, instead of trying to mess the UX here.

I think the solution is to get a modal asking what language the new association when pressing the copy reference button. Then do the magic in the controller so that the cancel button won't have any weird effect. This is similar to batch functionality

avatar brianteeman
brianteeman - comment - 21 Mar 2017

The problem is this
You select a language that is not associated to an article from the component list view
You now have the origin on the left and an empty editor on the right with the NEW language preselected
You click on the Copy Reference to Target
After a while you get a message that the article is saved
You look and you see that the Target is set to the intended language
You dont need to make any more changes to the article (you are just doing a quick prototype) so you click close.
Then go to the article manager
You epxect to see the original article in the original language and a copy of the article in the language you selected before associated to it
You actually have the original article in the original language and a copy of the article in a language called Default and there is no association

To prevent this with the current code you have to Select Save Target even though it has already told you it has been saved and it is showing the correct language and you have not made any changes

avatar infograf768
infograf768 - comment - 21 Mar 2017

@dgt41
When one choose Copy to Reference, the js uses save2copy.
But, and its good, as we wanted, the language of the created item is the language chosen for the Target in the form.
The issue is that Save2Copy has not yet tagged the copy to that language. The target exists with an id, its content, but no language yet as the language field is not used when we save2copy
The Target HAS to be saved to get its correct language. Close may only be used after save.

avatar infograf768
infograf768 - comment - 21 Mar 2017

even though it has already told you it has been saved

No, it tells you the reference is saved in its Iframe (in fact it is a draft save preparing the recording of the association) which will become effective only when a full Target with its language is saved.

avatar dgt41
dgt41 - comment - 21 Mar 2017

@infograf768 So the iframe needs to fire automatically a save event in the parent?
Did I ever told you how much I hate iframes?

avatar infograf768
infograf768 - comment - 21 Mar 2017

@dgt41
I sugest you look at the js. For the rest, the GSOC project did not find a better way, sorry.

avatar infograf768
infograf768 - comment - 21 Mar 2017

And I insist once more: Using Save Target is not difficult to learn, and is 99% of the time necessary as many things in the Target created by Copy Reference have to be modified to fit.
Once the alert is displayed, one has no excuse to use Close without thinking...

avatar Fedik
Fedik - comment - 21 Mar 2017

maybe we can try to set new language before call "submit Save2Copy" by javascript, hm

avatar dgt41
dgt41 - comment - 21 Mar 2017

append it to the url and catch it in the controller... (just an idea)

avatar Fedik
Fedik - comment - 21 Mar 2017

the language input already in the form, so it will override URL var during POST request,
but cannot test currently

avatar brianteeman
brianteeman - comment - 21 Mar 2017

OK sorry about that the loop issue was something local not related.

However please consider this

Once the alert is displayed, one has no excuse to use Close without thinking...

  1. The alert has an OK button which when pressed acts as a cancel which I thought you were trying to avoid.
  2. The alert does nnot kick in when you change the target language as described earlier and displayed in the movie below. If you tell me it is saved then I expect it to be saved in the language that was selected AND the language that it is showing me that it is in. This is plain wrong

mmassoc

avatar infograf768
infograf768 - comment - 21 Mar 2017

then let' get rid of copy reference. easy enough. until someone finds a solution. no p for me.


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

avatar infograf768 infograf768 - change - 22 Mar 2017
Labels Added: ? ?
avatar joomla-cms-bot joomla-cms-bot - change - 22 Mar 2017
Category Administration com_associations Language & Strings Layout JavaScript Administration com_associations Language & Strings JavaScript
avatar Fedik
Fedik - comment - 22 Mar 2017

I have made some test, and we can set language by javascript before submit 'save2copy':

else if(task == 'copy')
{
  var reference = document.getElementById('reference-association');
  var target    = document.getElementById('target-association');
  var referenceLang  = reference.getAttribute('data-language');
  var targetLang     = target.getAttribute('data-language');
  var referlangInput = window.frames['reference-association'].document.getElementById('jform_language');

  referlangInput.value = targetLang;

  window.frames['reference-association'].Joomla.submitbutton(document.getElementById('adminForm').getAttribute('data-associatedview') + '.save2copy');
}

also need to comment out (for test)

// Disable language field.
reference.find('#jform_language_chzn').remove();
reference.find('#jform_language').attr('disabled', true).chosen();

But still, the copied article will stay after push the cancel button.
So no idea.
Maybe we just remove "Copy Reference to Target" button for now ? 😄

avatar alikon
alikon - comment - 23 Mar 2017

@Fedik i've tested your snippet and i think in this way we solve the "issue"
that when we push "Copy Reference to Target" without pushing "Save Target"
the target lanuguage is not correctly handled

infact now the copyed item is saved with the correct languge
articles issue administration

i've copyied from IT to EN

so i will go with your patch,

But still, the copied article will stay after push the cancel button.

we should solve one issue at time ;)

avatar infograf768
infograf768 - comment - 23 Mar 2017

Will test.
The Close button is only a Cancel button when some editing has already been done on existing items and Save has not been used. As save2copy has created the item already in db, it does not delete the copy from db.

avatar brianteeman
brianteeman - comment - 23 Mar 2017

Great news @Fedik @alikon

avatar infograf768
infograf768 - comment - 23 Mar 2017

@Fedik
It works for the save2copy.
One aspect to solve is to re-instate

// Disable language field.
		reference.find('#jform_language_chzn').remove();
		reference.find('#jform_language').attr('disabled', true).chosen();

after Copy Reference to Target, as the language field in the reference item is now changeable.

avatar Fedik
Fedik - comment - 23 Mar 2017

As save2copy has created the item already in db, it does not delete the copy from db.

I thought would be good if save2copy also add the association. Then there will not exist a "ghost" articles, after push the Cancel.

avatar infograf768
infograf768 - comment - 23 Mar 2017

@Fedik
We would be in the same situation when manually creating a Target, then save it.
In that case the association is created, but one can still clear the target and choose another item to associate. The item formerly created is still existing in the db.
Therefore I would not worry about that.

More important imho is to re-instate disabling language field after save2copy

avatar infograf768
infograf768 - comment - 23 Mar 2017

@Fedik
Also, what woud be great is to use the ajax-loader.gif while the operation is completing as it may take some time, specially when com_fields are in use...

avatar infograf768
infograf768 - comment - 23 Mar 2017

@Fedik
Please keep me posted on your progress to take a decision about this feature.

  1. We could just take it off
  2. Add an alert when using Copy Reference to Target instead of when using Close.

If we keep it, I have another patch ready to check if the component is using save2copy (in the component associations helper) as some 3rd party components may not be implementing this.

avatar Fedik
Fedik - comment - 23 Mar 2017

@infograf768 I will ping you when will do PR, but I think it will be not faster than weekend 😉

avatar infograf768
infograf768 - comment - 23 Mar 2017

No p. 😄

avatar infograf768
infograf768 - comment - 25 Mar 2017

@alikon
@Fedik has posted a PR here:
#14898

Please test also.

avatar infograf768 infograf768 - change - 25 Mar 2017
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2017-03-25 16:46:07
Closed_By infograf768
avatar infograf768 infograf768 - close - 25 Mar 2017
avatar infograf768
infograf768 - comment - 25 Mar 2017

Clsoing as #14898 solves that issue.

Add a Comment

Login with GitHub to post a comment