Skip to content

Commit 49cb942

Browse files
committed
Changes for EzPlatform 2.2
1 parent aa89835 commit 49cb942

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

Resources/public/js/recommendationrestclient.js

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,6 @@
4747
return;
4848
}
4949

50-
xmlhttp.onreadystatechange = function () {
51-
var jsonResponse;
52-
53-
if (xmlhttp.readyState === 4) {
54-
if (xmlhttp.status === 200) {
55-
jsonResponse = JSON.parse(xmlhttp.response);
56-
responseCallback(jsonResponse.recommendationItems, this);
57-
} else if (xmlhttp.status === 401) {
58-
errorCallback(this.unauthorizedMessage);
59-
} else if (xmlhttp.status === 500) {
60-
errorCallback(this.internalServerErrorMessage);
61-
} else {
62-
errorCallback(this.errorMessage);
63-
}
64-
}
65-
}.bind(this);
66-
6750
for (var i = 0; i < this.fields.length; i++) {
6851
attributes = attributes + '&attribute=' + this.fields[i];
6952
}
@@ -82,6 +65,24 @@
8265
];
8366

8467
xmlhttp.open('GET', requestQueryString.join(''), true);
68+
xmlhttp.onload = function (e) {
69+
var jsonResponse;
70+
71+
if (xmlhttp.readyState === 4) {
72+
if (xmlhttp.status === 200) {
73+
jsonResponse = JSON.parse(xmlhttp.response);
74+
responseCallback(jsonResponse.recommendationItems, this);
75+
} else if (xmlhttp.status === 401) {
76+
errorCallback(this.unauthorizedMessage);
77+
} else if (xmlhttp.status === 500) {
78+
errorCallback(this.internalServerErrorMessage);
79+
} else {
80+
errorCallback(this.errorMessage);
81+
}
82+
}
83+
}.bind(this);
84+
85+
8586
xmlhttp.send();
8687
};
8788

@@ -99,7 +100,7 @@
99100
return true;
100101
}
101102

102-
xmlhttp.open('GET', url, false);
103+
xmlhttp.open('GET', url, true);
103104
xmlhttp.send();
104105

105106
return true;

Rest/Field/TypeValue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace EzSystems\RecommendationBundle\Rest\Field;
77

88
use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver;
9-
use eZ\Bundle\EzPublishCoreBundle\Imagine\AliasGenerator as ImageVariationService;
9+
use eZ\Bundle\EzPublishCoreBundle\Imagine\PlaceholderAliasGenerator as ImageVariationService;
1010
use eZ\Publish\Core\FieldType\RichText\Converter as RichTextConverterInterface;
1111
use eZ\Publish\Core\MVC\Exception\SourceImageNotFoundException;
1212
use eZ\Publish\API\Repository\Values\Content\Content;
@@ -30,7 +30,7 @@ class TypeValue
3030

3131
/**
3232
* @param \eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Configuration\ConfigResolver $configResolver
33-
* @param \eZ\Bundle\EzPublishCoreBundle\Imagine\AliasGenerator $imageVariationService
33+
* @param \eZ\Bundle\EzPublishCoreBundle\Imagine\PlaceholderAliasGenerator $imageVariationService
3434
* @param \eZ\Publish\Core\FieldType\RichText\Converter $richHtml5Converter
3535
* @param \eZ\Publish\Core\FieldType\XmlText\Converter\Html5 $xmlHtml5Converter
3636
*/

0 commit comments

Comments
 (0)