Commit fc3ec2ca authored by dongsheng's avatar dongsheng
Browse files

"MDL-18486, 1. hide toolbar, pagination when doing global searching, 2....

"MDL-18486, 1. hide toolbar, pagination when doing global searching, 2. display empty directory in local pluign"
parent 005789bb
...@@ -835,40 +835,40 @@ abstract class repository { ...@@ -835,40 +835,40 @@ abstract class repository {
*/ */
public static function get_user_file_tree($search = ""){ public static function get_user_file_tree($search = ""){
global $CFG; global $CFG;
$ret = array(); $ret = array();
$ret['nologin'] = true; $ret['nologin'] = true;
$ret['manage'] = $CFG->wwwroot .'/files/index.php'; // temporary $ret['manage'] = $CFG->wwwroot .'/files/index.php'; // temporary
$browser = get_file_browser(); $browser = get_file_browser();
$itemid = null; $itemid = null;
$filename = null; $filename = null;
$filearea = null; $filearea = null;
$path = '/'; $path = '/';
$ret['dynload'] = false; $ret['dynload'] = false;
if ($fileinfo = $browser->get_file_info(get_system_context(), $filearea, $itemid, $path, $filename)) { if ($fileinfo = $browser->get_file_info(get_system_context(), $filearea, $itemid, $path, $filename)) {
$ret['path'] = array(); $ret['path'] = array();
$params = $fileinfo->get_params(); $params = $fileinfo->get_params();
$filearea = $params['filearea']; $filearea = $params['filearea'];
$ret['path'][] = repository::encode_path($filearea, $path, $fileinfo->get_visible_name()); $ret['path'][] = repository::encode_path($filearea, $path, $fileinfo->get_visible_name());
if ($fileinfo->is_directory()) { if ($fileinfo->is_directory()) {
$level = $fileinfo->get_parent(); $level = $fileinfo->get_parent();
while ($level) { while ($level) {
$params = $level->get_params(); $params = $level->get_params();
$ret['path'][] = repository::encode_path($params['filearea'], $params['filepath'], $level->get_visible_name()); $ret['path'][] = repository::encode_path($params['filearea'], $params['filepath'], $level->get_visible_name());
$level = $level->get_parent(); $level = $level->get_parent();
}
} }
$filecount = repository::build_tree($fileinfo, $search, $ret['dynload'], $ret['list']);
$ret['path'] = array_reverse($ret['path']);
} }
$filecount = repository::build_tree($fileinfo, $search, $ret['dynload'], $ret['list']);
$ret['path'] = array_reverse($ret['path']);
}
if (empty($ret['list'])) { if (empty($ret['list'])) {
//exit(mnet_server_fault(9016, get_string('emptyfilelist', 'repository_local'))); //exit(mnet_server_fault(9016, get_string('emptyfilelist', 'repository_local')));
throw new Exception('emptyfilelist'); throw new Exception('emptyfilelist');
} else { } else {
return $ret; return $ret;
} }
} }
...@@ -923,7 +923,7 @@ abstract class repository { ...@@ -923,7 +923,7 @@ abstract class repository {
'size' => 0, 'size' => 0,
'date' => $filedate, 'date' => $filedate,
'path' => array_reverse($path), 'path' => array_reverse($path),
'thumbnail' => $CFG->pixpath .'/f/folder.gif' 'thumbnail' => $CFG->pixpath .'/f/folder-32.png'
); );
//if ($dynamicmode && $child->is_writable()) { //if ($dynamicmode && $child->is_writable()) {
...@@ -943,8 +943,7 @@ abstract class repository { ...@@ -943,8 +943,7 @@ abstract class repository {
//} //}
//Uncomment this following line if you wanna display all directory ()even empty //Uncomment this following line if you wanna display all directory ()even empty
//if (!$search || $_filecount || (stristr($tmp['title'], $search) !== false)) { if (!$search || $_filecount || (stristr($tmp['title'], $search) !== false)) {
if ($_filecount) {
$filecount += $_filecount; $filecount += $_filecount;
$list[] = $tmp; $list[] = $tmp;
} }
...@@ -1802,7 +1801,7 @@ function repository_get_client($context, $id = '', $accepted_filetypes = '*', $ ...@@ -1802,7 +1801,7 @@ function repository_get_client($context, $id = '', $accepted_filetypes = '*', $
.fp-login-form{text-align:center} .fp-login-form{text-align:center}
.fp-searchbar{float:right} .fp-searchbar{float:right}
.fp-viewbar{width:300px;float:left} .fp-viewbar{width:300px;float:left}
.fp-toolbar{padding: .8em;background: #FFFFCC;color:white;text-align:center} .fp-toolbar{padding: .8em;background: #FFFFCC;color:white;text-align:center;margin: 3px}
.fp-toolbar a{padding: 0 .5em} .fp-toolbar a{padding: 0 .5em}
.fp-list{list-style-type:none;padding:0;float:left;width:100%;margin:0;} .fp-list{list-style-type:none;padding:0;float:left;width:100%;margin:0;}
.fp-list li{border-bottom:1px dotted gray;margin-bottom: 1em;} .fp-list li{border-bottom:1px dotted gray;margin-bottom: 1em;}
...@@ -1847,7 +1846,7 @@ EOD; ...@@ -1847,7 +1846,7 @@ EOD;
'yui_json', 'yui_json',
'yui_button', 'yui_button',
'yui_selector', 'yui_selector',
'repository/repository.js' 'repository/repository.src.js'
)); ));
$lang = array(); $lang = array();
$lang['title'] = get_string('title', 'repository'); $lang['title'] = get_string('title', 'repository');
......
This diff is collapsed.
...@@ -147,6 +147,10 @@ var repository_client = (function(){ ...@@ -147,6 +147,10 @@ var repository_client = (function(){
var r = repository_client.fp[data.client_id]; var r = repository_client.fp[data.client_id];
r.view_staus = 0; r.view_staus = 0;
r.fs = data.list; r.fs = data.list;
if (data.gsearch) {
// will be used to hide header and footer
r.gsearch = true;
}
if(r.view_staus) { if(r.view_staus) {
repository_client.view_as_list(data.client_id, data.list); repository_client.view_as_list(data.client_id, data.list);
} else { } else {
...@@ -808,6 +812,11 @@ repository_client.print_footer = function(client_id) { ...@@ -808,6 +812,11 @@ repository_client.print_footer = function(client_id) {
panel.appendChild(footer); panel.appendChild(footer);
// add repository manage buttons here // add repository manage buttons here
var oDiv = document.getElementById('repo-tb-'+client_id); var oDiv = document.getElementById('repo-tb-'+client_id);
if(this.fp[client_id].gsearch) {
// reset
this.fp[client_id].gsearch='';
return;
}
if(!fs.nosearch) { if(!fs.nosearch) {
var search = document.createElement('A'); var search = document.createElement('A');
search.href = '###'; search.href = '###';
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
} }
} }
$listing = array('list'=>$list); $listing = array('list'=>$list);
$listing['gsearch'] = true;
$listing['client_id'] = $client_id; $listing['client_id'] = $client_id;
die(json_encode($listing)); die(json_encode($listing));
break; break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment