Skip to content

Commit

Permalink
Solución a problema al editar distribuciones cuando se tienen demasia…
Browse files Browse the repository at this point in the history
…dos contenidos multimediales
  • Loading branch information
Nahuel Cuesta Luengo committed Dec 7, 2016
1 parent dd6365f commit c843abc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
4 changes: 3 additions & 1 deletion apps/backend/modules/article/actions/actions.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,13 @@ public function executeAutocompleteMultimedia()
$crit->addOr($c->getNewCriterion(MultimediaPeer::DESCRIPTION, $query, Criteria::LIKE));
$crit->addOr($c->getNewCriterion(MultimediaPeer::COMMENT, $query, Criteria::LIKE));
$c->add($crit);
if ($this->getRequestParameter('limit')) {
$c->setLimit(20);
}

$this->multimedias = MultimediaPeer::doSelect($c);
}


public function executeDelete()
{
$this->article = $this->getArticleOrCreate();
Expand Down
18 changes: 14 additions & 4 deletions lib/slotlet/slotlets/MultimediaSlotlet.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class MultimediaSlotlet implements ISlotlet
{
public function getConfigurationForm($values = array())
{
$ts = str_replace('.', '_', (string) microtime(true));
$row = '<div><label for="%id%">%label%</label> %field%</div><div style="clear:both;"></div>';
$labels = array(
'class' => __('Clase CSS'),
Expand All @@ -41,10 +42,19 @@ public function getConfigurationForm($values = array())
'n' => 'Grande'
);

$form = strtr($row, array(
'%id%' => 'multimedia_id',
$form = input_hidden_tag("multimedia_id_${ts}", $values['multimedia_id'], array('class' => 'slotlet_option', 'name' => 'multimedia_id'));

$multimedia = MultimediaPeer::retrieveByPk($values['multimedia_id']);

$form .= strtr($row, array(
'%id%' => "multimedia_id_${ts}",
'%label%' => $labels['multimedia_id'],
'%field%' => select_tag('multimedia_id', objects_for_select(MultimediaPeer::retrieveAll(), 'getId', '__toString', $values['multimedia_id']), array('class' => 'slotlet_option'))
'%field%' => input_auto_complete_tag("multimedia_id_${ts}_search",
$multimedia ? $multimedia->__toString() : '',
'article/autocompleteMultimedia?limit=20&_csrf_token='.csrf_token(),
array('class' => 'slotlet_option', 'size' => '80', 'name' => 'multimedia_id_search'),
array('use_style' => true,
'after_update_element' => "function(inputField, selectedItem) { console.log(selectedItem); $('multimedia_id_${ts}').value = selectedItem.id; }"))
));

$form .= strtr($row, array(
Expand Down Expand Up @@ -115,4 +125,4 @@ public static function getName()
return 'Contenido multimedial';
}

}
}

0 comments on commit c843abc

Please sign in to comment.