diff --git a/repository/filepicker.js b/repository/filepicker.js
index 3a82f7b55ee..285735a0646 100644
--- a/repository/filepicker.js
+++ b/repository/filepicker.js
@@ -46,19 +46,6 @@ M.core_filepicker = M.core_filepicker || {};
M.core_filepicker.instances = M.core_filepicker.instances || {};
M.core_filepicker.active_filepicker = null;
-/**
- * Set selected file info
- *
- * @parma object file info
- */
-M.core_filepicker.select_file = function(file) {
- var fileinfo = {};
- fileinfo['title'] = file.title;
- fileinfo['source'] = file.reference;
- fileinfo['thumbnail'] = file.thumbnail;
- M.core_filepicker.active_filepicker.select_file(fileinfo);
-}
-
/**
* Init and show file picker
*/
@@ -381,25 +368,19 @@ M.core_filepicker.init = function(Y, options) {
tmpNode.isLeaf = true;
}
},
- view_files: function(page) {
- var p= page?page:null;
+ view_files: function() {
if (this.active_repo.issearchresult) {
// list view is desiged to display treeview
// it is not working well with search result
this.view_as_icons();
} else {
- if (this.objecttag) {
- // handle cancle action for repo using iframe
- this.create_object_container(this.objecttag);
+ this.viewbar.set('disabled', false);
+ if (this.viewmode == 1) {
+ this.view_as_icons();
+ } else if (this.viewmode == 2) {
+ this.view_as_list();
} else {
- this.viewbar.set('disabled', false);
- if (this.viewmode == 1) {
- this.view_as_icons();
- } else if (this.viewmode == 2) {
- this.view_as_list(p);
- } else {
- this.view_as_icons();
- }
+ this.view_as_icons();
}
}
},
@@ -414,7 +395,6 @@ M.core_filepicker.init = function(Y, options) {
path:node.path?node.path:'',
page:node.page?args.page:'',
callback: function(id, obj, args) {
- obj.issearchresult = false;
var list = obj.list;
scope.viewbar.set('disabled', false);
scope.parse_repository_options(obj);
@@ -425,70 +405,46 @@ M.core_filepicker.init = function(Y, options) {
}
}, false);
},
- view_as_list: function(p) {
+ view_as_list: function() {
var scope = this;
- var page = null;
- if (!p) {
- if (scope.active_repo.page) {
- page = scope.active_repo.page;
- }
- } else {
- page = p;
+ var client_id = scope.options.client_id;
+ var dynload = scope.active_repo.dynload;
+ var list = this.filelist;
+ var panel_id = '#panel-'+client_id;
+ scope.viewmode = 2;
+ Y.one(panel_id).set('innerHTML', '');
+ scope.print_header();
+
+ var html = '
';
+ if (list && list.length==0) {
+ html += '
' +M.str.repository.nofilesavailable+'
';
}
- scope.request({
- action:'list',
- client_id: scope.options.client_id,
- repository_id: scope.active_repo.id,
- path:'',
- page:page,
- callback: function(id, obj, args) {
- scope.parse_repository_options(obj);
- if (obj.login) {
- scope.viewbar.set('disabled', true);
- scope.print_login(obj);
- return;
- }
- var client_id = scope.options.client_id;
- var dynload = scope.active_repo.dynload;
- var list = obj.list;
- var panel_id = '#panel-'+client_id;
- scope.viewmode = 2;
- Y.one(panel_id).set('innerHTML', '');
+ html += '
';
- scope.print_header();
+ var tree = Y.Node.create(html);
+ Y.one(panel_id).appendChild(tree);
+ if (!list || list.length==0) {
+ return;
+ }
- var html = '
';
@@ -622,28 +581,16 @@ M.core_filepicker.init = function(Y, options) {
var le_checked = '';
var le_style = '';
- var returntypes = this.options.repositories[this.active_repo.id].return_types;
-
- if (returntypes == 1) {
- // support link only
- html += '';
- } else if (returntypes == 4) {
- html += '';
- } else {
- if (((returntypes & 1) == 1) && ((this.options.return_types & 1) == 1)) {
- // support external links
- html += '
'+M.str.repository.linkexternal+'
';
- }
- // form element support file reference and repository support it too
- if (((returntypes & 4) == 4) && ((this.options.return_types & 4) == 4)) {
- // file reference
- html += '
'+M.str.repository.uselatestfile+'
';
- }
-
- if (((returntypes & 4) != 4) && ((returntypes & 1) != 1)) {
- html += '';
- html += '';
- }
+ if (this.options.repositories[this.active_repo.id].return_types == 1) {
+ // support external links only
+ le_checked = 'checked';
+ le_style = ' style="display:none;"';
+ } else if(this.options.repositories[this.active_repo.id].return_types == 2) {
+ // support internal files only
+ le_style = ' style="display:none;"';
+ }
+ if ((this.options.externallink && this.options.env == 'editor' && this.options.return_types != 1)) {
+ html += '