From 07b72ca53459bcd150a21e2133a7d5936d92cbec Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Thu, 16 Jun 2011 23:15:58 +0200 Subject: [PATCH] make the system for default fileactions more flexible --- files/js/fileactions.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/files/js/fileactions.js b/files/js/fileactions.js index dec1d1cfb0..1bdbc4ac0b 100644 --- a/files/js/fileactions.js +++ b/files/js/fileactions.js @@ -8,7 +8,7 @@ FileActions={ FileActions.actions[mime][name]=action; }, setDefault:function(mime,name){ - FileActions.defaults[mime]=FileActions.actions[mime][name]; + FileActions.defaults[mime]=name; }, get:function(mime,type){ var actions={}; @@ -35,15 +35,18 @@ FileActions={ if(mime){ var mimePart=mime.substr(0,mime.indexOf('/')); } + var name=false; if(mime && FileActions.defaults[mime]){ - return FileActions.defaults[mime]; + name=FileActions.defaults[mime]; }else if(mime && FileActions.defaults[mimePart]){ - return FileActions.defaults[mimePart]; + name=FileActions.defaults[mimePart]; }else if(type && FileActions.defaults[type]){ - return FileActions.defaults[type]; + name=FileActions.defaults[type]; }else{ - return FileActions.defaults.all; + name=FileActions.defaults.all; } + var actions=this.get(mime,type); + return actions[name]; }, display:function(parent){ $('#file_menu ul').empty();