Merge branch 'MDL-26562-23' of git://github.com/vadimonus/moodle
authorSam Hemelryk <sam@moodle.com>
Wed, 23 May 2012 23:00:09 +0000 (11:00 +1200)
committerSam Hemelryk <sam@moodle.com>
Wed, 23 May 2012 23:00:09 +0000 (11:00 +1200)
720 files changed:
admin/repository.php
admin/repositoryinstance.php
admin/settings/development.php
admin/settings/plugins.php
admin/timezone.php
admin/tool/assignmentupgrade/batchupgrade.php
admin/tool/assignmentupgrade/index.php
admin/tool/assignmentupgrade/lang/en/tool_assignmentupgrade.php
admin/tool/assignmentupgrade/listnotupgraded.php
admin/tool/assignmentupgrade/locallib.php
admin/tool/assignmentupgrade/module.js
admin/tool/assignmentupgrade/paginationform.php [new file with mode: 0644]
admin/tool/assignmentupgrade/renderer.php
admin/tool/assignmentupgrade/styles.css
admin/tool/assignmentupgrade/upgradableassignmentstable.php
admin/tool/assignmentupgrade/upgradesingle.php
admin/tool/assignmentupgrade/upgradesingleconfirm.php
admin/tool/unittest/coveragefile.php
backup/backupfilesedit_form.php
backup/moodle2/backup_stepslib.php
backup/moodle2/restore_stepslib.php
backup/util/dbops/backup_controller_dbops.class.php
backup/util/dbops/restore_dbops.class.php
backup/util/helper/backup_file_manager.class.php
backup/util/helper/backup_general_helper.class.php
backup/util/helper/convert_helper.class.php
backup/util/ui/backup_ui_stage.class.php
backup/util/ui/renderer.php
blocks/activity_modules/block_activity_modules.php
blocks/private_files/edit.php
blocks/private_files/renderer.php
blog/locallib.php
course/dndupload.js
course/dnduploadlib.php
course/format/renderer.php
course/format/topics/format.js
course/format/topics/renderer.php
course/format/weeks/format.js
course/lib.php
course/yui/coursebase/coursebase.js
course/yui/dragdrop/dragdrop.js
course/yui/toolboxes/toolboxes.js
draftfile.php
enrol/mnet/enrol.php
files/coursefilesedit_form.php
files/filebrowser_ajax.php
files/renderer.php
grade/lib.php
lang/en/admin.php
lang/en/backup.php
lang/en/error.php
lang/en/mimetypes.php
lang/en/moodle.php
lang/en/repository.php
lib/cronlib.php
lib/db/install.xml
lib/db/upgrade.php
lib/filebrowser/file_info.php
lib/filebrowser/file_info_context_user.php
lib/filebrowser/file_info_stored.php
lib/filelib.php
lib/filestorage/file_exceptions.php
lib/filestorage/file_storage.php
lib/filestorage/file_types.mm [deleted file]
lib/filestorage/stored_file.php
lib/filestorage/tests/file_storage_test.php
lib/form/dndupload.js
lib/form/editor.php
lib/form/filemanager.js
lib/form/filemanager.php
lib/form/filepicker.js
lib/form/filepicker.php
lib/formslib.php
lib/medialib.php
lib/navigationlib.php
lib/outputrenderers.php
lib/outputrequirementslib.php
lib/pluginlib.php
lib/portfolio/formats.php
lib/tests/filelib_test.php
lib/tests/medialib_test.php
lib/tests/repositorylib_test.php [deleted file]
lib/weblib.php
mod/assign/backup/moodle2/backup_assign_stepslib.php
mod/assign/db/install.xml
mod/assign/db/messages.php
mod/assign/db/upgrade.php
mod/assign/gradingbatchoperationsform.php
mod/assign/gradingoptionsform.php
mod/assign/gradingtable.php
mod/assign/lang/en/assign.php
mod/assign/lib.php
mod/assign/locallib.php
mod/assign/mod_form.php
mod/assign/module.js
mod/assign/quickgradingform.php [new file with mode: 0644]
mod/assign/renderable.php
mod/assign/renderer.php
mod/assign/settings.php
mod/assign/styles.css
mod/assign/upgradelib.php
mod/assign/version.php
mod/assignment/lib.php
mod/assignment/renderer.php
mod/assignment/type/online/assignment.class.php
mod/assignment/type/upload/assignment.class.php
mod/assignment/type/uploadsingle/assignment.class.php
mod/book/README.md [new file with mode: 0644]
mod/book/backup/moodle1/lib.php [new file with mode: 0644]
mod/book/backup/moodle2/backup_book_activity_task.class.php [new file with mode: 0644]
mod/book/backup/moodle2/backup_book_settingslib.php [new file with mode: 0644]
mod/book/backup/moodle2/backup_book_stepslib.php [new file with mode: 0644]
mod/book/backup/moodle2/restore_book_activity_task.class.php [new file with mode: 0644]
mod/book/backup/moodle2/restore_book_stepslib.php [new file with mode: 0644]
mod/book/db/access.php [new file with mode: 0644]
mod/book/db/install.xml [new file with mode: 0644]
mod/book/db/log.php [new file with mode: 0644]
mod/book/db/subplugins.php [new file with mode: 0644]
mod/book/db/upgrade.php [new file with mode: 0644]
mod/book/delete.php [new file with mode: 0644]
mod/book/edit.php [new file with mode: 0644]
mod/book/edit_form.php [new file with mode: 0644]
mod/book/index.php [new file with mode: 0644]
mod/book/lang/en/book.php [new file with mode: 0644]
mod/book/lib.php [new file with mode: 0644]
mod/book/locallib.php [new file with mode: 0644]
mod/book/mod_form.php [new file with mode: 0644]
mod/book/move.php [new file with mode: 0644]
mod/book/pix/add.png [new file with mode: 0644]
mod/book/pix/chapter.png [new file with mode: 0644]
mod/book/pix/icon.png [new file with mode: 0644]
mod/book/pix/nav_exit.png [new file with mode: 0644]
mod/book/pix/nav_next.png [new file with mode: 0644]
mod/book/pix/nav_prev.png [new file with mode: 0644]
mod/book/pix/nav_prev_dis.png [new file with mode: 0644]
mod/book/pix/nav_sep.png [new file with mode: 0644]
mod/book/settings.php [new file with mode: 0644]
mod/book/show.php [new file with mode: 0644]
mod/book/styles.css [new file with mode: 0644]
mod/book/tool/exportimscp/db/access.php [new file with mode: 0644]
mod/book/tool/exportimscp/db/log.php [new file with mode: 0644]
mod/book/tool/exportimscp/imscp.css [new file with mode: 0644]
mod/book/tool/exportimscp/index.php [new file with mode: 0644]
mod/book/tool/exportimscp/lang/en/booktool_exportimscp.php [new file with mode: 0644]
mod/book/tool/exportimscp/lib.php [new file with mode: 0644]
mod/book/tool/exportimscp/locallib.php [new file with mode: 0644]
mod/book/tool/exportimscp/pix/generate.png [new file with mode: 0644]
mod/book/tool/exportimscp/version.php [new file with mode: 0644]
mod/book/tool/importhtml/db/access.php [new file with mode: 0644]
mod/book/tool/importhtml/import_form.php [new file with mode: 0644]
mod/book/tool/importhtml/index.php [new file with mode: 0644]
mod/book/tool/importhtml/lang/en/booktool_importhtml.php [new file with mode: 0644]
mod/book/tool/importhtml/lib.php [new file with mode: 0644]
mod/book/tool/importhtml/locallib.php [new file with mode: 0644]
mod/book/tool/importhtml/version.php [new file with mode: 0644]
mod/book/tool/print/db/access.php [new file with mode: 0644]
mod/book/tool/print/db/log.php [new file with mode: 0644]
mod/book/tool/print/index.php [new file with mode: 0644]
mod/book/tool/print/lang/en/booktool_print.php [new file with mode: 0644]
mod/book/tool/print/lib.php [new file with mode: 0644]
mod/book/tool/print/locallib.php [new file with mode: 0644]
mod/book/tool/print/pix/book.png [new file with mode: 0644]
mod/book/tool/print/pix/chapter.png [new file with mode: 0644]
mod/book/tool/print/print.css [new file with mode: 0644]
mod/book/tool/print/version.php [new file with mode: 0644]
mod/book/version.php [new file with mode: 0644]
mod/book/view.php [new file with mode: 0644]
mod/data/field/file/field.class.php
mod/data/field/picture/field.class.php
mod/folder/edit.php
mod/folder/edit_form.php
mod/folder/mod_form.php
mod/forum/lib.php
mod/glossary/lib.php
mod/resource/lib.php
mod/resource/locallib.php
mod/resource/mod_form.php
mod/url/locallib.php
mod/wiki/edit_form.php
mod/wiki/editors/wikifiletable.php
mod/wiki/filesedit.php
mod/wiki/renderer.php
mod/workshop/renderer.php
mod/workshop/submission.php
pix/a/add_file.png [new file with mode: 0644]
pix/a/create_folder.png [new file with mode: 0644]
pix/a/download_all.png [new file with mode: 0644]
pix/f/FileTypesIcons-LICENSE.txt [new file with mode: 0644]
pix/f/Oxygen-LICENSE.txt [new file with mode: 0644]
pix/f/audio-128.png [new file with mode: 0644]
pix/f/audio-24.png [new file with mode: 0644]
pix/f/audio-256.png [new file with mode: 0644]
pix/f/audio-32.png
pix/f/audio-48.png [new file with mode: 0644]
pix/f/audio-64.png [new file with mode: 0644]
pix/f/audio-72.png [new file with mode: 0644]
pix/f/audio-80.png [new file with mode: 0644]
pix/f/audio-96.png [new file with mode: 0644]
pix/f/audio.gif [deleted file]
pix/f/audio.png [new file with mode: 0644]
pix/f/avi-128.png [new file with mode: 0644]
pix/f/avi-24.png [new file with mode: 0644]
pix/f/avi-256.png [new file with mode: 0644]
pix/f/avi-32.png
pix/f/avi-48.png [new file with mode: 0644]
pix/f/avi-64.png [new file with mode: 0644]
pix/f/avi-72.png [new file with mode: 0644]
pix/f/avi-80.png [new file with mode: 0644]
pix/f/avi-96.png [new file with mode: 0644]
pix/f/avi.gif [deleted file]
pix/f/avi.png [new file with mode: 0644]
pix/f/bmp-128.png [new file with mode: 0644]
pix/f/bmp-24.png [new file with mode: 0644]
pix/f/bmp-256.png [new file with mode: 0644]
pix/f/bmp-32.png [new file with mode: 0644]
pix/f/bmp-48.png [new file with mode: 0644]
pix/f/bmp-64.png [new file with mode: 0644]
pix/f/bmp-72.png [new file with mode: 0644]
pix/f/bmp-80.png [new file with mode: 0644]
pix/f/bmp-96.png [new file with mode: 0644]
pix/f/bmp.png [new file with mode: 0644]
pix/f/database-128.png [new file with mode: 0644]
pix/f/database-24.png [new file with mode: 0644]
pix/f/database-256.png [new file with mode: 0644]
pix/f/database-32.png [new file with mode: 0644]
pix/f/database-48.png [new file with mode: 0644]
pix/f/database-64.png [new file with mode: 0644]
pix/f/database-72.png [new file with mode: 0644]
pix/f/database-80.png [new file with mode: 0644]
pix/f/database-96.png [new file with mode: 0644]
pix/f/database.png [new file with mode: 0644]
pix/f/docm-32.png [deleted file]
pix/f/docm.gif [deleted file]
pix/f/document-128.png [new file with mode: 0644]
pix/f/document-24.png [new file with mode: 0644]
pix/f/document-256.png [new file with mode: 0644]
pix/f/document-32.png [new file with mode: 0644]
pix/f/document-48.png [new file with mode: 0644]
pix/f/document-64.png [new file with mode: 0644]
pix/f/document-72.png [new file with mode: 0644]
pix/f/document-80.png [new file with mode: 0644]
pix/f/document-96.png [new file with mode: 0644]
pix/f/document.png [new file with mode: 0644]
pix/f/docx-128.png [new file with mode: 0644]
pix/f/docx-24.png [new file with mode: 0644]
pix/f/docx-256.png [new file with mode: 0644]
pix/f/docx-32.png
pix/f/docx-48.png [new file with mode: 0644]
pix/f/docx-64.png [new file with mode: 0644]
pix/f/docx-72.png [new file with mode: 0644]
pix/f/docx-80.png [new file with mode: 0644]
pix/f/docx-96.png [new file with mode: 0644]
pix/f/docx.gif [deleted file]
pix/f/docx.png [new file with mode: 0644]
pix/f/dotm-32.png [deleted file]
pix/f/dotm.gif [deleted file]
pix/f/dotx-32.png [deleted file]
pix/f/dotx.gif [deleted file]
pix/f/eps-128.png [new file with mode: 0644]
pix/f/eps-24.png [new file with mode: 0644]
pix/f/eps-256.png [new file with mode: 0644]
pix/f/eps-32.png [new file with mode: 0644]
pix/f/eps-48.png [new file with mode: 0644]
pix/f/eps-64.png [new file with mode: 0644]
pix/f/eps-72.png [new file with mode: 0644]
pix/f/eps-80.png [new file with mode: 0644]
pix/f/eps-96.png [new file with mode: 0644]
pix/f/eps.png [new file with mode: 0644]
pix/f/excel-32.png [deleted file]
pix/f/excel.gif [deleted file]
pix/f/flash-128.png [new file with mode: 0644]
pix/f/flash-24.png [new file with mode: 0644]
pix/f/flash-256.png [new file with mode: 0644]
pix/f/flash-32.png [new file with mode: 0644]
pix/f/flash-48.png [new file with mode: 0644]
pix/f/flash-64.png [new file with mode: 0644]
pix/f/flash-72.png [new file with mode: 0644]
pix/f/flash-80.png [new file with mode: 0644]
pix/f/flash-96.png [new file with mode: 0644]
pix/f/flash.gif [deleted file]
pix/f/flash.png [new file with mode: 0644]
pix/f/folder-128.png [new file with mode: 0644]
pix/f/folder-24.png [new file with mode: 0644]
pix/f/folder-32.png
pix/f/folder-48.png [new file with mode: 0644]
pix/f/folder-64.png [new file with mode: 0644]
pix/f/folder-open-128.png [new file with mode: 0644]
pix/f/folder-open-24.png [new file with mode: 0644]
pix/f/folder-open-32.png [new file with mode: 0644]
pix/f/folder-open-48.png [new file with mode: 0644]
pix/f/folder-open-64.png [new file with mode: 0644]
pix/f/folder-open.png [new file with mode: 0644]
pix/f/folder.gif [deleted file]
pix/f/folder.png [new file with mode: 0644]
pix/f/gif-128.png [new file with mode: 0644]
pix/f/gif-24.png [new file with mode: 0644]
pix/f/gif-256.png [new file with mode: 0644]
pix/f/gif-32.png [new file with mode: 0644]
pix/f/gif-48.png [new file with mode: 0644]
pix/f/gif-64.png [new file with mode: 0644]
pix/f/gif-72.png [new file with mode: 0644]
pix/f/gif-80.png [new file with mode: 0644]
pix/f/gif-96.png [new file with mode: 0644]
pix/f/gif.png [new file with mode: 0644]
pix/f/html-128.png [new file with mode: 0644]
pix/f/html-24.png [new file with mode: 0644]
pix/f/html-256.png [new file with mode: 0644]
pix/f/html-32.png
pix/f/html-48.png [new file with mode: 0644]
pix/f/html-64.png [new file with mode: 0644]
pix/f/html-72.png [new file with mode: 0644]
pix/f/html-80.png [new file with mode: 0644]
pix/f/html-96.png [new file with mode: 0644]
pix/f/html.gif [deleted file]
pix/f/html.png [new file with mode: 0644]
pix/f/image-128.png [new file with mode: 0644]
pix/f/image-24.png [new file with mode: 0644]
pix/f/image-256.png [new file with mode: 0644]
pix/f/image-32.png
pix/f/image-48.png [new file with mode: 0644]
pix/f/image-64.png [new file with mode: 0644]
pix/f/image-72.png [new file with mode: 0644]
pix/f/image-80.png [new file with mode: 0644]
pix/f/image-96.png [new file with mode: 0644]
pix/f/image.gif [deleted file]
pix/f/image.png [new file with mode: 0644]
pix/f/jbc.gif [deleted file]
pix/f/jcl.gif [deleted file]
pix/f/jcw.gif [deleted file]
pix/f/jmt.gif [deleted file]
pix/f/jmx.gif [deleted file]
pix/f/jpeg-128.png [new file with mode: 0644]
pix/f/jpeg-24.png [new file with mode: 0644]
pix/f/jpeg-256.png [new file with mode: 0644]
pix/f/jpeg-32.png [new file with mode: 0644]
pix/f/jpeg-48.png [new file with mode: 0644]
pix/f/jpeg-64.png [new file with mode: 0644]
pix/f/jpeg-72.png [new file with mode: 0644]
pix/f/jpeg-80.png [new file with mode: 0644]
pix/f/jpeg-96.png [new file with mode: 0644]
pix/f/jpeg.png [new file with mode: 0644]
pix/f/jqz.gif [deleted file]
pix/f/moodle-128.png [new file with mode: 0644]
pix/f/moodle-24.png [new file with mode: 0644]
pix/f/moodle-256.png [new file with mode: 0644]
pix/f/moodle-32.png [new file with mode: 0644]
pix/f/moodle-48.png [new file with mode: 0644]
pix/f/moodle-64.png [new file with mode: 0644]
pix/f/moodle-72.png [new file with mode: 0644]
pix/f/moodle-80.png [new file with mode: 0644]
pix/f/moodle-96.png [new file with mode: 0644]
pix/f/moodle.png [new file with mode: 0644]
pix/f/mov-128.png [new file with mode: 0644]
pix/f/mov-24.png [new file with mode: 0644]
pix/f/mov-256.png [new file with mode: 0644]
pix/f/mov-32.png [new file with mode: 0644]
pix/f/mov-48.png [new file with mode: 0644]
pix/f/mov-64.png [new file with mode: 0644]
pix/f/mov-72.png [new file with mode: 0644]
pix/f/mov-80.png [new file with mode: 0644]
pix/f/mov-96.png [new file with mode: 0644]
pix/f/mov.png [new file with mode: 0644]
pix/f/mp3-128.png [new file with mode: 0644]
pix/f/mp3-24.png [new file with mode: 0644]
pix/f/mp3-256.png [new file with mode: 0644]
pix/f/mp3-32.png [new file with mode: 0644]
pix/f/mp3-48.png [new file with mode: 0644]
pix/f/mp3-64.png [new file with mode: 0644]
pix/f/mp3-72.png [new file with mode: 0644]
pix/f/mp3-80.png [new file with mode: 0644]
pix/f/mp3-96.png [new file with mode: 0644]
pix/f/mp3.png [new file with mode: 0644]
pix/f/mpeg-128.png [new file with mode: 0644]
pix/f/mpeg-24.png [new file with mode: 0644]
pix/f/mpeg-256.png [new file with mode: 0644]
pix/f/mpeg-32.png [new file with mode: 0644]
pix/f/mpeg-48.png [new file with mode: 0644]
pix/f/mpeg-64.png [new file with mode: 0644]
pix/f/mpeg-72.png [new file with mode: 0644]
pix/f/mpeg-80.png [new file with mode: 0644]
pix/f/mpeg-96.png [new file with mode: 0644]
pix/f/mpeg.png [new file with mode: 0644]
pix/f/odb-128.png [new file with mode: 0644]
pix/f/odb-24.png [new file with mode: 0644]
pix/f/odb-32.png [new file with mode: 0644]
pix/f/odb-48.png [new file with mode: 0644]
pix/f/odb-64.png [new file with mode: 0644]
pix/f/odb-72.png [new file with mode: 0644]
pix/f/odb-80.png [new file with mode: 0644]
pix/f/odb-96.png [new file with mode: 0644]
pix/f/odb.gif [deleted file]
pix/f/odb.png [new file with mode: 0644]
pix/f/odc-128.png [new file with mode: 0644]
pix/f/odc-24.png [new file with mode: 0644]
pix/f/odc-32.png [new file with mode: 0644]
pix/f/odc-48.png [new file with mode: 0644]
pix/f/odc-64.png [new file with mode: 0644]
pix/f/odc-72.png [new file with mode: 0644]
pix/f/odc-80.png [new file with mode: 0644]
pix/f/odc-96.png [new file with mode: 0644]
pix/f/odc.gif [deleted file]
pix/f/odc.png [new file with mode: 0644]
pix/f/odf-128.png [new file with mode: 0644]
pix/f/odf-24.png [new file with mode: 0644]
pix/f/odf-32.png [new file with mode: 0644]
pix/f/odf-48.png [new file with mode: 0644]
pix/f/odf-64.png [new file with mode: 0644]
pix/f/odf-72.png [new file with mode: 0644]
pix/f/odf-80.png [new file with mode: 0644]
pix/f/odf-96.png [new file with mode: 0644]
pix/f/odf.gif [deleted file]
pix/f/odf.png [new file with mode: 0644]
pix/f/odg-128.png [new file with mode: 0644]
pix/f/odg-24.png [new file with mode: 0644]
pix/f/odg-32.png [new file with mode: 0644]
pix/f/odg-48.png [new file with mode: 0644]
pix/f/odg-64.png [new file with mode: 0644]
pix/f/odg-72.png [new file with mode: 0644]
pix/f/odg-80.png [new file with mode: 0644]
pix/f/odg-96.png [new file with mode: 0644]
pix/f/odg.gif [deleted file]
pix/f/odg.png [new file with mode: 0644]
pix/f/odi.gif [deleted file]
pix/f/odm.gif [deleted file]
pix/f/odp-128.png [new file with mode: 0644]
pix/f/odp-24.png [new file with mode: 0644]
pix/f/odp-32.png
pix/f/odp-48.png [new file with mode: 0644]
pix/f/odp-64.png [new file with mode: 0644]
pix/f/odp-72.png [new file with mode: 0644]
pix/f/odp-80.png [new file with mode: 0644]
pix/f/odp-96.png [new file with mode: 0644]
pix/f/odp.gif [deleted file]
pix/f/odp.png [new file with mode: 0644]
pix/f/ods-128.png [new file with mode: 0644]
pix/f/ods-24.png [new file with mode: 0644]
pix/f/ods-32.png [new file with mode: 0644]
pix/f/ods-48.png [new file with mode: 0644]
pix/f/ods-64.png [new file with mode: 0644]
pix/f/ods-72.png [new file with mode: 0644]
pix/f/ods-80.png [new file with mode: 0644]
pix/f/ods-96.png [new file with mode: 0644]
pix/f/ods.gif [deleted file]
pix/f/ods.png [new file with mode: 0644]
pix/f/odt-128.png [new file with mode: 0644]
pix/f/odt-24.png [new file with mode: 0644]
pix/f/odt-32.png
pix/f/odt-48.png [new file with mode: 0644]
pix/f/odt-64.png [new file with mode: 0644]
pix/f/odt-72.png [new file with mode: 0644]
pix/f/odt-80.png [new file with mode: 0644]
pix/f/odt-96.png [new file with mode: 0644]
pix/f/odt.gif [deleted file]
pix/f/odt.png [new file with mode: 0644]
pix/f/oth-128.png [new file with mode: 0644]
pix/f/oth-24.png [new file with mode: 0644]
pix/f/oth-32.png [new file with mode: 0644]
pix/f/oth-48.png [new file with mode: 0644]
pix/f/oth-64.png [new file with mode: 0644]
pix/f/oth-72.png [new file with mode: 0644]
pix/f/oth-80.png [new file with mode: 0644]
pix/f/oth-96.png [new file with mode: 0644]
pix/f/oth.png [new file with mode: 0644]
pix/f/pdf-128.png [new file with mode: 0644]
pix/f/pdf-24.png [new file with mode: 0644]
pix/f/pdf-256.png [new file with mode: 0644]
pix/f/pdf-32.png [new file with mode: 0644]
pix/f/pdf-48.png [new file with mode: 0644]
pix/f/pdf-64.png [new file with mode: 0644]
pix/f/pdf-72.png [new file with mode: 0644]
pix/f/pdf-80.png [new file with mode: 0644]
pix/f/pdf-96.png [new file with mode: 0644]
pix/f/pdf.gif [deleted file]
pix/f/pdf.png [new file with mode: 0644]
pix/f/png-128.png [new file with mode: 0644]
pix/f/png-24.png [new file with mode: 0644]
pix/f/png-256.png [new file with mode: 0644]
pix/f/png-32.png [new file with mode: 0644]
pix/f/png-48.png [new file with mode: 0644]
pix/f/png-64.png [new file with mode: 0644]
pix/f/png-72.png [new file with mode: 0644]
pix/f/png-80.png [new file with mode: 0644]
pix/f/png-96.png [new file with mode: 0644]
pix/f/png.png [new file with mode: 0644]
pix/f/potm.gif [deleted file]
pix/f/potx.gif [deleted file]
pix/f/powerpoint-128.png [new file with mode: 0644]
pix/f/powerpoint-24.png [new file with mode: 0644]
pix/f/powerpoint-256.png [new file with mode: 0644]
pix/f/powerpoint-32.png
pix/f/powerpoint-48.png [new file with mode: 0644]
pix/f/powerpoint-64.png [new file with mode: 0644]
pix/f/powerpoint-72.png [new file with mode: 0644]
pix/f/powerpoint-80.png [new file with mode: 0644]
pix/f/powerpoint-96.png [new file with mode: 0644]
pix/f/powerpoint.gif [deleted file]
pix/f/powerpoint.png [new file with mode: 0644]
pix/f/ppam.gif [deleted file]
pix/f/pps-32.png [deleted file]
pix/f/ppsm.gif [deleted file]
pix/f/ppsx-32.png [deleted file]
pix/f/ppsx.gif [deleted file]
pix/f/pptm.gif [deleted file]
pix/f/pptx-128.png [new file with mode: 0644]
pix/f/pptx-24.png [new file with mode: 0644]
pix/f/pptx-256.png [new file with mode: 0644]
pix/f/pptx-32.png
pix/f/pptx-48.png [new file with mode: 0644]
pix/f/pptx-64.png [new file with mode: 0644]
pix/f/pptx-72.png [new file with mode: 0644]
pix/f/pptx-80.png [new file with mode: 0644]
pix/f/pptx-96.png [new file with mode: 0644]
pix/f/pptx.gif [deleted file]
pix/f/pptx.png [new file with mode: 0644]
pix/f/psd-128.png [new file with mode: 0644]
pix/f/psd-24.png [new file with mode: 0644]
pix/f/psd-256.png [new file with mode: 0644]
pix/f/psd-32.png [new file with mode: 0644]
pix/f/psd-48.png [new file with mode: 0644]
pix/f/psd-64.png [new file with mode: 0644]
pix/f/psd-72.png [new file with mode: 0644]
pix/f/psd-80.png [new file with mode: 0644]
pix/f/psd-96.png [new file with mode: 0644]
pix/f/psd.png [new file with mode: 0644]
pix/f/spreadsheet-128.png [new file with mode: 0644]
pix/f/spreadsheet-24.png [new file with mode: 0644]
pix/f/spreadsheet-256.png [new file with mode: 0644]
pix/f/spreadsheet-32.png [new file with mode: 0644]
pix/f/spreadsheet-48.png [new file with mode: 0644]
pix/f/spreadsheet-64.png [new file with mode: 0644]
pix/f/spreadsheet-72.png [new file with mode: 0644]
pix/f/spreadsheet-80.png [new file with mode: 0644]
pix/f/spreadsheet-96.png [new file with mode: 0644]
pix/f/spreadsheet.png [new file with mode: 0644]
pix/f/text-128.png [new file with mode: 0644]
pix/f/text-24.png [new file with mode: 0644]
pix/f/text-256.png [new file with mode: 0644]
pix/f/text-32.png
pix/f/text-48.png [new file with mode: 0644]
pix/f/text-64.png [new file with mode: 0644]
pix/f/text-72.png [new file with mode: 0644]
pix/f/text-80.png [new file with mode: 0644]
pix/f/text-96.png [new file with mode: 0644]
pix/f/text.gif [deleted file]
pix/f/text.png [new file with mode: 0644]
pix/f/tiff-128.png [new file with mode: 0644]
pix/f/tiff-24.png [new file with mode: 0644]
pix/f/tiff-256.png [new file with mode: 0644]
pix/f/tiff-32.png [new file with mode: 0644]
pix/f/tiff-48.png [new file with mode: 0644]
pix/f/tiff-64.png [new file with mode: 0644]
pix/f/tiff-72.png [new file with mode: 0644]
pix/f/tiff-80.png [new file with mode: 0644]
pix/f/tiff-96.png [new file with mode: 0644]
pix/f/tiff.png [new file with mode: 0644]
pix/f/unknown-128.png [new file with mode: 0644]
pix/f/unknown-24.png [new file with mode: 0644]
pix/f/unknown-256.png [new file with mode: 0644]
pix/f/unknown-32.png
pix/f/unknown-48.png [new file with mode: 0644]
pix/f/unknown-64.png [new file with mode: 0644]
pix/f/unknown-72.png [new file with mode: 0644]
pix/f/unknown-80.png [new file with mode: 0644]
pix/f/unknown-96.png [new file with mode: 0644]
pix/f/unknown.gif [deleted file]
pix/f/unknown.png [new file with mode: 0644]
pix/f/video-128.png [new file with mode: 0644]
pix/f/video-24.png [new file with mode: 0644]
pix/f/video-256.png [new file with mode: 0644]
pix/f/video-32.png
pix/f/video-48.png [new file with mode: 0644]
pix/f/video-64.png [new file with mode: 0644]
pix/f/video-72.png [new file with mode: 0644]
pix/f/video-80.png [new file with mode: 0644]
pix/f/video-96.png [new file with mode: 0644]
pix/f/video.gif [deleted file]
pix/f/video.png [new file with mode: 0644]
pix/f/wav-128.png [new file with mode: 0644]
pix/f/wav-24.png [new file with mode: 0644]
pix/f/wav-256.png [new file with mode: 0644]
pix/f/wav-32.png [new file with mode: 0644]
pix/f/wav-48.png [new file with mode: 0644]
pix/f/wav-64.png [new file with mode: 0644]
pix/f/wav-72.png [new file with mode: 0644]
pix/f/wav-80.png [new file with mode: 0644]
pix/f/wav-96.png [new file with mode: 0644]
pix/f/wav.png [new file with mode: 0644]
pix/f/web-32.png [deleted file]
pix/f/web.gif [deleted file]
pix/f/wma-128.png [new file with mode: 0644]
pix/f/wma-24.png [new file with mode: 0644]
pix/f/wma-256.png [new file with mode: 0644]
pix/f/wma-32.png [new file with mode: 0644]
pix/f/wma-48.png [new file with mode: 0644]
pix/f/wma-64.png [new file with mode: 0644]
pix/f/wma-72.png [new file with mode: 0644]
pix/f/wma-80.png [new file with mode: 0644]
pix/f/wma-96.png [new file with mode: 0644]
pix/f/wma.png [new file with mode: 0644]
pix/f/wmv-128.png [new file with mode: 0644]
pix/f/wmv-24.png [new file with mode: 0644]
pix/f/wmv-256.png [new file with mode: 0644]
pix/f/wmv-32.png [new file with mode: 0644]
pix/f/wmv-48.png [new file with mode: 0644]
pix/f/wmv-64.png [new file with mode: 0644]
pix/f/wmv-72.png [new file with mode: 0644]
pix/f/wmv-80.png [new file with mode: 0644]
pix/f/wmv-96.png [new file with mode: 0644]
pix/f/wmv.png [new file with mode: 0644]
pix/f/word-32.png [deleted file]
pix/f/word.gif [deleted file]
pix/f/xlam.gif [deleted file]
pix/f/xlsb.gif [deleted file]
pix/f/xlsm.gif [deleted file]
pix/f/xlsx-128.png [new file with mode: 0644]
pix/f/xlsx-24.png [new file with mode: 0644]
pix/f/xlsx-256.png [new file with mode: 0644]
pix/f/xlsx-32.png [new file with mode: 0644]
pix/f/xlsx-48.png [new file with mode: 0644]
pix/f/xlsx-64.png [new file with mode: 0644]
pix/f/xlsx-72.png [new file with mode: 0644]
pix/f/xlsx-80.png [new file with mode: 0644]
pix/f/xlsx-96.png [new file with mode: 0644]
pix/f/xlsx.gif [deleted file]
pix/f/xlsx.png [new file with mode: 0644]
pix/f/xltm.gif [deleted file]
pix/f/xltx.gif [deleted file]
pix/f/xml-128.png [new file with mode: 0644]
pix/f/xml-24.png [new file with mode: 0644]
pix/f/xml-256.png [new file with mode: 0644]
pix/f/xml-32.png
pix/f/xml-48.png [new file with mode: 0644]
pix/f/xml-64.png [new file with mode: 0644]
pix/f/xml-72.png [new file with mode: 0644]
pix/f/xml-80.png [new file with mode: 0644]
pix/f/xml-96.png [new file with mode: 0644]
pix/f/xml.gif [deleted file]
pix/f/xml.png [new file with mode: 0644]
pix/f/zip-128.png [new file with mode: 0644]
pix/f/zip-24.png [new file with mode: 0644]
pix/f/zip-256.png [new file with mode: 0644]
pix/f/zip-32.png
pix/f/zip-48.png [new file with mode: 0644]
pix/f/zip-64.png [new file with mode: 0644]
pix/f/zip-72.png [new file with mode: 0644]
pix/f/zip-80.png [new file with mode: 0644]
pix/f/zip-96.png [new file with mode: 0644]
pix/f/zip.gif [deleted file]
pix/f/zip.png [new file with mode: 0644]
pix/y/lm.gif [deleted file]
pix/y/lm.png [new file with mode: 0644]
pix/y/lmh.gif [deleted file]
pix/y/ln.png [new file with mode: 0644]
pix/y/lp.gif [deleted file]
pix/y/lp.png [new file with mode: 0644]
pix/y/lph.gif [deleted file]
pix/y/tm.gif [deleted file]
pix/y/tm.png [new file with mode: 0644]
pix/y/tmh.gif [deleted file]
pix/y/tp.gif [deleted file]
pix/y/tp.png [new file with mode: 0644]
pix/y/tph.gif [deleted file]
question/type/essay/renderer.php
repository/alfresco/lib.php
repository/boxnet/lib.php
repository/coursefiles/lib.php
repository/draftfiles_ajax.php
repository/draftfiles_manager.php
repository/dropbox/lib.php
repository/dropbox/locallib.php
repository/filepicker.js
repository/filesystem/lang/en/repository_filesystem.php
repository/filesystem/lib.php
repository/flickr/lib.php
repository/flickr_public/lib.php
repository/googledocs/lib.php
repository/lib.php
repository/local/lib.php
repository/merlot/lib.php
repository/picasa/lib.php
repository/recent/lib.php
repository/repository_ajax.php
repository/s3/lib.php
repository/tests/repository_test.php [new file with mode: 0644]
repository/upload/lib.php
repository/url/db/install.php [new file with mode: 0644]
repository/url/lib.php
repository/user/lib.php
repository/webdav/lib.php
repository/wikimedia/db/install.php [new file with mode: 0644]
repository/wikimedia/lib.php
repository/wikimedia/wikimedia.php
repository/youtube/db/install.php [new file with mode: 0644]
repository/youtube/lib.php
theme/afterburner/style/afterburner_styles.css
theme/base/config.php
theme/base/pix/fp/alias.png [new file with mode: 0644]
theme/base/pix/fp/check.png [new file with mode: 0644]
theme/base/pix/fp/cross.png [new file with mode: 0644]
theme/base/pix/fp/dnd_arrow.png [new file with mode: 0644]
theme/base/pix/fp/link.png [new file with mode: 0644]
theme/base/pix/fp/path_folder.png [new file with mode: 0644]
theme/base/pix/fp/view_icon_active.png [new file with mode: 0644]
theme/base/pix/fp/view_icon_inactive.png [new file with mode: 0644]
theme/base/pix/fp/view_icon_selected.png [new file with mode: 0644]
theme/base/pix/fp/view_list_active.png [new file with mode: 0644]
theme/base/pix/fp/view_list_inactive.png [new file with mode: 0644]
theme/base/pix/fp/view_list_selected.png [new file with mode: 0644]
theme/base/pix/fp/view_tree_active.png [new file with mode: 0644]
theme/base/pix/fp/view_tree_inactive.png [new file with mode: 0644]
theme/base/pix/fp/view_tree_selected.png [new file with mode: 0644]
theme/base/style/core.css
theme/base/style/course.css
theme/base/style/filemanager.css [new file with mode: 0644]
theme/formal_white/config.php
theme/mymobile/layout/embedded.php
user/filesedit.php
user/filesedit_form.php
user/renderer.php
version.php

