Skip to content

Commit

Permalink
Fix EZP-22813: Impossible to create users in IE11
Browse files Browse the repository at this point in the history
  • Loading branch information
dpobel committed May 14, 2014
1 parent a6f9ae8 commit 2102c7a
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 7 deletions.
10 changes: 7 additions & 3 deletions README.md
Expand Up @@ -79,14 +79,18 @@ Example:
// will not trigger an auto submit
action: 'url/to/post/the/form/content', // should answer in JSON
interval: 30, // number of seconds between two submit attempts
trackUserInput: true // boolean, whether the component should try to
// submit the form if the user leaves a field
// and has made changes
trackUserInput: true, // boolean, whether the component should try to
// submit the form if the user leaves a field
// and has made changes
enabled: function () { return true; } // optional function to
// disable autosave in some circumstances
});

as.on('init', function () {
// init event
// triggered when the component is initialized
// if the `enabled` function returns false, this event is not
// triggered
// "this" is the Y.eZ.AutoSubmit instance
});

Expand Down
14 changes: 13 additions & 1 deletion design/admin/templates/content/edit/autosave.tpl
Expand Up @@ -19,7 +19,19 @@ YUI(YUI3_config).use('ezautosubmit', 'ezcontentpreview', 'node-base', 'node-styl
ignoreClass: 'no-autosave',
action: {concat( 'ezjscore/call/ezautosave::savedraftpreview::', $object.id, '::', $edit_version, '::', $edit_language, '?ContentType=javascript' )|ezurl},
interval: {ezini( 'AutosaveSettings', 'Interval', 'autosave.ini' )|int()},
trackUserInput: {cond( ezini( 'AutosaveSettings', 'TrackUserInput', 'autosave.ini')|eq( 'enabled' ), "true", "false" )}
trackUserInput: {cond( ezini( 'AutosaveSettings', 'TrackUserInput', 'autosave.ini')|eq( 'enabled' ), "true", "false" )},
enabled: function () {ldelim}
var ieDisableWithPassword = [{ezini( 'BrowserWorkarounds', 'IEDisableWithPassword', 'autosave.ini' )|implode( ', ')}];
if ( ieDisableWithPassword.indexOf(Y.UA.ie) !== -1 ) {ldelim}
return (Y.one(this.conf.form).all("input[type=password]").size() == 0);
{rdelim}
return true;
{rdelim}
{rdelim}),
messages = {ldelim}
Expand Down
14 changes: 13 additions & 1 deletion design/ezwebin/templates/content/edit/autosave.tpl
Expand Up @@ -9,7 +9,19 @@ YUI(YUI3_config).use('ezautosubmit', 'node-base', 'node-style', function (Y) {ld
form: '#editform',
action: {concat( 'ezjscore/call/ezautosave::savedraft::', $object.id, '::', $edit_version, '::', $edit_language, '?ContentType=javascript' )|ezurl},
interval: {ezini( 'AutosaveSettings', 'Interval', 'autosave.ini' )|int()},
trackUserInput: {cond( ezini( 'AutosaveSettings', 'TrackUserInput', 'autosave.ini')|eq( 'enabled' ), "true", "false" )}
trackUserInput: {cond( ezini( 'AutosaveSettings', 'TrackUserInput', 'autosave.ini')|eq( 'enabled' ), "true", "false" )},
enabled: function () {ldelim}
var ieDisableWithPassword = [{ezini( 'BrowserWorkarounds', 'IEDisableWithPassword', 'autosave.ini' )|implode( ', ')}];
if ( ieDisableWithPassword.indexOf(Y.UA.ie) !== -1 ) {ldelim}
return (Y.one(this.conf.form).all("input[type=password]").size() == 0);
{rdelim}
return true;
{rdelim}
{rdelim}),
messages = {ldelim}
Expand Down
13 changes: 11 additions & 2 deletions design/standard/javascript/ezautosubmit.js
Expand Up @@ -73,9 +73,12 @@ YUI(YUI3_config).add('ezautosubmit', function (Y) {
* - action String, the URI to POST the form
* - interval Integer, number of seconds between 2 auto submit attempts
* - trackUserInput Boolean, whether to auto submit the end user leave a form field
* - enabled Function, optional function returning a boolean called when the page
* is ready, allowing to disabled autosave in some circumstances
*/
function eZAutoSubmit(conf) {
var that = this;
var that = this,
enableCheckFunc = conf.enabled || function () { return true; };

this.conf = Y.merge(defaultConfig, conf);
this.conf.interval = parseInt(this.conf.interval);
Expand All @@ -96,7 +99,10 @@ YUI(YUI3_config).add('ezautosubmit', function (Y) {
this.ajaxSubscription = false;

Y.on('domready', function () {
that.fire('init');
that.isEnabled = enableCheckFunc.call(that);
if ( that.isEnabled ) {
that.fire('init');
}
});

Y.on('autosubmit:forcesave', function () {
Expand All @@ -118,6 +124,9 @@ YUI(YUI3_config).add('ezautosubmit', function (Y) {
return;
}
Y.on('domready', function () {
if ( !that.isEnabled ) {
return;
}
that.timer = Y.later(that.conf.interval * 1000, that, that.submit, [], true);
that.started = true;
that.state = serializeForm(that.conf.form, that.conf.ignoreClass);
Expand Down
11 changes: 11 additions & 0 deletions settings/autosave.ini.append.php
Expand Up @@ -15,4 +15,15 @@
# whether to hide the preview link
HidePreviewLink=disabled
[BrowserWorkarounds]
# Disable autosave in IE (11 for now) when the form has a password field.
# This is because by default IE 11 is not able to post a form to an iframe
# when giving the focus to a password field...
# It's possible to change this behaviour by unchecking the "Enable Protected
# Mode" options in the security settings of IE11 or by putting the eZ Publish
# website in a zone where this option is disabled.
# See https://jira.ez.no/browse/EZP-22813
IEDisableWithPassword[]
IEDisableWithPassword[]=11
*/ ?>

0 comments on commit 2102c7a

Please sign in to comment.