Merge with master

This commit is contained in:
Romain Neutron
2012-01-06 13:30:56 +01:00
6 changed files with 87 additions and 32 deletions

View File

@@ -137,6 +137,7 @@ class User_Query implements User_QueryInterface
const LIKE_FIRSTNAME= 'usr_prenom'; const LIKE_FIRSTNAME= 'usr_prenom';
const LIKE_LASTNAME= 'usr_nom'; const LIKE_LASTNAME= 'usr_nom';
const LIKE_NAME= 'name';
const LIKE_COMPANY = 'societe'; const LIKE_COMPANY = 'societe';
const LIKE_LOGIN = 'usr_login'; const LIKE_LOGIN = 'usr_login';
const LIKE_EMAIL = 'usr_mail'; const LIKE_EMAIL = 'usr_mail';
@@ -292,6 +293,7 @@ class User_Query implements User_QueryInterface
} }
$sql_like = array(); $sql_like = array();
foreach ($this->like_field as $like_field => $like_value) foreach ($this->like_field as $like_field => $like_value)
{ {
switch ($like_field) switch ($like_field)
@@ -303,7 +305,7 @@ class User_Query implements User_QueryInterface
case self::LIKE_LOGIN: case self::LIKE_LOGIN:
case self::LIKE_COUNTRY: case self::LIKE_COUNTRY:
$sql_like[] = sprintf( $sql_like[] = sprintf(
' usr.`%s` LIKE "%s%%" ' ' usr.`%s` LIKE "%s%%" COLLATE utf8_unicode_ci '
, $like_field , $like_field
, str_replace(array('"', '%'), array('\"', '\%'), $like_value) , str_replace(array('"', '%'), array('\"', '\%'), $like_value)
); );
@@ -579,8 +581,17 @@ class User_Query implements User_QueryInterface
*/ */
public function like($like_field, $like_value) public function like($like_field, $like_value)
{ {
$this->like_field[trim($like_field)] = trim($like_value);
if($like_field == self::LIKE_NAME)
{
$this->like_field[self::LIKE_FIRSTNAME] = trim($like_value);
$this->like_field[self::LIKE_LASTNAME] = trim($like_value);
}
else
{
$this->like_field[trim($like_field)] = trim($like_value);
}
$this->total = $this->page = null; $this->total = $this->page = null;
return $this; return $this;

View File

@@ -984,6 +984,7 @@ class set_export extends set_abstract
); );
$response->headers->set('X-Sendfile', $file); $response->headers->set('X-Sendfile', $file);
$response->headers->set('X-Accel-Redirect', $file_xaccel); $response->headers->set('X-Accel-Redirect', $file_xaccel);
$response->headers->set('Pragma', 'public', true);
$response->headers->set('Content-Type', $mime); $response->headers->set('Content-Type', $mime);
$response->headers->set('Content-Name', $exportname); $response->headers->set('Content-Name', $exportname);
$response->headers->set('Content-Disposition', $disposition . "; filename=" . $exportname . ";"); $response->headers->set('Content-Disposition', $disposition . "; filename=" . $exportname . ";");
@@ -993,12 +994,25 @@ class set_export extends set_abstract
} }
else else
{ {
/**
*
* Header "Pragma: public" SHOULD be present.
* In case it is not present, download on IE 8 and previous over HTTPS
* will fail.
*
* @todo : merge this shitty fix with Response object.
*
*/
if(!headers_sent())
{
header("Pragma: public");
}
$response->headers->set('Content-Type', $mime); $response->headers->set('Content-Type', $mime);
$response->headers->set('Content-Name', $exportname); $response->headers->set('Content-Name', $exportname);
$response->headers->set('Content-Disposition', $disposition . "; filename=" . $exportname . ";"); $response->headers->set('Content-Disposition', $disposition . "; filename=" . $exportname . ";");
$response->headers->set('Content-Length', filesize($file)); $response->headers->set('Content-Length', filesize($file));
$response->setContent(file_get_contents($file)); $response->setContent(file_get_contents($file));
return $response; return $response;
} }
} }
@@ -1014,22 +1028,42 @@ class set_export extends set_abstract
* @param String $disposition * @param String $disposition
* @return Void * @return Void
*/ */
function stream_data($data, $exportname, $mime, $disposition='attachment') public static function stream_data($data, $exportname, $mime, $disposition='attachment')
{ {
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false); header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); header("Pragma: public");
header("Content-Type: " . $mime); header("Content-Type: " . $mime);
header("Content-Length: " . strlen($data)); header("Content-Length: " . strlen($data));
header("Cache-Control: max-age=3600, must-revalidate "); header("Cache-Control: max-age=3600, must-revalidate ");
header("Content-Disposition: " . $disposition header("Content-Disposition: " . $disposition . "; filename=" . $exportname . ";");
. "; filename=" . $exportname . ";"); echo $data;
exit();
echo $data; $response = new \Symfony\Component\HttpFoundation\Response();
$response->headers->set('Cache-Control', 'must-revalidate, post-check=0, pre-check=0');
$response->setLastModified(new DateTime());
$response->headers->set('Pragma', 'public', true);
$response->headers->set('Content-Type', $mime);
$response->headers->set('Content-Length', strlen($data));
$response->headers->set('Content-Disposition', $disposition. "; filename=" . $exportname . ";");
// header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
//
// header("Pragma: public");
//
// header("Content-Type: " . $mime);
// header("Content-Length: " . strlen($data));
// header("Cache-Control: max-age=3600, must-revalidate ");
// header("Content-Disposition: " . $disposition
// . "; filename=" . $exportname . ";");
//
// echo $data;
$response->send();
exit();
return true; return true;
} }

