Skip to content

Commit

Permalink
Merge pull request #76 from gl005/2.3
Browse files Browse the repository at this point in the history
Made the changes of patch 2.5.1 available in 2.3
  • Loading branch information
helios-ag committed Oct 29, 2014
2 parents bfb870d + 6a74e35 commit 4834631
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions Controller/ElFinderController.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function showAction($instance)
{
$efParameters = $this->container->getParameter('fm_elfinder');
$parameters = $efParameters['instances'][$instance];
$result = $this->selectEditor($parameters, $instance);
$result = $this->selectEditor($parameters, $instance, $this->getRequest()->get("id"));

return $this->render($result['template'], $result['params']);
}
Expand All @@ -33,7 +33,7 @@ public function showAction($instance)
* @param $instance
* @return array
*/
private function selectEditor($parameters, $instance)
private function selectEditor($parameters, $instance, $formTypeId = null)
{
$editor = $parameters['editor'];
$locale = $parameters['locale'] ?: $this->container->getParameter('locale');
Expand Down Expand Up @@ -76,7 +76,8 @@ private function selectEditor($parameters, $instance)
'locale' => $locale,
'fullscreen' => $fullscreen,
'includeAssets' => $includeAssets,
'instance' => $instance
'instance' => $instance,
'id'=>$formTypeId
);
return $result;
default:
Expand Down
2 changes: 1 addition & 1 deletion Resources/views/Elfinder/elfinder_type.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
url : '{{path('ef_connect', { 'instance': instance } )}}',
lang : '{{locale}}',
getFileCallback: function(file) {
window.opener.setValue(file.path);
window.opener.setValue(file.path, "{{ id }}");
window.close();
}
});
Expand Down
8 changes: 4 additions & 4 deletions Resources/views/Form/elfinder_widget.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<input type="text" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %} data-type="elfinder-input-field" />
{% if enable and instance is defined %}
<script type="text/javascript" charset="utf-8">
$('[data-type="elfinder-input-field"]').on("click",function() {
var childWin = window.open("{{path('elfinder', {'instance': instance })}}", "popupWindow", "height=450, width=900");
$('[data-type="elfinder-input-field"][id="{{ id }}"]').on("click",function() {
var childWin = window.open("{{path('elfinder', {'instance': instance })}}?id={{ id }}", "popupWindow", "height=450, width=900");
});
function setValue(value) {
$('[data-type="elfinder-input-field"]').val(value);
function setValue(value, element_id) {
$('[data-type="elfinder-input-field"]'+ (element_id ? '[id="'+ element_id +'"]': '')).val(value);
}
</script>
{% endif %}
Expand Down

0 comments on commit 4834631

Please sign in to comment.