index c3409a5..b3494ca 100644 (file)
@@ -1,12 +1,27 @@
 <?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->dirroot . '/repository/lib.php');
 require_once($CFG->libdir . '/adminlib.php');
 
-$repository    = optional_param('repos', '', PARAM_FORMAT);
-$action        = optional_param('action', '', PARAM_ALPHA);
-$sure          = optional_param('sure', '', PARAM_ALPHA);
+$repository       = optional_param('repos', '', PARAM_ALPHANUMEXT);
+$action           = optional_param('action', '', PARAM_ACTION);
+$sure             = optional_param('sure', '', PARAM_ALPHA);
+$downloadcontents = optional_param('downloadcontents', false, PARAM_BOOL);
 
 $display = true; // fall through to normal display
 
@@ -42,6 +57,10 @@ $configstr  = get_string('manage', 'repository');
 
 $return = true;
 
+if (!empty($action)) {
+    require_sesskey();
+}
+
 /**
  * Helper function that generates a moodle_url object
  * relevant to the repository
@@ -152,10 +171,10 @@ if (($action == 'edit') || ($action == 'new')) {
 
         // Display instances list and creation form
         if ($action == 'edit') {
-           $instanceoptionnames = repository::static_function($repository, 'get_instance_option_names');
-           if (!empty($instanceoptionnames)) {
-               repository::display_instances_list(get_context_instance(CONTEXT_SYSTEM), $repository);
-           }
+            $instanceoptionnames = repository::static_function($repository, 'get_instance_option_names');
+            if (!empty($instanceoptionnames)) {
+                repository::display_instances_list(context_system::instance(), $repository);
+            }
         }
     }
 } else if ($action == 'show') {
@@ -185,7 +204,8 @@ if (($action == 'edit') || ($action == 'new')) {
         if (!confirm_sesskey()) {
             print_error('confirmsesskeybad', '', $baseurl);
         }
-        if ($repositorytype->delete()) {
+
+        if ($repositorytype->delete($downloadcontents)) {
             redirect($baseurl);
         } else {
             print_error('instancenotdeleted', 'repository', $baseurl);
@@ -193,7 +213,34 @@ if (($action == 'edit') || ($action == 'new')) {
         exit;
     } else {
         echo $OUTPUT->header();
-        echo $OUTPUT->confirm(get_string('confirmremove', 'repository', $repositorytype->get_readablename()), $sesskeyurl . '&action=delete&repos=' . $repository . '&sure=yes', $baseurl);
+
+        $message = get_string('confirmremove', 'repository', $repositorytype->get_readablename());
+
+        $output = $OUTPUT->box_start('generalbox', 'notice');
+        $output .= html_writer::tag('p', $message);
+
+        $removeurl = new moodle_url($sesskeyurl);
+        $removeurl->params(array(
+            'action' =>'delete',
+            'repos' => $repository,
+            'sure' => 'yes',
+        ));
+
+        $removeanddownloadurl = new moodle_url($sesskeyurl);
+        $removeanddownloadurl->params(array(
+            'action' =>'delete',
+            'repos'=> $repository,
+            'sure' => 'yes',
+            'downloadcontents' => 1,
+        ));
+
+        $output .= $OUTPUT->single_button($removeurl, get_string('continueuninstall', 'repository'));
+        $output .= $OUTPUT->single_button($removeanddownloadurl, get_string('continueuninstallanddownload', 'repository'));
+        $output .= $OUTPUT->single_button($baseurl, get_string('cancel'));
+        $output .= $OUTPUT->box_end();
+
+        echo $output;
+
         $return = false;
     }
 } else if ($action == 'moveup') {
@@ -255,7 +302,7 @@ if (($action == 'edit') || ($action == 'new')) {
                 // Calculate number of instances in order to display them for the Moodle administrator
                 if (!empty($instanceoptionnames)) {
                     $params = array();
-                    $params['context'] = array(get_system_context());
+                    $params['context'] = array(context_system::instance());
                     $params['onlyvisible'] = false;
                     $params['type'] = $typename;
                     $admininstancenumber = count(repository::static_function($typename, 'get_instances', $params));
index e75193d..fe75146 100644 (file)
@@ -1,18 +1,35 @@
 <?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
 require_once(dirname(dirname(__FILE__)) . '/config.php');
 require_once($CFG->dirroot . '/repository/lib.php');
 require_once($CFG->libdir . '/adminlib.php');
 
+require_sesskey();
+
 // id of repository
 $edit    = optional_param('edit', 0, PARAM_INT);
-$new     = optional_param('new', '', PARAM_FORMAT);
+$new     = optional_param('new', '', PARAM_PLUGIN);
 $hide    = optional_param('hide', 0, PARAM_INT);
 $delete  = optional_param('delete', 0, PARAM_INT);
 $sure    = optional_param('sure', '', PARAM_ALPHA);
 $type    = optional_param('type', '', PARAM_PLUGIN);
+$downloadcontents = optional_param('downloadcontents', false, PARAM_BOOL);
 
-$context = get_context_instance(CONTEXT_SYSTEM);
+$context = context_system::instance();
 
 $pagename = 'repositorycontroller';
 
@@ -24,16 +41,20 @@ if ($edit){
     $pagename = 'repositoryinstancenew';
 }
 
-admin_externalpage_setup($pagename);
-require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+admin_externalpage_setup($pagename, '', null, new moodle_url('/admin/repositoryinstances.php'));
+require_capability('moodle/site:config', $context);
+
+$baseurl = new moodle_url("/$CFG->admin/repositoryinstance.php", array('sesskey'=>sesskey()));
+
+$parenturl = new moodle_url("/$CFG->admin/repository.php", array(
+    'sesskey'=>sesskey(),
+    'action'=>'edit',
+));
 
-$sesskeyurl = "$CFG->wwwroot/$CFG->admin/repositoryinstance.php?sesskey=" . sesskey();
-$baseurl    = "$CFG->wwwroot/$CFG->admin/repository.php?session=". sesskey() .'&action=edit&repos=';
 if ($new) {
-    $baseurl .= $new;
-}
-else {
-    $baseurl .= $type;
+    $parenturl->param('repos', $new);
+} else {
+    $parenturl->param('repos', $type);
 }
 
 $return = true;
@@ -48,7 +69,7 @@ if (!empty($edit) || !empty($new)) {
         $typeid = $instance->options['typeid'];
     } else {
         $plugin = $new;
-        $typeid = $new;
+        $typeid = null;
         $instance = null;
     }
 
@@ -57,12 +78,9 @@ if (!empty($edit) || !empty($new)) {
     // end setup, begin output
 
     if ($mform->is_cancelled()){
-        redirect($baseurl);
+        redirect($parenturl);
         exit;
     } else if ($fromform = $mform->get_data()){
-        if (!confirm_sesskey()) {
-            print_error('confirmsesskeybad', '', $baseurl);
-        }
         if ($edit) {
             $settings = array();
             $settings['name'] = $fromform->name;
@@ -77,13 +95,13 @@ if (!empty($edit) || !empty($new)) {
             }
             $success = $instance->set_option($settings);
         } else {
-            $success = repository::static_function($plugin, 'create', $plugin, 0, get_system_context(), $fromform);
+            $success = repository::static_function($plugin, 'create', $plugin, 0, $context, $fromform);
             $data = data_submitted();
         }
         if ($success) {
-            redirect($baseurl);
+            redirect($parenturl);
         } else {
-            print_error('instancenotsaved', 'repository', $baseurl);
+            print_error('instancenotsaved', 'repository', $parenturl);
         }
         exit;
     } else {
@@ -95,9 +113,6 @@ if (!empty($edit) || !empty($new)) {
         $return = false;
     }
 } else if (!empty($hide)) {
-    if (!confirm_sesskey()) {
-        print_error('confirmsesskeybad', '', $baseurl);
-    }
     $instance = repository::get_type_by_typename($hide);
     $instance->hide();
     $return = true;
@@ -108,25 +123,38 @@ if (!empty($edit) || !empty($new)) {
             throw new repository_exception('readonlyinstance', 'repository');
      }
     if ($sure) {
-        if (!confirm_sesskey()) {
-            print_error('confirmsesskeybad', '', $baseurl);
-        }
-        if ($instance->delete()) {
+        if ($instance->delete($downloadcontents)) {
             $deletedstr = get_string('instancedeleted', 'repository');
-            redirect($baseurl, $deletedstr, 3);
+            redirect($parenturl, $deletedstr, 3);
         } else {
-            print_error('instancenotdeleted', 'repository', $baseurl);
+            print_error('instancenotdeleted', 'repository', $parenturl);
         }
         exit;
     }
 
     echo $OUTPUT->header();
-    echo $OUTPUT->confirm(get_string('confirmdelete', 'repository', $instance->name), "$sesskeyurl&type=$type'&delete=$delete'&sure=yes", "$CFG->wwwroot/$CFG->admin/repositoryinstance.php?session=". sesskey());
+    echo $OUTPUT->box_start('generalbox', 'notice');
+    $continueurl = new moodle_url($baseurl, array(
+        'type' => $type,
+        'delete' => $delete,
+        'sure' => 'yes',
+    ));
+    $continueanddownloadurl = new moodle_url($continueurl, array(
+        'downloadcontents' => 1
+    ));
+    $message = get_string('confirmdelete', 'repository', $instance->name);
+    echo html_writer::tag('p', $message);
+
+    echo $OUTPUT->single_button($continueurl, get_string('continueuninstall', 'repository'));
+    echo $OUTPUT->single_button($continueanddownloadurl, get_string('continueuninstallanddownload', 'repository'));
+    echo $OUTPUT->single_button($parenturl, get_string('cancel'));
+
+    echo $OUTPUT->box_end();
+
     $return = false;
 }
 
 if (!empty($return)) {
-
-    redirect($baseurl);
+    redirect($parenturl);
 }
 echo $OUTPUT->footer();
index 9d7b5a0..e55e1f2 100644 (file)
@@ -13,6 +13,8 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     $temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', new lang_string('enablesafebrowserintegration', 'admin'), new lang_string('configenablesafebrowserintegration', 'admin'), 0));
     $temp->add(new admin_setting_configcheckbox('enablegroupmembersonly', new lang_string('enablegroupmembersonly', 'admin'), new lang_string('configenablegroupmembersonly', 'admin'), 0));
 
+    $temp->add(new admin_setting_configcheckbox('dndallowtextandlinks', new lang_string('dndallowtextandlinks', 'admin'), new lang_string('configdndallowtextandlinks', 'admin'), 0));
+
     $ADMIN->add('experimental', $temp);
 
     // "debugging" settingpage
index 6d192b6..96d0455 100644 (file)
@@ -330,12 +330,12 @@ if ($hassiteconfig) {
       $typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names');
       $instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names');
       if (!empty($typeoptionnames) || !empty($instanceoptionnames)) {
-            $ADMIN->add('repositorysettings',
-                new admin_externalpage('repositorysettings'.$repositorytype->get_typename(),
-                        $repositorytype->get_readablename(),
-                        $url . '?action=edit&repos=' . $repositorytype->get_typename()),
-                        'moodle/site:config');
-        }
+
+          $params = array('action'=>'edit', 'sesskey'=>sesskey(), 'repos'=>$repositorytype->get_typename());
+          $settingsurl = new moodle_url("/$CFG->admin/repository.php", $params);
+          $repositoryexternalpage = new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), $repositorytype->get_readablename(), $settingsurl);
+          $ADMIN->add('repositorysettings', $repositoryexternalpage);
+      }
     }
 }
 
index 34e1fa4..e031be4 100644 (file)
@@ -9,6 +9,9 @@
          $zone = clean_param($zone, PARAM_PATH);
     }
 
+    $PAGE->set_url('/admin/timezone.php');
+    $PAGE->set_context(context_system::instance());
+
     require_login();
 
     require_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
@@ -18,7 +21,6 @@
     $strusers = get_string("users");
     $strall = get_string("all");
 
-    $PAGE->set_url('/admin/timezone.php');
     $PAGE->set_title($strtimezone);
     $PAGE->set_heading($strtimezone);
     $PAGE->navbar->add($strtimezone);
index 20ebf5c..31bca24 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+define('NO_OUTPUT_BUFFERING', true);
+
 require_once(dirname(__FILE__) . '/../../../config.php');
-require_once(dirname(__FILE__) . '/locallib.php');
-require_once(dirname(__FILE__) . '/upgradableassignmentstable.php');
-require_once(dirname(__FILE__) . '/upgradableassignmentsbatchform.php');
 require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/locallib.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/upgradableassignmentstable.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/upgradableassignmentsbatchform.php');
 
 require_sesskey();
 
 // admin_externalpage_setup calls require_login and checks moodle/site:config
 admin_externalpage_setup('assignmentupgrade', '', array(), tool_assignmentupgrade_url('batchupgrade'));
+
+$PAGE->set_pagelayout('maintenance');
 $PAGE->navbar->add(get_string('batchupgrade', 'tool_assignmentupgrade'));
 
 $renderer = $PAGE->get_renderer('tool_assignmentupgrade');
@@ -41,7 +45,26 @@ if (!$confirm) {
     print_error('invalidrequest');
     die();
 }
-$result = tool_assignmentupgrade_upgrade_multiple_assignments(optional_param('upgradeall', 0, PARAM_BOOL),
-                                                explode(',', optional_param('selected', '', PARAM_TEXT)));
+raise_memory_limit(MEMORY_EXTRA);
+session_get_instance()->write_close(); // release session
+
+echo $renderer->header();
+echo $renderer->heading(get_string('batchupgrade', 'tool_assignmentupgrade'));
+
+$current = 0;
+if (optional_param('upgradeall', false, PARAM_BOOL)) {
+    $assignmentids = tool_assignmentupgrade_load_all_upgradable_assignmentids();
+} else {
+    $assignmentids = explode(',', optional_param('selected', '', PARAM_TEXT));
+}
+$total = count($assignmentids);
+
+foreach ($assignmentids as $assignmentid) {
+    list($summary, $success, $log) = tool_assignmentupgrade_upgrade_assignment($assignmentid);
+    $current += 1;
+    echo $renderer->heading(get_string('upgradeprogress', 'tool_assignmentupgrade', array('current'=>$current, 'total'=>$total)), 3);
+    echo $renderer->convert_assignment_result($summary, $success, $log);
+}
 
-echo $renderer->convert_multiple_assignments_result($result);
+echo $renderer->continue_button(tool_assignmentupgrade_url('listnotupgraded'));
+echo $renderer->footer();
index bb7ff49..f4cd179 100644 (file)
@@ -34,8 +34,8 @@
  */
 
 require_once(dirname(__FILE__) . '/../../../config.php');
