| | |
| | | import org.wicketstuff.googlecharts.AbstractChartData;
|
| | | import org.wicketstuff.googlecharts.IChartData;
|
| | |
|
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.Constants.FederationPullStatus;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.FederationModel;
|
| | | import com.gitblit.models.Metric;
|
| | | import com.gitblit.utils.HttpUtils;
|
| | | import com.gitblit.utils.JGitUtils.SearchType;
|
| | | import com.gitblit.utils.StringUtils;
|
| | | import com.gitblit.utils.TimeUtils;
|
| | |
|
| | |
| | | public static void setTicketCssClass(Component container, String state) {
|
| | | String css = null;
|
| | | if (state.equals("open")) {
|
| | | css = "bug_open";
|
| | | css = "label important";
|
| | | } else if (state.equals("hold")) {
|
| | | css = "bug_hold";
|
| | | css = "label warning";
|
| | | } else if (state.equals("resolved")) {
|
| | | css = "bug_resolved";
|
| | | css = "label success";
|
| | | } else if (state.equals("invalid")) {
|
| | | css = "bug_invalid";
|
| | | css = "label";
|
| | | }
|
| | | if (css != null) {
|
| | | setCssClass(container, css);
|
| | |
| | | }
|
| | |
|
| | | public static void setAlternatingBackground(Component c, int i) {
|
| | | String clazz = i % 2 == 0 ? "dark" : "light";
|
| | | String clazz = i % 2 == 0 ? "light" : "dark";
|
| | | setCssClass(c, clazz);
|
| | | }
|
| | |
|
| | |
| | | return new ContextRelativeResource(file);
|
| | | }
|
| | |
|
| | | public static String getHostURL(Request request) {
|
| | | public static String getGitblitURL(Request request) {
|
| | | HttpServletRequest req = ((WebRequest) request).getHttpServletRequest();
|
| | | return HttpUtils.getHostURL(req);
|
| | | return HttpUtils.getGitblitURL(req);
|
| | | }
|
| | |
|
| | | public static HeaderContributor syndicationDiscoveryLink(final String feedTitle,
|
| | |
| | | return newObjectParameter(repositoryName, objectId);
|
| | | }
|
| | | if (StringUtils.isEmpty(objectId)) {
|
| | | return new PageParameters("r=" + repositoryName + ",page=" + pageNumber);
|
| | | return new PageParameters("r=" + repositoryName + ",pg=" + pageNumber);
|
| | | }
|
| | | return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",page=" + pageNumber);
|
| | | return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",pg=" + pageNumber);
|
| | | }
|
| | |
|
| | | public static PageParameters newHistoryPageParameter(String repositoryName, String objectId,
|
| | |
| | | return newObjectParameter(repositoryName, objectId);
|
| | | }
|
| | | if (StringUtils.isEmpty(objectId)) {
|
| | | return new PageParameters("r=" + repositoryName + ",f=" + path + ",page=" + pageNumber);
|
| | | return new PageParameters("r=" + repositoryName + ",f=" + path + ",pg=" + pageNumber);
|
| | | }
|
| | | return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",f=" + path
|
| | | + ",page=" + pageNumber);
|
| | | + ",pg=" + pageNumber);
|
| | | }
|
| | |
|
| | | public static PageParameters newBlobDiffParameter(String repositoryName, String baseCommitId,
|
| | |
| | | }
|
| | |
|
| | | public static PageParameters newSearchParameter(String repositoryName, String commitId,
|
| | | String search, SearchType type) {
|
| | | String search, Constants.SearchType type) {
|
| | | if (StringUtils.isEmpty(commitId)) {
|
| | | return new PageParameters("r=" + repositoryName + ",s=" + search + ",st=" + type.name());
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static PageParameters newSearchParameter(String repositoryName, String commitId,
|
| | | String search, SearchType type, int pageNumber) {
|
| | | String search, Constants.SearchType type, int pageNumber) {
|
| | | if (StringUtils.isEmpty(commitId)) {
|
| | | return new PageParameters("r=" + repositoryName + ",s=" + search + ",st=" + type.name()
|
| | | + ",page=" + pageNumber);
|
| | | + ",pg=" + pageNumber);
|
| | | }
|
| | | return new PageParameters("r=" + repositoryName + ",h=" + commitId + ",s=" + search
|
| | | + ",st=" + type.name() + ",page=" + pageNumber);
|
| | | + ",st=" + type.name() + ",pg=" + pageNumber);
|
| | | }
|
| | |
|
| | | public static String getRepositoryName(PageParameters params) {
|
| | |
| | |
|
| | | public static int getPage(PageParameters params) {
|
| | | // index from 1
|
| | | return params.getInt("page", 1);
|
| | | return params.getInt("pg", 1);
|
| | | }
|
| | |
|
| | | public static String getUsername(PageParameters params) {
|