import org.apache.wicket.markup.html.basic.Label;\r
import org.apache.wicket.markup.html.form.ListMultipleChoice;\r
import org.apache.wicket.markup.html.form.TextField;\r
+import org.apache.wicket.markup.html.form.CheckBox;\r
import org.apache.wicket.markup.html.panel.Fragment;\r
import org.apache.wicket.markup.repeater.Item;\r
import org.apache.wicket.markup.repeater.data.DataView;\r
int page = 1;\r
int pageSize = app().settings().getInteger(Keys.web.itemsPerPage, 50);\r
\r
+ // display user-accessible selections\r
+ UserModel user = GitBlitWebSession.get().getUser();\r
+ List<String> availableRepositories = new ArrayList<String>();\r
+ for (RepositoryModel model : app().repositories().getRepositoryModels(user)) {\r
+ if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
+ availableRepositories.add(model.name);\r
+ }\r
+ }\r
+\r
if (params != null) {\r
String repository = WicketUtils.getRepositoryName(params);\r
if (!StringUtils.isEmpty(repository)) {\r
List<String> list = StringUtils.getStringsFromValue(value);\r
repositories.addAll(list);\r
}\r
+
+ if (params.containsKey("allrepos")) {\r
+ repositories.addAll(availableRepositories);\r
+ }\r
\r
if (params.containsKey("query")) {\r
query = params.getString("query", "");\r
}\r
}\r
\r
- // display user-accessible selections\r
- UserModel user = GitBlitWebSession.get().getUser();\r
- List<String> availableRepositories = new ArrayList<String>();\r
- for (RepositoryModel model : app().repositories().getRepositoryModels(user)) {\r
- if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
- availableRepositories.add(model.name);\r
- }\r
- }\r
boolean luceneEnabled = app().settings().getBoolean(Keys.web.allowLuceneIndexing, true);\r
if (luceneEnabled) {\r
if (availableRepositories.size() == 0) {\r
// search form\r
final Model<String> queryModel = new Model<String>(query);\r
final Model<ArrayList<String>> repositoriesModel = new Model<ArrayList<String>>(searchRepositories);\r
+ final Model<Boolean> allreposModel = new Model<Boolean>(params != null && params.containsKey("allrepos"));\r
SessionlessForm<Void> form = new SessionlessForm<Void>("searchForm", getClass()) {\r
\r
private static final long serialVersionUID = 1L;\r
error(getString("gb.undefinedQueryWarning"));\r
return;\r
}\r
- if (repositoriesModel.getObject().size() == 0) {\r
+ if (repositoriesModel.getObject().size() == 0 && !allreposModel.getObject()) {\r
error(getString("gb.noSelectedRepositoriesWarning"));\r
return;\r
}\r
PageParameters params = new PageParameters();\r
params.put("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
params.put("query", queryModel.getObject());\r
+ params.put("allrepos", allreposModel.getObject());\r
LuceneSearchPage page = new LuceneSearchPage(params);\r
setResponsePage(page);\r
}\r
selections.setMaxRows(8);\r
form.add(selections.setEnabled(luceneEnabled));\r
form.add(new TextField<String>("query", queryModel).setEnabled(luceneEnabled));\r
+ form.add(new CheckBox("allrepos", allreposModel));\r
add(form.setEnabled(luceneEnabled));\r
\r
// execute search\r