import com.gitblit.GitBlit;\r
import com.gitblit.Keys;\r
import com.gitblit.wicket.pages.ActivityPage;\r
-import com.gitblit.wicket.pages.BasePage;\r
import com.gitblit.wicket.pages.BlamePage;\r
import com.gitblit.wicket.pages.BlobDiffPage;\r
import com.gitblit.wicket.pages.BlobPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.DocsPage;\r
import com.gitblit.wicket.pages.FederationRegistrationPage;\r
+import com.gitblit.wicket.pages.GitSearchPage;\r
import com.gitblit.wicket.pages.GravatarProfilePage;\r
import com.gitblit.wicket.pages.HistoryPage;\r
import com.gitblit.wicket.pages.LogPage;\r
+import com.gitblit.wicket.pages.LuceneSearchPage;\r
import com.gitblit.wicket.pages.MarkdownPage;\r
import com.gitblit.wicket.pages.MetricsPage;\r
import com.gitblit.wicket.pages.PatchPage;\r
import com.gitblit.wicket.pages.RawPage;\r
import com.gitblit.wicket.pages.RepositoriesPage;\r
import com.gitblit.wicket.pages.ReviewProposalPage;\r
-import com.gitblit.wicket.pages.SearchPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TagPage;\r
import com.gitblit.wicket.pages.TagsPage;\r
mount("/commitdiff", CommitDiffPage.class, "r", "h");\r
mount("/patch", PatchPage.class, "r", "h", "f");\r
mount("/history", HistoryPage.class, "r", "h", "f");\r
- if (GitBlit.getBoolean(Keys.lucene.enable, false)) {\r
- // TODO switch this to LucenePage when it is ready\r
- mount("/search", SearchPage.class);\r
- } else {\r
- mount("/search", SearchPage.class);\r
- }\r
+ mount("/search", GitSearchPage.class);\r
mount("/metrics", MetricsPage.class, "r");\r
mount("/blame", BlamePage.class, "r", "h", "f");\r
\r
\r
mount("/activity", ActivityPage.class, "r", "h");\r
mount("/gravatar", GravatarProfilePage.class, "h");\r
+ mount("/lucene", LuceneSearchPage.class);\r
}\r
\r
private void mount(String location, Class<? extends WebPage> clazz, String... parameters) {\r
return RepositoriesPage.class;\r
}\r
\r
- /**\r
- * Returns the preferred search page class.\r
- * \r
- * @return a Wicket class representing a search page\r
- */\r
- public Class<? extends BasePage> getSearchPageClass() {\r
- if (GitBlit.getBoolean(Keys.lucene.enable, false)) {\r
- // TODO switch this to LucenePage when it is ready\r
- return SearchPage.class;//LucenePage.class;\r
- }\r
- return SearchPage.class;\r
- }\r
-\r
-\r
@Override\r
public final Session newSession(Request request, Response response) {\r
return new GitBlitWebSession(request);\r
gb.workingCopy = working copy\r
gb.workingCopyWarning = this repository has a working copy and can not receive pushes\r
gb.query = query\r
-gb.queryHelp = write brief explanation of Lucene syntax here\r
+gb.queryHelp = Standard query syntax is supported.<p/><p/>Please see <a target="_new" href="http://lucene.apache.org/core/old_versioned_docs/versions/3_5_0/queryparsersyntax.html">Lucene Query Parser Syntax</a> for details.\r
gb.authored = authored\r
gb.committed = committed\r
gb.indexedBranches = indexed branches\r
gb.indexedBranchesDescription = select the branches to include in your Lucene index\r
gb.noIndexedRepositoriesWarning = none of your repositories are configured for Lucene indexing\r
gb.undefinedQueryWarning = query is undefined!\r
-gb.gb.noSelectedRepositoriesWarning = please select one or more repositories!
\ No newline at end of file
+gb.noSelectedRepositoriesWarning = please select one or more repositories!
\ No newline at end of file
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<body>\r
+<wicket:extend>\r
+\r
+ <!-- pager links -->\r
+ <div style="padding-top:5px;">\r
+ <a wicket:id="firstPageTop"><wicket:message key="gb.pageFirst"></wicket:message></a> | <a wicket:id="prevPageTop"><wicket:message key="gb.pagePrevious"></wicket:message></a> | <a wicket:id="nextPageTop"><wicket:message key="gb.pageNext"></wicket:message></a> \r
+ </div>\r
+ \r
+ <!-- history -->\r
+ <div style="margin-top:5px;" wicket:id="searchPanel">[search panel]</div>\r
+\r
+ <!-- pager links -->\r
+ <div style="padding-bottom:5px;">\r
+ <a wicket:id="firstPageBottom"><wicket:message key="gb.pageFirst"></wicket:message></a> | <a wicket:id="prevPageBottom"><wicket:message key="gb.pagePrevious"></wicket:message></a> | <a wicket:id="nextPageBottom"><wicket:message key="gb.pageNext"></wicket:message></a> \r
+ </div>\r
+\r
+</wicket:extend>\r
+</body>\r
+</html>
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright 2011 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.wicket.pages;\r
+\r
+import org.apache.wicket.PageParameters;\r
+import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
+\r
+import com.gitblit.Constants;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.panels.SearchPanel;\r
+\r
+public class GitSearchPage extends RepositoryPage {\r
+\r
+ public GitSearchPage(PageParameters params) {\r
+ super(params);\r
+\r
+ String value = WicketUtils.getSearchString(params);\r
+ String type = WicketUtils.getSearchType(params);\r
+ Constants.SearchType searchType = Constants.SearchType.forName(type);\r
+\r
+ int pageNumber = WicketUtils.getPage(params);\r
+ int prevPage = Math.max(0, pageNumber - 1);\r
+ int nextPage = pageNumber + 1;\r
+\r
+ SearchPanel search = new SearchPanel("searchPanel", repositoryName, objectId, value,\r
+ searchType, getRepository(), -1, pageNumber - 1);\r
+ boolean hasMore = search.hasMore();\r
+ add(search);\r
+\r
+ add(new BookmarkablePageLink<Void>("firstPageTop", GitSearchPage.class,\r
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))\r
+ .setEnabled(pageNumber > 1));\r
+ add(new BookmarkablePageLink<Void>("prevPageTop", GitSearchPage.class,\r
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
+ prevPage)).setEnabled(pageNumber > 1));\r
+ add(new BookmarkablePageLink<Void>("nextPageTop", GitSearchPage.class,\r
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
+ nextPage)).setEnabled(hasMore));\r
+\r
+ add(new BookmarkablePageLink<Void>("firstPageBottom", GitSearchPage.class,\r
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))\r
+ .setEnabled(pageNumber > 1));\r
+ add(new BookmarkablePageLink<Void>("prevPageBottom", GitSearchPage.class,\r
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
+ prevPage)).setEnabled(pageNumber > 1));\r
+ add(new BookmarkablePageLink<Void>("nextPageBottom", GitSearchPage.class,\r
+ WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
+ nextPage)).setEnabled(hasMore));\r
+\r
+ }\r
+\r
+ @Override\r
+ protected String getPageName() {\r
+ return getString("gb.search");\r
+ }\r
+}\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<!-- contribute google-code-prettify resources to the page header -->\r
-<wicket:head>\r
- <wicket:link>\r
- <link href="prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="prettify/prettify.js"></script>\r
- </wicket:link>\r
-</wicket:head>\r
- \r
-<wicket:extend>\r
-<body onload="document.getElementById('query').focus(); prettyPrint();">\r
- <div class="pageTitle">\r
- <h2><wicket:message key="gb.search"></wicket:message></h2>\r
- </div>\r
- <form class="form-inline" style="margin:0px;" wicket:id="searchForm">\r
- <div class="row-fluid">\r
- <div class="span3">\r
- <h3><wicket:message key="gb.repositories"></wicket:message></h3>\r
- <select wicket:id="repositories" ></select>\r
- </div>\r
- <div class="span9">\r
- <div>\r
- <h3><wicket:message key="gb.query"></wicket:message></h3>\r
- <input class="span8" id="query" wicket:id="query" placeholder="enter search text"></input>\r
- <button class="btn btn-primary" type="submit" value="Search"><wicket:message key="gb.search"></wicket:message></button>\r
- </div>\r
- <div style="margin-top:10px;">\r
- <div style="margin-left:0px;" class="span4">\r
- <div class="alert alert">\r
- <b>type:</b> commit or blob<br/>\r
- <b>commit:</b> commit id<br/>\r
- <b>path:</b> blob path<br/>\r
- <b>branch:</b> refs/heads/master<br/>\r
- <b>author:</b><br/>\r
- <b>committer:</b><br/>\r
- <b>tag:</b> tag<br/>\r
- </div>\r
- </div>\r
- <div class="span5">\r
- <wicket:message key="gb.queryHelp"></wicket:message>\r
- </div>\r
- </div>\r
- </div>\r
- </div>\r
- </form>\r
-\r
- <div class="row-fluid"> \r
- <!-- results header -->\r
- <div class="span8">\r
- <h3><span wicket:id="resultsHeader"></span> <small><span wicket:id="resultsCount"></span></small></h3>\r
- </div>\r
- <!-- pager links -->\r
- <div class="span4" wicket:id="topPager"></div>\r
- </div>\r
- \r
- <div class="row-fluid"> \r
- <!-- search result repeater -->\r
- <div class="searchResult" wicket:id="searchResults">\r
- <div><i wicket:id="type"></i><span class="summary" wicket:id="summary"></span></div>\r
- <div class="body">\r
- <div class="fragment" wicket:id="fragment"></div>\r
- <div><span class="author" wicket:id="author"></span> <span class="date" ><wicket:message key="gb.authored"></wicket:message> <span class="date" wicket:id="date"></span></span></div>\r
- <span class="repository" wicket:id="repository"></span>:<span class="branch" wicket:id="branch"></span> \r
- </div>\r
- </div>\r
-\r
- <!-- pager links -->\r
- <div wicket:id="bottomPager"></div>\r
-\r
- </div> \r
-</body>\r
-</wicket:extend>\r
-</html>
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright 2012 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.wicket.pages;\r
-\r
-import java.text.MessageFormat;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
-import org.apache.wicket.PageParameters;\r
-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.StatelessForm;\r
-import org.apache.wicket.markup.html.form.TextField;\r
-import org.apache.wicket.markup.repeater.Item;\r
-import org.apache.wicket.markup.repeater.data.DataView;\r
-import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
-import org.apache.wicket.model.Model;\r
-import org.eclipse.jgit.lib.Constants;\r
-\r
-import com.gitblit.Constants.SearchType;\r
-import com.gitblit.GitBlit;\r
-import com.gitblit.Keys;\r
-import com.gitblit.models.RepositoryModel;\r
-import com.gitblit.models.SearchResult;\r
-import com.gitblit.models.UserModel;\r
-import com.gitblit.utils.ArrayUtils;\r
-import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
-import com.gitblit.wicket.StringChoiceRenderer;\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.panels.LinkPanel;\r
-import com.gitblit.wicket.panels.PagerPanel;\r
-\r
-public class LucenePage extends RootPage {\r
-\r
- public LucenePage() {\r
- super();\r
- setup(null);\r
- }\r
-\r
- public LucenePage(PageParameters params) {\r
- super(params);\r
- setup(params);\r
- }\r
-\r
- private void setup(PageParameters params) {\r
- setupPage("", "");\r
- \r
- // default values\r
- ArrayList<String> repositories = new ArrayList<String>(); \r
- String query = "";\r
- int page = 1;\r
- int pageSize = GitBlit.getInteger(Keys.web.itemsPerPage, 50);\r
-\r
- if (params != null) {\r
- String repository = WicketUtils.getRepositoryName(params);\r
- if (!StringUtils.isEmpty(repository)) {\r
- repositories.add(repository);\r
- }\r
-\r
- page = WicketUtils.getPage(params); \r
- \r
- if (params.containsKey("repositories")) {\r
- String value = params.getString("repositories", "");\r
- List<String> list = StringUtils.getStringsFromValue(value); \r
- repositories.addAll(list);\r
- }\r
-\r
- if (params.containsKey("query")) {\r
- query = params.getString("query", ""); \r
- } else {\r
- String value = WicketUtils.getSearchString(params);\r
- String type = WicketUtils.getSearchType(params);\r
- com.gitblit.Constants.SearchType searchType = com.gitblit.Constants.SearchType.forName(type);\r
- if (!StringUtils.isEmpty(value)) {\r
- if (searchType == SearchType.COMMIT) {\r
- query = "type:" + searchType.name().toLowerCase() + " AND \"" + value + "\""; \r
- } else {\r
- query = searchType.name().toLowerCase() + ":\"" + value + "\"";\r
- }\r
- }\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 : GitBlit.self().getRepositoryModels(user)) {\r
- if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
- availableRepositories.add(model.name);\r
- }\r
- }\r
- \r
- if (availableRepositories.size() == 0) {\r
- info(getString("gb.noIndexedRepositoriesWarning"));\r
- }\r
-\r
- // enforce user-accessible repository selections\r
- ArrayList<String> searchRepositories = new ArrayList<String>();\r
- for (String selectedRepository : repositories) {\r
- if (availableRepositories.contains(selectedRepository)) {\r
- searchRepositories.add(selectedRepository);\r
- }\r
- }\r
- \r
- // search form\r
- final Model<String> queryModel = new Model<String>(query);\r
- final Model<ArrayList<String>> repositoriesModel = new Model<ArrayList<String>>(searchRepositories);\r
- StatelessForm<Void> form = new StatelessForm<Void>("searchForm") {\r
- \r
- private static final long serialVersionUID = 1L;\r
-\r
- @Override\r
- public void onSubmit() {\r
- String q = queryModel.getObject();\r
- if (StringUtils.isEmpty(q)) {\r
- error(getString("gb.undefinedQueryWarning"));\r
- return;\r
- } \r
- if (repositoriesModel.getObject().size() == 0) {\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
- setResponsePage(LucenePage.class, params);\r
- }\r
- };\r
- \r
- ListMultipleChoice<String> selections = new ListMultipleChoice<String>("repositories", \r
- repositoriesModel, availableRepositories, new StringChoiceRenderer());\r
- selections.setMaxRows(10);\r
- form.add(selections);\r
- form.add(new TextField<String>("query", queryModel));\r
- add(form);\r
- \r
- // execute search\r
- final List<SearchResult> results = new ArrayList<SearchResult>();\r
- if (!ArrayUtils.isEmpty(searchRepositories) && !StringUtils.isEmpty(query)) {\r
- results.addAll(GitBlit.self().search(query, page, pageSize, searchRepositories));\r
- }\r
- \r
- // results header\r
- if (results.size() == 0) {\r
- add(new Label("resultsHeader").setVisible(false));\r
- add(new Label("resultsCount").setVisible(false));\r
- } else {\r
- add(new Label("resultsHeader", query).setRenderBodyOnly(true));\r
- add(new Label("resultsCount", MessageFormat.format("results {0} - {1} ({2} hits)",\r
- results.get(0).hitId, results.get(results.size() - 1).hitId, results.get(0).totalHits)).\r
- setRenderBodyOnly(true));\r
- }\r
- \r
- // search results view\r
- ListDataProvider<SearchResult> resultsDp = new ListDataProvider<SearchResult>(results);\r
- final DataView<SearchResult> resultsView = new DataView<SearchResult>("searchResults", resultsDp) {\r
- private static final long serialVersionUID = 1L;\r
- public void populateItem(final Item<SearchResult> item) {\r
- SearchResult sr = item.getModelObject();\r
- switch(sr.type) {\r
- case commit: {\r
- Label icon = WicketUtils.newIcon("type", "icon-refresh");\r
- WicketUtils.setHtmlTooltip(icon, "commit");\r
- item.add(icon);\r
- item.add(new LinkPanel("summary", null, sr.summary, CommitPage.class, WicketUtils.newObjectParameter(sr.repository, sr.commitId)));\r
- break;\r
- }\r
- case blob: {\r
- Label icon = WicketUtils.newIcon("type", "icon-file");\r
- WicketUtils.setHtmlTooltip(icon, "blob");\r
- item.add(icon);\r
- item.add(new LinkPanel("summary", null, sr.path, BlobPage.class, WicketUtils.newPathParameter(sr.repository, sr.branch, sr.path)));\r
- break;\r
- }\r
- case issue: {\r
- Label icon = WicketUtils.newIcon("type", "icon-file");\r
- WicketUtils.setHtmlTooltip(icon, "issue");\r
- item.add(icon);\r
- item.add(new Label("summary", "issue: " + sr.issueId));\r
- break;\r
- }\r
- }\r
- item.add(new Label("fragment", sr.fragment).setEscapeModelStrings(false).setVisible(!StringUtils.isEmpty(sr.fragment)));\r
- item.add(new LinkPanel("repository", null, sr.repository, SummaryPage.class, WicketUtils.newRepositoryParameter(sr.repository)));\r
- if (StringUtils.isEmpty(sr.branch)) {\r
- item.add(new Label("branch", "null"));\r
- } else {\r
- item.add(new LinkPanel("branch", "branch", StringUtils.getRelativePath(Constants.R_HEADS, sr.branch), LogPage.class, WicketUtils.newObjectParameter(sr.repository, sr.branch)));\r
- }\r
- item.add(new Label("author", sr.author));\r
- item.add(WicketUtils.createDatestampLabel("date", sr.date, getTimeZone()));\r
- }\r
- };\r
- add(resultsView.setVisible(results.size() > 0));\r
- \r
- PageParameters pagerParams = new PageParameters();\r
- pagerParams.put("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
- pagerParams.put("query", queryModel.getObject());\r
- \r
- int totalPages = 0;\r
- if (results.size() > 0) {\r
- totalPages = (results.get(0).totalHits / pageSize) + (results.get(0).totalHits % pageSize > 0 ? 1 : 0);\r
- }\r
- \r
- add(new PagerPanel("topPager", page, totalPages, LucenePage.class, pagerParams));\r
- add(new PagerPanel("bottomPager", page, totalPages, LucenePage.class, pagerParams));\r
- }\r
- \r
-// private String buildPager(int currentPage, int count, int total) {\r
-// int pages = (total / count) + (total % count == 0 ? 0 : 1);\r
-// \r
-// // pages are 1-indexed\r
-// // previous page link\r
-// if (currentPage <= 1) {\r
-// sb.append(MessageFormat.format(li, "disabled", "#", "←"));\r
-// } else {\r
-// List<String> parameters = new ArrayList<String>();\r
-// if (!StringUtils.isEmpty(penString)) {\r
-// parameters.add(penString);\r
-// }\r
-// parameters.add(MessageFormat.format(pg, currentPage - 1));\r
-// sb.append(MessageFormat.format(li, "", StringUtils.flattenStrings(parameters, "&"), "←"));\r
-// }\r
-//\r
-// // page links in middle\r
-// int minpage = Math.max(1, currentPage - Math.min(2, 2));\r
-// int maxpage = Math.min(pages, minpage + 4);\r
-// for (int i = minpage; i <= maxpage; i++) {\r
-// String cssClass = "";\r
-// if (i == currentPage) {\r
-// cssClass = "active";\r
-// }\r
-// List<String> parameters = new ArrayList<String>();\r
-// if (!StringUtils.isEmpty(penString)) {\r
-// parameters.add(penString);\r
-// }\r
-// parameters.add(MessageFormat.format(pg, i));\r
-// sb.append(MessageFormat.format(li, cssClass, StringUtils.flattenStrings(parameters, "&"), i));\r
-// }\r
-//\r
-// // next page link\r
-// if (currentPage == pages) {\r
-// sb.append(MessageFormat.format(li, "disabled", "#", "→"));\r
-// } else {\r
-// List<String> parameters = new ArrayList<String>();\r
-// if (!StringUtils.isEmpty(penString)) {\r
-// parameters.add(penString);\r
-// }\r
-// parameters.add(MessageFormat.format(pg, currentPage + 1));\r
-// sb.append(MessageFormat.format(li, "", StringUtils.flattenStrings(parameters, "&"), "→"));\r
-// }\r
-// return sb.toString();\r
-// }\r
-\r
-}\r
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
+<html xmlns="http://www.w3.org/1999/xhtml" \r
+ xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
+ xml:lang="en" \r
+ lang="en"> \r
+\r
+<!-- contribute google-code-prettify resources to the page header -->\r
+<wicket:head>\r
+ <wicket:link>\r
+ <link href="prettify/prettify.css" type="text/css" rel="stylesheet" />\r
+ <script type="text/javascript" src="prettify/prettify.js"></script>\r
+ </wicket:link>\r
+</wicket:head>\r
+ \r
+<wicket:extend>\r
+<body onload="document.getElementById('query').focus(); prettyPrint();">\r
+ <div class="pageTitle">\r
+ <h2><wicket:message key="gb.search"></wicket:message></h2>\r
+ </div>\r
+ <form class="form-inline" style="margin:0px;" wicket:id="searchForm">\r
+ <div class="row-fluid">\r
+ <div class="span3">\r
+ <h3><wicket:message key="gb.repositories"></wicket:message></h3>\r
+ <select wicket:id="repositories" ></select>\r
+ </div>\r
+ <div class="span9">\r
+ <div>\r
+ <h3><wicket:message key="gb.query"></wicket:message></h3>\r
+ <input class="span8" id="query" wicket:id="query" placeholder="enter search text"></input>\r
+ <button class="btn btn-primary" type="submit" value="Search"><wicket:message key="gb.search"></wicket:message></button>\r
+ </div>\r
+ <div style="margin-top:10px;">\r
+ <div style="margin-left:0px;" class="span3">\r
+ <div class="alert alert">\r
+ <b>type:</b> commit or blob<br/>\r
+ <b>commit:</b> commit id<br/>\r
+ <b>path:</b> path/to/blob<br/>\r
+ <b>branch:</b> refs/heads/master<br/>\r
+ <b>author:</b> or <b>committer:</b> \r
+ </div>\r
+ </div>\r
+ <div class="span4"> \r
+ <div class="alert alert-info">\r
+ type:commit AND "bug fix"<br/>\r
+ type:commit AND author:james*<br/>\r
+ type:blob AND "int errorCode"<br/>\r
+ type:blob AND test AND path:*.java<br/>\r
+ commit:d91e5*\r
+ </div>\r
+ </div>\r
+ <div class="span2">\r
+ <wicket:message key="gb.queryHelp"></wicket:message>\r
+ </div>\r
+ </div>\r
+ </div>\r
+ </div>\r
+ </form>\r
+\r
+ <div class="row-fluid"> \r
+ <!-- results header -->\r
+ <div class="span8">\r
+ <h3><span wicket:id="resultsHeader"></span> <small><span wicket:id="resultsCount"></span></small></h3>\r
+ </div>\r
+ <!-- pager links -->\r
+ <div class="span4" wicket:id="topPager"></div>\r
+ </div>\r
+ \r
+ <div class="row-fluid"> \r
+ <!-- search result repeater -->\r
+ <div class="searchResult" wicket:id="searchResults">\r
+ <div><i wicket:id="type"></i><span class="summary" wicket:id="summary"></span></div>\r
+ <div class="body">\r
+ <div class="fragment" wicket:id="fragment"></div>\r
+ <div><span class="author" wicket:id="author"></span> <span class="date" ><wicket:message key="gb.authored"></wicket:message> <span class="date" wicket:id="date"></span></span></div>\r
+ <span class="repository" wicket:id="repository"></span>:<span class="branch" wicket:id="branch"></span> \r
+ </div>\r
+ </div>\r
+\r
+ <!-- pager links -->\r
+ <div wicket:id="bottomPager"></div>\r
+\r
+ </div> \r
+</body>\r
+</wicket:extend>\r
+</html>
\ No newline at end of file
--- /dev/null
+/*\r
+ * Copyright 2012 gitblit.com.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+package com.gitblit.wicket.pages;\r
+\r
+import java.text.MessageFormat;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.apache.wicket.PageParameters;\r
+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.StatelessForm;\r
+import org.apache.wicket.markup.html.form.TextField;\r
+import org.apache.wicket.markup.repeater.Item;\r
+import org.apache.wicket.markup.repeater.data.DataView;\r
+import org.apache.wicket.markup.repeater.data.ListDataProvider;\r
+import org.apache.wicket.model.Model;\r
+import org.eclipse.jgit.lib.Constants;\r
+\r
+import com.gitblit.Constants.SearchType;\r
+import com.gitblit.GitBlit;\r
+import com.gitblit.Keys;\r
+import com.gitblit.models.RepositoryModel;\r
+import com.gitblit.models.SearchResult;\r
+import com.gitblit.models.UserModel;\r
+import com.gitblit.utils.ArrayUtils;\r
+import com.gitblit.utils.StringUtils;\r
+import com.gitblit.wicket.GitBlitWebSession;\r
+import com.gitblit.wicket.StringChoiceRenderer;\r
+import com.gitblit.wicket.WicketUtils;\r
+import com.gitblit.wicket.panels.LinkPanel;\r
+import com.gitblit.wicket.panels.PagerPanel;\r
+\r
+public class LuceneSearchPage extends RootPage {\r
+\r
+ public LuceneSearchPage() {\r
+ super();\r
+ setup(null);\r
+ }\r
+\r
+ public LuceneSearchPage(PageParameters params) {\r
+ super(params);\r
+ setup(params);\r
+ }\r
+\r
+ private void setup(PageParameters params) {\r
+ setupPage("", "");\r
+ \r
+ // default values\r
+ ArrayList<String> repositories = new ArrayList<String>(); \r
+ String query = "";\r
+ int page = 1;\r
+ int pageSize = GitBlit.getInteger(Keys.web.itemsPerPage, 50);\r
+\r
+ if (params != null) {\r
+ String repository = WicketUtils.getRepositoryName(params);\r
+ if (!StringUtils.isEmpty(repository)) {\r
+ repositories.add(repository);\r
+ }\r
+\r
+ page = WicketUtils.getPage(params); \r
+ \r
+ if (params.containsKey("repositories")) {\r
+ String value = params.getString("repositories", "");\r
+ List<String> list = StringUtils.getStringsFromValue(value); \r
+ repositories.addAll(list);\r
+ }\r
+\r
+ if (params.containsKey("query")) {\r
+ query = params.getString("query", ""); \r
+ } else {\r
+ String value = WicketUtils.getSearchString(params);\r
+ String type = WicketUtils.getSearchType(params);\r
+ com.gitblit.Constants.SearchType searchType = com.gitblit.Constants.SearchType.forName(type);\r
+ if (!StringUtils.isEmpty(value)) {\r
+ if (searchType == SearchType.COMMIT) {\r
+ query = "type:" + searchType.name().toLowerCase() + " AND \"" + value + "\""; \r
+ } else {\r
+ query = searchType.name().toLowerCase() + ":\"" + value + "\"";\r
+ }\r
+ }\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 : GitBlit.self().getRepositoryModels(user)) {\r
+ if (model.hasCommits && !ArrayUtils.isEmpty(model.indexedBranches)) {\r
+ availableRepositories.add(model.name);\r
+ }\r
+ }\r
+ \r
+ if (availableRepositories.size() == 0) {\r
+ info(getString("gb.noIndexedRepositoriesWarning"));\r
+ }\r
+\r
+ // enforce user-accessible repository selections\r
+ ArrayList<String> searchRepositories = new ArrayList<String>();\r
+ for (String selectedRepository : repositories) {\r
+ if (availableRepositories.contains(selectedRepository)) {\r
+ searchRepositories.add(selectedRepository);\r
+ }\r
+ }\r
+ \r
+ // search form\r
+ final Model<String> queryModel = new Model<String>(query);\r
+ final Model<ArrayList<String>> repositoriesModel = new Model<ArrayList<String>>(searchRepositories);\r
+ StatelessForm<Void> form = new StatelessForm<Void>("searchForm") {\r
+ \r
+ private static final long serialVersionUID = 1L;\r
+\r
+ @Override\r
+ public void onSubmit() {\r
+ String q = queryModel.getObject();\r
+ if (StringUtils.isEmpty(q)) {\r
+ error(getString("gb.undefinedQueryWarning"));\r
+ return;\r
+ } \r
+ if (repositoriesModel.getObject().size() == 0) {\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
+ setResponsePage(LuceneSearchPage.class, params);\r
+ }\r
+ };\r
+ \r
+ ListMultipleChoice<String> selections = new ListMultipleChoice<String>("repositories", \r
+ repositoriesModel, availableRepositories, new StringChoiceRenderer());\r
+ selections.setMaxRows(8);\r
+ form.add(selections);\r
+ form.add(new TextField<String>("query", queryModel));\r
+ add(form);\r
+ \r
+ // execute search\r
+ final List<SearchResult> results = new ArrayList<SearchResult>();\r
+ if (!ArrayUtils.isEmpty(searchRepositories) && !StringUtils.isEmpty(query)) {\r
+ results.addAll(GitBlit.self().search(query, page, pageSize, searchRepositories));\r
+ }\r
+ \r
+ // results header\r
+ if (results.size() == 0) {\r
+ add(new Label("resultsHeader").setVisible(false));\r
+ add(new Label("resultsCount").setVisible(false));\r
+ } else {\r
+ add(new Label("resultsHeader", query).setRenderBodyOnly(true));\r
+ add(new Label("resultsCount", MessageFormat.format("results {0} - {1} ({2} hits)",\r
+ results.get(0).hitId, results.get(results.size() - 1).hitId, results.get(0).totalHits)).\r
+ setRenderBodyOnly(true));\r
+ }\r
+ \r
+ // search results view\r
+ ListDataProvider<SearchResult> resultsDp = new ListDataProvider<SearchResult>(results);\r
+ final DataView<SearchResult> resultsView = new DataView<SearchResult>("searchResults", resultsDp) {\r
+ private static final long serialVersionUID = 1L;\r
+ public void populateItem(final Item<SearchResult> item) {\r
+ SearchResult sr = item.getModelObject();\r
+ switch(sr.type) {\r
+ case commit: {\r
+ Label icon = WicketUtils.newIcon("type", "icon-refresh");\r
+ WicketUtils.setHtmlTooltip(icon, "commit");\r
+ item.add(icon);\r
+ item.add(new LinkPanel("summary", null, sr.summary, CommitPage.class, WicketUtils.newObjectParameter(sr.repository, sr.commitId)));\r
+ break;\r
+ }\r
+ case blob: {\r
+ Label icon = WicketUtils.newIcon("type", "icon-file");\r
+ WicketUtils.setHtmlTooltip(icon, "blob");\r
+ item.add(icon);\r
+ item.add(new LinkPanel("summary", null, sr.path, BlobPage.class, WicketUtils.newPathParameter(sr.repository, sr.branch, sr.path)));\r
+ break;\r
+ }\r
+ case issue: {\r
+ Label icon = WicketUtils.newIcon("type", "icon-file");\r
+ WicketUtils.setHtmlTooltip(icon, "issue");\r
+ item.add(icon);\r
+ item.add(new Label("summary", "issue: " + sr.issueId));\r
+ break;\r
+ }\r
+ }\r
+ item.add(new Label("fragment", sr.fragment).setEscapeModelStrings(false).setVisible(!StringUtils.isEmpty(sr.fragment)));\r
+ item.add(new LinkPanel("repository", null, sr.repository, SummaryPage.class, WicketUtils.newRepositoryParameter(sr.repository)));\r
+ if (StringUtils.isEmpty(sr.branch)) {\r
+ item.add(new Label("branch", "null"));\r
+ } else {\r
+ item.add(new LinkPanel("branch", "branch", StringUtils.getRelativePath(Constants.R_HEADS, sr.branch), LogPage.class, WicketUtils.newObjectParameter(sr.repository, sr.branch)));\r
+ }\r
+ item.add(new Label("author", sr.author));\r
+ item.add(WicketUtils.createDatestampLabel("date", sr.date, getTimeZone()));\r
+ }\r
+ };\r
+ add(resultsView.setVisible(results.size() > 0));\r
+ \r
+ PageParameters pagerParams = new PageParameters();\r
+ pagerParams.put("repositories", StringUtils.flattenStrings(repositoriesModel.getObject()));\r
+ pagerParams.put("query", queryModel.getObject());\r
+ \r
+ int totalPages = 0;\r
+ if (results.size() > 0) {\r
+ totalPages = (results.get(0).totalHits / pageSize) + (results.get(0).totalHits % pageSize > 0 ? 1 : 0);\r
+ }\r
+ \r
+ add(new PagerPanel("topPager", page, totalPages, LuceneSearchPage.class, pagerParams));\r
+ add(new PagerPanel("bottomPager", page, totalPages, LuceneSearchPage.class, pagerParams));\r
+ }\r
+ \r
+// private String buildPager(int currentPage, int count, int total) {\r
+// int pages = (total / count) + (total % count == 0 ? 0 : 1);\r
+// \r
+// // pages are 1-indexed\r
+// // previous page link\r
+// if (currentPage <= 1) {\r
+// sb.append(MessageFormat.format(li, "disabled", "#", "←"));\r
+// } else {\r
+// List<String> parameters = new ArrayList<String>();\r
+// if (!StringUtils.isEmpty(penString)) {\r
+// parameters.add(penString);\r
+// }\r
+// parameters.add(MessageFormat.format(pg, currentPage - 1));\r
+// sb.append(MessageFormat.format(li, "", StringUtils.flattenStrings(parameters, "&"), "←"));\r
+// }\r
+//\r
+// // page links in middle\r
+// int minpage = Math.max(1, currentPage - Math.min(2, 2));\r
+// int maxpage = Math.min(pages, minpage + 4);\r
+// for (int i = minpage; i <= maxpage; i++) {\r
+// String cssClass = "";\r
+// if (i == currentPage) {\r
+// cssClass = "active";\r
+// }\r
+// List<String> parameters = new ArrayList<String>();\r
+// if (!StringUtils.isEmpty(penString)) {\r
+// parameters.add(penString);\r
+// }\r
+// parameters.add(MessageFormat.format(pg, i));\r
+// sb.append(MessageFormat.format(li, cssClass, StringUtils.flattenStrings(parameters, "&"), i));\r
+// }\r
+//\r
+// // next page link\r
+// if (currentPage == pages) {\r
+// sb.append(MessageFormat.format(li, "disabled", "#", "→"));\r
+// } else {\r
+// List<String> parameters = new ArrayList<String>();\r
+// if (!StringUtils.isEmpty(penString)) {\r
+// parameters.add(penString);\r
+// }\r
+// parameters.add(MessageFormat.format(pg, currentPage + 1));\r
+// sb.append(MessageFormat.format(li, "", StringUtils.flattenStrings(parameters, "&"), "→"));\r
+// }\r
+// return sb.toString();\r
+// }\r
+\r
+}\r
import com.gitblit.PagesServlet;\r
import com.gitblit.SyndicationServlet;\r
import com.gitblit.models.RepositoryModel;\r
+import com.gitblit.utils.ArrayUtils;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
import com.gitblit.utils.TicgitUtils;\r
-import com.gitblit.wicket.GitBlitWebApp;\r
import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.PageRegistration;\r
import com.gitblit.wicket.PageRegistration.OtherPageLink;\r
\r
protected Component createPersonPanel(String wicketId, PersonIdent identity,\r
Constants.SearchType searchType) {\r
- GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();\r
- final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();\r
String name = identity == null ? "" : identity.getName();\r
String address = identity == null ? "" : identity.getEmailAddress();\r
boolean showEmail = GitBlit.getBoolean(Keys.web.showEmailAddresses, false);\r
}\r
}\r
Fragment partial = new Fragment(wicketId, "partialPersonIdent", this);\r
- LinkPanel link = new LinkPanel("personName", "list", value, searchPageClass,\r
+ LinkPanel link = new LinkPanel("personName", "list", value, GitSearchPage.class,\r
WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType));\r
setPersonSearchTooltip(link, value, searchType);\r
partial.add(link);\r
return partial;\r
} else {\r
Fragment fullPerson = new Fragment(wicketId, "fullPersonIdent", this);\r
- LinkPanel nameLink = new LinkPanel("personName", "list", name, searchPageClass,\r
+ LinkPanel nameLink = new LinkPanel("personName", "list", name, GitSearchPage.class,\r
WicketUtils.newSearchParameter(repositoryName, objectId, name, searchType));\r
setPersonSearchTooltip(nameLink, name, searchType);\r
fullPerson.add(nameLink);\r
\r
LinkPanel addressLink = new LinkPanel("personAddress", "list", "<" + address + ">",\r
- searchPageClass, WicketUtils.newSearchParameter(repositoryName, objectId,\r
+ GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,\r
address, searchType));\r
setPersonSearchTooltip(addressLink, address, searchType);\r
fullPerson.add(addressLink);\r
break;\r
}\r
}\r
- GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();\r
- setResponsePage(app.getSearchPageClass(),\r
+ Class<? extends BasePage> searchPageClass = GitSearchPage.class;\r
+ RepositoryModel model = GitBlit.self().getRepositoryModel(repositoryName);\r
+ if (!ArrayUtils.isEmpty(model.indexedBranches)) {\r
+ // this repository is Lucene-indexed\r
+ searchPageClass = LuceneSearchPage.class;\r
+ }\r
+ setResponsePage(searchPageClass,\r
WicketUtils.newSearchParameter(repositoryName, null, searchString, searchType));\r
}\r
}\r
getRootPageParameters()));\r
pages.add(new PageRegistration("gb.activity", ActivityPage.class, getRootPageParameters()));\r
if (GitBlit.getBoolean(Keys.lucene.enable, false)) {\r
- pages.add(new PageRegistration("gb.search", LucenePage.class));\r
+ pages.add(new PageRegistration("gb.search", LuceneSearchPage.class));\r
}\r
if (showAdmin) {\r
pages.add(new PageRegistration("gb.users", UsersPage.class));\r
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\r
-<html xmlns="http://www.w3.org/1999/xhtml" \r
- xmlns:wicket="http://wicket.apache.org/dtds.data/wicket-xhtml1.3-strict.dtd" \r
- xml:lang="en" \r
- lang="en"> \r
-\r
-<body>\r
-<wicket:extend>\r
-\r
- <!-- pager links -->\r
- <div style="padding-top:5px;">\r
- <a wicket:id="firstPageTop"><wicket:message key="gb.pageFirst"></wicket:message></a> | <a wicket:id="prevPageTop"><wicket:message key="gb.pagePrevious"></wicket:message></a> | <a wicket:id="nextPageTop"><wicket:message key="gb.pageNext"></wicket:message></a> \r
- </div>\r
- \r
- <!-- history -->\r
- <div style="margin-top:5px;" wicket:id="searchPanel">[search panel]</div>\r
-\r
- <!-- pager links -->\r
- <div style="padding-bottom:5px;">\r
- <a wicket:id="firstPageBottom"><wicket:message key="gb.pageFirst"></wicket:message></a> | <a wicket:id="prevPageBottom"><wicket:message key="gb.pagePrevious"></wicket:message></a> | <a wicket:id="nextPageBottom"><wicket:message key="gb.pageNext"></wicket:message></a> \r
- </div>\r
-\r
-</wicket:extend>\r
-</body>\r
-</html>
\ No newline at end of file
+++ /dev/null
-/*\r
- * Copyright 2011 gitblit.com.\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package com.gitblit.wicket.pages;\r
-\r
-import org.apache.wicket.PageParameters;\r
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;\r
-\r
-import com.gitblit.Constants;\r
-import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.panels.SearchPanel;\r
-\r
-public class SearchPage extends RepositoryPage {\r
-\r
- public SearchPage(PageParameters params) {\r
- super(params);\r
-\r
- String value = WicketUtils.getSearchString(params);\r
- String type = WicketUtils.getSearchType(params);\r
- Constants.SearchType searchType = Constants.SearchType.forName(type);\r
-\r
- int pageNumber = WicketUtils.getPage(params);\r
- int prevPage = Math.max(0, pageNumber - 1);\r
- int nextPage = pageNumber + 1;\r
-\r
- SearchPanel search = new SearchPanel("searchPanel", repositoryName, objectId, value,\r
- searchType, getRepository(), -1, pageNumber - 1);\r
- boolean hasMore = search.hasMore();\r
- add(search);\r
-\r
- add(new BookmarkablePageLink<Void>("firstPageTop", SearchPage.class,\r
- WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))\r
- .setEnabled(pageNumber > 1));\r
- add(new BookmarkablePageLink<Void>("prevPageTop", SearchPage.class,\r
- WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
- prevPage)).setEnabled(pageNumber > 1));\r
- add(new BookmarkablePageLink<Void>("nextPageTop", SearchPage.class,\r
- WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
- nextPage)).setEnabled(hasMore));\r
-\r
- add(new BookmarkablePageLink<Void>("firstPageBottom", SearchPage.class,\r
- WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType))\r
- .setEnabled(pageNumber > 1));\r
- add(new BookmarkablePageLink<Void>("prevPageBottom", SearchPage.class,\r
- WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
- prevPage)).setEnabled(pageNumber > 1));\r
- add(new BookmarkablePageLink<Void>("nextPageBottom", SearchPage.class,\r
- WicketUtils.newSearchParameter(repositoryName, objectId, value, searchType,\r
- nextPage)).setEnabled(hasMore));\r
-\r
- }\r
-\r
- @Override\r
- protected String getPageName() {\r
- return getString("gb.search");\r
- }\r
-}\r
import com.gitblit.models.Activity;\r
import com.gitblit.models.Activity.RepositoryCommit;\r
import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.GitBlitWebApp;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.pages.BasePage;\r
import com.gitblit.wicket.pages.CommitDiffPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.LogPage;\r
-import com.gitblit.wicket.pages.SearchPage;\r
+import com.gitblit.wicket.pages.GitSearchPage;\r
import com.gitblit.wicket.pages.SummaryPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
\r
Collections.sort(recentActivity);\r
\r
- GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();\r
- final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();\r
-\r
DataView<Activity> activityView = new DataView<Activity>("activity",\r
new ListDataProvider<Activity>(recentActivity)) {\r
private static final long serialVersionUID = 1L;\r
// author search link\r
String author = commit.getAuthorIdent().getName();\r
LinkPanel authorLink = new LinkPanel("author", "list", author,\r
- searchPageClass, WicketUtils.newSearchParameter(commit.repository,\r
+ GitSearchPage.class, WicketUtils.newSearchParameter(commit.repository,\r
commit.getName(), author, Constants.SearchType.AUTHOR), true);\r
setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);\r
fragment.add(authorLink);\r
import com.gitblit.models.RepositoryModel;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.GitBlitWebApp;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.pages.BasePage;\r
import com.gitblit.wicket.pages.BranchesPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.LogPage;\r
import com.gitblit.wicket.pages.MetricsPage;\r
-import com.gitblit.wicket.pages.SearchPage;\r
+import com.gitblit.wicket.pages.GitSearchPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
public class BranchesPanel extends BasePanel {\r
add(new Label("branches", new StringResourceModel("gb.branches", this, null)));\r
}\r
\r
- GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();\r
- final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();\r
-\r
ListDataProvider<RefModel> branchesDp = new ListDataProvider<RefModel>(branches);\r
DataView<RefModel> branchesView = new DataView<RefModel>("branch", branchesDp) {\r
private static final long serialVersionUID = 1L;\r
\r
String author = entry.getAuthorIdent().getName();\r
LinkPanel authorLink = new LinkPanel("branchAuthor", "list", author,\r
- searchPageClass, WicketUtils.newSearchParameter(model.name,\r
+ GitSearchPage.class, WicketUtils.newSearchParameter(model.name,\r
entry.getName(), author, Constants.SearchType.AUTHOR));\r
setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);\r
item.add(authorLink);\r
import com.gitblit.models.RefModel;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.GitBlitWebApp;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.pages.BasePage;\r
import com.gitblit.wicket.pages.BlobDiffPage;\r
import com.gitblit.wicket.pages.BlobPage;\r
import com.gitblit.wicket.pages.CommitDiffPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.HistoryPage;\r
-import com.gitblit.wicket.pages.SearchPage;\r
+import com.gitblit.wicket.pages.GitSearchPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
public class HistoryPanel extends BasePanel {\r
// breadcrumbs\r
add(new PathBreadcrumbsPanel("breadcrumbs", repositoryName, path, objectId));\r
\r
- GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();\r
- final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();\r
-\r
ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);\r
DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {\r
private static final long serialVersionUID = 1L;\r
// author search link\r
String author = entry.getAuthorIdent().getName();\r
LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,\r
- searchPageClass, WicketUtils.newSearchParameter(repositoryName, objectId,\r
+ GitSearchPage.class,\r
+ WicketUtils.newSearchParameter(repositoryName, objectId,\r
author, Constants.SearchType.AUTHOR));\r
setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);\r
item.add(authorLink);\r
import com.gitblit.models.RefModel;\r
import com.gitblit.utils.JGitUtils;\r
import com.gitblit.utils.StringUtils;\r
-import com.gitblit.wicket.GitBlitWebApp;\r
-import com.gitblit.wicket.GitBlitWebSession;\r
import com.gitblit.wicket.WicketUtils;\r
-import com.gitblit.wicket.pages.BasePage;\r
import com.gitblit.wicket.pages.CommitDiffPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
import com.gitblit.wicket.pages.LogPage;\r
-import com.gitblit.wicket.pages.SearchPage;\r
+import com.gitblit.wicket.pages.GitSearchPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
public class LogPanel extends BasePanel {\r
WicketUtils.newRepositoryParameter(repositoryName)));\r
}\r
\r
- GitBlitWebApp app = (GitBlitWebApp) GitBlitWebSession.get().getApplication();\r
- final Class<? extends BasePage> searchPageClass = app.getSearchPageClass();\r
-\r
ListDataProvider<RevCommit> dp = new ListDataProvider<RevCommit>(commits);\r
DataView<RevCommit> logView = new DataView<RevCommit>("commit", dp) {\r
private static final long serialVersionUID = 1L;\r
// author search link\r
String author = entry.getAuthorIdent().getName();\r
LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,\r
- searchPageClass, WicketUtils.newSearchParameter(repositoryName, objectId,\r
- author, Constants.SearchType.AUTHOR));\r
+ GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName,\r
+ objectId, author, Constants.SearchType.AUTHOR));\r
setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);\r
item.add(authorLink);\r
\r
import com.gitblit.wicket.WicketUtils;\r
import com.gitblit.wicket.pages.CommitDiffPage;\r
import com.gitblit.wicket.pages.CommitPage;\r
-import com.gitblit.wicket.pages.SearchPage;\r
+import com.gitblit.wicket.pages.GitSearchPage;\r
import com.gitblit.wicket.pages.TreePage;\r
\r
public class SearchPanel extends BasePanel {\r
// author search link\r
String author = entry.getAuthorIdent().getName();\r
LinkPanel authorLink = new LinkPanel("commitAuthor", "list", author,\r
- SearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,\r
+ GitSearchPage.class, WicketUtils.newSearchParameter(repositoryName, objectId,\r
author, Constants.SearchType.AUTHOR));\r
setPersonSearchTooltip(authorLink, author, Constants.SearchType.AUTHOR);\r
item.add(authorLink);\r