File Picker Not Working

Re: File Picker Not Working

by Emma Blaney -
Number of replies: 8

Hi Emma

no that didnt work. Im going to try upgrading to 3.4 and see if that helps. 

thanks for trying

Emma

In reply to Emma Blaney

Re: File Picker Not Working

by Rodrigo Ribeiro -

Having the same inssue on Digital Ocean.


Tryed some alternatives, but with no success.


Going to test Moodle 2.9

In reply to Rodrigo Ribeiro

Re: File Picker Not Working

by Ken Task -
Picture of Particularly helpful Moodlers

3.4.1+ (Build: 20180223)

In Site Admin Appearance Ajax and Javascript:
Use online YUI libraries ... default is no- NOT checked
YUI combo loading ... is checked default is yes.
Cache Javascript: checked Default is yes
Activity chooser default: is checked - default is yet.

php cfg.php |grep 'yui'

useexternalyui    0
yuicomboloading    1
yui2version    2.9.0
yui3version    3.17.2
yuipatchlevel    0

On a functioning 3.4. not experiencing the issues described,
there are the .js the are 16 files cached in moodledata/localcache/js


php cfg.php |grep 'yui'

useexternalyui    0
yuicomboloading    1
yui2version    2.9.0
yui3version    3.17.2
yuipatchlevel    0

On a functioning 3.4. not experiencing the issues described,
There are 16 files cached in moodledata/localcache/js

Appear to be from YUI library.  The fist line in each section is the cache file name.
(probably not the same on your server).

[root@sos js]# fgrep 'yui' *

63d2ec1fad68e5baafd462236bcacf7027d3c453

:if(!this.msg_dlg){this.msg_dlg_node=Y.Node.create(M.core_filepicker.templates.message);this.msg_dlg_node.generateID();this.msg_dlg=new M.core.dialogue({bodyContent:this.msg_dlg_node,centered:!0,modal:!0,visible:!1});this.msg_dlg.plug(Y.Plugin.Drag,{handles:['#'+this.msg_dlg_node.get('id')+' .yui3-widget-hd']});this.msg_dlg_node.one('.fp-msg-butok').on('click',function(e){e.preventDefault();this.msg_dlg.hide()},this)}

63d2ec1fad68e5baafd462236bcacf7027d3c453

:var node=process_dlg_node;node.generateID();var process_dlg=new M.core.dialogue({bodyContent:node,headerContent:M.util.get_string('fileexistsdialogheader','repository'),centered:!0,modal:!0,visible:!1});process_dlg.plug(Y.Plugin.Drag,{handles:['#'+node.get('id')+' .yui3-widget-hd']});node.one('.fp-dlg-butoverwrite').on('click',function(e){e.preventDefault();process_dlg.hide();self.add_to_upload_queue(file,file.name,!0);self.process_renames()},this);node.one('.fp-dlg-butrename').on('click',function(e){e.preventDefault();process_dlg.hide();self.add_to_upload_queue(file,newname,!1);self.process_renames()},this);node.one('.fp-dlg-butcancel').on('click',function(e){e.preventDefault();process_dlg.hide();if(self.callbackcancel){self.callbackcancel()}},this);if(this.currentfilecount==this.options.maxfiles){node.one('.fp-dlg-butrename').setStyle('display','none');if(multiplefiles){node.one('.fp-dlg-butrenameall').setStyle('display','none')}}

71204035530466404491929799f026126654e72c

:M.yui.add_module=function(modules){for(var
modname in modules){YUI_config.modules[modname]=modules[modname]}

71204035530466404491929799f026126654e72c

:Y.applyConfig(YUI_config)};M.yui.galleryversion='2010.04.21-21-51';M.util=M.util||{};M.str=M.str||{};M.util.image_url=function(imagename,component){if(!component||component==''||component=='moodle'||component=='core'){component='core'}
71204035530466404491929799f026126654e72c:return M.util.pending_js.length};M.util.get_string=function(identifier,component,a){var stringvalue;if(M.cfg.developerdebug){if(typeof M.util.get_string_yui_instance==='undefined'){M.util.get_string_yui_instance=new YUI({debug:!0})}

71204035530466404491929799f026126654e72c

:var Y=M.util.get_string_yui_instance c814114ba5d4a75be1e0aa9d4e122074d138b56c:if(options.viewmode==2){append_files_tree()}else if(options.viewmode==3){append_files_table()}else{append_files_icons()}}},'@VERSION@',{requires:['base','node','yui2-treeview','panel','cookie','datatable','datatable-sort']});M.core_filepicker=M.core_filepicker||{};M.core_filepicker.instances=M.core_filepicker.instances||{};M.core_filepicker.active_filepicker=null;M.core_filepicker.templates=M.core_filepicker.templates||{};M.core_filepicker.loadedpreviews=M.core_filepicker.loadedpreviews||{};M.core_filepicker.select_file=function(file){M.core_filepicker.active_filepicker.select_file(file)}

On your system, what are ownerships/permissions on moodledata/localcache/js?

drwxrwsrwx. 2 apache apache 4096 Feb 27 12:46 js
-rw-rw-rw-. 1 apache apache on fils in the cache.

I don't know of any method to force reloading of the YUI cached js files.    Maybe a true programmer could tell all!

'spirit of sharing', Ken

Average of ratings: Useful (1)
In reply to Ken Task

Re: File Picker Not Working

by Rodrigo Ribeiro -

Hello Ken!

Thank you about your time!

In Site Admin Appearance Ajax and Javascript:
Use online YUI libraries ... default is no- NOT checked
YUI combo loading ... is checked default is yes.
Cache Javascript: checked Default is yes
Activity chooser default: is checked - default is yet.

