From 764a1dfad1934f612d10c9a39832a732dbea9e42 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Mon, 21 Jul 2008 03:26:47 +0000 Subject: [PATCH] MDL-13766, fix bugs in javascript, and use different icons in boxnet plugin according to the extension. --- repository/ajax.php | 6 +++--- repository/boxnet/repository.class.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/repository/ajax.php b/repository/ajax.php index da0b24f68f..2229d8ebb1 100644 --- a/repository/ajax.php +++ b/repository/ajax.php @@ -290,9 +290,9 @@ function viewlist(){ } var panel = new YAHOO.util.Element('panel'); str += makepage(); + var re = new RegExp(); + re.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); for(k in obj){ - var re = new RegExp(); - re.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); str += (' '); if(re.test(obj[k].source)) { str += ''+obj[k].title+''; @@ -359,7 +359,7 @@ function cr(id, path, reset){ } function dosearch(id){ var data = window.prompt("What are you searching for?"); - if(data == null && data == '') { + if(data == null || data == '') { alert('nothing entered'); return; } diff --git a/repository/boxnet/repository.class.php b/repository/boxnet/repository.class.php index 16617eb144..e3ff8869f9 100755 --- a/repository/boxnet/repository.class.php +++ b/repository/boxnet/repository.class.php @@ -70,7 +70,7 @@ class repository_boxnet extends repository{ 'date'=>$filedates[$n], 'source'=>'http://box.net/api/1.0/download/' .$this->options['auth_token'].'/'.$fileids[$n], - 'thumbnail'=>$CFG->pixpath.'/f/text.gif'); + 'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon', $v)); } } else { $list[] = array('title'=>$v, @@ -78,7 +78,7 @@ class repository_boxnet extends repository{ 'date'=>$filedates[$n], 'source'=>'http://box.net/api/1.0/download/' .$this->options['auth_token'].'/'.$fileids[$n], - 'thumbnail'=>$CFG->pixpath.'/f/text.gif'); + 'thumbnail'=>$CFG->pixpath.'/f/'.mimeinfo('icon', $v)); } } $this->listing = $list; -- 2.39.5