View File

@@ -36,11 +36,11 @@
{% if record.get_type() == 'image' and document.get_width() and document.get_height() %} {% if record.get_type() == 'image' and document.get_width() and document.get_height() %}
{% trans 'Dimensions a l\'impression' %} {% trans 'Dimensions a l\'impression' %}
<br/> <br/>
{% set size_w = (document.get_width() / (300*254/100)) %} {% set size_w = (document.get_width() * (254/100) / 300) %}
{% set size_h = (document.get_height() / (300*254/100)) %} {% set size_h = (document.get_height() * (254/100) / 300) %}
300 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm 300 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm
{% set size_w = (document.get_width() / (72*254/100)) %} {% set size_w = (document.get_width() * (254/100) / 72) %}
{% set size_h = (document.get_height() / (72*254/100)) %} {% set size_h = (document.get_height() * (254/100) / 72) %}
<br/> 72 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm <br/> 72 dpi : {{size_w|round(1)}}x{{size_h|round(1)}} cm
{% endif %} {% endif %}

View File

@@ -153,7 +153,7 @@
<div id="divS_wrapper" style="width:{{user.getPrefs('editing_right_box')}}"> <div id="divS_wrapper" style="width:{{user.getPrefs('editing_right_box')}}">
<div id="divS"> <div id="divS">
{{_self.HTML_fieldlist(edit, user)}} {{_self.HTML_fieldlist(edit, user)}}
</div> </div>
</div> </div>
@@ -360,7 +360,7 @@
<br/> <br/>
<br> <br>
<b> <b>
<h4>{% trans 'prod::editing:indexation en cours' %}<f/h4> <h4>{% trans 'prod::editing:indexation en cours' %}</h4>
</b> </b>
<span id='saveeditPbarI'></span> / <span id='saveeditPbarN'></span> <span id='saveeditPbarI'></span> / <span id='saveeditPbarN'></span>
<br/><br/><br/> <br/><br/><br/>

View File

@@ -1135,6 +1135,11 @@
<div id="modal_feed" title="{% trans 'action : publier' %}" style="display:none;"> <div id="modal_feed" title="{% trans 'action : publier' %}" style="display:none;">
</div> </div>
<form id="push_form" style="display:none;" method="post" target="download" action="/prod/pushdoc.php">
<input name="lst" value=""/>
<input name="ACT" value="LOAD"/>
<input name="SSTTID" value="LOAD"/>
</form>
<div id="dialog_dwnl" title="{% trans 'action : exporter' %}" style="display:none;"></div> <div id="dialog_dwnl" title="{% trans 'action : exporter' %}" style="display:none;"></div>
<div title="{% trans 'Re-ordonner' %}" id="reorder_dialog" style="position:relative;overflow:hidden;"> <div title="{% trans 'Re-ordonner' %}" id="reorder_dialog" style="position:relative;overflow:hidden;">

View File

@@ -1864,11 +1864,16 @@ function chgStatusThis(url)
} }
function pushThis(url) function pushThis(sstt_id, lst)
{ {
url = "pushdoc.php?ACT=LOAD&"+url;
$('#MODALDL').attr('src','about:blank'); $('#MODALDL').attr('src','about:blank');
$('#MODALDL').attr('src',url);
var $form = $('#push_form');
$('input[name="lst"]', $form).val(lst);
$('input[name="SSTTID"]', $form).val(sstt_id);
$form.submit();
var w = bodySize.x - 40; var w = bodySize.x - 40;
var h = bodySize.y - 40; var h = bodySize.y - 40;
@@ -2221,7 +2226,7 @@ function activeIcons()
}); });
$('.TOOL_pushdoc_btn').live('click', function(){ $('.TOOL_pushdoc_btn').live('click', function(){
var value=""; var value="",type="",sstt_id="";
if($(this).hasClass('results_window')) if($(this).hasClass('results_window'))
{ {
if(p4.Results.Selection.length() > 0) if(p4.Results.Selection.length() > 0)
@@ -2234,19 +2239,19 @@ function activeIcons()
if(p4.WorkZone.Selection.length() > 0) if(p4.WorkZone.Selection.length() > 0)
value = "lst=" + p4.WorkZone.Selection.serialize(); value = "lst=" + p4.WorkZone.Selection.serialize();
else else
value = "SSTTID=" + $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); sstt_id = $('.SSTT.active').attr('id').split('_').slice(1,2).pop();
} }
else else
{ {
if($(this).hasClass('basket_element')) if($(this).hasClass('basket_element'))
{ {
value = "SSTTID=" + $('.SSTT.active').attr('id').split('_').slice(1,2).pop(); sstt_id = $('.SSTT.active').attr('id').split('_').slice(1,2).pop();
} }
} }
} }
if(value !== '') if(value !== '' || sstt_id !== '')
{ {
pushThis(value); pushThis(sstt_id, value);
} }
else else
{ {