Merge branch 'regs' into 3.6

This commit is contained in:
Romain Neutron
2012-01-04 18:08:33 +01:00
6 changed files with 33 additions and 27 deletions

View File

@@ -573,11 +573,11 @@ class module_report_nav extends module_report
*/ */
public function buildTabUserWhat($bid, $rid, $tab = false) public function buildTabUserWhat($bid, $rid, $tab = false)
{ {
$this->initialize();
$sbas_id = phrasea::sbasFromBas($bid); $sbas_id = phrasea::sbasFromBas($bid);
$record = new record_adapter($sbas_id, $rid); $record = new record_adapter($sbas_id, $rid);
$this->setDisplay($tab); $this->setDisplay($tab);
$this->initialize();
$this->champ = array( $this->champ = array(
'photo', 'photo',
'record_id', 'record_id',
@@ -593,7 +593,7 @@ class module_report_nav extends module_report
$x = $record->get_thumbnail(); $x = $record->get_thumbnail();
$this->result = array( $this->result[] = array(
'photo' => 'photo' =>
"<img style='width:" . $x->get_width() . "px;height:" . $x->get_height() . "px;' "<img style='width:" . $x->get_width() . "px;height:" . $x->get_height() . "px;'
src='" . $x->get_url() . "'>" src='" . $x->get_url() . "'>"

View File

@@ -1179,7 +1179,9 @@ class record_adapter implements record_Interface, cache_cacheableInterface
foreach ($mandatoryParams as $param) foreach ($mandatoryParams as $param)
{ {
if (!array_key_exists($param, $params)) if (!array_key_exists($param, $params))
throw new Exception_InvalidArgument(); {
throw new Exception_InvalidArgument(sprintf('Invalid metadata, missing key %s', $param));
}
} }
if (!is_array($params['value'])) if (!is_array($params['value']))

View File

@@ -274,40 +274,39 @@ class record_preview extends record_adapter
{ {
if ($this->title) if ($this->title)
return $this->title; return $this->title;
$this->title = collection::getLogo($this->get_base_id()) . ' '; $this->title = collection::getLogo($this->get_base_id()) . ' ';
switch ($this->env) switch ($this->env)
{ {
case "RESULT": case "RESULT":
$this->title .= sprintf( $this->title .= sprintf(
_('preview:: resultat numero %s '), '<span id="current_result_n">' . ($this->number + 1) _('preview:: resultat numero %s '), '<span id="current_result_n">' . ($this->number + 1)
. '</span>' . '</span> : '
); );
$title = parent::get_title(); $this->title .= parent::get_title($highlight, $search_engine);
if ($search_engine instanceof searchEngine_adapter)
{
$this->title .= array_pop($search_engine->build_excerpt($highlight, array($title), $this));
}
else
{
$this->title .= $title;
}
break; break;
case "BASK": case "BASK":
$this->title .= $this->name . ' - ' . parent::get_title() $this->title .= $this->name . ' - ' . parent::get_title($highlight, $search_engine)
. ' (' . $this->get_number() . '/' . $this->total . ') '; . ' (' . $this->get_number() . '/' . $this->total . ') ';
break; break;
case "REG": case "REG":
$title = parent::get_title();
if ($this->get_number() == 0) if ($this->get_number() == 0)
$this->title .= _('preview:: regroupement '); {
$this->title .= $title;
}
else else
{
$this->title .= sprintf( $this->title .= sprintf(
_('preview:: Previsualisation numero %s '), $this->get_number() . '/' . $this->total _('%s %d/%d '), $title, $this->get_number() . '/' . $this->total
); );
}
break; break;
default: default:
$this->title .= parent::get_title(); $this->title .= parent::get_title($highlight, $search_engine);
break; break;
} }

View File

@@ -9,6 +9,10 @@
<div style="text-align:center;"> <div style="text-align:center;">
{{record.get_status_icons()|raw}} {{record.get_status_icons()|raw}}
</div> </div>
{% if record.is_from_reg() %}
{{caption.format_caption(record)}}
{% else %}
{{caption.format_caption(record, highlight, searchEngine)}} {{caption.format_caption(record, highlight, searchEngine)}}
{% endif %}
<hr style="margin:10px 0;"/> <hr style="margin:10px 0;"/>
{% include 'common/technical_datas.twig' %} {% include 'common/technical_datas.twig' %}

View File

@@ -74,18 +74,18 @@
{% endif %} {% endif %}
{% for class, config in result.display %} {% for class, config in result.display %}
<td class="{{ class }}"> <td class="{{ class }}">
{% for key , result in value %} {% for key , res in value %}
{% if key == class %} {% if key == class %}
{% if config.bound == 1 and "</i>" not in result %} {% if config.bound == 1 and "</i>" not in res %}
{% if key == "user" and value.user == "<b>TOTAL</b>"%} {% if key == "user" and value.user == "<b>TOTAL</b>"%}
{{ result|raw }} {{ res|raw }}
{% elseif is_nav or is_doc %} {% elseif is_nav or is_doc %}
<a href="#" rel ="" class="{{result}} bound">{{ result|raw }}</a> <a href="#" rel ="" class="{{res}} bound">{{ res|raw }}</a>
{% else %} {% else %}
<a href="#" rel ="" class="{{value.usrid}} bound">{{ result|raw }}</a> <a href="#" rel ="" class="{{value.usrid}} bound">{{ res|raw }}</a>
{% endif %} {% endif %}
{% else %} {% else %}
{{ result|raw }} {{ res|raw }}
{% endif %} {% endif %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@@ -1840,6 +1840,7 @@ function preset_load(preset_id)
{ {
p4.edit.T_records[r].fields[""+i] = { p4.edit.T_records[r].fields[""+i] = {
value:[], value:[],
"meta_struct_id":p4.edit.T_fields[i].meta_struct_id,
dirty:true dirty:true
};// = { };// = {
var n = 0; var n = 0;
@@ -1853,6 +1854,7 @@ function preset_load(preset_id)
{ {
p4.edit.T_records[r].fields[""+i] = { p4.edit.T_records[r].fields[""+i] = {
"value":p4.edit.T_fields[i].preset[0], "value":p4.edit.T_fields[i].preset[0],
"meta_struct_id":p4.edit.T_fields[i].meta_struct_id,
"dirty":true "dirty":true
}; };
} }
@@ -1875,7 +1877,6 @@ function preset_load(preset_id)
function hsplit1() function hsplit1()
{ {
var el = $('#EDIT_TOP'); var el = $('#EDIT_TOP');