From: dongsheng Date: Thu, 11 Jun 2009 02:54:33 +0000 (+0000) Subject: "MDL-17316, non-js file manager, support externel authentication" X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5e98ab966f24bb07b6ea7000229bf33e25d98cd5;p=moodle.git "MDL-17316, non-js file manager, support externel authentication" --- diff --git a/repository/filepicker.php b/repository/filepicker.php index 19d23454c1..f0b79fd6ff 100755 --- a/repository/filepicker.php +++ b/repository/filepicker.php @@ -122,13 +122,15 @@ case 'sign': echo ''; echo ''; } else { - foreach ($list['path'] as $p) { - echo '
'; - echo ''; - echo '
'; - echo ' / '; + if (!empty($list['path'])) { + foreach ($list['path'] as $p) { + echo '
'; + echo ''; + echo '
'; + echo ' / '; + } } echo ''; foreach ($list['list'] as $item) { diff --git a/repository/flickr/repository.class.php b/repository/flickr/repository.class.php index ff81b16740..24eecb957e 100755 --- a/repository/flickr/repository.class.php +++ b/repository/flickr/repository.class.php @@ -124,14 +124,16 @@ class repository_flickr extends repository { * @param $ajax * @return */ - public function print_login($ajax = true) { - if ($ajax) { + public function print_login() { + if ($this->options['ajax']) { $ret = array(); $popup_btn = new stdclass; $popup_btn->type = 'popup'; $popup_btn->url = $this->flickr->auth(); $ret['login'] = array($popup_btn); return $ret; + } else { + echo 'Login'; } } diff --git a/repository/ws.php b/repository/ws.php index fc41538b2e..cc5992b2e4 100644 --- a/repository/ws.php +++ b/repository/ws.php @@ -45,8 +45,11 @@ $contextid = $context->id; $fs = get_file_storage(); if ($file = $fs->get_file($contextid, 'user_draft', $itemid, '/', $title)) { - $file->delete(); - echo 200; + if($result = $file->delete()) { + echo 200; + } else { + echo ''; + } } else { echo ''; } @@ -118,14 +121,21 @@ // parent window, in this case, we need to alert user to refresh the repository // manually. $js =<< + + + + + EOD; echo $js; die; @@ -195,6 +205,7 @@ EOD; $itemid = (int)substr(hexdec(uniqid()), 0, 9)+rand(1,100); } if (preg_match('#(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)#', $filepath)) { + // youtube plugin return a url instead a file path $url = $filepath; echo json_encode(array( /* File picker need to know this is a link @@ -208,6 +219,7 @@ EOD; ) ); } else if (is_array($filepath)) { + // file api don't have real file path, so we need more file api specific info for "local" plugin $fileinfo = $filepath; $info = array(); $info['client_id'] = $client_id;