-
Notifications
You must be signed in to change notification settings - Fork 5
Automatically create associations of selected languages #4
base: staging
Are you sure you want to change the base?
Conversation
…multilingual_association into modal
…multilingual_association into modal
Hmm, one afterthought. |
@@ -99,6 +99,10 @@ | |||
<?php if ( ! $isModal && $assoc) : ?> | |||
<?php echo JHtml::_('bootstrap.addTab', 'myTab', 'associations', JText::_('JGLOBAL_FIELDSET_ASSOCIATIONS')); ?> | |||
<?php echo $this->loadTemplate('associations'); ?> | |||
<a class="btn btn-primary" data-toggle="modal" role="button" href="#ModalSelectArticle_auto_associations" title="Test Auto Association"> | |||
<span class="icon-file" aria-hidden="true"></span>Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace hard coded Title and Name by a Language Key like _MAKE_ASSOCIATIONS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it 👌
@infograf768 Coding is not finished yet and sorry about confusion 😛 . I'll complete this in later commits. |
I wish you good luck. This is imho redundant with com_associations with very important side-aspects. If some improvements have to be done, it is there. |
@coolcat-creations I haven't found this bug ... You could try PR #3 in which I fixed some bugs. |
Probably something wrong with my checkout... I can't create a new content language and the fallback field is missing too. |
@coolcat-creations please check your database if you had an older version. The table #__languages must contain a field fallback_lang: CREATE TABLE @Wang-Yu-Chao why is this field char(7)? Wouldn't it be better to use a ID of the respective language? |
@chmst I use the same type as |
I see I have the field in the database - but strangely not in the view - although I checked out this PR... |
name="state" | ||
type="status" | ||
onchange="this.form.submit();" | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have the state "archived"? If not, use filter="*,0,1,-2"
Hi guys, |
Tested again. As I already noted, the article is still just copied with a different name and alias, but with the same category which makes the feature useless. I guess that in the case of articles, a solution could be that each language in the modal should have a Select/Create for its category and that the modal would throw an error if no category is defined when using Create an therefore prevent creating the new associated languages. It means that for other type of items we would need : IMPORTANT: Note that the only advantage vs com_associations is that one would create multiple associated items at the same time with an improved title/alias. It would never save the effort to edit each item as it is only a copy of the original. We still have an issue in 4.0 displaying the associations for categories, whether in the cat manager or the tab when editing a category. See joomla/joomla-cms#20692 Question: What is the difference between a simple BTW: the instance of 4.0-dev used for staging is quite old. |
@infograf768 thanks a lot! Associated Categories Remember Option: Only ask once, remember for later Loading Root Article Contents until translation is done
I would say, in the first moment it's even not a real copy. Until the user opens the associated article, this "link" should show always the contents from the parent with a message that the content has not been translated yet. Just if the user opens the associated article he can load the root articles text into it and change it / and or paste the translation in. How could that possibly be solved? If the not translated article is called and has a translation missing flag it will show automatically the contents of the root article with the message that the content has not been translated yet. If the user opens an article with a translation missing flag it will be empty, but has a button to load in the root article data into all fields (editor, custom fields) if wanted. This button should be able to be hooked in by extension developers so someone could do a google translate or whatever button to retrieve translated contents. The user can change the translation state/flag to translated after work is done. (Maybe with Joomla Workflow component) If the root article is changed AFTER the associated article with translated flag the associated article will get a translation outdated flag. The user will be able to check the changes and to remove the translation outdated flag if wanted. If wanted a "this translation might be outdated" message can be displayed above each content with a translation outdated tag. |
This would require categories to be already associated. Therefore making the feature more complex. An error message is not the solution imho. Specially saying that the article is created in the same category. Remember: A site can have a category set to All languages containing items set to different languages, but it is not advised at all as it may have unforecasted consequences when drilling down/up. Please consider my proposal instead. It is much safer and easy to implement. For the rest, I stand with my former comments: you are creating here a very heavy alternative to com_associations instead of improving it. As I see it, what we simply need is, IN BACKEND, to tag with a translated flag (OK flag for me) the associated articles when saved the first time and it is good to go (and generally the associated items) and a translated oudated flag (Modified Reference flag for me) when the reference item has been modified. Flag that would be changed when the associated item is saved again. These flags should show in the Managers as well as in com_associations. Proposing in frontend an associated item which is not complete at all should just be forbidden. The item should be unpublished. I guess you are not expecting what I am saying here, but we have to be realistic and centralize features in joomla. Com_associations is in core to be used and improved. You want to create associations automatically, still incomplete?, do it there. They will be ready to edit to fit. Tag with Complete or Incomplete, and Outdated when the reference item has been modifed and we all will get what we want. |
Hi infograf768, |
Yes, thats what I wrote above. Either you have associated categories or the items will be put into the same category. It would not make much sense to define only one category for all other languages (thats how I understood your proposal). Either the user had built up a structure before and when saving a category the user accepted joomla to create the automatic associations for those - or the user did not do this because he has only one category for all items then they will be created in there. I did not speak about an error message at all. |
This is not what I meant. Sorry. My fault. The screenshot may be wrong. I proposed to add IN the modal a way to choose or create the category for each item. The Select/Create category should in fact display for each item. I guess the reason I did not add it for the first item in the screenshot is because that item was already associated the old way and it had a category (the correct one).
That, for me, IS de facto an error message. Adding a French article in an English category is definitively wrong. |
As it's part of com_associations I am not sure why you would see it as an alternative.
Ok I think with the flagging we have the same opinion ?
Let the site owner decide if it's unpublished or not. Like you see, Amazon is doing that too. They provide the english content to the german customer and state above that the translation is in progress. In my eyes a very good customer service because at least I have something to read into even if its not translated yet. Reference Link for french: https://developer.amazon.com/fr/docs/custom-skills/speech-synthesis-markup-language-ssml-reference.html
Yes, thanks - thats indeed great we can think of that too...
I don't think the user comes always from a "switched" state. He probably is browsing the website all the time in his own language and would never think of that the other language provides more information than the site he is browsing. Providing the whole content set (if the siteowner wants to do that) is a good customer service. You might not see this useful from english to other languages but often backwards. Example: Someone has a website in 5 languages (Spanish, Italian, Chinese, German, English) - Now Austrian and Turkish will be added. Fun fact about Austrian is, that it's 98% like German - so it would be need only 5 items/articles to be "translated" and the other 1500 items pointing just to the german contents. And not to the copy of that items, because this would mean you have to maintain always the copys too. In that case the siteowner would disable even the "not translated yet message" There would be 1500 associated items that only function as "pointers" - Next Example for turkish: The turkish company is perfectly happy about having the Homepage, the Contact Page and the Page about the Company in turkish, everything else will be shown in english (because it will be not possible to translate 1500 items in short time). But how should the user know that other contents exist? Solution: Turkish falls back to the English language and points to the contents of those items. Maybe one of those pages will be amazingly popular (page hits) and so the company knows that it would be probably better to translate the articles above xxxx page hits. Reading your comments I think we are quite on the same track but maybe a meeting on skype or some kind of hangout will help us to figure out the specific needs, concerns and to figure out things faster? |
Yes, depends how the users work... but you are right. I would expect the user to have associated categories too. So we could manage it like that: If the category has no associations the modal proposes to create the associated categories too ? Is that a solution? |
@joomleb Thanks and appreciate your comments about the project too. But from what I can say we will NOT provide 3rd party translations services in Joomla. But thats something that definetly will be considered to put at least something to "hook into" for 3rd party developers. But not provided by core. To break the scope of this GSoC down to just one sentence it's focusing on: Everything else is an absolutely nice to have and I am looking forward to push things forward also after GSoC. The part about "outdated" flags and information is a part that is thankfully done by our great Mentor Lavinia, who is working on that part for her Bachelor degree on the university of Gießen. |
Hi Elisa, In my "resumen" #3 (comment) and in the reply to jreys #3 (comment) there are my suggestions, my opinions and a lot of questions... |
Hi @joomleb, Pretty sure Elisa wasn't trying to be offensive 🙂 The reason for not depending on 3rd party services/software is because of the constant evolution and having to adapt to it, by using those 3rd party services while making some stuff easier (the translations) and more direct, imagine if one of those services completely changes. The way it is included into this component has to be changed, some sites could break before a patch could fix that, do you understand? I know ReCaptcha is being used but it's more about safety (against bots, etc.), TinyMCE is a lib and as long as it has a stable version there are no problems using that! Google/Bing translate are a good plus to have but they don't solve a real problem, they just make things easier. That's why being dependent on such things is not advisable, if a 3rd party extension wants to do that sure, but it won't be associated to Joomla core 😉 Btw your english is alright, I've seen worse 😂 |
It would be a good idea to discuss indeed on skype or glip as I think we are not on the same track concerning the fallback language, the reference language, the place where to create automatically the associations, the select of categories, etc.. |
$this->filterForm = $this->get('FilterForm'); | ||
$this->activeFilters = $this->get('ActiveFilters'); | ||
|
||
if (!Associations::isEnabled()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So many uncommented lines, don't forget your code will be read by other people and it's hard to modify code that you don't know what is doing.
I suggest you do the following:
// Comment
<block of code>
For example:
// Getting form data
$name = $input->get('name');
$age = $input->get('age');
// Sanitizing name
if (strlen($name) === 0)
{
\JFactory::getApplication()->enqueueMessage(\JText::sprintf('ERROR_MSG_NAME', $link), 'error');
}
// Sanitizing age
if ($age < MIN_AGE || $age > MAX_AGE)
{
\JFactory::getApplication()->enqueueMessage(\JText::sprintf('ERROR_MSG_AGE', $link), 'error');
}
// Preparing an array to store into the DB
$data['name'] = $name;
$data['age'] = $age;
// Store form data into the db
$model->store($data);
This was just an example, not real code, so you can make better comments 😉
if (array_key_exists('support', $details)) | ||
{ | ||
$support = $details['support']; | ||
$this->typeSupports = $support; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not $this->typeSupports = $details['support']
? Doesn't make the code more readable to create an extra var.
if (array_key_exists('fields', $details)) | ||
{ | ||
$fields = $details['fields']; | ||
$this->typeFields = $fields; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
} | ||
|
||
// Store user's decision | ||
if ($remember && !empty($langIds)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This if/elseif code looks a bit repeated, can you find a way to generalize it?
} | ||
|
||
// Store the row. | ||
if (!$contentTable->store()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These 2 ifs could become an OR
:
if (!$contentTable->check() || !$contentTable->store())
{
$this->setError($contentTable->getError());
return false;
}
else | ||
{ | ||
$this->set('decision', ''); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for the else statement, just do $this->set('decision', '');
before the previous IF, also lots of uncommented code, keep it tidy 🙂
|
||
$itemId = $displayData->get('Item')->id; | ||
$modalId = 'associationAddAssociations'; | ||
$modalTitle = 'Multilingual Associations'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why isn't this a language string?
'modalWidth' => 80, | ||
'footer' => '<a type="button" class="btn btn-secondary" data-dismiss="modal" aria-hidden="true"' | ||
. ' onclick="jQuery(\'#associationAddAssociations iframe\').contents().find(\'#closeBtn\').click();">' | ||
. JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</a>' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably the Close button could be simpler:
'<button class="btn btn-secondary" data-dismiss="modal">’ . JText::_('JLIB_HTML_BEHAVIOR_CLOSE') . '</button>
should do it as well and is correct semantic.
@infograf768 Just as a update it seams i have missed this mention here. But joomla/joomla-cms#20692 is not merged yet so also not included in the regularly sync of the master branch yet. |
@zero-24 |
}); | ||
|
||
window.parent['fillFields'](values, remember); | ||
window.parent['closeModal'](); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is an API method to close the modal:
window.parent.Joomla.Modal.getCurrent().close()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dgrammatiko
This PR is obsolete.
All is now done in new branch new-staging.
#6
* Load correct core files of override files (#2) Start implements loadcorefile() in administrator/components/com_templates/Model/TemplateModel.php * CS (#3) Coding Standards * codingstandards * codingstandards (#4) * Test (#6) Phase 2 (2 part) Mechanism to find correct core file and implementation. * Remove Notice: Only available for html-folder * Remove Warning if core file not found (#11) Thanks. So one part of the issue joomla-projects/gsoc18_override_management#12 is done. * Implement the diff view in template manager Implement the diff view in template manager * coding standard (#17) * fix diff (#18) Fix bug in path in case of administrator template override. Fix bug in path in case of administrator template override. * Notification after update and TEST (#16) Find changed files of overridden files and show message. * coding standard (#21) * correction * correction (#26) * Correcthtmlpath (#27) * correction * change oldhtml to newhtml * List of updated override files. (#30) * addcss (#34) * Final Product (#39) Core and Diff view Updated override history list. Quick icon notification plugin. Override control plugin. * save 3 lines :) * New feature show status. (#47) show status in com_template view templates * link * corrected namespace * Button to Switch (#35) * wip add Switcher * wip style switcher * wip style switch make inline and change on off text * wip start with js * wip js * wip delete buttons and make js more robust * wip save to storage * wip delete old code * wip * wip lint * wip css * set default value for switcher * wip make switcher blue * wip * wip * build * correct names * create new functions * fist test code * use onchange * undo installer.min.js * add forgotten new line at the end of css file * correct align * correct compare.es6 - only deleted the toggle part * correct compare.js - only deleted the toggle part * wip * reduce timeout * wrap in funcitons * wip * add use strict to both js-files(compare and toggle) * add the timeout value of 500 again, because 200 are not enought in my case * use css class 'active' for toggle views * add strict * time out for editor * wip * improvments use newActive and switch * correction * width of switcher-spans * correct align * do not use global * wip * removed timeouts * JTEXT to TEXT * forgotton last line * deleted duplicated comments * css fix align * use unnamed functions in es6 * Sql files for fix database (#50) * sql files for database fix * delete space * Suggestion for displaying Dates in view updates files (#52) Correct Dates and do not use date of file any more * Store Date as UTC and show it in server time zone (#57) * modified and created date are created and stored in UTC * convert dates for displaying in model * spar a loop * normalize timezone in view * use language constants for dateformat * JToolbarHelper to ToolbarHelper * CS * namespace * plural * name * clean * text * fx * sin * files * s * Suggestion for language strings (#60) * language strings * correct typo * delete media folder plg_quickicon * add folder plg_quickicon to build/media_src * delete files in media folder * Move media folder - System (#66) * multi * cs * delete files in media folder for joomla toolbar (#67) * Fix button switchers style. (#70) * button * CS * changed uitab.addTab for updated files * Bring back core.js changes. (#69) * core.js * const * fix * form * core * hound * CS * scopr * grid * alpha * cs * lang * only override file * lang * override lang installer * Cs * sub * Update list of core extensions (#71) * Language changes (#76) * update * Update en-GB.com_templates.ini * override JLIB_HTML_PUBLISH_ITEM this is the hover text on the publish icon in the list of files * Change icon (#74) change the icon to use an outline for more consistency * lang * not core (#75) * not core * Update en-GB.plg_installer_override.ini * namespace * cs * Updated files (#82) * Update default_updated_files.php * Update en-GB.com_templates.ini * Update en-GB.com_templates.ini (#81) * Update en-GB.plg_quickicon_overridecheck.ini (#80) * Update en-GB.plg_quickicon_overridecheck.ini (#79) * remove space (#78) * Update en-GB.plg_quickicon_overridecheck.ini * Update en-GB.plg_quickicon_overridecheck.sys.ini * remove hardcoded id * null get function * state * clean * More changes "core" to "original" (#85) * cs * update * plural
Pull Request for Issue # .
Summary of Changes
Create a modal which displays all content languages when clicking "save". Users can select some of them and associations in these languages will be created. This processes can be automated.
Testing Instructions
Expected result
Actual result
Documentation Changes Required