1
0
mirror of https://github.com/silverstripe/silverstripe-docsviewer synced 2024-10-22 09:05:56 +00:00

BUGFIX: changed $request to not return a null spaced array. Updated docs to reflect that

This commit is contained in:
Will Rossiter 2010-06-26 04:49:20 +00:00
parent a07855109f
commit 3a94574ef6

@ -108,25 +108,25 @@ class DocumentationViewer extends Controller {
// count the number of parameters after the language, version are taken // count the number of parameters after the language, version are taken
// into account. This automatically includes ' ' so all the counts // into account. This automatically includes ' ' so all the counts
// are 1 more than what you would expect // are 1 more than what you would expect
if($this->Remaining) { if($this->Remaining) {
$params = count(array_unique($this->Remaining));
switch($params) { $paramCount = count($this->Remaining);
case '1':
return parent::getViewer('home'); if($paramCount == 1) {
case '2': return parent::getViewer('folder');
return parent::getViewer('folder');
default:
if($module = $this->getModule()) {
$params = $this->Remaining;
array_shift($params);
$path = implode('/', array_unique($params));
}
if(is_dir($module->getPath() . $path)) return parent::getViewer('folder');
} }
else if($module = $this->getModule()) {
$params = $this->Remaining;
array_shift($params); // module name
$path = implode('/', array_unique($params));
if(is_dir($module->getPath() . $path)) return parent::getViewer('folder');
}
}
else {
return parent::getViewer('home');
} }
return parent::getViewer($action); return parent::getViewer($action);
@ -221,7 +221,7 @@ class DocumentationViewer extends Controller {
$modules = DocumentationService::get_registered_modules($version, $lang); $modules = DocumentationService::get_registered_modules($version, $lang);
$output = new DataObjectSet(); $output = new DataObjectSet();
if($modules) { if($modules) {
foreach($modules as $module) { foreach($modules as $module) {
// build the dataset. Load the $Content from an index.md // build the dataset. Load the $Content from an index.md
@ -232,7 +232,7 @@ class DocumentationViewer extends Controller {
))); )));
} }
} }
return $output; return $output;
} }