?
avatar farhadst
farhadst
27 Feb 2015

install joomla 3.4
install persian language
set administrator panel (backend) to persian language
1. create a article, date is ok but when edit article date is broken!
(when backend language set to En, everything is ok)
article-edit


  1. in module manager and edit module, tabs of "Menu Assignment" "Module Permissions" and "Advanced" is hidden. (but when backend language set to En everything is ok) module-edit
avatar farhadst farhadst - open - 27 Feb 2015
avatar joomla-cms-bot joomla-cms-bot - change - 27 Feb 2015
Labels Added: ?
avatar infograf768
infograf768 - comment - 27 Feb 2015

I can't reproduce your jalali date error here with the registered Persian language pack.
screen shot 2015-02-27 at 08 54 59

avatar farhadst
farhadst - comment - 27 Feb 2015

Please set backend language to persian and logout joomla, then again login with persian language!
edit article and save it.

avatar infograf768
infograf768 - comment - 27 Feb 2015

Same. no issue for the date.

BUT I confirm the issue for the modules tabs and this is a big regression!

avatar brianteeman
brianteeman - comment - 27 Feb 2015

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

screen shot 2015-02-27 at 02 25 25

screen shot 2015-02-27 at 02 26 00


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6207.
avatar brianteeman brianteeman - change - 27 Feb 2015
Status New Confirmed
avatar brianteeman brianteeman - change - 27 Feb 2015
Category Language & Strings Multilanguage
avatar infograf768
infograf768 - comment - 27 Feb 2015

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

avatar brianteeman
brianteeman - comment - 27 Feb 2015

My tests were with debug OFF


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6207.
avatar brianteeman
brianteeman - comment - 27 Feb 2015

The thai language issue was a JS error and unrelated see http://forum.joomla.org/viewtopic.php?f=706&t=874697&p=3272023#p3272023


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6207.
avatar infograf768
infograf768 - comment - 27 Feb 2015

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
avatar infograf768
infograf768 - comment - 27 Feb 2015

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

avatar brianteeman
brianteeman - comment - 28 Feb 2015

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?


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6207.
avatar Bakual
Bakual - comment - 28 Feb 2015

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 or @fedik maybe?

avatar brianteeman
brianteeman - comment - 28 Feb 2015

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/

avatar Bakual
Bakual - comment - 28 Feb 2015

Thanks for that info. I've sent them an email to ask what they did.

avatar Fedik
Fedik - comment - 28 Feb 2015

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 :smile:

avatar Bakual
Bakual - comment - 28 Feb 2015

and lack of knowledge for Persian language

Aww, comon. It's sure simpler to learn than JavaScript :smiley:

avatar dgt41
dgt41 - comment - 28 Feb 2015

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?

avatar infograf768
infograf768 - comment - 1 Mar 2015

@test
https://gist.github.com/dgt41/cfcbe426029726ef63e0
Does not solve the issue here.

It's even worse compared to the original one.

avatar infograf768
infograf768 - comment - 2 Mar 2015

@dgt41

