359 Commits

Author SHA1 Message Date
Frederic Massart
e42861d4fa MDL-38474 repository: Correct context when checking permissions to access a repository 2013-03-14 14:49:29 +08:00
Frederic Massart
89a9d21a15 MDL-37852 repository: Prevent undesired access to repositories settings 2013-03-05 09:56:22 +01:00
Frederic Massart
31581ae65d MDL-36426 repository: Prevent login_as() users to access private repositories 2013-03-04 02:38:35 +01:00
Frederic Massart
d7d69396b0 MDL-37641 files: Improve file name suggestion and performance 2013-02-20 08:50:40 +08:00
Dan Poltawski
0e35ba6ffc MDL-36357 cleanup - remove double semicolons 2012-11-15 09:51:26 +08:00
Frederic Massart
68acd1157e MDL-33766 files: Improved validation of areamaxbytes 2012-11-01 16:47:06 +08:00
Dan Poltawski
aed58a3da8 Merge branch 'MDL-35990-master' of git://github.com/FMCorz/moodle 2012-10-29 14:32:11 +08:00
Frederic Massart
e56de3a4d1 MDL-35990 repository: Added MOODLE_INTERNAL check and removed config inclusion 2012-10-16 14:01:29 +08:00
Matteo Scaramuccia
c67f1a342c MDL-35990 Repository Library should not include the main config.php file 2012-10-16 13:54:23 +08:00
Frederic Massart
8136753abf MDL-35892 repository: prepare_listing recursively prepares the data 2012-10-15 09:46:04 +08:00
Eloy Lafuente (stronk7)
92b75df804 Merge branch 'MDL-34945-master' of git://github.com/FMCorz/moodle 2012-09-06 20:11:53 +02:00
Eloy Lafuente (stronk7)
69689b4c3e Merge branch 'wip-MDL-34290-master' of git://github.com/marinaglancy/moodle 2012-08-29 12:11:00 +02:00
Marina Glancy
bc6f241ca2 MDL-34290 repository API: add repository function to import referenced file
it must be independed from sync_external_file because sync often does not actually download contents, it is used just to retrieve
the size of the file. Besides the timeouts for get_file and sync requests are very different.

