| | |
| | | public static void setTicketCssClass(Component container, String state) {
|
| | | String css = null;
|
| | | if (state.equals("open")) {
|
| | | css = "label important";
|
| | | css = "label label-important";
|
| | | } else if (state.equals("hold")) {
|
| | | css = "label warning";
|
| | | css = "label label-warning";
|
| | | } else if (state.equals("resolved")) {
|
| | | css = "label success";
|
| | | css = "label label-success";
|
| | | } else if (state.equals("invalid")) {
|
| | | css = "label";
|
| | | }
|
| | |
| | | return img;
|
| | | }
|
| | |
|
| | | public static Label newIcon(String wicketId, String css) {
|
| | | Label lbl = new Label(wicketId);
|
| | | setCssClass(lbl, css); |
| | | return lbl;
|
| | | }
|
| | | |
| | | public static Label newBlankIcon(String wicketId) {
|
| | | Label lbl = new Label(wicketId);
|
| | | setCssClass(lbl, "");
|
| | | lbl.setRenderBodyOnly(true);
|
| | | return lbl;
|
| | | }
|
| | | |
| | | public static ContextRelativeResource getResource(String file) {
|
| | | return new ContextRelativeResource(file);
|
| | | }
|
| | |
| | |
|
| | | 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) {
|
| | |
| | | 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) {
|
| | |
| | |
|
| | | public static String getUsername(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("n", "");
|
| | | }
|
| | |
|
| | | public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
|
| | | String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone != null) {
|
| | | df.setTimeZone(timeZone);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String dateString;
|
| | | if (date.getTime() == 0) {
|
| | | dateString = "--";
|
| | |
| | | String title = null;
|
| | | if (date.getTime() <= System.currentTimeMillis()) {
|
| | | // past
|
| | | title = TimeUtils.timeAgo(date);
|
| | | title = timeUtils.timeAgo(date);
|
| | | }
|
| | | if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) {
|
| | | String tmp = dateString;
|
| | |
| | | title = tmp;
|
| | | }
|
| | | Label label = new Label(wicketId, dateString);
|
| | | WicketUtils.setCssClass(label, TimeUtils.timeAgoCss(date));
|
| | | WicketUtils.setCssClass(label, timeUtils.timeAgoCss(date));
|
| | | if (!StringUtils.isEmpty(title)) {
|
| | | WicketUtils.setHtmlTooltip(label, title);
|
| | | }
|
| | | return label;
|
| | | }
|
| | |
|
| | | public static Label createTimeLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | public static Label createTimeLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
|
| | | String format = GitBlit.getString(Keys.web.timeFormat, "HH:mm");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone != null) {
|
| | | df.setTimeZone(timeZone);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String timeString;
|
| | | if (date.getTime() == 0) {
|
| | | timeString = "--";
|
| | | } else {
|
| | | timeString = df.format(date);
|
| | | }
|
| | | String title = TimeUtils.timeAgo(date);
|
| | | String title = timeUtils.timeAgo(date);
|
| | | Label label = new Label(wicketId, timeString);
|
| | | WicketUtils.setCssClass(label, TimeUtils.timeAgoCss(date));
|
| | | if (!StringUtils.isEmpty(title)) {
|
| | | WicketUtils.setHtmlTooltip(label, title);
|
| | | }
|
| | | return label;
|
| | | }
|
| | |
|
| | | public static Label createDatestampLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | public static Label createDatestampLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
|
| | | String format = GitBlit.getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone != null) {
|
| | | df.setTimeZone(timeZone);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String dateString;
|
| | | if (date.getTime() == 0) {
|
| | | dateString = "--";
|
| | |
| | | dateString = df.format(date);
|
| | | }
|
| | | String title = null;
|
| | | if (date.getTime() <= System.currentTimeMillis()) {
|
| | | if (TimeUtils.isToday(date)) {
|
| | | title = timeUtils.today();
|
| | | } else if (TimeUtils.isYesterday(date)) {
|
| | | title = timeUtils.yesterday();
|
| | | } else if (date.getTime() <= System.currentTimeMillis()) {
|
| | | // past
|
| | | title = TimeUtils.timeAgo(date);
|
| | | title = timeUtils.timeAgo(date);
|
| | | }
|
| | | if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) {
|
| | | String tmp = dateString;
|
| | |
| | | title = tmp;
|
| | | }
|
| | | Label label = new Label(wicketId, dateString);
|
| | | WicketUtils.setCssClass(label, TimeUtils.timeAgoCss(date));
|
| | | if (!StringUtils.isEmpty(title)) {
|
| | | WicketUtils.setHtmlTooltip(label, title);
|
| | | }
|
| | | return label;
|
| | | }
|
| | |
|
| | | public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone) {
|
| | | public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
|
| | | String format = GitBlit.getString(Keys.web.datetimestampLongFormat,
|
| | | "EEEE, MMMM d, yyyy h:mm a z");
|
| | | "EEEE, MMMM d, yyyy HH:mm Z");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone != null) {
|
| | | df.setTimeZone(timeZone);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String dateString;
|
| | | if (date.getTime() == 0) {
|
| | | dateString = "--";
|
| | |
| | | String title = null;
|
| | | if (date.getTime() <= System.currentTimeMillis()) {
|
| | | // past
|
| | | title = TimeUtils.timeAgo(date);
|
| | | title = timeUtils.timeAgo(date);
|
| | | }
|
| | | Label label = new Label(wicketId, dateString);
|
| | | if (!StringUtils.isEmpty(title)) {
|