If I change ONLY in the original file
C.inputField.form.addEvent('submit', function() {
to
C.inputField.form.addEventListener('submit', function() {

It looks like working here.

avatar farhadst
farhadst - comment - 2 Mar 2015

@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:

first
1

second
2

Third
3

Fourth
4

avatar Fedik
Fedik - comment - 2 Mar 2015

@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() {
avatar farhadst
farhadst - comment - 2 Mar 2015

@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!

avatar dgt41
dgt41 - comment - 2 Mar 2015

@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

avatar Fedik
Fedik - comment - 2 Mar 2015

something tells me that it based on https://github.com/farhadi/JalaliJSCalendar :smile:

avatar dgt41
dgt41 - comment - 2 Mar 2015

@Fedik I will bet that the problem here is the code to support multiple instances...

avatar Fedik
Fedik - comment - 2 Mar 2015

@dgt41 this simple to check, just leave the calendar only for one field, other set to text, example

avatar dgt41
dgt41 - comment - 2 Mar 2015

This is the line that produces the error:

C.inputField.value = date.print(C.ifFormat, 'jalali', C.langNumbers);
avatar dgt41
dgt41 - comment - 2 Mar 2015

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

avatar infograf768
infograf768 - comment - 2 Mar 2015

@dgt41
I confirm that, here, on Firefox, your js does not quite work.
screen shot 2015-03-02 at 18 54 01

If I change ONLY in the original file
C.inputField.form.addEvent('submit', function() {
to
C.inputField.form.addEventListener('submit', function()
I get
screen shot 2015-03-02 at 18 57 16

Then, If I use 'true" for langNumbers, I get:
screen shot 2015-03-02 at 19 01 11

avatar infograf768
infograf768 - comment - 2 Mar 2015

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.

avatar infograf768
infograf768 - comment - 2 Mar 2015

@farhadst

When testing, you should make sure all cache are deleted, including browser cache. The best even is to logout, quit browser and launch again.

avatar dgt41
dgt41 - comment - 2 Mar 2015

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?

avatar infograf768
infograf768 - comment - 3 Mar 2015

A correction to my former reports:
Although I get the original display fine, it is then broken when I save and I get weird results of the type shown by @farhadst

avatar farhadst
farhadst - comment - 3 Mar 2015

@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.

avatar mhehm
mhehm - comment - 7 Mar 2015

Hi, before of joomla 3.4, calender field convert jalali date to gregorion before submit form, but it does not convert it befor submit.


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/6207.
avatar dgt41
dgt41 - comment - 8 Mar 2015

@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!)

avatar infograf768
infograf768 - comment - 8 Mar 2015

@test
Editing an existing article, I get:

screen shot 2015-03-08 at 08 07 57

Creating a new article I get before save:

screen shot 2015-03-08 at 08 10 27

After choosing a date, before save:

screen shot 2015-03-08 at 08 11 42

After saving:

screen shot 2015-03-08 at 08 12 24

In the manager:

screen shot 2015-03-08 at 08 13 55

Test fails.

avatar infograf768
infograf768 - comment - 8 Mar 2015

Also, when switching to en-GB, I see that the date for publish up that was saved in the db is the jalali date and not the gregorian.

screen shot 2015-03-08 at 08 28 30

avatar farhadst
farhadst - comment - 8 Mar 2015

@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!
pe1

in archive:
pe2

@infograf768 yes, i have the same problem!

avatar mhehm
mhehm - comment - 8 Mar 2015

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.

avatar dgt41
dgt41 - comment - 8 Mar 2015

@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!

avatar dgt41
dgt41 - comment - 8 Mar 2015

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)

avatar mhehm
mhehm - comment - 9 Mar 2015

Hi,
I tested your last code. it work.
thank you.

avatar farhadst
farhadst - comment - 9 Mar 2015

@dgt41 i test this code https://gist.github.com/dgt41/cfcbe426029726ef63e0
and it work
Thank's :)

avatar infograf768
infograf768 - comment - 9 Mar 2015

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>
avatar infograf768
infograf768 - comment - 9 Mar 2015

@dgt41
Thanks a lot! I was frightened we would lose fa-IR for Joomla!

avatar mhehm
mhehm - comment - 9 Mar 2015

@infograf768
I created language package file with this fix and emailed to you.

avatar infograf768
infograf768 - comment - 9 Mar 2015

This can now be closed

avatar roland-d
roland-d - comment - 9 Mar 2015

Closed as requested.

avatar roland-d roland-d - change - 9 Mar 2015
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2015-03-09 10:33:34
avatar roland-d roland-d - close - 9 Mar 2015
avatar roland-d roland-d - close - 9 Mar 2015
avatar mhehm
mhehm - comment - 24 Mar 2015

Hi, one more issue.
if on page mootools not load, below error appear:
TypeError: C.inputField.form.addEvent is not a function

avatar dgt41
dgt41 - comment - 24 Mar 2015

@mhehm have you tried to clean your browser’s cache?

avatar infograf768
infograf768 - comment - 24 Mar 2015

Also, on which page does it fails exactly?

avatar mhehm
mhehm - comment - 24 Mar 2015

@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.

avatar dgt41
dgt41 - comment - 24 Mar 2015

@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

avatar infograf768
infograf768 - comment - 25 Mar 2015

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

avatar dgt41
dgt41 - comment - 25 Mar 2015

@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

avatar dgt41
dgt41 - comment - 25 Mar 2015

Please also test #6580, to get this bug corrected once for good!

avatar mhehm
mhehm - comment - 25 Mar 2015

@dgt41 I tested your last code with #6580 fix, and it worked for me.
Thanks.

avatar infograf768
infograf768 - comment - 26 Mar 2015

Works great here too.
Now commenting in #6580

avatar balvard
balvard - comment - 9 Apr 2015

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

avatar infograf768
infograf768 - comment - 11 Apr 2015

@dgt41
What is the last iteration for the fa-IR js files

avatar dgt41
dgt41 - comment - 11 Apr 2015
    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

avatar Fedik
Fedik - comment - 11 Apr 2015

@dgt41 jQuery(C.inputField.form) could save one line, in theory :wink:

avatar dgt41
dgt41 - comment - 11 Apr 2015

@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 ????

avatar infograf768
infograf768 - comment - 12 Apr 2015

@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

avatar mamool
mamool - comment - 1 Jul 2015

Hi
I upgrade my joomla to 3.4.2
after update jalali date has problem same first post


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

avatar farhadst
farhadst - comment - 1 Jul 2015

Hi @mamool
i have create a new issue for this problem on joomla 3.4.2
Please follow this #7298

Add a Comment

Login with GitHub to post a comment