Merge pull request #1119 from nlegoff/fix-3.8.6

[3.8.6] Fix some bugs
This commit is contained in:
Nicolas Le Goff
2014-07-25 18:10:51 +02:00
10 changed files with 45 additions and 31 deletions

View File

@@ -49,7 +49,7 @@ class Oauth2 implements ControllerProviderInterface
$params = $oauth2_adapter->getAuthorizationRequestParameters($request); $params = $oauth2_adapter->getAuthorizationRequestParameters($request);
$app_authorized = false; $app_authorized = false;
$errorMessage = false; $error = $request->get('error', '');
$client = \API_OAuth2_Application::load_from_client_id($app, $params['client_id']); $client = \API_OAuth2_Application::load_from_client_id($app, $params['client_id']);
@@ -79,26 +79,24 @@ class Oauth2 implements ControllerProviderInterface
$usr_id = $app['auth.native']->getUsrId($request->get("login"), $request->get("password"), $request); $usr_id = $app['auth.native']->getUsrId($request->get("login"), $request->get("password"), $request);
if (null === $usr_id) { if (null === $usr_id) {
$app['session']->getFlashBag()->set('error', _('login::erreur: Erreur d\'authentification'));
return $app->redirectPath('oauth2_authorize'); return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'login'), $params));
} }
} catch (RequireCaptchaException $e) { } catch (RequireCaptchaException $e) {
return $app->redirectPath('oauth2_authorize', array('error' => 'captcha')); return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'captcha'), $params));
} catch (AccountLockedException $e) { } catch (AccountLockedException $e) {
return $app->redirectPath('oauth2_authorize', array('error' => 'account-locked')); return $app->redirectPath('oauth2_authorize', array_merge(array('error' => 'account-locked'), $params));
} }
$app['authentication']->openAccount(\User_Adapter::getInstance($usr_id, $app)); $app['authentication']->openAccount(\User_Adapter::getInstance($usr_id, $app));
} else {
return new Response($app['twig']->render($template, array('error' => $error, "auth" => $oauth2_adapter)));
} }
return new Response($app['twig']->render($template, array("auth" => $oauth2_adapter)));
} }
//check if current client is already authorized by current user //check if current client is already authorized by current user
$user_auth_clients = \API_OAuth2_Application::load_authorized_app_by_user( $user_auth_clients = \API_OAuth2_Application::load_authorized_app_by_user(
$app $app, $app['authentication']->getUser()
, $app['authentication']->getUser()
); );
foreach ($user_auth_clients as $auth_client) { foreach ($user_auth_clients as $auth_client) {
@@ -114,7 +112,7 @@ class Oauth2 implements ControllerProviderInterface
if (!$app_authorized && $action_accept === null) { if (!$app_authorized && $action_accept === null) {
$params = array( $params = array(
"auth" => $oauth2_adapter, "auth" => $oauth2_adapter,
"errorMessage" => $errorMessage, "error" => $error,
); );
return new Response($app['twig']->render($template, $params)); return new Response($app['twig']->render($template, $params));

View File

@@ -234,14 +234,22 @@ class Basket implements ControllerProviderInterface
{ {
$basket = $app['EM']->getRepository('\Entities\Basket') $basket = $app['EM']->getRepository('\Entities\Basket')
->findUserBasket($app, $basket_id, $app['authentication']->getUser(), true); ->findUserBasket($app, $basket_id, $app['authentication']->getUser(), true);
$basketElement = $app['EM']->getRepository('\Entities\BasketElement')
->find($basket_element_id);
$ord = $basketElement->getOrd();
foreach ($basket->getElements() as $basket_element) { foreach ($basket->getElements() as $basket_element) {
if ($basket_element->getOrd() > $ord) {
$basket_element->setOrd($basket_element->getOrd() - 1);
}
/* @var $basket_element \Entities\BasketElement */ /* @var $basket_element \Entities\BasketElement */
if ($basket_element->getId() == $basket_element_id) { if ($basket_element->getId() == $basket_element_id) {
$basket->removeElement($basket_element);
$app['EM']->remove($basket_element); $app['EM']->remove($basket_element);
} }
} }
$app['EM']->persist($basket);
$app['EM']->flush(); $app['EM']->flush();
$data = array( $data = array(

View File

@@ -110,11 +110,11 @@ class databox_status
$this->status[$bit]["img_on"] = null; $this->status[$bit]["img_on"] = null;
if (is_file($path . "-stat_" . $bit . "_0.gif")) { if (is_file($path . "-stat_" . $bit . "_0.gif")) {
$this->status[$bit]["img_off"] = $url . "-stat_" . $bit . "_0.gif"; $this->status[$bit]["img_off"] = $url . "-stat_" . $bit . "_0.gif?etag=".md5_file($path . "-stat_" . $bit . "_0.gif");
$this->status[$bit]["path_off"] = $path . "-stat_" . $bit . "_0.gif"; $this->status[$bit]["path_off"] = $path . "-stat_" . $bit . "_0.gif";
} }
if (is_file($path . "-stat_" . $bit . "_1.gif")) { if (is_file($path . "-stat_" . $bit . "_1.gif")) {
$this->status[$bit]["img_on"] = $url . "-stat_" . $bit . "_1.gif"; $this->status[$bit]["img_on"] = $url . "-stat_" . $bit . "_1.gif?etag=".md5_file($path . "-stat_" . $bit . "_1.gif");
$this->status[$bit]["path_on"] = $path . "-stat_" . $bit . "_1.gif"; $this->status[$bit]["path_on"] = $path . "-stat_" . $bit . "_1.gif";
} }

View File

@@ -39,8 +39,9 @@
{% for key,value in auth.getParams %} {% for key,value in auth.getParams %}
<input type="hidden" name="{{key}}" value="{{value}}"> <input type="hidden" name="{{key}}" value="{{value}}">
{% endfor %} {% endfor %}
{% if errorMessage is defined %} {% if error == 'login' %}
<p class="login_error">{% trans 'Erreur de login / mot de passe' %}</p> <br />
<p class="alert alert-error" style="color: #E0215D;padding:10px">{% trans 'Erreur de login / mot de passe' %}</p>
{% endif %} {% endif %}
<p class="login_hello"> <p class="login_hello">
{% trans %} {% trans %}

View File

@@ -144,7 +144,7 @@
{% else %} {% else %}
<td class="w160px"> <td class="w160px">
{% endif %} {% endif %}
<div class="diapo w160px" style="margin-bottom:0;border-bottom:none;overflow:hidden;"> <div class="diapo w160px" style="margin-bottom:0;border-bottom:none;">
<div class="title" style="max-height:100%" title="{{ record.get_title() }}">{{ record.get_title() }}</div> <div class="title" style="max-height:100%" title="{{ record.get_title() }}">{{ record.get_title() }}</div>
<div class="status">{{ record.get_status_icons()|raw }}</div> <div class="status">{{ record.get_status_icons()|raw }}</div>
<table cellpadding="0" cellspacing="0" style="margin: 0pt auto;"> <table cellpadding="0" cellspacing="0" style="margin: 0pt auto;">

View File

@@ -25,9 +25,8 @@
</td> </td>
{% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %} {% if list.getOwner(app['authentication'].getUser(), app).getRole() >= constant('\\Entities\\UsrListOwner::ROLE_ADMIN') %}
<td style="text-align:right;white-space:nowrap;width:150px;"> <td style="text-align:right;white-space:nowrap;width:150px;">
<button class="deleter btn btn-inverse"> <button class="deleter btn btn-inverse" data-list-id="{{ list.getId() }}">
{% trans 'Delete' %} {% trans 'Delete' %}
<input type="hidden" name="list_id" value="{{ list.getId() }}"/>
</button> </button>
</td> </td>
{% endif %} {% endif %}

View File

@@ -21,7 +21,7 @@
onDblClick="openPreview('RESULT',{{record.get_number}});"> onDblClick="openPreview('RESULT',{{record.get_number}});">
{% endif %} {% endif %}
<div style="padding: 4px;"> <div style="padding: 4px;">
<div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;overflow:hidden;"> <div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;">
<div class="title" style="max-height:100%" title="{{ record.get_title() }}"> <div class="title" style="max-height:100%" title="{{ record.get_title() }}">
{{ record.get_title() }} {{ record.get_title() }}
</div> </div>

View File

@@ -394,13 +394,19 @@ $(document).ready(function () {
//on submit file //on submit file
$('#fileupload', UploaderManager.getContainer()).bind('fileuploadsubmit', function (e, data) { $('#fileupload', UploaderManager.getContainer()).bind('fileuploadsubmit', function (e, data) {
var $this = $(this); var $this = $(this);
var params = [];
data.formData = [];
//get form datas attached to the file //get form datas attached to the file
data.formData = $.extend( params.push(data.context.find('input, select').serializeArray());
data.context.find('input, select').serializeArray(), params.push($("input", $('.collection-status:visible', UploaderManager.getSettingsBox())).serializeArray());
$("input", $('.collection-status:visible', UploaderManager.getSettingsBox())).serializeArray(), params.push($("select", UploaderManager.getSettingsBox()).serializeArray());
$("select", UploaderManager.getSettingsBox()).serializeArray()
); $.each(params, function(i, p) {
$.each(p, function (i, f){
data.formData.push(f);
});
});
data.formData.push({ data.formData.push({
"name": "b64_image", "name": "b64_image",

View File

@@ -149,13 +149,13 @@
buttons[language.send] = function () { buttons[language.send] = function () {
if ($.trim($('input[name="name"]', $dialog.getDomElement()).val()) === '') { if ($.trim($('input[name="name"]', $dialog.getDomElement()).val()) === '') {
options = { var options = {
size: 'Alert', size: 'Alert',
closeButton: true, closeButton: true,
title: language.warning title: language.warning
}, }
$dialog = p4.Dialog.Create(options, 3); var $dialogAlert = p4.Dialog.Create(options, 3);
$dialog.setContent(language.FeedBackNameMandatory); $dialogAlert.setContent(language.FeedBackNameMandatory);
return false; return false;
} }
@@ -514,7 +514,7 @@
var options = { var options = {
cancelButton: true, cancelButton: true,
buttons: buttons, buttons: buttons,
size: 'Alert' size: '700x170'
}; };
p4.Dialog.Create(options, 2).setContent(box); p4.Dialog.Create(options, 2).setContent(box);
@@ -626,7 +626,7 @@
$('button.deleter', $container).bind('click', function (event) { $('button.deleter', $container).bind('click', function (event) {
var list_id = $(this).find('input[name=list_id]').val(); var list_id = $(this).data("list-id");
var makeDialog = function (box) { var makeDialog = function (box) {

View File

@@ -155,6 +155,8 @@ var p4 = p4 || {};
} }
selectedItem.remove(); selectedItem.remove();
} else {
return p4.WorkZone.reloadCurrent();
} }
} else { } else {
humane.error(data.message); humane.error(data.message);
@@ -308,8 +310,8 @@ var p4 = p4 || {};
$('a.WorkZoneElementRemover', dest).bind('mousedown',function (event) { $('a.WorkZoneElementRemover', dest).bind('mousedown',function (event) {
return false; return false;
}).bind('click', function (event) { }).bind('click', function (event) {
return WorkZoneElementRemover($(this), false); return WorkZoneElementRemover($(this), false);
}); });
dest.droppable({ dest.droppable({
accept: function (elem) { accept: function (elem) {