-require_once(dirname(__FILE__) . '/locallib.php');
 require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/locallib.php');
 
 // admin_externalpage_setup calls require_login and checks moodle/site:config
 admin_externalpage_setup('assignmentupgrade');
@@ -47,4 +47,4 @@ $actions = array();
 $header = get_string('pluginname', 'tool_assignmentupgrade');
 $actions[] = tool_assignmentupgrade_action::make('listnotupgraded');
 
-echo $renderer->index_page($header, $actions);
\ No newline at end of file
+echo $renderer->index_page($header, $actions);
index 3b3734b..e9a61dc 100644 (file)
@@ -26,6 +26,7 @@ $string['areyousure'] = 'Are you sure?';
 $string['areyousuremessage'] = 'Are you sure you want to upgrade the assignment "{$a->name}"?';
 $string['assignmentid'] = 'Assignment ID';
 $string['assignmentnotfound'] = 'Assignment could not be found (id={$a})';
+$string['assignmentsperpage'] = 'Assignments per page';
 $string['assignmenttype'] = 'Assignment type';
 $string['backtoindex'] = 'Back to index';
 $string['batchoperations'] = 'Batch operations';
@@ -43,6 +44,7 @@ $string['pluginname'] = 'Assignment upgrade helper';
 $string['select'] = 'Select';
 $string['submissions'] = 'Submissions';
 $string['supported'] = 'Upgrade';
+$string['updatetable'] = 'Update table';
 $string['unknown'] = 'Unknown';
 $string['upgradeassignmentsummary'] = 'Upgrade assignment: {$a->name} (Course: {$a->shortname})';
 $string['upgradeassignmentsuccess'] = 'Result: Upgrade successful';
@@ -52,5 +54,6 @@ $string['upgradeselected'] = 'Upgrade selected assignments';
 $string['upgradeselectedcount'] = 'Upgrade {$a} selected assignments?';
 $string['upgradeall'] = 'Upgrade all assignments';
 $string['upgradeallconfirm'] = 'Upgrade all assignments?';
+$string['upgradeprogress'] = 'Upgrade assignment {$a->current} of {$a->total}';
 $string['upgradesingle'] = 'Upgrade single assignment';
 $string['viewcourse'] = 'View the course with the converted assignment';
index 37605a5..b03883a 100644 (file)
  */
 
 require_once(dirname(__FILE__) . '/../../../config.php');
-require_once(dirname(__FILE__) . '/locallib.php');
-require_once(dirname(__FILE__) . '/upgradableassignmentstable.php');
-require_once(dirname(__FILE__) . '/upgradableassignmentsbatchform.php');
 require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/locallib.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/upgradableassignmentstable.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/upgradableassignmentsbatchform.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/paginationform.php');
 
 // admin_externalpage_setup calls require_login and checks moodle/site:config
 admin_externalpage_setup('assignmentupgrade', '', array(), tool_assignmentupgrade_url('listnotupgraded'));
@@ -34,16 +35,26 @@ $PAGE->navbar->add(get_string('listnotupgraded', 'tool_assignmentupgrade'));
 
 $renderer = $PAGE->get_renderer('tool_assignmentupgrade');
 
-$perpage = get_user_preferences('tool_assignmentupgrade_perpage', 5);
+$perpage = optional_param('perpage', 0, PARAM_INT);
+if (!$perpage) {
+    $perpage = get_user_preferences('tool_assignmentupgrade_perpage', 100);
+} else {
+    set_user_preference('tool_assignmentupgrade_perpage', $perpage);
+}
 $assignments = new tool_assignmentupgrade_assignments_table($perpage);
 
 $batchform = new tool_assignmentupgrade_batchoperations_form();
 $data = $batchform->get_data();
+
 if ($data && $data->selectedassignments != '' || $data && isset($data->upgradeall)) {
     require_sesskey();
     echo $renderer->confirm_batch_operation_page($data);
 } else {
-    echo $renderer->assignment_list_page($assignments, $batchform);
+    $paginationform = new tool_assignmentupgrade_pagination_form();
+    $pagedata = new stdClass();
+    $pagedata->perpage = $perpage;
+    $paginationform->set_data($pagedata);
+    echo $renderer->assignment_list_page($assignments, $batchform, $paginationform);
 }
 
 
