| | |
| | | package com.gitblit.wicket;
|
| | |
|
| | | import java.text.DateFormat;
|
| | | import java.text.MessageFormat;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.Collection;
|
| | | import java.util.Date;
|
| | |
| | |
|
| | | public static void setCssStyle(Component container, String value) {
|
| | | container.add(new SimpleAttributeModifier("style", value));
|
| | | }
|
| | |
|
| | | public static void setCssBackground(Component container, String value) {
|
| | | String background = MessageFormat.format("background-color:{0};",
|
| | | StringUtils.getColor(value));
|
| | | container.add(new SimpleAttributeModifier("style", background));
|
| | | }
|
| | |
|
| | | public static void setHtmlTooltip(Component container, String value) {
|
| | |
| | | filename = "bullet_white.png";
|
| | | break;
|
| | | case PENDING:
|
| | | case NOCHANGE: |
| | | case NOCHANGE:
|
| | | default:
|
| | | filename = "bullet_black.png";
|
| | | }
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | |
| | |
|
| | | public static PageParameters newTokenParameter(String token) {
|
| | | return new PageParameters("t=" + token);
|
| | | }
|
| | | |
| | |
|
| | | public static PageParameters newRegistrationParameter(String url, String name) {
|
| | | return new PageParameters("u=" + url + ",n=" + name);
|
| | | }
|
| | |
|
| | | public static PageParameters newUsernameParameter(String username) {
|
| | | return new PageParameters("user=" + username);
|
| | | }
|
| | |
|
| | | public static PageParameters newTeamnameParameter(String teamname) {
|
| | | return new PageParameters("team=" + teamname);
|
| | | }
|
| | |
|
| | | public static PageParameters newRepositoryParameter(String repositoryName) {
|
| | |
| | | if (StringUtils.isEmpty(objectId)) {
|
| | | return new PageParameters("r=" + repositoryName + ",f=" + path + ",pg=" + pageNumber);
|
| | | }
|
| | | return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",f=" + path
|
| | | + ",pg=" + pageNumber);
|
| | | return new PageParameters("r=" + repositoryName + ",h=" + objectId + ",f=" + path + ",pg="
|
| | | + pageNumber);
|
| | | }
|
| | |
|
| | | public static PageParameters newBlobDiffParameter(String repositoryName, String baseCommitId,
|
| | |
| | | return params.getInt("pg", 1);
|
| | | }
|
| | |
|
| | | public static String getRegEx(PageParameters params) {
|
| | | return params.getString("x", "");
|
| | | }
|
| | |
|
| | | public static String getSet(PageParameters params) {
|
| | | return params.getString("set", "");
|
| | | }
|
| | |
|
| | | public static String getTeam(PageParameters params) {
|
| | | return params.getString("team", "");
|
| | | }
|
| | |
|
| | | public static int getDaysBack(PageParameters params) {
|
| | |
| | | return params.getString("user", "");
|
| | | }
|
| | |
|
| | | public static String getTeamname(PageParameters params) {
|
| | | return params.getString("team", "");
|
| | | }
|
| | |
|
| | | public static String getToken(PageParameters params) {
|
| | | return params.getString("t", "");
|
| | | }
|
| | | |
| | |
|
| | | public static String getUrlParameter(PageParameters params) {
|
| | | return params.getString("u", "");
|
| | | }
|
| | |
| | | }
|
| | | return label;
|
| | | }
|
| | | |
| | |
|
| | | public static Label createTimeLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | String format = GitBlit.getString(Keys.web.timeFormat, "HH:mm");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | |
| | | }
|
| | | return label;
|
| | | }
|
| | | |
| | |
|
| | | public static Label createDatestampLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | String format = GitBlit.getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | |
| | | dateString = df.format(date);
|
| | | }
|
| | | String title = null;
|
| | | if (date.getTime() <= System.currentTimeMillis()) {
|
| | | if (TimeUtils.isToday(date)) {
|
| | | title = "today";
|
| | | } else if (TimeUtils.isYesterday(date)) {
|
| | | title = "yesterday";
|
| | | } else if (date.getTime() <= System.currentTimeMillis()) {
|
| | | // past
|
| | | title = TimeUtils.timeAgo(date);
|
| | | }
|