make the system for default fileactions more flexible
This commit is contained in:
parent
300b8c06cf
commit
07b72ca534
|
@ -8,7 +8,7 @@ FileActions={
|
||||||
FileActions.actions[mime][name]=action;
|
FileActions.actions[mime][name]=action;
|
||||||
},
|
},
|
||||||
setDefault:function(mime,name){
|
setDefault:function(mime,name){
|
||||||
FileActions.defaults[mime]=FileActions.actions[mime][name];
|
FileActions.defaults[mime]=name;
|
||||||
},
|
},
|
||||||
get:function(mime,type){
|
get:function(mime,type){
|
||||||
var actions={};
|
var actions={};
|
||||||
|
@ -35,15 +35,18 @@ FileActions={
|
||||||
if(mime){
|
if(mime){
|
||||||
var mimePart=mime.substr(0,mime.indexOf('/'));
|
var mimePart=mime.substr(0,mime.indexOf('/'));
|
||||||
}
|
}
|
||||||
|
var name=false;
|
||||||
if(mime && FileActions.defaults[mime]){
|
if(mime && FileActions.defaults[mime]){
|
||||||
return FileActions.defaults[mime];
|
name=FileActions.defaults[mime];
|
||||||
}else if(mime && FileActions.defaults[mimePart]){
|
}else if(mime && FileActions.defaults[mimePart]){
|
||||||
return FileActions.defaults[mimePart];
|
name=FileActions.defaults[mimePart];
|
||||||
}else if(type && FileActions.defaults[type]){
|
}else if(type && FileActions.defaults[type]){
|
||||||
return FileActions.defaults[type];
|
name=FileActions.defaults[type];
|
||||||
}else{
|
}else{
|
||||||
return FileActions.defaults.all;
|
name=FileActions.defaults.all;
|
||||||
}
|
}
|
||||||
|
var actions=this.get(mime,type);
|
||||||
|
return actions[name];
|
||||||
},
|
},
|
||||||
display:function(parent){
|
display:function(parent){
|
||||||
$('#file_menu ul').empty();
|
$('#file_menu ul').empty();
|
||||||
|
|
Loading…
Reference in New Issue