diff --git a/code/forms/DocumentationAdvancedSearchForm.php b/code/forms/DocumentationAdvancedSearchForm.php index c814aad..165c826 100644 --- a/code/forms/DocumentationAdvancedSearchForm.php +++ b/code/forms/DocumentationAdvancedSearchForm.php @@ -8,11 +8,11 @@ class DocumentationAdvancedSearchForm extends Form { public function __construct($controller) { $versions = $controller->getManifest()->getAllVersions(); $entities = $controller->getManifest()->getEntities(); - + $q = ($q = $controller->getSearchQuery()) ? $q->NoHTML() : ""; // klude to take an array of objects down to a simple map - $entities = $entities->map('Folder', 'Title'); + $entities = $entities->map('Key', 'Title'); // if we haven't gone any search limit then we're searching everything $searchedEntities = $controller->getSearchedEntities(); @@ -27,21 +27,21 @@ class DocumentationAdvancedSearchForm extends Form { $searchedVersions = $versions; } - $fields = new FieldList( - new TextField('q', _t('DocumentationViewer.KEYWORDS', 'Keywords'), $q), - new CheckboxSetField('Entities', _t('DocumentationViewer.MODULES', 'Modules'), $entities, $searchedEntities), - new CheckboxSetField( + $fields = FieldList::create( + TextField::create('q', _t('DocumentationViewer.KEYWORDS', 'Keywords'), $q), + //CheckboxSetField::create('Entities', _t('DocumentationViewer.MODULES', 'Modules'), $entities, $searchedEntities), + CheckboxSetField::create( 'Versions', _t('DocumentationViewer.VERSIONS', 'Versions'), $versions, $searchedVersions ) ); - $actions = new FieldList( - new FormAction('results', _t('DocumentationViewer.SEARCH', 'Search')) + $actions = FieldList::create( + FormAction::create('results', _t('DocumentationViewer.SEARCH', 'Search')) ); - $required = new RequiredFields(array('Search')); + $required = RequiredFields::create(array('Search')); parent::__construct( $controller, diff --git a/code/forms/DocumentationSearchForm.php b/code/forms/DocumentationSearchForm.php index 40b1bd3..eb6863c 100644 --- a/code/forms/DocumentationSearchForm.php +++ b/code/forms/DocumentationSearchForm.php @@ -3,9 +3,17 @@ class DocumentationSearchForm extends Form { public function __construct($controller) { + + //pass through the current version + $page = $controller->getPage(); + if($page){ + $versions = HiddenField::create('Versions','Versions',$page->getEntity()->getVersion()); + } + $fields = new FieldList( TextField::create('q', _t('DocumentationViewer.SEARCH', 'Search'), '') - ->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search')) + ->setAttribute('placeholder', _t('DocumentationViewer.SEARCH', 'Search')), + $versions ); $actions = new FieldList( diff --git a/templates/DocumentationViewer_all.ss b/templates/DocumentationViewer_all.ss new file mode 100644 index 0000000..6f03188 --- /dev/null +++ b/templates/DocumentationViewer_all.ss @@ -0,0 +1,47 @@ + + + + <% include DocumentationHead %> + +