Labels |
Added:
?
|
Please set backend language to persian and logout joomla, then again login with persian language!
edit article and save it.
Same. no issue for the date.
BUT I confirm the issue for the modules tabs and this is a big regression!
I can confirm that there is an issue with the persian date.
See how it is displayed within the article view and the article list
I think I saw a similar report with users of the Thai calendar in the forum
Status | New | ⇒ | Confirmed |
Category | ⇒ | Language & Strings Multilanguage |
date has to be tested with debug OFF as there is no uncompressed jalali calendar_setup
Can't find why modules tabs don't show
My tests were with debug OFF
The thai language issue was a JS error and unrelated see http://forum.joomla.org/viewtopic.php?f=706&t=874697&p=3272023#p3272023
I found out that the specifc calendar js file for Persian is the reason why module tabs are broken
Although dates did show OK here, I find this js error in that file.
Timestamp: 27/02/15 10:02:16
Error: TypeError: C.inputField.form.addEvent is not a function
Source File: http://localhost:8888/trunkgitnew/media/fa-IR/js/calendar-setup.js
Line: 11
Issue is this chnage
-JHtml::_('behavior.formvalidation');
+JHtml::_('behavior.formvalidator');
I.e. mootools is no more loaded
The fa-IR js file has to be modified
As the fix is beyond the control of the core of joomla and is something for the Persian Translation Team can this be closed here?
Maybe check with the Thai translation team as it looks like they fixed an
identical issue with their non-gregorian calendar
On 28 February 2015 at 14:13, Thomas Hunziker notifications@github.com
wrote:
I would like to leave that open simply because I doubt the the translators
will be able to fix it themself.
At least till we got the attention of someone willing and capable of
fixing it. Shouldn't be that hard if you're a bit familiar with MooTools /
jQuery.@dgt41 https://github.com/dgt41 or @fedik https://github.com/fedik
maybe?—
Reply to this email directly or view it on GitHub
#6207 (comment).
Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/
Thanks for that info. I've sent them an email to ask what they did.
I can confirm error on Module edit, but in content all looks good .
But it very tricky to fix/debug, as they do not provide uncompressed version of calendar.js
and lack of knowledge for Persian language
and lack of knowledge for Persian language
Aww, comon. It's sure simpler to learn than JavaScript
https://gist.github.com/dgt41/cfcbe426029726ef63e0
This might be a possible solution. Can somebody test it by replacing the calendar-setup.js with the code of the gist?
@test
https://gist.github.com/dgt41/cfcbe426029726ef63e0
Does not solve the issue here.
It's even worse compared to the original one.
@infograf768
i have change this code in original file (calendar-setup.js)
But does not solve the issue!
in date article problem, when save article after 4time, date is ok:
@farhadst what browser you use?
@infograf768 it could not work in IE,
this should be more safe, in theory:
var method, event;
if(document.addEventListener){
method = 'addEventListener';
event = 'submit';
} else {
method = 'attachEvent';
event = 'onsubmit';
}
C.inputField.form[method](event, function() {
@Fedik
i have replace this code in original file (calendar-setup.js)
and problem with module tab fix. thanks for this solution.
But does not solve article date!
i check this problem in firefox 35.0.1 & google chrome 40.0.2214.115 m (64-bit) & IE 11 and cache is disabled!
@infograf768 I thought that I changed only that part on that file :)
@Fedik Thanks for the full proof solution!
@farhadst The file calendar.js also got some extra code for jalali, which is quite hard to go through because this file is compressed. What I did in calendar-setup.js was to compare it with the normal of joomla (both compressed and normal), and maybe this is the way to debug this error as well
something tells me that it based on https://github.com/farhadi/JalaliJSCalendar
This is the line that produces the error:
C.inputField.value = date.print(C.ifFormat, 'jalali', C.langNumbers);
I updated the gist: https://gist.github.com/dgt41/cfcbe426029726ef63e0
Please mind that line 36 needs to be either true or false, true means local numbers, names and false means local names but "english" numbers
@farhadst please try it, and see if it works for you with either settings
Correction Line 36: F("langNumbers", true); // Needs to be true
btw, we would not be B/C with langNumbers set to true as anyway the manager will not display the Persian numbers. Only the calendar will. But that is a choice for the Persian language team coordinator.
One more try here:
The first correction as stated above by @infograf768 (or better with the lines of @Fedik)
And also this:
if(dateEl&&parseInt(dateEl.value)!=0&&dateEl.value!=''){
var date=Date.parseDate(dateEl.value||dateEl.innerHTML,dateFmt,'gregorian');
//C.inputField.value=date.print(C.ifFormat,'jalali',C.langNumbers);
}
else {
C.date=new Date();
}
Commenting out that line seems to correct the problem of repeated saves. But I don;t know if this is the expected output, format.
@farhadst Can you try this?
@dgt41 i replace this js file https://gist.github.com/dgt41/cfcbe426029726ef63e0
problem with module tab fix.
but in problem with article date: after each save, date is reset, for example: if article date is 1/2/2015, after save article, date reset to now (3/3/2015)
@infograf768 i replace C.inputField.form.addEventListener('submit', function()
to orginal js
problem with module tab fix but article date broken after save not solved.
@dgt41 when delete this line: C.inputField.value=date.print(C.ifFormat,'jalali',C.langNumbers)
article date not shown to jalali and shown to Gregorian calendar! and date also reset after each save time.
Hi, before of joomla 3.4, calender field convert jalali date to gregorion before submit form, but it does not convert it befor submit.
@mhehm @farhadst Can you try this
var dateEl=C.inputField||C.displayArea;
var dateFmt=C.inputField?C.ifFormat:C.daFormat;
if(dateEl&&parseInt(dateEl.value)!=0&&dateEl.value!=''){
if (C.ifFormat && !C.inputField.readOnly)
{
date=dateEl.value;
}
else if (C.inputField.readOnly)
{
var date=Date.parseDate(dateEl.value,dateFmt,'gregorian');
C.inputField.value=date.print(C.ifFormat,'jalali',C.langNumbers);
}
}
else {
C.date=new Date();
}
function H(K) {
Or try https://gist.github.com/dgt41/cfcbe426029726ef63e0 (updated!)
@mhehm exactly, This convert does not happen!
@dgt41 i replace this code to orginal file and when save new article, date shown as gregorian but in archive, shown as jalali!
@infograf768 yes, i have the same problem!
in joomla before joomla 3.4, js file add a function to form submit action that it will convert jalali date to gregorian after click save button on the fly exactly before submit form. it do not work now.
@infograf768 @mhehm @farhadst Sorry for this.
I spent some time to proper solve this
Please test again https://gist.github.com/dgt41/cfcbe426029726ef63e0
Or try the code:
jQuery(document).ready(function(){
jQuery.fn.addEvent = jQuery.fn.bind;
C.inputField.form.addEvent('onsubmit', function () {
var dateEl = C.inputField || C.displayArea;
var dateFmt = C.inputField ? C.ifFormat : C.daFormat;
if (dateEl && parseInt(dateEl.value) != 0 && dateEl.value != '') {
console.log(dateEl.value);
var date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt, 'jalali');
C.inputField.value = date.print(C.ifFormat, 'gregorian', C.langNumbers);
}
});
});
I hope this one solves all the problems here!
One final thought here:
There IS a problem with binding something to submit
with jquery and I just found that there is a PR that corrects this #3484.
If that PR [#3484] gets merged this code can be simplified a bit more!
So @Bakual can you see if that can also gets merged? (will save us in the future with similar situations)
Hi,
I tested your last code. it work.
thank you.
@dgt41 i test this code https://gist.github.com/dgt41/cfcbe426029726ef63e0
and it work
Thank's :)
Works here too!
@mhem
I suggest you modify the fa-IR pack to add 2 js files.
these would be the exact copy of this calendar-setup.js proposed here + a copy of the existing fa-IR calendar.js (no need to really compress the originals).
Change the names of these copies to, respectively:
calendar-setup-uncompressed.js
and
calendar-uncompressed.js
Therefore jalali date will also work when Debug is on.
Add the copied files in the pack js folder.
your site install.xml would be
<media destination="fa-IR">
<filename>index.html</filename>
<filename>js/index.html</filename>
<filename>js/calendar-setup.js</filename>
<filename>js/calendar.js</filename>
<filename>js/calendar-setup-uncompressed.js</filename>
<filename>js/calendar-uncompressed.js</filename>
</media>
@infograf768
I created language package file with this fix and emailed to you.
This can now be closed
Closed as requested.
Status | Confirmed | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-03-09 10:33:34 |
Hi, one more issue.
if on page mootools not load, below error appear:
TypeError: C.inputField.form.addEvent is not a function
Also, on which page does it fails exactly?
@dgt41 yes, i cleaned my browser cache.
@infograf768 i see this issue on one of my component. but you can see it on joomla user manager.
edit an user, and see firebug console. for user's created date field.
it is readonly but if you save user, date will get wrong value.The error is for addEvent function that is one of mootools function and because of that joomla is in converting mootools to jquery, in forms that not more load mootools and have a date field, this error appear.
@mhehm @infograf768
Since 3.4.1 PR #3484 is part of joomla so the code for jalali calendar can be simplified a little bit. (hopefully this will also eliminate this addEvent error)
I will provide a gist
I confirm the error:
Timestamp: 25/03/15 10:43:45
Error: TypeError: C.inputField.form.addEvent is not a function
Source File: http://localhost:8888/trunkgitnew/media/fa-IR/js/calendar-setup.js
Line: 14
@mhehm @infograf768 Here we go then:
on calendar-setup replace the function after line 55 with:
jQuery(document).ready(function() {
var form_id = "#"+C.inputField.form.id;
jQuery(form_id).on("submit", function() {
var dateEl = C.inputField || C.displayArea;
var dateFmt = C.inputField ? C.ifFormat : C.daFormat;
if (dateEl && parseInt(dateEl.value) != 0 && dateEl.value != '') {
var date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt, 'jalali');
C.inputField.value = date.print(C.ifFormat, 'gregorian', C.langNumbers);
}
});
});
This will NOT work as there is a BUG on core-uncompressed.js at line 33:
jQuery(form).submit();
NEEDS to be:
jQuery(form).trigger("submit");
Once you verify that this also works on your setups I will make a PR for core.js
Salam
I solved this issue.
in your own component just use this code at beginning of file :
JHtml::_('behavior.framework');
and new language package for persian in joomla 3.4.1 is updated
good luck
jQuery(document).ready(function() {
var form_id = "#"+C.inputField.form.id;
jQuery(form_id).on("submit", function() {
var dateEl = C.inputField || C.displayArea;
var dateFmt = C.inputField ? C.ifFormat : C.daFormat;
if (dateEl && parseInt(dateEl.value) != 0 && dateEl.value != '') {
var date = Date.parseDate(dateEl.value || dateEl.innerHTML, dateFmt, 'jalali');
C.inputField.value = date.print(C.ifFormat, 'gregorian', C.langNumbers);
}
});
});
But will need 3.4.2 for the proper submit binding
@infograf768 To elaborate a little more (previous comment was from my mobile):
The last iteration #6207 (comment) as you already tested and it works for every possible condition. The problem here was that forms didn’t trigger the submit event and although that PR was actually merged in 3.4.1 there is still a bug as the compressed core.js somehow doesn’t have this code. That is the reason I stated that 3.4.2 will be needed, since @Fedik ’s PR is merged and this code is tested against that!
@Fedik Yes you are right here! I guess trying to figure out why this code didn’t execute in conjunction with #6580 I tried all the possible variations I could think, and this just left hanging there
@dgt41
I was not asking for me but for the Persian (fa-IR) Translation Team Coordinator.
Can you send him the full file and reference this?
Here are his coordinates:
http://community.joomla.org/translations/joomla-3-translations.html#fa-ir
Thanks
Hi
I upgrade my joomla to 3.4.2
after update jalali date has problem same first post
I can't reproduce your jalali date error here with the registered Persian language pack.