I tested changing these parameters, without success.


On the folder js, it did not exist. Maybe it's the problem. But strange, because the permission has always been with apache as owner and works perfectly on other servers.


[root@srv12 ~]# php /var/www/moodle/public_html/moodle/admin/cli/cfg.php | grep 'yui'

useexternalyui  0

yuicomboloading 1

yui2version     2.9.0

yui3version     3.17.2

yuipatchlevel   0


[root@srv12 ~]# ls -lha /var/www/moodle/moodledata/localcache/

total 0

drwxrwxrwx.  5 apache apache  74 Mar  4 13:35 .

drwxrwxrwx. 13 apache apache 175 Mar  4 09:51 ..

drwxrwxrwx   3 apache apache  27 Mar  4 13:35 htmlpurifier

-rw-rw-rw-   1 apache apache   0 Mar  4 13:35 .lastpurged

drwxrwxrwx   3 apache apache  24 Mar  4 13:35 mustache

drwxrwxrwx   3 apache apache  24 Mar  4 13:35 theme


Afeter i created /js:

[root@srv12 ~]# ls -lha /var/www/moodle/moodledata/localcache/js/

total 236K

drwxrwxrwx  2 root   root   294 Mar  4 21:58 .

drwxrwxrwx. 7 apache apache 101 Mar  4 21:58 ..

-rw-rw-rw-  1 apache apache 14K Mar  4 21:58 1c08e738883b37df8ae4cc25b50101ed054fe6bb

-rw-rw-rw-  1 apache apache 49K Mar  4 21:58 256b73925ff9219c6cb787bb22217b6ea4c59812

-rw-rw-rw-  1 apache apache 85K Mar  4 21:58 5a377647165096439b034159031a9bdc5b0cb488

-rw-rw-rw-  1 apache apache 26K Mar  4 21:58 6a7167556af38b232c1ce2d8034bcf34825cbdd5

-rw-rw-rw-  1 apache apache 26K Mar  4 21:58 a17a0a31686ec305143d2685007c028f02f1a66c

-rw-rw-rw-  1 apache apache 21K Mar  4 21:58 c51906293caa3fee3a13c87a338c03791f35e5c2


But it did not solve the problem yet....We are on the correct way to solve!

Thank you again! 

In reply to Rodrigo Ribeiro

Re: File Picker Not Working

by Ken Task -
Picture of Particularly helpful Moodlers

Thinking out loud ... without access .... sooooooo

See:

ls -lha /var/www/moodle/moodledata/localcache/js/

drwxrwxrwx  2 root   root   294 Mar  4 21:58 .

The .dot has always meant 'pwd' ... I think .. like issuing a command from the present working directory not in paths ... php ./somephpscript.php

You had to manually create js directory, so that means purge cache scripts which might delete directories and then attempt to re-create them couldn't?!!!

so what are ownerships/permissions on localcache dir and on the js directory?

cd /path/to/moodledata/

chown apache:apache localcache -R

I also see (in your case) that moodledata is inside moodle code?

Is there an .htaccess file in moodledata?

Could you access moodledata with browser?   http://site/moodle/moodledata/

'spirit of sharing', Ken


In reply to Ken Task

Re: File Picker Not Working

by Rodrigo Ribeiro -

Hello Ken!


I created the JS folder and the files appeared there, but still it still does not work.


I installed another moodle, I gave permission 777 in the moodledata directory and it also has the same problem, but this one created the js folder and the files, but the infinite wheel problem still continues.


As exposed, the files were created after creating the folder, with apache: apache.


I tried to clear the caches, the files disappeared and when trying again, some appeared, but it did not solve the problem.


The moodledata folder is behind public_html and not accessible via HTTP (s).


I will reinstall the VPS and test again, unfortunately.


Thank you!

In reply to Rodrigo Ribeiro

Re: File Picker Not Working

by Ken Task -
Picture of Particularly helpful Moodlers

What OS is this?  CentOS or Ubuntu? or ?

If either of those, and a true VPS (you are the only customer on the server), there is no reason to put moodledata in a 'public_html' directory.   public_html typically a 'user' space which is restricted (check your main config file for apache) ... that's the only reason one would put moodledata at that location ... right along side the code directory ... moodle.

In both of the OS's above (Centos 7 and Ubuntu 16.04) apache has /var/www/ as it's 'home' directory and 'document' root is /var/www/html/.   Since apache user/group already knows about /var/www/ moodledata should be located there - unless you have a large partition ... like /data/.   Moodle code goes in /var/www/html/ or in a directory of /var/www/html/.

Also ... if CentOS, is seLinux running?   How about any other additional protections for PHP ... like suPHP.

'spirit of sharing', Ken


In reply to Rodrigo Ribeiro

Re: File Picker Not Working

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Rodrigo,
please open the Development Tools of your browser and look at the body of the response of the request named draftfiles_ajax.php?action=list: the text in that body will be the reason for your spinning wheel (an error or an HTML page explaining the error).

Some refs: https://moodle.org/mod/forum/discuss.php?d=366360 .

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: File Picker Not Working

by Rodrigo Ribeiro -

Hello people


Thank you very much for your willingness to help!


Since I was short on time, I could not debug to resolve. I refitted the server and the test was working normally.


Centos7 + Apache + MariaDB + Php7 (not fpm).


About moodledata, it is not accessible. Only public_html is accessible via the internet.


I have several moodles and I have never seen this kind of problem. I hope it does not happen to anyone else.


Thank you!