Merge branch 'wip-MDL-33417-master' of git://github.com/marinaglancy/moodle
authorDan Poltawski <dan@moodle.com>
Wed, 20 Jun 2012 05:42:19 +0000 (13:42 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 20 Jun 2012 05:42:19 +0000 (13:42 +0800)
files/renderer.php
lib/filebrowser/file_info.php
lib/filebrowser/file_info_stored.php
repository/coursefiles/lib.php
repository/filepicker.js
repository/local/lib.php
repository/user/lib.php
theme/base/style/filemanager.css

index ee97254..f5f96b1 100644 (file)
@@ -565,7 +565,11 @@ class core_files_renderer extends plugin_renderer_base {
     private function fp_js_template_iconfilename() {
         $rv = '
 <a class="fp-file" href="#" >
-    <div class="{!}fp-thumbnail"></div>
+    <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">
         <p class="{!}fp-filename"></p>
     </div>
index 6f9d302..d5bcade 100644 (file)
@@ -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
      *
index d16f13c..44fa566 100644 (file)
@@ -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.
      *
index ea62bf7..3f2787d 100644 (file)
@@ -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()));
index ea1a424..93e4490 100644 (file)
@@ -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);
         },
index 6b3e028..d8898bf 100644 (file)
@@ -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);
index 241d49d..98c7384 100644 (file)
@@ -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()));
index aed0eba..4debe5a 100644 (file)
@@ -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;}