diff --git a/files/renderer.php b/files/renderer.php index ee972545b6f..f5f96b10eb9 100644 --- a/files/renderer.php +++ b/files/renderer.php @@ -565,7 +565,11 @@ class core_files_renderer extends plugin_renderer_base { private function fp_js_template_iconfilename() { $rv = ' -
+
+
+
+
+

diff --git a/lib/filebrowser/file_info.php b/lib/filebrowser/file_info.php index 6f9d302bde5..d5bcadecc7b 100644 --- a/lib/filebrowser/file_info.php +++ b/lib/filebrowser/file_info.php @@ -226,6 +226,24 @@ abstract class file_info { return 0; } + /** + * Whether or not this is a external resource + * + * @return bool + */ + public function is_external_file() { + return false; + } + + /** + * Returns file status flag. + * + * @return int 0 means file OK, anything else is a problem and file can not be used + */ + public function get_status() { + return 0; + } + /** * Returns the localised human-readable name of the file together with virtual path * diff --git a/lib/filebrowser/file_info_stored.php b/lib/filebrowser/file_info_stored.php index d16f13c2ab8..44fa566517b 100644 --- a/lib/filebrowser/file_info_stored.php +++ b/lib/filebrowser/file_info_stored.php @@ -309,6 +309,24 @@ class file_info_stored extends file_info { return $this->lf->get_sortorder(); } + /** + * Whether or not this is a external resource + * + * @return bool + */ + public function is_external_file() { + return $this->lf->is_external_file(); + } + + /** + * Returns file status flag. + * + * @return int 0 means file OK, anything else is a problem and file can not be used + */ + public function get_status() { + return $this->lf->get_status(); + } + /** * Returns list of children. * diff --git a/repository/coursefiles/lib.php b/repository/coursefiles/lib.php index ea62bf7f40f..3f2787d1b8e 100644 --- a/repository/coursefiles/lib.php +++ b/repository/coursefiles/lib.php @@ -122,8 +122,12 @@ class repository_coursefiles extends repository { 'datemodified' => $child->get_timemodified(), 'datecreated' => $child->get_timecreated(), 'source'=> $encodedpath, + 'isref' => $child->is_external_file(), 'thumbnail' => $OUTPUT->pix_url(file_file_icon($child, 90))->out(false) ); + if ($child->get_status() == 666) { + $node['originalmissing'] = true; + } if ($imageinfo = $child->get_imageinfo()) { $fileurl = new moodle_url($child->get_url()); $node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb', 'oid' => $child->get_timemodified())); diff --git a/repository/filepicker.js b/repository/filepicker.js index ea1a424feda..93e44904346 100644 --- a/repository/filepicker.js +++ b/repository/filepicker.js @@ -885,6 +885,22 @@ M.core_filepicker.init = function(Y, options) { } }, false); }, + classnamecallback : function(node) { + var classname = ''; + if (node.children) { + classname = classname + ' fp-folder'; + } + if (node.isref) { + classname = classname + ' fp-isreference'; + } + if (node.refcount) { + classname = classname + ' fp-hasreferences'; + } + if (node.originalmissing) { + classname = classname + ' fp-originalmissing'; + } + return Y.Lang.trim(classname); + }, /** displays list of files in tree (list) view mode. If param appenditems is specified, * appends those items to the end of the list. Otherwise (default behaviour) * clears the contents and displays the items from this.filelist */ @@ -920,9 +936,7 @@ M.core_filepicker.init = function(Y, options) { this.content_scrolled(); } }, - classnamecallback : function(node) { - return node.children ? 'fp-folder' : ''; - }, + classnamecallback : this.classnamecallback, dynload : this.active_repo.dynload, filepath : this.filepath, treeview_dynload : this.treeview_dynload @@ -961,9 +975,7 @@ M.core_filepicker.init = function(Y, options) { this.select_file(node); } }, - classnamecallback : function(node) { - return node.children ? 'fp-folder' : ''; - } + classnamecallback : this.classnamecallback }; this.fpnode.one('.fp-content').fp_display_filelist(options, list, this.lazyloading); }, @@ -998,9 +1010,7 @@ M.core_filepicker.init = function(Y, options) { this.select_file(node); } }, - classnamecallback : function(node) { - return node.children ? 'fp-folder' : ''; - } + classnamecallback : this.classnamecallback }; this.fpnode.one('.fp-content').fp_display_filelist(options, list, this.lazyloading); }, diff --git a/repository/local/lib.php b/repository/local/lib.php index 6b3e0285f29..d8898bfbab2 100644 --- a/repository/local/lib.php +++ b/repository/local/lib.php @@ -230,6 +230,10 @@ class repository_local_file { $node['size'] = $this->fileinfo->get_filesize(); $node['author'] = $this->fileinfo->get_author(); $node['license'] = $this->fileinfo->get_license(); + $node['isref'] = $this->fileinfo->is_external_file(); + if ($this->fileinfo->get_status() == 666) { + $node['originalmissing'] = true; + } $node['source'] = $encodedpath; $node['thumbnail'] = $OUTPUT->pix_url(file_file_icon($this->fileinfo, 90))->out(false); $node['icon'] = $OUTPUT->pix_url(file_file_icon($this->fileinfo, 24))->out(false); diff --git a/repository/user/lib.php b/repository/user/lib.php index 241d49dc0cd..98c73845740 100644 --- a/repository/user/lib.php +++ b/repository/user/lib.php @@ -112,10 +112,14 @@ class repository_user extends repository { 'datecreated' => $child->get_timecreated(), 'author' => $child->get_author(), 'license' => $child->get_license(), + 'isref' => $child->is_external_file(), 'source'=> $encodedpath, 'icon' => $OUTPUT->pix_url(file_file_icon($child, 24))->out(false), 'thumbnail' => $OUTPUT->pix_url(file_file_icon($child, 90))->out(false) ); + if ($child->get_status() == 666) { + $node['originalmissing'] = true; + } if ($imageinfo = $child->get_imageinfo()) { $fileurl = new moodle_url($child->get_url()); $node['realthumbnail'] = $fileurl->out(false, array('preview' => 'thumb', 'oid' => $child->get_timemodified())); diff --git a/theme/base/style/filemanager.css b/theme/base/style/filemanager.css index aed0eba8042..4debe5abd23 100644 --- a/theme/base/style/filemanager.css +++ b/theme/base/style/filemanager.css @@ -294,10 +294,10 @@ a.ygtvspacer:hover {color: transparent;text-decoration: none;} /* * Icon view (File Manager only) */ -.filemanager .fp-iconview .fp-reficons1 {position:absolute;height:100%;width:100%;top:0;left:0;z-index:1000;} -.filemanager .fp-iconview .fp-reficons2 {position:absolute;height:100%;width:100%;top:0;left:0;z-index:1001;} -.filemanager .fp-iconview .fp-file.fp-hasreferences .fp-reficons1 {background: url('[[pix:theme|fp/link]]') no-repeat;background-position:bottom right;} -.filemanager .fp-iconview .fp-file.fp-isreference .fp-reficons2 {background: url('[[pix:theme|fp/alias]]') no-repeat;background-position:bottom left;} +.fp-iconview .fp-reficons1 {position:absolute;height:100%;width:100%;top:0;left:0;z-index:1000;} +.fp-iconview .fp-reficons2 {position:absolute;height:100%;width:100%;top:0;left:0;z-index:1001;} +.fp-iconview .fp-file.fp-hasreferences .fp-reficons1 {background: url('[[pix:theme|fp/link]]') no-repeat;background-position:bottom right;} +.fp-iconview .fp-file.fp-isreference .fp-reficons2 {background: url('[[pix:theme|fp/alias]]') no-repeat;background-position:bottom left;} .filemanager .fp-iconview .fp-file.fp-originalmissing .fp-thumbnail img {display:none;} .filemanager .fp-iconview .fp-file.fp-originalmissing .fp-thumbnail {background: url([[pix:s/dead]]) no-repeat;background-position:center center;}