James Moger
2013-11-26 4fcac9d2cbdafb51e3ee9ca3b3da64fd86103174
src/main/java/com/gitblit/wicket/WicketUtils.java
@@ -21,7 +21,6 @@
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
@@ -95,22 +94,6 @@
      }
   }
   public static void setTicketCssClass(Component container, String state) {
      String css = null;
      if (state.equals("open")) {
         css = "label label-important";
      } else if (state.equals("hold")) {
         css = "label label-warning";
      } else if (state.equals("resolved")) {
         css = "label label-success";
      } else if (state.equals("invalid")) {
         css = "label";
      }
      if (css != null) {
         setCssClass(container, css);
      }
   }
   public static void setPermissionClass(Component container, AccessPermission permission) {
      if (permission == null) {
         setCssClass(container, "badge");
@@ -131,7 +114,7 @@
      default:
         setCssClass(container, "badge");
         break;
      }
      }
   }
   public static void setAlternatingBackground(Component c, int i) {
@@ -206,11 +189,10 @@
         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(GitBlit.getSettings());
      String ext = StringUtils.getFileExtension(filename).toLowerCase();
      if (processor.getMarkupExtensions().contains(ext)) {
         return newImage(wicketId, "file_world_16x16.png");
      }
      return newImage(wicketId, "file_16x16.png");
   }
@@ -248,17 +230,17 @@
   public static Label newIcon(String wicketId, String css) {
      Label lbl = new Label(wicketId);
      setCssClass(lbl, css);
      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);
   }
@@ -273,6 +255,7 @@
      return new HeaderContributor(new IHeaderContributor() {
         private static final long serialVersionUID = 1L;
         @Override
         public void renderHead(IHeaderResponse response) {
            String contentType = "application/rss+xml";
@@ -523,6 +506,10 @@
   }
   public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils) {
      return createDateLabel(wicketId, date, timeZone, timeUtils, true);
   }
   public static Label createDateLabel(String wicketId, Date date, TimeZone timeZone, TimeUtils timeUtils, boolean setCss) {
      String format = GitBlit.getString(Keys.web.datestampShortFormat, "MM/dd/yy");
      DateFormat df = new SimpleDateFormat(format);
      if (timeZone == null) {
@@ -546,7 +533,9 @@
         title = tmp;
      }
      Label label = new Label(wicketId, dateString);
      WicketUtils.setCssClass(label, timeUtils.timeAgoCss(date));
      if (setCss) {
         WicketUtils.setCssClass(label, timeUtils.timeAgoCss(date));
      }
      if (!StringUtils.isEmpty(title)) {
         WicketUtils.setHtmlTooltip(label, title);
      }
@@ -652,6 +641,7 @@
      IChartData data = new AbstractChartData(max) {
         private static final long serialVersionUID = 1L;
         @Override
         public double[][] getData() {
            return new double[][] { commits, tags };
         }
@@ -687,6 +677,7 @@
      IChartData data = new AbstractChartData(max) {
         private static final long serialVersionUID = 1L;
         @Override
         public double[][] getData() {
            return new double[][] { x, y };
         }