| | |
| | | import java.util.Collection;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.TimeZone;
|
| | |
|
| | |
| | | import com.gitblit.Constants;
|
| | | import com.gitblit.Constants.AccessPermission;
|
| | | import com.gitblit.Constants.FederationPullStatus;
|
| | | import com.gitblit.GitBlit;
|
| | | import com.gitblit.Keys;
|
| | | import com.gitblit.models.FederationModel;
|
| | | import com.gitblit.models.Metric;
|
| | |
| | | return newImage(wicketId, "file_settings_16x16.png");
|
| | | }
|
| | |
|
| | | List<String> mdExtensions = GitBlit.getStrings(Keys.web.markdownExtensions);
|
| | | for (String ext : mdExtensions) {
|
| | | if (filename.endsWith('.' + ext.toLowerCase())) {
|
| | | return newImage(wicketId, "file_world_16x16.png");
|
| | | }
|
| | | MarkupProcessor processor = new MarkupProcessor(GitBlitWebApp.get().settings());
|
| | | String ext = StringUtils.getFileExtension(filename).toLowerCase();
|
| | | if (processor.getMarkupExtensions().contains(ext)) {
|
| | | return newImage(wicketId, "file_world_16x16.png");
|
| | | }
|
| | | return newImage(wicketId, "file_16x16.png");
|
| | | }
|
| | |
| | | return new PageParameters(parameterMap);
|
| | | }
|
| | |
|
| | | public static PageParameters newBlameTypeParameter(String repositoryName,
|
| | | String commitId, String path, String blameType) {
|
| | | Map<String, String> parameterMap = new HashMap<String, String>();
|
| | | parameterMap.put("r", repositoryName);
|
| | | parameterMap.put("h", commitId);
|
| | | parameterMap.put("f", path);
|
| | | parameterMap.put("blametype", blameType);
|
| | | return new PageParameters(parameterMap);
|
| | | }
|
| | |
|
| | | public static String getProjectName(PageParameters params) {
|
| | | return params.getString("p", "");
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils, boolean setCss) {
|
| | | String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy");
|
| | | String format = GitBlitWebApp.get().settings().getString(Keys.web.datestampShortFormat, "MM/dd/yy");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | timeZone = GitBlitWebApp.get().getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String dateString;
|
| | |
| | | // past
|
| | | title = timeUtils.timeAgo(date);
|
| | | }
|
| | | if ((System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) {
|
| | | if (title != null && (System.currentTimeMillis() - date.getTime()) < 10 * 24 * 60 * 60 * 1000L) {
|
| | | String tmp = dateString;
|
| | | dateString = title;
|
| | | title = tmp;
|
| | |
| | | }
|
| | |
|
| | | public static Label createTimeLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
|
| | | String format = GitBlit.getString(Keys.web.timeFormat, "HH:mm");
|
| | | String format = GitBlitWebApp.get().settings().getString(Keys.web.timeFormat, "HH:mm");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | timeZone = GitBlitWebApp.get().getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String timeString;
|
| | |
| | | }
|
| | |
|
| | | public static Label createDatestampLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
|
| | | String format = GitBlit.getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");
|
| | | String format = GitBlitWebApp.get().settings().getString(Keys.web.datestampLongFormat, "EEEE, MMMM d, yyyy");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | timeZone = GitBlitWebApp.get().getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String dateString;
|
| | |
| | | }
|
| | |
|
| | | public static Label createTimestampLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
|
| | | String format = GitBlit.getString(Keys.web.datetimestampLongFormat,
|
| | | String format = GitBlitWebApp.get().settings().getString(Keys.web.datetimestampLongFormat,
|
| | | "EEEE, MMMM d, yyyy HH:mm Z");
|
| | | DateFormat df = new SimpleDateFormat(format);
|
| | | if (timeZone == null) {
|
| | | timeZone = GitBlit.getTimezone();
|
| | | timeZone = GitBlitWebApp.get().getTimezone();
|
| | | }
|
| | | df.setTimeZone(timeZone);
|
| | | String dateString;
|