index 5b81485..6ea1883 100644 (file)
@@ -170,54 +170,33 @@ function tool_assignmentupgrade_load_all_upgradable_assignmentids() {
 
 
 /**
- * Convert a list of assignments from the old format to the new one.
- * @param bool $upgradeall - Upgrade all possible assignments
- * @param array $assignmentids An array of assignment ids to upgrade
- * @return array of $entry['assignmentsummary' => (result from tool_assignmentupgrade_get_assignment)
- *                  $entry['success'] => boolean
- *                  $entry['log'] => string - upgrade log
+ * Upgrade a single assignment. This is used by both upgrade single and upgrade batch
+ *
+ * @param int $assignmentid - The assignment id to upgrade
+ * @return array(string, boolean, string) -
+ *                  The array contains
+ *                      - the assignment summary (returned by tool_assignmentupgrade_get_assignment)
+ *                      - success
+ *                      - the upgrade log
  */
-function tool_assignmentupgrade_upgrade_multiple_assignments($upgradeall, $assignmentids) {
+function tool_assignmentupgrade_upgrade_assignment($assignmentid) {
     global $CFG;
-    require_once($CFG->dirroot . '/mod/assign/locallib.php');
     require_once($CFG->dirroot . '/mod/assign/upgradelib.php');
-    $upgrades = array();
-
-    if ($upgradeall) {
-        $assignmentids = tool_assignmentupgrade_load_all_upgradable_assignmentids();
-    }
 
     $assignment_upgrader = new assign_upgrade_manager();
-    foreach ($assignmentids as $assignmentid) {
-        $info = tool_assignmentupgrade_get_assignment($assignmentid);
-        if ($info) {
-            $log = '';
-            $success = $assignment_upgrader->upgrade_assignment($assignmentid, $log);
-        } else {
-            $success = false;
-            $log = get_string('assignmentnotfound', 'tool_assignmentupgrade', $assignmentid);
-            $info = new stdClass();
-            $info->name = get_string('unknown', 'tool_assignmentupgrade');
-            $info->shortname = get_string('unknown', 'tool_assignmentupgrade');
-        }
-
-        $upgrades[] = array('assignmentsummary'=>$info, 'success'=>$success, 'log'=>$log);
+    $info = tool_assignmentupgrade_get_assignment($assignmentid);
+    if ($info) {
+        $log = '';
+        $success = $assignment_upgrader->upgrade_assignment($assignmentid, $log);
+    } else {
+        $success = false;
+        $log = get_string('assignmentnotfound', 'tool_assignmentupgrade', $assignmentid);
+        $info = new stdClass();
+        $info->name = get_string('unknown', 'tool_assignmentupgrade');
+        $info->shortname = get_string('unknown', 'tool_assignmentupgrade');
     }
-    return $upgrades;
-}
 
-/**
- * Convert a single assignment from the old format to the new one.
- * @param stdClass $assignmentinfo An object containing information about this class
- * @param string $log This gets appended to with the details of the conversion process
- * @return boolean This is the overall result (true/false)
- */
-function tool_assignmentupgrade_upgrade_assignment($assignmentinfo, &$log) {
-    global $CFG;
-    require_once($CFG->dirroot . '/mod/assign/locallib.php');
-    require_once($CFG->dirroot . '/mod/assign/upgradelib.php');
-    $assignment_upgrader = new assign_upgrade_manager();
-    return $assignment_upgrader->upgrade_assignment($assignmentinfo->id, $log);
+    return array($info, $success, $log);
 }
 
 /**
index 829f99a..edee839 100644 (file)
@@ -61,6 +61,11 @@ M.tool_assignmentupgrade = {
             }
         });
 
+        var perpage = Y.one('#id_perpage');
+        perpage.on('change', function(e) {
+            window.onbeforeunload = null;
+            Y.one('.tool_assignmentupgrade_paginationform form').submit();
+        });
 
     }
 }
diff --git a/admin/tool/assignmentupgrade/paginationform.php b/admin/tool/assignmentupgrade/paginationform.php
new file mode 100644 (file)
index 0000000..3efb8d4
--- /dev/null
@@ -0,0 +1,59 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * This file contains the forms to create and edit an instance of this module
+ *
+ * @package   tool_assignmentupgrade
+ * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die('Direct access to this script is forbidden.');
+
+
+/** Include formslib.php */
+require_once ($CFG->libdir.'/formslib.php');
+
+/**
+ * Assignment upgrade table display options
+ *
+ * @package   tool_assignmentupgrade
+ * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class tool_assignmentupgrade_pagination_form extends moodleform {
+    /**
+     * Define this form - called from the parent constructor
+     */
+    function definition() {
+        $mform = $this->_form;
+        $instance = $this->_customdata;
+
+        $mform->addElement('header', 'general', get_string('assignmentsperpage', 'tool_assignmentupgrade'));
+        // visible elements
+        $options = array(10=>'10', 20=>'20', 50=>'50', 100=>'100');
+        $mform->addElement('select', 'perpage', get_string('assignmentsperpage', 'assign'), $options);
+
+        // hidden params
+        $mform->addElement('hidden', 'action', 'saveoptions');
+        $mform->setType('action', PARAM_ALPHA);
+
+        // buttons
+        $this->add_action_buttons(false, get_string('updatetable', 'tool_assignmentupgrade'));
+    }
+}
+
index 16c013c..ddb8cfa 100644 (file)
@@ -112,9 +112,10 @@ class tool_assignmentupgrade_renderer extends plugin_renderer_base {
      * Render the list of assignments that still need to be upgraded page.
      * @param tool_assignmentupgrade_assignments_table $assignments of data about assignments.
      * @param tool_assignmentupgrade_batchoperations_form $batchform Submitted form with list of assignments to upgrade
+     * @param tool_assignmentupgrade_pagination_form $paginationform Form which contains the preferences for paginating the table
      * @return string html to output.
      */
-    public function assignment_list_page(tool_assignmentupgrade_assignments_table $assignments, tool_assignmentupgrade_batchoperations_form $batchform) {
+    public function assignment_list_page(tool_assignmentupgrade_assignments_table $assignments, tool_assignmentupgrade_batchoperations_form $batchform, tool_assignmentupgrade_pagination_form $paginationform) {
         $output = '';
         $output .= $this->header();
         $this->page->requires->js_init_call('M.tool_assignmentupgrade.init_upgrade_table', array());
@@ -126,6 +127,10 @@ class tool_assignmentupgrade_renderer extends plugin_renderer_base {
 
         $output .= $this->container_start('tool_assignmentupgrade_upgradetable');
 
+        $output .= $this->container_start('tool_assignmentupgrade_paginationform');
+        $output .= $this->moodleform($paginationform);
+        $output .= $this->container_end();
+
         $output .= $this->flexible_table($assignments, $assignments->get_rows_per_page(), true);
         $output .= $this->container_end();
 
@@ -140,43 +145,6 @@ class tool_assignmentupgrade_renderer extends plugin_renderer_base {
         return $output;
     }
 
-    /**
-     * Render the result of an assignment conversion
-     * @param array $assignments - An array of arrays with keys $entry['assignmentsummary', 'success', 'log']
-     *                            See convert_assignment_result for more description of these keys.
-     * @return string html to output.
-     */
-    public function convert_multiple_assignments_result($assignments) {
-        $output = '';
-        $output .= $this->header();
-        $output .= $this->heading(get_string('batchupgrade', 'tool_assignmentupgrade'));
-
-        foreach ($assignments as $assignment) {
-            $assignmentsummary = $assignment['assignmentsummary'];
-            $success = $assignment['success'];
-            $log = $assignment['log'];
-
-            $output .= $this->heading(get_string('upgradeassignmentsummary', 'tool_assignmentupgrade', $assignmentsummary), 5);
-            if ($success) {
-                $output .= $this->container(get_string('upgradeassignmentsuccess', 'tool_assignmentupgrade'));
-
-            } else {
-                $output .= $this->container(get_string('upgradeassignmentfailed', 'tool_assignmentupgrade', $assignment));
-            }
-            if (isset($assignmentsummary->courseid)) {
-                $output .= html_writer::link(new moodle_url('/course/view.php', array('id'=>$assignmentsummary->courseid)) ,get_string('viewcourse', 'tool_assignmentupgrade'));
-            }
-
-
-        }
-
-        $output .= $this->continue_button(tool_assignmentupgrade_url('listnotupgraded'));
-
-
-        $output .= $this->footer();
-        return $output;
-    }
-
     /**
      * Render the result of an assignment conversion
      * @param stdClass $assignmentsummary data about the assignment to upgrade.
@@ -186,19 +154,17 @@ class tool_assignmentupgrade_renderer extends plugin_renderer_base {
      */
     public function convert_assignment_result($assignmentsummary, $success, $log) {
         $output = '';
-        $output .= $this->header();
-        $output .= $this->heading(get_string('conversioncomplete', 'tool_assignmentupgrade'));
 
+        $output .= $this->container_start('tool_assignmentupgrade_result');
+        $output .= $this->container(get_string('upgradeassignmentsummary', 'tool_assignmentupgrade', $assignmentsummary));
         if (!$success) {
-            $output .= get_string('conversionfailed', 'tool_assignmentupgrade', $log);
+            $output .= $this->container(get_string('conversionfailed', 'tool_assignmentupgrade', $log));
         } else {
-            $output .= html_writer::link(new moodle_url('/course/view.php', array('id'=>$assignmentsummary->courseid)) ,get_string('viewcourse', 'tool_assignmentupgrade'));
+            $output .= $this->container(get_string('upgradeassignmentsuccess', 'tool_assignmentupgrade'));
+            $output .= $this->container(html_writer::link(new moodle_url('/course/view.php', array('id'=>$assignmentsummary->courseid)) ,get_string('viewcourse', 'tool_assignmentupgrade')));
         }
+        $output .= $this->container_end();
 
-        $output .= $this->continue_button(tool_assignmentupgrade_url('listnotupgraded'));
-
-
-        $output .= $this->footer();
         return $output;
     }
 
index 0188dc4..277400b 100644 (file)
@@ -8,4 +8,4 @@
 #page-admin-tool-assignmentupgrade-listnotupgraded .tool_assignmentupgrade_upgradetable tr.selectedrow td { background-color: #ffeecc; }
 #page-admin-tool-assignmentupgrade-listnotupgraded .tool_assignmentupgrade_upgradetable tr.unselectedrow td { background-color: white; }
 
-
+#page-admin-tool-assignmentupgrade-listnotupgraded .tool_assignmentupgrade_paginationform .hidden { display: none; }
index 0e4830b..307a8c9 100644 (file)
@@ -70,12 +70,11 @@ class tool_assignmentupgrade_assignments_table extends table_sql implements rend
         $from = '{assignment} a JOIN {course} c ON a.course = c.id ' .
                         ' LEFT JOIN {assignment_submissions} s ON a.id = s.assignment';
 
-
         $where = '1 = 1';
         $where .= ' GROUP BY a.id, a.name, a.assignmenttype, c.shortname, c.id ';
 
         $this->set_sql($fields, $from, $where, array());
-        $this->set_count_sql('SELECT COUNT(*) FROM ' . $from, array());
+        $this->set_count_sql('SELECT COUNT(*) FROM {assignment} a JOIN {course} c ON a.course = c.id', array());
 
         $columns = array();
         $headers = array();
index 2464ebe..5125bbb 100644 (file)
@@ -23,8 +23,8 @@
  */
 
 require_once(dirname(__FILE__) . '/../../../config.php');
-require_once(dirname(__FILE__) . '/locallib.php');
 require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/locallib.php');
 
 require_sesskey();
 
@@ -36,13 +36,11 @@ admin_externalpage_setup('assignmentupgrade', '', array(), tool_assignmentupgrad
 $PAGE->navbar->add(get_string('upgradesingle', 'tool_assignmentupgrade'));
 $renderer = $PAGE->get_renderer('tool_assignmentupgrade');
 
-$assignmentinfo = tool_assignmentupgrade_get_assignment($assignmentid);
-if (!$assignmentinfo) {
-    print_error('invalidrequest');
-    die();
-}
-
 $log = '';
-$result = tool_assignmentupgrade_upgrade_assignment($assignmentinfo, $log);
+list($summary, $success, $log) = tool_assignmentupgrade_upgrade_assignment($assignmentid);
 
-echo $renderer->convert_assignment_result($assignmentinfo, $result, $log);
+echo $renderer->header();
+echo $renderer->heading(get_string('conversioncomplete', 'tool_assignmentupgrade'));
+echo $renderer->convert_assignment_result($summary, $success, $log);
+echo $renderer->continue_button(tool_assignmentupgrade_url('listnotupgraded'));
+echo $renderer->footer();
index 0325b4a..b7ec24c 100644 (file)
@@ -23,8 +23,8 @@
  */
 
 require_once(dirname(__FILE__) . '/../../../config.php');
-require_once(dirname(__FILE__) . '/locallib.php');
 require_once($CFG->libdir . '/adminlib.php');
+require_once($CFG->dirroot . '/admin/tool/assignmentupgrade/locallib.php');
 
 require_sesskey();
 
index 8c17b60..d3c8737 100644 (file)
@@ -60,9 +60,8 @@ if (!isset($args[0]) || !in_array($args[0], $alloweddirs)) {
     print_error('invalidarguments');
 }
 
-// only serve some controlled extensions
-$allowedextensions = array('text/html', 'text/css', 'image/gif', 'application/x-javascript');
-if (!in_array(mimeinfo('type', $filepath), $allowedextensions)) {
+// only serve some controlled extensions/mimetypes
+if (!file_extension_in_typegroup($filepath, array('web_file', 'web_image'), true)) {
     print_error('invalidarguments');
 }
 
index 7906a08..36a4030 100644 (file)
@@ -27,7 +27,7 @@ class backup_files_edit_form extends moodleform {
     function definition() {
         $mform =& $this->_form;
         $contextid = $this->_customdata['contextid'];
-        $options = array('subdirs'=>0, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
+        $options = array('subdirs'=>0, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL | FILE_REFERENCE);
         $mform->addElement('filemanager', 'files_filemanager', get_string('files'), null, $options);
         $mform->addElement('hidden', 'contextid', $this->_customdata['contextid']);
         $mform->addElement('hidden', 'currentcontext', $this->_customdata['currentcontext']);
index e7b6018..d1be602 100644 (file)
@@ -1404,7 +1404,7 @@ class backup_final_files_structure_step extends backup_structure_step {
             'contenthash', 'contextid', 'component', 'filearea', 'itemid',
             'filepath', 'filename', 'userid', 'filesize',
             'mimetype', 'status', 'timecreated', 'timemodified',
-            'source', 'author', 'license', 'sortorder'));
+            'source', 'author', 'license', 'sortorder', 'reference', 'repositoryid'));
 
         // Build the tree
 
@@ -1412,9 +1412,12 @@ class backup_final_files_structure_step extends backup_structure_step {
 
         // Define sources
 
-        $file->set_source_sql("SELECT f.*
+        $file->set_source_sql("SELECT f.*, r.repositoryid, r.reference
                                  FROM {files} f
-                                 JOIN {backup_ids_temp} bi ON f.id = bi.itemid
+                                 JOIN {files_reference} r
+                                      ON r.id = f.referencefileid
+                                 JOIN {backup_ids_temp} bi
+                                      ON f.id = bi.itemid
                                 WHERE bi.backupid = ?
                                   AND bi.itemname = 'filefinal'", array(backup::VAR_BACKUPID));
 
@@ -1442,6 +1445,8 @@ class backup_main_structure_step extends backup_structure_step {
         $info['backup_date']    = time();
         $info['backup_uniqueid']= $this->get_backupid();
         $info['mnet_remoteusers']=backup_controller_dbops::backup_includes_mnet_remote_users($this->get_backupid());
+        $info['include_file_references_to_external_content'] =
+                backup_controller_dbops::backup_includes_file_references($this->get_backupid());
         $info['original_wwwroot']=$CFG->wwwroot;
         $info['original_site_identifier_hash'] = md5(get_site_identifier());
         $info['original_course_id'] = $this->get_courseid();
@@ -1461,7 +1466,7 @@ class backup_main_structure_step extends backup_structure_step {
 
         $information = new backup_nested_element('information', null, array(
             'name', 'moodle_version', 'moodle_release', 'backup_version',
-            'backup_release', 'backup_date', 'mnet_remoteusers', 'original_wwwroot',
+            'backup_release', 'backup_date', 'mnet_remoteusers', 'include_file_references_to_external_content', 'original_wwwroot',
             'original_site_identifier_hash', 'original_course_id',
             'original_course_fullname', 'original_course_shortname', 'original_course_startdate',
             'original_course_contextid', 'original_system_contextid'));
@@ -1584,8 +1589,12 @@ class backup_store_backup_file extends backup_execution_step {
         // Calculate the zip fullpath (in OS temp area it's always backup.mbz)
         $zipfile = $basepath . '/backup.mbz';
 
+        $has_file_references = backup_controller_dbops::backup_includes_file_references($this->get_backupid());
         // Perform storage and return it (TODO: shouldn't be array but proper result object)
-        return array('backup_destination' => backup_helper::store_backup_file($this->get_backupid(), $zipfile));
+        return array(
+            'backup_destination' => backup_helper::store_backup_file($this->get_backupid(), $zipfile),
+            'include_file_references_to_external_content' => $has_file_references
+        );
     }
 }
 
index fda860c..4d610e5 100644 (file)
@@ -586,11 +586,23 @@ class restore_load_included_files extends restore_structure_step {
         return array($file);
     }
 
-    // Processing functions go here
+    /**
+     * Processing functions go here
+     *
+     * @param array $data one file record including repositoryid and reference
+     */
     public function process_file($data) {
 
         $data = (object)$data; // handy
 
+        $isreference = !empty($data->repositoryid);
+        $issamesite = $this->task->is_samesite();
+
+        // If it's not samesite, we skip file refernces
+        if (!$issamesite && $isreference) {
+            return;
+        }
+
         // load it if needed:
         //   - it it is one of the annotated inforef files (course/section/activity/block)
         //   - it is one "user", "group", "grouping", "grade", "question" or "qtype_xxxx" component file (that aren't sent to inforef ever)
@@ -601,6 +613,7 @@ class restore_load_included_files extends restore_structure_step {
                         $data->component == 'grouping' || $data->component == 'grade' ||
                         $data->component == 'question' || substr($data->component, 0, 5) == 'qtype');
         if ($isfileref || $iscomponent) {
+            // Process files
             restore_dbops::set_backup_files_record($this->get_restoreid(), $data);
         }
     }
index c77aeb6..ee98987 100644 (file)
@@ -409,6 +409,27 @@ abstract class backup_controller_dbops extends backup_dbops {
         return (int)(bool)$count;
     }
 
+    /**
+     * Given the backupid, detect if the backup contains references to external contents
+     *
+     * @copyright 2012 Dongsheng Cai {@link http://dongsheng.org}
+     * @return int
+     */
+    public static function backup_includes_file_references($backupid) {
+        global $CFG, $DB;
+
+        $sql = "SELECT count(r.repositoryid)
+                  FROM {files} f
+                  JOIN {files_reference} r
+                       ON r.id = f.referencefileid
+                  JOIN {backup_ids_temp} bi
+                       ON f.id = bi.itemid
+                 WHERE bi.backupid = ?
+                       AND bi.itemname = 'filefinal'";
+        $count = $DB->count_records_sql($sql, array($backupid));
+        return (int)(bool)$count;
+    }
+
     /**
      * Given the courseid, return some course related information we want to transport
      *
index 25f2e53..e50c6e6 100644 (file)
@@ -685,6 +685,9 @@ abstract class restore_dbops {
         $rs = $DB->get_recordset_sql($sql, $params);
         foreach ($rs as $rec) {
             $file = (object)unserialize(base64_decode($rec->info));
+
+            $isreference = !empty($file->repositoryid);
+
             // ignore root dirs (they are created automatically)
             if ($file->filepath == '/' && $file->filename == '.') {
                 continue;
@@ -697,10 +700,12 @@ abstract class restore_dbops {
                 $fs->create_directory($newcontextid, $component, $filearea, $rec->newitemid, $file->filepath, $file->userid);
                 continue;
             }
+
             // arrived here, file found
             // Find file in backup pool
             $backuppath = $basepath . backup_file_manager::get_backup_content_file_location($file->contenthash);
-            if (!file_exists($backuppath)) {
+
+            if (!file_exists($backuppath) && !$isreference) {
                 throw new restore_dbops_exception('file_not_found_in_pool', $file);
             }
             if (!$fs->file_exists($newcontextid, $component, $filearea, $rec->newitemid, $file->filepath, $file->filename)) {
@@ -717,7 +722,11 @@ abstract class restore_dbops {
                     'author'      => $file->author,
                     'license'     => $file->license,
                     'sortorder'   => $file->sortorder);
-                $fs->create_file_from_pathname($file_record, $backuppath);
+                if ($isreference) {
+                    $fs->create_file_from_reference($file_record, $file->repositoryid, $file->reference);
+                } else {
+                    $fs->create_file_from_pathname($file_record, $backuppath);
+                }
             }
         }
         $rs->close();
@@ -1204,6 +1213,7 @@ abstract class restore_dbops {
     public static function set_backup_files_record($restoreid, $filerec) {
         global $DB;
 
+        // Store external files info in `info` field
         $filerec->info     = base64_encode(serialize($filerec)); // Serialize the whole rec in info
         $filerec->backupid = $restoreid;
         $DB->insert_record('backup_files_temp', $filerec);
index fb6477a..9941af7 100644 (file)
@@ -73,6 +73,10 @@ class backup_file_manager {
 
         $fs = get_file_storage();
         $file = $fs->get_file_instance($filerecorid);
+        // If the file is external file, skip copying.
+        if ($file->is_external_file()) {
+            return;
+        }
 
         // Calculate source and target paths (use same subdirs strategy for both)
         $targetfilepath = self::get_backup_storage_base_dir($backupid) . '/' .
index 73b5d3b..ff5dc89 100644 (file)
@@ -145,6 +145,12 @@ abstract class backup_general_helper extends backup_helper {
         $info->original_course_startdate= $infoarr['original_course_startdate'];
         $info->original_course_contextid= $infoarr['original_course_contextid'];
         $info->original_system_contextid= $infoarr['original_system_contextid'];
+        // Moodle backup file don't have this option before 2.3
+        if (!empty($infoarr['include_file_references_to_external_content'])) {
+            $info->include_file_references_to_external_content = 1;
+        } else {
+            $info->include_file_references_to_external_content = 0;
+        }
         $info->type   =  $infoarr['details']['detail'][0]['type'];
         $info->format =  $infoarr['details']['detail'][0]['format'];
         $info->mode   =  $infoarr['details']['detail'][0]['mode'];
index 8f481de..e5d21b8 100644 (file)
@@ -55,12 +55,6 @@ abstract class convert_helper {
 
         $converters = array();
 
-        // Only apply for backup converters if the (experimental) setting enables it.
-        // This will be out once we get proper support of backup converters. MDL-29956
-        if (!$restore && empty($CFG->enablebackupconverters)) {
-            return $converters;
-        }
-
         $plugins    = get_list_of_plugins('backup/converter');
         foreach ($plugins as $name) {
             $filename = $restore ? 'lib.php' : 'backuplib.php';
index 2cc2045..1ce9053 100644 (file)
@@ -470,6 +470,9 @@ class backup_ui_stage_complete extends backup_ui_stage_final {
 
         $output = '';
         $output .= $renderer->box_start();
+        if (!empty($this->results['include_file_references_to_external_content'])) {
+            $output .= $renderer->notification(get_string('filereferencesincluded', 'backup'), 'notifyproblem');
+        }
         $output .= $renderer->notification(get_string('executionsuccess', 'backup'), 'notifysuccess');
         $output .= $renderer->continue_button($restorerul);
         $output .= $renderer->box_end();
index 7afcdfd..9e0ab9d 100644 (file)
@@ -92,6 +92,16 @@ class core_backup_renderer extends plugin_renderer_base {
         $html .= $this->backup_detail_pair(get_string('originalwwwroot', 'backup'),
                 html_writer::tag('span', $details->original_wwwroot, array('class'=>'originalwwwroot')).
                 html_writer::tag('span', '['.$details->original_site_identifier_hash.']', array('class'=>'sitehash sub-detail')));
+        if (!empty($details->include_file_references_to_external_content)) {
+            $message = '';
+            if (backup_general_helper::backup_is_samesite($details)) {
+                $message = $yestick . ' ' . get_string('filereferencessamesite', 'backup');
+            } else {
+                $message = $notick . ' ' . get_string('filereferencesnotsamesite', 'backup');
+            }
+            $html .= $this->backup_detail_pair(get_string('includefilereferences', 'backup'), $message);
+        }
+
         $html .= html_writer::end_tag('div');
 
         $html .= html_writer::start_tag('div', array('class'=>'backup-section settings-section'));
index c290b24..2aa2578 100644 (file)
@@ -1,5 +1,8 @@
 <?php
 
+defined('MOODLE_INTERNAL') || die();
+require_once($CFG->libdir . '/filelib.php');
+
 class block_activity_modules extends block_list {
     function init() {
         $this->title = get_string('pluginname', 'block_activity_modules');
@@ -50,7 +53,7 @@ class block_activity_modules extends block_list {
 
         foreach ($modfullnames as $modname => $modfullname) {
             if ($modname === 'resources') {
-                $icon = '<img src="'.$OUTPUT->pix_url('f/html') . '" class="icon" alt="" />&nbsp;';
+                $icon = $OUTPUT->pix_icon(file_extension_icon('.htm'), '', 'moodle', array('class' => 'icon')). '&nbsp;';
                 $this->content->items[] = '<a href="'.$CFG->wwwroot.'/course/resources.php?id='.$course->id.'">'.$icon.$modfullname.'</a>';
             } else {
                 $icon = '<img src="'.$OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />&nbsp;';
index 5a7667b..67b1e70 100644 (file)
@@ -45,7 +45,7 @@ $PAGE->set_pagelayout('mydashboard');
 $PAGE->set_pagetype('user-private-files');
 
 $data = new stdClass();
-$options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
+$options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*');
 file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0);
 
 $mform = new block_private_files_form(null, array('data'=>$data, 'options'=>$options));
index 5c27971..eb109fa 100644 (file)
@@ -65,14 +65,13 @@ class block_private_files_renderer extends plugin_renderer_base {
         }
         $result = '<ul>';
         foreach ($dir['subdirs'] as $subdir) {
-            $image = $this->output->pix_icon("f/folder", $subdir['dirname'], 'moodle', array('class'=>'icon'));
+            $image = $this->output->pix_icon(file_folder_icon(), $subdir['dirname'], 'moodle', array('class'=>'icon'));
             $result .= '<li yuiConfig=\''.json_encode($yuiconfig).'\'><div>'.$image.' '.s($subdir['dirname']).'</div> '.$this->htmllize_tree($tree, $subdir).'</li>';
         }
         foreach ($dir['files'] as $file) {
             $url = file_encode_url("$CFG->wwwroot/pluginfile.php", '/'.$tree->context->id.'/user/private'.$file->get_filepath().$file->get_filename(), true);
             $filename = $file->get_filename();
-            $icon = mimeinfo("icon", $filename);
-            $image = $this->output->pix_icon("f/$icon", $filename, 'moodle', array('class'=>'icon'));
+            $image = $this->output->pix_icon(file_file_icon($file), $filename, 'moodle', array('class'=>'icon'));
             $result .= '<li yuiConfig=\''.json_encode($yuiconfig).'\'><div>'.html_writer::link($url, $image.'&nbsp;'.$filename).'</div></li>';
         }
         $result .= '</ul>';
index 9eb1e8f..6ac8944 100644 (file)
@@ -513,10 +513,7 @@ class blog_entry {
             $ffurl    = file_encode_url($CFG->wwwroot.'/pluginfile.php', '/'.SYSCONTEXTID.'/blog/attachment/'.$this->id.'/'.$filename);
             $mimetype = $file->get_mimetype();
 
-            $icon     = mimeinfo_from_type("icon", $mimetype);
-            $type     = mimeinfo_from_type("type", $mimetype);
-
-            $image = $OUTPUT->pix_icon("f/$icon", $filename, 'moodle', array('class'=>'icon'));
+            $image = $OUTPUT->pix_icon(file_file_icon($file), $filename, 'moodle', array('class'=>'icon'));
 
             if ($return == "html") {
                 $output .= html_writer::link($ffurl, $image);
@@ -526,7 +523,7 @@ class blog_entry {
                 $output .= "$strattachment $filename:\n$ffurl\n";
 
             } else {
-                if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {    // Image attachments don't get printed as links
+                if (file_mimetype_in_typegroup($file->get_mimetype(), 'web_image')) {    // Image attachments don't get printed as links
                     $imagereturn .= '<br /><img src="'.$ffurl.'" alt="" />';
                 } else {
                     $imagereturn .= html_writer::link($ffurl, $image);
index b0d35a3..9b7c4e4 100644 (file)
@@ -92,14 +92,12 @@ M.course_dndupload = {
             this.init_events(el);
         }, this);
 
-        var div = this.add_status_div();
-        div.setContent(M.util.get_string('dndworking', 'moodle'));
+        this.add_status_div();
     },
 
     /**
      * Add a div element to tell the user that drag and drop upload
      * is available (or to explain why it is not available)
-     * @return the DOM element to add messages to
      */
     add_status_div: function() {
         var div = document.createElement('div');
@@ -108,7 +106,34 @@ M.course_dndupload = {
         if (coursecontents) {
             coursecontents.insertBefore(div, coursecontents.firstChild);
         }
-        return this.Y.one(div);
+        div = this.Y.one(div);
+
+        var handlefile = (this.handlers.filehandlers.length > 0);
+        var handletext = false;
+        var handlelink = false;
+        var i;
+        for (i=0; i<this.handlers.types.length; i++) {
+            switch (this.handlers.types[i].identifier) {
+            case 'text':
+            case 'text/html':
+                handletext = true;
+                break;
+            case 'url':
+                handlelink = true;
+                break;
+            }
+        }
+        $msgident = 'dndworking';
+        if (handlefile) {
+            $msgident += 'file';
+        }
+        if (handletext) {
+            $msgident += 'text';
+        }
+        if (handlelink) {
+            $msgident += 'link';
+        }
+        div.setContent(M.util.get_string($msgident, 'moodle'));
     },
 
     /**
@@ -176,14 +201,7 @@ M.course_dndupload = {
      */
     types_includes: function(e, type) {
         var i;
-        if (e._event.dataTransfer === null) {
-            // TODO MDL-33054: If we get here then something has gone wrong.
-            return false;
-        }
         var types = e._event.dataTransfer.types;
-        if (types == null) {
-            return false;
-        }
         for (i=0; i<types.length; i++) {
             if (types[i] == type) {
                 return true;
@@ -204,19 +222,33 @@ M.course_dndupload = {
      *           }
      */
     drag_type: function(e) {
+        // Check there is some data attached.
+        if (e._event.dataTransfer === null) {
+            return false;
+        }
+        if (e._event.dataTransfer.types === null) {
+            return false;
+        }
+        if (e._event.dataTransfer.types.length == 0) {
+            return false;
+        }
+
+        // Check for files first.
         if (this.types_includes(e, 'Files')) {
-            if (this.handlers.filehandlers.length == 0) {
-                return false; // No available file handlers - ignore this drag.
+            if (e.type != 'drop' || e._event.dataTransfer.files.length != 0) {
+                if (this.handlers.filehandlers.length == 0) {
+                    return false; // No available file handlers - ignore this drag.
+                }
+                return {
+                    realtype: 'Files',
+                    addmessage: M.util.get_string('addfilehere', 'moodle'),
+                    namemessage: null, // Should not be asked for anyway
+                    type: 'Files'
+                };
             }
-            return {
-                realtype: 'Files',
-                addmessage: M.util.get_string('addfilehere', 'moodle'),
-                namemessage: null, // Should not be asked for anyway
-                type: 'Files'
-            };
         }
 
-        // Check each of the registered types
+        // Check each of the registered types.
         var types = this.handlers.types;
         for (var i=0; i<types.length; i++) {
             // Check each of the different identifiers for this type
@@ -401,6 +433,7 @@ M.course_dndupload = {
         resel.div.appendChild(resel.a);
 
         resel.icon.src = M.util.image_url('i/ajaxloader');
+        resel.icon.className = 'activityicon';
         resel.a.appendChild(resel.icon);
 
         resel.a.appendChild(document.createTextNode(' '));
@@ -672,6 +705,11 @@ M.course_dndupload = {
                             if (result.onclick) {
                                 resel.a.onclick = result.onclick;
                             }
+                            if (self.Y.UA.gecko > 0) {
+                                // Fix a Firefox bug which makes sites with a '~' in their wwwroot
+                                // log the user out when clicking on the link (before refreshing the page).
+                                resel.div.innerHTML = unescape(resel.div.innerHTML);
+                            }
                             self.add_editing(result.elementid);
                         } else {
                             // Error - remove the dummy element
@@ -813,6 +851,7 @@ M.course_dndupload = {
      * @param contents the actual data that was dropped
      * @param section the DOM element representing the selected course section
      * @param sectionnumber the number of the selected course section
+     * @param module the module chosen to handle this upload
      */
     upload_item: function(name, type, contents, section, sectionnumber, module) {
 
@@ -846,6 +885,11 @@ M.course_dndupload = {
                             if (result.onclick) {
                                 resel.a.onclick = result.onclick;
                             }
+                            if (self.Y.UA.gecko > 0) {
+                                // Fix a Firefox bug which makes sites with a '~' in their wwwroot
+                                // log the user out when clicking on the link (before refreshing the page).
+                                resel.div.innerHTML = unescape(resel.div.innerHTML);
+                            }
                             self.add_editing(result.elementid, sectionnumber);
                         } else {
                             // Error - remove the dummy element
index 7c7756c..c0ed633 100644 (file)
@@ -52,7 +52,13 @@ function dndupload_add_to_course($course, $modnames) {
         'fullpath' => new moodle_url('/course/dndupload.js'),
         'strings' => array(
             array('addfilehere', 'moodle'),
-            array('dndworking', 'moodle'),
+            array('dndworkingfiletextlink', 'moodle'),
+            array('dndworkingfilelink', 'moodle'),
+            array('dndworkingfiletext', 'moodle'),
+            array('dndworkingfile', 'moodle'),
+            array('dndworkingtextlink', 'moodle'),
+            array('dndworkingtext', 'moodle'),
+            array('dndworkinglink', 'moodle'),
             array('filetoolarge', 'moodle'),
             array('actionchoice', 'moodle'),
             array('servererror', 'moodle'),
@@ -103,7 +109,7 @@ class dndupload_handler {
         // Add some default types to handle.
         // Note: 'Files' type is hard-coded into the Javascript as this needs to be ...
         // ... treated a little differently.
-        $this->add_type('url', array('url', 'text/uri-list'), get_string('addlinkhere', 'moodle'),
+        $this->add_type('url', array('url', 'text/uri-list', 'text/x-moz-url'), get_string('addlinkhere', 'moodle'),
                         get_string('nameforlink', 'moodle'), 10);
         $this->add_type('text/html', array('text/html'), get_string('addpagehere', 'moodle'),
                         get_string('nameforpage', 'moodle'), 20);
@@ -298,17 +304,21 @@ class dndupload_handler {
      * @return object Data to pass on to Javascript code
      */
     public function get_js_data() {
+        global $CFG;
+
         $ret = new stdClass;
 
         // Sort the types by priority.
         uasort($this->types, array($this, 'type_compare'));
 
         $ret->types = array();
-        foreach ($this->types as $type) {
-            if (empty($type->handlers)) {
-                continue; // Skip any types without registered handlers.
+        if (!empty($CFG->dndallowtextandlinks)) {
+            foreach ($this->types as $type) {
+                if (empty($type->handlers)) {
+                    continue; // Skip any types without registered handlers.
+                }
+                $ret->types[] = $type;
             }
-            $ret->types[] = $type;
         }
 
         $ret->filehandlers = $this->filehandlers;
@@ -430,6 +440,10 @@ class dndupload_ajax_processor {
             if ($content != null) {
                 throw new moodle_exception('fileuploadwithcontent', 'moodle');
             }
+        } else {
+            if (empty($content)) {
+                throw new moodle_exception('dnduploadwithoutcontent', 'moodle');
+            }
         }
 
         require_sesskey();
@@ -543,7 +557,13 @@ class dndupload_ajax_processor {
         }
         // The following are used inside some few core functions, so may as well set them here.
         $this->cm->coursemodule = $this->cm->id;
-        $this->cm->groupmodelink = (!$this->course->groupmodeforce);
+        $groupbuttons = ($this->course->groupmode or (!$this->course->groupmodeforce));
+        if ($groupbuttons and plugin_supports('mod', $this->module->name, FEATURE_GROUPS, 0)) {
+            $this->cm->groupmodelink = (!$this->course->groupmodeforce);
+        } else {
+            $this->cm->groupmodelink = false;
+            $this->cm->groupmode = false;
+        }
     }
 
     /**
@@ -605,6 +625,8 @@ class dndupload_ajax_processor {
             throw new moodle_exception('errorcreatingactivity', 'moodle', '', $this->module->name);
         }
         $mod = $info->cms[$this->cm->id];
+        $mod->groupmodelink = $this->cm->groupmodelink;
+        $mod->groupmode = $this->cm->groupmode;
 
         // Trigger mod_created event with information about this module.
         $eventdata = new stdClass();
@@ -622,12 +644,6 @@ class dndupload_ajax_processor {
                    "view.php?id=$mod->id",
                    "$instanceid", $mod->id);
 
-        if ($this->cm->groupmodelink && plugin_supports('mod', $mod->modname, FEATURE_GROUPS, 0)) {
-            $mod->groupmodelink = $this->cm->groupmodelink;
-        } else {
-            $mod->groupmodelink = false;
-        }
-
         $this->send_response($mod);
     }
 
index 45977d4..d969e8b 100644 (file)
@@ -261,10 +261,15 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
      * @return string HTML to output.
      */
     protected function section_summary($section, $course) {
+        // If section is hidden then display grey section link
+        $classattr = 'section-summary clearfix';
+        If (!$section->visible) {
+            $classattr .= ' dimmed_text';
+        }
 
         $o = '';
         $o.= html_writer::start_tag('li', array('id' => 'section-'.$section->section,
-            'class' => 'section-summary clearfix'));
+            'class' => $classattr));
 
         $title = get_section_name($course, $section);
         $o.= html_writer::start_tag('a', array('href' => course_get_url($course, $section->section)));
@@ -351,9 +356,13 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
         $back = $sectionno - 1;
         while ($back > 0 and empty($links['previous'])) {
             if ($canviewhidden || $sections[$back]->visible) {
+                $params = array();
+                if (!$sections[$back]->visible) {
+                    $params = array('class' => 'dimmed_text');
+                }
                 $previouslink = html_writer::tag('span', $this->output->larrow(), array('class' => 'larrow'));
                 $previouslink .= get_section_name($course, $sections[$back]);
-                $links['previous'] = html_writer::link(course_get_url($course, $back), $previouslink);
+                $links['previous'] = html_writer::link(course_get_url($course, $back), $previouslink, $params);
             }
             $back--;
         }
@@ -361,9 +370,13 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
         $forward = $sectionno + 1;
         while ($forward <= $course->numsections and empty($links['next'])) {
             if ($canviewhidden || $sections[$forward]->visible) {
+                $params = array();
+                if (!$sections[$forward]->visible) {
+                    $params = array('class' => 'dimmed_text');
+                }
                 $nextlink = get_section_name($course, $sections[$forward]);
                 $nextlink .= html_writer::tag('span', $this->output->rarrow(), array('class' => 'rarrow'));
-                $links['next'] = html_writer::link(course_get_url($course, $forward), $nextlink);
+                $links['next'] = html_writer::link(course_get_url($course, $forward), $nextlink, $params);
             }
             $forward++;
         }
@@ -444,7 +457,6 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
                 echo $this->start_section_list();
                 echo $this->section_hidden($displaysection);
                 echo $this->end_section_list();
-                echo $sectionnavlinks;
             }
             // Can't view this section.
             return;
@@ -463,20 +475,24 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
             echo $this->end_section_list();
         }
 
+        // Start single-section div
+        echo html_writer::start_tag('div', array('class' => 'single-section'));
+
         // Title with section navigation links.
         $sectionnavlinks = $this->get_nav_links($course, $sections, $displaysection);
         $sectiontitle = '';
-        $sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation headingblock header'));
+        $sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation header headingblock'));
         $sectiontitle .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
         $sectiontitle .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
-        $sectiontitle .= html_writer::tag('div', get_section_name($course, $sections[$displaysection]), array('class' => 'mdl-align'));
+        // Title attributes
+        $titleattr = 'mdl-align title';
+        if (!$sections[$displaysection]->visible) {
+            $titleattr .= ' dimmed_text';
+        }
+        $sectiontitle .= html_writer::tag('div', get_section_name($course, $sections[$displaysection]), array('class' => $titleattr));
         $sectiontitle .= html_writer::end_tag('div');
         echo $sectiontitle;
 
-        // Show completion help icon.
-        $completioninfo = new completion_info($course);
-        echo $completioninfo->display_help_icon();
-
         // Copy activity clipboard..
         echo $this->course_activity_clipboard($course, $displaysection);
 
@@ -486,6 +502,10 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
         // The requested section page.
         $thissection = $sections[$displaysection];
         echo $this->section_header($thissection, $course, true);
+        // Show completion help icon.
+        $completioninfo = new completion_info($course);
+        echo $completioninfo->display_help_icon();
+
         print_section($course, $thissection, $mods, $modnamesused, true);
         if ($PAGE->user_is_editing()) {
             print_section_add_menus($course, $displaysection, $modnames);
@@ -502,6 +522,9 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
         $sectionbottomnav .= html_writer::tag('div', $courselink, array('class' => 'mdl-align'));
         $sectionbottomnav .= html_writer::end_tag('div');
         echo $sectionbottomnav;
+
+        // close single-section div.
+        echo html_writer::end_tag('div');
     }
 
     /**
@@ -552,6 +575,8 @@ abstract class format_section_renderer_base extends plugin_renderer_base {
                 // a section_info object - we will need at least the uservisible
                 // field in it.
                 $thissection->uservisible = true;
+                $thissection->availableinfo = null;
+                $thissection->showavailability = 0;
             }
             // Show the section if the user is permitted to access it, OR if it's not available
             // but showavailability is turned on
index 85aec6d..218492d 100644 (file)
@@ -5,13 +5,24 @@ M.course = M.course || {};
 M.course.format = M.course.format || {};
 
 /**
- * Get section list for this format
+ * Get sections config for this format
  *
- * @param {YUI} Y YUI3 instance
- * @return {string} section list selector
+ * The section structure is:
+ * <ul class="topics">
+ *  <li class="section">...</li>
+ *  <li class="section">...</li>
+ *   ...
+ * </ul>
+ *
+ * @return {object} section list configuration
  */
-M.course.format.get_section_selector = function(Y) {
-    return 'li.section';
+M.course.format.get_config = function() {
+    return {
+        container_node : 'ul',
+        container_class : 'topics',
+        section_node : 'li',
+        section_class : 'section'
+    };
 }
 
 /**
index 7050488..5ef126f 100644 (file)
@@ -102,23 +102,4 @@ class format_topics_renderer extends format_section_renderer_base {
 
         return array_merge($controls, parent::section_edit_controls($course, $section, $onsectionpage));
     }
-
-    /**
-     * Generate the content to displayed on the left part of a section
-     *
-     * before course modules are included
-     * @param stdClass $section The course_section entry from DB
-     * @param stdClass $course The course entry from DB
-     * @param bool $onsectionpage true if being printed on a section page
-     * @return string HTML to output.
-     */
-    protected function section_left_content($section, $course, $onsectionpage) {
-        $o = parent::section_left_content($section, $course, $onsectionpage);
-
-        if ($section->section > 0) {
-            $o.= $section->section;
-        }
-
-        return $o;
-    }
 }
index 78c2063..28aed42 100644 (file)
@@ -5,13 +5,24 @@ M.course = M.course || {};
 M.course.format = M.course.format || {};
 
 /**
- * Get section list for this format
+ * Get sections config for this format
  *
- * @param {YUI} Y YUI3 instance
- * @return {string} section list selector
+ * The section structure is:
+ * <ul class="weeks">
+ *  <li class="section">...</li>
+ *  <li class="section">...</li>
+ *   ...
+ * </ul>
+ *
+ * @return {object} section list configuration
  */
-M.course.format.get_section_selector = function(Y) {
-    return 'li.section';
+M.course.format.get_config = function() {
+    return {
+        container_node : 'ul',
+        container_class : 'weeks',
+        section_node : 'li',
+        section_class : 'section'
+    };
 }
 
 /**
index 9a64052..8e07373 100644 (file)
@@ -1518,13 +1518,6 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
             //Accessibility: for files get description via icon, this is very ugly hack!
             $altname = '';
             $altname = $mod->modfullname;
-            if (!empty($customicon)) {
-                $archetype = plugin_supports('mod', $mod->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
-                if ($archetype == MOD_ARCHETYPE_RESOURCE) {
-                    $mimetype = mimeinfo_from_icon('type', $customicon);
-                    $altname = get_mimetype_description($mimetype);
-                }
-            }
             // Avoid unnecessary duplication: if e.g. a forum name already
             // includes the word forum (or Forum, etc) then it is unhelpful
             // to include that in the accessible description that is added.
index 713ad70..3dbbf0b 100644 (file)
@@ -52,6 +52,156 @@ YUI.add('moodle-course-coursebase', function(Y) {
     // Ensure that M.course exists and that coursebase is initialised correctly
     M.course = M.course || {};
     M.course.coursebase = M.course.coursebase || new COURSEBASE();
+
+    // Abstract functions that needs to be defined per format (course/format/somename/format.js)
+    M.course.format = M.course.format || {}
+
+   /**
+    * Swap section (should be defined in format.js if requred)
+    *
+    * @param {YUI} Y YUI3 instance
+    * @param {string} node1 node to swap to
+    * @param {string} node2 node to swap with
+    * @return {NodeList} section list
+    */
+    M.course.format.swap_sections = M.course.format.swap_sections || function(Y, node1, node2) {
+        return null;
+    }
+
+
+   /**
+    * Get sections config for this format, for examples see function definition
+    * in the formats.
+    *
+    * @return {object} section list configuration
+    */
+    M.course.format.get_config = M.course.format.get_config || function() {
+        return {
+            container_node : null, // compulsory
+            container_class : null, // compulsory
+            section_wrapper_node : null, // optional
+            section_wrapper_class : null, // optional
+            section_node : null,  // compulsory
+            section_class : null  // compulsory
+        }
+    }
+
+   /**
+    * Get section list for this format (usually items inside container_node.container_class selector)
+    *
+    * @param {YUI} Y YUI3 instance
+    * @return {string} section selector
+    */
+    M.course.format.get_section_selector = M.course.format.get_section_selector || function(Y) {
+        var config = M.course.format.get_config();
+        if (config.section_node && config.section_class) {
+            return config.section_node + '.' + config.section_class;
+        }
+        console.log('section_node and section_class are not defined in M.course.format.get_config');
+        return null;
+    }
+
+   /**
+    * Get section wraper for this format (only used in case when each
+    * container_node.container_class node is wrapped in some other element).
+    *
+    * @param {YUI} Y YUI3 instance
+    * @return {string} section wrapper selector or M.course.format.get_section_selector
+    * if section_wrapper_node and section_wrapper_class are not defined in the format config.
+    */
+    M.course.format.get_section_wrapper = M.course.format.get_section_wrapper || function(Y) {
+        var config = M.course.format.get_config();
+        if (config.section_wrapper_node && config.section_wrapper_class) {
+            return config.section_wrapper_node + '.' + config.section_wrapper_class;
+        }
+        return M.course.format.get_section_selector(Y);
+    }
+
+   /**
+    * Get the tag of container node
+    *
+    * @return {string} tag of container node.
+    */
+    M.course.format.get_containernode = M.course.format.get_containernode || function() {
+        var config = M.course.format.get_config();
+        if (config.container_node) {
+            return config.container_node;
+        } else {
+            console.log('container_node is not defined in M.course.format.get_config');
+        }
+    }
+
+   /**
+    * Get the class of container node
+    *
+    * @return {string} class of the container node.
+    */
+    M.course.format.get_containerclass = M.course.format.get_containerclass || function() {
+        var config = M.course.format.get_config();
+        if (config.container_class) {
+            return config.container_class;
+        } else {
+            console.log('container_class is not defined in M.course.format.get_config');
+        }
+    }
+
+   /**
+    * Get the tag of draggable node (section wrapper if exists, otherwise section)
+    *
+    * @return {string} tag of the draggable node.
+    */
+    M.course.format.get_sectionwrappernode = M.course.format.get_sectionwrappernode || function() {
+        var config = M.course.format.get_config();
+        if (config.section_wrapper_node) {
+            return config.section_wrapper_node;
+        } else {
+            return config.section_node;
+        }
+    }
+
+   /**
+    * Get the class of draggable node (section wrapper if exists, otherwise section)
+    *
+    * @return {string} class of the draggable node.
+    */
+    M.course.format.get_sectionwrapperclass = M.course.format.get_sectionwrapperclass || function() {
+        var config = M.course.format.get_config();
+        if (config.section_wrapper_class) {
+            return config.section_wrapper_class;
+        } else {
+            return config.section_class;
+        }
+    }
+
+   /**
+    * Get the tag of section node
+    *
+    * @return {string} tag of section node.
+    */
+    M.course.format.get_sectionnode = M.course.format.get_sectionnode || function() {
+        var config = M.course.format.get_config();
+        if (config.section_node) {
+            return config.section_node;
+        } else {
+            console.log('section_node is not defined in M.course.format.get_config');
+        }
+    }
+
+   /**
+    * Get the class of section node
+    *
+    * @return {string} class of the section node.
+    */
+    M.course.format.get_sectionclass = M.course.format.get_sectionclass || function() {
+        var config = M.course.format.get_config();
+        if (config.section_class) {
+            return config.section_class;
+        } else {
+            console.log('section_class is not defined in M.course.format.get_config');
+        }
+
+    }
+
 },
 '@VERSION@', {
     requires : ['base', 'node']
index c3ed979..012355e 100644 (file)
@@ -17,9 +17,7 @@ YUI.add('moodle-course-dragdrop', function(Y) {
         SECTION : 'section',
         SECTIONADDMENUS : 'section_add_menus',
         SECTIONHANDLE : 'section-handle',
-        SUMMARY : 'summary',
-        TOPICS : 'topics',
-        WEEKDATES: 'weekdates'
+        SUMMARY : 'summary'
     };
 
     var DRAGSECTION = function() {
@@ -31,16 +29,17 @@ YUI.add('moodle-course-dragdrop', function(Y) {
         initializer : function(params) {
             // Set group for parent class
             this.groups = ['section'];
-            this.samenodeclass = CSS.SECTION;
-            this.parentnodeclass = CSS.TOPICS;
+            this.samenodeclass = M.course.format.get_sectionwrapperclass();
+            this.parentnodeclass = M.course.format.get_containerclass();
 
             // Check if we are in single section mode
             if (Y.Node.one('.'+CSS.JUMPMENU)) {
                 return false;
             }
             // Initialise sections dragging
-            if (M.course.format && M.course.format.get_section_selector && typeof(M.course.format.get_section_selector) == 'function') {
-                this.sectionlistselector = '.'+CSS.COURSECONTENT+' '+M.course.format.get_section_selector(Y);
+            this.sectionlistselector = M.course.format.get_section_wrapper(Y);
+            if (this.sectionlistselector) {
+                this.sectionlistselector = '.'+CSS.COURSECONTENT+' '+this.sectionlistselector;
                 this.setup_for_section(this.sectionlistselector);
             }
         },
@@ -109,14 +108,14 @@ YUI.add('moodle-course-dragdrop', function(Y) {
             // Get our drag object
             var drag = e.target;
             // Creat a dummy structure of the outer elemnents for clean styles application
-            var ul = Y.Node.create('<ul></ul>');
-            ul.addClass(CSS.TOPICS);
-            var li = Y.Node.create('<li></li>');
-            li.addClass(CSS.SECTION);
-            li.setStyle('margin', 0);
-            li.setContent(drag.get('node').get('innerHTML'));
-            ul.appendChild(li);
-            drag.get('dragNode').setContent(ul);
+            var containernode = Y.Node.create('<'+M.course.format.get_containernode()+'></'+M.course.format.get_containernode()+'>');
+            containernode.addClass(M.course.format.get_containerclass());
+            var sectionnode = Y.Node.create('<'+ M.course.format.get_sectionwrappernode()+'></'+ M.course.format.get_sectionwrappernode()+'>');
+            sectionnode.addClass( M.course.format.get_sectionwrapperclass());
+            sectionnode.setStyle('margin', 0);
+            sectionnode.setContent(drag.get('node').get('innerHTML'));
+            containernode.appendChild(sectionnode);
+            drag.get('dragNode').setContent(containernode);
             drag.get('dragNode').addClass(CSS.COURSECONTENT);
         },
 
@@ -186,10 +185,8 @@ YUI.add('moodle-course-dragdrop', function(Y) {
                                     var sectionid = sectionlist.item(i-1).get('id');
                                     sectionlist.item(i-1).set('id', sectionlist.item(i).get('id'));
                                     sectionlist.item(i).set('id', sectionid);
-                                    // See what format needs to be swapped
-                                    if (M.course.format && M.course.format.swap_sections && typeof(M.course.format.swap_sections) == 'function') {
-                                        M.course.format.swap_sections(Y, i-1, i);
-                                    }
+                                    // See what format needs to swap
+                                    M.course.format.swap_sections(Y, i-1, i);
                                     // Update flag
                                     swapped = true;
                                 }
@@ -232,8 +229,9 @@ YUI.add('moodle-course-dragdrop', function(Y) {
             this.parentnodeclass = CSS.SECTION;
 
             // Go through all sections
-            if (M.course.format && M.course.format.get_section_selector && typeof(M.course.format.get_section_selector) == 'function') {
-                var sectionlistselector = '.'+CSS.COURSECONTENT+' '+M.course.format.get_section_selector(Y);
+            var sectionlistselector = M.course.format.get_section_selector(Y);
+            if (sectionlistselector) {
+                sectionlistselector = '.'+CSS.COURSECONTENT+' '+sectionlistselector;
                 this.setup_for_section(sectionlistselector);
                 M.course.coursebase.register_module(this);
                 M.course.dragres = this;
@@ -263,7 +261,7 @@ YUI.add('moodle-course-dragdrop', function(Y) {
                     padding: '20 0 20 0'
                 });
                 // Go through each li element and make them draggable
-                this.setup_for_resource('li#'+sectionnode.get('id')+' li.'+CSS.ACTIVITY);
+                this.setup_for_resource('#'+sectionnode.get('id')+' li.'+CSS.ACTIVITY);
             }, this);
         },
         /**
@@ -317,8 +315,6 @@ YUI.add('moodle-course-dragdrop', function(Y) {
             var dragnode = drag.get('node');
             var dropnode = e.drop.get('node');
 
-            var sectionselector = M.course.format.get_section_selector(Y);
-
             // Add spinner if it not there
             var spinner = M.util.add_spinner(Y, dragnode.one(CSS.COMMANDSPAN));
 
@@ -336,7 +332,7 @@ YUI.add('moodle-course-dragdrop', function(Y) {
             params['class'] = 'resource';
             params.field = 'move';
             params.id = Number(this.get_resource_id(dragnode));
-            params.sectionId = this.get_section_id(dropnode.ancestor(sectionselector));
+            params.sectionId = this.get_section_id(dropnode.ancestor(M.course.format.get_section_wrapper(Y), true));
 
             if (dragnode.next()) {
                 params.beforeId = Number(this.get_resource_id(dragnode.next()));
index 6dfcce0..024785e 100644 (file)
@@ -28,7 +28,7 @@ YUI.add('moodle-course-toolboxes', function(Y) {
         MOVELEFTCLASS : 'editing_moveleft',
         MOVERIGHT : 'a.editing_moveright',
         PAGECONTENT : 'div#page-content',
-        RIGHTDIV : 'div.right',
+        RIGHTSIDE : '.right',
         SECTIONHIDDENCLASS : 'hidden',
         SECTIONIDPREFIX : 'section-',
         SECTIONLI : 'li.section',
@@ -384,7 +384,7 @@ YUI.add('moodle-course-toolboxes', function(Y) {
             e.preventDefault();
 
             // Return early if the current section is hidden
-            var section = e.target.ancestor(CSS.SECTIONLI);
+            var section = e.target.ancestor(M.course.format.get_section_selector(Y));
             if (section && section.hasClass(CSS.SECTIONHIDDENCLASS)) {
                 return;
             }
@@ -649,17 +649,17 @@ YUI.add('moodle-course-toolboxes', function(Y) {
         },
         _setup_for_section : function(toolboxtarget) {
             // Section Highlighting
-            this.replace_button(toolboxtarget, CSS.RIGHTDIV + ' ' + CSS.HIGHLIGHT, this.toggle_highlight);
+            this.replace_button(toolboxtarget, CSS.RIGHTSIDE + ' ' + CSS.HIGHLIGHT, this.toggle_highlight);
 
             // Section Visibility
-            this.replace_button(toolboxtarget, CSS.RIGHTDIV + ' ' + CSS.SHOWHIDE, this.toggle_hide_section);
+            this.replace_button(toolboxtarget, CSS.RIGHTSIDE + ' ' + CSS.SHOWHIDE, this.toggle_hide_section);
         },
         toggle_hide_section : function(e) {
             // Prevent the default button action
             e.preventDefault();
 
             // Get the section we're working on
-            var section = e.target.ancestor(CSS.SECTIONLI);
+            var section = e.target.ancestor(M.course.format.get_section_selector(Y));
             var button = e.target.ancestor('a', true);
             var hideicon = button.one('img');
 
@@ -691,7 +691,7 @@ YUI.add('moodle-course-toolboxes', function(Y) {
             var data = {
                 'class' : 'section',
                 'field' : 'visible',
-                'id'    : this.get_section_id(section),
+                'id'    : this.get_section_id(section.ancestor(M.course.format.get_section_wrapper(Y), true)),
                 'value' : value
             };
 
@@ -725,7 +725,7 @@ YUI.add('moodle-course-toolboxes', function(Y) {
             e.preventDefault();
 
             // Get the section we're working on
-            var section = e.target.ancestor(CSS.SECTIONLI);
+            var section = e.target.ancestor(M.course.format.get_section_selector(Y));
             var button = e.target.ancestor('a', true);
             var buttonicon = button.one('img');
 
@@ -736,22 +736,22 @@ YUI.add('moodle-course-toolboxes', function(Y) {
             // Set the current highlighted item text
             var old_string = M.util.get_string('markthistopic', 'moodle');
             Y.one(CSS.PAGECONTENT)
-                .all(CSS.SECTIONLI + '.current ' + CSS.HIGHLIGHT)
+                .all(M.course.format.get_section_selector(Y) + '.current ' + CSS.HIGHLIGHT)
                 .set('title', old_string);
             Y.one(CSS.PAGECONTENT)
-                .all(CSS.SECTIONLI + '.current ' + CSS.HIGHLIGHT + ' img')
+                .all(M.course.format.get_section_selector(Y) + '.current ' + CSS.HIGHLIGHT + ' img')
                 .set('title', old_string)
                 .set('alt', old_string)
                 .set('src', M.util.image_url('i/marker'));
 
             // Remove the highlighting from all sections
-            var allsections = Y.one(CSS.PAGECONTENT).all(CSS.SECTIONLI)
+            var allsections = Y.one(CSS.PAGECONTENT).all(M.course.format.get_section_selector(Y))
                 .removeClass('current');
 
             // Then add it if required to the selected section
             if (!togglestatus) {
                 section.addClass('current');
-                value = this.get_section_id(section);
+                value = this.get_section_id(section.ancestor(M.course.format.get_section_wrapper(Y), true));
                 var new_string = M.util.get_string('markedthistopic', 'moodle');
                 button
                     .set('title', new_string);
index baeceaf..ede5706 100644 (file)
@@ -36,6 +36,7 @@ if (isguestuser()) {
 }
 
 $relativepath = get_file_argument();
+$preview = optional_param('preview', null, PARAM_ALPHANUM);
 
 // relative path must start with '/'
 if (!$relativepath) {
@@ -84,4 +85,4 @@ if (!$file = $fs->get_file_by_hash(sha1($fullpath)) or $file->get_filename() ==
 // finally send the file
 // ========================================
 session_get_instance()->write_close(); // unlock session during fileserving
-send_stored_file($file, 0, false, true); // force download - security first!
+send_stored_file($file, 0, false, true, array('preview' => $preview)); // force download - security first!
index 7a0a0af..c09cd7e 100644 (file)
@@ -145,6 +145,7 @@ class enrol_mnet_mnetservice_enrol {
             // users {@link http://tracker.moodle.org/browse/MDL-21327}
             $user = mnet_strip_user((object)$userdata, mnet_fields_to_import($client));
             $user->mnethostid = $client->id;
+            $user->auth = 'mnet';
             try {
                 $user->id = $DB->insert_record('user', $user);
             } catch (Exception $e) {
index e5498dc..fadd387 100644 (file)
@@ -21,7 +21,7 @@ class coursefiles_edit_form extends moodleform {
     function definition() {
         $mform =& $this->_form;
         $contextid = $this->_customdata['contextid'];
-        $options = array('subdirs'=>1, 'maxfiles'=>-1, 'accepted_types'=>'*', 'return_types'=>FILE_INTERNAL);
+        $options = array('subdirs'=>1, 'maxfiles'=>-1, 'accepted_types'=>'*');
         $mform->addElement('filemanager', 'files_filemanager', '', null, $options);
         $mform->addElement('hidden', 'contextid', $this->_customdata['contextid']);
         $this->set_data($this->_customdata['data']);
index 2d651e9..a8b638b 100644 (file)
@@ -70,10 +70,10 @@ switch ($action) {
             if ($child->is_directory()) {
                 $fileitem['isdir'] = true;
                 $fileitem['url'] = $url->out(false);
-                $fileitem['icon'] = $OUTPUT->pix_icon('f/folder', get_string('icon'));
+                $fileitem['icon'] = $OUTPUT->pix_icon(file_folder_icon(), get_string('icon'));
             } else {
                 $fileitem['url'] = $child->get_url();
-                $fileitem['icon'] = $OUTPUT->pix_icon('f/'.mimeinfo('icon', $child->get_visible_name()), get_string('icon'));
+                $fileitem['icon'] = $OUTPUT->pix_icon(file_file_icon($child), get_string('icon'));
             }
             $tree[] = $fileitem;
         }
index 1597163..e6f0a22 100644 (file)
@@ -56,25 +56,31 @@ class core_files_renderer extends plugin_renderer_base {
 
         $html .= $this->output->box_start();
         $table = new html_table();
-        $table->head = array(get_string('filename', 'backup'), get_string('size'), get_string('modified'));
-        $table->align = array('left', 'right', 'right');
+        $table->head = array(get_string('name'), get_string('lastmodified'), get_string('size', 'repository'), get_string('type', 'repository'));
+        $table->align = array('left', 'left', 'left', 'left');
         $table->width = '100%';
         $table->data = array();
 
         foreach ($tree->tree as $file) {
-            if (!empty($file['isdir'])) {
-                $table->data[] = array(
-                    html_writer::link($file['url'], $this->output->pix_icon('f/folder', 'icon') . ' ' . $file['filename']),
-                    '',
-                    $file['filedate'],
-                    );
+            $filedate = $filesize = $filetype = '';
+            if ($file['filedate']) {
+                $filedate = userdate($file['filedate'], get_string('strftimedatetimeshort', 'langconfig'));
+            }
+            if (empty($file['isdir'])) {
+                if ($file['filesize']) {
+                    $filesize = display_size($file['filesize']);
+                }
+                $fileicon = file_file_icon($file, 24);
+                $filetype = get_mimetype_description($file);
             } else {
-                $table->data[] = array(
-                    html_writer::link($file['url'], $this->output->pix_icon('f/'.mimeinfo('icon', $file['filename']), get_string('icon')) . ' ' . $file['filename']),
-                    $file['filesize'],
-                    $file['filedate'],
-                    );
+                $fileicon = file_folder_icon(24);
             }
+            $table->data[] = array(
+                html_writer::link($file['url'], $this->output->pix_icon($fileicon, get_string('icon')) . ' ' . $file['filename']),
+                $filedate,
+                $filesize,
+                $filetype
+                );
         }
 
         $html .= html_writer::table($table);
@@ -82,8 +88,812 @@ class core_files_renderer extends plugin_renderer_base {
         $html .= $this->output->box_end();
         return $html;
     }
-}
 
+    /**
+     * Prints the file manager and initializes all necessary libraries
+     *
+     * <pre>
+     * $fm = new form_filemanager($options);
+     * $output = get_renderer('core', 'files');
+     * echo $output->render($fm);
+     * </pre>
+     *
+     * @param form_filemanager $fm File manager to render
+     * @return string HTML fragment
+     */
+    public function render_form_filemanager($fm) {
+        static $filemanagertemplateloaded;
+        $html = $this->fm_print_generallayout($fm);
+        $module = array(
+            'name'=>'form_filemanager',
+            'fullpath'=>'/lib/form/filemanager.js',
+            'requires' => array('core_filepicker', 'base', 'io-base', 'node', 'json', 'core_dndupload', 'panel', 'resize-plugin', 'dd-plugin'),
+            'strings' => array(
+                array('error', 'moodle'), array('info', 'moodle'), array('confirmdeletefile', 'repository'),
+                array('draftareanofiles', 'repository'), array('entername', 'repository'), array('enternewname', 'repository'),
+                array('invalidjson', 'repository'), array('popupblockeddownload', 'repository'),
+                array('unknownoriginal', 'repository'), array('confirmdeletefolder', 'repository'),
+                array('confirmdeletefilewithhref', 'repository'), array('confirmrenamefolder', 'repository'),
+                array('confirmrenamefile', 'repository')
+            )
+        );
+        if (empty($filemanagertemplateloaded)) {
+            $filemanagertemplateloaded = true;
+            $this->page->requires->js_init_call('M.form_filemanager.set_templates',
+                    array($this->filemanager_js_templates()), true, $module);
+        }
+        $this->page->requires->js_init_call('M.form_filemanager.init', array($fm->options), true, $module);
+
+        // non javascript file manager
+        $html .= '<noscript>';
+        $html .= "<div><object type='text/html' data='".$fm->get_nonjsurl()."' height='160' width='600' style='border:1px solid #000'></object></div>";
+        $html .= '</noscript>';
+
+
+        return $html;
+    }
+
+    /**
+     * Returns html for displaying one file manager
+     *
+     * The main element in HTML must have id="filemanager-{$client_id}" and
+     * class="filemanager fm-loading";
+     * After all necessary code on the page (both html and javascript) is loaded,
+     * the class fm-loading will be removed and added class fm-loaded;
+     * The main element (class=filemanager) will be assigned the following classes:
+     * 'fm-maxfiles' - when filemanager has maximum allowed number of files;
+     * 'fm-nofiles' - when filemanager has no files at all (although there might be folders);
+     * 'fm-noitems' - when current view (folder) has no items - neither files nor folders;
+     * 'fm-updating' - when current view is being updated (usually means that loading icon is to be displayed);
+     * 'fm-nomkdir' - when 'Make folder' action is unavailable (empty($fm->options->subdirs) == true)
+     *
+     * Element with class 'filemanager-container' will be holding evens for dnd upload (dragover, etc.).
+     * It will have class:
+     * 'dndupload-ready' - when a file is being dragged over the browser
+     * 'dndupload-over' - when file is being dragged over this filepicker (additional to 'dndupload-ready')
+     * 'dndupload-uploading' - during the upload process (note that after dnd upload process is
+     * over, the file manager will refresh the files list and therefore will have for a while class
+     * fm-updating. Both waiting processes should look similar so the images don't jump for user)
+     *
+     * If browser supports Drag-and-drop, the body element will have class 'dndsupported',
+     * otherwise - 'dndnotsupported';
+     *
+     * Element with class 'fp-content' will be populated with files list;
+     * Element with class 'fp-btn-add' will hold onclick event for adding a file (opening filepicker);
+     * Element with class 'fp-btn-mkdir' will hold onclick event for adding new folder;
+     * Element with class 'fp-btn-download' will hold onclick event for download action;
+     *
+     * Element with class 'fp-path-folder' is a template for one folder in path toolbar.
+     * It will hold mouse click event and will be assigned classes first/last/even/odd respectfully.
+     * Parent element will receive class 'empty' when there are no folders to be displayed;
+     * The content of subelement with class 'fp-path-folder-name' will be substituted with folder name;
+     *
+     * Element with class 'fp-viewbar' will have the class 'enabled' or 'disabled' when view mode
+     * can be changed or not;
+     * Inside element with class 'fp-viewbar' there are expected elements with classes
+     * 'fp-vb-icons', 'fp-vb-tree' and 'fp-vb-details'. They will handle onclick events to switch
+     * between the view modes, the last clicked element will have the class 'checked';
+     *
+     * @param form_filemanager $fm
+     * @return string
+     */
+    private function fm_print_generallayout($fm) {
+        global $OUTPUT;
+        $options = $fm->options;
+        $client_id = $options->client_id;
+        $straddfile  = get_string('addfile', 'repository');
+        $strmakedir  = get_string('makeafolder', 'moodle');
+        $strdownload = get_string('downloadfolder', 'repository');
+        $strloading  = get_string('loading', 'repository');
+        $strnofilesattached = get_string('nofilesattached', 'repository');
+        $strdroptoupload = get_string('droptoupload', 'moodle');
+        $icon_progress = $OUTPUT->pix_icon('i/loading_small', $strloading).'';
+        $restrictions = $this->fm_print_restrictions($fm);
+        $strdndenabled = get_string('dndenabled_insentence', 'moodle').$OUTPUT->help_icon('dndenabled');
+        $strdndenabledinbox = get_string('dndenabled_inbox', 'moodle');
+        $loading = get_string('loading', 'repository');
+
+        $html = '
+<div id="filemanager-'.$client_id.'" class="filemanager fm-loading">
+    <div class="fp-restrictions">
+        '.$restrictions.'
+        <span class="dndupload-message"> - '.$strdndenabled.' </span>
+    </div>
+    <div class="fp-navbar">
+        <div class="filemanager-toolbar">
+            <div class="fp-toolbar">
+                <div class="{!}fp-btn-add"><a href="#"><img src="'.$this->pix_url('a/add_file').'" /> '.$straddfile.'</a></div>
+                <div class="{!}fp-btn-mkdir"><a href="#"><img src="'.$this->pix_url('a/create_folder').'" /> '.$strmakedir.'</a></div>
+                <div class="{!}fp-btn-download"><a href="#"><img src="'.$this->pix_url('a/download_all').'" /> '.$strdownload.'</a></div>
+            </div>
+            <div class="{!}fp-viewbar">
+                <a class="{!}fp-vb-icons" href="#"></a>
+                <a class="{!}fp-vb-details" href="#"></a>
+                <a class="{!}fp-vb-tree" href="#"></a>
+            </div>
+        </div>
+        <div class="fp-pathbar">
+            <span class="{!}fp-path-folder"><a class="{!}fp-path-folder-name" href="#"></a></span>
+        </div>
+    </div>
+    <div class="filemanager-loading mdl-align">'.$icon_progress.'</div>
+    <div class="filemanager-container" >
+        <div class="fm-content-wrapper">
+            <div class="fp-content"></div>
+            <div class="fm-empty-container <!--mdl-align-->">'.$strnofilesattached.'
+                <span class="dndupload-message">'.$strdndenabledinbox.'<br/><span class="dndupload-arrow"></span></span>
+            </div>
+            <div class="dndupload-target">'.$strdroptoupload.'<br/><span class="dndupload-arrow"></span></div>
+            <div class="dndupload-uploadinprogress">'.$icon_progress.'</div>
+        </div>
+        <div class="filemanager-updating">'.$icon_progress.'</div>
+    </div>
+</div>';
+        return preg_replace('/\{\!\}/', '', $html);
+    }
+
+    /**
+     * FileManager JS template for displaying one file in 'icon view' mode.
+     *
+     * Except for elements described in fp_js_template_iconfilename, this template may also
+     * contain element with class 'fp-contextmenu'. If context menu is available for this
+     * file, the top element will receive the additional class 'fp-hascontextmenu' and
+     * the element with class 'fp-contextmenu' will hold onclick event for displaying
+     * the context menu.
+     *
+     * @see fp_js_template_iconfilename()
+     * @return string
+     */
+    private function fm_js_template_iconfilename() {
+        $rv = '
+<div class="fp-file">
+    <a href="#">
+    <div style="position:relative;">
+        <div class="{!}fp-thumbnail"></div>
+        <div class="fp-reficons1"></div>
+        <div class="fp-reficons2"></div>
+    </div>
+    <div class="fp-filename-field">
+        <div class="{!}fp-filename"></div>
+    </div>
+    </a>
+    <a class="{!}fp-contextmenu" href="#">'.$this->pix_icon('i/menu', '▶').'</a>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FileManager JS template for displaying file name in 'table view' and 'tree view' modes.
+     *
+     * Except for elements described in fp_js_template_listfilename, this template may also
+     * contain element with class 'fp-contextmenu'. If context menu is available for this
+     * file, the top element will receive the additional class 'fp-hascontextmenu' and
+     * the element with class 'fp-contextmenu' will hold onclick event for displaying
+     * the context menu.
+     *
+     * @todo MDL-32736 remove onclick="return false;"
+     * @see fp_js_template_listfilename()
+     * @return string
+     */
+    private function fm_js_template_listfilename() {
+        $rv = '
+<span>
+    <a href="#">
+    <span class="{!}fp-icon"></span>
+    <span class="{!}fp-filename"></span>
+    </a>
+    <a class="{!}fp-contextmenu" href="#" onclick="return false;">'.$this->pix_icon('i/menu', '▶').'</a>
+</span>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FileManager JS template for displaying 'Make new folder' dialog.
+     *
+     * Must be wrapped in an element, CSS for this element must define width and height of the window;
+     *
+     * Must have one input element with type="text" (for users to enter the new folder name);
+     *
+     * content of element with class 'fp-dlg-curpath' will be replaced with current path where
+     * new folder is about to be created;
+     * elements with classes 'fp-dlg-butcreate' and 'fp-dlg-butcancel' will hold onclick events;
+     *
+     * @return string
+     */
+    private function fm_js_template_mkdir() {
+        $rv = '
+<div class="fp-mkdir-dlg">
+    <p>New folder name:</p>
+    <input type="text"><br/>
+    <a class="{!}fp-dlg-butcreate fp-panel-button" href="#">'.get_string('create').'</a>
+    <a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FileManager JS template for error/info message displayed as a separate popup window.
+     *
+     * @see fp_js_template_message()
+     * @return string
+     */
+    private function fm_js_template_message() {
+        return $this->fp_js_template_message();
+    }
+
+    /**
+     * FileManager JS template for window with file information/actions.
+     *
+     * All content must be enclosed in one element, CSS for this class must define width and
+     * height of the window;
+     *
+     * Thumbnail image will be added as content to the element with class 'fp-thumbnail';
+     *
+     * Inside the window the elements with the following classnames must be present:
+     * 'fp-saveas', 'fp-author', 'fp-license', 'fp-path'. Inside each of them must be
+     * one input element (or select in case of fp-license and fp-path). They may also have labels.
+     * The elements will be assign with class 'uneditable' and input/select element will become
+     * disabled if they are not applicable for the particular file;
+     *
+     * There may be present elements with classes 'fp-original', 'fp-datemodified', 'fp-datecreated',
+     * 'fp-size', 'fp-dimensions', 'fp-reflist'. They will receive additional class 'fp-unknown' if
+     * information is unavailable. If there is information available, the content of embedded
+     * element with class 'fp-value' will be substituted with the value;
+     *
+     * The value of Original ('fp-original') is loaded in separate request. When it is applicable
+     * but not yet loaded the 'fp-original' element receives additional class 'fp-loading';
+     *
+     * The value of 'Aliases/Shortcuts' ('fp-reflist') is also loaded in separate request. When it
+     * is applicable but not yet loaded the 'fp-original' element receives additional class
+     * 'fp-loading'. The string explaining that XX references exist will replace content of element
+     * 'fp-refcount'. Inside '.fp-reflist .fp-value' each reference will be enclosed in <li>;
+     *
+     * Elements with classes 'fp-file-update', 'fp-file-download', 'fp-file-delete', 'fp-file-zip',
+     * 'fp-file-unzip', 'fp-file-setmain' and 'fp-file-cancel' will hold corresponding onclick
+     * events (there may be several elements with class 'fp-file-cancel');
+     *
+     * When confirm button is pressed and file is being selected, the top element receives
+     * additional class 'loading'. It is removed when response from server is received.
+     *
+     * When any of the input fields is changed, the top element receives class 'fp-changed';
+     * When current file can be set as main - top element receives class 'fp-cansetmain';
+     * When current file is folder/zip/file - top element receives respectfully class
+     * 'fp-folder'/'fp-zip'/'fp-file';
+     *
+     * @return string
+     */
+    private function fm_js_template_fileselectlayout() {
+        $strloading  = get_string('loading', 'repository');
+        $icon_progress = $this->pix_icon('i/loading_small', $strloading).'';
+        $rv = '
+<div class="filemanager fp-select">
+    <div class="fp-select-loading">
+        <img src="'.$this->pix_url('i/loading').'" />
+        <p>'.get_string('loading', 'repository').'</p>
+    </div>
+    <form>
+        <div><a class="{!}fp-file-download fp-panel-button" href="#">'.get_string('download').'</a>
+            <a class="{!}fp-file-delete fp-panel-button" href="#">'.get_string('delete').'</a>
+            <a class="{!}fp-file-setmain fp-panel-button" href="#">'.get_string('setmainfile', 'repository').'</a>
+            <a class="{!}fp-file-zip fp-panel-button" href="#">'.get_string('zip', 'editor').'</a>
+            <a class="{!}fp-file-unzip fp-panel-button" href="#">'.get_string('unzip').'</a>
+        </div>
+        <div class="fp-hr"></div>
+        <table>
+            <tr class="{!}fp-saveas"><td class="mdl-right"><label>'.get_string('name', 'moodle').'</label>:</td>
+            <td class="mdl-left"><input type="text"/></td></tr>
+            <tr class="{!}fp-author"><td class="mdl-right"><label>'.get_string('author', 'repository').'</label>:</td>
+            <td class="mdl-left"><input type="text" /></td></tr>
+            <tr class="{!}fp-license"><td class="mdl-right"><label>'.get_string('chooselicense', 'repository').'</label>:</td>
+            <td class="mdl-left"><select></select></td></tr>
+            <tr class="{!}fp-path"><td class="mdl-right"><label>'.get_string('path', 'moodle').'</label>:</td>
+            <td class="mdl-left"><select></select></td></tr>
+            <tr class="{!}fp-original"><td class="mdl-right"><label>'.get_string('original', 'repository').'</label>:</td>
+            <td class="mdl-left"><span class="fp-originloading">'.$icon_progress.' '.$strloading.'</span><span class="fp-value"/></td></tr>
+            <tr class="{!}fp-reflist"><td class="mdl-right"><label>'.get_string('referenceslist', 'repository').'</label>:</td>
+            <td class="mdl-left"><p class="{!}fp-refcount"/><span class="fp-reflistloading">'.$icon_progress.' '.$strloading.'</span><ul class="fp-value"/></td></tr>
+        </table>
+    </form>
+    <p class="{!}fp-thumbnail"></p>
+    <form>
+        <p class="fp-select-update">
+            <a class="{!}fp-file-update" href="#"><span>'.get_string('update', 'moodle').'</span></a>
+            <a class="{!}fp-file-cancel" href="#"><span>'.get_string('cancel').'</span></a>
+        </p>
+    </form>
+    <div class="fp-fileinfo">
+        <div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"/></div>
+        <div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"/></div>
+        <div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"/></div>
+        <div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"/></div>
+    </div>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FileManager JS template for popup confirm dialogue window.
+     *
+     * Must have one top element, CSS for this element must define width and height of the window;
+     *
+     * content of element with class 'fp-dlg-text' will be replaced with dialog text;
+     * elements with classes 'fp-dlg-butconfirm' and 'fp-dlg-butcancel' will
+     * hold onclick events;
+     *
+     * @return string
+     */
+    private function fm_js_template_confirmdialog() {
+        $rv = '
+<div class="filemanager fp-dlg">
+    <div class="{!}fp-dlg-text"></div>
+    <a class="{!}fp-dlg-butconfirm fp-panel-button" href="#">'.get_string('ok').'</a>
+    <a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * Returns all FileManager JavaScript templates as an array.
+     *
+     * @return array
+     */
+    public function filemanager_js_templates() {
+        $class_methods = get_class_methods($this);
+        $templates = array();
+        foreach ($class_methods as $method_name) {
+            if (preg_match('/^fm_js_template_(.*)$/', $method_name, $matches))
+            $templates[$matches[1]] = $this->$method_name();
+        }
+        return $templates;
+    }
+
+    /**
+     * Displays restrictions for the file manager
+     *
+     * @param form_filemanager $fm
+     * @return string
+     */
+    private function fm_print_restrictions($fm) {
+        $maxbytes = display_size($fm->options->maxbytes);
+        if (empty($options->maxfiles) || $options->maxfiles == -1) {
+            $maxsize = get_string('maxfilesize', 'moodle', $maxbytes);
+            //$string['maxfilesize'] = 'Maximum size for new files: {$a}';
+        } else {
+            $strparam = (object)array('size' => $maxbytes, 'attachments' => $options->maxfiles);
+            $maxsize = get_string('maxsizeandattachments', 'moodle', $strparam);
+            //$string['maxsizeandattachments'] = 'Maximum size for new files: {$a->size}, maximum attachments: {$a->attachments}';
+        }
+        // TODO MDL-32020 also should say about 'File types accepted'
+        return '<span>'. $maxsize. '</span>';
+    }
+
+    /**
+     * Template for FilePicker with general layout (not QuickUpload).
+     *
+     * Must have one top element containing everything else (recommended <div class="file-picker">),
+     * CSS for this element must define width and height of the filepicker window. Or CSS must
+     * define min-width, max-width, min-height and max-height and in this case the filepicker
+     * window will be resizeable;
+     *
+     * Element with class 'fp-viewbar' will have the class 'enabled' or 'disabled' when view mode
+     * can be changed or not;
+     * Inside element with class 'fp-viewbar' there are expected elements with classes
+     * 'fp-vb-icons', 'fp-vb-tree' and 'fp-vb-details'. They will handle onclick events to switch
+     * between the view modes, the last clicked element will have the class 'checked';
+     *
+     * Element with class 'fp-repo' is a template for displaying one repository. Other repositories
+     * will be attached as siblings (classes first/last/even/odd will be added respectfully).
+     * The currently selected repostory will have class 'active'. Contents of element with class
+     * 'fp-repo-name' will be replaced with repository name, source of image with class
+     * 'fp-repo-icon' will be replaced with repository icon;
+     *
+     * Element with class 'fp-content' is obligatory and will hold the current contents;
+     *
+     * Element with class 'fp-paging' will contain page navigation (will be deprecated soon);
+     *
+     * Element with class 'fp-path-folder' is a template for one folder in path toolbar.
+     * It will hold mouse click event and will be assigned classes first/last/even/odd respectfully.
+     * Parent element will receive class 'empty' when there are no folders to be displayed;
+     * The content of subelement with class 'fp-path-folder-name' will be substituted with folder name;
+     *
+     * Element with class 'fp-toolbar' will have class 'empty' if all 'Back', 'Search', 'Refresh',
+     * 'Logout', 'Manage' and 'Help' are unavailable for this repo;
+     *
+     * Inside fp-toolbar there are expected elements with classes fp-tb-back, fp-tb-search,
+     * fp-tb-refresh, fp-tb-logout, fp-tb-manage and fp-tb-help. Each of them will have
+     * class 'enabled' or 'disabled' if particular repository has this functionality.
+     * Element with class 'fp-tb-search' must contain empty form inside, it's contents will
+     * be substituted with the search form returned by repository (in the most cases it
+     * is generated with template core_repository_renderer::repository_default_searchform);
+     * Other elements must have either <a> or <button> element inside, it will hold onclick
+     * event for corresponding action; labels for fp-tb-back and fp-tb-logout may be
+     * replaced with those specified by repository;
+     *
+     * @return string
+     */
+    private function fp_js_template_generallayout() {
+        $rv = '
+<div class="file-picker fp-generallayout">
+    <div class="fp-repo-area">
+        <ul class="fp-list">
+            <li class="{!}fp-repo"><a href="#"><img class="{!}fp-repo-icon" width="16" height="16" />&nbsp;<span class="{!}fp-repo-name" /span></a></li>
+        </ul>
+    </div>
+    <div class="fp-repo-items">
+        <div class="fp-navbar">
+            <div>
+                <div class="{!}fp-toolbar">
+                    <div class="{!}fp-tb-back"><a href="#">'.get_string('back', 'repository').'</a></div>
+                    <div class="{!}fp-tb-search fp-search"><form/></div>
+                    <div class="{!}fp-tb-refresh"><a href="#"><img src="'.$this->pix_url('a/refresh').'" /></a></div>
+                    <div class="{!}fp-tb-logout"><img src="'.$this->pix_url('a/logout').'" /><a href="#"></a></div>
+                    <div class="{!}fp-tb-manage"><a href="#"><img src="'.$this->pix_url('a/setting').'" /> '.get_string('manageurl', 'repository').'</a></div>
+                    <div class="{!}fp-tb-help"><a href="#"><img src="'.$this->pix_url('a/help').'" /> '.get_string('help').'</a></div>
+                </div>
+                <div class="{!}fp-viewbar">
+                    <a class="{!}fp-vb-icons" href="#"></a>
+                    <a class="{!}fp-vb-details" href="#"></a>
+                    <a class="{!}fp-vb-tree" href="#"></a>
+                </div>
+            </div>
+            <div class="fp-pathbar">
+                 <span class="{!}fp-path-folder"><a class="{!}fp-path-folder-name" href="#"></a></span>
+            </div>
+        </div>
+        <div class="{!}fp-content"></div>
+    </div>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for displaying one file in 'icon view' mode.
+     *
+     * the element with class 'fp-thumbnail' will be resized to the repository thumbnail size
+     * (both width and height, unless min-width and/or min-height is set in CSS) and the content of
+     * an element will be replaced with an appropriate img;
+     *
+     * the width of element with class 'fp-filename' will be set to the repository thumbnail width
+     * (unless min-width is set in css) and the content of an element will be replaced with filename
+     * supplied by repository;
+     *
+     * top element(s) will have class fp-folder if the element is a folder;
+     *
+     * List of files will have parent <div> element with class 'fp-iconview'
+     *
+     * @return string
+     */
+    private function fp_js_template_iconfilename() {
+        $rv = '
+<a class="fp-file" href="#" >
+    <div class="{!}fp-thumbnail"></div>
+    <div class="fp-filename-field">
+        <p class="{!}fp-filename"></p>
+    </div>
+</a>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for displaying file name in 'table view' and 'tree view' modes.
+     *
+     * content of the element with class 'fp-icon' will be replaced with an appropriate img;
+     *
+     * content of element with class 'fp-filename' will be replaced with filename supplied by
+     * repository;
+     *
+     * top element(s) will have class fp-folder if the element is a folder;
+     *
+     * Note that tree view and table view are the YUI widgets and therefore there are no
+     * other templates. The widgets will be wrapped in <div> with class fp-treeview or
+     * fp-tableview (respectfully).
+     *
+     * @return string
+     */
+    private function fp_js_template_listfilename() {
+        $rv = '<span><span class="{!}fp-icon"></span> <span class="{!}fp-filename"></span></span>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for displaying link/loading progress for fetching of the next page
+     *
+     * This text is added to .fp-content AFTER .fp-iconview/.fp-treeview/.fp-tableview
+     *
+     * Must have one parent element with class 'fp-nextpage'. It will be assigned additional
+     * class 'loading' during loading of the next page (it is recommended that in this case the link
+     * becomes unavailable). Also must contain one element <a> or <button> that will hold
+     * onclick event for displaying of the next page. The event will be triggered automatically
+     * when user scrolls to this link.
+     *
+     * @return string
+     */
+    private function fp_js_template_nextpage() {
+        $rv = '
+<div class="{!}fp-nextpage">
+    <div class="fp-nextpage-link"><a href="#">'.get_string('more').'</a></div>
+    <div class="fp-nextpage-loading">
+        <img src="'.$this->pix_url('i/loading').'" />
+        <p>'.get_string('loading', 'repository').'</p>
+    </div>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for window appearing to select a file.
+     *
+     * All content must be enclosed in one element, CSS for this class must define width and
+     * height of the window;
+     *
+     * Thumbnail image will be added as content to the element with class 'fp-thumbnail';
+     *
+     * Inside the window the elements with the following classnames must be present:
+     * 'fp-saveas', 'fp-linktype-2', 'fp-linktype-1', 'fp-linktype-4', 'fp-setauthor',
+     * 'fp-setlicense'. Inside each of them must have one input element (or select in case of
+     * fp-setlicense). They may also have labels.
+     * The elements will be assign with class 'uneditable' and input/select element will become
+     * disabled if they are not applicable for the particular file;
+     *
+     * There may be present elements with classes 'fp-datemodified', 'fp-datecreated', 'fp-size',
+     * 'fp-license', 'fp-author', 'fp-dimensions'. They will receive additional class 'fp-unknown'
+     * if information is unavailable. If there is information available, the content of embedded
+     * element with class 'fp-value' will be substituted with the value;
+     *
+     * Elements with classes 'fp-select-confirm' and 'fp-select-cancel' will hold corresponding
+     * onclick events;
+     *
+     * When confirm button is pressed and file is being selected, the top element receives
+     * additional class 'loading'. It is removed when response from server is received.
+     *
+     * @return string
+     */
+    private function fp_js_template_selectlayout() {
+        $rv = '
+<div class="file-picker fp-select">
+    <div class="fp-select-loading">
+        <img src="'.$this->pix_url('i/loading').'" />
+        <p>'.get_string('loading', 'repository').'</p>
+    </div>
+    <form>
+        <div>
+            <a class="{!}fp-select-confirm fp-panel-button" href="#">'.get_string('getfile', 'repository').'</a>
+            <a class="{!}fp-select-cancel fp-panel-button" href="#">'.get_string('cancel').'</a>
+        </div>
+        <div class="fp-hr"></div>
+        <table>
+            <tr class="{!}fp-linktype-2">
+                <td></td>
+                <td class="mdl-left"><input type="radio"/><label>&nbsp;'.get_string('makefileinternal', 'repository').'</label></td></tr>
+            <tr class="{!}fp-linktype-1">
+                <td></td>
+                <td class="mdl-left"><input type="radio"/><label>&nbsp;'.get_string('makefilelink', 'repository').'</label></td></tr>
+            <tr class="{!}fp-linktype-4">
+                <td></td>
+                <td class="mdl-left"><input type="radio"/><label>&nbsp;'.get_string('makefilereference', 'repository').'</label></td></tr>
+            <tr class="{!}fp-saveas">
+                <td class="mdl-right"><label>'.get_string('saveas', 'repository').'</label>:</td>
+                <td class="mdl-left"><input type="text"/></td></tr>
+            <tr class="{!}fp-setauthor">
+                <td class="mdl-right"><label>'.get_string('author', 'repository').'</label>:</td>
+                <td class="mdl-left"><input type="text" /></td></tr>
+            <tr class="{!}fp-setlicense">
+                <td class="mdl-right"><label>'.get_string('chooselicense', 'repository').'</label>:</td>
+                <td class="mdl-left"><select></select></td></tr>
+        </table>
+    </form>
+    <p class="{!}fp-thumbnail"></p>
+    <div class="fp-fileinfo">
+        <div class="{!}fp-datemodified">'.get_string('lastmodified', 'moodle').': <span class="fp-value"/></div>
+        <div class="{!}fp-datecreated">'.get_string('datecreated', 'repository').': <span class="fp-value"/></div>
+        <div class="{!}fp-size">'.get_string('size', 'repository').': <span class="fp-value"/></div>
+        <div class="{!}fp-license">'.get_string('license', 'moodle').': <span class="fp-value"/></div>
+        <div class="{!}fp-author">'.get_string('author', 'repository').': <span class="fp-value"/></div>
+        <div class="{!}fp-dimensions">'.get_string('dimensions', 'repository').': <span class="fp-value"/></div>
+    </div>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for 'Upload file' repository
+     *
+     * Content to display when user chooses 'Upload file' repository (will be nested inside
+     * element with class 'fp-content').
+     *
+     * Must contain form (enctype="multipart/form-data" method="POST")
+     *
+     * The elements with the following classnames must be present:
+     * 'fp-file', 'fp-saveas', 'fp-setauthor', 'fp-setlicense'. Inside each of them must have
+     * one input element (or select in case of fp-setlicense). They may also have labels.
+     *
+     * Element with class 'fp-upload-btn' will hold onclick event for uploading the file;
+     *
+     * Please note that some fields may be hidden using CSS if this is part of quickupload form
+     *
+     * @return string
+     */
+    private function fp_js_template_uploadform() {
+        $rv = '
+<div class="fp-upload-form mdl-align">
+    <div class="fp-content-center">
+        <form enctype="multipart/form-data" method="POST">
+            <table >
+                <tr class="{!}fp-file">
+                    <td class="mdl-right"><label>'.get_string('attachment', 'repository').'</label>:</td>
+                    <td class="mdl-left"><input type="file"/></td></tr>
+                <tr class="{!}fp-saveas">
+                    <td class="mdl-right"><label>'.get_string('saveas', 'repository').'</label>:</td>
+                    <td class="mdl-left"><input type="text"/></td></tr>
+                <tr class="{!}fp-setauthor">
+                    <td class="mdl-right"><label>'.get_string('author', 'repository').'</label>:</td>
+                    <td class="mdl-left"><input type="text"/></td></tr>
+                <tr class="{!}fp-setlicense">
+                    <td class="mdl-right"><label>'.get_string('chooselicense', 'repository').'</label>:</td>
+                    <td class="mdl-left"><select/></td></tr>
+            </table>
+        </form>
+        <div><button class="{!}fp-upload-btn">'.get_string('upload', 'repository').'</button></div>
+    </div>
+</div> ';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template to display during loading process (inside element with class 'fp-content').
+     *
+     * @return string
+     */
+    private function fp_js_template_loading() {
+        return '
+<div class="fp-content-loading">
+    <div class="fp-content-center">
+        <img src="'.$this->pix_url('i/loading').'" />
+        <p>'.get_string('loading', 'repository').'</p>
+    </div>
+</div>';
+    }
+
+    /**
+     * FilePicker JS template for error (inside element with class 'fp-content').
+     *
+     * must have element with class 'fp-error', its content will be replaced with error text
+     * and the error code will be assigned as additional class to this element
+     * used errors: invalidjson, nofilesavailable, norepositoriesavailable
+     *
+     * @return string
+     */
+    private function fp_js_template_error() {
+        $rv = '
+<div class="fp-content-error" ><div class="{!}fp-error" /></div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for error/info message displayed as a separate popup window.
+     *
+     * Must be wrapped in one element, CSS for this element must define
+     * width and height of the window. It will be assigned with an additional class 'fp-msg-error'
+     * or 'fp-msg-info' depending on message type;
+     *
+     * content of element with class 'fp-msg-text' will be replaced with error/info text;
+     *
+     * element with class 'fp-msg-butok' will hold onclick event
+     *
+     * @return string
+     */
+    private function fp_js_template_message() {
+        $rv = '
+<div class="file-picker fp-msg">
+    <p class="{!}fp-msg-text"></p>
+    <a class="{!}fp-msg-butok fp-panel-button" href="#">'.get_string('ok').'</a>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for popup dialogue window asking for action when file with the same name already exists.
+     *
+     * Must have one top element, CSS for this element must define width and height of the window;
+     *
+     * content of element with class 'fp-dlg-text' will be replaced with dialog text;
+     * elements with classes 'fp-dlg-butoverwrite', 'fp-dlg-butrename' and 'fp-dlg-butcancel' will
+     * hold onclick events;
+     *
+     * content of element with class 'fp-dlg-butrename' will be substituted with appropriate string
+     * (Note that it may have long text)
+     *
+     * @return string
+     */
+    private function fp_js_template_processexistingfile() {
+        $rv = '
+<div class="file-picker fp-dlg">
+    <p class="{!}fp-dlg-text"></p>
+    <a class="{!}fp-dlg-butoverwrite fp-panel-button" href="#">'.get_string('overwrite', 'repository').'</a>
+    <a class="{!}fp-dlg-butcancel fp-panel-button" href="#">'.get_string('cancel').'</a>
+    <a class="{!}fp-dlg-butrename fp-panel-button" href="#"/>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * FilePicker JS template for repository login form including templates for each element type
+     *
+     * Must contain one <form> element with templates for different input types inside:
+     * Elements with classes 'fp-login-popup', 'fp-login-textarea', 'fp-login-select' and
+     * 'fp-login-input' are templates for displaying respective login form elements. Inside
+     * there must be exactly one element with type <button>, <textarea>, <select> or <input>
+     * (i.e. fp-login-popup should have <button>, fp-login-textarea should have <textarea>, etc.);
+     * They may also contain the <label> element and it's content will be substituted with
+     * label;
+     *
+     * You can also define elements with classes 'fp-login-checkbox', 'fp-login-text'
+     * but if they are not found, 'fp-login-input' will be used;
+     *
+     * Element with class 'fp-login-radiogroup' will be used for group of radio inputs. Inside
+     * it should hava a template for one radio input (with class 'fp-login-radio');
+     *
+     * Element with class 'fp-login-submit' will hold on click mouse event (form submission). It
+     * will be removed if at least one popup element is present;
+     *
+     * @return string
+     */
+    private function fp_js_template_loginform() {
+        $rv = '
+<div class="fp-login-form">
+    <div class="fp-content-center">
+        <form>
+            <table >
+                <tr class="{!}fp-login-popup">
+                    <td colspan="2">
+                        <label>'.get_string('popup', 'repository').'</label>
+                        <p class="fp-popup"><button class="{!}fp-login-popup-but">'.get_string('login', 'repository').'</button></p></td></tr>
+                <tr class="{!}fp-login-textarea">
+                    <td colspan="2"><p><textarea></textarea></p></td></tr>
+                <tr class="{!}fp-login-select">
+                    <td align="right"><label></label></td>
+                    <td align="left"><select></select></td></tr>
+                <tr class="{!}fp-login-input">
+                    <td class="label"><label /></td>
+                    <td class="input"><input/></td></tr>
+                <tr class="{!}fp-login-radiogroup">
+                    <td align="right" width="30%" valign="top"><label /></td>
+                    <td align="left" valign="top"><p class="{!}fp-login-radio"><input /> <label /></p></td></tr>
+            </table>
+            <p><button class="{!}fp-login-submit">'.get_string('submit', 'repository').'</button></p>
+        </form>
+    </div>
+</div>';
+        return preg_replace('/\{\!\}/', '', $rv);
+    }
+
+    /**
+     * Returns all FilePicker JavaScript templates as an array.
+     *
+     * @return array
+     */
+    public function filepicker_js_templates() {
+        $class_methods = get_class_methods($this);
+        $templates = array();
+        foreach ($class_methods as $method_name) {
+            if (preg_match('/^fp_js_template_(.*)$/', $method_name, $matches))
+            $templates[$matches[1]] = $this->$method_name();
+        }
+        return $templates;
+    }
+
+    /**
+     * Returns HTML for default repository searchform to be passed to Filepicker
+     *
+     * This will be used as contents for search form defined in generallayout template
+     * (form with id {TOOLSEARCHID}).
+     * Default contents is one text input field with name="s"
+     */
+    public function repository_default_searchform() {
+        $str = '<input class="search-entry" name="s" value="Search" />';
+        return $str;
+    }
+}
 
 /**
  * Data structure representing a general moodle file tree viewer
@@ -148,8 +958,9 @@ class files_tree_viewer implements renderable {
             $fileitem = array(
                     'params'   => $params,
                     'filename' => $child->get_visible_name(),
-                    'filedate' => $filedate ? userdate($filedate) : '',
-                    'filesize' => $filesize ? display_size($filesize) : ''
+                    'mimetype' => $child->get_mimetype(),
+                    'filedate' => $filedate ? $filedate : '',
+                    'filesize' => $filesize ? $filesize : ''
                     );
             $url = new moodle_url('/files/index.php', $params);
             if ($child->is_directory()) {
index 185fed5..e1937be 100644 (file)
@@ -1049,6 +1049,7 @@ class grade_structure {
      */
     public function get_element_icon(&$element, $spacerifnone=false) {
         global $CFG, $OUTPUT;
+        require_once $CFG->libdir.'/filelib.php';
 
         switch ($element['type']) {
             case 'item':
@@ -1114,7 +1115,7 @@ class grade_structure {
 
             case 'category':
                 $strcat = get_string('category', 'grades');
-                return '<img src="'.$OUTPUT->pix_url('f/folder') . '" class="icon itemicon" ' .
+                return '<img src="'.$OUTPUT->pix_url(file_folder_icon()) . '" class="icon itemicon" ' .
                         'title="'.s($strcat).'" alt="'.s($strcat).'" />';
         }
 
index 5cee004..2ac7b1e 100644 (file)
@@ -183,6 +183,7 @@ $string['configdenyemailaddresses'] = 'To deny email addresses from particular d
 $string['configenabledevicedetection'] = 'Enables detection of mobiles, smartphones, tablets or default devices (desktop PCs, laptops, etc) for the application of themes and other features.';
 $string['configdisableuserimages'] = 'Disable the ability for users to change user profile images.';
 $string['configdisplayloginfailures'] = 'This will display information to selected users about previous failed logins.';
+$string['configdndallowtextandlinks'] = 'Enable or disable the dragging and dropping of text and links onto a course page, alongside the dragging and dropping of files. Note that the dragging of text into Firefox or between different browsers is unreliable and may result in no data being uploaded, or corrupted text being uploaded.';
 $string['configdocroot'] = 'Defines the path to the Moodle Docs. You can change this if you wish to have your own custom online documentation. However, if you do that make sure that the paths in your documentation follow the same format as http://docs.moodle.org.';
 $string['configdoctonewwindow'] = 'If you enable this, then links to Moodle Docs will be shown in a new window.';
 $string['configeditordictionary'] = 'This value will be used if aspell doesn\'t have dictionary for users own language.';
@@ -431,6 +432,7 @@ $string['devicetype'] = 'Device type';
 $string['disableuserimages'] = 'Disable user profile images';
 $string['displayerrorswarning'] = 'Enabling the PHP setting <em>display_errors</em> is not recommended on production sites because some error messages may reveal sensitive information about your server.';
 $string['displayloginfailures'] = 'Display login failures to';
+$string['dndallowtextandlinks'] = 'Drag and drop upload of text/links';
 $string['docroot'] = 'Moodle Docs document root';
 $string['doctonewwindow'] = 'Open in new window';
 $string['download'] = 'Download';
index 3cb7ec1..fa80925 100644 (file)
@@ -117,6 +117,9 @@ $string['errorinvalidformat'] = 'Unknown backup format';
 $string['errorinvalidformatinfo'] = 'The selected file is not a valid Moodle backup file and can\'t be restored.';
 $string['executionsuccess'] = 'The backup file was successfully created.';
 $string['filename'] = 'Filename';
+$string['filereferencesincluded'] = 'File references to external contents included in backup package, they won\'t work on other sites.';
+$string['filereferencessamesite'] = 'Backup is from the same site, file references can be restored';
+$string['filereferencesnotsamesite'] = 'Backup is from other site, file references cannot be restored';
 $string['generalactivities'] = 'Include activities';
 $string['generalanonymize'] = 'Anonymise information';
 $string['generalbackdefaults'] = 'General backup defaults';
@@ -148,6 +151,7 @@ $string['includeditems'] = 'Included items:';
 $string['includesection'] = 'Section {$a}';
 $string['includeuserinfo'] = 'User data';
 $string['loglifetime'] = 'Keep logs for';
+$string['includefilereferences'] = 'File references to external contents';
 $string['locked'] = 'Locked';
 $string['lockedbypermission'] = 'You don\'t have sufficient permissions to change this setting';
 $string['lockedbyconfig'] = 'This setting has been locked by the default backup settings';
index 75fb0be..b40859b 100644 (file)
@@ -224,6 +224,7 @@ $string['errorsettinguserpref'] = 'Error setting user preference';
 $string['errorunzippingfiles'] = 'Error unzipping files';
 $string['expiredkey'] = 'Expired key';
 $string['externalauthpassworderror'] = 'Non-empty password for external authentication';
+$string['externalfilenolocation'] = 'External file has no location path';
 $string['failtoloadblocks'] = 'One or more blocks are registered in the database, but they all failed to load!';
 $string['fieldrequired'] = '"{$a}" is a required field';
 $string['fileexists'] = 'File exists';
@@ -323,6 +324,7 @@ $string['invalidsection'] = 'Course module record contains invalid section';
 $string['invalidsesskey'] = 'Incorrect sesskey submitted, form not accepted!';
 $string['invalidshortname'] = 'That\'s an invalid short course name';
 $string['invalidstatedetected'] = 'Something has gone wrong: {$a}. This should never normally happen.';
+$string['invalidsourcefield'] = 'Draft file\'s source field is invalid';
 $string['invalidurl'] = 'Invalid URL';
 $string['invaliduser'] = 'Invalid user';
 $string['invaliduserid'] = 'Invalid user id';
index 17d224e..9cb966d 100644 (file)
 /**
  * Strings for component 'mimetypes', language 'en', branch 'MOODLE_20_STABLE'
  *
+ * Strings are used to display human-readable name of mimetype. Some mimetypes share the same
+ * string. The following attributes are passed in the parameter when processing the string:
+ *   $a->ext - filename extension in lower case
+ *   $a->EXT - filename extension, capitalized
+ *   $a->Ext - filename extension with first capital letter
+ *   $a->mimetype - file mimetype
+ *   $a->mimetype1 - first chunk of mimetype (before /)
+ *   $a->mimetype2 - second chunk of mimetype (after /)
+ *   $a->Mimetype, $a->MIMETYPE, $a->Mimetype1, $a->Mimetype2, $a->MIMETYPE1, $a->MIMETYPE2
+ *      - the same with capitalized first/all letters
+ *
+ * @see       get_mimetypes_array()
+ * @see       get_mimetype_description()
  * @package   mimetypes
  * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
  * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 
 $string['application/msword'] = 'Word document';
 $string['application/pdf'] = 'PDF document';
+$string['application/vnd.moodle.backup'] = 'Moodle backup';
 $string['application/vnd.ms-excel'] = 'Excel spreadsheet';
 $string['application/vnd.ms-powerpoint'] = 'Powerpoint presentation';
-$string['application/zip'] = 'zip archive';
-$string['audio/mp3'] = 'MP3 audio file';
-$string['audio/wav'] = 'sound file';
-$string['document/unknown'] = 'file';
-$string['image/bmp'] = 'uncompressed BMP image';
-$string['image/gif'] = 'GIF image';
-$string['image/jpeg'] = 'JPEG image';
-$string['image/png'] = 'PNG image';
-$string['text/plain'] = 'text file';
+$string['application/vnd.openxmlformats-officedocument.presentationml.presentation'] = 'Powerpoint presentation';
+$string['application/vnd.openxmlformats-officedocument.presentationml.slideshow'] = 'Powerpoint slideshow';
+$string['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'] = 'Excel spreadsheet';
+$string['application/vnd.openxmlformats-officedocument.spreadsheetml.template'] = 'Excel template';
+$string['application/vnd.openxmlformats-officedocument.wordprocessingml.document'] = 'Word document';
+$string['archive'] = 'Archive ({$a->EXT})';
+$string['audio'] = 'Audio file ({$a->EXT})';
+$string['default'] = '{$a->mimetype}';
+$string['document/unknown'] = 'File';
+$string['image'] = 'Image ({$a->MIMETYPE2})';
+$string['text/html'] = 'HTML document';
+$string['text/plain'] = 'Text file';
 $string['text/rtf'] = 'RTF document';
index b7cc79e..073d3eb 100644 (file)
@@ -467,7 +467,14 @@ $string['dndenabled'] = 'Drag and drop available';
 $string['dndenabled_help'] = 'You can drag one or more files from your desktop and drop them onto the box below to upload them.<br />Note: this may not work with other web browsers';
 $string['dndenabled_insentence'] = 'drag and drop available';
 $string['dndenabled_inbox'] = 'drag and drop files here to upload them';
-$string['dndworking'] = 'Drag and drop files, text or links onto course sections to upload them';
+$string['dnduploadwithoutcontent'] = 'This upload does not have any content';
+$string['dndworkingfiletextlink'] = 'Drag and drop files, text or links onto course sections to upload them';
+$string['dndworkingfilelink'] = 'Drag and drop files or links onto course sections to upload them';
+$string['dndworkingfiletext'] = 'Drag and drop files or text onto course sections to upload them';
+$string['dndworkingfile'] = 'Drag and drop files onto course sections to upload them';
+$string['dndworkingtextlink'] = 'Drag and drop text or links onto course sections to upload them';
+$string['dndworkingtext'] = 'Drag and drop text onto course sections to upload it';
+$string['dndworkinglink'] = 'Drag and drop links onto course sections to upload them';
 $string['documentation'] = 'Moodle documentation';
 $string['down'] = 'Down';
 $string['download'] = 'Download';
@@ -1242,6 +1249,7 @@ $string['olduserdirectory'] = 'This is the OLD users directory, and is no longer
 $string['opentoguests'] = 'Guest access';
 $string['optional'] = 'optional';
 $string['order'] = 'Order';
+$string['originalpath'] = 'Original path';
 $string['orphanedactivities'] = 'Orphaned activities';
 $string['other'] = 'Other';
 $string['outline'] = 'Outline';
index 0e84fcd..42c8658 100644 (file)
@@ -61,9 +61,15 @@ $string['commonrepositorysettings'] = 'Common repository settings';
 $string['configallowexternallinks'] = 'This option enables all users to choose whether or not external media is copied into Moodle or not. If this is off then media is always copied into Moodle (this is usually best for overall data integrity and security).  If this is on then users can choose each time they add media to a text.';
 $string['configcacheexpire'] = 'The amount of time that file listings are cached locally (in seconds) when browsing external repositories.';
 $string['configsaved'] = 'Configuration saved!';
-$string['confirmdelete'] = 'Are you sure you want to delete this repository - {$a}?';
+$string['confirmdelete'] = 'Are you sure you want to delete this repository - {$a}? If you choose "Continue and download", file references to external contents will be downloaded to moodle, but it could take long time to process.';
 $string['confirmdeletefile'] = 'Are you sure you want to delete this file?';
-$string['confirmremove'] = 'Are you sure you want to remove this repository plugin, its options and <strong>all of its instances</strong> - {$a}?';
+$string['confirmrenamefile'] = 'Are you sure you want to rename/move this file? There are {$a} alias/shortcut files that use this file as their source. If you proceed then those aliases will be converted to true copies.';
+$string['confirmdeletefilewithhref'] = 'Are you sure you want to delete this file? There are {$a} alias/shortcut files that use this file as their source. If you proceed then those aliases will be converted to true copies.';
+$string['confirmdeletefolder'] = 'Are you sure you want to delete this folder? All files and subfolders will be deleted.';
+$string['confirmremove'] = 'Are you sure you want to remove this repository plugin, its options and <strong>all of its instances</strong> - {$a}? If you choose "Continue and download", file references to external contents will be downloaded to moodle, but it could take long time to process.';
+$string['confirmrenamefolder'] = ' Are you sure you want to move/rename this folder? Any alias/shortcut files that reference files in this folder will be converted into true copies.';
+$string['continueuninstall'] = 'Continue';
+$string['continueuninstallanddownload'] = 'Continue and download';
 $string['copying'] = 'Copying';
 $string['create'] = 'Create';
 $string['createfolderfail'] = 'Fail to create this folder';
@@ -72,8 +78,11 @@ $string['createinstance'] = 'Create a repository instance';
 $string['createrepository'] = 'Create a repository instance';
 $string['createxxinstance'] = 'Create "{$a}" instance';
 $string['date'] = 'Date';
+$string['datecreated'] = 'Created';
 $string['deleted'] = 'Repository deleted';
 $string['deleterepository'] = 'Delete this repository';
+$string['detailview'] = 'View details';
+$string['dimensions'] = 'Dimensions';
 $string['disabled'] = 'Disabled';
 $string['download'] = 'Download';
 $string['downloadfolder'] = 'Download all';
@@ -102,11 +111,15 @@ $string['filenotnull'] = 'You must select a file to upload.';
 $string['filesaved'] = 'The file has been saved';
 $string['filepicker'] = 'File picker';
 $string['filesizenull'] = 'File size cannot be determined';
+$string['folderexists'] = 'Folder name already being used, please use another name';
+$string['foldernotfound'] = 'Folder not found';
+$string['folderrecurse'] = 'Folder can not be moved to it\s own subfolder';
 $string['getfile'] = 'Select this file';
 $string['hidden'] = 'Hidden';
 $string['choosealink'] = 'Choose a link...';
 $string['chooselicense'] = 'Choose license';
 $string['iconview'] = 'View as icons';
+$string['imagesize'] = '{$a->width} x {$a->height} px';
 $string['instance'] = 'instance';
 $string['instancedeleted'] = 'Instance deleted';
 $string['instances'] = 'Repository instances';
@@ -117,6 +130,7 @@ $string['invalidjson'] = 'Invalid JSON string';
 $string['invalidplugin'] = 'Invalid repository {$a} plug-in';
 $string['invalidfiletype'] = '{$a} filetype cannot be accepted.';
 $string['invalidrepositoryid'] = 'Invalid repository ID';
+$string['invalidparams'] = 'Invalid parameters';
 $string['isactive'] = 'Active?';
 $string['keyword'] = 'Keyword';
 $string['linkexternal'] = 'Link external';
@@ -124,6 +138,9 @@ $string['listview'] = 'View as list';
 $string['loading'] = 'Loading...';
 $string['login'] = 'Login';
 $string['logout'] = 'Logout';
+$string['makefileinternal'] = 'Make a copy of the file';
+$string['makefilelink'] = 'Link to the file directly';
+$string['makefilereference'] = 'Create an alias/shortcut to the file';
 $string['manage'] = 'Manage repositories';
 $string['manageurl'] = 'Manage';
 $string['manageuserrepository'] = 'Manage individual repository';
@@ -139,6 +156,7 @@ $string['norepositoriesavailable'] = 'Sorry, none of your current repositories c
 $string['norepositoriesexternalavailable'] = 'Sorry, none of your current repositories can return external files.';
 $string['notyourinstances'] = 'You can not view/edit repository instances of another user';
 $string['off'] = 'Enabled but hidden';
+$string['original'] = 'Original';
 $string['openpicker'] = 'Choose a file...';
 $string['operation'] = 'Operation';
 $string['on'] = 'Enabled and visible';
@@ -150,10 +168,12 @@ $string['popup'] = 'Click "Login" button to login';
 $string['popupblockeddownload'] = 'The downloading window is blocked, please allow the popup window, and try again.';
 $string['preview'] = 'Preview';
 $string['readonlyinstance'] = 'You cannot edit/delete a read-only instance';
+$string['referencesexist'] = 'There are {$a} alias/shortcut files that use this file as their source';
+$string['referenceslist'] = 'Aliases/Shortcuts';
 $string['refresh'] = 'Refresh';
 $string['refreshnonjsfilepicker'] = 'Please close this window and refresh non-javascript file picker';
 $string['removed'] = 'Repository removed';
-$string['renameto'] = 'Rename to';
+$string['renameto'] = 'Rename to "{$a}"';
 $string['repositories'] = 'Repositories';
 $string['repository'] = 'Repository';
 $string['repositorycourse'] = 'Course repositories';
@@ -175,10 +195,14 @@ $string['submit'] = 'Submit';
 $string['sync'] = 'Sync';
 $string['thumbview'] = 'View as icons';
 $string['title'] = 'Choose a file...';
+$string['type'] = 'Type';
 $string['typenotvisible'] = 'Type not visible';
+$string['unknownoriginal'] = 'Unknown';
 $string['upload'] = 'Upload this file';
 $string['uploading'] = 'Uploading...';
 $string['uploadsucc'] = 'The file has been uploaded successfully';
+$string['undisclosedreference'] = '(Undisclosed)';
+$string['uselatestfile'] = 'Use latest file';
 $string['usercontextrepositorydisabled'] = 'You cannot edit this repository in user context';
 $string['usenonjsfilemanager'] = 'Open file manager in new window';
 $string['usenonjsfilepicker'] = 'Open file picker in new window';
index b05e34f..0e47a65 100644 (file)
@@ -403,9 +403,7 @@ function cron_run() {
     cron_execute_plugin_type('format', 'course formats');
     cron_execute_plugin_type('profilefield', 'profile fields');
     cron_execute_plugin_type('webservice', 'webservices');
-    // TODO: Repository lib.php files are messed up (include many other files, etc), so it is
-    // currently not possible to implement repository plugin cron using this infrastructure
-    // cron_execute_plugin_type('repository', 'repository plugins');
+    cron_execute_plugin_type('repository', 'repository plugins');
     cron_execute_plugin_type('qbehaviour', 'question behaviours');
     cron_execute_plugin_type('qformat', 'question import/export formats');
     cron_execute_plugin_type('qtype', 'question types');
@@ -462,6 +460,9 @@ function cron_run() {
     $fs = get_file_storage();
     $fs->cron();
 
+    mtrace("Clean up cached external files");
+    // 1 week
+    cache_file::cleanup(array(), 60 * 60 * 24 * 7);
 
     mtrace("Cron script completed correctly");
 
index 1d83d84..0463430 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20120516" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20120521" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
         <KEY NAME="primary" TYPE="primary" FIELDS="id" COMMENT="primary key of the table, please edit me"/>
       </KEYS>
     </TABLE>
-    <TABLE NAME="files" COMMENT="description of files, content is stored in sha1 file pool" PREVIOUS="message_working" NEXT="repository">
+    <TABLE NAME="files" COMMENT="description of files, content is stored in sha1 file pool" PREVIOUS="message_working" NEXT="files_reference">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true" NEXT="contenthash"/>
         <FIELD NAME="contenthash" TYPE="char" LENGTH="40" NOTNULL="true" SEQUENCE="false" COMMENT="sha1 hash of file content" PREVIOUS="id" NEXT="pathnamehash"/>
@@