Skip to content

Commit

Permalink
Merge branch 'wip-MDL-33417-master' of git://github.com/marinaglancy/…
Browse files Browse the repository at this point in the history
…moodle
  • Loading branch information
danpoltawski committed Jun 20, 2012
2 parents b19af5b + 1778f31 commit 6e471af
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 14 deletions.
6 changes: 5 additions & 1 deletion files/renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,11 @@ private function fp_js_template_generallayout() {
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>
Expand Down
18 changes: 18 additions & 0 deletions lib/filebrowser/file_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@ public function get_sortorder() {
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
*
Expand Down
18 changes: 18 additions & 0 deletions lib/filebrowser/file_info_stored.php
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,24 @@ public function get_sortorder() {
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.
*
Expand Down
4 changes: 4 additions & 0 deletions repository/coursefiles/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,12 @@ public function get_listing($encodedpath = '', $page = '') {
'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()));
Expand Down
28 changes: 19 additions & 9 deletions repository/filepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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);
},
Expand Down Expand Up @@ -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);
},
Expand Down
4 changes: 4 additions & 0 deletions repository/local/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ public function get_node() {
$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);
Expand Down
4 changes: 4 additions & 0 deletions repository/user/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,14 @@ public function get_listing($encodedpath = '', $page = '') {
'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()));
Expand Down
8 changes: 4 additions & 4 deletions theme/base/style/filemanager.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
Expand Down

0 comments on commit 6e471af

Please sign in to comment.