Also add option to send_stored_file() to ignore reference and send cached contents
2012-08-29 11:56:15 +08:00
Marina Glancy
72a5655566 MDL-34290 repository API: add timeout to get_file and throw exception
- get_file should have a request timeout and throw an exception with the details (i.e. timeout reached) if download can
not be completed
- corrected phpdocs
2012-08-29 11:56:14 +08:00
Marina Glancy
59cb759850 MDL-34290 repository API: do not confuse source and reference
make sure that repository function get_file_source_info receives as argument the source of the file,
and get_file receives a reference;
reference is a value of DB field files_reference.reference and result of get_file_reference(source).
Fix dropbox as the only repository that have different values in those fields;
also added information about user in dropbox reference and original
2012-08-29 11:56:14 +08:00
Marina Glancy
2d222a3243 MDL-34290 repository API: allow get_file_by_reference return only filesize
we want to allow repositories to perform quick synchronisation, without downloading the file. In this case they return
only filesize, without the contenthash
2012-08-29 11:56:07 +08:00
Ankit Agarwal
5fbe2118bc MDL-34549 libraries: Changing strictness of context::instance_by_id() when required 2012-08-24 11:30:35 +08:00
Ankit Agarwal
d197ea4300 MDL-34549 libraries: Replace get_context_instance_by_id() by context::instance_by_id() 2012-08-24 11:30:10 +08:00
Frederic Massart
2c86955027 MDL-34945 Repository: Creating an instance requires the user to have the permission to view it 2012-08-24 10:55:22 +08:00
Paul Nicholls
ec3eaa2c38 MDL-33640 - change $templatesinitialized to an array; improve naming and automate use of template
* $templatesinitialized is now an array, so that subsequent calls to initialise_filepicker which request different repositories will include those (and only those) templates which it requires but have not yet been included
* The get_template method has also been renamed to get_upload_template (and the template to "uploadform_" followed by the repository type), since it only applies to upload forms
* If a plugin provides a get_upload_template method, the template it returns will now automatically be used instead of the standard uploadform template when generating an upload form
2012-08-09 09:47:40 +12:00
Paul Nicholls
013cf2878c MDL-33640 - Add ability to use custom filepicker templates
Allow repository plugins to register a template by defining a get_template() method, coupled with the ability to request the template be used by create_upload_form() instead of the standard 'uploadform' template.  The template is automatically registered using the plugin's name, and core templates will override any which clash; this also means that a theme can override these templates in a custom renderer if it wants to.
2012-08-08 13:50:47 +12:00
Frederic Massart
bb9ea890f6 MDL-34507 Repository: Better support for 'any' accepted filetypes 2012-07-27 10:01:27 +08:00
Frederic Massart
21c08c63ca MDL-34458 Librairies: Replaced deprecated get_context_instance() 2012-07-24 16:58:17 +08:00
Rajesh Taneja
405aca3532 MDL-32942 libraries: Replaced deprecated PARAM_ACTION and PARAM_FORMAT with PARAM_ALPHANUMEXT 2012-07-19 15:46:10 +08:00
Marina Glancy
6dc82385ab MDL-33950 Correctly initialise repository and check access in js and non-js filepicker 2012-07-06 09:44:07 +08:00
Marina Glancy
1bd0174743 MDL-33950 check if source file is accessible in repository_ajax.php
- repository::copy_to_area() does not check access any more, and repository_recent::copy_to_area() is unnecessary
- added repository::file_is_accessible() that checks access to the picked file (regardless of accessibility of the file it is referencing to)
2012-07-06 09:44:07 +08:00
Marina Glancy
c8161eec94 MDL-33997 Repository should not support references by default 2012-06-25 16:03:25 +08:00
Sam Hemelryk
92e0842978 Merge branch 'MDL-33808' of git://github.com/danpoltawski/moodle 2012-06-21 10:19:05 +12:00
Marina Glancy
83d2700ec9 MDL-33832 Fixed filling of files.source field
- also supress the error on unserialise (because people already may have broken files.source field)
- also display details about unparseable JSON error
- make source field look the same across repositories
2012-06-20 16:09:37 +08:00
Dan Poltawski
8655fb96cf MDL-33808 - format title on the repository instance screen 2012-06-19 12:10:56 +08:00
Dan Poltawski
102f928621 MDL-33808 - incorrect cleaning of repository names 2012-06-19 11:27:04 +08:00
Dongsheng Cai
d6453211b6 MDL-33513: Make files->source field consistent 2012-06-15 14:51:07 +08:00
Dan Poltawski
4585e6ac98 Merge branch 'wip-MDL-33550-master' of git://github.com/marinaglancy/moodle 2012-06-14 16:23:08 +08:00
Marina Glancy
6fd1cf05b0 MDL-33550 reset repository static cache between unit tests 2012-06-14 16:21:04 +08:00
Dan Poltawski
414ce30812 Revert MDL-33513
This reverts commit b2cf2b807f7a7c8d1a02ebb52038c61cc63a1494.
This reverts commit 24b96f01702571989fa77a05c5cd11b9fedc2745.
This reverts commit 39c60294a6a027ae56f4b9eda159bb589b60c0c0.
This reverts commit 8a288971e25eaaa4c8cbd67e450cee0e12435d4e.
2012-06-14 13:57:45 +08:00
Dan Poltawski
cd925ac79b Merge branch 'dev_MDL-33513_files_source' of git://github.com/danpoltawski/moodle 2012-06-14 11:12:21 +08:00
Dan Poltawski
b2cf2b807f MDL-33513 repositories - fix misleading phpdocs 2012-06-14 10:55:30 +08:00
Sam Hemelryk
043a53fb25 Merge branch 'MDL-33541' of git://github.com/danpoltawski/moodle 2012-06-14 11:27:37 +12:00
Dan Poltawski
3aad3a5e64 Merge branch 'wip-MDL-33452-master' of git://github.com/marinaglancy/moodle 2012-06-13 15:03:07 +08:00
Dan Poltawski
837eef2e64 MDL-33541 - remove cookies from filepicker 2012-06-13 12:17:52 +08:00
Marina Glancy
0b2bfbd1c6 MDL-33550 Correctly process situation when file reference source is missing
- do not die with fatal error if source file in moodle internal repository is missing;
- moved code duplication for moodle repositories into class repository (functions send_file, get_reference_details, get_file_by_reference, get_file_reference);
- update file status after repository::sync_external_file so we know that it is missing (or not missing anymore). Do not run this function more than once for file within one request;
- display readable name for Private Files and Server files with the new format;
- display broken icon in filemanager if we know that source is missing, display information (for admin) where it was located before: see repository::get_reference_details() and extending classes;
- removed unnecessary queries in stored_file::sync_external_file();
- syncronize files before displaying it's size in mod_resource, do not query  directly
2012-06-13 12:11:06 +08:00
Dan Poltawski
4a126f1725 MDL-32573 - repository: make instance_config_form static 2012-06-12 22:17:29 +08:00
Marina Glancy
c0e8f211d3 MDL-33452 It must not possible to create an alias to another alias
- if the downloaded file is an alias we pretend that we operate with its source
2012-06-12 11:03:54 +08:00
Dongsheng Cai
8a288971e2 MDL-33513: Make files->source field consistent 2012-06-10 17:47:00 +10:00
Marina Glancy
2dfa16ef8a MDL-33409 Newly copied files should take on the userid of the current user, and dates reset
- changed function repository::copy_to_area so it accepts more file attributes, pass changed attributes to it
- changed file_info::copy_to_storage and file_info_stored::copy_to_storage to accept more file attributes
- simplified file size check for moodle files in repository/repository_ajax.php
- removed unused code in repository/repository_ajax.php
2012-06-05 09:26:26 +08:00
Aparup Banerjee
09cb95f861 MDL-33324 Filepicker : fixed syntax. 2012-05-25 11:44:04 +08:00
Aparup Banerjee
0479a2873e MDL-33324 Filepicker : removed redundant parantheses. 2012-05-25 11:25:57 +08:00
Marina Glancy
9213f5476f MDL-33324 fixed bugs with icons in filepicker/filemanager treeview
- in treeview the icons for parent folders did not appear
- in treeview after refreshing (expanding subtrees) the image previews were replaced back to filetype icons
- also fixed a mistype in icon url in repository_local
2012-05-24 14:10:40 +08:00
Marina Glancy
e563582760 MDL-33158 fixed bugs with restricting file typs in filepicker
- extension was returned without leading dot which resulted in improper validation
- fixed human-readable mime type in error message
- fixed youtube repository to support video files and pass filetype validation
2012-05-22 14:24:11 +08:00
Marina Glancy
559276b153 MDL-32247,MDL-32831,MDL-32900 Use correct url building of file type icons
- function get_mimetypes_array() now contains also information about filetype groups and language strings
- use 'smart' human-readable mimetype description
- never determine filetype group based on filetype icon image! remove function mimeinfo_from_icon()
- get rid of class filetype_parser and file lib/filestorage/file_types.mm, replaced with functions file_get_typegroup(), file_extension_in_typegroup() and file_mimetype_in_typegroup()
- support multiple icon sizes, not only 16 and 32
- retrieve filetype icon only using proper functions file_..._icon() from lib/filelib.php throughout the code
- increase size of repository thumbnails to 90 and icons to 24 (will take effect when new icons exist)
2012-05-21 16:01:04 +08:00