Permalink
Browse files

Update elfinder to latest version Important: requires composer update.

  • Loading branch information...
jmontoyaa committed Feb 9, 2017
1 parent 5607ff6 commit ac8a66b240bcf92a9e83ec2f4c7e829747269a00
@@ -78,7 +78,7 @@
"szymach/c-pchart": "1.*",
"aferrandini/phpqrcode": "1.0.1",
"mpdf/mpdf": "6.1.*",
"barryvdh/elfinder-builds": "2.1.0.3",
"studio-42/elfinder": "2.1.*",
"jbroadway/urlify": "dev-master",
"monolog/monolog": "~1.0",
"ircmaxell/password-compat": "~1.0.4",
@@ -1,4 +1,4 @@
{% set finderFolder = _p.web ~ 'vendor/barryvdh/elfinder-builds/' %}
{% set finderFolder = _p.web ~ 'vendor/studio-42/elfinder/' %}
<!-- elFinder CSS (REQUIRED) -->
<link rel="stylesheet" type="text/css" media="screen" href="{{ finderFolder }}css/elfinder.full.css">
<link rel="stylesheet" type="text/css" media="screen" href="{{ finderFolder }}css/theme.css">
@@ -219,7 +219,7 @@ public function getCourseDirectory()
/**
* {@inheritdoc}
*/
public function upload($fp, $dst, $name, $tmpname)
public function upload($fp, $dst, $name, $tmpname, $hashes = array())
{
$this->setConnectorFromPlugin();
@@ -20,7 +20,6 @@ public function setup()
$userId = api_get_user_id();
$dir = \UserManager::getUserPathById($userId, 'system');
if (!empty($dir)) {
if (!is_dir($dir)) {
mkdir($dir);
}
@@ -37,11 +36,9 @@ public function setup()
public function getConfiguration()
{
if ($this->allow()) {
$userId = api_get_user_id();
if (!empty($userId)) {
// Adding user personal files
$dir = \UserManager::getUserPathById($userId, 'system');
$dirWeb = \UserManager::getUserPathById($userId, 'web');
@@ -78,12 +75,10 @@ public function getConfiguration()
/**
* {@inheritdoc}
*/
public function upload($fp, $dst, $name, $tmpname)
public function upload($fp, $dst, $name, $tmpname, $hashes = array())
{
$this->setConnectorFromPlugin();
if ($this->allow()) {
return parent::upload($fp, $dst, $name, $tmpname);
}
}
@@ -96,7 +91,6 @@ public function rm($hash)
$this->setConnectorFromPlugin();
if ($this->allow()) {
return parent::rm($hash);
}
}
@@ -107,7 +101,6 @@ public function rm($hash)
public function allow()
{
//if ($this->connector->security->isGranted('IS_AUTHENTICATED_FULLY')) {
return !api_is_anonymous();
}
}
Oops, something went wrong.

3 comments on commit ac8a66b

@ywarnier

This comment has been minimized.

Copy link
Member

ywarnier replied Feb 17, 2017

Not sure how/why it worked for you, but for all of us here with different versions of PHP, this change broke the elfinder popup (it appears blank).
When doing composer update, in the notes, we get:

studio-42/elfinder suggests installing barryvdh/elfinder-flysystem-driver (VolumeDriver for elFinder to use Flysystem as a root.)
studio-42/elfinder suggests installing dropbox-php/dropbox-php (elFinder Volume driver `Dropbox` require `dropbox-php/dropbox-php`.)
studio-42/elfinder suggests installing nao-pon/flysystem-google-drive (require in GoogleDrive network volume mounting.)
studio-42/elfinder suggests installing pear/http_oauth (dropbox-php require `pear/http_oauth` or `PHP OAuth extension`.)

And then it finishes without error, but when opening the elfinder window, we get a blank page and the JS console shows:

"NetworkError: 404 Not Found - https://www.peruanojaponesvirtual.apj.org.pe/vendor/barryvdh/elfinder-builds/js/i18n/elfinder.ru.js"
"NetworkError: 404 Not Found - https://www.peruanojaponesvirtual.apj.org.pe/vendor/barryvdh/elfinder-builds/js/elfinder.full.js"
"NetworkError: 404 Not Found - https://www.peruanojaponesvirtual.apj.org.pe/vendor/barryvdh/elfinder-builds/css/theme.css"
...a series of other similar lines...
TypeError: $(...).elfinder is not a function

This prevents us from uploading anything. This is relatively important, but the big mystery is how it can work for you...

@ywarnier

This comment has been minimized.

Copy link
Member

ywarnier replied Feb 17, 2017

Nevermind this comment above: the portals we were testing were all using custom template folders (super weird circumstances), and so our elfinder tpl was not updated by your commit!
That was resolved by copying the main/template/default/javascript/editor/elfinder_standalone.tpl file to the custom template.

@jmontoyaa

This comment has been minimized.

Copy link
Member

jmontoyaa replied Feb 21, 2017

😼

Please sign in to comment.